예제 #1
0
        //-///////////////////////////////////////////////////////////////////////
        //-///////////////////////////////////////////////////////////////////////

        private void LoadLayoutForScript(string scriptFileName)
        {
            Config config = Misc.LoadXmlOrCreateDefault <Config>(GetConfigFileName(scriptFileName));

            // Set main form placement
            if (config.WindowPlacement != null)
            {
                config.WindowPlacement.Set(this);
            }

            // Load dock layout
            {
                string layoutFileName = GetLayoutFileName(scriptFileName);

                // Annoyingly, a new layout can't be reloaded unless the
                // old one is destroyed, so let's hope that loading the
                // layout in works. This checks that the file exists first,
                // but that's all.
                if (File.Exists(layoutFileName))
                {
                    while (_dockPanel.Contents.Count > 0)
                    {
                        var w = _dockPanel.Contents[0];

                        w.DockHandler.Close();

                        Misc.Dispose(w);
                    }

                    _dockPanel.LoadFromXml(layoutFileName, this.HandleDeserializeDockContent);
                }

                PostLoadPanels();
            }
        }