public override void Run() { if (isFirstStartPage) { isFirstStartPage = false; ProjectService.SolutionLoaded += delegate { // close all start pages when loading a solution foreach (IViewContent v in WorkbenchSingleton.Workbench.ViewContentCollection.ToArray()) { BrowserPane b = v as BrowserPane; if (b != null) { if (b.Url.Scheme == "startpage") { b.WorkbenchWindow.CloseWindow(true); } } } }; } foreach (IViewContent view in WorkbenchSingleton.Workbench.ViewContentCollection) { BrowserPane b = view as BrowserPane; if (b != null) { if (b.Url.Scheme == "startpage") { view.WorkbenchWindow.SelectWindow(); return; } } } WorkbenchSingleton.Workbench.ShowView(new BrowserPane(new Uri("startpage://start/"))); }
public static BrowserPane CreateNewHelp2BrowserView() { BrowserPane tempPane = new BrowserPane(); WorkbenchSingleton.Workbench.ShowView(tempPane); return(tempPane); }
private BrowserFolder getFolderForFile(BrowserPane browserPane, string searchedFileName) { BrowserFolder folder = null; foreach (BrowserFolder curentFolder in browserPane.TopNode.BrowserFolders) { foreach (BrowserNode node in curentFolder.BrowserNode.BrowserNodes) { if (node.NativeObject is ComponentOccurrence) { ComponentOccurrence occ = (ComponentOccurrence)node.NativeObject; string currentFileName = occ.ReferencedFileDescriptor.FullFileName; if (!searchedFileName.Equals(currentFileName, StringComparison.InvariantCultureIgnoreCase)) { continue; } } else { continue; } folder = curentFolder; break; } } if (folder == null) { ObjectCollection colNodes = inventor.TransientObjects.CreateObjectCollection(); folder = browserPane.AddBrowserFolder("temp", colNodes); } return(folder); }
static void DisplayLocalHelp(string arguments, bool embedded) { if (string.IsNullOrEmpty(arguments)) { throw new ArgumentNullException("arguments"); } if (!Help3Environment.IsLocalHelp) { return; } if (!HelpLibraryAgent.IsRunning) { HelpLibraryAgent.Start(); Thread.Sleep(0x3e8); } string helpUrl = string.Format(@"{0}{1}{2}", arguments, ProjectLanguages.GetCurrentLanguageAsHttpParam(), (embedded)?"&embedded=true":string.Empty); if (Help3Service.Config.ExternalHelp) { DisplayHelpWithShellExecute(helpUrl); return; } BrowserPane browser = ActiveHelp3Browser(); if (browser != null) { LoggingService.Info(string.Format("Help 3.0: Navigating to {0}", helpUrl)); browser.Navigate(Help3Environment.GetHttpFromMsXHelp(helpUrl)); browser.WorkbenchWindow.SelectWindow(); } }
static BrowserPane ActiveHelp3Browser() { IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow; if (window != null) { BrowserPane browser = window.ActiveViewContent as BrowserPane; if (browser != null && browser.Url.Scheme == "http") { return(browser); } } foreach (IViewContent view in WorkbenchSingleton.Workbench.ViewContentCollection) { BrowserPane browser = view as BrowserPane; if (browser != null && browser.Url.Scheme == "http") { return(browser); } } BrowserPane tmp = new BrowserPane(); WorkbenchSingleton.Workbench.ShowView(tmp); return(tmp); }
/// <summary> /// 执行显示网页的命令。 /// </summary> public override void Run() { try { foreach (IViewContent view in WorkbenchSingleton.Workbench.ViewContentCollection) { if (view.TitleName == _titleName) { view.WorkbenchWindow.SelectWindow(); return; } } BrowserPane pane = new BrowserPane(false); pane.TitleName = _titleName; pane.Navigate(_url); pane.TitleNameChanged += new EventHandler((o, e) => { _titleName = pane.TitleName; }); WorkbenchSingleton.Workbench.ShowView(pane); } catch (Exception ex) { MessageService.ShowError(ex.Message); } }
public void AddAssemblyBrowserFolder() { AssemblyDocument oDoc = (AssemblyDocument)_InvApplication.ActiveDocument; AssemblyComponentDefinition oDef = oDoc.ComponentDefinition; BrowserPane oPane = default(BrowserPane); oPane = oDoc.BrowserPanes.ActivePane; // Create an object collection ObjectCollection oOccurrenceNodes = default(ObjectCollection); oOccurrenceNodes = _InvApplication.TransientObjects.CreateObjectCollection(); foreach (ComponentOccurrence oOcc in oDef.Occurrences) { // Get the node associated with this occurrence. BrowserNode oNode = default(BrowserNode); oNode = oPane.GetBrowserNodeFromObject(oOcc); // Add the node to the collection. oOccurrenceNodes.Add(oNode); } // Add the folder to the browser and specify the nodes to be grouped within it. BrowserFolder oFolder = default(BrowserFolder); oFolder = oPane.AddBrowserFolder("My Occurrences Folder", oOccurrenceNodes); }
private void onClickBundle(NameValueMap Context) { Document oDoc = inventor.ActiveDocument; if (!(oDoc is AssemblyDocument)) { return; } AssemblyDocument doc = (AssemblyDocument)oDoc; BrowserPane browserPane = doc.BrowserPanes[MODELBROWSERNAME]; BrowserNode topNode = browserPane.TopNode; BrowserNode selectedNode = getSelectedNode(topNode); if (selectedNode == null) { return; } string fileToBundle = ""; if (selectedNode.NativeObject is ComponentOccurrence) { ComponentOccurrence occ = (ComponentOccurrence)selectedNode.NativeObject; fileToBundle = occ.ReferencedFileDescriptor.FullFileName; BrowserFolder folder = getFolderForFile(browserPane, fileToBundle); List <BrowserNode> nodesWithFileName = getNodesWithFileName(fileToBundle, topNode); foreach (BrowserNode foundNode in nodesWithFileName) { folder.Add(foundNode); } folder.Name = nodesWithFileName.Count + "x " + System.IO.Path.GetFileNameWithoutExtension(fileToBundle); } else if (selectedNode.NativeObject is BrowserFolder) { BrowserFolder folder = (BrowserFolder)selectedNode.NativeObject; if (folder.BrowserNode.BrowserNodes[1].NativeObject is ComponentOccurrence) { ComponentOccurrence occ = (ComponentOccurrence)folder.BrowserNode.BrowserNodes[1].NativeObject; fileToBundle = occ.ReferencedFileDescriptor.FullFileName; folder.Delete(); folder = getFolderForFile(browserPane, fileToBundle); List <BrowserNode> nodesWithFileName = getNodesWithFileName(fileToBundle, topNode); foreach (BrowserNode foundNode in nodesWithFileName) { folder.Add(foundNode); } folder.Name = nodesWithFileName.Count + "x " + System.IO.Path.GetFileNameWithoutExtension(fileToBundle); } } }
public static void OpenHelpView(string topicLink, IHxTopic topic, bool hiliteMatchingWords) { hiliteMatches = hiliteMatchingWords; lastTopic = topic; BrowserPane help2Browser = ActiveHelp2BrowserView(); if (help2Browser != null) { help2Browser.Navigate(topicLink); help2Browser.WorkbenchWindow.SelectWindow(); } }
public BrowserView(BrowserPane browserPane, Uri url) { InitializeComponent(); this.HideOnClose = false; this.TabText = "Browser"; _workbenchService = ServiceUnity.Container.Resolve <IWorkbenchService>(); browserPane.View.StatusTextChanged = (e) => { _workbenchService.SetStatusMessage(e); }; browserPane.View.TitleChanged = (e) => { this.TabText = e; }; browserPane.View.NewWindow += (sender, e) => { _workbenchService.Show(new BrowserView(e.BrowserPane, e.Url)); }; this.Controls.Add(browserPane.View); browserPane.Navigate(url.ToString()); }
static void DisplaySearchOnMSDN(string searchWords) { if (string.IsNullOrEmpty(searchWords)) { throw new ArgumentNullException("searchWords"); } string msdnUrl = string.Format(@"http://social.msdn.microsoft.com/Search/{0}/?query={1}&ac=3", CultureInfo.CurrentUICulture.ToString(), searchWords.Replace(" ", "+")); BrowserPane browser = ActiveHelp3Browser(); if (browser != null) { LoggingService.Info(string.Format("Help 3.0: Navigating to {0}", msdnUrl)); browser.Navigate(msdnUrl); browser.WorkbenchWindow.SelectWindow(); } }
static void DisplayHelpOnMSDN(string keyword) { if (string.IsNullOrEmpty(keyword)) { throw new ArgumentNullException("keyword"); } string msdnUrl = string.Format(@"http://msdn.microsoft.com/library/{0}.aspx", keyword); if (Help3Service.Config.ExternalHelp) { DisplayHelpWithShellExecute(msdnUrl); return; } BrowserPane browser = ActiveHelp3Browser(); if (browser != null) { LoggingService.Info(string.Format("Help 3.0: Navigating to {0}", msdnUrl)); browser.Navigate(msdnUrl); browser.WorkbenchWindow.SelectWindow(); } }
public static BrowserPane ActiveHelp2BrowserView() { IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow; if (window != null) { BrowserPane browserPane = window.ActiveViewContent as BrowserPane; if (browserPane != null && browserPane.Url.Scheme == "ms-help") { return(browserPane); } } foreach (IViewContent view in WorkbenchSingleton.Workbench.ViewContentCollection) { BrowserPane browserPane = view as BrowserPane; if (browserPane != null && browserPane.Url.Scheme == "ms-help") { return(browserPane); } } return(CreateNewHelp2BrowserView()); }
private void BrowserForm_Load(object sender, EventArgs e) { //��ü����ĵ���������һ���ĵ����� Inventor.Document doc; doc = m_inventorApplication.ActiveDocument; //���ӵ��ĵ��¼���������Ӧ�ĵ��ر� docEvents = doc.DocumentEvents; //ʹ�������ؼ������µ���������� browserPane = doc.BrowserPanes.Add("Calendar", "MSCAL.Calendar"); //���õ������ؼ������� calCtrl = (MSACAL.Calendar)browserPane.Control; //���������ؼ���ʾ��ǰ���� calCtrl.Today(); //ʹ�´����Ϊ����� browserPane.Activate(); calCtrl.Click += new MSACAL.DCalendarEvents_ClickEventHandler(calCtrl_Click); }
/// <summary> /// when [ActiveXBrowser] button is clicked /// </summary> /// <param name="Context"></param> /// <remarks></remarks> private void m_ActiveXBrowser_OnExecute(Inventor.NameValueMap Context) { //get active document Document oDoc = m_inventorApplication.ActiveDocument; //get the BrowserPanes BrowserPanes oPanes = default(BrowserPanes); oPanes = oDoc.BrowserPanes; //add the BrowserPane with the control BrowserPane oPane = default(BrowserPane); oPane = oPanes.Add("MyActiveXPane", "BrowserSample.UserControl1"); //get the control m_ActiveX = (UserControl1)oPane.Control; //call a method of the control m_ActiveX.DrawASketchRectangle(m_inventorApplication); //activate the BrowserPane oPane.Activate(); }
private void Unload() { calCtrl=null; docEvents = null; if (browserPane != null) { browserPane.Delete(); browserPane = null; } }
public BrowserPaneEventsLib(Application inventorApp, BrowserPane browserPane) { this.inventorApp = inventorApp; BrowserPane = browserPane; Activate(); }