diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2018-07-08 09:45:46 +0300 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2018-07-08 09:45:46 +0300 |
| commit | a2cf6c8d62083a63ee193a1cd206ab345368b242 (patch) | |
| tree | 4f653018e4fb5b4ad806e9d410800489afe411e5 /Software/Visual_Studio/PPC/Tango.PPC.UI | |
| parent | c8807df7010acb129997cb7ca130e6b7928ce809 (diff) | |
| parent | f4688d6113dc33deac114bd6999967fec246b8c0 (diff) | |
| download | Tango-a2cf6c8d62083a63ee193a1cd206ab345368b242.tar.gz Tango-a2cf6c8d62083a63ee193a1cd206ab345368b242.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI')
7 files changed, 116 insertions, 4 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/HeaderLoadingControl.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/HeaderLoadingControl.xaml new file mode 100644 index 000000000..5b07e1fa2 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/HeaderLoadingControl.xaml @@ -0,0 +1,16 @@ +<UserControl x:Class="Tango.PPC.UI.Controls.HeaderLoadingControl" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:local="clr-namespace:Tango.PPC.UI.Controls" + mc:Ignorable="d" + d:DesignHeight="80" d:DesignWidth="300" IsHitTestVisible="False"> + <Grid> + <StackPanel Orientation="Horizontal" Margin="20 0 0 0"> + <touch:TouchBusyIndicator IsIndeterminate="True" Width="50" Height="50" /> + <TextBlock VerticalAlignment="Center" Margin="10 0 0 0">Loading...</TextBlock> + </StackPanel> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/HeaderLoadingControl.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/HeaderLoadingControl.xaml.cs new file mode 100644 index 000000000..540e829c9 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/HeaderLoadingControl.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.PPC.UI.Controls +{ + /// <summary> + /// Interaction logic for HeaderLoadingControl.xaml + /// </summary> + public partial class HeaderLoadingControl : UserControl + { + public HeaderLoadingControl() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs index ae777839b..aaa5a9cf3 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs @@ -386,5 +386,40 @@ namespace Tango.PPC.UI.Notifications { return ShowDialog<T>(Activator.CreateInstance<T>()); } + + /// <summary> + /// Sets the global busy message. + /// </summary> + /// <param name="message">The message.</param> + public void SetGlobalBusyMessage(string message) + { + GlobalBusyMessage = message; + IsInGlobalBusyState = true; + + RaisePropertyChanged(nameof(IsInGlobalBusyState)); + RaisePropertyChanged(nameof(GlobalBusyMessage)); + } + + /// <summary> + /// Releases the global busy message. + /// </summary> + public void ReleaseGlobalBusyMessage() + { + GlobalBusyMessage = null; + IsInGlobalBusyState = false; + + RaisePropertyChanged(nameof(IsInGlobalBusyState)); + RaisePropertyChanged(nameof(GlobalBusyMessage)); + } + + /// <summary> + /// Gets the current global busy message. + /// </summary> + public string GlobalBusyMessage { get; private set; } + + /// <summary> + /// Gets a value indicating whether this instance is in global busy state. + /// </summary> + public bool IsInGlobalBusyState { get; private set; } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj index d2763510a..eaf53b993 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj @@ -101,6 +101,7 @@ <Reference Include="WindowsBase" /> <Reference Include="PresentationCore" /> <Reference Include="PresentationFramework" /> + <Reference Include="WindowsFormsIntegration" /> </ItemGroup> <ItemGroup> <ApplicationDefinition Include="App.xaml"> @@ -111,6 +112,9 @@ <Link>PPC.cs</Link> </Compile> <Compile Include="Authentication\DefaultAuthenticationProvider.cs" /> + <Compile Include="Controls\HeaderLoadingControl.xaml.cs"> + <DependentUpon>HeaderLoadingControl.xaml</DependentUpon> + </Compile> <Compile Include="Converters\NotificationItemConverter.cs" /> <Compile Include="Modules\DefaultStudioModuleLoader.cs" /> <Compile Include="Navigation\DefaultNavigationManager.cs" /> @@ -140,6 +144,10 @@ <Compile Include="Views\MainView.xaml.cs"> <DependentUpon>MainView.xaml</DependentUpon> </Compile> + <Page Include="Controls\HeaderLoadingControl.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> <Page Include="MainWindow.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoginViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoginViewVM.cs index 6107a906d..293435d0b 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoginViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoginViewVM.cs @@ -56,9 +56,10 @@ namespace Tango.PPC.UI.ViewModels NotificationProvider.ShowWarning("Email or password are incorrect."); } - ApplicationManager.ModulesInitialized += (_, __) => + ApplicationManager.ModulesInitialized += async (_, __) => { - NavigationManager.NavigateTo(NavigationView.HomeModule); + await Task.Delay(500); + await NavigationManager.NavigateTo(NavigationView.HomeModule); }; } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml index 78d040d27..7d170d04f 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml @@ -4,12 +4,14 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Tango.PPC.UI.Views" + xmlns:localControls="clr-namespace:Tango.PPC.UI.Controls" xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:fa="http://schemas.fontawesome.io/icons/" xmlns:vm="clr-namespace:Tango.PPC.UI.ViewModels" xmlns:global="clr-namespace:Tango.PPC.UI" xmlns:localConverters="clr-namespace:Tango.PPC.UI.Converters" xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:commonControls="clr-namespace:Tango.PPC.Common.Controls;assembly=Tango.PPC.Common" xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" xmlns:keyboard="clr-namespace:Tango.Touch.Keyboard;assembly=Tango.Touch" mc:Ignorable="d" @@ -110,12 +112,34 @@ </Grid> <Grid> <!--External Header Content Here--> + <commonControls:AsyncAdornerControl> + <commonControls:AsyncAdornerControl.Style> + <Style TargetType="commonControls:AsyncAdornerControl"> + <Setter Property="Visibility" Value="Hidden"></Setter> + <Style.Triggers> + <MultiDataTrigger> + <MultiDataTrigger.Conditions> + <Condition Binding="{Binding NotificationProvider.IsInGlobalBusyState}" Value="True" /> + <Condition Binding="{Binding IsMenuOpened}" Value="False" /> + </MultiDataTrigger.Conditions> + <Setter Property="Visibility" Value="Visible"></Setter> + </MultiDataTrigger> + </Style.Triggers> + </Style> + </commonControls:AsyncAdornerControl.Style> + <Grid> + <StackPanel Orientation="Horizontal"> + <touch:TouchBusyIndicator Width="50" Height="50" IsIndeterminate="True" /> + <TextBlock VerticalAlignment="Center" Margin="10 0 0 0" FontSize="20" Text="{Binding NotificationProvider.GlobalBusyMessage}"></TextBlock> + </StackPanel> + </Grid> + </commonControls:AsyncAdornerControl> </Grid> </DockPanel> </Border> <Grid Background="{StaticResource TangoKeyboardBackground}"> - <controls:NavigationControl x:Name="NavigationControl" x:FieldModifier="public" TransitionAlwaysFades="False" TransitionType="Zoom"> + <controls:NavigationControl x:Name="NavigationControl" x:FieldModifier="public" TransitionAlwaysFades="False" TransitionType="Zoom" KeepElementsAttached="True"> <!--MODULES GOES HERE--> </controls:NavigationControl> </Grid> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LoginView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LoginView.xaml index b6f6f4432..6fbf713e9 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LoginView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LoginView.xaml @@ -21,7 +21,7 @@ <touch:TouchCheckBox Margin="0 30 0 0">Keep me logged in.</touch:TouchCheckBox> - <touch:TouchButton Height="60" Margin="0 30 0 0" CornerRadius="3" IsDefault="True" Command="{Binding LoginCommand}">LOGIN</touch:TouchButton> + <touch:TouchButton Height="60" Margin="0 30 0 0" CornerRadius="3" IsDefault="True" DelayCommand="{Binding LoginCommand}" DelayCommandDuration="00:00:0.2">LOGIN</touch:TouchButton> <TextBlock HorizontalAlignment="Center" Margin="0 20 0 0">Forgot password?</TextBlock> </StackPanel> |
