Ejemplo n.º 1
0
        public void BeginEdit(string text, IIntellisenseProvider provider, EditMode mode, Color color, bool focus)
        {
            IXmlBuilder builder = null;

            IIntellisenseList list = null;

            if (focus)
            {
                switch (mode)
                {
                case EditMode.Value:
                    builder            = provider.Builder;
                    this._cset.Builder = builder;
                    this._editor       = provider.Editor;
                    if (this._editor != null)
                    {
                        this._editor.Site = this._site;
                    }
                    list = provider.GetExpectedValues();
                    break;

                case EditMode.Name:
                    list = provider.GetExpectedNames();
                    break;
                }
            }
            this._schemaType = provider.GetSchemaType();

            if (this._editor != null)
            {
                this._currentEditor = this._editor.Editor as Control;
                _parent.Controls.Add(this._currentEditor);
                this._editor.SchemaType      = this._schemaType;
                this._currentEditor.KeyDown += new KeyEventHandler(editor_KeyDown);
                this._editor.XmlValue        = text;
            }
            else
            {
                this._currentEditor      = this._textEditor;
                this._currentEditor.Text = text;
            }

            this._currentEditor.ForeColor = color;
            PerformLayout();
            this._currentEditor.Visible = true;
            if (focus)
            {
                this._currentEditor.Focus();
                if (this._currentEditor == this._textEditor)
                {
                    this._textEditor.SelectAll();
                }

                // see if this node needs a dropdown.
                if (builder != null || (list != null && list.Count > 0))
                {
                    _cset.BeginEdit(list, this._schemaType);
                }
            }
        }
Ejemplo n.º 2
0
 private void DisposeEditor()
 {
     if (this._editor is IDisposable d)
     {
         d.Dispose();
     }
     this._editor = null;
 }
 protected virtual void Dispose(bool disposing)
 {
     if (this.textEditor != null)
     {
         this.parent.Controls.Remove(this.textEditor);
         this.textEditor.Dispose();
         this.textEditor = null;
         this.textEditor = null;
     }
     if (this.cset != null)
     {
         this.cset.Builder = null;
         this.cset.Dispose();
         this.cset = null;
     }
     // do NOT dispose this guy, it's owned by someone else.
     this.editor = null;
 }
 void HideEdit()
 {
     if (this.currentEditor.Visible)
     {
         bool wasFocused = this.currentEditor.ContainsFocus || this.cset.ContainsFocus;
         this.currentEditor.Visible = false;
         this.cset.Visible          = false;
         if (this.editor != null && this.currentEditor != this.textEditor)
         {
             parent.Controls.Remove(this.currentEditor);
             this.currentEditor.KeyDown   -= new KeyEventHandler(editor_KeyDown);
             this.currentEditor.LostFocus -= new EventHandler(editor_LostFocus);
             this.currentEditor            = this.textEditor;
             this.editor = null;
         }
         if (wasFocused)
         {
             this.parent.Focus();
         }
     }
 }
Ejemplo n.º 5
0
 public XmlOperator(Stream stream)
 {
     this.Editor = new XmlEditor(stream);
 }
Ejemplo n.º 6
0
 public XmlOperator(string xmlPath, string rootNodeName)
 {
     this.Editor = new XmlEditor(xmlPath, rootNodeName);
 }
Ejemplo n.º 7
0
 public XmlOperator(string xmlPath)
 {
     this.Editor = new XmlEditor(xmlPath);
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Dispose resource.
 /// </summary>
 public void Dispose()
 {
     this.Editor.Dispose();
     this.Editor = null;
 }
Ejemplo n.º 9
0
 void HideEdit()
 {
     if (this.currentEditor.Visible) {
         bool wasFocused = this.currentEditor.ContainsFocus || this.cset.ContainsFocus;
         this.currentEditor.Visible = false;
         this.cset.Visible = false;
         if (this.editor != null && this.currentEditor != this.textEditor) {
             parent.Controls.Remove(this.currentEditor);
             this.currentEditor.KeyDown -= new KeyEventHandler(editor_KeyDown);
             this.currentEditor.LostFocus -= new EventHandler(editor_LostFocus);
             this.currentEditor = this.textEditor;
             this.editor = null;
         }
         if (wasFocused) this.parent.Focus();
     }
 }
Ejemplo n.º 10
0
 protected virtual void Dispose(bool disposing)
 {
     if (this.textEditor != null) {
         this.parent.Controls.Remove(this.textEditor);
         this.textEditor.Dispose();
         this.textEditor = null;
         this.textEditor = null;
     }
     if (this.cset != null) {
         this.cset.Builder = null;
         this.cset.Dispose();
         this.cset = null;
     }
     // do NOT dispose this guy, it's owned by someone else.
     this.editor = null;
 }
Ejemplo n.º 11
0
        public void BeginEdit(string text, IIntellisenseProvider provider, EditMode mode, Color color, bool focus)
        {
            IXmlBuilder builder = null;

            IIntellisenseList list = null;
            if (focus) {
                switch (mode) {
                    case EditMode.Value:
                        builder = provider.Builder;
                        this.cset.Builder = builder;
                        this.editor = provider.Editor;
                        if (this.editor != null) {
                            this.editor.Site = this.site;
                        }
                        list = provider.GetExpectedValues();
                        break;
                    case EditMode.Name:
                        list = provider.GetExpectedNames();
                        break;
                }
            }
            this.schemaType = provider.GetSchemaType();

            if (this.editor != null) {
                this.currentEditor = this.editor.Editor;
                parent.Controls.Add(this.currentEditor);
                this.editor.SchemaType = this.schemaType;
                this.currentEditor.KeyDown += new KeyEventHandler(editor_KeyDown);
                this.editor.XmlValue = text;
            } else {
                this.currentEditor = this.textEditor;
                this.currentEditor.Text = text;
            }

            this.currentEditor.ForeColor = color;
            PerformLayout();
            this.currentEditor.Visible = true;
            if (focus) {
                this.currentEditor.Focus();
                if (this.currentEditor == this.textEditor) {
                    this.textEditor.SelectAll();
                }

                // see if this node needs a dropdown.
                if (builder != null || (list != null && list.Count > 0)) {
                    cset.BeginEdit(list, this.schemaType);
                }
            }
        }