Пример #1
0
        public MediaPortalEditor()
        {
            InitializeComponent();
            Text = "MediaPortalEditor";

            // Initialize style options
            style = VisualStyle.IDE;
            SetStyle(ControlStyles.DoubleBuffer, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);

            // Create the docking and tab manager
            tabManager                   = new TabControl();
            tabManager.Appearance        = TabControl.VisualAppearance.MultiDocument;
            tabManager.ClosePressed     += new EventHandler(OnDesignerClosed);
            tabManager.SelectionChanged += new EventHandler(OnDesignerIndexChanged);
            tabManager.Dock              = DockStyle.Fill;
            tabManager.Style             = style;
            tabManager.IDEPixelBorder    = true;
            tabManager.ShowClose         = false;
            tabManager.ImageList         = tabImageList;
            Controls.Add(tabManager);

            dockManager = new DockingManager(this, style);
            dockManager.InnerControl       = tabManager;
            dockManager.TabControlCreated += new DockingManager.TabControlCreatedHandler(OnTabControlCreated);
            dockManager.ContentHidden     += new DockingManager.ContentHandler(OnContentHidden);
            dockManager.ContentShown      += new DockingManager.ContentHandler(OnContentShown);

            // Create Status Bar
            statusBar = CreateStatusBar();
            dockManager.OuterControl = statusBar;

            // Create Menu and Toolbar
            topMenu = CreateTopMenu();

            // Create Skin Tree
            skinExplorer = new MpeExplorer(this);
            Content c = dockManager.Contents.Add(skinExplorer, "Explorer", serviceImageList, 0);

            dockManager.AddContentWithState(c, State.DockLeft);

            // Create Properties
            propertyManager = new MpePropertyManager(this);
            c = dockManager.Contents.Add(propertyManager, "Properties", serviceImageList, 1);
            dockManager.AddContentWithState(c, State.DockRight);

            // Create Help Manager and Browser
            helpManager = new MpeHelpManager(this);
            c           = dockManager.Contents.Add(helpManager, "Help", serviceImageList, 2);
            dockManager.AddContentWithState(c, State.DockBottom);
            helpBrowser = new MpeHelpBrowser(this);

            // Setup Tab Designers
            selectedDesignerIndex = -1;

            // Static Self Reference
            self = this;
        }
Пример #2
0
        protected void OnDesignerClosed(object source, EventArgs args)
        {
            Cursor = Cursors.WaitCursor;
            MpeDesigner designer = (MpeDesigner)tabManager.SelectedTab.Tag;

            if (tabManager.SelectedTab.Title.EndsWith("*"))
            {
                MpeSaveForm form = new MpeSaveForm(new MpeDesigner[1] {
                    designer
                }, tabImageList);
                DialogResult result = form.ShowDialog(this);
                if (result == DialogResult.Cancel)
                {
                    Cursor = Cursors.Default;
                    return;
                }
                else if (result == DialogResult.Yes)
                {
                    OnMenuSave(source, args);
                }
                else if (result == DialogResult.No)
                {
                    designer.Cancel();
                }
            }
            selectedDesignerIndex = -1;
            tabManager.TabPages.Remove(tabManager.SelectedTab);
            try
            {
                designer.Destroy();
                if (designer is MpeHelpBrowser)
                {
                    helpBrowser = null;
                }
            }
            catch (Exception e)
            {
                MpeLog.Debug(e);
                MpeLog.Error(e);
            }
            if (tabManager.TabPages.Count == 0)
            {
                tabManager.ShowClose = false;
            }
            Cursor = Cursors.Default;
        }
Пример #3
0
 public void ShowHelp(FileInfo file)
 {
     if (helpBrowser == null)
     {
         MpeLog.Info("Creating help browser...");
         helpBrowser = new MpeHelpBrowser(this);
     }
     AddDesigner(helpBrowser);
     try
     {
         Cursor = Cursors.WaitCursor;
         helpBrowser.ShowHelp(file);
     }
     catch (Exception e)
     {
         MessageBox.Show(this, e.Message, "Help Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     finally
     {
         Cursor = Cursors.Default;
     }
 }