private string BuildDateTimeDescription(Meeting meeting)
        {
            string date;

            if (meeting.Recurrence != null)
            {
                date = DateTimeUtils.BuildRecurrentDate(meeting.Recurrence);
            }
            else
            {
                DateTime dateTime;

                if (meeting.IsAllDay)
                {
                    dateTime = meeting.Start.DateTime;
                }
                else
                {
                    dateTime = meeting.Start.ToLocalTime();
                }

                date = string.Format("{0:dd MMM yyyy}", dateTime);
            }

            string time = meeting.IsAllDay ?
                GetString("AllDayPart") :
                string.Format(GetString("FromToPart"),
                                meeting.Start.ToLocalTime(),
                                meeting.End.ToLocalTime());

            return $"{date} {time}";
        }
 private async void CancelMeetingInstance(Meeting meeting)
 {
     if (await ConfirmCancellation(meeting, isInstance: true))
     {
         CancelMeeting(meeting.Id);
     }
 }
        protected override async void OnNavigatedTo(object parameter)
        {
            _meeting = JSON.Deserialize<Meeting>(parameter);

            var items = await GetAllTimeCandidates(_meeting);
            SetTimeSlotProperties(items);

            Items = new ObservableCollection<MeetingTimeCandidate>(items);
            OnPropertyChanged(() => Items);
        }
        private async void OnInitialize(object parameter)
        {
            GetEvent<InitDialogEvent>().Unsubscribe(OnInitialize);

            _meeting = Deserialize<Meeting>(parameter);

            var items = await GetAllTimeCandidates(_meeting);
            SetTimeSlotProperties(items);

            MeetingTimeCandidates = new ObservableCollection<MeetingTimeCandidate>(items);
        }
        private async void CancelMeetingSeries(Meeting meeting)
        {
            if (await ConfirmCancellation(meeting, isInstance: false))
            {
                if (meeting.SeriesMasterId != null)
                {
                    meeting = await GetEventById(meeting.SeriesMasterId);
                }

                CancelMeeting(meeting.Id);
            }
        }
        private async Task<bool> ConfirmCancellation(Meeting meeting, bool isInstance)
        {
            string format;

            if (meeting.IsSerial)
            {
                format = GetString(isInstance ? "CancelOccurence" : "CancelSeries");
            }
            else
            {
                format = GetString("CancelInstance");
            }

            return await UI.YesNoDialog(string.Format(format, meeting.Subject));
        }
        public override async void OnNavigatedTo(NavigatedToEventArgs e, Dictionary<string, object> viewModelState)
        {
            base.OnNavigatedTo(e, viewModelState);

            _meeting = JsonConvert.DeserializeObject<Meeting>((string)e.Parameter);

            MeetingTimeCandidates = new ObservableCollection<MeetingTimeCandidate>();

            using (new Loading(this))
            {
                var items = await GetTimeCandidates("8:00:00", "11:00:00");

                items = items.Union(await GetTimeCandidates("11:00:00", "15:00:00"));
                items = items.Union(await GetTimeCandidates("15:00:00", "18:00:00"));

                items.ForEach(x => MeetingTimeCandidates.Add(x));
            }
        }
 private void OnMeetingUpdate(Meeting meeting)
 {
     Meeting = meeting;
     Populate();
 }
 private void OnEditOpen(Meeting meeting)
 {
     IsEditActive = true;
     OnPropertyChanged(() => IsEditActive);
     OnPropertyChanged(() => IsDetailsActive);
 }
        private void RecurrenceUpdated(Meeting.EventRecurrence recurrence)
        {
            _meeting.Recurrence = recurrence;
            OnPropertyChanged(() => IsSerial);

            if (IsSerial)
            {
                RecurrenceDate = DateTimeUtils.BuildRecurrentDate(_meeting.Recurrence);
            }
        }
        private void SetDefaultTimes(Meeting meeting)
        {
            meeting.Start = new ZonedDateTime
            {
                DateTime = GetDefaultStartTime(),
                TimeZone = TimeZoneInfo.Local.Id
            };

            meeting.End = new ZonedDateTime
            {
                DateTime = GetDefaultStartTime() + TimeSpan.FromMinutes(30),
                TimeZone = TimeZoneInfo.Local.Id
            };
        }
        private Meeting CreateNewMeeting()
        {
            var meeting = new Meeting
            {
                Start = new ZonedDateTime(),
                End = new ZonedDateTime(),
                Body = new Body
                {
                    ContentType = "text"
                },
                Attendees = new List<Attendee>(),
                Location = new Location(),
                OriginalStartTimeZone = TimeZoneInfo.Local.Id,
                OriginalEndTimeZone = TimeZoneInfo.Local.Id
            };

            SetDefaultTimes(meeting);

            return meeting;
        }
        public override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary<string, object> viewModelState)
        {
            base.OnNavigatedTo(e, viewModelState);

            if (e.NavigationMode == NavigationMode.New)
            {
                if (e.Parameter != null)
                {
                    _meeting = Deserialize<Meeting>(e.Parameter);
                }
                else
                {
                    _meeting = CreateNewMeeting();
                }
            }

            if (IsSerial)
            {
                RecurrenceDate = DateTimeUtils.BuildRecurrentDate(_meeting.Recurrence);
            }

            PopulateAttendees();
        }
        private void RecurrenceUpdated(Meeting.EventRecurrence recurrence)
        {
            Meeting.Recurrence = recurrence;
            OnPropertyChanged(() => IsSerial);

            BuildRecurrentDate();
        }
 private void ViewMeetingInstance(Meeting meeting)
 {
     NavigateToEditOrDetails(meeting);
 }
        private async void ViewMeetingSeries(Meeting meeting)
        {
            if (meeting.SeriesMasterId != null)
            {
                meeting = await GetEventById(meeting.SeriesMasterId);
            }

            NavigateToEditOrDetails(meeting);
        }
 private void NavigateToEditOrDetails(Meeting meeting)
 {
     if (meeting != null)
     {
         UI.NavigateTo(meeting.IsOrganizer ? "Edit" : "Details", meeting);
     }
 }
 private async void SendLate(Meeting meeting)
 {
     await SendRunningLate(meeting);
 }
        private async Task<bool> ConfirmCancellation(Meeting meeting)
        {
            string format;

            if (meeting.IsSerial)
            {
                format = GetString("CancelSeries");
            }
            else if (meeting.Type.EqualsCaseInsensitive(OData.Occurrence))
            {
                format = GetString("CancelOccurence");
            }
            else
            {
                format = GetString("CancelInstance");
            }

            return await YesNoDialog(string.Format(format, meeting.Subject));
        }