public XmlElement(System.Xml.XmlNode xmlNode, XmlEditor xmlEditor, EditorContext editorContext) { this.editorContext = editorContext; this.XmlNode = xmlNode; this.xmlEditor = xmlEditor; this.EditorState.CursorRaw.ChangedEvent.Add(this.Cursor_ChangedEvent); this.xmlEditor.MouseHandler.MouseDownEvent.Add(this._xmlEditor_MouseDownEvent); this.xmlEditor.MouseHandler.MouseUpEvent.Add(this._xmlEditor_MouseUpEvent); this.xmlEditor.MouseHandler.MouseDownMoveEvent.Add(this._xmlEditor_MouseDownMoveEvent); this.xmlEditor.CleanUpXmlElementsEvent += new EventHandler(_xmlEditor_xmlElementsCleanUpEvent); }
public XmlElementStandardNode(XmlNode xmlNode, XmlEditor xmlEditor, EditorContext editorContext) : base(xmlNode, xmlEditor, editorContext) { var IsEndTagVisible = this.XmlRules.HasEndTag(xmlNode); var colorTagBackground = this.XmlRules.NodeColor(this.XmlNode); this.nodeDimensions = new StandardNodeDimensionsAndColor(editorContext.EditorConfig, colorTagBackground); this.startTag = new StandardNodeStartTagPainter(this.Config, this.nodeDimensions, xmlNode, IsEndTagVisible); if (IsEndTagVisible) { this.endTag = new StandardNodeEndTagPainter(this.Config, this.nodeDimensions, xmlNode, IsEndTagVisible); } }
private async Task Init() { if (this.EditorContext == null) { throw new ArgumentNullException(nameof(this.EditorContext)); } this.EditorContext.NativePlatform = new BlazorNativePlatform(_canvasReference, new BlazorClipboard(this.clipboardService)); this.editor = new editor.XmlEditor(this.EditorContext); this.EditorContext.EditorState.RootNodeChanged.Add(this.RootNodeChanged); this.EditorContext.EditorState.ContentChangedEvent.Add(this.ContentChanged); this.editor.VirtualSizeChanged.Add(this.VirtualSizeChanged); await OnReady.InvokeAsync(EventArgs.Empty); }
// Dispose(bool disposing) executes in two distinct scenarios. // If disposing equals true, the method has been called directly // or indirectly by a user's code. Managed and unmanaged resources // can be disposed. // If disposing equals false, the method has been called by the // runtime from inside the finalizer and you should not reference // other objects. Only unmanaged resources can be disposed. protected virtual void Dispose(bool disposing) { // Check to see if Dispose has already been called. if (!this.disposed) { // If disposing equals true, dispose all managed // and unmanaged resources. if (disposing) // Dispose managed resources. { this.UnPaint(this.xmlEditor.NativePlatform.Gfx); // Unsubscribe from the events editorContext.EditorState.CursorRaw.ChangedEvent.Remove(this.Cursor_ChangedEvent); xmlEditor.MouseHandler.MouseDownEvent.Remove(this._xmlEditor_MouseDownEvent); xmlEditor.MouseHandler.MouseUpEvent.Remove(this._xmlEditor_MouseUpEvent); xmlEditor.MouseHandler.MouseDownMoveEvent.Remove(this._xmlEditor_MouseDownMoveEvent); xmlEditor.CleanUpXmlElementsEvent -= new EventHandler(_xmlEditor_xmlElementsCleanUpEvent); this.xmlEditor = null; } } disposed = true; }