Пример #1
0
        private void UpdateEvent(UpdateType updateType)
        {
            if (SelectedEvent.IsFake)
            {
                return;
            }

            repository.SetCurrentEvent(SelectedEvent);

            if (SelectedEvent.IsRecurrenceEvent)
            {
                var updateEventOptionsWindow = new Views.UpdateEventOptionsView();
                updateEventOptionsWindow.ShowDialog();
            }
            else
            {
                CalendarEventUpdater updateEvent = new CalendarEventUpdater(GoogleCalendar.ActionType.single, SelectedEvent);
                repository.SetEventUpdater(updateEvent);
            }

            if (repository.GetEventUpdater().Type == GoogleCalendar.ActionType.none)
            {
                return;
            }

            if (repository.GetEventUpdater().Type != GoogleCalendar.ActionType.none && updateType == UpdateType.full)
            {
                var updateEventWindow = new Views.UpdateEventView();
                updateEventWindow.ShowDialog();
                RefreshEventsList();
            }
            else
            {
                CalendarEventUpdater eventUpdater = repository.GetEventUpdater();
                eventUpdater.CalendarEvent.Confirmed = updateType == UpdateType.confirm ? true : false;
                eventUpdater.CalendarEvent.RRule     = calendar.GetRecurrenceSettings(eventUpdater.CalendarEvent).ToString();
                if (calendar.UpdateEvent(eventUpdater.CalendarEvent, eventUpdater.Type))
                {
                    RefreshEventsList();
                    messanger.Success("Event status changed", false);
                }
                else
                {
                    messanger.Error("Failed to change event status. Please check log file for a detailed information about the error.", false);
                }
            }
        }
Пример #2
0
        private void UpdateEvent(UpdateType updateType)
        {
            if (SelectedEvent.IsFake)
            {
                return;
            }

            repository.SetCurrentEvent(SelectedEvent);

            if (SelectedEvent.IsRecurrenceEvent)
            {
                var updateEventOptionsWindow = new Views.UpdateEventOptionsView();
                updateEventOptionsWindow.ShowDialog();
            }
            else
            {
                CalendarEventUpdater updateEvent = new CalendarEventUpdater(GoogleCalendar.ActionType.single, SelectedEvent);
                repository.SetEventUpdater(updateEvent);
            }

            if (repository.GetEventUpdater().Type == GoogleCalendar.ActionType.none)
            {
                return;
            }

            if (repository.GetEventUpdater().Type != GoogleCalendar.ActionType.none && updateType == UpdateType.full)
            {
                var updateEventWindow = new Views.UpdateEventView();
                updateEventWindow.ShowDialog();
                RefreshEventsList();
            }
            else
            {
                CalendarEventUpdater eventUpdater = repository.GetEventUpdater();
                eventUpdater.CalendarEvent.Confirmed = updateType == UpdateType.confirm ? true : false;
                eventUpdater.CalendarEvent.RRule = calendar.GetRecurrenceSettings(eventUpdater.CalendarEvent).ToString();
                if (calendar.UpdateEvent(eventUpdater.CalendarEvent, eventUpdater.Type))
                {
                    RefreshEventsList();
                    messanger.Success("Event status changed", false);
                }
                else
                {
                    messanger.Error("Failed to change event status. Please check log file for a detailed information about the error.", false);
                }
            }
        }