public void Initialize() { var storage = IsolatedStorageStorageStrategy.Load(); var http = new HTTPConfigurationProvider(); var communication = new BinaryHTTPAsynchronousCommunicationStrategy(http); var notification = new WindowsPhoneNotificationStrategy(http); communication.SetNotificationStrategy(notification); _community = new Community(storage); //_community.AddAsynchronousCommunicationStrategy(communication); _community.Register<CorrespondenceModel>(); _community.Subscribe(() => _individual); _individual = _community.AddFact(new Individual(GetAnonymousUserId())); http.Individual = _individual; // Synchronize whenever the user has something to send. _community.FactAdded += delegate { Synchronize(); }; // Synchronize when the network becomes available. System.Net.NetworkInformation.NetworkChange.NetworkAddressChanged += (sender, e) => { if (NetworkInterface.GetIsNetworkAvailable()) Synchronize(); }; // And synchronize on startup or resume. Synchronize(); }
public void Initialize() { HTTPConfigurationProvider configurationProvider = new HTTPConfigurationProvider(); _community = new Community(IsolatedStorageStorageStrategy.Load()) .AddAsynchronousCommunicationStrategy(new BinaryHTTPAsynchronousCommunicationStrategy(configurationProvider)) .Register <CorrespondenceModel>() .Subscribe(() => _conference) ; _conference = _community.AddFact(new Conference(CommonSettings.ConferenceID)); // Synchronize whenever the user has something to send. _community.FactAdded += delegate { _community.BeginSending(); }; // Periodically resume if there is an error. DispatcherTimer synchronizeTimer = new DispatcherTimer(); synchronizeTimer.Tick += delegate { _community.BeginSending(); _community.BeginReceiving(); }; synchronizeTimer.Interval = TimeSpan.FromSeconds(60.0); synchronizeTimer.Start(); // And synchronize on startup. _community.BeginSending(); _community.BeginReceiving(); InitializeData(); }
public void Initialize() { var storage = IsolatedStorageStorageStrategy.Load(); var http = new HTTPConfigurationProvider(); var communication = new BinaryHTTPAsynchronousCommunicationStrategy(http); var notification = new WindowsPhoneNotificationStrategy(http); communication.SetNotificationStrategy(notification); _community = new Community(storage); //_community.AddAsynchronousCommunicationStrategy(communication); _community.Register <CorrespondenceModel>(); _community.Subscribe(() => _individual); _individual = _community.AddFact(new Individual(GetAnonymousUserId())); http.Individual = _individual; // Synchronize whenever the user has something to send. _community.FactAdded += delegate { Synchronize(); }; // Synchronize when the network becomes available. System.Net.NetworkInformation.NetworkChange.NetworkAddressChanged += (sender, e) => { if (NetworkInterface.GetIsNetworkAvailable()) { Synchronize(); } }; // And synchronize on startup or resume. Synchronize(); }
public void Initialize() { InitializeData(); HTTPConfigurationProvider configurationProvider = new HTTPConfigurationProvider(); _community = new Community(IsolatedStorageStorageStrategy.Load()) .AddAsynchronousCommunicationStrategy(new BinaryHTTPAsynchronousCommunicationStrategy(configurationProvider)) .Register<CorrespondenceModel>() .Subscribe(() => _attendee.Conference) .Subscribe(() => _individual) .Subscribe(() => _attendee.ScheduledSessions) ; Individual identity = _community.AddFact(new Individual(GetAnonymousUserId())); _attendee = identity.GetAttendee(CommonSettings.ConferenceID); configurationProvider.Individual = identity; // Synchronize whenever the user has something to send. _community.FactAdded += delegate { Synchronize(); }; // Synchronize when the network becomes available. System.Net.NetworkInformation.NetworkChange.NetworkAddressChanged += (sender, e) => { if (NetworkInterface.GetIsNetworkAvailable()) Synchronize(); }; // And synchronize on startup or resume. Synchronize(); //DataLoader.Load(conference); }
public void Initialize() { HTTPConfigurationProvider configurationProvider = new HTTPConfigurationProvider(); _community = new Community(IsolatedStorageStorageStrategy.Load()) .AddAsynchronousCommunicationStrategy(new BinaryHTTPAsynchronousCommunicationStrategy(configurationProvider)) .Register<CorrespondenceModel>() .Subscribe(() => _conference) ; _conference = _community.AddFact(new Conference(CommonSettings.ConferenceID)); // Synchronize whenever the user has something to send. _community.FactAdded += delegate { _community.BeginSending(); }; // Periodically resume if there is an error. DispatcherTimer synchronizeTimer = new DispatcherTimer(); synchronizeTimer.Tick += delegate { _community.BeginSending(); _community.BeginReceiving(); }; synchronizeTimer.Interval = TimeSpan.FromSeconds(60.0); synchronizeTimer.Start(); // And synchronize on startup. _community.BeginSending(); _community.BeginReceiving(); InitializeData(); }
public async void Initialize() { var storage = new FileStreamStorageStrategy(); var http = new HTTPConfigurationProvider(); var communication = new BinaryHTTPAsynchronousCommunicationStrategy(http); _community = new Community(storage); _community.AddAsynchronousCommunicationStrategy(communication); _community.Register <CorrespondenceModel>(); _community.Subscribe(() => _individual.Value); _community.Subscribe(() => _conference.Value); // Synchronize periodically. DispatcherTimer timer = new DispatcherTimer(); int timeoutSeconds = Math.Min(http.Configuration.TimeoutSeconds, 30); timer.Interval = TimeSpan.FromSeconds(5 * timeoutSeconds); timer.Tick += delegate(object sender, object e) { Synchronize(); }; timer.Start(); Individual individual = await _community.LoadFactAsync <Individual>(ThisIndividual); if (individual == null) { string randomId = Punctuation.Replace(Guid.NewGuid().ToString(), String.Empty).ToLower(); individual = await _community.AddFactAsync(new Individual(randomId)); await _community.SetFactAsync(ThisIndividual, individual); } var conference = await _community.AddFactAsync(new Conference(CommonSettings.ConferenceID)); lock (this) { _individual.Value = individual; _conference.Value = conference; } // Synchronize whenever the user has something to send. _community.FactAdded += delegate { Synchronize(); }; // Synchronize when the network becomes available. System.Net.NetworkInformation.NetworkChange.NetworkAddressChanged += (sender, e) => { if (NetworkInterface.GetIsNetworkAvailable()) { Synchronize(); } }; // And synchronize on startup or resume. Synchronize(); }
public async void Initialize() { var storage = new FileStreamStorageStrategy(); var http = new HTTPConfigurationProvider(); var communication = new BinaryHTTPAsynchronousCommunicationStrategy(http); _community = new Community(storage); _community.AddAsynchronousCommunicationStrategy(communication); _community.Register<CorrespondenceModel>(); _community.Subscribe(() => _individual.Value); _community.Subscribe(() => _conference.Value); // Synchronize periodically. DispatcherTimer timer = new DispatcherTimer(); int timeoutSeconds = Math.Min(http.Configuration.TimeoutSeconds, 30); timer.Interval = TimeSpan.FromSeconds(5 * timeoutSeconds); timer.Tick += delegate(object sender, object e) { Synchronize(); }; timer.Start(); Individual individual = await _community.LoadFactAsync<Individual>(ThisIndividual); if (individual == null) { string randomId = Punctuation.Replace(Guid.NewGuid().ToString(), String.Empty).ToLower(); individual = await _community.AddFactAsync(new Individual(randomId)); await _community.SetFactAsync(ThisIndividual, individual); } var conference = await _community.AddFactAsync(new Conference(CommonSettings.ConferenceID)); lock (this) { _individual.Value = individual; _conference.Value = conference; } // Synchronize whenever the user has something to send. _community.FactAdded += delegate { Synchronize(); }; // Synchronize when the network becomes available. System.Net.NetworkInformation.NetworkChange.NetworkAddressChanged += (sender, e) => { if (NetworkInterface.GetIsNetworkAvailable()) Synchronize(); }; // And synchronize on startup or resume. Synchronize(); }
public void Initialize() { InitializeData(); HTTPConfigurationProvider configurationProvider = new HTTPConfigurationProvider(); _community = new Community(IsolatedStorageStorageStrategy.Load()) .AddAsynchronousCommunicationStrategy(new BinaryHTTPAsynchronousCommunicationStrategy(configurationProvider)) .Register <CorrespondenceModel>() .Subscribe(() => _attendee.Conference) .Subscribe(() => _individual) .Subscribe(() => _attendee.ScheduledSessions) ; Individual identity = _community.AddFact(new Individual(GetAnonymousUserId())); _attendee = identity.GetAttendee(CommonSettings.ConferenceID); configurationProvider.Individual = identity; // Synchronize whenever the user has something to send. _community.FactAdded += delegate { Synchronize(); }; // Synchronize when the network becomes available. System.Net.NetworkInformation.NetworkChange.NetworkAddressChanged += (sender, e) => { if (NetworkInterface.GetIsNetworkAvailable()) { Synchronize(); } }; // And synchronize on startup or resume. Synchronize(); //DataLoader.Load(conference); }