예제 #1
0
        private Grid WrapItemWithContainer(HierarchicalButtonConfiguration item, double radius)
        {
            // create container
            var container = new Grid()
            {
                RenderTransform       = new CompositeTransform(),
                RenderTransformOrigin = new Point(0.5, 0.5)
            };

            // setup name
            container.GenerateRandomName();

            // create hitbox
            var hitbox = new Ellipse()
            {
                Width  = radius * 2,
                Height = radius * 2,
                Fill   = new SolidColorBrush(Colors.Transparent),
            };

            // add to container
            container.Children.Add(item.ButtonVisual);
            container.Children.Add(hitbox);

            // add to dictionary
            itemContainerDict.Add(item, container);

            // return container
            return(container);
        }
예제 #2
0
 public void RegisterQuickButtonConfiguration(string key, HierarchicalButtonConfiguration configuration)
 {
     if(quickButtonConfigurations.ContainsKey(key))
     {
         quickButtonConfigurations[key] = configuration;
     }
     else
     {
         quickButtonConfigurations.Add(key, configuration);
     }
 }
예제 #3
0
        private void SetupResizeConfiguration()
        {
            var configuration = new HierarchicalButtonConfiguration
            {
                ButtonVisual = CreateSymbolIcon(Symbol.Setting, true),
                SubButtonConfigurations = new List<HierarchicalButtonConfiguration>
                {
                    new HierarchicalButtonConfiguration
                    {
                        ButtonVisual = CreateSymbolIcon(Symbol.FullScreen),
                        Command = new RelayCommand(()=>ResizeAction(selectedConfigurationTarget,2,1))

                    },
                    new HierarchicalButtonConfiguration
                    {
                        ButtonVisual = CreateSymbolIcon(Symbol.BackToWindow),
                        Command = new RelayCommand(()=>ResizeAction(selectedConfigurationTarget,1,1))
                    }
                }
            };

            Shell.Instance.RegisterQuickButtonConfiguration("Resize", configuration);
        }
예제 #4
0
        private void SetupDefaultConfiguration()
        {
            var configuration = new HierarchicalButtonConfiguration
            {
                ButtonVisual = CreateSymbolIcon(Symbol.Add, true),
                SubButtonConfigurations = new List<HierarchicalButtonConfiguration>
                {
                    new HierarchicalButtonConfiguration
                    {
                        ButtonVisual = CreateSymbolIcon(Symbol.Bookmarks)
                    },
                    new HierarchicalButtonConfiguration
                    {
                        ButtonVisual = CreateSymbolIcon(Symbol.Flag)
                    },
                    new HierarchicalButtonConfiguration
                    {
                        ButtonVisual = CreateSymbolIcon(Symbol.Edit)
                    }
                }
            };

            Shell.Instance.RegisterQuickButtonConfiguration("Default", configuration);
        }
        private Grid WrapItemWithContainer(HierarchicalButtonConfiguration item, double radius)
        {
            // create container
            var container = new Grid()
            {
                RenderTransform = new CompositeTransform(),
                RenderTransformOrigin = new Point(0.5, 0.5)
            };

            // setup name
            container.GenerateRandomName();

            // create hitbox
            var hitbox = new Ellipse()
            {
                Width = radius * 2,
                Height = radius * 2,
                Fill = new SolidColorBrush(Colors.Transparent),
            };

            // add to container
            container.Children.Add(item.ButtonVisual);
            container.Children.Add(hitbox);

            // add to dictionary
            itemContainerDict.Add(item, container);

            // return container
            return container;
        }
예제 #6
0
        public void SwitchToQuickButtonConfiguration(string key, bool expand = false)
        {
            if(quickButtonConfigurations.ContainsKey(key))
            {
                // set active configuration
                activeQuickButtonItems = quickButtonConfigurations[key];

                // invalidate binding
                OnPropertyChanged("QuickButtonConfiguration");

                // expand if needed
                if(expand)
                {
                    QuickButton.ExpandRootButton();
                }
            }
        }