コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        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);
        }