예제 #1
0
        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;
        }
예제 #2
0
		/// <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);
		}
예제 #3
0
 /// <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);
 }
예제 #4
0
		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;
		}
예제 #5
0
 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;
 }
예제 #6
0
        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);
                }
            }
        }
예제 #7
0
 public ReplEditorCtxMenuContext(IReplEditor ui)
 {
     UI = ui;
     VM = ScriptContent.GetScriptContent(ui).ScriptControlVM;
 }
예제 #8
0
		protected override ScriptControlVM CreateScriptControlVM(IReplEditor replEditor, IServiceLocator serviceLocator, ReplSettings replSettings) =>
			new CSharpControlVM(replEditor, replSettings, serviceLocator);
예제 #9
0
 protected override ScriptControlVM CreateScriptControlVM(IReplEditor replEditor, IServiceLocator serviceLocator) =>
 new CSharpControlVM(replEditor, serviceLocator);
예제 #10
0
 public VisualBasicControlVM(IReplEditor replEditor, ReplSettings settings, IServiceLocator serviceLocator)
     : base(replEditor, settings, serviceLocator)
 {
 }
예제 #11
0
		protected override ScriptControlVM CreateScriptControlVM(IReplEditor replEditor, IServiceLocator serviceLocator) =>
			new VisualBasicControlVM(replEditor, serviceLocator);
예제 #12
0
 public CSharpControlVM(IReplEditor replEditor, ReplSettings settings, IServiceLocator serviceLocator)
     : base(replEditor, settings, serviceLocator)
 {
 }
예제 #13
0
 protected abstract ScriptControlVM CreateScriptControlVM(IReplEditor replEditor, IServiceLocator serviceLocator, ReplSettings replSettings);
예제 #14
0
 public static ScriptContent GetScriptContent(IReplEditor replEditor) => (ScriptContent)replEditor.Tag;
예제 #15
0
파일: CSharpContent.cs 프로젝트: n017/dnSpy
 protected override ScriptControlVM CreateScriptControlVM(IReplEditor replEditor, IServiceLocator serviceLocator)
 {
     return new CSharpControlVM(replEditor, serviceLocator);
 }
예제 #16
0
 public CSharpControlVM(IReplEditor replEditor, IServiceLocator serviceLocator)
     : base(replEditor, serviceLocator)
 {
 }
예제 #17
0
		public static ScriptContent GetScriptContent(IReplEditor replEditor) => (ScriptContent)replEditor.Tag;
예제 #18
0
 protected override ScriptControlVM CreateScriptControlVM(IReplEditor replEditor, IServiceLocator serviceLocator, ReplSettings replSettings) =>
 new VisualBasicControlVM(replEditor, replSettings, serviceLocator);
예제 #19
0
		protected abstract ScriptControlVM CreateScriptControlVM(IReplEditor replEditor, IServiceLocator serviceLocator, ReplSettings replSettings);