public void Initialize()
        {
            POXConfigurationProvider configurationProvider = new POXConfigurationProvider();
            _community = new Community(IsolatedStorageStorageStrategy.Load())
                .AddAsynchronousCommunicationStrategy(new POXAsynchronousCommunicationStrategy(configurationProvider))
                .Register<CorrespondenceModel>()
                .Subscribe(() => _navigationModel.CurrentUser)
                .Subscribe(() => _navigationModel.CurrentUser.SharedClouds)
                ;

            _navigationModel.CurrentUser = _community.AddFact(new Identity("mike2"));

            // 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();
        }
Example #2
0
        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();
        }
Example #3
0
        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();
        }
Example #4
0
        public void Initialize()
        {
            POXConfigurationProvider configurationProvider = new POXConfigurationProvider();

            _community = new Community(IsolatedStorageStorageStrategy.Load())
                         .AddAsynchronousCommunicationStrategy(new POXAsynchronousCommunicationStrategy(configurationProvider))
                         .Register <CorrespondenceModel>()
                         .Subscribe(() => _navigationModel.CurrentUser)
                         .Subscribe(() => _navigationModel.CurrentUser.SharedClouds)
            ;

            _navigationModel.CurrentUser = _community.AddFact(new Identity("mike2"));

            // 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()
        {
            HTTPConfigurationProvider configurationProvider = new HTTPConfigurationProvider();
            _community = new Community(IsolatedStorageStorageStrategy.Load())
                .AddAsynchronousCommunicationStrategy(new BinaryHTTPAsynchronousCommunicationStrategy(configurationProvider))
                .Register<CorrespondenceModel>();

            _domain = _community.AddFact(new Domain("Improving Enterprises"));
            _community.Subscribe(_domain);

            // 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();
        }
Example #7
0
        static void Main(string[] args)
        {
            string    path      = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "FacetedWorlds", "MyConSurveys");
            Community community = new Community(FileStreamStorageStrategy.Load(path))
                                  .AddAsynchronousCommunicationStrategy(new BinaryHTTPAsynchronousCommunicationStrategy(new HTTPConfigurationProvider()))
                                  .Register <CorrespondenceModel>()
                                  .Subscribe(() => _conference)
                                  .Subscribe(() => _conference.AllSessionSurveys);

            _conference = community.AddFact(new Conference(CommonSettings.ConferenceID));

            Console.WriteLine("Receiving facts.");
            community.BeginReceiving();
            WaitWhileSynchronizing(community);

            var completedSurveys =
                from survey in _conference.AllSessionSurveys
                from completed in survey.Completed
                select new
            {
                SessionName = completed.SessionEvaluation.Schedule.SessionPlace.Session.Name,
                SpeakerName = completed.SessionEvaluation.Schedule.SessionPlace.Session.Speaker.Name,
                Ratings     =
                    from ratingAnswer in completed.SessionEvaluation.RatingAnswers
                    select new
                {
                    Question = ratingAnswer.Rating.Question.Text,
                    Answer   = ratingAnswer.Value
                },
                Essays =
                    from essayAnswer in completed.SessionEvaluation.EssayAnswers
                    select new
                {
                    Question = essayAnswer.Essay.Question.Text,
                    Answer   = essayAnswer.Value
                }
            };

            foreach (var completedSurvey in completedSurveys)
            {
                Console.WriteLine(completedSurvey.SessionName);
                Console.WriteLine(completedSurvey.SpeakerName);
                foreach (var rating in completedSurvey.Ratings)
                {
                    Console.WriteLine(String.Format("{0}: {1}", rating.Question, rating.Answer));
                }
                foreach (var essay in completedSurvey.Essays)
                {
                    Console.WriteLine(String.Format("{0}: {1}", essay.Question, essay.Answer));
                }
                Console.WriteLine();
            }

            Console.WriteLine("Finished.");
            Console.ReadKey();
        }
        private void LoadDomain()
        {
            _community.Perform(async delegate
            {
                var domain = await _community.AddFactAsync(new Domain());
                Domain     = domain;

                _community.BeginSending();
                _community.BeginReceiving();
            });
        }
Example #9
0
        public void Initialize()
        {
            HTTPConfigurationProvider configurationProvider = new HTTPConfigurationProvider();
            string path = Path.Combine(HostingEnvironment.MapPath("~/App_Data"), "Correspondence");

            _community = new Community(FileStreamStorageStrategy.Load(path))
                         .AddAsynchronousCommunicationStrategy(new BinaryHTTPAsynchronousCommunicationStrategy(configurationProvider))
                         .Register <CorrespondenceModel>()
                         .Subscribe(() => _conference)
            ;
            _community.ClientApp = false;

            string conferenceId = ConfigurationManager.AppSettings["ConferenceID"];

            if (string.IsNullOrEmpty(conferenceId))
            {
                conferenceId = CommonSettings.ConferenceID;
            }
            _conference = _community.AddFact(new Conference(conferenceId));

            // 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();

            // And synchronize on startup.
            _community.BeginSending();
            _community.BeginReceiving();
        }
Example #10
0
 public void Synchronize()
 {
     try
     {
         _community.BeginSending();
         _community.BeginReceiving();
     }
     catch (Exception)
     {
         // TODO: Ignore
     }
 }
Example #11
0
        static void Main(string[] args)
        {
            string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "FacetedWorlds", "MyConSurveys");
            Community community = new Community(FileStreamStorageStrategy.Load(path))
                .AddAsynchronousCommunicationStrategy(new BinaryHTTPAsynchronousCommunicationStrategy(new HTTPConfigurationProvider()))
                .Register<CorrespondenceModel>()
                .Subscribe(() => _conference)
                .Subscribe(() => _conference.AllSessionSurveys);

            _conference = community.AddFact(new Conference(CommonSettings.ConferenceID));

            Console.WriteLine("Receiving facts.");
            community.BeginReceiving();
            WaitWhileSynchronizing(community);

            var completedSurveys =
                from survey in _conference.AllSessionSurveys
                from completed in survey.Completed
                select new
                {
                    SessionName = completed.SessionEvaluation.Schedule.SessionPlace.Session.Name,
                    SpeakerName = completed.SessionEvaluation.Schedule.SessionPlace.Session.Speaker.Name,
                    Ratings =
                        from ratingAnswer in completed.SessionEvaluation.RatingAnswers
                        select new
                        {
                            Question = ratingAnswer.Rating.Question.Text,
                            Answer = ratingAnswer.Value
                        },
                    Essays =
                        from essayAnswer in completed.SessionEvaluation.EssayAnswers
                        select new
                        {
                            Question = essayAnswer.Essay.Question.Text,
                            Answer = essayAnswer.Value
                        }
                };

            foreach (var completedSurvey in completedSurveys)
            {
                Console.WriteLine(completedSurvey.SessionName);
                Console.WriteLine(completedSurvey.SpeakerName);
                foreach (var rating in completedSurvey.Ratings)
                    Console.WriteLine(String.Format("{0}: {1}", rating.Question, rating.Answer));
                foreach (var essay in completedSurvey.Essays)
                    Console.WriteLine(String.Format("{0}: {1}", essay.Question, essay.Answer));
                Console.WriteLine();
            }

            Console.WriteLine("Finished.");
            Console.ReadKey();
        }
        public void Initialize()
        {
            HTTPConfigurationProvider configurationProvider = new HTTPConfigurationProvider();

            _community = new Community(IsolatedStorageStorageStrategy.Load())
                         .AddAsynchronousCommunicationStrategy(new BinaryHTTPAsynchronousCommunicationStrategy(configurationProvider))
                         .Register <CorrespondenceModel>();

            _individual = _community.LoadFact <Individual>(ThisIndividual);
            if (_individual == null)
            {
                string randomId = Punctuation.Replace(Guid.NewGuid().ToString(), String.Empty).ToLower();
                _individual = _community.AddFact(new Individual(randomId));
                _community.SetFact(ThisIndividual, _individual);
            }

            _community.Subscribe(_individual);

            // 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()
        {
            HTTPConfigurationProvider configurationProvider = new HTTPConfigurationProvider();
            string path = Path.Combine(HostingEnvironment.MapPath("~/App_Data"), "Correspondence");
            _community = new Community(FileStreamStorageStrategy.Load(path))
                .AddAsynchronousCommunicationStrategy(new BinaryHTTPAsynchronousCommunicationStrategy(configurationProvider))
                .Register<CorrespondenceModel>()
                .Subscribe(() => _conference)
                ;
            _community.ClientApp = false;

            string conferenceId = ConfigurationManager.AppSettings["ConferenceID"];
            if (string.IsNullOrEmpty(conferenceId))
                conferenceId = CommonSettings.ConferenceID;
            _conference = _community.AddFact(new Conference(conferenceId));

            // 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();

            // And synchronize on startup.
            _community.BeginSending();
            _community.BeginReceiving();
        }
Example #14
0
        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();
        }
Example #15
0
        static void Main(string[] args)
        {
            string folderPath = Path.Combine(
                Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
                "FacetedWorlds",
                "MyCon");
            Community community = new Community(FileStreamStorageStrategy.Load(folderPath))
                                  .AddAsynchronousCommunicationStrategy(new BinaryHTTPAsynchronousCommunicationStrategy(new HTTPConfigurationProvider()))
                                  .Register <CorrespondenceModel>()
                                  .Subscribe(() => _conference);

            _conference = community.AddFact(new Conference(CommonSettings.ConferenceID));

            Console.WriteLine("Receiving facts.");
            community.BeginReceiving();
            WaitWhileSynchronizing(community);

            Console.WriteLine("Finished.");
            Console.ReadKey();
        }
Example #16
0
        static void Main(string[] args)
        {
            string folderPath = Path.Combine(
                Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
                "FacetedWorlds",
                "MyCon");
            Community community = new Community(FileStreamStorageStrategy.Load(folderPath))
                .AddAsynchronousCommunicationStrategy(new BinaryHTTPAsynchronousCommunicationStrategy(new HTTPConfigurationProvider()))
                .Register<CorrespondenceModel>()
                .Subscribe(() => _conference);

            _conference = community.AddFact(new Conference(CommonSettings.ConferenceID));

            Console.WriteLine("Receiving facts.");
            community.BeginReceiving();
            WaitWhileSynchronizing(community);

            Console.WriteLine("Finished.");
            Console.ReadKey();
        }
        public void Initialize()
        {
            HTTPConfigurationProvider configurationProvider = new HTTPConfigurationProvider();
            string correspondenceDatabase = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "CorrespondenceApp", "Multichat", "Correspondence.sdf");
            _community = new Community(new SSCEStorageStrategy(correspondenceDatabase))
                .AddAsynchronousCommunicationStrategy(new BinaryHTTPAsynchronousCommunicationStrategy(configurationProvider))
                .Register<CorrespondenceModel>()
                .Subscribe(() => _individual)
                .Subscribe(() => _individual.MessageBoards)
                ;

            _individual = _community.LoadFact<Individual>(ThisIndividual);
            if (_individual == null)
            {
                string randomId = Punctuation.Replace(Guid.NewGuid().ToString(), String.Empty).ToLower();
                _individual = _community.AddFact(new Individual(randomId));
                _community.SetFact(ThisIndividual, _individual);
            }

            // 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()
        {
            HTTPConfigurationProvider configurationProvider = new HTTPConfigurationProvider();
            _community = new Community(IsolatedStorageStorageStrategy.Load())
                .AddAsynchronousCommunicationStrategy(new BinaryHTTPAsynchronousCommunicationStrategy(configurationProvider))
                .Register<CorrespondenceModel>();

            _individual = _community.LoadFact<Individual>(ThisIndividual);
            if (_individual == null)
            {
                string randomId = Punctuation.Replace(Guid.NewGuid().ToString(), String.Empty).ToLower();
                _individual = _community.AddFact(new Individual(randomId));
                _community.SetFact(ThisIndividual, _individual);
            }

            _community.Subscribe(_individual);

            // 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()
        {
            // 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 Synchronize()
 {
     _community.BeginSending();
     _community.BeginReceiving();
 }
        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();
        }