//////////////////////////////////////////////////////////////////////////
        private void OpenFile(string Filename)
        {
            if (CurrentDoc != null)
            {
                if (CurrentDoc.CloseDocument())
                {
                    CurrentDoc.CaptionChanged  -= new EventHandler(OnDocumentCaptionChanged);
                    CurrentDoc.FileNameChanged -= new EventHandler(OnDocumentFileNameChanged);
                    CurrentDoc.Dispose();
                }
                else
                {
                    return;
                }
            }
            HourGlass.Enabled = true;
            WindowDoc NewDoc = new WindowDoc(this);

            NewDoc.CaptionChanged  += new EventHandler(OnDocumentCaptionChanged);
            NewDoc.FileNameChanged += new EventHandler(OnDocumentFileNameChanged);

            Document.DocumentOpenResult Res = NewDoc.OpenDocument(WindowCanvas, Filename);
            if (Res == Document.DocumentOpenResult.Ok)
            {
                CurrentDoc            = NewDoc;
                CurrentDoc.PropGrid   = PropItem;
                CurrentDoc.LayoutTree = TreeLayout;
                AddRecentFile(CurrentDoc.FileName);
            }
            else
            {
                CurrentDoc = null;
                if (Res == Document.DocumentOpenResult.Error)
                {
                    MessageBox.Show("Error opening file. See WindowEdit.log for details.", Form.ActiveForm.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                this.Text = AppName;
            }
            HourGlass.Enabled = false;
        }
        public void File_New(ActionParam Param)
        {
            switch (Param.Type)
            {
            case ActionParam.QueryType.Invoke:
                if (CurrentDoc != null)
                {
                    if (CurrentDoc.CloseDocument())
                    {
                        CurrentDoc.CaptionChanged  -= new EventHandler(OnDocumentCaptionChanged);
                        CurrentDoc.FileNameChanged -= new EventHandler(OnDocumentFileNameChanged);
                        CurrentDoc.Dispose();
                    }
                    else
                    {
                        return;
                    }
                }

                PropItem.SelectedObject = null;

                WindowDoc NewDoc = new WindowDoc(this);
                NewDoc.CaptionChanged  += new EventHandler(OnDocumentCaptionChanged);
                NewDoc.FileNameChanged += new EventHandler(OnDocumentFileNameChanged);
                if (NewDoc.NewDocument(WindowCanvas))
                {
                    CurrentDoc            = NewDoc;
                    CurrentDoc.PropGrid   = PropItem;
                    CurrentDoc.LayoutTree = TreeLayout;
                }
                else
                {
                    CurrentDoc = null;
                }

                break;
            }
        }
        //////////////////////////////////////////////////////////////////////////
        private void OpenFile(string Filename)
        {
            if (CurrentDoc != null)
            {
                if (CurrentDoc.CloseDocument())
                {
                    CurrentDoc.CaptionChanged -= new EventHandler(OnDocumentCaptionChanged);
                    CurrentDoc.FileNameChanged -= new EventHandler(OnDocumentFileNameChanged);
                    CurrentDoc.Dispose();
                }
                else
                    return;
            }
            HourGlass.Enabled = true;
            WindowDoc NewDoc = new WindowDoc(this);
            NewDoc.CaptionChanged += new EventHandler(OnDocumentCaptionChanged);
            NewDoc.FileNameChanged += new EventHandler(OnDocumentFileNameChanged);

            Document.DocumentOpenResult Res = NewDoc.OpenDocument(WindowCanvas, Filename);
            if (Res == Document.DocumentOpenResult.Ok)
            {
                CurrentDoc = NewDoc;
                CurrentDoc.PropGrid = PropItem;
                CurrentDoc.LayoutTree = TreeLayout;
                AddRecentFile(CurrentDoc.FileName);
            }
            else
            {
                CurrentDoc = null;
                if(Res == Document.DocumentOpenResult.Error)
                    MessageBox.Show("Error opening file. See WindowEdit.log for details.", Form.ActiveForm.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.Text = AppName;
            }
            HourGlass.Enabled = false;
        }
        public void File_New(ActionParam Param)
        {
            switch (Param.Type)
            {
                case ActionParam.QueryType.Invoke:
                    if(CurrentDoc != null)
                    {
                        if (CurrentDoc.CloseDocument())
                        {
                            CurrentDoc.CaptionChanged -= new EventHandler(OnDocumentCaptionChanged);
                            CurrentDoc.FileNameChanged -= new EventHandler(OnDocumentFileNameChanged);
                            CurrentDoc.Dispose();
                        }
                        else
                            return;
                    }

                    PropItem.SelectedObject = null;

                    WindowDoc NewDoc = new WindowDoc(this);
                    NewDoc.CaptionChanged += new EventHandler(OnDocumentCaptionChanged);
                    NewDoc.FileNameChanged += new EventHandler(OnDocumentFileNameChanged);
                    if (NewDoc.NewDocument(WindowCanvas))
                    {
                        CurrentDoc = NewDoc;
                        CurrentDoc.PropGrid = PropItem;
                        CurrentDoc.LayoutTree = TreeLayout;
                    }
                    else CurrentDoc = null;

                    break;
            }
        }