diff options
| author | Roy <Roy.mail.net@gmail.com> | 2023-05-09 16:10:17 +0300 |
|---|---|---|
| committer | Roy <Roy.mail.net@gmail.com> | 2023-05-09 16:10:17 +0300 |
| commit | af4e99d71390d050e321e4de3530b2774f84ba0c (patch) | |
| tree | e7af146405e3ca582870deb9481b8f8e037f7445 | |
| parent | 34a674da227985f0dc5b24d2f79cbcfe49a31b04 (diff) | |
| download | Tango-af4e99d71390d050e321e4de3530b2774f84ba0c.tar.gz Tango-af4e99d71390d050e321e4de3530b2774f84ba0c.zip | |
Added loading video on Eureka.
9 files changed, 49 insertions, 43 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Converters/BuildTypeToVisibilityConverter.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Converters/BuildTypeToVisibilityConverter.cs index e697c1c6a..a9b3ff8bc 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Converters/BuildTypeToVisibilityConverter.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Converters/BuildTypeToVisibilityConverter.cs @@ -15,7 +15,7 @@ namespace Tango.PPC.Common.Converters { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { - return (BuildType)value == (BuildType)parameter ? Visibility.Visible : Visibility.Collapsed; + return (BuildType)value == (BuildType)Enum.Parse(typeof(BuildType), parameter.ToStringSafe()) ? Visibility.Visible : Visibility.Collapsed; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Converters/BuildTypeToVisibilityInverseConverter.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Converters/BuildTypeToVisibilityInverseConverter.cs index a603a6d52..744d0d975 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Converters/BuildTypeToVisibilityInverseConverter.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Converters/BuildTypeToVisibilityInverseConverter.cs @@ -15,7 +15,7 @@ namespace Tango.PPC.Common.Converters { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { - return (BuildType)value == (BuildType)parameter ? Visibility.Collapsed : Visibility.Visible; + return (BuildType)value == (BuildType)Enum.Parse(typeof(BuildType), parameter.ToStringSafe()) ? Visibility.Collapsed : Visibility.Visible; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/Merged.xaml b/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/Merged.xaml index 5f8cabcca..da4e63b51 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/Merged.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/Merged.xaml @@ -72,8 +72,8 @@ <localConverter:EventTypeDescriptionConverter x:Key="EventTypeDescriptionConverter" /> <localConverter:EventTypeTitleConverter x:Key="EventTypeTitleConverter" /> <localConverter:IsEurekaToBooleanConverter x:Key="IsEurekaToBooleanConverter" /> - <localConverter:BuildTypeToVisibilityConverter x:Key="IsEurekaToVisibilityConverter" /> - <localConverter:BuildTypeToVisibilityInverseConverter x:Key="IsEurekaToVisibilityInverseConverter" /> + <localConverter:BuildTypeToVisibilityConverter x:Key="BuildTypeToVisibilityConverter" /> + <localConverter:BuildTypeToVisibilityInverseConverter x:Key="BuildTypeToVisibilityInverseConverter" /> <Style TargetType="FrameworkElement"> <Setter Property="TextElement.FontFamily" Value="{StaticResource TangoFlexoFontFamily}"></Setter> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Intro.wmv b/Software/Visual_Studio/PPC/Tango.PPC.UI/Intro.wmv Binary files differnew file mode 100644 index 000000000..7f4a8dd66 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Intro.wmv 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 7772c1f55..4e0671b57 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 @@ -130,6 +130,9 @@ <Reference Include="PresentationCore" /> <Reference Include="PresentationFramework" /> <Reference Include="WindowsFormsIntegration" /> + <Reference Include="WPFMediaKit, Version=2.2.0.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\..\packages\WPFMediaKit.2.2.0\lib\WPFMediaKit.dll</HintPath> + </Reference> </ItemGroup> <ItemGroup> <ApplicationDefinition Include="App.xaml"> @@ -607,6 +610,7 @@ <Resource Include="Images\Overview Icons\Waste.png" /> <Resource Include="Images\Overview Icons\Feeder4.png" /> <Resource Include="Manifests\eureka_debug.xml" /> + <Content Include="Intro.wmv" /> <Content Include="Manifests\release.xml" /> <Content Include="Manifests\debug.xml" /> <None Include="firmware_package.tfp"> @@ -615,7 +619,9 @@ <None Include="GetVersionTag.bat"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> - <None Include="packages.config" /> + <None Include="packages.config"> + <SubType>Designer</SubType> + </None> <None Include="Properties\Settings.settings"> <Generator>SettingsSingleFileGenerator</Generator> <LastGenOutput>Settings.Designer.cs</LastGenOutput> @@ -852,6 +858,7 @@ <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> </PropertyGroup> <Error Condition="!Exists('..\..\packages\System.Data.SQLite.Core.1.0.108.0\build\net46\System.Data.SQLite.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\System.Data.SQLite.Core.1.0.108.0\build\net46\System.Data.SQLite.Core.targets'))" /> + <Error Condition="!Exists('..\..\packages\WPFMediaKit.2.2.0\build\WPFMediaKit.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\WPFMediaKit.2.2.0\build\WPFMediaKit.targets'))" /> </Target> <PropertyGroup> <PostBuildEvent>RD /S /Q "$(TargetDir)cs\" @@ -929,7 +936,10 @@ if $(ConfigurationName) == Eureka del WebRtc.NET.pdb if $(ConfigurationName) == Debug copy /Y "$(TargetDir)Packages" "$(TargetDir)" -if $(ConfigurationName) == Debug "rc.exe" "$(TargetPath)" --set-version-string "Comments" "Debug Tag"</PostBuildEvent> +if $(ConfigurationName) == Debug "rc.exe" "$(TargetPath)" --set-version-string "Comments" "Debug Tag" + +if $(ConfigurationName) == Eureka_Debug copy /Y "$(ProjectDir)Intro.wmv" "$(TargetDir)" +if $(ConfigurationName) == Eureka copy /Y "$(ProjectDir)Intro.wmv" "$(TargetDir)"</PostBuildEvent> </PropertyGroup> <PropertyGroup> <PreBuildEvent>copy /Y "$(ProjectDir)Manifests\$(ConfigurationName).xml" "$(ProjectDir)app.manifest" @@ -940,4 +950,5 @@ if $(ConfigurationName) == Debug "rc.exe" "$(TargetPath)" --set-version-string " <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> </VisualStudio> </ProjectExtensions> + <Import Project="..\..\packages\WPFMediaKit.2.2.0\build\WPFMediaKit.targets" Condition="Exists('..\..\packages\WPFMediaKit.2.2.0\build\WPFMediaKit.targets')" /> </Project>
\ No newline at end of file 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 ec316989f..07b58e55f 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoginViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoginViewVM.cs @@ -13,6 +13,7 @@ using Tango.PPC.Common.Authentication; using Tango.BL.Entities; using Tango.BL.Enumerations; using Tango.Logging; +using Tango.PPC.UI.Views; namespace Tango.PPC.UI.ViewModels { @@ -95,6 +96,14 @@ namespace Tango.PPC.UI.ViewModels if (!AuthenticationProvider.AuthenticationRequired) { LogManager.Log("Application is ready! Navigating to home module..."); + + if (BuildProvider.IsEureka) + { + var secondsPassed = (DateTime.Now - LoadingView.VideoStartTime).TotalSeconds; + var secondsToHold = Math.Max(10 - secondsPassed, 0); + await Task.Delay(TimeSpan.FromSeconds(secondsToHold)); + } + await NavigationManager.NavigateTo(NavigationView.HomeModule); IsLoading = false; } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LoadingView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LoadingView.xaml index 146d4b50d..3ed91e5db 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LoadingView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LoadingView.xaml @@ -9,47 +9,16 @@ xmlns:global="clr-namespace:Tango.PPC.UI" xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" xmlns:local="clr-namespace:Tango.PPC.UI.Views" + xmlns:mediaKit="clr-namespace:WPFMediaKit.DirectShow.Controls;assembly=WPFMediaKit" mc:Ignorable="d" d:DesignHeight="1280" d:DesignWidth="800" Background="{StaticResource TangoPrimaryBackgroundBrush}" d:DataContext="{d:DesignInstance Type=vm:LoadingViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.LoadingView}"> <Grid> - <StackPanel HorizontalAlignment="Center"> - <!--<Image gif:ImageBehavior.EnableAnimation="{Binding IsLoading}" gif:ImageBehavior.AnimatedSource="/Images/Twine_Loading_GIF.gif" Margin="100 100 100 0" RenderTransformOrigin="0.5,0.5" RenderOptions.BitmapScalingMode="Fant" Height="382"> - <Image.Style> - <Style TargetType="Image"> - <Setter Property="RenderTransform"> - <Setter.Value> - <ScaleTransform ScaleX="1" ScaleY="1" /> - </Setter.Value> - </Setter> - <Setter Property="Effect"> - <Setter.Value> - <fx:DisplaySettingEffect SaturationLevel="0" /> - </Setter.Value> - </Setter> - <Style.Triggers> - <DataTrigger Binding="{Binding IsLoading}" Value="True"> - <DataTrigger.EnterActions> - <BeginStoryboard> - <Storyboard> - <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleY" Duration="00:00:1" To="1.010" AutoReverse="True" RepeatBehavior="10x" /> - <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleX" Duration="00:00:1" To="1.010" AutoReverse="True" RepeatBehavior="10x" /> - <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Effect.SaturationLevel" Duration="00:00:3" AutoReverse="True" RepeatBehavior="3x"> - <LinearDoubleKeyFrame KeyTime="00:00:00" Value="0" /> - <LinearDoubleKeyFrame KeyTime="00:00:2" Value="1" /> - <LinearDoubleKeyFrame KeyTime="00:00:3" Value="6" /> - </DoubleAnimationUsingKeyFrames> - </Storyboard> - </BeginStoryboard> - </DataTrigger.EnterActions> - </DataTrigger> - </Style.Triggers> - </Style> - </Image.Style> - </Image>--> - + <Grid x:Name="videoPlayerGrid" Visibility="{Binding BuildProvider.BuildType,Converter={StaticResource BuildTypeToVisibilityConverter},ConverterParameter='Eureka'}"> + <mediaKit:MediaUriElement x:Name="videoPlayer" Stretch="Uniform" LoadedBehavior="Manual" /> + </Grid> + <StackPanel HorizontalAlignment="Center" Visibility="{Binding BuildProvider.BuildType,Converter={StaticResource BuildTypeToVisibilityConverter},ConverterParameter='TS1800'}"> + <Grid Margin="0 0 0 0"> - <!--<Image Source="/Images/machine.png" Stretch="Uniform" Width="250" RenderOptions.BitmapScalingMode="Fant"></Image> - <touch:TouchBusyIndicator Width="350" Height="350" IsIndeterminate="{Binding IsLoading}" />--> <touch:TouchGifAnimation Source="/Images/loading_anim2.gif" EnableAnimation="{Binding IsLoading}" Margin="0 200 0 0" /> </Grid> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LoadingView.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LoadingView.xaml.cs index a1214a0df..4616ea438 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LoadingView.xaml.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LoadingView.xaml.cs @@ -12,6 +12,9 @@ using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; +using Tango.Core.DI; +using Tango.PPC.Common.Application; +using Tango.PPC.Common.Build; namespace Tango.PPC.UI.Views { @@ -20,9 +23,22 @@ namespace Tango.PPC.UI.Views /// </summary> public partial class LoadingView : UserControl { + public static DateTime VideoStartTime { get; set; } + public LoadingView() { InitializeComponent(); + + var buildProvider = TangoIOC.Default.GetInstance<IBuildProvider>(); + var appManager = TangoIOC.Default.GetInstance<IPPCApplicationManager>(); + + if (buildProvider.IsEureka) + { + VideoStartTime = DateTime.Now; + videoPlayer.Source = new Uri(appManager.StartPath + "\\Intro.wmv", UriKind.Absolute); + videoPlayer.MediaOpened += (_, __) => VideoStartTime = DateTime.Now; + videoPlayer.Play(); + } } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/packages.config b/Software/Visual_Studio/PPC/Tango.PPC.UI/packages.config index ec7ec1e3a..9e3e48198 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/packages.config +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/packages.config @@ -11,4 +11,5 @@ <package id="System.Data.SQLite.Core" version="1.0.108.0" targetFramework="net46" /> <package id="System.Data.SQLite.EF6" version="1.0.108.0" targetFramework="net46" /> <package id="System.Data.SQLite.Linq" version="1.0.108.0" targetFramework="net46" /> + <package id="WPFMediaKit" version="2.2.0" targetFramework="net461" /> </packages>
\ No newline at end of file |
