/// <summary> /// Initialization routine for the editor. Loads the list of properties for the nuset document /// which will show up in the properties window /// </summary> /// <param name="package"> /// The package /// </param> private void PrivateInit(NuSetPackage package) { this.myPackage = package; this.editorIsLoading = false; this.editorIsGettingCheckoutStatus = false; this.trackSelection = null; Control.CheckForIllegalCrossThreadCalls = false; // Create an ArrayList to store the objects that can be selected var listObjects = new ArrayList(); // Create the object that will show the document's properties // on the properties window. var prop = new EditorProperties(this); listObjects.Add(prop); // Create the SelectionContainer object. this.selectionContainer = new SelectionContainer(true, false) { SelectableObjects = listObjects, SelectedObjects = listObjects }; // Create and initialize the editor var resources = new ComponentResourceManager(typeof(EditorPane)); this.EditorControl = new MyEditor(); resources.ApplyResources(this.EditorControl, "EditorControl", CultureInfo.CurrentUICulture); // Event handlers for macro recording. this.EditorControl.RichTextBoxControl.TextChanged += this.OnTextChange; this.EditorControl.RichTextBoxControl.MouseDown += this.OnMouseClick; this.EditorControl.RichTextBoxControl.SelectionChanged += this.OnSelectionChanged; this.EditorControl.RichTextBoxControl.KeyDown += this.OnKeyDown; // Handle Focus event this.EditorControl.RichTextBoxControl.GotFocus += this.OnGotFocus; // Call the helper function that will do all of the command setup work this.SetupCommands(); }
protected override void Dispose(bool disposing) { try { if (!disposing) { return; } if (this.EditorControl != null && this.EditorControl.RichTextBoxControl != null) { this.EditorControl.RichTextBoxControl.TextChanged -= this.OnTextChange; this.EditorControl.RichTextBoxControl.MouseDown -= this.OnMouseClick; this.EditorControl.RichTextBoxControl.SelectionChanged -= this.OnSelectionChanged; this.EditorControl.RichTextBoxControl.KeyDown -= this.OnKeyDown; this.EditorControl.RichTextBoxControl.GotFocus -= this.OnGotFocus; } // Dispose the timers if (null != this.FileChangeTrigger) { this.FileChangeTrigger.Dispose(); this.FileChangeTrigger = null; } if (null != this.FNFStatusbarTrigger) { this.FNFStatusbarTrigger.Dispose(); this.FNFStatusbarTrigger = null; } this.SetFileChangeNotification(null, false); if (this.EditorControl != null) { this.EditorControl.RichTextBoxControl.Dispose(); this.EditorControl.Dispose(); this.EditorControl = null; } if (this.FileChangeTrigger != null) { this.FileChangeTrigger.Dispose(); this.FileChangeTrigger = null; } if (this.extensibleObjectSite != null) { this.extensibleObjectSite.NotifyDelete(this); this.extensibleObjectSite = null; } GC.SuppressFinalize(this); } finally { base.Dispose(disposing); } }