private void DeleteNotes(DateTime?date) { var confirmationViewModel = new YesNoConfirmationViewModel { ConfirmationMessage = date.HasValue ? string.Format(CommonResourceManager.Instance.GetResourceString("XRay_YesNoConfirmationView_DeleteNotesMessage"), date.Value) : CommonResourceManager.Instance.GetResourceString("XRay_YesNoConfirmationView_DeleteAllNotesMessage") }; confirmationViewModel.OnYesAction = () => { StartAsyncOperation(() => { Progress = 0; ProgressEnabled = true; var noteProcessingService = ServiceLocator.Current.GetInstance <INoteProcessingService>(); noteProcessingService.ProgressChanged += (s, e) => { Progress = e.Progress; }; noteProcessingService.DeletesNotes(date); }, () => { ProgressEnabled = false; Progress = 0; }); }; var popupEventArgs = new RaisePopupEventArgs() { Title = CommonResourceManager.Instance.GetResourceString("XRay_YesNoConfirmationView_DeleteTitle"), Content = new YesNoConfirmationView(confirmationViewModel) }; eventAggregator.GetEvent <RaisePopupEvent>().Publish(popupEventArgs); }
public override bool OnClosing() { if (isClosing) { return(true); } var confirmationViewModel = new YesNoConfirmationViewModel { ConfirmationMessage = CommonResourceManager.Instance.GetResourceString("XRay_YesNoConfirmationView_ExitText"), OnYesAction = () => { isClosing = true; OnClosed(); } }; var popupEventArgs = new RaisePopupEventArgs() { Title = CommonResourceManager.Instance.GetResourceString("XRay_YesNoConfirmationView_Exit"), Content = new YesNoConfirmationView(confirmationViewModel) }; eventAggregator.GetEvent <RaisePopupEvent>().Publish(popupEventArgs); return(isClosing); }
private void RemoveNote() { var confirmationViewModel = new YesNoConfirmationViewModel { ConfirmationMessage = CommonResourceManager.Instance.GetResourceString("XRay_YesNoConfirmationView_DeleteItemMessage") }; confirmationViewModel.OnYesAction = () => { foreach (var stage in Stages) { if (SelectedStage is NoteObject) { var noteToRemove = SelectedStage as NoteObject; stage.Notes.Remove(noteToRemove); foreach (var group in stage.InnerGroups) { group.Notes.Remove(noteToRemove); } noteToRemove.TrackChanges(false); } else if (SelectedStage is InnerGroupObject) { var groupToRemove = SelectedStage as InnerGroupObject; stage.InnerGroups.Remove(groupToRemove); } SaveNote(); } }; var popupEventArgs = new RaisePopupEventArgs() { Title = CommonResourceManager.Instance.GetResourceString("XRay_YesNoConfirmationView_DeleteTitle"), Content = new YesNoConfirmationView(confirmationViewModel) }; eventAggregator.GetEvent <RaisePopupEvent>().Publish(popupEventArgs); }
private void RestoreDefaults() { var confirmationViewModel = new YesNoConfirmationViewModel { ConfirmationMessage = CommonResourceManager.Instance.GetResourceString("XRay_YesNoConfirmationView_RestoreDefaultsText") }; confirmationViewModel.OnYesAction = () => { NoteService.InitializeDefaultNotes(); eventAggregator.GetEvent <RestoreDefaultsEvent>().Publish(new RestoreDefaultsEventArgs()); }; var popupEventArgs = new RaisePopupEventArgs() { Title = CommonResourceManager.Instance.GetResourceString("XRay_YesNoConfirmationView_RestoreDefaults"), Content = new YesNoConfirmationView(confirmationViewModel) }; eventAggregator.GetEvent <RaisePopupEvent>().Publish(popupEventArgs); }
private void RemoveProfile() { var confirmationViewModel = new YesNoConfirmationViewModel { ConfirmationMessage = CommonResourceManager.Instance.GetResourceString("XRay_YesNoConfirmationView_DeleteItemMessage") }; confirmationViewModel.OnYesAction = () => { profiles.Remove(SelectedProfile); SelectedProfile = profiles.FirstOrDefault(); NoteService.SaveAppSettings(); eventAggregator.GetEvent <RefreshSettingsEvent>().Publish(new RefreshSettingsEventArgs()); }; var popupEventArgs = new RaisePopupEventArgs() { Title = CommonResourceManager.Instance.GetResourceString("XRay_YesNoConfirmationView_DeleteTitle"), Content = new YesNoConfirmationView(confirmationViewModel) }; eventAggregator.GetEvent <RaisePopupEvent>().Publish(popupEventArgs); }
private void ShowPendingChangedPopup(NoteObject noteObject) { var confirmationViewModel = new YesNoConfirmationViewModel { ConfirmationMessage = CommonResourceManager.Instance.GetResourceString("XRay_YesNoConfirmationView_SavePendingChangesText"), OnYesAction = () => { if (selectedNote != null) { selectedNote.Modified = false; } SaveNote(); SelectedNote = noteObject; }, OnNoAction = () => { if (selectedNote != null) { noteCopy?.CopyTo(selectedNote); selectedNote.Modified = false; } SelectedNote = noteObject; } }; var popupEventArgs = new RaisePopupEventArgs() { Title = CommonResourceManager.Instance.GetResourceString("XRay_YesNoConfirmationView_SavePendingChanges"), Content = new YesNoConfirmationView(confirmationViewModel) }; eventAggregator.GetEvent <RaisePopupEvent>().Publish(popupEventArgs); }