protected override void OnApplyTemplate() { base.OnApplyTemplate(); _grdGraphics = GetTemplateChild("GrdGraphics") as Grid; _toggleStatesGroup = GetTemplateChild("ToggleStates") as VisualStateGroup; if (_grdGraphics == null || _toggleStatesGroup == null) { return; } _toggleStatesGroup.CurrentStateChanged += _toggleStatesGroup_CurrentStateChanged; _toggleStatesGroup.CurrentStateChanging += (sender, args) => { _isAnimationOnRunning = true; }; _grdGraphics.Tapped += _grdGraphics_Tapped; _grdGraphics.PointerEntered += _grdGraphics_PointerEntered; _grdGraphics.PointerExited += _grdGraphics_PointerExited; if (this.IsOn) { VisualStateManager.GoToState(this, "On", false); } else { VisualStateManager.GoToState(this, "Off", false); } Toggled?.Invoke(this, new RoutedEventArgs()); }
public void Toggle() { Visible = !Visible; Toggled?.Invoke(Visible); StateHasChanged(); }
/// <summary> /// Change the current active button /// </summary> /// <param name="btn">The button to make active/checked in the group</param> public void UpdateCurrentButton(ButtonBase btn) { _currentButton = btn; if (btn != null) { btn.IsToggled = true; } foreach (ButtonBase b in _buttons) { if (btn != b) { b.IsToggled = false; } } if (btn != null) { Toggled?.Invoke(this, btn, _buttons.IndexOf(btn)); } else { Toggled?.Invoke(this, null, -1); } }
private void OnIsOnChanged(DependencyPropertyChangedEventArgs e) { // On windows the event is raised first, then the ui is updated Toggled?.Invoke(this, new RoutedEventArgs()); UpdateToggleState(); UpdateContentState(); }
protected override bool Process(Key key, KeyModifier modifier, KeyState state) { var changed = false; var pressed = state == KeyState.Pressed; switch (key) { case Key.A: changed = A != pressed; A = pressed; break; case Key.LWin: changed = LeftWindows != pressed; LeftWindows = pressed; break; } if (A && LeftWindows && changed) { logger.Debug("Detected toggle sequence for action center."); Toggled?.Invoke(); return(true); } return(false); }
private IntPtr LowLevelKeyboardProc(int nCode, IntPtr wParam, IntPtr lParam) { if (nCode >= 0) { var changed = false; var keyData = (KBDLLHOOKSTRUCT)Marshal.PtrToStructure(lParam, typeof(KBDLLHOOKSTRUCT)); var pressed = IsPressed(wParam.ToInt32()); switch (keyData.KeyCode) { case (uint)VirtualKeyCode.A: changed = A != pressed; A = pressed; break; case (uint)VirtualKeyCode.LeftWindows: changed = LeftWindows != pressed; LeftWindows = pressed; break; } if (A && LeftWindows && changed) { logger.Debug("Detected toggle sequence for action center."); Toggled?.Invoke(); return((IntPtr)1); } } return(User32.CallNextHookEx(handle, nCode, wParam, lParam)); }
public override void Setted() { base.Setted(); Changed.Invoke(ItemHandler as WeaponHandler); Toggled?.Invoke(false); }
public void Toggle() { IsOpen = !IsOpen; Toggled?.Invoke(IsOpen); StateHasChanged(); }
void Initialize(EvasObject parent) { _mainContainer = new Box(parent) { AlignmentX = -1, AlignmentY = -1, WeightX = 1, WeightY = 1, }; _mainContainer.Show(); PackEnd(_mainContainer); _dimArea = new Box(parent) { AlignmentX = -1, AlignmentY = -1, WeightX = 1, WeightY = 1, BackgroundColor = MColors.Current.OnSurfaceColor.WithAlpha(0.32) }; PackEnd(_dimArea); _drawer = new Panel(parent); _drawer.SetScrollable(!_isLock); _drawer.SetScrollableArea(_navigationViewRatio); _drawer.Direction = PanelDirection.Left; _drawer.Toggled += (s, e) => { UpdateDimArea(); Toggled?.Invoke(this, e); }; _drawer.Show(); PackEnd(_drawer); }
/// <summary> /// Creates and initializes a new instance of the Panel class. /// </summary> /// <param name="parent">The EvasObject to which the new panel will be attached as a child.</param> /// <since_tizen> preview </since_tizen> public Panel(EvasObject parent) : base(parent) { _toggled = new SmartEvent(this, this.RealHandle, "toggled"); _scrolled = new SmartEvent(this, this.RealHandle, "scroll"); _toggled.On += (s, e) => Toggled?.Invoke(this, EventArgs.Empty); _scrolled.On += (s, e) => Scrolled?.Invoke(this, EventArgs.Empty); }
private async void OnFeatureToggleToggled(object sender, ToggledEventArgs e) { Log.Info($"Feature toggle '{e.Toggle}' was toggled from '{e.OldValue}' => '{e.NewValue}'"); await SaveAsync(); Toggled?.Invoke(this, e); }
void PlayControl_Toggled(object sender, RoutedEventArgs e) { // Keep our IsChecked property in sync with the ToggleButton's IsChecked property. IsChecked = _playStopButton.IsChecked == true; // Notify listeners. Toggled?.Invoke(sender, e); }
public ToggleCommand(string name, string label, string?tooltip, string?stock_id) : base(name, label, tooltip, stock_id, new GLib.Variant(false)) { Activated += (o, args) => { var active = !(bool)Action.State; Toggled?.Invoke(active); Action.ChangeState(new GLib.Variant(active)); }; }
private void OnInputReceived(Action action, State state, bool pointerOverUi) { Toggled?.Invoke(this, new ToggledArgs { Action = action, State = state, PointerOverUi = pointerOverUi }); }
private void Lever_OnCollision(Box sender, CollisionEventArgs e) { if (e.CollidedWith is Character) { SwitchState = true; Counter = TimeSpan.Zero; SwitchedOn?.Invoke(this); Toggled?.Invoke(this); } }
private void Toggle() { if (_pauseMenuToggler.IsToggled) { IsToggled = !IsToggled; return; } Toggled?.Invoke(); _pickableItemssInventoryUIUpdater.ActivateOrClose(); }
/// <summary> /// Called from the platform dependent renderers & interaction handlers /// to fire the toggle event to the button's user /// </summary> /// <param name="e"></param> protected /*async Task*/ void FireToggled(EventArgs e) { //await Task.Run(() => //{ // Xamarin.Forms.Device.BeginInvokeOnMainThread(() => // { Toggled?.Invoke(this, e); ToggleCommand?.Execute(this); // }); //}); }
public MySwitch() : base() { this.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Auto) }); { SWmain = new Switch(); SWmain.Toggled += (sender, e) => { Toggled?.Invoke(sender, e); }; this.Children.Add(SWmain, 0, 0); } }
private void CreateToggle() { toggle = new Switch() { }; toggle.Toggled += (object sender, ToggledEventArgs e) => { if (Toggled != null) { Toggled.Invoke(this, e); } }; }
private void TapGestureRecognizer_Tapped(object sender, EventArgs e) { Toggled?.Invoke(sender, e); if (Foreground == ColorActive) { Foreground = ColorUnActive; } else { Foreground = ColorActive; } }
protected virtual void OnToggled() { var args = new RoutedEventArgs(); args.OriginalSource = this; Toggled?.Invoke(this, args); if (!_isDragging) { UpdateVisualState(true); } }
public void Close() { var temp = IsOpen; IsOpen = false; if (temp != IsOpen) // used to prevent toggle event call if Close() is called multiple times { Toggled?.Invoke(IsOpen); } StateHasChanged(); }
protected void ClickHandler() { Click?.Invoke(); if (To == null) { Visible = !Visible; StateHasChanged(); Toggled?.Invoke(Visible); } }
public void Open() { // used to prevent toggle event call if Open() is called multiple times if (IsOpen) { return; } IsOpen = true; Toggled?.Invoke(IsOpen); StateHasChanged(); }
public void Close() { // used to prevent toggle event call if Close() is called multiple times if (!IsOpen) { return; } IsOpen = false; Toggled?.Invoke(IsOpen); StateHasChanged(); }
/// <summary> /// The MultilineCell's constructor. /// </summary> public MultilineCell() { Disappearing += (sender, e) => { Icon?.Cancel(); }; Tapped += (sender, e) => { IsChecked = !IsChecked; Toggled?.Invoke(this, new ToggledEventArgs((bool)IsChecked)); }; }
protected void ClickHandler() { Click?.Invoke(); if (To == null) { IsShow = !IsShow; StateHasChanged(); Toggled?.Invoke(IsShow); } }
public DrawerBox(EvasObject parent) : base(parent) { _drawerBox = new EBox(this); _drawerBox.SetAlignment(-1.0, -1.0); _drawerBox.SetWeight(1.0, 1.0); _drawerBox.Show(); _contentBox = new EBox(this); _contentBox.SetAlignment(-1.0, -1.0); _contentBox.SetWeight(1.0, 1.0); _contentBox.Show(); _dimArea = new EBox(this) { BackgroundColor = ThemeConstants.Shell.ColorClass.DefaultDrawerDimBackgroundColor, Opacity = ThemeConstants.Shell.Resources.DefaultDrawerDimOpacity }; _gestureOnDimArea = new GestureLayer(_dimArea); _gestureOnDimArea.SetTapCallback(GestureType.Tap, GestureLayer.GestureState.Start, OnTapped); _gestureOnDimArea.Attach(_dimArea); _splitPane = new Panes(this) { AlignmentX = -1, AlignmentY = -1, WeightX = 1, WeightY = 1, IsFixed = true, IsHorizontal = false, }; _panel = new Panel(this); _panel.SetScrollable(_isGestureEnabled); _panel.SetScrollableArea(1.0); _panel.Direction = PanelDirection.Left; _panel.Toggled += (object?sender, EventArgs e) => { if (_panel.IsOpen) { _dimArea.Show(); } Toggled?.Invoke(this, EventArgs.Empty); }; _mainWidget = _contentBox; ConfigureLayout(); SetLayoutCallback(OnLayout); }
protected override void OnMouseDown(MouseButtonEventArgs e) { base.OnMouseDown(e); if (IsToggleButton) { IsSelected = !IsSelected; Toggled?.Invoke(IsSelected); } OnClicked(); Clicked?.Invoke(this); Command?.Execute(CommandParameter); }
public async void Close(uint length = 300) { var toMove = _drawerBox.Geometry; toMove.Y = Geometry.Height - _iconHeight; await RunMoveAnimation(_drawerBox, toMove, length); if (_isOpen) { _isOpen = false; Toggled?.Invoke(this, EventArgs.Empty); } }