Beispiel #1
0
        protected virtual void CreateRibbonBackstage(Fluent.Ribbon ribbon)
        {
            ribbon.BackstageItems.Add(Tum.PDE.ToolFramework.Modeling.Visualization.Base.Controls.Ribbon.RibbonCreationHelper.CreateButton(
                                          "New", "pack://application:,,,/Tum.PDE.ToolFramework.Images;component/Ribbon/New-16.png", "Medium", "NewModelCommand"));
            ribbon.BackstageItems.Add(Tum.PDE.ToolFramework.Modeling.Visualization.Base.Controls.Ribbon.RibbonCreationHelper.CreateButton(
                                          "Open...", "pack://application:,,,/Tum.PDE.ToolFramework.Images;component/Ribbon/Open-16.png", "Medium", "OpenModelCommand"));

            backstageSaveModelButton = Tum.PDE.ToolFramework.Modeling.Visualization.Base.Controls.Ribbon.RibbonCreationHelper.CreateButton(
                "Save", "pack://application:,,,/Tum.PDE.ToolFramework.Images;component/Ribbon/Save-16.png", "Medium", "SaveModelCommand");
            ribbon.BackstageItems.Add(backstageSaveModelButton);
            backstageSaveModelButton.IsEnabled = false;

            backstageSaveAsModelButton = Tum.PDE.ToolFramework.Modeling.Visualization.Base.Controls.Ribbon.RibbonCreationHelper.CreateButton(
                "Save As...", "pack://application:,,,/Tum.PDE.ToolFramework.Images;component/Ribbon/SaveAs-32.png", "Medium", "SaveAsModelCommand");
            ribbon.BackstageItems.Add(backstageSaveAsModelButton);
            backstageSaveAsModelButton.IsEnabled = false;

            Fluent.BackstageTabItem tabItemRecent = new Fluent.BackstageTabItem();
            tabItemRecent.Header = "Recent";
            ContentControl c = new ContentControl();

            c.Template            = (ControlTemplate)FindResource("RibbonBackstageRecentItemsTemplate");
            tabItemRecent.Content = c;
            ribbon.BackstageItems.Add(tabItemRecent);

            // see if needed
            tabItemFI        = new Fluent.BackstageTabItem();
            tabItemFI.Header = "Further Information";
            ContentControl c2 = new ContentControl();

            c2.Template       = (ControlTemplate)FindResource("RibbonBackstageFurtherInformationTemplate");
            tabItemFI.Content = c2;
            ribbon.BackstageItems.Add(tabItemFI);

            // see if needed
            tabItemCredits        = new Fluent.BackstageTabItem();
            tabItemCredits.Header = "Credits";
            ContentControl c3 = new ContentControl();

            c3.Template            = (ControlTemplate)FindResource("RibbonBackstageCreditsTemplate");
            tabItemCredits.Content = c3;
            ribbon.BackstageItems.Add(tabItemCredits);

            backstageCloseModelButton = Tum.PDE.ToolFramework.Modeling.Visualization.Base.Controls.Ribbon.RibbonCreationHelper.CreateButton(
                "Close", "pack://application:,,,/Tum.PDE.ToolFramework.Images;component/Ribbon/CloseDocument-32.png", "Medium", "CloseModelCommand");
            ribbon.BackstageItems.Add(backstageCloseModelButton);
            backstageCloseModelButton.IsEnabled = false;

            Fluent.Button b = new Fluent.Button();
            b.Text   = "Exit";
            b.Click += new RoutedEventHandler(ExitButton_Click);
            b.Icon   = new System.Windows.Media.Imaging.BitmapImage(new Uri("pack://application:,,,/Tum.PDE.ToolFramework.Images;component/Ribbon/Exit-16.png", UriKind.Absolute));

            ribbon.BackstageItems.Add(b);
        }
Beispiel #2
0
        private void MakeMainMenuBar(XmlNode node)
        {
            if (node == null) return;

            backstageTabControl.Items.Clear();

            PlugInManager compManager = new PlugInManager();
            foreach (XmlNode menu in node.SelectNodes("Menu[@name]"))
            {
                if (menu.Attributes["name"].Value.ToLower() == "file")
                {
                    foreach (XmlNode menuItem in menu.SelectNodes("MenuItem"))
                    {
                        if (menuItem.Attributes["guid"] == null)
                        {
                            //backstageTabControl.Items.Add(new Separator());
                        }
                        else
                        {
                            IExTool tool = (IExTool)compManager.CreateInstance(new Guid(menuItem.Attributes["guid"].Value));
                            if (tool == null) continue;

                            tool.OnCreate(_application);

                            if (tool is IToolControl)
                            {
                                Fluent.BackstageTabItem backItem = new Fluent.BackstageTabItem();
                                backItem.Header = tool.Name;

                                object control = ((IToolControl)tool).Control;
                                if (control is System.Windows.Forms.Control)
                                {
                                    WindowsFormsHost host = WinHostFactory.ToWindowsHost((System.Windows.Forms.Control)control);
                                    backItem.Content = host;
                                }
                                else if (control is FrameworkElement)
                                {
                                    backItem.Content = control;
                                }

                                backstageTabControl.Items.Add(backItem);
                            }
                            else
                            {
                                Items.ToolButton button = new Items.ToolButton(tool);
                                button.Click += new RoutedEventHandler(ToolButton_Click);

                                backstageTabControl.Items.Add(button);
                            }
                        }
                    }
                }
                
                if (menu.Attributes["name"].Value.ToLower() == "quickaccess")
                {
                    foreach (XmlNode menuItem in menu.SelectNodes("MenuItem"))
                    {
                        IExTool tool = compManager.CreateInstance(new Guid(menuItem.Attributes["guid"].Value)) as IExTool;
                        if (tool == null) continue;
                        tool.OnCreate(_application);

                        ToolButton button = new ToolButton((IExTool)tool);
                        button.Click += new RoutedEventHandler(ToolButton_Click);

                        ribbon.QuickAccessItems.Add(new Fluent.QuickAccessMenuItem() { Target = button });
                    }
                }
            }
        }
Beispiel #3
0
		protected virtual void CreateRibbonBackstage(Fluent.Ribbon ribbon)
		{
		    ribbon.BackstageItems.Add(Tum.PDE.ToolFramework.Modeling.Visualization.Base.Controls.Ribbon.RibbonCreationHelper.CreateButton(
		        "New", "pack://application:,,,/Tum.PDE.ToolFramework.Images;component/Ribbon/New-16.png", "Medium", "NewModelCommand"));
		    ribbon.BackstageItems.Add(Tum.PDE.ToolFramework.Modeling.Visualization.Base.Controls.Ribbon.RibbonCreationHelper.CreateButton(
		        "Open...", "pack://application:,,,/Tum.PDE.ToolFramework.Images;component/Ribbon/Open-16.png", "Medium", "OpenModelCommand"));
		    
			backstageSaveModelButton = Tum.PDE.ToolFramework.Modeling.Visualization.Base.Controls.Ribbon.RibbonCreationHelper.CreateButton(
		        "Save", "pack://application:,,,/Tum.PDE.ToolFramework.Images;component/Ribbon/Save-16.png", "Medium", "SaveModelCommand");
			ribbon.BackstageItems.Add(backstageSaveModelButton);
			backstageSaveModelButton.IsEnabled = false;
				
			backstageSaveAsModelButton = Tum.PDE.ToolFramework.Modeling.Visualization.Base.Controls.Ribbon.RibbonCreationHelper.CreateButton(
		        "Save As...", "pack://application:,,,/Tum.PDE.ToolFramework.Images;component/Ribbon/SaveAs-32.png", "Medium", "SaveAsModelCommand");
		    ribbon.BackstageItems.Add(backstageSaveAsModelButton);
			backstageSaveAsModelButton.IsEnabled = false;
		
		    Fluent.BackstageTabItem tabItemRecent = new Fluent.BackstageTabItem();
		    tabItemRecent.Header = "Recent";
		    ContentControl c = new ContentControl();
		    c.Template = (ControlTemplate)FindResource("RibbonBackstageRecentItemsTemplate");
		    tabItemRecent.Content = c;
		    ribbon.BackstageItems.Add(tabItemRecent);
		
		    // see if needed
		    tabItemFI = new Fluent.BackstageTabItem();
		    tabItemFI.Header = "Further Information";
		    ContentControl c2 = new ContentControl();
		    c2.Template = (ControlTemplate)FindResource("RibbonBackstageFurtherInformationTemplate");
		    tabItemFI.Content = c2;
		    ribbon.BackstageItems.Add(tabItemFI);
		
		    // see if needed
		    tabItemCredits = new Fluent.BackstageTabItem();
		    tabItemCredits.Header = "Credits";
		    ContentControl c3 = new ContentControl();
		    c3.Template = (ControlTemplate)FindResource("RibbonBackstageCreditsTemplate");
		    tabItemCredits.Content = c3;
		    ribbon.BackstageItems.Add(tabItemCredits);
		
			backstageCloseModelButton = Tum.PDE.ToolFramework.Modeling.Visualization.Base.Controls.Ribbon.RibbonCreationHelper.CreateButton(
		        "Close", "pack://application:,,,/Tum.PDE.ToolFramework.Images;component/Ribbon/CloseDocument-32.png", "Medium", "CloseModelCommand");
		    ribbon.BackstageItems.Add(backstageCloseModelButton);
			backstageCloseModelButton.IsEnabled = false;
		
		    Fluent.Button b = new Fluent.Button();
		    b.Text = "Exit";
		    b.Click += new RoutedEventHandler(ExitButton_Click);
		    b.Icon = new System.Windows.Media.Imaging.BitmapImage(new Uri("pack://application:,,,/Tum.PDE.ToolFramework.Images;component/Ribbon/Exit-16.png", UriKind.Absolute));
		
		    ribbon.BackstageItems.Add(b);
		}