示例#1
0
        public void Add(string name, string description, object data, ContextMenu menu, Color colour)
        {
            FocusedSelectedModule = -1;
            BorderIconButton newModelSystem = new BorderIconButton
            {
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment   = VerticalAlignment.Center,
                Header = name,
                Margin = new Thickness(5),
                Width  = 250,
                Text   = description,
                // newModelSystem.HighlightColour = SelectionBlue;
                Icon = SettingsImage
            };

            newModelSystem.Clicked      += ClickedAction;
            newModelSystem.RightClicked += RightClickedAction;
            newModelSystem.ContextMenu   = menu;
            // newModelSystem.ShadowColour = colour;
            Items.Add(data);
            DisplayedItems.Add(data);
            Searchable.Add(String.Concat((name == null ? String.Empty : name.ToLower()), " ", (description == null ? String.Empty : description.ToLower())));
            ModelSystemsButtons.Add(newModelSystem);
            ModelSystemPanel.Children.Add(newModelSystem);
            NothingFound.Visibility = Visibility.Collapsed;
        }
示例#2
0
        private void SetupViableModules(IList <Type> modules)
        {
            this.ValidModulePanel.Children.Clear();
            if (this.ViableModules != null)
            {
                this.ViableModules.Clear();
            }
            this.ShowingParameters = false;
            var l = (modules as List <Type>);

            if (l != null)
            {
                l.Sort(new Comparison <Type>(delegate(Type one, Type two)
                {
                    int value = one.Name.CompareTo(two.Name);
                    if (value != 0)
                    {
                        return(value);
                    }
                    return(one.FullName.CompareTo(two.FullName));
                }));
            }
            this.ViableModules = modules;
            var clicked      = new Action <object>(ReplacementSelected);
            var rightClicked = new Action <object>(ViableModuleDocumentation);

            if (modules != null)
            {
                var thickness = new Thickness(5, 5, 5, 5);
                // Setup the possible ones
                foreach (var module in modules)
                {
                    BorderIconButton moduleButton = new BorderIconButton();
                    moduleButton.HorizontalAlignment = HorizontalAlignment.Stretch;
                    moduleButton.Header          = module.Name;
                    moduleButton.Margin          = thickness;
                    moduleButton.Text            = module.FullName;
                    moduleButton.HighlightColour = HighlightColour;
                    moduleButton.Icon            = ModuleIcon;
                    if (module == this.ModelSystemDisplay.SelectedModule.Type)
                    {
                        moduleButton.ShadowColour = HighlightColour;
                    }
                    moduleButton.Clicked      += clicked;
                    moduleButton.RightClicked += rightClicked;
                    this.ValidModulePanel.Children.Add(moduleButton);
                }
            }
        }
示例#3
0
        public void Add(string name, string description, object data, ContextMenu menu)
        {
            this.FocusedSelectedModule = -1;
            BorderIconButton newModelSystem = new BorderIconButton();

            newModelSystem.HorizontalAlignment = HorizontalAlignment.Left;
            newModelSystem.VerticalAlignment   = VerticalAlignment.Center;
            newModelSystem.Header          = name;
            newModelSystem.Margin          = new Thickness(5);
            newModelSystem.Width           = 250;
            newModelSystem.Text            = description;
            newModelSystem.HighlightColour = this.SelectionBlue;
            newModelSystem.Icon            = this.SettingsImage;
            newModelSystem.Clicked        += this.ClickedAction;
            newModelSystem.RightClicked   += this.RightClickedAction;
            newModelSystem.ContextMenu     = menu;
            this.Items.Add(data);
            this.DisplayedItems.Add(data);
            this.Searchable.Add(String.Concat((name == null ? String.Empty : name.ToLower()), " ", (description == null ? String.Empty : description.ToLower())));
            this.ModelSystemsButtons.Add(newModelSystem);
            this.ModelSystemPanel.Children.Add(newModelSystem);
            this.NothingFound.Visibility = System.Windows.Visibility.Collapsed;
        }
 private void SetupViableModules(IList<Type> modules)
 {
     this.ValidModulePanel.Children.Clear();
     if(this.ViableModules != null)
     {
         this.ViableModules.Clear();
     }
     this.ShowingParameters = false;
     var l = (modules as List<Type>);
     if(l != null)
     {
         l.Sort(new Comparison<Type>(delegate (Type one, Type two)
         {
             int value = one.Name.CompareTo(two.Name);
             if(value != 0) return value;
             return one.FullName.CompareTo(two.FullName);
         }));
     }
     this.ViableModules = modules;
     var clicked = new Action<object>(ReplacementSelected);
     var rightClicked = new Action<object>(ViableModuleDocumentation);
     if(modules != null)
     {
         var thickness = new Thickness(5, 5, 5, 5);
         // Setup the possible ones
         foreach(var module in modules)
         {
             BorderIconButton moduleButton = new BorderIconButton();
             moduleButton.HorizontalAlignment = HorizontalAlignment.Stretch;
             moduleButton.Header = module.Name;
             moduleButton.Margin = thickness;
             moduleButton.Text = module.FullName;
             moduleButton.HighlightColour = HighlightColour;
             moduleButton.Icon = ModuleIcon;
             if(module == this.ModelSystemDisplay.SelectedModule.Type)
             {
                 moduleButton.ShadowColour = HighlightColour;
             }
             moduleButton.Clicked += clicked;
             moduleButton.RightClicked += rightClicked;
             this.ValidModulePanel.Children.Add(moduleButton);
         }
     }
 }
示例#5
0
 public void Add(string name, string description, object data, ContextMenu menu, Color colour)
 {
     this.FocusedSelectedModule = -1;
     BorderIconButton newModelSystem = new BorderIconButton();
     newModelSystem.HorizontalAlignment = HorizontalAlignment.Left;
     newModelSystem.VerticalAlignment = VerticalAlignment.Center;
     newModelSystem.Header = name;
     newModelSystem.Margin = new Thickness( 5 );
     newModelSystem.Width = 250;
     newModelSystem.Text = description;
     newModelSystem.HighlightColour = this.SelectionBlue;
     newModelSystem.Icon = this.SettingsImage;
     newModelSystem.Clicked += this.ClickedAction;
     newModelSystem.RightClicked += this.RightClickedAction;
     newModelSystem.ContextMenu = menu;
     newModelSystem.ShadowColour = colour;
     this.Items.Add( data );
     this.DisplayedItems.Add( data );
     this.Searchable.Add( String.Concat( ( name == null ? String.Empty : name.ToLower() ), " ", ( description == null ? String.Empty : description.ToLower() ) ) );
     this.ModelSystemsButtons.Add( newModelSystem );
     this.ModelSystemPanel.Children.Add( newModelSystem );
     this.NothingFound.Visibility = System.Windows.Visibility.Collapsed;
 }