private void UpdateCalendarListDropdown() { //get selected account var selectedAccount = gui.MainGrid.SendToCalendarPopup.SelectedAccount; //get the calendars available for that account var calendarList = MuhurthaCore.GetCalendarsForAccount(selectedAccount); //place calendars into combobox gui.MainGrid.SendToCalendarPopup.CalendarList = calendarList; }
private void SendEventsToCalendar(object threadCanceler) { //get name of the selected calendar var calendarName = gui.MainGrid.SendToCalendarPopup.SelectedCalendar; var customEventName = gui.MainGrid.SendToCalendarPopup.CustomEventName; var isSplitEventsChecked = gui.MainGrid.SendToCalendarPopup.IsSplitEventsChecked; var isEnableRemindersChecked = gui.MainGrid.SendToCalendarPopup.IsEnableRemindersChecked; //get events to send var events = gui.MainGrid.EventView.EventList; //use thread canceler, so that sending events can be stopped if needed MuhurthaCore.threadCanceler = (CancellationToken)threadCanceler; //start uploading events to calendar MuhurthaCore.SendEventsToCalendar(events, calendarName, CalendarAccount.Google, isSplitEventsChecked, isEnableRemindersChecked, customEventName); }
//SEND TO CALENDAR POPUP //popup becomes visible private void SendToCalendarPopupOnIsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e) { //if becoming visible then, load calendar accounts into dropdown if (gui.MainGrid.SendToCalendarPopup.Visibility == Visibility.Visible) { //get all calendar account names var allAccounts = MuhurthaCore.GetAllCalendarAccounts(); //before setting account list, disable handler listening for account list changes gui.MainGrid.SendToCalendarPopup.AccountSelectionChanged -= AccountSelectionChanged; gui.MainGrid.SendToCalendarPopup.AccountList = allAccounts; //enable handler back gui.MainGrid.SendToCalendarPopup.AccountSelectionChanged += AccountSelectionChanged; } }
private void FindAndUpdateEvents(object threadCanceler) { //get all the needed values var startTime = gui.MainGrid.FindEventOptions.StartTimeText; var endTime = gui.MainGrid.FindEventOptions.EndTimeText; var location = gui.MainGrid.FindEventOptions.SelectedLocation; var person = gui.MainGrid.FindEventOptions.SelectedPerson; var selectedEvents = gui.MainGrid.FindEventOptions.SelectedEventsToFind; //pass thread canceler MuhurthaCore, so that methods inside can be stopped if needed MuhurthaCore.threadCanceler = (CancellationToken)threadCanceler; //calculate events from values var events = MuhurthaCore.FindCombinedEvents(startTime, endTime, location, person, selectedEvents); //set event into view gui.MainGrid.EventView.EventList = events; }
/// <summary> /// Events are created & updated to view here /// </summary> private void CalculateAndUpdateEvents(object threadCanceler) { //get all the needed values var startTime = gui.MainGrid.ViewEventOptions.StartTimeText; var endTime = gui.MainGrid.ViewEventOptions.EndTimeText; var location = gui.MainGrid.ViewEventOptions.SelectedLocation; var person = gui.MainGrid.ViewEventOptions.SelectedPerson; var tag = gui.MainGrid.ViewEventOptions.SelectedTag; var precision = gui.MainGrid.ViewEventOptions.PrecisionHours; //pass thread canceler MuhurthaCore, so that methods inside can be stopped if needed MuhurthaCore.threadCanceler = (CancellationToken)threadCanceler; //calculate events from values var events = MuhurthaCore.GetEvents(startTime, endTime, location, person, tag, precision); //set event into view gui.MainGrid.EventView.EventList = events; }
private void LoadFindEventOptionsDefaultValues() { //only load defaults if the property is null //this allows users to switch views without getting data reset //load all person, location & tag list into combo box gui.MainGrid.FindEventOptions.EventsToFindList ??= MuhurthaCore.GetAllEventDataList(); gui.MainGrid.FindEventOptions.PersonList ??= MuhurthaCore.GetAllPeopleList(); gui.MainGrid.FindEventOptions.LocationList ??= MuhurthaCore.GetAllLocationList(); //set default start & end times to begining and end of the day var todayStart = DateTime.Today.ToString(Time.GetDateTimeFormat()); var todayEnd = DateTime.Today.AddHours(23.999).ToString(Time.GetDateTimeFormat()); gui.MainGrid.FindEventOptions.StartTimeText ??= todayStart; gui.MainGrid.FindEventOptions.EndTimeText ??= todayEnd; //set default combobox option to be none //gui.MainGrid.EventOptions.SelectedLocationIndex = -1; //gui.MainGrid.EventOptions.SelectedPersonIndex = -1; //gui.MainGrid.EventOptions.SelectedTag = ; }