예제 #1
0
        private void ApplicationMenu_OnIsOpenChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            if (true.Equals(e.NewValue))
            {
                _mnuOpen.Children.Clear();

                var files = XSConfiguration.Instance.Config.RecentlyUsedFiles;
                foreach (string file in files)
                {
                    FileInfo fi = new FileInfo(file);
                    if (fi.Exists)
                    {
                        var item = new Fluent.Button
                        {
                            Header  = fi.Name,
                            ToolTip = fi.FullName,
                            Tag     = file,
                        };

                        item.Click += (x, args) =>
                                      ((MainWindow)Application.Current.MainWindow).OpenFile(item.Tag.ToString());
                        _mnuOpen.Children.Add(item);
                    }
                }
            }
        }
예제 #2
0
파일: UI.cs 프로젝트: ckimpel/FSE-2011-PDE
        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);
        }
        public void Initialize()
        {
            _container.Install(new Installers.Installer());
            _uiExtensionService.AddNavigationalItem(_navigationItem);

            var button = new Fluent.Button();

            button.Header = "Parent Module";
            var ribbonItem = new RibbonItem(button, "Tab1", "Group1");

            _regionManager.RegisterViewWithRegion(KnownRegionNames.RibbonRegion, () => ribbonItem);
        }
예제 #4
0
        /// <summary>
        /// 获取按钮
        /// </summary>
        /// <param name="header"></param>
        /// <param name="command"></param>
        /// <param name="iconPath"></param>
        /// <param name="largeIconPath"></param>
        /// <param name="toolTip"></param>
        /// <param name="size"></param>
        /// <returns></returns>
        public static Fluent.Button GetFluentButton(object header, ICommand command, string iconPath, string largeIconPath, object toolTip = null, Fluent.RibbonControlSize size = Fluent.RibbonControlSize.Large)
        {
            var button = new Fluent.Button()
            {
                Header  = header,
                ToolTip = toolTip,
                Size    = size,
                Command = command
            };

            if (!string.IsNullOrEmpty(iconPath))
            {
                button.Icon = new BitmapImage(new Uri(iconPath, UriKind.RelativeOrAbsolute));
            }
            if (!string.IsNullOrEmpty(largeIconPath))
            {
                button.LargeIcon = new BitmapImage(new Uri(largeIconPath, UriKind.RelativeOrAbsolute));
            }
            return(button);
        }
예제 #5
0
        /// <summary>
        /// Creates a ribbon button.
        /// </summary>
        /// <param name="text">Text.</param>
        /// <param name="imageUri">Image uri. Can be null.</param>
        /// <param name="size">Large, Medium, .. Can be null.</param>
        /// <param name="commandBinding">Binding path for the Command-Property. Can be null.</param>
        /// <param name="commandBindingMode">Binding mode for the Command-Property. Default is OneWay.</param>
        /// <param name="commandParameterBinding">>Binding path for the CommandParameter-Property. Can be null.</param>
        /// <param name="commandParameterBindingMode">Binding mode for the CommandParameter-Property.</param>
        /// <returns>Ribbon button.</returns>
        public static Fluent.Button CreateButton(string text, string imageUri, string size, string commandBinding, BindingMode commandBindingMode, string commandParameterBinding, BindingMode commandParameterBindingMode)
        {
            Fluent.Button btn = new Fluent.Button();
            btn.Text = text;
            if (size == "Large")
            {
                if (imageUri != null)
                {
                    btn.LargeIcon = new BitmapImage(new Uri(imageUri, UriKind.RelativeOrAbsolute));
                }
                btn.SizeDefinition = size;
            }
            else
            {
                if (imageUri != null)
                {
                    btn.Icon = new BitmapImage(new Uri(imageUri));
                }
                btn.SizeDefinition = size;
            }

            if (commandBinding != null)
            {
                Binding cmdB = new Binding(commandBinding);
                cmdB.Mode = commandBindingMode;
                btn.SetBinding(Fluent.Button.CommandProperty, cmdB);
            }

            if (commandParameterBinding != null)
            {
                Binding cmdBParam = new Binding(commandBinding);
                cmdBParam.Mode = commandParameterBindingMode;
                btn.SetBinding(Fluent.Button.CommandParameterProperty, cmdBParam);
            }

            return(btn);
        }
        /// <summary>
        /// Creates a ribbon button.
        /// </summary>
        /// <param name="text">Text.</param>
        /// <param name="imageUri">Image uri. Can be null.</param>
        /// <param name="size">Large, Medium, .. Can be null.</param>
        /// <param name="commandBinding">Binding path for the Command-Property. Can be null.</param>
        /// <param name="commandBindingMode">Binding mode for the Command-Property. Default is OneWay.</param>
        /// <param name="commandParameterBinding">>Binding path for the CommandParameter-Property. Can be null.</param>
        /// <param name="commandParameterBindingMode">Binding mode for the CommandParameter-Property.</param>
        /// <returns>Ribbon button.</returns>
        public static Fluent.Button CreateButton(string text, string imageUri, string size, string commandBinding, BindingMode commandBindingMode, string commandParameterBinding, BindingMode commandParameterBindingMode)
        {
            Fluent.Button btn = new Fluent.Button();
            btn.Text = text;
            if (size == "Large")
            {
                if( imageUri != null )
                    btn.LargeIcon = new BitmapImage(new Uri(imageUri, UriKind.RelativeOrAbsolute));
                btn.SizeDefinition = size;
            }
            else
            {
                if (imageUri != null)
                    btn.Icon = new BitmapImage(new Uri(imageUri));
                btn.SizeDefinition = size;
            }

            if (commandBinding != null)
            {
                Binding cmdB = new Binding(commandBinding);
                cmdB.Mode = commandBindingMode;
                btn.SetBinding(Fluent.Button.CommandProperty, cmdB);

            }

            if (commandParameterBinding != null)
            {
                Binding cmdBParam = new Binding(commandBinding);
                cmdBParam.Mode = commandParameterBindingMode;
                btn.SetBinding(Fluent.Button.CommandParameterProperty, cmdBParam);
            }

            return btn;
        }
예제 #7
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);
		}