Ejemplo n.º 1
0
        private void SetStage(StageView sv)
        {
            if (currentStage != null)
            {
                currentLibraryView.Clear();

                currentStage.OnSelectionChanged  -= OnSelectionChanged;
                currentStage.OnUndoStackChanged  -= OnUndoStackChanged;
                currentStage.OnNestedEditChanged -= OnNestedEditChanged;
                currentStage.FormClosing         -= new FormClosingEventHandler(currentStage_FormClosing);
                currentStage.OnDepthChanged      -= OnDepthChanged;
                currentStage = null;
            }

            if (sv != null)
            {
                if (sv.rootFolder != null)
                {
                    Environment.CurrentDirectory = sv.rootFolder;
                }

                currentStage = sv;
                currentLibraryView.LoadCurrentLibrary();

                sv.Show(dockPanel);

                currentStage.OnSelectionChanged  += OnSelectionChanged;
                currentStage.OnUndoStackChanged  += OnUndoStackChanged;
                currentStage.OnNestedEditChanged += OnNestedEditChanged;
                currentStage.OnDepthChanged      += OnDepthChanged;
                currentStage.FormClosing         += new FormClosingEventHandler(currentStage_FormClosing);
                currentStage.Invalidate();

                saveToolStripMenuItem.Enabled         = currentStage.HasSaveableChanges;
                importToolStripMenuItem.Enabled       = true;
                saveAsToolStripMenuItem.Enabled       = true;
                closeToolStripMenuItem.Enabled        = true;
                exportSVGToolStripMenuItem.Enabled    = true;
                exportXAMLToolStripMenuItem.Enabled   = true;
                exportCanvasToolStripMenuItem.Enabled = true;
            }
            else
            {
                saveToolStripMenuItem.Enabled         = false;
                importToolStripMenuItem.Enabled       = false;
                saveAsToolStripMenuItem.Enabled       = false;
                closeToolStripMenuItem.Enabled        = false;
                exportSVGToolStripMenuItem.Enabled    = false;
                exportXAMLToolStripMenuItem.Enabled   = false;
                exportCanvasToolStripMenuItem.Enabled = false;
            }
        }