コード例 #1
0
        public MainPage()
        {
            this.InitializeComponent();

            colourShower = new ShowColourHue();

            // Create a reference to the RadialController.
            var supported = RadialController.IsSupported();

            if (!supported)
            {
                return;
            }
            var controller = RadialController.CreateForCurrentView();

            // Create the icons for the dial menu
            var iconBright = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/bright.png"));
            var iconColor  = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/Color.png"));

            // Create the items for the menu
            var itemBright = RadialControllerMenuItem.CreateFromIcon("Bright", iconBright);
            var itemColor  = RadialControllerMenuItem.CreateFromIcon("Color", iconColor);

            // Add the items to the menu
            controller.Menu.Items.Add(itemBright);
            controller.Menu.Items.Add(itemColor);

            // Select the correct tool when the item is selected
            itemBright.Invoked += (s, e) => _currentTool = CurrentTool.Bright;
            itemColor.Invoked  += (s, e) => _currentTool = CurrentTool.Color;

            // Get all named colors and create brushes from them
            _namedBrushes = typeof(Colors).GetRuntimeProperties().Select(c => new SolidColorBrush((Color)c.GetValue(null))).ToList();

            controller.RotationChanged += ControllerRotationChanged;

            // Leave only the Volume default item - Zoom and Undo won't be used
            RadialControllerConfiguration config = RadialControllerConfiguration.GetForCurrentView();

            config.SetDefaultMenuItems(new[] { RadialControllerSystemMenuItemKind.Volume });
        }
コード例 #2
0
 public MainPage()
 {
     this.InitializeComponent();
     colourShower = new ShowColourHue();
 }