protected ScriptControlVM(IReplEditor replEditor, ReplSettings replSettings, IServiceLocator serviceLocator) { this.dispatcher = Dispatcher.CurrentDispatcher; this.replSettings = replSettings; this.replSettings.PropertyChanged += ReplSettings_PropertyChanged; this.ReplEditor = replEditor; this.ReplEditor.CommandHandler = this; this.serviceLocator = serviceLocator; ReplEditor.TextView.Options.OptionChanged += Options_OptionChanged; var themeClassificationTypeService = serviceLocator.Resolve <IThemeClassificationTypeService>(); this.roslynClassificationTypes = RoslynClassificationTypes.GetClassificationTypeInstance(themeClassificationTypeService); this.defaultClassificationType = themeClassificationTypeService.GetClassificationType(TextColor.Error); this.toScriptCommand = new Dictionary <string, IScriptCommand>(StringComparer.Ordinal); foreach (var sc in CreateScriptCommands()) { foreach (var name in sc.Names) { this.toScriptCommand.Add(name, sc); } } WordWrapStyle = replSettings.WordWrapStyle; ShowLineNumbers = replSettings.ShowLineNumbers; }
/// <summary> /// Adds the <see cref="IReplEditor"/> instance to the <see cref="ITextView"/> properties /// </summary> /// <param name="replEditor">REPL editor</param> /// <param name="textView">REPL editor text view</param> public static void AddInstance(IReplEditor replEditor, ITextView textView) { if (replEditor == null) throw new ArgumentNullException(nameof(replEditor)); if (textView == null) throw new ArgumentNullException(nameof(textView)); textView.Properties.AddProperty(Key, replEditor); }
/// <summary> /// Adds the <see cref="IReplEditor"/> instance to the <see cref="ITextView"/> properties /// </summary> /// <param name="replEditor">REPL editor</param> /// <param name="textView">REPL editor text view</param> public static void AddInstance(IReplEditor replEditor, ITextView textView) { if (replEditor == null) { throw new ArgumentNullException(nameof(replEditor)); } if (textView == null) { throw new ArgumentNullException(nameof(textView)); } textView.Properties.AddProperty(Key, replEditor); }
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; }
protected ScriptControlVM(IReplEditor replEditor, IServiceLocator serviceLocator) { this.dispatcher = Dispatcher.CurrentDispatcher; this.replEditor = replEditor; this.replEditor.CommandHandler = this; this.serviceLocator = serviceLocator; this.toScriptCommand = new Dictionary <string, IScriptCommand>(StringComparer.Ordinal); foreach (var sc in CreateScriptCommands()) { foreach (var name in sc.Names) { this.toScriptCommand.Add(name, sc); } } }
public ReplEditorCtxMenuContext(IReplEditor ui) { UI = ui; VM = ScriptContent.GetScriptContent(ui).ScriptControlVM; }
protected override ScriptControlVM CreateScriptControlVM(IReplEditor replEditor, IServiceLocator serviceLocator, ReplSettings replSettings) => new CSharpControlVM(replEditor, replSettings, serviceLocator);
protected override ScriptControlVM CreateScriptControlVM(IReplEditor replEditor, IServiceLocator serviceLocator) => new CSharpControlVM(replEditor, serviceLocator);
public VisualBasicControlVM(IReplEditor replEditor, ReplSettings settings, IServiceLocator serviceLocator) : base(replEditor, settings, serviceLocator) { }
protected override ScriptControlVM CreateScriptControlVM(IReplEditor replEditor, IServiceLocator serviceLocator) => new VisualBasicControlVM(replEditor, serviceLocator);
public CSharpControlVM(IReplEditor replEditor, ReplSettings settings, IServiceLocator serviceLocator) : base(replEditor, settings, serviceLocator) { }
protected abstract ScriptControlVM CreateScriptControlVM(IReplEditor replEditor, IServiceLocator serviceLocator, ReplSettings replSettings);
public static ScriptContent GetScriptContent(IReplEditor replEditor) => (ScriptContent)replEditor.Tag;
protected override ScriptControlVM CreateScriptControlVM(IReplEditor replEditor, IServiceLocator serviceLocator) { return new CSharpControlVM(replEditor, serviceLocator); }
public CSharpControlVM(IReplEditor replEditor, IServiceLocator serviceLocator) : base(replEditor, serviceLocator) { }
protected override ScriptControlVM CreateScriptControlVM(IReplEditor replEditor, IServiceLocator serviceLocator, ReplSettings replSettings) => new VisualBasicControlVM(replEditor, replSettings, serviceLocator);