コード例 #1
0
 private void InitializeController()
 {
     Controller = RadialController.CreateForCurrentView();
     Controller.RotationResolutionInDegrees = 1;
     Controller.RotationChanged            += Controller_RotationChanged;
     Controller.ButtonClicked += Controller_ButtonClicked;
 }
コード例 #2
0
        public OnScreenVisualPage()
        {
            this.InitializeComponent();

            RadialControllerConfiguration myConfiguration = RadialControllerConfiguration.GetForCurrentView();

            myConfiguration.SetDefaultMenuItems(new[]
            {
                RadialControllerSystemMenuItemKind.Volume,
                RadialControllerSystemMenuItemKind.Scroll
            });

            // Create a reference to the RadialController.
            myController = RadialController.CreateForCurrentView();

            // Create an icon for the custom tool.
            RandomAccessStreamReference icon =
                RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/dial_icon_custom_visual.png"));

            // Create a menu item for the custom tool.
            screenColorMenuItem =
                RadialControllerMenuItem.CreateFromIcon("Screen Color", icon);

            // Add the custom tool to the RadialController menu.
            myController.Menu.Items.Add(screenColorMenuItem);

            screenColorMenuItem.Invoked += ColorMenuItem_Invoked;

            myController.ScreenContactStarted   += MyController_ScreenContactStarted;
            myController.ScreenContactContinued += MyController_ScreenContactContinued;
            myController.ScreenContactEnded     += MyController_ScreenContactEnded;

            myController.RotationChanged += MyController_RotationChanged;
        }
コード例 #3
0
        private void ConfigureRadialController()
        {
            if (!RadialControllerConfiguration.IsAppControllerEnabled)
            {
                return;
            }

            // Setup DialController
            dialController = RadialController.CreateForCurrentView();
            dialController.RotationResolutionInDegrees = 1;

            // Wireup event handler for rotation
            dialController.RotationChanged += DialController_RotationChanged;
            dialController.ButtonClicked   += DialController_ButtonClicked;

            // Remove the default items to make more room for our custom items
            var config = RadialControllerConfiguration.GetForCurrentView();

            config.SetDefaultMenuItems(new[] { RadialControllerSystemMenuItemKind.Scroll });

            // Add a custom menu item for each of the video effects
            foreach (VideoEffectItemViewModel effect in PageViewModel.VideoEffects)
            {
                // Create a menu item, using the effect's name and thumbnail
                var menuItem = RadialControllerMenuItem.CreateFromIcon(effect.DisplayName,
                                                                       RandomAccessStreamReference.CreateFromUri(new Uri(effect.IconImagePath)));

                // Hook up the menu item's invoked (aka clicked/selected) event handler
                menuItem.Invoked += MenuItem_Invoked;

                // Add it to the RadialDial
                dialController.Menu.Items.Add(menuItem);
            }
        }
コード例 #4
0
        /// <summary>
        /// When a Surface Dial TextBox gets focus, ensure the proper events are setup, and connect the Surface Dial itself.
        /// </summary>
        /// <param name="sender">The TextBox in being affected.</param>
        /// <param name="e">The event arguments.</param>
        private static void TextBox_GotFocus(object sender, RoutedEventArgs e)
        {
            _textBox = sender as TextBox;

            if (_textBox == null)
            {
                return;
            }

            if (!IsSupported)
            {
                return;
            }

            _controller = _controller ?? RadialController.CreateForCurrentView();

            if (GetForceMenuItem(_textBox))
            {
                _stepTextMenuItem = RadialControllerMenuItem.CreateFromKnownIcon("Step Text Box", GetIcon(_textBox));
                _controller.Menu.Items.Add(_stepTextMenuItem);
                _controller.Menu.SelectMenuItem(_stepTextMenuItem);
            }

            _controller.UseAutomaticHapticFeedback  = GetEnableHapticFeedback(_textBox);
            _controller.RotationResolutionInDegrees = 1;
            _controller.RotationChanged            += Controller_RotationChanged;
            if (GetEnableTapToNextControl(_textBox))
            {
                _controller.ButtonClicked += Controller_ButtonClicked;
            }
        }
コード例 #5
0
        private void InitializeDial()
        {
            radialController = RadialController.CreateForCurrentView();

            // Set rotation resolution to 1 degree of sensitivity.
            radialController.RotationResolutionInDegrees = 36;

            // create new dial menu item
            //ToggleMenuItem =
            //    RadialControllerMenuItem.CreateFromFontGlyph("Toggle Light", "\xE793", "Segoe MDL2 Assets");
            //radialController.Menu.Items.Add(ToggleMenuItem);

            BrightnessMenuItem =
                RadialControllerMenuItem.CreateFromFontGlyph("Brightness", "\xE706", "Segoe MDL2 Assets");
            radialController.Menu.Items.Add(BrightnessMenuItem);

            ColorMenuItem =
                RadialControllerMenuItem.CreateFromFontGlyph("Color", "\xE790", "Segoe MDL2 Assets");
            radialController.Menu.Items.Add(ColorMenuItem);

            // clear all default item
            RadialControllerConfiguration config = RadialControllerConfiguration.GetForCurrentView();

            config.SetDefaultMenuItems(new RadialControllerSystemMenuItemKind[] { });

            // bind dial menu item to CurrentTool Enum
            //ToggleMenuItem.Invoked += (sender, args) => thisTool = CurrentTool.ToggleItem;
            BrightnessMenuItem.Invoked += (sender, args) => thisTool = CurrentTool.BrightnessItem;
            ColorMenuItem.Invoked      += (sender, args) => thisTool = CurrentTool.ColorItem;

            // subscribe click and rotation of the dial
            radialController.ButtonClicked   += (sender, args) => { RadialController_ButtonClicked(sender, args); };
            radialController.RotationChanged += (sender, args) => { RadialController_RotationChanged(sender, args); };
        }
コード例 #6
0
        // </SnippetTestRC>
        // <SnippetInitializeController>
        // Create and configure our radial controller.
        private void InitializeController()
        {
            // Create a reference to the RadialController.
            radialController = RadialController.CreateForCurrentView();
            // Set rotation resolution to 1 degree of sensitivity.
            radialController.RotationResolutionInDegrees = 1;

            // Declare input handlers for the RadialController.
            radialController.ButtonClicked += (sender, args) =>
            { RadialController_ButtonClicked(sender, args); };
            radialController.RotationChanged += (sender, args) =>
            { RadialController_RotationChanged(sender, args); };

            radialController.ControlAcquired += (sender, args) =>
            { RadialController_ControlAcquired(sender, args); };
            radialController.ControlLost += (sender, args) =>
            { RadialController_ControlLost(sender, args); };
            radialController.ScreenContactStarted += (sender, args) =>
            { RadialController_ScreenContactStarted(sender, args); };
            radialController.ScreenContactContinued += (sender, args) =>
            { RadialController_ScreenContactContinued(sender, args); };
            radialController.ScreenContactEnded += (sender, args) =>
            { RadialController_ScreenContactEnded(sender, args); };
            AddToLog("Input handlers created");

            // Create the custom menu items.
            CreateMenuItems();
            // Specify the menu items.
            ConfigureMenu();
        }
コード例 #7
0
        public MenuItemPage()
        {
            this.InitializeComponent();

            RadialControllerConfiguration myConfiguration = RadialControllerConfiguration.GetForCurrentView();

            //determine which operating system menu items should be shown
            myConfiguration.SetDefaultMenuItems(new[]
            {
                RadialControllerSystemMenuItemKind.Volume,
                RadialControllerSystemMenuItemKind.NextPreviousTrack,
                RadialControllerSystemMenuItemKind.Scroll
            });

            // Create a reference to the RadialController.
            myController = RadialController.CreateForCurrentView();

            // Create an icon for the custom tool.
            RandomAccessStreamReference icon =
                RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/dial_icon_custom_item.png"));

            // Create a menu item for the custom tool.
            selectImageMenuItem =
                RadialControllerMenuItem.CreateFromIcon("Select Image", icon);

            // Add the custom tool to the RadialController menu.
            myController.Menu.Items.Add(selectImageMenuItem);

            // Declare input handlers for the RadialController.
            myController.RotationChanged += MyController_RotationChanged;

            selectImageMenuItem.Invoked += SelectImageItem_Invoked;
        }
コード例 #8
0
        private void InitializeSurfaceDial()
        {
            _radialController = RadialController.CreateForCurrentView();

            _radialController.ButtonClicked   += _radialController_ButtonClicked;
            _radialController.RotationChanged += _radialController_RotationChanged;

            var bluricon       = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/Blur.png"));
            var fogicon        = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/Fog.png"));
            var hueicon        = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/Hue.png"));
            var saturationicon = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/Saturation.png"));
            var sepiaicon      = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/Sepia.png"));

            var blurItem = RadialControllerMenuItem.CreateFromIcon(TAGS.Blur, bluricon);

            blurItem.Tag = blurItem.DisplayText;
            var fogItem = RadialControllerMenuItem.CreateFromIcon(TAGS.Fog, fogicon);

            fogItem.Tag = fogItem.DisplayText;
            var hueItem = RadialControllerMenuItem.CreateFromIcon(TAGS.Hue, hueicon);

            hueItem.Tag = hueItem.DisplayText;
            var saturationItem = RadialControllerMenuItem.CreateFromIcon(TAGS.Saturation, saturationicon);

            saturationItem.Tag = saturationItem.DisplayText;
            var sepiaItem = RadialControllerMenuItem.CreateFromIcon(TAGS.Sepia, sepiaicon);

            sepiaItem.Tag = sepiaItem.DisplayText;

            _radialController.Menu.Items.Add(blurItem);
            _radialController.Menu.Items.Add(fogItem);
            _radialController.Menu.Items.Add(hueItem);
            _radialController.Menu.Items.Add(saturationItem);
            _radialController.Menu.Items.Add(sepiaItem);
        }
コード例 #9
0
        public MainPage()
        {
            this.InitializeComponent();

            controller = RadialController.CreateForCurrentView();

            controller.UseAutomaticHapticFeedback = false;

            controller.RotationResolutionInDegrees = 1;

            customItem = RadialControllerMenuItem.CreateFromKnownIcon("Rotate", RadialControllerMenuKnownIcon.Ruler);
            controller.Menu.Items.Add(customItem);

            controller.Menu.SelectMenuItem(customItem);

            config = RadialControllerConfiguration.GetForCurrentView();
            config.ActiveControllerWhenMenuIsSuppressed = controller;
            config.SetDefaultMenuItems(new[] { RadialControllerSystemMenuItemKind.Volume, RadialControllerSystemMenuItemKind.Scroll });

            //comment these three lines to supress menu scenario
            controller.ControlLost     += Controller_ControlLost;
            controller.ControlAcquired += Controller_ControlAcquired;
            controller.RotationChanged += Controller_RotationChanged;

            //uncomment it to supress the default menu
            //config.IsMenuSuppressed = true;
            //controller.ButtonHolding += Controller_ButtonHolding;
        }
コード例 #10
0
        private void SetupController()
        {
            if (null == Controller)
            {
                Controller = RadialController.CreateForCurrentView();
            }

            RadialControllerConfiguration _dialConfiguration = RadialControllerConfiguration.GetForCurrentView();

            // Remove standard menu items
            _dialConfiguration.SetDefaultMenuItems(new RadialControllerSystemMenuItemKind[] { });

            // Create an icon for the custom tool.
            RandomAccessStreamReference icon =
                RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/List/specs_creative.png"));

            // Create a menu item for the custom tool.
            _brushColorMenuItem = RadialControllerMenuItem.CreateFromIcon("Brush Color", icon);

            // Add the custom tool to the RadialController menu.
            Controller.Menu.Items.Add(_brushColorMenuItem);

            // Set rotation degrees
            Controller.RotationResolutionInDegrees = ROTATION_DEGREES;

            // Bind dial controls to local methods
            _brushColorMenuItem.Invoked       += ColorMenuItem_Invoked;
            Controller.RotationChanged        += Controller_RotationChanged;
            Controller.ButtonClicked          += Controller_ButtonClicked;
            Controller.ScreenContactStarted   += Controller_ScreenContactStarted;
            Controller.ScreenContactContinued += Controller_ScreenContactContinued;
            Controller.ScreenContactEnded     += Controller_ScreenContactEnded;
        }
        public Scenario2_SystemDefaultMenu()
        {
            this.InitializeComponent();

            controller = RadialController.CreateForCurrentView();
            controller.RotationChanged += Controller_RotationChanged;

            customItem = RadialControllerMenuItem.CreateFromKnownIcon("Item1", RadialControllerMenuKnownIcon.InkColor);
        }
コード例 #12
0
        public MainPage()
        {
            this.InitializeComponent();
            UpdatePreview();
            highlightedItem = RValue;
            myCanvas.InkPresenter.InputDeviceTypes = Windows.UI.Core.CoreInputDeviceTypes.Pen | Windows.UI.Core.CoreInputDeviceTypes.Touch;

            RValue.ValueChanged += Slider_ValueChanged;
            GValue.ValueChanged += Slider_ValueChanged;
            BValue.ValueChanged += Slider_ValueChanged;

            //Hide our custom tool's UI until it is activated
            ToolPanel.Visibility = Visibility.Collapsed;

            // Create a reference to the RadialController.
            myController = RadialController.CreateForCurrentView();

            // Create a menu item for the custom tool.

            //RadialControllerMenuItem myItem =
            //  RadialControllerMenuItem.CreateFromKnownIcon("Background", RadialControllerMenuKnownIcon.InkColor);

            RadialControllerMenuItem myItem =
                RadialControllerMenuItem.CreateFromFontGlyph("Background", "\xE7B5", "Segoe MDL2 Assets");


            //Add the custom tool's menu item to the menu
            myController.Menu.Items.Add(myItem);

            //Create a handler for when the menu item is selected
            myItem.Invoked += MyItem_Invoked;

            //Create handlers for button and rotational input
            myController.RotationChanged += MyController_RotationChanged;
            myController.ButtonClicked   += MyController_ButtonClicked;

            myController.ButtonPressed  += MyController_ButtonPressed;
            myController.ButtonReleased += MyController_ButtonReleased;

            //Remove Scroll/Zoom/Undo tools as app doesn't support them
            RadialControllerConfiguration config = RadialControllerConfiguration.GetForCurrentView();

            config.SetDefaultMenuItems(new RadialControllerSystemMenuItemKind[] { RadialControllerSystemMenuItemKind.Volume });

            //Query user's handedness for on-screen UI
            Windows.UI.ViewManagement.UISettings settings = new Windows.UI.ViewManagement.UISettings();
            isRightHanded = (settings.HandPreference == Windows.UI.ViewManagement.HandPreference.RightHanded);

            //Create handlers for when RadialController provides an on-screen position
            myController.ScreenContactStarted   += MyController_ScreenContactStarted;
            myController.ScreenContactContinued += MyController_ScreenContactContinued;
            myController.ScreenContactEnded     += MyController_ScreenContactEnded;

            //Create handlers for when RadialController focus changes
            myController.ControlAcquired += MyController_ControlAcquired;
            myController.ControlLost     += MyController_ControlLost;
        }
コード例 #13
0
        public MainPage()
        {
            this.InitializeComponent();

            ranOnLaunchInternetTasks        = false;
            currentNetworkConnectivityLevel = NetworkInformation.GetInternetConnectionProfile().GetNetworkConnectivityLevel();
            Window.Current.Activated       += Current_Activated;

            NetworkInformation.NetworkStatusChanged += NetworkInformation_NetworkStatusChanged;

            string deviceFamily = AnalyticsInfo.VersionInfo.DeviceFamily;

            if (deviceFamily.Contains("Mobile"))
            {
                device = Device.Mobile;
            }
            else if (deviceFamily.Contains("Desktop"))
            {
                device = Device.Desktop;
            }
            else
            {
                device = Device.Other;
            }

            mediaPlayer              = new MediaPlayer();
            mediaPlayer.MediaEnded  += MediaPlayer_MediaEnded;
            mediaPlayer.MediaFailed += MediaPlayer_MediaFailed;
            mediaPlayerElement.SetMediaPlayer(mediaPlayer);
            ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.FullScreen;
            httpClient           = new HttpClient();
            appleMovieDownloader = new AppleMovieDownloader(httpClient);
            sunrise          = DateTime.MinValue;
            sunset           = DateTime.MinValue;
            lastPositions    = new Queue <TimeSpan>();
            SpotifyHelper    = new SpotifyHelper();
            HueHelper        = new HueHelper();
            AirQualityHelper = new AirQualityHelper();
            CalendarHelper   = new CalendarHelper();

            rotationBuffer = 0;
            lightMode      = LightMode.Brightness;

            if (device == Device.Desktop)
            {
                dial = RadialController.CreateForCurrentView();
                dial.RotationResolutionInDegrees = 5;
                dial.UseAutomaticHapticFeedback  = false;
                dialConfig            = RadialControllerConfiguration.GetForCurrentView();
                menuItems             = new List <RadialControllerMenuItem>();
                isWindowFocused       = true;
                dial.ButtonClicked   += Dial_ButtonClicked;
                dial.RotationChanged += Dial_RotationChanged;
                dial.ControlAcquired += Dial_ControlAcquired;
                dial.ControlLost     += Dial_ControlLost;
            }
        }
コード例 #14
0
        private void InitializeRadialController()
        {
            RadialController = RadialController.CreateForCurrentView();
            RadialController.RotationResolutionInDegrees = 15;

            // Clear any custom items.
            RadialController.Menu.Items.Clear();

            RadialController.RotationChanged += RadialController_RotationChanged;
        }
コード例 #15
0
        public async void Initialise()
        {
            await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
                                                                                                        () =>
            {
                _controller = RadialController.CreateForCurrentView();

                wireEvents();
            }
                                                                                                        );
        }
コード例 #16
0
        private async void InitializeRadialController()
        {
            if (!ApiInformation.IsTypePresent(typeof(RadialController).FullName))
            {
                return;
            }

            if (RadialController.IsSupported())
            {
                myController = RadialController.CreateForCurrentView();
            }

            if (myController == null)
            {
                return;
            }

            myController.RotationResolutionInDegrees = 1;
            myController.UseAutomaticHapticFeedback  = false;

            await VM.InitializeTask;

            if (!isLoaded)
            {
                return;
            }

            RandomAccessStreamReference icon = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/StoreLogo.png"));

            // Create a menu item for the custom tool.
            myController.Menu.Items.Clear();

            if (VM.SupportsDimming)
            {
                myController.Menu.Items.Add(RadialControllerMenuItem.CreateFromIcon("Brightness", RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/Brightness.png"))));
            }
            if (VM.SupportsColor)
            {
                myController.Menu.Items.Add(RadialControllerMenuItem.CreateFromIcon("Saturation", RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/Saturation.png"))));
                myController.Menu.Items.Add(RadialControllerMenuItem.CreateFromIcon("Hue", RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/HueIcon.png"))));
            }

            var config = RadialControllerConfiguration.GetForCurrentView();

            config.SetDefaultMenuItems(new RadialControllerSystemMenuItemKind[] { });


            supportsHaptics               = ApiInformation.IsTypePresent("Windows.Devices.Haptics.SimpleHapticsController");
            myController.ButtonClicked   += MyController_ButtonClicked;
            myController.RotationChanged += MyController_RotationChanged;

            SurfaceDialTip.Visibility = Visibility.Visible;
        }
コード例 #17
0
ファイル: MainPage.xaml.cs プロジェクト: usheveta/Blog
        public MainPage()
        {
            InitializeComponent();

            _controller = RadialController.CreateForCurrentView();
            var icon   = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/StoreLogo.png"));
            var myItem = RadialControllerMenuItem.CreateFromIcon("El Bruno Sample App", icon);

            _controller.Menu.Items.Add(myItem);
            _controller.ButtonClicked   += ControllerButtonClicked;
            _controller.RotationChanged += ControllerRotationChanged;
        }
コード例 #18
0
        private void ConfigureDialRotation()
        {
            var iconRotate = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/Rotate.png"));
            var itemRotate = RadialControllerMenuItem.CreateFromIcon("Rotate", iconRotate);
            var controller = RadialController.CreateForCurrentView();

            controller.Menu.Items.Add(itemRotate);
            controller.RotationChanged += ControllerOnRotationChanged;

            var config = RadialControllerConfiguration.GetForCurrentView();

            config.SetDefaultMenuItems(new RadialControllerSystemMenuItemKind[] { });
        }
コード例 #19
0
        public MainPage()
        {
            this.InitializeComponent();

            radial = RadialController.CreateForCurrentView();
            var icon = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/StoreLogo.png"));
            var item = RadialControllerMenuItem.CreateFromKnownIcon("ITWORKS", RadialControllerMenuKnownIcon.Volume);

            radial.Menu.Items.Add(item);

            radial.ButtonClicked   += Radial_ButtonClicked;
            radial.RotationChanged += Radial_RotationChanged;
        }
コード例 #20
0
        private void InitializeController()
        {
            Controller = RadialController.CreateForCurrentView();
            Controller.RotationResolutionInDegrees = 1;

            // Wire events
            Controller.RotationChanged        += Controller_RotationChanged;
            Controller.ButtonClicked          += Controller_ButtonClicked;
            Controller.ScreenContactStarted   += Controller_ScreenContactStarted;
            Controller.ScreenContactContinued += Controller_ScreenContactContinued;
            Controller.ScreenContactEnded     += Controller_ScreenContactEnded;
            Controller.ControlAcquired        += Controller_ControlAcquired;
            Controller.ControlLost            += Controller_ControlLost;
        }
コード例 #21
0
        /// <summary>
        /// 初期化処理
        /// </summary>
        public void Initialize()
        {
#if NETFX_CORE
            this.control = RadialController.CreateForCurrentView();

            // オリジナルのメニューを追加
            var icon = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/CatHand.png"));
            var item = RadialControllerMenuItem.CreateFromIcon("Play Game", icon);
            this.control.Menu.Items.Add(item);

            // イベントの購読
            this.control.ButtonClicked   += this.OnButtonClicked;
            this.control.RotationChanged += this.OnRotationChanged;
#endif
        }
コード例 #22
0
        public DialMenuControl()
        {
            Loaded += DialMenuControl_Loaded;

            _radialController = RadialController.CreateForCurrentView();
            _myRadialMenuItem = RadialControllerMenuItem.CreateFromKnownIcon("The App", RadialControllerMenuKnownIcon.InkColor);
            _radialController.Menu.Items.Add(_myRadialMenuItem);
            _radialController.RotationChanged += OnRadialController_RotationChanged;
            _radialController.ButtonClicked   += OnRadialController_ButtonClicked;
            var config = RadialControllerConfiguration.GetForCurrentView();

            config.SetDefaultMenuItems(new RadialControllerSystemMenuItemKind[] { });
            config.IsMenuSuppressed = true;
            this.DefaultStyleKey    = typeof(DialMenuControl);
        }
コード例 #23
0
        private void InitializeController()
        {
            _controller = RadialController.CreateForCurrentView();
            _controller.RotationResolutionInDegrees = 5;

            // Wire events
            _controller.RotationChanged += Controller_RotationChanged;
            _controller.ButtonClicked   += Controller_ButtonClicked;

            _controller.Menu.Items.Clear();
            _radialMenuItem = RadialControllerMenuItem.CreateFromKnownIcon("Asteroids", RadialControllerMenuKnownIcon.Scroll);
            _controller.Menu.Items.Add(_radialMenuItem);
            _controller.Menu.SelectMenuItem(_radialMenuItem);
            //_controller.Menu.IsEnabled = true;
        }
コード例 #24
0
        public MainPage()
        {
            this.InitializeComponent();
            // inizializzo l'oggetto
            controller = RadialController.CreateForCurrentView();
            // creo una icona per lo strumento personalizzato
            RandomAccessStreamReference icon = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/StoreLogo.png"));
            // creo un menu item per lo strumento personalizzato
            RadialControllerMenuItem myItem = RadialControllerMenuItem.CreateFromIcon("Sample", icon);

            // aggiungo lo strumento personalizzato al menu di RadialController
            controller.Menu.Items.Add(myItem);
            // aggiungo gli handler per gli eventi del RadialController
            controller.ButtonClicked   += Controller_ButtonClicked;
            controller.RotationChanged += Controller_RotationChanged;
        }
コード例 #25
0
ファイル: MapPagePage.xaml.cs プロジェクト: ZZZim/Blog
        public MapPagePage()
        {
            locationService = new LocationService();
            Center          = new Geopoint(defaultPosition);
            ZoomLevel       = DefaultZoomLevel;
            InitializeComponent();

            _controller = RadialController.CreateForCurrentView();
            _controller.RotationResolutionInDegrees = 0.2;
            _controller.UseAutomaticHapticFeedback  = false;

            var myItem = RadialControllerMenuItem.CreateFromFontGlyph("El Bruno - Maps", "\xE128", "Segoe MDL2 Assets");

            _controller.Menu.Items.Add(myItem);
            _controller.ButtonClicked   += ControllerButtonClicked;
            _controller.RotationChanged += ControllerRotationChangedAsync;
        }
コード例 #26
0
        public void RegisterSurfaceDial()
        {
            if (RadialController.IsSupported())
            {
                _diaoController = RadialController.CreateForCurrentView();
                _diaoController.UseAutomaticHapticFeedback  = Settings.EnableVibrateForSurfaceDial;
                _diaoController.RotationResolutionInDegrees = 1;

                // Opacity Tool
                DiaoToolOpacity = RadialControllerMenuItem.CreateFromFontGlyph(Utils.GetResource("Tracing.Core/Resources/SurfaceDialMenu/Opacity"), "\xE71C", "Segoe MDL2 Assets");
                _diaoController.Menu.Items.Add(DiaoToolOpacity);
                DiaoToolOpacity.Invoked += (sender, args) =>
                {
                    OpacityInvoked?.Invoke(sender, args);
                };

                // Undo Tool
                DiaoToolUndoRedo = RadialControllerMenuItem.CreateFromFontGlyph(Utils.GetResource("Tracing.Core/Resources/SurfaceDialMenu/Undo"), "\xE10E", "Segoe MDL2 Assets");
                _diaoController.Menu.Items.Add(DiaoToolUndoRedo);
                DiaoToolUndoRedo.Invoked += (sender, args) =>
                {
                    UndoRedoInvoked?.Invoke(sender, args);
                };

                // Zoom Tool
                DiaoToolZoom = RadialControllerMenuItem.CreateFromKnownIcon(Utils.GetResource("Tracing.Core/Resources/SurfaceDialMenu/Zoom"), RadialControllerMenuKnownIcon.Zoom);
                _diaoController.Menu.Items.Add(DiaoToolZoom);
                DiaoToolZoom.Invoked += (sender, args) =>
                {
                    ZoomInvoked?.Invoke(sender, args);
                };

                // AlignmentGrid Tool
                DiaoToolAlignmentGrid = RadialControllerMenuItem.CreateFromFontGlyph(Utils.GetResource("Tracing.Core/Resources/SurfaceDialMenu/AlignmentGrid"), "\xE80A", "Segoe MDL2 Assets");
                _diaoController.Menu.Items.Add(DiaoToolAlignmentGrid);
                DiaoToolAlignmentGrid.Invoked += (sender, args) =>
                {
                    AlignmentGridInvoked?.Invoke(sender, args);
                };

                _diaoController.RotationChanged += DiaoController_RotationChanged;

                DiaoConfig = RadialControllerConfiguration.GetForCurrentView();
                DiaoConfig.SetDefaultMenuItems(new RadialControllerSystemMenuItemKind[] { });
            }
        }
コード例 #27
0
        public MediaPlayerPagePage()
        {
            InitializeComponent();

            mpe.PosterSource = new BitmapImage(new Uri(DefaultPoster));
            mpe.Source       = MediaSource.CreateFromUri(new Uri(DefaultSource));

            _controller = RadialController.CreateForCurrentView();
            _controller.RotationResolutionInDegrees = 5;
            _controller.UseAutomaticHapticFeedback  = false;

            var myItem = RadialControllerMenuItem.CreateFromFontGlyph("El Bruno - Playback", "\xE714", "Segoe MDL2 Assets");

            _controller.Menu.Items.Add(myItem);
            _controller.ButtonClicked   += ControllerButtonClicked;
            _controller.RotationChanged += ControllerRotationChanged;
        }
コード例 #28
0
        public MainPage()
        {
            this.InitializeComponent();
            // Create a reference to the RadialController.
            var controller = RadialController.CreateForCurrentView();

            // Create the items for the menu
            var itemResize = RadialControllerMenuItem.CreateFromFontGlyph("Resize", "\xE8B9", "Segoe MDL2 Assets");
            var itemRotate = RadialControllerMenuItem.CreateFromFontGlyph("Rotate", "\xE7AD", "Segoe MDL2 Assets");
            var itemMoveX  = RadialControllerMenuItem.CreateFromFontGlyph("MoveX", "\xE8AB", "Segoe MDL2 Assets");
            var itemMoveY  = RadialControllerMenuItem.CreateFromFontGlyph("MoveY", "\xE8CB", "Segoe MDL2 Assets");
            var itemColor  = RadialControllerMenuItem.CreateFromFontGlyph("Color", "\xE7E6", "Segoe MDL2 Assets");

            // Add the items to the menu
            controller.Menu.Items.Add(itemResize);
            controller.Menu.Items.Add(itemRotate);
            controller.Menu.Items.Add(itemMoveX);
            controller.Menu.Items.Add(itemMoveY);
            controller.Menu.Items.Add(itemColor);

            // Select the correct tool when the item is selected
            itemResize.Invoked += (s, e) => _currentTool = CurrentTool.Resize;
            itemRotate.Invoked += (s, e) => _currentTool = CurrentTool.Rotate;
            itemMoveX.Invoked  += (s, e) => _currentTool = CurrentTool.MoveX;
            itemMoveY.Invoked  += (s, e) => _currentTool = CurrentTool.MoveY;
            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 });
            config.ActiveControllerWhenMenuIsSuppressed = controller;
            config.IsMenuSuppressed               = true;
            controller.ButtonHolding             += (s, e) => _isButtonHolding = true;
            controller.ButtonReleased            += (s, e) => _isButtonHolding = false;
            controller.UseAutomaticHapticFeedback = false;
            ToolText.Text = _currentTool.ToString();
        }
コード例 #29
0
ファイル: DialHelper.cs プロジェクト: jbristowe/neo-tracker
        private static void StepValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            _control = d as RadialBarGaugeIndicator;

            if (_control == null)
            {
                return;
            }

            _controller = _controller ?? RadialController.CreateForCurrentView();

            var menuItem = RadialControllerMenuItem.CreateFromKnownIcon("Radial Bar", RadialControllerMenuKnownIcon.Scroll);

            _controller.Menu.Items.Add(menuItem);
            _controller.Menu.SelectMenuItem(menuItem);

            _controller.UseAutomaticHapticFeedback  = true;
            _controller.RotationResolutionInDegrees = 1;
            _controller.RotationChanged            += Controller_RotationChanged;
        }
コード例 #30
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 });
        }