Animationen
This commit is contained in:
@@ -120,6 +120,10 @@
|
||||
<Compile Include="View\Windows\AnimatedBeWoWindow.xaml.cs">
|
||||
<DependentUpon>AnimatedBeWoWindow.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Page Include="Styles\ControlStyles\PopupStyles.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="View\Core\WaitLayer3.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
||||
31
BeWo/Styles/ControlStyles/PopupStyles.xaml
Normal file
31
BeWo/Styles/ControlStyles/PopupStyles.xaml
Normal file
@@ -0,0 +1,31 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<!-- Eine Ease-Out-Funktion für eine sanfte Bewegung -->
|
||||
<QuadraticEase x:Key="EaseOut" EasingMode="EaseOut" />
|
||||
|
||||
<Storyboard x:Key="PopupLoadedAnimation">
|
||||
<DoubleAnimation
|
||||
Storyboard.TargetProperty="Opacity"
|
||||
From="0"
|
||||
To="1"
|
||||
Duration="0:0:0.1" />
|
||||
<DoubleAnimation
|
||||
EasingFunction="{StaticResource EaseOut}"
|
||||
Storyboard.TargetProperty="RenderTransform.(TranslateTransform.Y)"
|
||||
From="50"
|
||||
To="0"
|
||||
Duration="0:0:0.1" />
|
||||
</Storyboard>
|
||||
<Storyboard x:Key="PopupClosingAnimation">
|
||||
<DoubleAnimation
|
||||
Storyboard.TargetProperty="Opacity"
|
||||
From="1"
|
||||
To="0"
|
||||
Duration="0:0:0.1" />
|
||||
<DoubleAnimation
|
||||
EasingFunction="{StaticResource EaseOut}"
|
||||
Storyboard.TargetProperty="RenderTransform.(TranslateTransform.Y)"
|
||||
From="0"
|
||||
To="50"
|
||||
Duration="0:0:0.1" />
|
||||
</Storyboard>
|
||||
</ResourceDictionary>
|
||||
@@ -20,6 +20,7 @@
|
||||
<ResourceDictionary Source="ControlStyles\GroupBoxStyles.xaml" />
|
||||
<ResourceDictionary Source="ControlStyles\LabelStyles.xaml" />
|
||||
<ResourceDictionary Source="ControlStyles\ListBoxStyles.xaml" />
|
||||
<ResourceDictionary Source="ControlStyles\PopupStyles.xaml" />
|
||||
<ResourceDictionary Source="ControlStyles\RadioButtonStyles.xaml" />
|
||||
<ResourceDictionary Source="ControlStyles\TextBoxStyles.xaml" />
|
||||
<ResourceDictionary Source="ControlStyles\TextEditStyles.xaml" />
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:BeWo.View.Core"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:view="clr-namespace:BeWo.ViewModel.View"
|
||||
d:DataContext="{d:DesignInstance Type=view:WindowViewModel,
|
||||
IsDesignTimeCreatable=True}"
|
||||
mc:Ignorable="d">
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
@@ -41,14 +44,23 @@
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<Border
|
||||
Padding="40"
|
||||
Background="#FF252526"
|
||||
MinWidth="250"
|
||||
Padding="20"
|
||||
Background="#FFFFFFFF"
|
||||
BorderBrush="#FF606060"
|
||||
BorderThickness="1"
|
||||
CornerRadius="12">
|
||||
<Border.OpacityMask>
|
||||
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
|
||||
<GradientStop Offset="0.027" Color="#F3FFFFFF" />
|
||||
<GradientStop Offset="1" Color="#D7FFFFFF" />
|
||||
</LinearGradientBrush>
|
||||
</Border.OpacityMask>
|
||||
<StackPanel>
|
||||
<Canvas
|
||||
Width="80"
|
||||
Height="40"
|
||||
Margin="0,0,0,20">
|
||||
Margin="4">
|
||||
<Ellipse
|
||||
x:Name="Dot1"
|
||||
Canvas.Left="10"
|
||||
@@ -77,9 +89,12 @@
|
||||
</Canvas.Triggers>
|
||||
</Canvas>
|
||||
<TextBlock
|
||||
Margin="3,13,3,3"
|
||||
HorizontalAlignment="Center"
|
||||
FontSize="14"
|
||||
Foreground="White"
|
||||
FontFamily="Microsoft Sans Serif"
|
||||
FontSize="12"
|
||||
FontWeight="Normal"
|
||||
Foreground="#FF000000"
|
||||
Text="{Binding WaitingText}" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:core="clr-namespace:BeWo.View.Core"
|
||||
xmlns:view="clr-namespace:BeWo.ViewModel.View"
|
||||
Title="BeWoPlaner"
|
||||
MinWidth="300"
|
||||
MinHeight="300"
|
||||
@@ -15,6 +16,9 @@
|
||||
TextOptions.TextFormattingMode="Display"
|
||||
WindowStartupLocation="CenterOwner"
|
||||
WindowStyle="None">
|
||||
<Window.DataContext>
|
||||
<view:WindowViewModel />
|
||||
</Window.DataContext>
|
||||
<Window.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
@@ -38,12 +42,11 @@
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
Panel.ZIndex="1000"
|
||||
Background="#40FFFFFF"
|
||||
Focusable="True"
|
||||
IsHitTestVisible="True"
|
||||
KeyboardNavigation.IsTabStop="True"
|
||||
Visibility="{Binding IsWaiting, Converter={StaticResource BoolVisibilityConverter}}"
|
||||
Background="#80000000">
|
||||
|
||||
Visibility="{Binding IsWaiting, Converter={StaticResource BoolVisibilityConverter}}">
|
||||
<core:WaitLayer3 HorizontalAlignment="Center" VerticalAlignment="Center" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
using BeWo.ViewModel.View;
|
||||
using DevExpress.Web.Internal.XmlProcessor;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
@@ -24,8 +26,9 @@ namespace BeWo.View.Windows
|
||||
/// </summary>
|
||||
public partial class AnimatedBeWoWindow : Window
|
||||
{
|
||||
|
||||
private bool closeStoryBoardCompleted = false;
|
||||
private bool closePopupStoryBoardCompleted = false;
|
||||
private bool openPopupStoryBoardCompleted = false;
|
||||
private bool isClosing = false;
|
||||
private WaitLayer2 _WaitLayer;
|
||||
|
||||
@@ -50,8 +53,6 @@ namespace BeWo.View.Windows
|
||||
|
||||
public AnimatedBeWoWindow()
|
||||
{
|
||||
ViewModel = new WindowViewModel();
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
CommandBindings.Add(new CommandBinding(ApplicationCommands.Close, (s, e) => Close()));
|
||||
@@ -161,7 +162,33 @@ namespace BeWo.View.Windows
|
||||
|
||||
public void StartWaiting()
|
||||
{
|
||||
Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action)StartWaitingImmediately);
|
||||
if (openPopupStoryBoardCompleted)
|
||||
return;
|
||||
|
||||
Dispatcher.BeginInvoke(DispatcherPriority.Render, (Action)delegate
|
||||
{
|
||||
if (FindResource("PopupLoadedAnimation") is Storyboard storyboard)
|
||||
{
|
||||
openPopupStoryBoardCompleted = true;
|
||||
StartWaitingImmediately();
|
||||
storyboard.Completed += openPopupStoryBoard_Completed;
|
||||
Storyboard.SetTarget(storyboard.Children[0], _WaitingLayer);
|
||||
Storyboard.SetTarget(storyboard.Children[1], _WaitingLayer);
|
||||
storyboard.Begin();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new InvalidOperationException("PopupLoadedAnimation not found");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void openPopupStoryBoard_Completed(object sender, EventArgs e)
|
||||
{
|
||||
if (!openPopupStoryBoardCompleted)
|
||||
return;
|
||||
|
||||
openPopupStoryBoardCompleted = false;
|
||||
}
|
||||
|
||||
public void StartWaitingImmediately()
|
||||
@@ -173,12 +200,38 @@ namespace BeWo.View.Windows
|
||||
|
||||
public void EndWaiting()
|
||||
{
|
||||
Dispatcher.BeginInvoke(
|
||||
DispatcherPriority.Render,
|
||||
(Action)delegate
|
||||
if (closePopupStoryBoardCompleted)
|
||||
return;
|
||||
|
||||
Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action)delegate
|
||||
{
|
||||
if (FindResource("PopupClosingAnimation") is Storyboard storyboard)
|
||||
{
|
||||
ViewModel.IsWaiting = false;
|
||||
});
|
||||
closePopupStoryBoardCompleted = true;
|
||||
storyboard.Completed += closePopupStoryBoard_Completed;
|
||||
Storyboard.SetTarget(storyboard.Children[0], _WaitingLayer);
|
||||
Storyboard.SetTarget(storyboard.Children[1], _WaitingLayer);
|
||||
storyboard.Begin();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new InvalidOperationException("PopupClosingAnimation not found");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void closePopupStoryBoard_Completed(object sender, EventArgs e)
|
||||
{
|
||||
if (!closePopupStoryBoardCompleted)
|
||||
return;
|
||||
|
||||
closePopupStoryBoardCompleted = false;
|
||||
Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action)EndWaitingImmediately);
|
||||
}
|
||||
|
||||
public void EndWaitingImmediately()
|
||||
{
|
||||
ViewModel.IsWaiting = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,9 @@ namespace BeWo.ViewModel.View
|
||||
public WindowViewModel()
|
||||
{
|
||||
WaitingText = "Bitte warten...";
|
||||
|
||||
if(BeWoApp.IsInDesignMode)
|
||||
IsWaiting = true;
|
||||
}
|
||||
|
||||
public bool IsWaiting
|
||||
|
||||
Reference in New Issue
Block a user