inital
This commit is contained in:
23
FasdDesktopUi/Pages/SplashScreenView/IntroView.xaml
Normal file
23
FasdDesktopUi/Pages/SplashScreenView/IntroView.xaml
Normal file
@@ -0,0 +1,23 @@
|
||||
<Window x:Class="FasdDesktopUi.Pages.SplashScreenView.IntroView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:FasdDesktopUi.Pages.SplashScreenView"
|
||||
mc:Ignorable="d"
|
||||
Title="IntroView"
|
||||
Height="450"
|
||||
Width="800"
|
||||
WindowState="Maximized"
|
||||
WindowStyle="None"
|
||||
Background="#426199"
|
||||
PreviewKeyDown="Window_PreviewKeyDown"
|
||||
IsVisibleChanged="Window_IsVisibleChanged">
|
||||
<Grid>
|
||||
<MediaElement x:Name="VideoPlayer"
|
||||
x:FieldModifier="private"
|
||||
Stretch="Fill"
|
||||
MediaEnded="videoPlayer_MediaEnded"
|
||||
LoadedBehavior="Manual"/>
|
||||
</Grid>
|
||||
</Window>
|
||||
66
FasdDesktopUi/Pages/SplashScreenView/IntroView.xaml.cs
Normal file
66
FasdDesktopUi/Pages/SplashScreenView/IntroView.xaml.cs
Normal file
@@ -0,0 +1,66 @@
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
|
||||
using C4IT.Logging;
|
||||
using C4IT.FASD.Cockpit.Communication;
|
||||
|
||||
using FasdCockpitCommunication;
|
||||
|
||||
using static C4IT.Logging.cLogManager;
|
||||
|
||||
namespace FasdDesktopUi.Pages.SplashScreenView
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for IntroView.xaml
|
||||
/// </summary>
|
||||
public partial class IntroView : Window
|
||||
{
|
||||
public const string IntroPath = "MediaContent/F4SD-Intro-001.mov";
|
||||
|
||||
public IntroView()
|
||||
{
|
||||
MethodBase CM = null; if (cLogManager.DefaultLogger.IsDebug) { CM = MethodBase.GetCurrentMethod(); LogMethodBegin(CM); }
|
||||
|
||||
try
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
var _mediaUri = cFasdCockpitCommunicationBase.Instance.GetMediaContentUri(IntroPath);
|
||||
if (_mediaUri != null)
|
||||
VideoPlayer.Source = _mediaUri;
|
||||
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (CM != null) LogMethodEnd(CM);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void videoPlayer_MediaEnded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
private void Window_PreviewKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Escape)
|
||||
Close();
|
||||
}
|
||||
|
||||
private void Window_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if (Visibility != Visibility.Visible)
|
||||
return;
|
||||
|
||||
VideoPlayer.Play();
|
||||
}
|
||||
}
|
||||
}
|
||||
98
FasdDesktopUi/Pages/SplashScreenView/SplashScreenView.xaml
Normal file
98
FasdDesktopUi/Pages/SplashScreenView/SplashScreenView.xaml
Normal file
@@ -0,0 +1,98 @@
|
||||
<Window x:Class="FasdDesktopUi.Pages.SplashScreenView.SplashScreenView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:FasdDesktopUi.Pages.SplashScreenView"
|
||||
xmlns:ico="clr-namespace:FasdDesktopUi.Basics.UserControls.AdaptableIcon;assembly=F4SD-AdaptableIcon"
|
||||
mc:Ignorable="d"
|
||||
Title="First Aid Service Desk"
|
||||
Height="240"
|
||||
Width="430"
|
||||
ResizeMode="NoResize"
|
||||
Topmost="True"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
WindowStyle="None"
|
||||
IsVisibleChanged="Window_IsVisibleChanged">
|
||||
|
||||
<Border Padding="12.5 7.5"
|
||||
Background="#234B92">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<ico:AdaptableIcon x:Name="MinimizeButton"
|
||||
Grid.Row="0"
|
||||
Grid.Column="2"
|
||||
PrimaryIconColor="White"
|
||||
HorizontalAlignment="Right"
|
||||
Cursor="Hand"
|
||||
MouseLeftButtonUp="MinimizeButton_MouseLeftButtonUp"
|
||||
TouchDown="MinimizeButton_TouchDown">
|
||||
<ico:AdaptableIcon.Resources>
|
||||
<Style TargetType="ico:AdaptableIcon">
|
||||
<Setter Property="Opacity"
|
||||
Value="1" />
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver"
|
||||
Value="True">
|
||||
<Setter Property="Opacity"
|
||||
Value="0.6" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</ico:AdaptableIcon.Resources>
|
||||
<ico:AdaptableIcon.SelectedInternIcon>
|
||||
window_minimize
|
||||
</ico:AdaptableIcon.SelectedInternIcon>
|
||||
</ico:AdaptableIcon>
|
||||
|
||||
<ico:AdaptableIcon Grid.Row="0"
|
||||
Grid.RowSpan="3"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="3"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
PrimaryIconColor="White"
|
||||
IconHeight="220"
|
||||
IconWidth="330"
|
||||
SelectedInternIcon="f4sd_product_logo"
|
||||
MouseLeftButtonDown="F4SDLogo_MouseLeftButtonDown"/>
|
||||
|
||||
<Image Source="pack://application:,,,/Resources/Consulting4ITWhite.png"
|
||||
Width="90"
|
||||
Grid.Row="2"
|
||||
Grid.Column="2" />
|
||||
|
||||
<StackPanel Orientation="Horizontal"
|
||||
Grid.Row="2"
|
||||
Grid.Column="0"
|
||||
VerticalAlignment="Bottom">
|
||||
<StackPanel.Resources>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="Foreground"
|
||||
Value="White" />
|
||||
<Setter Property="FontFamily"
|
||||
Value="Calibri" />
|
||||
<Setter Property="Opacity"
|
||||
Value="0.8" />
|
||||
</Style>
|
||||
</StackPanel.Resources>
|
||||
|
||||
<TextBlock x:Name="StatusTextBlock" />
|
||||
<TextBlock x:Name="LoadingDotBlock" />
|
||||
</StackPanel>
|
||||
|
||||
</Grid>
|
||||
</Border>
|
||||
</Window>
|
||||
|
||||
141
FasdDesktopUi/Pages/SplashScreenView/SplashScreenView.xaml.cs
Normal file
141
FasdDesktopUi/Pages/SplashScreenView/SplashScreenView.xaml.cs
Normal file
@@ -0,0 +1,141 @@
|
||||
using C4IT.FASD.Cockpit.Communication;
|
||||
using C4IT.Graphics;
|
||||
using C4IT.Logging;
|
||||
using FasdCockpitCommunication;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Net.Http;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Threading;
|
||||
using static C4IT.Logging.cLogManager;
|
||||
|
||||
namespace FasdDesktopUi.Pages.SplashScreenView
|
||||
{
|
||||
public partial class SplashScreenView : Window
|
||||
{
|
||||
private DispatcherTimer timer;
|
||||
private readonly IntroView _introView = new IntroView();
|
||||
|
||||
public SplashScreenView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public void SetStatusText(string text)
|
||||
{
|
||||
try
|
||||
{
|
||||
Dispatcher.Invoke(() => StatusTextBlock.Text = text);
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnInitialized(EventArgs e)
|
||||
{
|
||||
base.OnInitialized(e);
|
||||
timer = new DispatcherTimer(TimeSpan.FromSeconds(0.5), DispatcherPriority.Loaded, new EventHandler((sender, args) => UpdateLoadingDots()), Dispatcher.CurrentDispatcher);
|
||||
}
|
||||
|
||||
private void UpdateLoadingDots()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrEmpty(LoadingDotBlock.Text))
|
||||
LoadingDotBlock.Text = ".";
|
||||
else if (LoadingDotBlock.Text == ".")
|
||||
LoadingDotBlock.Text = "..";
|
||||
else if (LoadingDotBlock.Text == "..")
|
||||
LoadingDotBlock.Text = "...";
|
||||
else
|
||||
LoadingDotBlock.Text = string.Empty;
|
||||
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
}
|
||||
|
||||
private void Window_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!(e.NewValue is bool isVisible))
|
||||
return;
|
||||
|
||||
if (isVisible)
|
||||
timer?.Start();
|
||||
else
|
||||
timer?.Stop();
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
}
|
||||
|
||||
#region MinimizeButton_Click
|
||||
|
||||
private void MinimizeButton_Click()
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
(App.Current as App).notifyIcon.Visible = true;
|
||||
Close();
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
}
|
||||
|
||||
private void MinimizeButton_MouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||
{
|
||||
MinimizeButton_Click();
|
||||
}
|
||||
|
||||
private void MinimizeButton_TouchDown(object sender, System.Windows.Input.TouchEventArgs e)
|
||||
{
|
||||
MinimizeButton_Click();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void F4SDLogo_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
var communication = cFasdCockpitCommunicationBase.Instance;
|
||||
var serverUrl = cFasdCockpitMachineConfiguration.Instance?.ServerUrl;
|
||||
|
||||
if (communication?.IsDemo() == true || string.IsNullOrWhiteSpace(serverUrl) || !Uri.TryCreate(serverUrl, UriKind.Absolute, out var baseUri))
|
||||
{
|
||||
_introView.Show();
|
||||
Close();
|
||||
return;
|
||||
}
|
||||
|
||||
using (HttpClient http = new HttpClient() { BaseAddress = baseUri })
|
||||
{
|
||||
if (!http.GetAsync(IntroView.IntroPath).Result.IsSuccessStatusCode)
|
||||
return;
|
||||
}
|
||||
|
||||
_introView.Show();
|
||||
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogException(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user