コード例 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ServiceToolWindow"/> class.
 /// </summary>
 public ServiceToolWindow(ToolWindowContext context) : base(null)
 {
     // This is the user control hosted by the tool window; Note that, even if this class implements IDisposable,
     // we are not calling Dispose on this object. This is because ToolWindowPane calls Dispose on
     // the object returned by the Content property.
     this.Content = new ServiceToolWindowControl(context);
 }
コード例 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ServiceToolWindowControl"/> class.
        /// </summary>
        public ServiceToolWindowControl(ToolWindowContext context)
        {
            this.InitializeComponent();

            this.Focusable = true;
            this.GotFocus += TermWindowControl_GotFocus;

            var target = new TerminalEvent(context.Package, this.terminalView, context.SolutionUtils);

            this.rpc           = JsonRpc.Attach(context.ServiceHubStream, target);
            this.package       = context.Package;
            this.solutionUtils = context.SolutionUtils;
        }
コード例 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TermWindowControl"/> class.
        /// </summary>
        public TermWindowControl(ToolWindowContext context)
        {
            this.InitializeComponent();

            this.package   = context.Package;
            this.Focusable = true;
            this.GotFocus += TermWindowControl_GotFocus;

            var target = new TerminalEvent(context.Package, this.terminalView, context.SolutionUtils);
            var rpc    = JsonRpc.Attach(context.ServiceHubStream, target);

            context.SolutionUtils.SolutionChanged += SolutionUtils_SolutionChanged;
            VSColorTheme.ThemeChanged             += VSColorTheme_ThemeChanged;

            this.terminalView.ScriptingObject = new TerminalScriptingObject(context.Package, rpc, context.SolutionUtils, null, true, null, null, null);

            string extensionDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            string rootPath           = Path.Combine(extensionDirectory, "WebView\\default.html").Replace("\\\\", "\\");

            this.terminalView.Navigate(new Uri(rootPath));
        }