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 ConferenceViewModel(Conference conference, NavigationModel navigationModel, SurveySnapshotModel surveySnapshot, SurveyNavigationModel surveyNavigationModel)
 {
     _conference = conference;
     _navigationModel = navigationModel;
     _surveySnapshot = surveySnapshot;
     _surveyNavigationModel = surveyNavigationModel;
 }
 public MyScheduleViewModel(
     Conference conference,
     SelectionModel selection,
     Func<Day, ScheduleDayViewModel> newScheduleDay)
 {
     _conference = conference;
     _selection = selection;
     _newScheduleDay = newScheduleDay;
 }
Beispiel #4
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();
        }
Beispiel #5
0
        public static async Task Populate(Community community, Conference conference, Individual individual)
        {
            conference.Name = "AwesomeFest 2013: The Gathering";

            var day = await community.AddFactAsync(new Day(conference, new DateTime(2013, 2, 23)));
            var placeTime = await community.AddFactAsync(new Time(day, new DateTime(2013, 2, 23, 8, 0, 0)));
            var room = await community.AddFactAsync(new Room(conference));
            room.RoomNumber = "101";
            var place = await community.AddFactAsync(new Place(placeTime, room));
            var speaker = await community.AddFactAsync(new Speaker(conference, "Speaker One"));
            var track = await community.AddFactAsync(new Track(conference, "Agile"));
            var session = await community.AddFactAsync(new Model.Session(conference, speaker, track));
            session.Name = "Kanban, Planning Poker, and Other Crazy Practices";
            var sessionPlace = await community.AddFactAsync(new SessionPlace(session, place, Enumerable.Empty<SessionPlace>()));
        }
Beispiel #6
0
        public static MyScheduleViewModel CreateViewModel(
            Conference conference,
            Individual individual,
            SelectionModel selection)
        {
            Func<Time, Schedule, ScheduleSlotViewModel> newScheduleSlot = (time, schedule) =>
                new ScheduleSlotViewModel(time, individual, schedule, selection);

            Func<Time, ScheduleTimeViewModel> newScheduleTime = time =>
                new ScheduleTimeViewModel(time, individual, selection, newScheduleSlot);

            Func<Day, ScheduleDayViewModel> newScheduleDay = day =>
                new ScheduleDayViewModel(day, newScheduleTime);

            return new MyScheduleViewModel(conference, selection, newScheduleDay);
        }
Beispiel #7
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();
        }
        private static void DefineConferenceSessions(ICommunity community, Conference conference)
        {
            var developer = community.AddFact(new Track(conference));
            developer.Name = "Developer";

            var michael = community.AddFact(new Speaker(conference));
            michael.Name = "Michael L Perry";
            michael.ImageUrl = "http://qedcode.com/extras/Perry_Headshot_Medium.jpg";
            michael.Contact = "@michaellperry";
            michael.Bio.SetString(
                "Software is math. Michael L Perry has built upon the works of mathematicians like Bertrand Meyer, James Rumbaugh, and Donald Knuth to develop a mathematical system for software development. He has captured this system in a set of open source projects, Update Controls and Correspondence. As a Principal Consultant at Improving Enterprises, he applies mathematical concepts to building scalable and robust enterprise systems. You can find out more at qedcode.com.",
                v => michael.Bio = v,
                community);

            var provable = community.AddFact(new Session(michael));
            provable.Title = "4 Ways to Prevent Code Abuse";
            provable.Description.SetString(
                "Your code is right. Other people are just using it wrong!" +
                "Learn 4 simple techniques to prevent people from using your code incorrectly. We'll apply those techniques to a class in the .NET Framework that is really easy to get wrong. By the time we're done, you'll have to try really hard to mess it up." +
                "Some APIs will throw exceptions when you get something wrong. That's not helpful! I'll show you how to write an API that guides you toward correct code. It won't even compile unless you get it right." +
                "These 4 techniques are built into the C# language today, so take advantage of them! Everybody on your team will thank you. And you'll spend less time fixing their bugs.",
                v => provable.Description = v,
                community);

            community.AddFact(new SessionTrack(provable, developer, new List<SessionTrack>()));

            var eight = community.AddFact(new Time(conference));
            eight.StartTime = new DateTime(2013, 7, 12, 8, 0, 0, DateTimeKind.Local);

            var room100 = community.AddFact(new Room(conference));
            room100.RoomNumber = "100";

            var room100AtEight = community.AddFact(new Slot(eight, room100));

            community.AddFact(new SessionSlot(provable, room100AtEight, new List<SessionSlot>()));
        }
        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();
        }
Beispiel #10
0
 // Business constructor
 public Attendee(
     Conference conference
     ,string identifier
     )
 {
     InitializeResults();
     _conference = new PredecessorObj<Conference>(this, GetRoleConference(), conference);
     _identifier = identifier;
 }
Beispiel #11
0
 // Fields
 // Results
 // Business constructor
 public Conference__conferenceSurvey(
     Conference conference
     ,IEnumerable<Conference__conferenceSurvey> prior
     ,Survey value
     )
 {
     InitializeResults();
     _conference = new PredecessorObj<Conference>(this, GetRoleConference(), conference);
     _prior = new PredecessorList<Conference__conferenceSurvey>(this, GetRolePrior(), prior);
     _value = new PredecessorObj<Survey>(this, GetRoleValue(), value);
 }
Beispiel #12
0
 public Attendee Attending(Conference conference)
 {
     return Community.AddFact(new Attendee(conference, this));
 }
Beispiel #13
0
 // Business constructor
 public Track(
     Conference conference
     ,string name
     )
 {
     InitializeResults();
     _conference = new PredecessorObj<Conference>(this, GetRoleConference(), conference);
     _name = name;
 }
Beispiel #14
0
            public CorrespondenceFact CreateFact(FactMemento memento)
            {
                Conference newFact = new Conference(memento);

                // Create a memory stream from the memento data.
                using (MemoryStream data = new MemoryStream(memento.Data))
                {
                    using (BinaryReader output = new BinaryReader(data))
                    {
                        newFact._id = (string)_fieldSerializerByType[typeof(string)].ReadData(output);
                    }
                }

                return newFact;
            }
Beispiel #15
0
 // Business constructor
 public Room(
     Conference conference
     )
 {
     _unique = Guid.NewGuid();
     InitializeResults();
     _conference = new PredecessorObj<Conference>(this, GetRoleConference(), conference);
 }
Beispiel #16
0
 // Results
 // Business constructor
 public Conference__name(
     Conference conference
     ,IEnumerable<Conference__name> prior
     ,string value
     )
 {
     InitializeResults();
     _conference = new PredecessorObj<Conference>(this, GetRoleConference(), conference);
     _prior = new PredecessorList<Conference__name>(this, GetRolePrior(), prior);
     _value = value;
 }
 public ScheduleViewModel(Conference conference, NavigationModel navigationModel)
 {
     _conference = conference;
     _navigationModel = navigationModel;
 }
Beispiel #18
0
 // Business constructor
 public Day(
     Conference conference
     ,DateTime conferenceDate
     )
 {
     InitializeResults();
     _conference = new PredecessorObj<Conference>(this, GetRoleConference(), conference);
     _conferenceDate = conferenceDate;
 }
Beispiel #19
0
 // Business constructor
 public ConferenceHeader(
     Catalog catalog
     ,Conference conference
     )
 {
     _unique = Guid.NewGuid();
     InitializeResults();
     _catalog = new PredecessorObj<Catalog>(this, GetRoleCatalog(), catalog);
     _conference = new PredecessorObj<Conference>(this, GetRoleConference(), conference);
 }
Beispiel #20
0
 // Business constructor
 public Session(
     Conference conference
     ,Speaker speaker
     ,Track track
     )
 {
     _unique = Guid.NewGuid();
     InitializeResults();
     _conference = new PredecessorObj<Conference>(this, GetRoleConference(), conference);
     _speaker = new PredecessorObj<Speaker>(this, GetRoleSpeaker(), speaker);
     _track = new PredecessorOpt<Track>(this, GetRoleTrack(), track);
 }
Beispiel #21
0
 // Business constructor
 public Attendee(
     Conference conference
     ,Profile profile
     )
 {
     InitializeResults();
     _conference = new PredecessorObj<Conference>(this, GetRoleConference(), conference);
     _profile = new PredecessorObj<Profile>(this, GetRoleProfile(), profile);
 }
Beispiel #22
0
 // Results
 // Business constructor
 public ConferenceNotice(
     Conference conference
     ,DateTime timeSent
     ,string text
     )
 {
     InitializeResults();
     _conference = new PredecessorObj<Conference>(this, GetRoleConference(), conference);
     _timeSent = timeSent;
     _text = text;
 }
 public SponsorsViewModel(Conference conference)
 {
     _conference = conference;
 }
 public ScheduleViewModel(Conference conference)
 {
     _conference = conference;
 }
Beispiel #25
0
 public TracksViewModel(Conference conference)
 {
     _conference = conference;
 }
 public SessionsViewModel(Conference conference, NavigationModel navigationModel)
 {
     _conference = conference;
     _navigationModel = navigationModel;
 }
Beispiel #27
0
 public HomeViewModel(Conference conference)
 {
     _conference = conference;
 }
Beispiel #28
0
 // Business constructor
 public ConferenceSessionSurvey(
     Conference conference
     ,Survey sessionSurvey
     ,IEnumerable<ConferenceSessionSurvey> prior
     )
 {
     InitializeResults();
     _conference = new PredecessorObj<Conference>(this, GetRoleConference(), conference);
     _sessionSurvey = new PredecessorObj<Survey>(this, GetRoleSessionSurvey(), sessionSurvey);
     _prior = new PredecessorList<ConferenceSessionSurvey>(this, GetRolePrior(), prior);
 }
 public SpeakersViewModel(Conference conference)
 {
     _conference = conference;
 }