public void Initialize() { string correspondenceDatabase = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "CorrespondenceApp", "Multinotes.Desktop", "Correspondence.sdf"); var storage = new SSCEStorageStrategy(correspondenceDatabase); var http = new HTTPConfigurationProvider(); var communication = new BinaryHTTPAsynchronousCommunicationStrategy(http); _community = new Community(storage); _community.AddAsynchronousCommunicationStrategy(communication); _community.Register<CorrespondenceModel>(); _community.Subscribe(() => Individual); _community.Subscribe(() => Individual.MessageBoards); CreateIndividual(); // 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(); }
public void Initialize() { string correspondenceDatabase = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "CorrespondenceApp", "Multinotes.Desktop", "Correspondence.sdf"); var storage = new SSCEStorageStrategy(correspondenceDatabase); var http = new HTTPConfigurationProvider(); var communication = new BinaryHTTPAsynchronousCommunicationStrategy(http); _community = new Community(storage); _community.AddAsynchronousCommunicationStrategy(communication); _community.Register <CorrespondenceModel>(); _community.Subscribe(() => Individual); _community.Subscribe(() => Individual.MessageBoards); CreateIndividual(); // 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(); }