Ejemplo n.º 1
0
        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();
        }
Ejemplo n.º 2
0
 public SessionHeaderViewModel(SessionPlace sessionPlace, Individual individual, SelectionModel selectionModel, Action showSession)
 {
     _sessionPlace = sessionPlace;
     _individual = individual;
     _selectionModel = selectionModel;
     _showSession = showSession;
 }
Ejemplo n.º 3
0
        public ScheduleSlotViewModel(Time time, Individual individual, Schedule schedule, SelectionModel selection)
        {
            _time = time;
            _individual = individual;
            _schedule = schedule;
            _selection = selection;

            _sessionPlace = new Dependent<SessionPlace>(() => SessionPlace);
        }
 public ConferenceDetailsViewModel(
     Individual individual,
     ConferenceHeader conferenceHeader,
     ConferenceSelection conferenceSelection)
     : base(conferenceHeader)
 {
     _individual = individual;
     _conferenceSelection = conferenceSelection;
 }
Ejemplo n.º 5
0
 public ScheduleTimeViewModel(
     Time time,
     Individual individual,
     SelectionModel selection,
     Func<Time, Schedule, ScheduleSlotViewModel> newScheduleSlot)
 {
     _time = time;
     _individual = individual;
     _selection = selection;
     _newScheduleSlot = newScheduleSlot;
 }
Ejemplo n.º 6
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>()));
        }
Ejemplo n.º 7
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);
        }
Ejemplo n.º 8
0
        public async Task Initialize()
        {
            var sharedCommunication = new MemoryCommunicationStrategy();
            _communityFlynn = new Community(new MemoryStorageStrategy())
                .AddCommunicationStrategy(sharedCommunication)
                .Register<CorrespondenceModel>()
                .Subscribe(() => _individualFlynn)
				;
            _communityAlan = new Community(new MemoryStorageStrategy())
                .AddCommunicationStrategy(sharedCommunication)
                .Register<CorrespondenceModel>()
                .Subscribe(() => _individualAlan)
                ;

            _individualFlynn = await _communityFlynn.AddFactAsync(new Individual("flynn"));
            _individualAlan = await _communityAlan.AddFactAsync(new Individual("alan"));
        }
Ejemplo n.º 9
0
        public static AvailableSessionsViewModel CreateViewModel(
            Time time,
            Individual individual,
            SelectionModel selectionModel)
        {
            Frame frame = null;
            if (Window.Current != null)
                frame = Window.Current.Content as Frame;

            Action showSession = () =>
            {
                if (frame != null)
                    frame.Navigate(typeof(SessionView));
            };

            Func<SessionPlace, SessionHeaderViewModel> newSessionHeaderViewModel = sessionPlace =>
                new SessionHeaderViewModel(sessionPlace, individual, selectionModel, showSession);

            return new AvailableSessionsViewModel(time, newSessionHeaderViewModel);
        }
Ejemplo n.º 10
0
 // Fields
 // Results
 // Business constructor
 public IndividualAttendee(
     Individual individual
     ,Attendee attendee
     )
 {
     InitializeResults();
     _individual = new PredecessorObj<Individual>(this, GetRoleIndividual(), individual);
     _attendee = new PredecessorObj<Attendee>(this, GetRoleAttendee(), attendee);
 }
Ejemplo n.º 11
0
            public CorrespondenceFact CreateFact(FactMemento memento)
            {
                Individual newFact = new Individual(memento);

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

                return newFact;
            }
Ejemplo n.º 12
0
 // Fields
 // Results
 // Business constructor
 public EnableToastNotification(
     Individual individual
     )
 {
     _unique = Guid.NewGuid();
     InitializeResults();
     _individual = new PredecessorObj<Individual>(this, GetRoleIndividual(), individual);
 }
Ejemplo n.º 13
0
 public SettingsViewModel(Individual individual, Attendee attendee)
 {
     _individual = individual;
     _attendee = attendee;
 }
Ejemplo n.º 14
0
 // Fields
 // Results
 // Business constructor
 public IndividualProfile(
     Individual individual
     ,Profile profile
     )
 {
     InitializeResults();
     _individual = new PredecessorObj<Individual>(this, GetRoleIndividual(), individual);
     _profile = new PredecessorObj<Profile>(this, GetRoleProfile(), profile);
 }
Ejemplo n.º 15
0
 public MainViewModel(Community community, Individual individual)
 {
     _community = community;
     _individual = individual;
 }
Ejemplo n.º 16
0
 public SessionViewModel(SessionPlace sessionPlace, Individual individual)
 {
     _sessionPlace = sessionPlace;
     _individual = individual;
 }