コード例 #1
0
        private void ToggleAlarmSwitch_ValueChanged(object sender, EventArgs e)
        {
            var impactGenerator = new UIImpactFeedbackGenerator(UIImpactFeedbackStyle.Light);

            impactGenerator.ImpactOccurred();
            //if(ToggleAlarmSwitch.On)
            //{
            //    ToggleAlarmSwitch.ThumbTintColor = Colors.AlarmSwitchOnColor;
            //}
            //else
            //{
            //    ToggleAlarmSwitch.ThumbTintColor = Colors.AlarmSwitchOffColor;
            //}
            ToggleChanged?.Invoke(this, ToggleAlarmSwitch.On);
        }
コード例 #2
0
ファイル: toggle.cs プロジェクト: tweemine/tweemine
        private void button1_Click(object sender, EventArgs e)
        {
            button1.Visible          = true;
            button2.Visible          = true;
            ((Button)sender).Visible = false;
            string tag = ((Button)sender).Tag.ToString();

            bool buttonVal = bool.Parse(tag);

            state = buttonVal;
            if (buttonVal == true)
            {
                BackColor = Toggle1Color;
            }
            else
            {
                BackColor = Toggle2Color;
            }
            ToggleChanged?.Invoke(buttonVal);
        }
コード例 #3
0
        private void f_Toggled()
        {
            if (toggled)
            {
                rectBack.Fill = backgrOn;
                ellDot.Margin = positionOn;

                ellDot.Stroke   = thicknessOnBrush;
                rectBack.Stroke = thicknessOnBrush;
            }
            else
            {
                rectBack.Fill = backgrOff;
                ellDot.Margin = positionOff;

                ellDot.Stroke   = thicknessOffBrush;
                rectBack.Stroke = thicknessOffBrush;
            }
            ToggleChanged?.Invoke(this, EventArgs.Empty);
        }
コード例 #4
0
ファイル: ToggleBase.cs プロジェクト: ckjbug/VisualPlus
 protected virtual void OnToggleChanged(ToggleEventArgs e)
 {
     ToggleChanged?.Invoke(e);
 }
コード例 #5
0
        public RoomPlayerState(ClientManager clientManager, PlayerState playerState, bool readOnlyState) : this(new Builder("GameWindow.glade"))
        {
            ClientManager = clientManager ?? throw new ArgumentNullException(nameof(clientManager));
            PlayerState   = playerState ?? throw new ArgumentNullException(nameof(playerState));
            playerState.PropertyChanged += PlayerState_PropertyChanged;
            this.Destroyed  += new EventHandler((o, e) => { playerState.PropertyChanged -= PlayerState_PropertyChanged; });
            ReadOnlyState    = readOnlyState;
            _color.Color     = playerState.Color.ToGdkColor();
            _ready.Active    = playerState.Ready;
            _playerName.Text = playerState.Name;
            if (!readOnlyState)
            {
                _color.Sensitive = true;
                _ready.Sensitive = true;
                _color.ColorSet += new EventHandler((o, e) =>
                {
                    if (!toogleState)
                    {
                        var c = _color.Color;
                        if (PlayerState != null)
                        {
                            var sysColor               = c.ToSystemColor();
                            PlayerState.Color          = sysColor;
                            clientManager.Server.Color = sysColor;
                        }
                        ColorChanged?.Invoke(c);
                    }
                });
                _ready.Toggled += new EventHandler((o, e) =>
                {
                    if (!toogleState)
                    {
                        var a = _ready.Active;
                        if (PlayerState != null)
                        {
                            PlayerState.Ready            = a;
                            clientManager.Server.IsReady = a;
                        }
                        ToggleChanged?.Invoke(a);
                    }
                });
            }
            else
            {
                _ready.Toggled += new EventHandler((o, e) =>
                {
                    if (_ready.Active != PlayerState.Ready)
                    {
                        _ready.Active = PlayerState.Ready;
                    }
                });
                _color.ColorSet += new EventHandler((o, e) =>
                {
                    if (!toogleState)
                    {
                        var c1 = _color.Color;
                        var c2 = PlayerState.Color.ToGdkColor();

                        if (c1.Blue != c2.Blue || c1.Red != c2.Red || c1.Green != c2.Green)
                        {
                            _color.Color = c2;
                        }
                    }
                });
            }
        }
コード例 #6
0
ファイル: ToggleBase.cs プロジェクト: yzwbrian/VisualPlus
 /// <summary>Occurs when the ToggleChanged event fires.</summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The event args.</param>
 protected virtual void OnToggleChanged(object sender, ToggleEventArgs e)
 {
     ToggleChanged?.Invoke(sender, e);
 }