示例#1
0
        /// <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));
        }
示例#2
0
        /// <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));
        }