Exemplo n.º 1
0
        /// <summary>
        /// Add new notebook log
        /// </summary>
        public void AddNotebookLog(object sender)
        {
            var selecteNotebookLogItem = (NotebookLogItem)sender;

            var dialog = new NotebookLogDialog();

            dialog.Closing += (s, e) =>
            {
                if (dialog.DataContext is NotebookLogViewModel vm && vm.NotebookLog != null)
                {
                    var notebookLogItem = new NotebookLogItem
                    {
                        NotebookLog = vm.NotebookLog,

                        EditNotebookLogCommand   = new RelayParameterizedCommand(EditNotebookLog),
                        DeleteNotebookLogCommand = new RelayParameterizedCommand(DeleteNotebookLog)
                    };

                    SelectedNotebookItem.NotebookLogItems.Insert(0, notebookLogItem);
                }
            };

            dialog.ShowDialogWindow(new NotebookLogViewModel(dialog, new NotebookLog
            {
                NotebookId = SelectedNotebookItem.Notebook.Id
            }));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Edit notebook log
        /// </summary>
        /// <param name="sender">Button</param>
        public void EditNotebookLog(object sender)
        {
            var notebookLog = (NotebookLog)sender;

            var dialog = new NotebookLogDialog();

            dialog.Closing += (s, e) =>
            {
                if (dialog.DataContext is NotebookLogViewModel vm && vm.NotebookLog != null)
                {
                    notebookLog = vm.NotebookLog;
                }
            };

            dialog.ShowDialogWindow(new NotebookLogViewModel(dialog, notebookLog));
        }