private void UIElement_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { Rectangle selectedRectangle = (Rectangle)sender; CalendarEventViewModel selectedEvent = (CalendarEventViewModel)selectedRectangle.DataContext; string message = "Hora Inicio: " + selectedEvent.GetStartTime() + "\n"; message += "Hora Fin: " + selectedEvent.GetFinishTime(); MessageBox.Show(message, selectedEvent.Title); }
private void UIElement_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { Rectangle selectedRectangle = (Rectangle)sender; CalendarEventViewModel selectedEvent = (CalendarEventViewModel)selectedRectangle.DataContext; string message = ""; message += String.Format(applicationCulture, "Author: {0}\n", selectedEvent.Owner); message += String.Format(applicationCulture, "Starting hour: {0}\n", selectedEvent.GetStartTime()); message += String.Format(applicationCulture, "Ending hour: {0}", selectedEvent.GetFinishTime()); if (selectedEvent.Owner == displayCalendarViewModel.GetLoggedUser()) { MessageBoxResult result = MessageBox.Show(message, Properties.Resources.editEventPrompt, MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No); if (result == MessageBoxResult.Yes) { NewEventView editDialog = new NewEventView(selectedEvent); bool? editDialogResult = editDialog.ShowDialog(); if (editDialogResult == true) { if (editDialog.DeleteRequested) { displayCalendarViewModel.DeleteCalendarEvent(selectedEvent); return; } List <string> ignoredUsers = DeleteScheduleConflicts(editDialog); if (ignoredUsers.Count != 0) { string errorMessageString = "Conflict detected on following user agendas: {0}. Invitation to conflict users has been ignored."; string errorMessage = String.Format( applicationCulture, errorMessageString, String.Join(",", ignoredUsers.ToArray())); MessageBox.Show(errorMessage); } CalendarEvent calendarEvent = selectedEvent.CalendarEvent; displayCalendarViewModel.UpdateCalendarEvent(calendarEvent, editDialog.TitleInput.Text, editDialog.PickedDate, editDialog.InvitedUsers, editDialog.Description, editDialog.EndingHour, editDialog.EndingMinutes, editDialog.StartingHour, editDialog.StartingMinutes); } } } else { MessageBox.Show(message, Properties.Resources.userIsInvited, MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.No); } }