private static void SetTextEditorText(ScriptEditorWindow view, string code) { var editor = view.ChildrenOfType <ICSharpCode.AvalonEdit.TextEditor>(); editor.FirstOrDefault().Text = code; DispatcherUtil.DoEvents(); }
private static ICSharpCode.AvalonEdit.TextEditor FindCodeEditor(ScriptEditorWindow view) { DispatcherUtil.DoEvents(); var windowGrid = view.Content as Grid; var codeEditor = windowGrid .ChildrenOfType <ICSharpCode.AvalonEdit.TextEditor>() .First(); return(codeEditor); }
private static ComboBox FindEditorDropDown(ScriptEditorWindow view) { DispatcherUtil.DoEvents(); // after simulating the click event get the opened Script editor window // and fetch the EngineSelector dropdown var windowGrid = view.Content as Grid; var engineSelectorComboBox = windowGrid .ChildrenOfType <ComboBox>() .First(x => x.Name == "EngineSelectorComboBox"); return(engineSelectorComboBox); }
private void ExecuteEditScript(Script script) { if (script is ScriptExpression) { ScriptExpression expression = (ScriptExpression)script; ScriptEditorWindow editor = new ScriptEditorWindow(); editor.Owner = App.Current.MainWindow; editor.WindowStartupLocation = WindowStartupLocation.CenterOwner; editor.Expression = expression.Expression; if (editor.ShowDialog() == true) { expression.Expression = editor.Expression; } } else if (script is ScriptFile) { ScriptFile scriptFile = (ScriptFile)script; Process.Start("notepad.exe", scriptFile.Path); } }
private void EditScriptContent() { var editWindow = new ScriptEditorWindow(dynamoViewModel); editWindow.Initialize(GUID, "ScriptContent", Script); bool? acceptChanged = editWindow.ShowDialog(); if (acceptChanged.HasValue && acceptChanged.Value) { RequiresRecalc = true; } }