Beispiel #1
0
        private void ScriptInternalEditorCommand_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            // Force update of script interface
            ScriptEditButton.Focus();

            Script sc = Model.CurMainTree.Script;

            if (ScriptEditWindow.Count != 0)
            {
                return;
            }

            ScriptEditDialog = new ScriptEditWindow(sc, Model)
            {
                Owner = this
            };

            // Open as Modal
            // If ScriptEditWindow returns true in DialogResult, refresh script
            if (ScriptEditDialog.ShowDialog() == true)
            {
                sc = ScriptEditDialog.Tag as Script;
                Debug.Assert(sc != null, $"{nameof(sc)} != null");

                Model.DisplayScript(sc);
                Model.CurMainTree.Script = sc;
            }
        }
Beispiel #2
0
        private void ScriptEditCommand_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            // Force update of script interface
            ScriptEditButton.Focus();

            if (Model.IsTreeEntryFile)
            { // Open Context Menu
                if (e.Source is Button button && button.ContextMenu is ContextMenu menu)
                {
                    menu.PlacementTarget = button;
                    menu.IsOpen          = true;
                }
            }
            else
            { // Open Folder
                MainViewCommands.ScriptExternalEditorCommand.Execute(null, null);
            }
        }
Beispiel #3
0
        private void ScriptExternalEditorCommand_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            // Force update of script interface
            ScriptEditButton.Focus();

            Script sc = Model.CurMainTree.Script;

            switch (sc.Type)
            {
            case ScriptType.Script:
            case ScriptType.Link:
                MainViewModel.OpenTextFile(sc.RealPath);
                break;

            default:
                MainViewModel.OpenFolder(sc.RealPath);
                break;
            }
        }