protected ScriptContent(IReplEditorProvider replEditorProvider, ReplEditorOptions replOpts, ReplSettings replSettings, IServiceLocator serviceLocator, string appearanceCategory) { replOpts.Roles.Add(PredefinedDsTextViewRoles.RoslynRepl); replEditor = replEditorProvider.Create(replOpts); replEditor.TextView.Options.SetOptionValue(DefaultWpfViewOptions.AppearanceCategory, appearanceCategory); scriptControl = new ScriptControl(); scriptControl.SetTextEditorObject(replEditor.UIObject); scriptControlVM = CreateScriptControlVM(replEditor, serviceLocator, replSettings); scriptControlVM.OnCommandExecuted += ScriptControlVM_OnCommandExecuted; RoslynReplEditorUtils.AddInstance(scriptControlVM, replEditor.TextView); replEditor.Tag = this; scriptControl.DataContext = scriptControlVM; }
ScriptControlVM TryGetInstance() => __replEditor ?? (__replEditor = RoslynReplEditorUtils.TryGetInstance(textView));