public void Initialize() { var storage = new FileStreamStorageStrategy(); 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); _community.Subscribe(() => Individual.MessageBoards); CreateIndividual(http); // 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() { var storage = IsolatedStorageStorageStrategy.Load(); var http = new HTTPConfigurationProvider(); var communication = new BinaryHTTPAsynchronousCommunicationStrategy(http); _community = new Community(storage); _community.AddAsynchronousCommunicationStrategy(communication); _community.Register <CorrespondenceModel>(); _community.Subscribe(() => _individual); 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(); }
public void Initialize() { var storage = IsolatedStorageStorageStrategy.Load(); var http = new HTTPConfigurationProvider(); var communication = new BinaryHTTPAsynchronousCommunicationStrategy(http); _community = new Community(storage); _community.AddAsynchronousCommunicationStrategy(communication); _community.Register<CorrespondenceModel>(); _community.Subscribe(() => _individual); 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() { var storage = new FileStreamStorageStrategy(); 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); _community.Subscribe(() => Individual.MessageBoards); CreateIndividual(http); // 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() { // TODO: Uncomment these lines to choose a database storage strategy. // string correspondenceConnectionString = ConfigurationManager.ConnectionStrings["Correspondence"].ConnectionString; // var storage = new SQLStorageStrategy(correspondenceConnectionString).UpgradeDatabase(); string path = HostingEnvironment.MapPath("~/App_Data/Correspondence"); var storage = new FileStreamStorageStrategy(path); var http = new HTTPConfigurationProvider(); var communication = new BinaryHTTPAsynchronousCommunicationStrategy(http); _community = new Community(storage); _community.AddAsynchronousCommunicationStrategy(communication); _community.Register<CorrespondenceModel>(); _community.Subscribe(() => Domain); _community.ClientApp = false; LoadDomain(); // Synchronize whenever the user has something to send. _community.FactAdded += delegate { _community.BeginSending(); }; // Resume in 5 minutes if there is an error. Timer synchronizeTimer = new Timer(); synchronizeTimer.Elapsed += delegate { _community.BeginSending(); _community.BeginReceiving(); }; synchronizeTimer.Interval = 5.0 * 60.0 * 1000.0; synchronizeTimer.Start(); }
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() { _community = new Community(IsolatedStorageStorageStrategy.Load()) .Register<CorrespondenceModel>() ; _community.AddAsynchronousCommunicationStrategy(new BinaryHTTPAsynchronousCommunicationStrategy(new HttpConfigurationProvider())); _identity = _community.LoadFact<Identity>(ThisIdentity); if (_identity == null) { string randomId = Punctuation.Replace(Guid.NewGuid().ToString(), String.Empty).ToLower(); _identity = _community.AddFact(new Identity(randomId)); _community.SetFact(ThisIdentity, _identity); } _community.BeginSending(); }
public 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); _community.Subscribe(() => Individual.MessageBoards); // 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(); CreateIndividual(http); // 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() { 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); _community.Subscribe(() => Individual.MessageBoards); // 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(); CreateIndividual(http); // 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() { 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); _community.Subscribe(() => _individual.Tunes); _community.Subscribe(() => _individual.Tunes .SelectMany(t => t.Individuals)); _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() { // TODO: Uncomment these lines to choose a database storage strategy. // string correspondenceConnectionString = ConfigurationManager.ConnectionStrings["Correspondence"].ConnectionString; // var storage = new SQLStorageStrategy(correspondenceConnectionString).UpgradeDatabase(); string path = HostingEnvironment.MapPath("~/App_Data/Correspondence"); var storage = new FileStreamStorageStrategy(path); var http = new HTTPConfigurationProvider(); var communication = new BinaryHTTPAsynchronousCommunicationStrategy(http); _community = new Community(storage); _community.AddAsynchronousCommunicationStrategy(communication); _community.Register <CorrespondenceModel>(); _community.Subscribe(() => Domain); _community.ClientApp = false; LoadDomain(); // Synchronize whenever the user has something to send. _community.FactAdded += delegate { _community.BeginSending(); }; // Resume in 5 minutes if there is an error. Timer synchronizeTimer = new Timer(); synchronizeTimer.Elapsed += delegate { _community.BeginSending(); _community.BeginReceiving(); }; synchronizeTimer.Interval = 5.0 * 60.0 * 1000.0; synchronizeTimer.Start(); }
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(); }