예제 #1
0
        public void Execute(object parameter)
        {
            if (((WorkPageViewModel)App.Current.Resources["WorkPageVM"]).SelectedNote.Author != ((MainWindowViewModel)App.Current.Resources["MainWindowVM"]).LoggedUser.Name)
            {
                MessageBox.Show("Cannot edit this note because you are not the author.");
            }
            else
            {
                NoteEditorWindow window = new NoteEditorWindow();
                window.Owner = App.Current.MainWindow;
                window.WindowStartupLocation = WindowStartupLocation.CenterOwner;


                window.Note = new Note
                {
                    Text   = ((WorkPageViewModel)App.Current.Resources["WorkPageVM"]).SelectedNote.Text,
                    Author = ((WorkPageViewModel)App.Current.Resources["WorkPageVM"]).SelectedNote.Author
                };

                window.SaveCommand   = new SaveCommand(window.Note, true);
                window.CancelCommand = new CancelCommand();

                window.ShowDialog();
            }
        }
예제 #2
0
        public void Execute(object parameter)
        {
            NoteEditorWindow window = new NoteEditorWindow();

            window.Owner = App.Current.MainWindow;
            window.WindowStartupLocation = WindowStartupLocation.CenterOwner;


            window.Note = new Note
            {
                Text   = "Write your note here.",
                Author = ((MainWindowViewModel)App.Current.Resources["MainWindowVM"]).LoggedUser.Name
            };

            window.SaveCommand   = new SaveCommand(window.Note, false);
            window.CancelCommand = new CancelCommand();

            window.ShowDialog();
        }