/// <summary> /// Retrieves a collection of events in a shortened format. /// </summary> /// <param name="parameter"></param> public void FetchUpcomingEventsInShortFormat(object parameter) { IObservable <ObservableCollection <UpcomingEventShortDTO> > events = EventServiceProxy.FetchUpcomingEventsInShortFormat().ObserveOn(SynchronizationContext.Current); events.Subscribe(eve => this.UpcomingEventsInShortFormatList = new ObservableCollection <UpcomingEventShortDTO>(eve.OrderByDescending(ev => ev.StartTime))); }
/// <summary> /// Retrieves full event info /// </summary> /// <param name="parameter"></param> public void FetchFullEventInfoFromList(object parameter) { if (parameter != null) { IObservable <UpcomingEventDTO> eventInFull = EventServiceProxy.FetchEventByGuid(((UpcomingEventShortDTO)parameter).EventId) .ObserveOn(SynchronizationContext.Current); eventInFull.Subscribe(rx => this.UpcomingEventInFull = new UpcomingEventWithValidation(rx)); } }
/// <summary> /// Send an event instance to server and updates the corresponding row in database /// </summary> /// <param name="parameter"></param> public void AddOrUpdateEventInDatabase(object parameter) { IObservable <string> reply = EventServiceProxy.AddOrUpdateEvent(this.UpcomingEventInFull.ToWCFUpcomingEventDTO()) .ObserveOn(SynchronizationContext.Current); reply.Subscribe(rx => MessageBox.Show(rx)); IObservable <ObservableCollection <UpcomingEventShortDTO> > events = EventServiceProxy.FetchEventsByMonth( this.DesiredMonth.Month).ObserveOn(SynchronizationContext.Current); events.Subscribe(eve => this.Weeks = WeekFactory.WeekBuilder(this.DesiredMonth, eve)); }
/// <summary> /// Retrieves events by month and creates a week collection. /// </summary> /// <param name="parameter"></param> private void FetchEventsByMonth(object parameter) { if (parameter == null) { this.DesiredMonth = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1); } else { int monthIncrement = ((MouseWheelEventArgs)parameter).Delta; if (monthIncrement > 0) { this.DesiredMonth = this.DesiredMonth.AddMonths(-1); } else { this.DesiredMonth = this.DesiredMonth.AddMonths(1); } } IObservable <ObservableCollection <UpcomingEventShortDTO> > events = EventServiceProxy.FetchEventsByMonth(this.DesiredMonth.Month).ObserveOn(SynchronizationContext.Current); events.Subscribe(eve => this.Weeks = WeekFactory.WeekBuilder(this.DesiredMonth, eve)); }