public MainWindow() { InitializeComponent(); logoPanel.Height = 530; FormPanel.Visibility = Visibility.Hidden; ThicknessAnimation myThicknessAnimation = new ThicknessAnimation(); myThicknessAnimation.Duration = TimeSpan.FromSeconds(1.0); myThicknessAnimation.FillBehavior = FillBehavior.HoldEnd; myThicknessAnimation.From = new Thickness(102, 172, 0, 0); myThicknessAnimation.To = new Thickness(102, 10, 0, 0); LogoImage.BeginAnimation(Image.MarginProperty, myThicknessAnimation); FormPanel.Visibility = Visibility.Visible; }
private void UpdateUiForConnectButtonClick() { //if prev was on if (_prevConnectionState) { //turn off //update button text ConnectButton.Content = "Connect"; //disable message entry MessageTextBox.IsEnabled = false; SendMessageButton.IsEnabled = false; StopButton.IsEnabled = false; //disable server and port text boxes ServerTextBox.IsEnabled = true; PortTextBox.IsEnabled = true; //create animations var ledBlurRadiusAnimation = new DoubleAnimation(LedBlurRadius, 0, TimeSpan.FromSeconds(LightToggleAnimLength)); var logoImageBlurRadiusAnimation = new DoubleAnimation(LogoBlurRadius, 0, TimeSpan.FromSeconds(LightToggleAnimLength)); var ledOpacityAnimation = new DoubleAnimation(LedOnOpacity, LedOffOpacity, TimeSpan.FromSeconds(LightToggleAnimLength)); var logoOpacityAnimation = new DoubleAnimation(LogoOnOpacity, LogoOffOpacity, TimeSpan.FromSeconds(LightToggleAnimLength)); //start animations _ledBlurEffect.BeginAnimation(BlurEffect.RadiusProperty, ledBlurRadiusAnimation); _logoBlurEffect.BeginAnimation(BlurEffect.RadiusProperty, logoImageBlurRadiusAnimation); ConnectionStatusLedImage.BeginAnimation(OpacityProperty, ledOpacityAnimation); LogoImageBlurLayer.BeginAnimation(OpacityProperty, logoOpacityAnimation); LogoImage.BeginAnimation(OpacityProperty, logoOpacityAnimation); } else { //else turn on // update button text ConnectButton.Content = "Disconnect"; //enable message entry MessageTextBox.IsEnabled = true; SendMessageButton.IsEnabled = true; StopButton.IsEnabled = true; //enable server and port text boxes ServerTextBox.IsEnabled = false; PortTextBox.IsEnabled = false; //create animations var ledBlurRadiusAnimation = new DoubleAnimation(0, LedBlurRadius, TimeSpan.FromSeconds(LightToggleAnimLength)); var logoImageBlurRadiusAnimation = new DoubleAnimation(0, LogoBlurRadius, TimeSpan.FromSeconds(LightToggleAnimLength)); var ledOpacityAnimation = new DoubleAnimation(LedOffOpacity, LedOnOpacity, TimeSpan.FromSeconds(LightToggleAnimLength)); var logoOpacityAnimation = new DoubleAnimation(LogoOffOpacity, LogoOnOpacity, TimeSpan.FromSeconds(LightToggleAnimLength)); //start animations _ledBlurEffect.BeginAnimation(BlurEffect.RadiusProperty, ledBlurRadiusAnimation); _logoBlurEffect.BeginAnimation(BlurEffect.RadiusProperty, logoImageBlurRadiusAnimation); ConnectionStatusLedImage.BeginAnimation(OpacityProperty, ledOpacityAnimation); LogoImageBlurLayer.BeginAnimation(OpacityProperty, logoOpacityAnimation); LogoImage.BeginAnimation(OpacityProperty, logoOpacityAnimation); } }