/// <summary> /// Creates control. /// </summary> /// <returns> /// The ensure window created. /// </returns> private JsParserToolWindow EnsureWindowCreated() { if (_toolWindow != null) { //Window is created already return(_toolWindow); } try { //Create window object obj = null; string guid = "{4CB92A30-3103-4AEB-824C-71A1DFA54F6D}"; var windows2 = (Windows2)_applicationObject.Windows; try { var t = typeof(NavigationTreeView); var window = windows2.CreateToolWindow2(_addInInstance, t.Assembly.Location, t.ToString(), "JavaScript Parser", guid, ref obj); window.Visible = true; _toolWindow = new JsParserToolWindow { Window = window, NavigationTreeView = (NavigationTreeView)obj, }; } catch (Exception ex) { Trace.WriteLine("js addin: Error while creating tool window"); MessageBox.Show("Error while creating tool window" + Environment.NewLine + ex.Message + Environment.NewLine + ex.Source, "JSParser"); return(null); } if (_toolWindow == null || _toolWindow.NavigationTreeView == null || _toolWindow.Window == null) { MessageBox.Show("Tool window has not created", "JSParser"); return(null); } try { _jsParserToolWindowManager.PerformInitialParsing(); } catch (Exception ex) { MessageBox.Show("Error while initializing JS Parser" + Environment.NewLine + ex.Message + Environment.NewLine + ex.Source, "JSParser"); return(null); } Trace.WriteLine("js addin: EnsureWindowCreated OK"); return(_toolWindow); } catch { return(null); } finally { } }
/// <summary> /// Creates control. /// </summary> /// <returns> /// The ensure window created. /// </returns> private JsParserToolWindow EnsureWindowCreated() { if (_toolWindow != null) { //Window is created already return _toolWindow; } try { //Create window object obj = null; string guid = "{4CB92A30-3103-4AEB-824C-71A1DFA54F6D}"; var windows2 = (Windows2)_applicationObject.Windows; try { var t = typeof(NavigationTreeView); var window = windows2.CreateToolWindow2(_addInInstance, t.Assembly.Location, t.ToString(), "JavaScript Parser", guid, ref obj); window.Visible = true; _toolWindow = new JsParserToolWindow { Window = window, NavigationTreeView = (NavigationTreeView)obj, }; } catch (Exception ex) { Trace.WriteLine("js addin: Error while creating tool window"); MessageBox.Show("Error while creating tool window" + Environment.NewLine + ex.Message + Environment.NewLine + ex.Source, "JSParser"); return null; } if (_toolWindow == null || _toolWindow.NavigationTreeView == null || _toolWindow.Window == null) { MessageBox.Show("Tool window has not created", "JSParser"); return null; } try { _jsParserToolWindowManager.PerformInitialParsing(); } catch (Exception ex) { MessageBox.Show("Error while initializing JS Parser" + Environment.NewLine + ex.Message + Environment.NewLine + ex.Source, "JSParser"); return null; } Trace.WriteLine("js addin: EnsureWindowCreated OK"); return _toolWindow; } catch { return null; } finally { } }