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 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; }
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; }
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); } }
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); }; }
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; }
protected override void OnNavigatedTo(NavigationEventArgs e) { _compositor = ElementCompositionPreview.GetElementVisual(this)?.Compositor; // User the events on the ink presenter _inkPresenter = MyInkCanvas.InkPresenter; _inkPresenter.InputDeviceTypes = CoreInputDeviceTypes.Mouse | CoreInputDeviceTypes.Pen | CoreInputDeviceTypes.Touch; _inkPresenter.StrokesCollected += InkPresenter_StrokesCollected; _inkPresenter.StrokesErased += InkPresenter_StrokesErased; _inkPresenter.UnprocessedInput.PointerPressed += UnprocessedInput_PointerPressed; _inkPresenter.InputProcessingConfiguration.RightDragAction = InkInputRightDragAction.LeaveUnprocessed; // Radial controller used for recognition if (RadialController.IsSupported()) { App.RadialController.ButtonPressed += RadialController_ButtonPressed; // Supress menu of controller _radialConfiguration = RadialControllerConfiguration.GetForCurrentView(); _radialConfiguration.ActiveControllerWhenMenuIsSuppressed = App.RadialController; _radialConfiguration.IsMenuSuppressed = true; } // When using Cortana perform app protocol recognition App.ProtocolSubject.Subscribe(dataEventArgs => App_Protocol(dataEventArgs)); ImageAnimationSetup(); }
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; } }
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; }
private void ToggleMenuSuppression(Object sender, RoutedEventArgs args) { RadialControllerConfiguration radialControllerConfig = RadialControllerConfiguration.GetForCurrentView(); if (MenuSuppressionToggleSwitch.IsOn) { radialControllerConfig.ActiveControllerWhenMenuIsSuppressed = Controller; } radialControllerConfig.IsMenuSuppressed = MenuSuppressionToggleSwitch.IsOn; }
public void UnregisterRadialController() { if (RadialController != null) { RadialController.Menu.Items.Clear(); RadialController.RotationChanged -= RadialController_RotationChanged; RadialController.ButtonClicked -= RadialController_ButtonClicked; } RadialControllerConfiguration.GetForCurrentView().ResetToDefaultMenuItems(); }
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; }
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[] { }); }
// </SnippetInitializeController> // Specify the radial controller menu items. // We remove all built-in items and add our default custom item. private void ConfigureMenu() { // Add primary (default) tool. radialController.Menu.Items.Add(menuItems[PRIMARY_MENU_ITEM_INDEX]); activeMenuItemIndex = PRIMARY_MENU_ITEM_INDEX; // Remove built-in tools to declutter the menu. // NOTE: The Surface Dial menu must have at least one menu item. // If all built-in tools are removed before you add a custom // tool, the default tools are restored and your tool is appended // to the default collection. radialControllerConfig = RadialControllerConfiguration.GetForCurrentView(); radialControllerConfig.SetDefaultMenuItems(new RadialControllerSystemMenuItemKind[] { }); }
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); }
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[] { }); } }
/// <summary> /// TODO: 3. Dial Control /// </summary> private void SetupDialControl() { // Singleton instance for the app using RadialController.CreateForCurrentView(); _radialController = App.RadialController; // Suppress the current menu from the dial _radialConfiguration = RadialControllerConfiguration.GetForCurrentView(); _radialConfiguration.ActiveControllerWhenMenuIsSuppressed = App.RadialController; _radialConfiguration.IsMenuSuppressed = true; _radialController.RotationResolutionInDegrees = _normalMovement; _radialController.ButtonHolding += RadialController_ButtonHolding; _radialController.RotationChanged += RadialController_RotationChanged; _radialController.ScreenContactStarted += RadialController_ScreenContactStarted; _radialController.ScreenContactEnded += RadialController_ScreenContactEnded; _radialController.ButtonPressed += RadialController_ButtonPressed; _radialController.ButtonReleased += RadialController_ButtonReleased; }
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(); }
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 }); }
// Configure RadialController menu and custom tool. private void InitializeController(object sender, RoutedEventArgs args) { // Create a reference to the RadialController. radialController = RadialController.CreateForCurrentView(); // Set rotation resolution to 1 degree of sensitivity. radialController.RotationResolutionInDegrees = 1; // Create the custom menu items. // Here, we use a font glyph for our custom tool. radialControllerMenuItem = RadialControllerMenuItem.CreateFromFontGlyph("SampleTool", "\xE1E3", "Segoe MDL2 Assets"); // Add the item to the RadialController menu. radialController.Menu.Items.Add(radialControllerMenuItem); // Remove built-in tools to declutter the menu. // NOTE: The Surface Dial menu must have at least one menu item. // If all built-in tools are removed before you add a custom // tool, the default tools are restored and your tool is appended // to the default collection. radialControllerConfig = RadialControllerConfiguration.GetForCurrentView(); radialControllerConfig.SetDefaultMenuItems( new RadialControllerSystemMenuItemKind[] { }); // Declare input handlers for the RadialController. // NOTE: These events are only fired when a custom tool is active. radialController.ButtonClicked += (clicksender, clickargs) => { RadialController_ButtonClicked(clicksender, clickargs); }; radialController.RotationChanged += (rotationsender, rotationargs) => { RadialController_RotationChanged(rotationsender, rotationargs); }; // Begin "Step 6: Customize the device haptics" //radialController.ControlAcquired += (hapticssender, hapticsargs) => //{ RadialController_ControlAcquired(hapticssender, hapticsargs); }; // End "Step 6: Customize the device haptics" }
public MainPage() { this.InitializeComponent(); //Create a reference to the RadialController. myController = RadialController.CreateForCurrentView(); myController.RotationResolutionInDegrees = 5; myController.UseAutomaticHapticFeedback = false; //Create menu items for the custom tool. volumeItem = RadialControllerMenuItem.CreateFromFontGlyph("Volume", "\xE767", "Segoe MDL2 Assets"); playbackItem = RadialControllerMenuItem.CreateFromFontGlyph("Playback", "\xE714", "Segoe MDL2 Assets"); volumeItem.Invoked += VolumeItem_Invoked; playbackItem.Invoked += PlaybackItem_Invoked; //Add the custom tool's menu item to the menu myController.Menu.Items.Add(volumeItem); myController.Menu.Items.Add(playbackItem); //Create handlers for button and rotational input myController.RotationChanged += MyController_RotationChanged; myController.ButtonClicked += MyController_ButtonClicked; //Remove system's built-in tools config = RadialControllerConfiguration.GetForCurrentView(); config.SetDefaultMenuItems(new RadialControllerSystemMenuItemKind[] { }); //Set up menu suppression targets config.ActiveControllerWhenMenuIsSuppressed = myController; myController.ButtonHolding += MyController_ButtonHolding; myPlayer.CurrentStateChanged += MyPlayer_CurrentStateChanged; //Select the first tool myPlayer.Loaded += MyPlayer_Loaded; }
public void InitializeForColoringPage() { InitializeRadialController(); // Set new system defaults. var config = RadialControllerConfiguration.GetForCurrentView(); config.SetDefaultMenuItems(new[] { RadialControllerSystemMenuItemKind.Volume, }); RadialControllerMenuItem colorRadialMenuItem = RadialControllerMenuItem.CreateFromKnownIcon( Tools.GetResourceString("RadialDial/ColorPicker"), RadialControllerMenuKnownIcon.InkColor); RadialControllerMenuItem undoRedoRadialMenuItem = RadialControllerMenuItem.CreateFromKnownIcon( "UndoRedo", RadialControllerMenuKnownIcon.UndoRedo); colorRadialMenuItem.Invoked += (s, e) => CurrentSelection = ColoringBookRadialController.Color; undoRedoRadialMenuItem.Invoked += (s, e) => CurrentSelection = ColoringBookRadialController.UndoRedo; AddMenuItem(colorRadialMenuItem); AddMenuItem(undoRedoRadialMenuItem); }
public MainPage() { this.InitializeComponent(); cnc_controller = new Controller(); radial_controller = RadialController.CreateForCurrentView(); RadialControllerConfiguration myConfiguration = RadialControllerConfiguration.GetForCurrentView(); myConfiguration.SetDefaultMenuItems(new[] { RadialControllerSystemMenuItemKind.Volume, RadialControllerSystemMenuItemKind.NextPreviousTrack }); RandomAccessStreamReference xicon = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/XAxis.64.png")); RandomAccessStreamReference yicon = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/YAxis.64.png")); RandomAccessStreamReference zicon = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/ZAxis.64.png")); RadialControllerMenuItem xAxisItem = RadialControllerMenuItem.CreateFromIcon("X-Axis", xicon); RadialControllerMenuItem yAxisItem = RadialControllerMenuItem.CreateFromIcon("Y-Axis", yicon); RadialControllerMenuItem zAxisItem = RadialControllerMenuItem.CreateFromIcon("Z-Axis", zicon); xAxisItem.Tag = Axes.X; yAxisItem.Tag = Axes.Y; zAxisItem.Tag = Axes.Z; radial_controller.Menu.Items.Add(xAxisItem); radial_controller.Menu.Items.Add(yAxisItem); radial_controller.Menu.Items.Add(zAxisItem); radial_controller.UseAutomaticHapticFeedback = true; radial_controller.RotationResolutionInDegrees = 5; radial_controller.RotationChanged += Controller_RotationChanged; radial_controller.ButtonClicked += Controller_ButtonClicked; // foreach (var name in SerialPort.GetPortNames()) // { // port_select.Items.Add(name); // } port_select.SelectedIndex = 0; connect_button.Click += Connect_button_Click; stop_button.Click += Stop_button_Click; //send_button.Click += Send_button_Click; unlock_button.Click += Unlock_button_Click; left_button.Click += Left_button_Click; right_button.Click += Right_button_Click; x_set_text.LostFocus += X_set_text_LostFocus; y_set_text.LostFocus += Y_set_text_LostFocus; z_set_text.LostFocus += Z_set_text_LostFocus; live_checkBox.Checked += Live_checkBox_Checked; live_checkBox.Unchecked += Live_checkBox_Unchecked; go_button.Click += Go_button_Click; to_origin_button.Click += To_origin_button_Click; to_work_origin_button.Click += To_work_origin_button_Click; zero_work_button.Click += Zero_work_button_Click; cnc_controller.StatusChanged += Cnc_controller_StatusChanged; cnc_controller.PositionChanged += Cnc_controller_PositionChanged; }
private void DialSettings(ObservableCollection <string> items) { // コントローラーを取得 var controller = _controller = RadialController.CreateForCurrentView(); {// アプリ独自メニューの設定 var menuItems = new List <RadialControllerMenuItem>() { RadialControllerMenuItem.CreateFromKnownIcon("Item Name 1", RadialControllerMenuKnownIcon.InkColor), RadialControllerMenuItem.CreateFromKnownIcon("Item Name 2", RadialControllerMenuKnownIcon.PenType) }; menuItems.ForEach(m => controller.Menu.Items.Add(m)); // メニューが選択されたイベント menuItems.ForEach(m => m.Invoked += (sender, arg) => AddItem(items, null, sender, nameof(RadialControllerMenuItem.Invoked), arg?.ToString() ) ); } {// 標準メニューの設定 // ここでは音量とスクロールだけを設定している var configration = RadialControllerConfiguration.GetForCurrentView(); //configration.SetDefaultMenuItems(Enumerable.Empty<RadialControllerSystemMenuItemKind>()); configration.SetDefaultMenuItems(new[] { RadialControllerSystemMenuItemKind.Volume, RadialControllerSystemMenuItemKind.Scroll }); } // イベントハンドラの設定(イベントの記録) // 標準メニューを選択した際や // アプリがフォーカスを失った時にも発生 controller.ControlLost += (sender, arg) => AddItem(items, null, sender, nameof(RadialController.ControlLost), arg?.ToString() ); // Dial を回転したときに発生 // arg.IsButtonPressed で押し込みながらの回転かを判別できる controller.RotationChanged += (sender, arg) => AddItem(items, arg.Contact, sender, nameof(RadialController.RotationChanged), $"{nameof(arg.IsButtonPressed)} : {arg.IsButtonPressed}, {nameof(arg.RotationDeltaInDegrees)} : {arg.RotationDeltaInDegrees}" ); // Dial のクリック(押し込み)時に発生 // クリック時、ButtonPressed ⇒ ButtonReleased ⇒ ButtonClicked と 3 つが続けて発生 // 押し込みながら Dial 回転した後でも ButtonClicked が発生する controller.ButtonClicked += (sender, arg) => AddItem(items, arg.Contact, sender, nameof(RadialController.ButtonClicked), arg?.ToString() ); controller.ButtonHolding += (sender, arg) => AddItem(items, arg.Contact, sender, nameof(RadialController.ButtonHolding), arg?.ToString() ); // Dial を押し込んだ際に発生 controller.ButtonPressed += (sender, arg) => AddItem(items, arg.Contact, sender, nameof(RadialController.ButtonPressed), arg?.ToString() ); // Dial を押し込んだ後、離した際に発生 controller.ButtonReleased += (sender, arg) => AddItem(items, arg.Contact, sender, nameof(RadialController.ButtonReleased), arg?.ToString() ); // 標準メニュー選択状態から独自メニューを選択した際や // アプリがフォーカスを得た際にも発生 controller.ControlAcquired += (sender, arg) => AddItem(items, arg.Contact, sender, nameof(RadialController.ControlAcquired), arg?.ToString() ); controller.ScreenContactContinued += (sender, arg) => AddItem(items, arg.Contact, sender, nameof(RadialController.ScreenContactContinued), arg?.ToString() ); controller.ScreenContactEnded += (sender, arg) => AddItem(items, null, sender, nameof(RadialController.ScreenContactEnded), arg?.ToString() ); controller.ScreenContactStarted += (sender, arg) => AddItem(items, arg.Contact, sender, nameof(RadialController.ScreenContactStarted), $"{nameof(arg.IsButtonPressed)} : {arg?.IsButtonPressed}, {arg?.ToString()}" ); }
static World() { random = new Random(); dial = RadialController.CreateForCurrentView(); dialConfig = RadialControllerConfiguration.GetForCurrentView(); }
private void Reset_ToDefault(object sender, RoutedEventArgs e) { config = RadialControllerConfiguration.GetForCurrentView(); config.ResetToDefaultMenuItems(); }
private void Select_Volume(object sender, RoutedEventArgs e) { config = RadialControllerConfiguration.GetForCurrentView(); config.TrySelectDefaultMenuItem(RadialControllerSystemMenuItemKind.Volume); }
private void ModifySystemDefaults(object sender, RoutedEventArgs e) { config = RadialControllerConfiguration.GetForCurrentView(); config.SetDefaultMenuItems(new[] { RadialControllerSystemMenuItemKind.Volume, RadialControllerSystemMenuItemKind.Scroll }); }
private void Remove_Defaults(object sender, RoutedEventArgs e) { config = RadialControllerConfiguration.GetForCurrentView(); config.SetDefaultMenuItems(new RadialControllerSystemMenuItemKind[] { }); }