/// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.editor = new XEditNet.XEditNetCtrl();
     this.SuspendLayout();
     //
     // xEditNetCtrl1
     //
     this.editor.AutoScroll  = true;
     this.editor.BackColor   = System.Drawing.Color.White;
     this.editor.BorderStyle = System.Windows.Forms.BorderStyle.None;
     this.editor.Dock        = System.Windows.Forms.DockStyle.Fill;
     this.editor.IsModified  = false;
     this.editor.Location    = new System.Drawing.Point(0, 0);
     this.editor.Name        = "editor";
     this.editor.Size        = new System.Drawing.Size(504, 336);
     this.editor.TabIndex    = 0;
     //
     // XEditNetDefaultEditorRegion
     //
     this.Controls.Add(this.editor);
     this.Name = "XEditNetDefaultEditorRegion";
     this.Size = new System.Drawing.Size(504, 336);
     this.ResumeLayout(false);
 }
 /// <summary> 
 /// Required method for Designer support - do not modify 
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.editor = new XEditNet.XEditNetCtrl();
     this.SuspendLayout();
     //
     // xEditNetCtrl1
     //
     this.editor.AutoScroll = true;
     this.editor.BackColor = System.Drawing.Color.White;
     this.editor.BorderStyle = System.Windows.Forms.BorderStyle.None;
     this.editor.Dock = System.Windows.Forms.DockStyle.Fill;
     this.editor.IsModified = false;
     this.editor.Location = new System.Drawing.Point(0, 0);
     this.editor.Name = "editor";
     this.editor.Size = new System.Drawing.Size(504, 336);
     this.editor.TabIndex = 0;
     //
     // XEditNetDefaultEditorRegion
     //
     this.Controls.Add(this.editor);
     this.Name = "XEditNetDefaultEditorRegion";
     this.Size = new System.Drawing.Size(504, 336);
     this.ResumeLayout(false);
 }
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     XEditNet.Location.Selection selection1 = new XEditNet.Location.Selection();
     this.tabControl = new System.Windows.Forms.TabControl();
     this.editorTab  = new System.Windows.Forms.TabPage();
     this.editor     = new XEditNet.XEditNetCtrl();
     this.browserTab = new System.Windows.Forms.TabPage();
     this.webBrowser = new System.Windows.Forms.WebBrowser();
     this.tabControl.SuspendLayout();
     this.editorTab.SuspendLayout();
     this.browserTab.SuspendLayout();
     this.SuspendLayout();
     //
     // tabControl
     //
     this.tabControl.Controls.Add(this.editorTab);
     this.tabControl.Controls.Add(this.browserTab);
     this.tabControl.Dock                  = System.Windows.Forms.DockStyle.Fill;
     this.tabControl.Location              = new System.Drawing.Point(0, 0);
     this.tabControl.Multiline             = true;
     this.tabControl.Name                  = "tabControl";
     this.tabControl.Padding               = new System.Drawing.Point(8, 6);
     this.tabControl.SelectedIndex         = 0;
     this.tabControl.Size                  = new System.Drawing.Size(440, 384);
     this.tabControl.TabIndex              = 0;
     this.tabControl.SelectedIndexChanged += new System.EventHandler(this.TabChanged);
     //
     // editorTab
     //
     this.editorTab.Controls.Add(this.editor);
     this.editorTab.Location = new System.Drawing.Point(4, 28);
     this.editorTab.Name     = "editorTab";
     this.editorTab.Size     = new System.Drawing.Size(432, 352);
     this.editorTab.TabIndex = 0;
     this.editorTab.Text     = "Editor";
     //
     // editor
     //
     this.editor.AutoScroll = true;
     this.editor.BackColor  = System.Drawing.Color.White;
     this.editor.Dock       = System.Windows.Forms.DockStyle.Fill;
     this.editor.IsModified = false;
     this.editor.Location   = new System.Drawing.Point(0, 0);
     this.editor.Name       = "editor";
     this.editor.Selection  = selection1;
     this.editor.Size       = new System.Drawing.Size(432, 352);
     this.editor.TabIndex   = 0;
     //
     // browserTab
     //
     this.browserTab.Controls.Add(this.webBrowser);
     this.browserTab.Location = new System.Drawing.Point(4, 28);
     this.browserTab.Name     = "browserTab";
     this.browserTab.Size     = new System.Drawing.Size(432, 352);
     this.browserTab.TabIndex = 1;
     this.browserTab.Text     = "Browser Preview";
     //
     // webBrowser1
     //
     this.webBrowser.Dock        = System.Windows.Forms.DockStyle.Fill;
     this.webBrowser.Location    = new System.Drawing.Point(0, 0);
     this.webBrowser.MinimumSize = new System.Drawing.Size(20, 20);
     this.webBrowser.Name        = "webBrowser1";
     this.webBrowser.Size        = new System.Drawing.Size(432, 352);
     this.webBrowser.TabIndex    = 0;
     //
     // WebProfileEditorRegion
     //
     this.Controls.Add(this.tabControl);
     this.Name = "WebProfileEditorRegion";
     this.Size = new System.Drawing.Size(440, 384);
     this.tabControl.ResumeLayout(false);
     this.editorTab.ResumeLayout(false);
     this.browserTab.ResumeLayout(false);
     this.ResumeLayout(false);
 }
 private void SaveFile(XEditNetCtrl editor, FileInfo fi)
 {
     // TODO: M: show wait cursor
     XmlTextWriter xtw=new XmlTextWriter(fi.FullName, Encoding.UTF8);
     try
     {
         editor.Document.Save(xtw);
         editor.IsModified=false;
     }
     finally
     {
         xtw.Close();
     }
 }
        private bool ConfirmSave(XEditNetCtrl editor, FileInfo fi)
        {
            if ( editor == null || !editor.IsModified )
                return true;

            string msg=string.Format("Do you want to save the changes to {0}", fi.Name);
            DialogResult dr=MessageBox.Show(this, msg, "XEditNet Author", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning);
            if ( dr == DialogResult.Cancel )
                return false;

            if ( dr == DialogResult.Yes )
            {
                if ( fi == null )
                    fi=GetSaveAsFileInfo();

                if ( fi == null )
                    return false;

                SaveFile(editor, fi);
            }
            return true;
        }