Esempio n. 1
0
        private void Button_MouseDown(object sender, MouseButtonEventArgs e)
        {
            if (Status == Models.ConnectionState.Protected)
            {
                SphereContainer.BeginStoryboard(this.FindResource("MakeDarkGreenColor") as Storyboard);
                return;
            }

            if (Status == Models.ConnectionState.Unprotected)
            {
                SphereContainer.BeginStoryboard(this.FindResource("MakeDarkGrayColor") as Storyboard);
                return;
            }

            if (Status == Models.ConnectionState.Connecting)
            {
                SphereContainer.BeginStoryboard(this.FindResource("MakeDarkGreenColor") as Storyboard);
                return;
            }

            if (Status == Models.ConnectionState.Disconnecting)
            {
                SphereContainer.BeginStoryboard(this.FindResource("MakeDarkGrayColor") as Storyboard);
                return;
            }
        }
Esempio n. 2
0
        private void AnimateOff(ButtonRefreshMode mode = ButtonRefreshMode.WithAnimation)
        {
            System.Windows.Thickness newThickness = SphereContainer.Margin;
            if (newThickness.Left == 5)
            {
                return;
            }

            newThickness.Left = 5;

            if (mode == ButtonRefreshMode.WithAnimation)
            {
                SphereContainer.BeginAnimation(Canvas.MarginProperty,
                                               new ThicknessAnimation(newThickness, TimeSpan.FromSeconds(0.15), System.Windows.Media.Animation.FillBehavior.HoldEnd)
                                               );
            }
            else
            {
                SphereContainer.Margin = newThickness;
            }

            SphereContainer.BeginStoryboard(this.FindResource("MakeGrayColor") as Storyboard);
            if (EnableWhiteSwitchBorder)
            {
                SwitchBorder.BorderBrush = this.FindResource("Grey/Grey 10") as Brush;
            }
        }