/// <summary> /// Called to initialize the extension. /// </summary> /// <param name="host">WebMatrix host interface.</param> /// <param name="initData">Extension initialization data.</param> protected override void Initialize(IWebMatrixHost host, ExtensionInitData initData) { _webMatrixHost = host; initData.RibbonItems.Add( new RibbonGroup( "TypeScript", new RibbonItem[] { new RibbonButton( "Compile TypeScript", new DelegateCommand(CanExecute, HandleRibbonButtonCompileTypeScriptInvoke), null, _typescriptCompileImageSmall, _typescriptCompileImageLarge), new RibbonButton( "Update software", new DelegateCommand(CanExecute, HandleRibbonButtonUpdateSoftwareInvoke), null, _typescriptUpdateImageSmall, _typescriptUpdateImageLarge) })); _executer = DesignFactory.WebMatrix.ExecuterFactory.GetExecuter( "TypeScript", _webMatrixHost, _editorTaskPanel); _webMatrixHost.WebSiteChanged += (sender, e) => _executer.InitializeTabs(); // Register handler for right-click context menu _webMatrixHost.ContextMenuOpening += new EventHandler<ContextMenuOpeningEventArgs>(webMatrixHost_ContextMenuOpening); }
protected override void Initialize(IWebMatrixHost host, ExtensionInitData initData) { this.Host = (IWebMatrixHostInternal)host; this.Globals = new ModuleGlobals(this.Host, this.Host.ServiceProvider); this.Host.WebSiteChanged += this.Host_WebSiteChanged; }
/// <summary> /// Called to initialize the extension. /// </summary> /// <param name="host">WebMatrix host interface.</param> /// <param name="initData">Extension initialization data.</param> protected override void Initialize(IWebMatrixHost host, ExtensionInitData initData) { _webMatrixHost = host; initData.RibbonItems.Add( new RibbonGroup( "TypeScript", new RibbonItem[] { new RibbonButton( "Compile TypeScript", new DelegateCommand(CanExecute, HandleRibbonButtonCompileTypeScriptInvoke), null, _typescriptCompileImageSmall, _typescriptCompileImageLarge), new RibbonButton( "Update software", new DelegateCommand(CanExecute, HandleRibbonButtonUpdateSoftwareInvoke), null, _typescriptUpdateImageSmall, _typescriptUpdateImageLarge) })); _executer = DesignFactory.WebMatrix.ExecuterFactory.GetExecuter( "TypeScript", _webMatrixHost, _editorTaskPanel); _webMatrixHost.WebSiteChanged += (sender, e) => _executer.InitializeTabs(); // Register handler for right-click context menu _webMatrixHost.ContextMenuOpening += new EventHandler <ContextMenuOpeningEventArgs>(webMatrixHost_ContextMenuOpening); }
//-------------------------------------------------------------------------- // // Event Handlers // //-------------------------------------------------------------------------- #region Initialize /// <summary> /// get a reference to the host when the app starts /// </summary> /// <param name="host"></param> protected override void Initialize(IWebMatrixHost host, ExtensionInitData data) { // add host event handlers _host = host; if (host != null) { host.WebSiteChanged += new EventHandler <EventArgs>(WebMatrixHost_WebSiteChanged); _worker = new Worker(host); host.ContextMenuOpening += new EventHandler <ContextMenuOpeningEventArgs>(host_ContextMenuOpening); InitSite(); } }
//-------------------------------------------------------------------------- // // Methods // //-------------------------------------------------------------------------- /// <summary> /// Called to initialize the extension. /// </summary> /// <param name="host">WebMatrix host interface.</param> /// <param name="initData">Extension initialization data.</param> protected override void Initialize(IWebMatrixHost host, ExtensionInitData initData) { _webMatrixHost = host; _webMatrixHost.WebSiteChanged += webMatrixHost_WebSiteChanged; // create a new ribbon button group that contains the get version button _ribbonGroup = new RibbonGroup( "NumediaStack", new RibbonItem[] { new RibbonButton( "Get Version", new DelegateCommand(HandleGetVersion), null, _starImageSmall, _starImageLarge) }); // create a new contextual ribbon tab that will only show up for Numedia Stack _contextualTab = new RibbonContextualTab("Numedia Stack Tools", new RibbonItem[] { _ribbonGroup }); }
//-------------------------------------------------------------------------- // // Event Handlers // //-------------------------------------------------------------------------- #region Initialize /// <summary> /// Called when the WebMatrixHost property changes. /// </summary> /// <param name="Host">Host used to communicate with WebMatrix</param> protected override void Initialize(IWebMatrixHost host, ExtensionInitData data) { // Get new values _host = host; if (host != null) { host.WorkspaceChanged += new EventHandler <WorkspaceChangedEventArgs>(WebMatrixHost_WorkspaceChanged); host.WebSiteChanged += new EventHandler <EventArgs>(WebMatrixHost_WebSiteChanged); // Add a simple button to the Ribbon _ribbonGroup = new RibbonGroup( "Node", new RibbonItem[] { new RibbonButton( "Debug", _launchDebuggerCommand, null, _starImageSmall, _starImageLarge) }); data.RibbonItems.Add(_ribbonGroup); _editorTaskPanel.PageChanged += InitializeLogTab; // handle the right click event the tree host.ContextMenuOpening += new EventHandler <ContextMenuOpeningEventArgs>(host_ContextMenuOpening); // if this is the first time the extension is installed, this method will be called if (_host.WebSite != null && !String.IsNullOrEmpty(_host.WebSite.Path)) { _isNodeSite = IsNodeProject(); _ribbonGroup.IsVisible = _host.Workspace is IEditorWorkspace && _isNodeSite; InitializeLogTab(this, EventArgs.Empty); } InstallNodeInspector(); } }
//-------------------------------------------------------------------------- // // Event Handlers // //-------------------------------------------------------------------------- #region Initialize /// <summary> /// Called when the WebMatrixHost property changes. /// </summary> /// <param name="Host">Host used to communicate with WebMatrix</param> protected override void Initialize(IWebMatrixHost host, ExtensionInitData data) { // Get new values _host = host; if (host != null) { host.WorkspaceChanged += new EventHandler<WorkspaceChangedEventArgs>(WebMatrixHost_WorkspaceChanged); host.WebSiteChanged += new EventHandler<EventArgs>(WebMatrixHost_WebSiteChanged); // Add a simple button to the Ribbon _ribbonGroup = new RibbonGroup( "Node", new RibbonItem[] { new RibbonButton( "Debug", _launchDebuggerCommand, null, _starImageSmall, _starImageLarge) }); data.RibbonItems.Add(_ribbonGroup); _editorTaskPanel.PageChanged += InitializeLogTab; // handle the right click event the tree host.ContextMenuOpening += new EventHandler<ContextMenuOpeningEventArgs>(host_ContextMenuOpening); // if this is the first time the extension is installed, this method will be called if (_host.WebSite != null && !String.IsNullOrEmpty(_host.WebSite.Path)) { _isNodeSite = IsNodeProject(); _ribbonGroup.IsVisible = _host.Workspace is IEditorWorkspace && _isNodeSite; InitializeLogTab(this, EventArgs.Empty); } InstallNodeInspector(); } }
/// <summary> /// get a reference to the host when the app starts /// </summary> /// <param name="host"></param> protected override void Initialize(IWebMatrixHost host, ExtensionInitData data) { // add host event handlers _host = host; if (host != null) { host.WebSiteChanged += new EventHandler<EventArgs>(WebMatrixHost_WebSiteChanged); _worker = new Worker(host); host.ContextMenuOpening += new EventHandler<ContextMenuOpeningEventArgs>(host_ContextMenuOpening); InitSite(); } }
protected override void Initialize(IWebMatrixHost host, ExtensionInitData initData) { this.webMatrixHost = host; this.webMatrixHost.WebSiteChanged += new EventHandler<EventArgs>(host_WebSiteChanged); this.webMatrixHost.TreeItemCreated += new EventHandler<TreeItemEventArgs>(webMatrixHost_TreeItemCreated); this.webMatrixHost.TreeItemRemoved += new EventHandler<TreeItemEventArgs>(webMatrixHost_TreeItemRemoved); this.webMatrixHost.ContextMenuOpening += new EventHandler<ContextMenuOpeningEventArgs>(webMatrixHost_ContextMenuOpening); var list = new List<RibbonButton>{ new RibbonButton("Initialize", this.gitInitCommand, null, Resources.git_init, Resources.git_32), //new RibbonButton("Clone", this.gitInitCommand, null, Resources.git_init, Resources.git_32), new RibbonButton("Commit Changes", this.gitCommitCommand, null, Resources.git_16, Resources.git_32), new RibbonButton("View Log/History", this.gitLogCommand, null, Resources.git_16, Resources.git_32), new RibbonButton("Refresh", this.gitRefreshCommand, null, Resources.git_16, Resources.git_32), new RibbonButton("Run Git Bash", this.gitBashCommand, null, Resources.git_16, Resources.git_32), }; var button = new RibbonSplitButton("Git", this.gitBashCommand, null, list, Resources.git_16, Resources.git_32); initData.RibbonItems.Add(button); }