Exemplo n.º 1
0
        public AddQuickEventViewModel(IGoogleCalendar googleCalendar, IRepository commonRepository, IMessanger commonMessanger)
        {
            try
            {
                log.Debug("Loading AddQuickEvent view model...");

                calendar             = googleCalendar;
                repository           = commonRepository;
                messanger            = commonMessanger;
                quickEventsTemplates = repository.GetQuickEventsTemplates();
                LoadData();

                SelectTemplateCommand   = new RelayCommand(SelectTemplate);
                MoveUpTemplateCommand   = new RelayCommand(MoveUpTemplate);
                MoveDownTemplateCommand = new RelayCommand(MoveDownTemplate);
                RemoveTemplateCommand   = new RelayCommand(RemoveTemplate);
                AddQuickEventCommand    = new RelayCommand(AddQuickEvent);
                SaveAsTemplateCommand   = new RelayCommand(SaveAsTemplate);

                log.Debug("AddQuickEvent view model was succssfully loaded");
            }
            catch (Exception ex)
            {
                log.Error("Failed to load AddQuickEvent view model:", ex);
            }
        }
Exemplo n.º 2
0
        public EventsCreateViewModel(IGoogleCalendar googleCalendar, IRecurrenceSettings recurrenceSettings, IRepository commonRepository, IMessanger commonMessanger)
        {
            try
            {
                log.Debug("Loading EventsCreate view model...");

                calendar = googleCalendar;
                repository = commonRepository;
                messanger = commonMessanger;
                recurrence = recurrenceSettings;

                CreateEventCommand = new RelayCommand(CreateEvent);
                UpdateEventCommand = new RelayCommand(UpdateEvent);
                QuickActionCommand = new RelayCommand(QuickAction);
                CancelUpdateEventCommand = new RelayCommand(CancelUpdateEvent);

                // For Update Events
                eventUpdater = repository.GetEventUpdater();
                if (eventUpdater.Type != GoogleCalendar.ActionType.none)
                {
                    IsUpdate = true;
                    SetUpdateEventSettings(eventUpdater);
                }

                log.Debug("EventsCreate view model was succssfully loaded");
            }
            catch(Exception ex)
            {
                log.Error("Failed to load EventsCreate view model:", ex);
            }
        }
Exemplo n.º 3
0
        public CalendarEventList GetEventsMultipleCalendars(IGoogleCalendar calendar, DateTime start, DateTime end, UserCalendarsPreferences preferences)
        {
            CalendarEventList selectedEvents = new CalendarEventList();

            var userCalendars = preferences.UserCalendars;

            foreach (var userCalendar in userCalendars)
            {
                CalendarEventList events = new CalendarEventList();
                if (userCalendar.IsVisible == true)
                {
                    calendar.SetCalendar(userCalendar.Id);
                    events = GetEvents(calendar, start, end);
                    calendar.SetCalendar(DEFAULT_CALENDAR);
                }
                // Mark events from not default calendar as fake
                if (userCalendar.IsPrimary == false)
                {
                    foreach (var ev in events)
                    {
                        ev.IsFake = true;
                    }
                }
                selectedEvents.AddRange(events);
            }

            selectedEvents = AddEmptyDaysFakeEvents(selectedEvents, start, end, preferences);
            return(selectedEvents);
        }
Exemplo n.º 4
0
        public AddQuickEventViewModel(IGoogleCalendar googleCalendar, IRepository commonRepository, IMessanger commonMessanger)
        {
            try
            {
                log.Debug("Loading AddQuickEvent view model...");

                calendar = googleCalendar;
                repository = commonRepository;
                messanger = commonMessanger;
                quickEventsTemplates = repository.GetQuickEventsTemplates();
                LoadData();

                SelectTemplateCommand = new RelayCommand(SelectTemplate);
                MoveUpTemplateCommand = new RelayCommand(MoveUpTemplate);
                MoveDownTemplateCommand = new RelayCommand(MoveDownTemplate);
                RemoveTemplateCommand = new RelayCommand(RemoveTemplate);
                AddQuickEventCommand = new RelayCommand(AddQuickEvent);
                SaveAsTemplateCommand = new RelayCommand(SaveAsTemplate);

                log.Debug("AddQuickEvent view model was succssfully loaded");
            }
            catch (Exception ex)
            {
                log.Error("Failed to load AddQuickEvent view model:", ex);
            }
        }
Exemplo n.º 5
0
        public EventsCreateViewModel(IGoogleCalendar googleCalendar, IRecurrenceSettings recurrenceSettings, IRepository commonRepository, IMessanger commonMessanger)
        {
            try
            {
                log.Debug("Loading EventsCreate view model...");

                calendar   = googleCalendar;
                repository = commonRepository;
                messanger  = commonMessanger;
                recurrence = recurrenceSettings;

                CreateEventCommand       = new RelayCommand(CreateEvent);
                UpdateEventCommand       = new RelayCommand(UpdateEvent);
                QuickActionCommand       = new RelayCommand(QuickAction);
                CancelUpdateEventCommand = new RelayCommand(CancelUpdateEvent);

                // For Update Events
                eventUpdater = repository.GetEventUpdater();
                if (eventUpdater.Type != GoogleCalendar.ActionType.none)
                {
                    IsUpdate = true;
                    SetUpdateEventSettings(eventUpdater);
                }

                log.Debug("EventsCreate view model was succssfully loaded");
            }
            catch (Exception ex)
            {
                log.Error("Failed to load EventsCreate view model:", ex);
            }
        }
 public StudentGroupsController(IStudentGroupsRepository studentGroupsRepository,
                                IStudentGroupScheduleProvider scheduleProvider, IGoogleCalendar googleCalendar, IDataStore dataStore, IPlanerConfig planerConfig)
 {
     _studentGroupsRepository = studentGroupsRepository;
     _scheduleProvider        = scheduleProvider;
     _googleCalendar          = googleCalendar;
     _dataStore    = dataStore;
     _planerConfig = planerConfig;
 }
Exemplo n.º 7
0
        public UpdateEventOptionsViewModel(IGoogleCalendar googleCalendar, IRepository commonRepository)
        {
            calendar = googleCalendar;
            repository = commonRepository;

            selectedEvent = repository.GetCurrentEvent();

            UpdateOnlyInstanceCommand = new RelayCommand(UpdateOnlyInstance);
            UpdateFollowingEventsCommand = new RelayCommand(UpdateFollowingEvents);
            UpdateAllEventsCommand = new RelayCommand(UpdateAllEvents);
            CancelUpdateCommand = new RelayCommand(CancelUpdate);
        }
Exemplo n.º 8
0
        public DeleteEventOptionsViewModel(IGoogleCalendar googleCalendar, IRepository commonRepository, IMessanger commonMessanger)
        {
            calendar      = googleCalendar;
            repository    = commonRepository;
            selectedEvent = repository.GetCurrentEvent();
            messanger     = commonMessanger;

            DeleteOnlyInstanceCommand    = new RelayCommand(DeleteOnlyInstance);
            DeleteFollowingEventsCommand = new RelayCommand(DeleteFollowingEvents);
            DeleteAllEventsCommand       = new RelayCommand(DeleteAllEvents);
            CancelDeleteCommand          = new RelayCommand(CloseWindow);
        }
Exemplo n.º 9
0
        public UpdateEventOptionsViewModel(IGoogleCalendar googleCalendar, IRepository commonRepository)
        {
            calendar   = googleCalendar;
            repository = commonRepository;

            selectedEvent = repository.GetCurrentEvent();

            UpdateOnlyInstanceCommand    = new RelayCommand(UpdateOnlyInstance);
            UpdateFollowingEventsCommand = new RelayCommand(UpdateFollowingEvents);
            UpdateAllEventsCommand       = new RelayCommand(UpdateAllEvents);
            CancelUpdateCommand          = new RelayCommand(CancelUpdate);
        }
Exemplo n.º 10
0
        public DeleteEventOptionsViewModel(IGoogleCalendar googleCalendar, IRepository commonRepository, IMessanger commonMessanger)
        {
            calendar = googleCalendar;
            repository = commonRepository;
            selectedEvent = repository.GetCurrentEvent();
            messanger = commonMessanger;

            DeleteOnlyInstanceCommand = new RelayCommand(DeleteOnlyInstance);
            DeleteFollowingEventsCommand = new RelayCommand(DeleteFollowingEvents);
            DeleteAllEventsCommand = new RelayCommand(DeleteAllEvents);
            CancelDeleteCommand = new RelayCommand(CloseWindow);

        }
Exemplo n.º 11
0
        public EventsListViewModel(IGoogleCalendar googleCalendar, ICalendarEventService eventService, ITimeIntervals timeInterval, IRepository commonRepository, IMessanger commonMessanger)
        {
            try
            {
                log.Debug("Loading EventsList view model...");

                calendar                = googleCalendar;
                service                 = eventService;
                period                  = timeInterval;
                repository              = commonRepository;
                sortFilterPreferences   = repository.GetSortFilterPreferences();
                userCalendarPreferences = repository.GetUserCalendarsPreferences();
                messanger               = commonMessanger;
                UpdateUserCalendarPreferences();

                Events = service.GetEventsMultipleCalendars(calendar, period.Today(), userCalendarPreferences);
                Events = service.FormatEventsDatesStringRepresentation(Events, repository.GetDateTimePreferences());

                GetTodayEventsCommand                    = new RelayCommand(GetTodayEvents);
                GetTomorrowEventsCommand                 = new RelayCommand(GetTomorrowEvents);
                GetThisWeekEventsCommand                 = new RelayCommand(GetThisWeekEvents);
                GetNextWeekEventsCommand                 = new RelayCommand(GetNextWeekEvents);
                GetThisMonthEventsCommand                = new RelayCommand(GetThisMonthEvents);
                GetNextMonthEventsCommand                = new RelayCommand(GetNextMonthEvents);
                GetPeriodEventsCommand                   = new RelayCommand(GetPeriodEvents);
                RefreshCommand                           = new RelayCommand(RefreshEventsList);
                DeleteEventCommand                       = new RelayCommand(DeleteEvent);
                UpdateEventCommand                       = new RelayCommand(FullUpdateEvent);
                ConfirmEventCommand                      = new RelayCommand(ConfirmEvent);
                MakeTentativeEventCommand                = new RelayCommand(MakeTentativeEvent);
                ShowChooseDateEventsControlsCommand      = new RelayCommand(ShowChooseDateEventsControls);
                HideChooseDateEventsControlsCommand      = new RelayCommand(HideChooseDateEventsControls);
                GetChooseDateEventsCommand               = new RelayCommand(GetChooseDateEvents);
                SetSortingAndFilteringPreferencesCommand = new RelayCommand(SetSortingAndFilteringPreferences);
                SetCalendarCommand                       = new RelayCommand(SetCalendar);
                LogOutCommand = new RelayCommand(LogOut);

                log.Debug("EventsList view model was succssfully loaded");
            }
            catch (Exception ex)
            {
                log.Error("Failed to load EventsList view model:", ex);
            }
        }
Exemplo n.º 12
0
        public OthersCalendarViewModel(IGoogleCalendar googleCalendar, ICalendarEventService eventService, ITimeIntervals timeInterval, IRepository commonRepository, IMessanger commonMessanger)
        {
            try
            {
                log.Debug("Loading EventsList view model...");

                calendar = googleCalendar;
                service = eventService;
                period = timeInterval;
                repository = commonRepository;
                sortFilterPreferences = repository.GetSortFilterPreferences();
                messanger = commonMessanger;

                OthersEvents = service.GetOthersEvents(calendar, period.Today(), _OtherCalendarsList);
                OthersEvents = service.FormatEventsDatesStringRepresentation(OthersEvents, repository.GetDateTimePreferences());

                GetOtherCalendarsCommand = new RelayCommand(GetOtherCalendars);
                GetTodayEventsCommand = new RelayCommand(GetTodayEvents);
                GetTomorrowEventsCommand = new RelayCommand(GetTomorrowEvents);
                GetThisWeekEventsCommand = new RelayCommand(GetThisWeekEvents);
                GetNextWeekEventsCommand = new RelayCommand(GetNextWeekEvents);
                GetThisMonthEventsCommand = new RelayCommand(GetThisMonthEvents);
                GetNextMonthEventsCommand = new RelayCommand(GetNextMonthEvents);
                GetPeriodEventsCommand = new RelayCommand(GetPeriodEvents);
                RefreshCommand = new RelayCommand(RefreshEventsList);
                DeleteEventCommand = new RelayCommand(DeleteEvent);
                UpdateEventCommand = new RelayCommand(FullUpdateEvent);
                ConfirmEventCommand = new RelayCommand(ConfirmEvent);
                MakeTentativeEventCommand = new RelayCommand(MakeTentativeEvent);
                ShowChooseDateEventsControlsCommand = new RelayCommand(ShowChooseDateEventsControls);
                HideChooseDateEventsControlsCommand = new RelayCommand(HideChooseDateEventsControls);
                GetChooseDateEventsCommand = new RelayCommand(GetChooseDateEvents);
                SetSortingAndFilteringPreferencesCommand = new RelayCommand(SetSortingAndFilteringPreferences);
                LogOutCommand = new RelayCommand(LogOut);

                log.Debug("EventsList view model was succssfully loaded");
            }
            catch(Exception ex)
            {
                log.Error("Failed to load EventsList view model:", ex);
            }
        }
Exemplo n.º 13
0
        public CalendarEventList GetEvents(IGoogleCalendar calendar, DateTime start, DateTime end)
        {
            log.Debug("Select events, period=" + start + " - " + end);
            CalendarEventList selectedEvents = new CalendarEventList();


            foreach (CalendarEvent ev in calendar.GetEvents(start, end))
            {
                try
                {
                    if (MatchStartDate(ev.Start, start) && MatchEndDate(ev.End, end))
                    {
                        selectedEvents.Add(ev);
                    }
                }
                catch (Exception ex)
                {
                    log.Error("Failed to get events for a specified period", ex);
                    log.Info("Event info: " + ev.ToString());
                }
            }
            log.Debug("Successfully selected events for a specified period");
            return(selectedEvents);
        }
Exemplo n.º 14
0
        public CalendarEventList GetOthersEvents(IGoogleCalendar calendar, DateTime start, DateTime end , String CalendarIDs)
        {
            log.Debug("Select events, period=" + start + " - " + end);
            CalendarEventList selectedEvents = new CalendarEventList();


            foreach (CalendarEvent ev in calendar.GetOthersEvents(start, end, CalendarIDs))
            {
                try
                {
                    if (MatchStartDate(ev.Start, start) && MatchEndDate(ev.End, end))
                    {
                        selectedEvents.Add(ev);
                    }
                }
                catch (Exception ex)
                {
                    log.Error("Failed to get events for a specified period", ex);
                    log.Info("Event info: " + ev.ToString());
                }
            }
            log.Debug("Successfully selected events for a specified period");
            return selectedEvents;
        }
Exemplo n.º 15
0
 public CalendarEventList GetEvents(IGoogleCalendar calendar, TimeIntervals period)
 {
     return GetEvents(calendar, period.Start, period.End);
 }
Exemplo n.º 16
0
 public CalendarEventList GetOthersEvents(IGoogleCalendar calendar, TimeIntervals period, String CalendarIDs)
 {
     return(GetOthersEvents(calendar, period.Start, period.End, CalendarIDs));
 }
Exemplo n.º 17
0
 public CalendarEventList GetEventsMultipleCalendars(IGoogleCalendar calendar, TimeIntervals period, UserCalendarsPreferences preferences)
 {
     return(GetEventsMultipleCalendars(calendar, period.Start, period.End, preferences));
 }
Exemplo n.º 18
0
 public CalendarEventList GetEvents(IGoogleCalendar calendar, TimeIntervals period)
 {
     return(GetEvents(calendar, period.Start, period.End));
 }
Exemplo n.º 19
0
 public CalendarEventList GetComparingEvents(IGoogleCalendar calendar, TimeIntervals period, List <String> CalendarIDs, String ViewFormat, bool primary)
 {
     return(GetComparingEvents(calendar, period.Start, period.End, CalendarIDs, ViewFormat, primary));
 }
Exemplo n.º 20
0
 public CalendarEventList GetOthersEvents(IGoogleCalendar calendar, TimeIntervals period , String CalendarIDs)
 {
     return GetOthersEvents(calendar, period.Start, period.End, CalendarIDs);
 }
Exemplo n.º 21
0
 public CalendarEventList GetComparingEvents(IGoogleCalendar calendar, TimeIntervals period, List<String> CalendarIDs, String ViewFormat,bool primary)
 {
     return GetComparingEvents(calendar, period.Start, period.End, CalendarIDs,  ViewFormat,primary);
 }