protected override void Dispose(bool disposing) { try { if (disposing) { if (this.editorControl != null && this.editorControl.DataGridControl != null) { this.editorControl.DataGridControl.TextChanged -= new System.EventHandler(this.OnTextChange); this.editorControl.DataGridControl.MouseDown -= new MouseEventHandler(this.OnMouseClick); this.editorControl.DataGridControl.SelectionChanged -= new EventHandler(this.OnSelectionChanged); this.editorControl.DataGridControl.KeyDown -= new KeyEventHandler(this.OnKeyDown); this.editorControl.DataGridControl.GotFocus -= new EventHandler(this.OnGotFocus); } // Dispose the timers if (null != FileChangeTrigger) { FileChangeTrigger.Dispose(); FileChangeTrigger = null; } if (null != FNFStatusbarTrigger) { FNFStatusbarTrigger.Dispose(); FNFStatusbarTrigger = null; } SetFileChangeNotification(null, false); if (editorControl != null) { if (editorControl.DataGridControl != null) { editorControl.DataGridControl.Dispose(); } editorControl.Dispose(); editorControl = null; } if (FileChangeTrigger != null) { FileChangeTrigger.Dispose(); FileChangeTrigger = null; } if (extensibleObjectSite != null) { extensibleObjectSite.NotifyDelete(this); extensibleObjectSite = null; } GC.SuppressFinalize(this); } } finally { base.Dispose(disposing); } }
/// <summary> /// Initialization routine for the Editor. Loads the list of properties for the resx-aggregator document /// which will show up in the properties window /// </summary> /// <param name="package"></param> private void PrivateInit(ResX_AggregatorPackage package) { myPackage = package; loading = false; gettingCheckoutStatus = false; trackSel = null; Control.CheckForIllegalCrossThreadCalls = false; // Create an ArrayList to store the objects that can be selected ArrayList listObjects = new ArrayList(); // Create the object that will show the document's properties // on the properties window. GridEditorProperties prop = new GridEditorProperties(this); listObjects.Add(prop); // Create the SelectionContainer object. selContainer = new Microsoft.VisualStudio.Shell.SelectionContainer(true, false); selContainer.SelectableObjects = listObjects; selContainer.SelectedObjects = listObjects; // Create and initialize the editor System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(GridEditorPane)); this.editorControl = new GridEditor(); resources.ApplyResources(this.editorControl, "editorControl", CultureInfo.CurrentUICulture); // Event handlers for macro recording. this.editorControl.DataGridControl.TextChanged += new System.EventHandler(this.OnTextChange); this.editorControl.DataGridControl.MouseDown += new MouseEventHandler(this.OnMouseClick); this.editorControl.DataGridControl.SelectionChanged += new EventHandler(this.OnSelectionChanged); this.editorControl.DataGridControl.KeyDown += new KeyEventHandler(this.OnKeyDown); this.editorControl.CellKeyDown += new KeyEventHandler(this.OnCellKeyDown); this.editorControl.CellKeyPressed += new KeyPressEventHandler(this.OnCellKeyPress); // Handle Focus event this.editorControl.DataGridControl.GotFocus += new EventHandler(this.OnGotFocus); // Call the helper function that will do all of the command setup work setupCommands(); }