aboutsummaryrefslogtreecommitdiffstats
path: root/Software
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2020-06-18 18:32:59 +0300
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2020-06-18 18:32:59 +0300
commit7344b90fcaa64759114e66cd9645f9e8ea4e073a (patch)
treee2bcd146fcf9b314ce77d13b79073853adde1665 /Software
parent920fe3a098f304b6c65e1c37447138f0699ec70c (diff)
downloadTango-7344b90fcaa64759114e66cd9645f9e8ea4e073a.tar.gz
Tango-7344b90fcaa64759114e66cd9645f9e8ea4e073a.zip
Demo Mode.
Diffstat (limited to 'Software')
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.Common/Connection/IMachineProvider.cs2
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.Common/DemoMode/DemoModeCommand.cs26
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.Common/DemoMode/IDemoModeManager.cs16
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.Common/FSEApplication/IFSEApplicationManager.cs5
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.Common/FSEViewModel.cs7
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.Common/INotifyApplicationReady.cs20
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.Common/INotifyApplicationStarted.cs8
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.Common/Notifications/INotificationProvider.cs2
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.Common/Tango.FSE.Common.csproj3
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.Common/Tiles/IDashboardManager.cs2
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.Common/Updates/IUpdatesManager.cs2
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.UI/Connection/DefaultMachineProvider.cs13
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.UI/DemoMode/DefaultDemoModeManager.cs25
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.UI/DemoMode/DemoModeWindow.xaml47
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.UI/DemoMode/DemoModeWindow.xaml.cs28
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.UI/DemoMode/DemoModeWindowVM.cs14
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.UI/FSEApplication/DefaultFSEApplicationManager.cs17
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.UI/MainWindow.xaml.cs10
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.UI/Notifications/DefaultNotificationProvider.cs93
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.UI/RemoteJob/DefaultRemoteJobProvider.cs8
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.UI/Tango.FSE.UI.csproj9
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.UI/Tiles/DefaultDashboardManager.cs5
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.UI/Updates/DefaultUpdatesManager.cs10
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.UI/ViewModelLocator.cs13
24 files changed, 345 insertions, 40 deletions
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Connection/IMachineProvider.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/Connection/IMachineProvider.cs
index 14dbe2f99..4d552d856 100644
--- a/Software/Visual_Studio/FSE/Tango.FSE.Common/Connection/IMachineProvider.cs
+++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Connection/IMachineProvider.cs
@@ -13,7 +13,7 @@ namespace Tango.FSE.Common.Connection
/// <summary>
/// Represents the machine connection provider.
/// </summary>
- public interface IMachineProvider : INotifyApplicationStarted
+ public interface IMachineProvider : INotifyApplicationReady
{
/// <summary>
/// Occurs when machine operator has connected.
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/DemoMode/DemoModeCommand.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/DemoMode/DemoModeCommand.cs
new file mode 100644
index 000000000..abb7b25e6
--- /dev/null
+++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/DemoMode/DemoModeCommand.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.Core.Commands;
+
+namespace Tango.FSE.Common.DemoMode
+{
+ public class DemoModeCommand
+ {
+ public String Name { get; set; }
+ public String Description { get; set; }
+ public RelayCommand Command { get; set; }
+
+ public static DemoModeCommand Create(Action action, String name, String description)
+ {
+ return new DemoModeCommand()
+ {
+ Command = new RelayCommand(action),
+ Name = name,
+ Description = description
+ };
+ }
+ }
+}
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/DemoMode/IDemoModeManager.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/DemoMode/IDemoModeManager.cs
new file mode 100644
index 000000000..b5afd9c1b
--- /dev/null
+++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/DemoMode/IDemoModeManager.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.FSE.Common.DemoMode
+{
+ public interface IDemoModeManager
+ {
+ ObservableCollection<DemoModeCommand> DemoCommands { get; }
+
+ void InsertCommand(Action action, String name, String description);
+ }
+}
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/FSEApplication/IFSEApplicationManager.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/FSEApplication/IFSEApplicationManager.cs
index bbfc618a3..c3f54d0e2 100644
--- a/Software/Visual_Studio/FSE/Tango.FSE.Common/FSEApplication/IFSEApplicationManager.cs
+++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/FSEApplication/IFSEApplicationManager.cs
@@ -97,5 +97,10 @@ namespace Tango.FSE.Common.FSEApplication
/// Gets or sets the state of the application main window.
/// </summary>
WindowState WindowState { get; set; }
+
+ /// <summary>
+ /// Gets a value indicating whether the application is currently running in demo mode.
+ /// </summary>
+ bool DemoMode { get; }
}
}
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/FSEViewModel.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/FSEViewModel.cs
index 4299e6b82..7dcfcb3c8 100644
--- a/Software/Visual_Studio/FSE/Tango.FSE.Common/FSEViewModel.cs
+++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/FSEViewModel.cs
@@ -42,6 +42,7 @@ using Tango.FSE.Common.Events;
using Tango.FSE.Common.Tiles;
using Tango.FSE.Common.RemoteJob;
using Tango.FSE.Common.WindowsManager;
+using Tango.FSE.Common.DemoMode;
namespace Tango.FSE.Common
{
@@ -222,6 +223,12 @@ namespace Tango.FSE.Common
public IWindowsManager WindowsManager { get; set; }
/// <summary>
+ /// Gets or sets the demo mode manager.
+ /// </summary>
+ [TangoInject]
+ public IDemoModeManager DemoModeManager { get; set; }
+
+ /// <summary>
/// Gets or sets the FSE service.
/// </summary>
[TangoInject]
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/INotifyApplicationReady.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/INotifyApplicationReady.cs
new file mode 100644
index 000000000..00858f070
--- /dev/null
+++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/INotifyApplicationReady.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.FSE.Common.FSEApplication;
+
+namespace Tango.FSE.Common
+{
+ /// <summary>
+ /// Represents an object that supports receiving application started/ready from the application manager.
+ /// </summary>
+ public interface INotifyApplicationReady
+ {
+ /// <summary>
+ /// Called when is ready and user is logged-in. (happens every time a user logs-in)
+ /// </summary>
+ void OnApplicationReady(IFSEApplicationManager applicationManager);
+ }
+}
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/INotifyApplicationStarted.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/INotifyApplicationStarted.cs
index 3a79e0b72..52479e8c1 100644
--- a/Software/Visual_Studio/FSE/Tango.FSE.Common/INotifyApplicationStarted.cs
+++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/INotifyApplicationStarted.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using Tango.FSE.Common.FSEApplication;
namespace Tango.FSE.Common
{
@@ -14,11 +15,6 @@ namespace Tango.FSE.Common
/// <summary>
/// Called when the application has started (once before user login).
/// </summary>
- void OnApplicationStarted();
-
- /// <summary>
- /// Called when is ready and user is logged-in. (happens every time a user logs-in)
- /// </summary>
- void OnApplicationReady();
+ void OnApplicationStarted(IFSEApplicationManager applicationManager);
}
}
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Notifications/INotificationProvider.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/Notifications/INotificationProvider.cs
index c37222727..5fff158fd 100644
--- a/Software/Visual_Studio/FSE/Tango.FSE.Common/Notifications/INotificationProvider.cs
+++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Notifications/INotificationProvider.cs
@@ -16,7 +16,7 @@ namespace Tango.FSE.Common.Notifications
/// <summary>
/// Represents the PPC user notification provider responsible for displaying information, alerts and dialogs to the user.
/// </summary>
- public interface INotificationProvider
+ public interface INotificationProvider : INotifyApplicationReady
{
/// <summary>
/// Gets the collection of notification items.
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Tango.FSE.Common.csproj b/Software/Visual_Studio/FSE/Tango.FSE.Common/Tango.FSE.Common.csproj
index 5b7746ac4..a07897758 100644
--- a/Software/Visual_Studio/FSE/Tango.FSE.Common/Tango.FSE.Common.csproj
+++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Tango.FSE.Common.csproj
@@ -153,6 +153,8 @@
<Compile Include="Converters\TimeSpanHumanizeConverter.cs" />
<Compile Include="Core\FSEProgress.cs" />
<Compile Include="DashboardTile.cs" />
+ <Compile Include="DemoMode\DemoModeCommand.cs" />
+ <Compile Include="DemoMode\IDemoModeManager.cs" />
<Compile Include="Diagnostics\DiagnosticsFrame.cs" />
<Compile Include="Diagnostics\DiagnosticsFrameReceivedEventArgs.cs" />
<Compile Include="Diagnostics\DiagnosticsPackage.cs" />
@@ -186,6 +188,7 @@
<Compile Include="Helpers\EncryptionHelper.cs" />
<Compile Include="Helpers\ResourceHelper.cs" />
<Compile Include="INotifyApplicationStarted.cs" />
+ <Compile Include="INotifyApplicationReady.cs" />
<Compile Include="Logging\ILoggingProvider.cs" />
<Compile Include="Logging\RemoteLogFileModel.cs" />
<Compile Include="Logging\RemoteLogFileStatus.cs" />
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Tiles/IDashboardManager.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/Tiles/IDashboardManager.cs
index 297da27c0..0700a5976 100644
--- a/Software/Visual_Studio/FSE/Tango.FSE.Common/Tiles/IDashboardManager.cs
+++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Tiles/IDashboardManager.cs
@@ -7,7 +7,7 @@ using System.Threading.Tasks;
namespace Tango.FSE.Common.Tiles
{
- public interface IDashboardManager: INotifyApplicationStarted
+ public interface IDashboardManager : INotifyApplicationStarted, INotifyApplicationReady
{
ObservableCollection<DashboardTile> Tiles { get; }
}
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Updates/IUpdatesManager.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/Updates/IUpdatesManager.cs
index 3dfe067ce..4e7aa857b 100644
--- a/Software/Visual_Studio/FSE/Tango.FSE.Common/Updates/IUpdatesManager.cs
+++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Updates/IUpdatesManager.cs
@@ -10,7 +10,7 @@ namespace Tango.FSE.Common.Updates
/// <summary>
/// Represents an FSE software updates manager.
/// </summary>
- public interface IUpdatesManager : INotifyApplicationStarted
+ public interface IUpdatesManager : INotifyApplicationReady
{
/// <summary>
/// Gets or sets a value indicating whether to perform an automatic update checks.
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Connection/DefaultMachineProvider.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/Connection/DefaultMachineProvider.cs
index c707bbe60..759bcb4d5 100644
--- a/Software/Visual_Studio/FSE/Tango.FSE.UI/Connection/DefaultMachineProvider.cs
+++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Connection/DefaultMachineProvider.cs
@@ -18,6 +18,7 @@ using Tango.FSE.BL;
using Tango.FSE.Common;
using Tango.FSE.Common.Authentication;
using Tango.FSE.Common.Connection;
+using Tango.FSE.Common.FSEApplication;
using Tango.FSE.Common.Notifications;
using Tango.FSE.UI.Dialogs;
using Tango.Integration.ExternalBridge;
@@ -672,20 +673,12 @@ namespace Tango.FSE.UI.Connection
#endregion
- #region Application Started
-
- /// <summary>
- /// Called when the application has started (once before user login).
- /// </summary>
- public void OnApplicationStarted()
- {
-
- }
+ #region Application Ready
/// <summary>
/// Called when is ready and user is logged-in. (happens every time a user logs-in)
/// </summary>
- public void OnApplicationReady()
+ public void OnApplicationReady(IFSEApplicationManager applicationManager)
{
_machineEventsStateProvider.Init();
}
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/DemoMode/DefaultDemoModeManager.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/DemoMode/DefaultDemoModeManager.cs
new file mode 100644
index 000000000..5f0ae1c0b
--- /dev/null
+++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/DemoMode/DefaultDemoModeManager.cs
@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.FSE.Common.DemoMode;
+
+namespace Tango.FSE.UI.DemoMode
+{
+ public class DefaultDemoModeManager : IDemoModeManager
+ {
+ public ObservableCollection<DemoModeCommand> DemoCommands { get; private set; }
+
+ public DefaultDemoModeManager()
+ {
+ DemoCommands = new ObservableCollection<DemoModeCommand>();
+ }
+
+ public void InsertCommand(Action action, string name, string description)
+ {
+ DemoCommands.Add(DemoModeCommand.Create(action, name, description));
+ }
+ }
+}
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/DemoMode/DemoModeWindow.xaml b/Software/Visual_Studio/FSE/Tango.FSE.UI/DemoMode/DemoModeWindow.xaml
new file mode 100644
index 000000000..2edbe69c5
--- /dev/null
+++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/DemoMode/DemoModeWindow.xaml
@@ -0,0 +1,47 @@
+<mahapps:MetroWindow x:Class="Tango.FSE.UI.DemoMode.DemoModeWindow"
+ 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:mahapps="http://metro.mahapps.com/winfx/xaml/controls"
+ xmlns:global="clr-namespace:Tango.FSE.UI"
+ xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
+ xmlns:local="clr-namespace:Tango.FSE.UI.DemoMode"
+ mc:Ignorable="d"
+ Title="Tango FSE - Demo Mode"
+ Height="400"
+ Width="350"
+ WindowState="Minimized"
+ TitleForeground="{StaticResource FSE_PrimaryForegroundBrush}"
+ TextElement.Foreground="{StaticResource FSE_PrimaryForegroundBrush}"
+ Background="{StaticResource FSE_PrimaryBackgroundBrush}"
+ TextElement.FontSize="{StaticResource FSE_DefaultFontSize}"
+ TitleCharacterCasing="Normal"
+ EnableDWMDropShadow="True"
+ BorderThickness="1"
+ BorderBrush="Gray"
+ FontFamily="{StaticResource flexo}"
+ WindowTitleBrush="{StaticResource FSE_PrimaryBackgroundLightBrush}"
+ d:DataContext="{d:DesignInstance Type=local:DemoModeWindowVM, IsDesignTimeCreatable=False}"
+ DataContext="{x:Static global:ViewModelLocator.DemoModeWindowVM}" ShowCloseButton="False" ShowMaxRestoreButton="False">
+ <Grid>
+ <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto" Padding="5">
+ <ItemsControl ItemsSource="{Binding DemoModeManager.DemoCommands}">
+ <ItemsControl.ItemTemplate>
+ <DataTemplate>
+ <Button Padding="10 10" HorizontalContentAlignment="Left" Margin="0 5 0 0" Style="{StaticResource FSE_RaisedButton_Dark_Hover}" Command="{Binding Command}">
+ <DockPanel>
+ <materialDesign:PackIcon Kind="LightningBolt" VerticalAlignment="Top" Width="24" Height="24" />
+
+ <StackPanel Margin="10 0 0 0">
+ <TextBlock Text="{Binding Name}" FontSize="{StaticResource FSE_SmallFontSize}"></TextBlock>
+ <TextBlock Text="{Binding Description}" Margin="0 5 0 0" Foreground="{StaticResource FSE_GrayBrush}" FontSize="{StaticResource FSE_SmallerFontSize}" TextWrapping="Wrap"></TextBlock>
+ </StackPanel>
+ </DockPanel>
+ </Button>
+ </DataTemplate>
+ </ItemsControl.ItemTemplate>
+ </ItemsControl>
+ </ScrollViewer>
+ </Grid>
+</mahapps:MetroWindow>
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/DemoMode/DemoModeWindow.xaml.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/DemoMode/DemoModeWindow.xaml.cs
new file mode 100644
index 000000000..eea87323b
--- /dev/null
+++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/DemoMode/DemoModeWindow.xaml.cs
@@ -0,0 +1,28 @@
+using MahApps.Metro.Controls;
+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.Shapes;
+
+namespace Tango.FSE.UI.DemoMode
+{
+ /// <summary>
+ /// Interaction logic for DemoModeWindow.xaml
+ /// </summary>
+ public partial class DemoModeWindow : MetroWindow
+ {
+ public DemoModeWindow()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/DemoMode/DemoModeWindowVM.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/DemoMode/DemoModeWindowVM.cs
new file mode 100644
index 000000000..2d613a8b1
--- /dev/null
+++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/DemoMode/DemoModeWindowVM.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.FSE.Common;
+
+namespace Tango.FSE.UI.DemoMode
+{
+ public class DemoModeWindowVM : FSEViewModel
+ {
+
+ }
+}
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/FSEApplication/DefaultFSEApplicationManager.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/FSEApplication/DefaultFSEApplicationManager.cs
index e0465d307..1c1a7ae00 100644
--- a/Software/Visual_Studio/FSE/Tango.FSE.UI/FSEApplication/DefaultFSEApplicationManager.cs
+++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/FSEApplication/DefaultFSEApplicationManager.cs
@@ -241,7 +241,7 @@ namespace Tango.FSE.UI.FSEApplication
foreach (var instance in TangoIOC.Default.GetAllInstancesByBase<INotifyApplicationStarted>())
{
LogManager.Log($"Invoking {instance.GetType().Name}.OnApplicationStarted...");
- instance.OnApplicationStarted();
+ instance.OnApplicationStarted(this);
}
var internalModules = this.GetType().Assembly.GetTypes().Where(xx => typeof(FSEModuleBase).IsAssignableFrom(xx)).ToList();
@@ -354,10 +354,10 @@ namespace Tango.FSE.UI.FSEApplication
}
LogManager.Log("OnApplicationReady methods for all INotifyApplicationStarted services...");
- foreach (var instance in TangoIOC.Default.GetAllInstancesByBase<INotifyApplicationStarted>())
+ foreach (var instance in TangoIOC.Default.GetAllInstancesByBase<INotifyApplicationReady>())
{
LogManager.Log($"Invoking {instance.GetType().Name}.OnApplicationReady...");
- instance.OnApplicationReady();
+ instance.OnApplicationReady(this);
}
});
}
@@ -437,5 +437,16 @@ namespace Tango.FSE.UI.FSEApplication
Process.Start(Application.ResourceAssembly.Location);
Environment.Exit(0);
}
+
+ /// <summary>
+ /// Gets a value indicating whether the application is currently running in demo mode.
+ /// </summary>
+ public bool DemoMode
+ {
+ get
+ {
+ return StartupArgs.Contains("-demo");
+ }
+ }
}
}
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/MainWindow.xaml.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/MainWindow.xaml.cs
index 75e27d586..07534dd8e 100644
--- a/Software/Visual_Studio/FSE/Tango.FSE.UI/MainWindow.xaml.cs
+++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/MainWindow.xaml.cs
@@ -17,6 +17,7 @@ using Tango.Core.DI;
using Tango.FSE.Common;
using Tango.FSE.Common.FSEApplication;
using Tango.FSE.Common.Resolution;
+using Tango.FSE.UI.DemoMode;
using Tango.Settings;
namespace Tango.FSE.UI
@@ -43,6 +44,15 @@ namespace Tango.FSE.UI
IFSEApplicationManager appManager = TangoIOC.Default.GetInstance<IFSEApplicationManager>();
+ ContentRendered += (_, __) =>
+ {
+ if (appManager.DemoMode)
+ {
+ DemoModeWindow demoWindow = new DemoModeWindow();
+ demoWindow.Show();
+ }
+ };
+
Closing += (x, e) =>
{
e.Cancel = true;
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Notifications/DefaultNotificationProvider.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/Notifications/DefaultNotificationProvider.cs
index 5c17b9f9a..ce64bd0f1 100644
--- a/Software/Visual_Studio/FSE/Tango.FSE.UI/Notifications/DefaultNotificationProvider.cs
+++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Notifications/DefaultNotificationProvider.cs
@@ -21,6 +21,10 @@ using System.Windows.Data;
using MaterialDesignThemes.Wpf;
using Tango.FSE.Common.Core;
using Tango.FSE.Common.BugReporting;
+using Tango.FSE.Common.FSEApplication;
+using Tango.FSE.Common.DemoMode;
+using Tango.FSE.Common;
+using System.Threading;
namespace Tango.FSE.UI.Notifications
{
@@ -39,6 +43,9 @@ namespace Tango.FSE.UI.Notifications
[TangoInject(TangoInjectMode.WhenAvailable)]
public IBugReporter BugReporter { get; set; }
+ [TangoInject(TangoInjectMode.WhenAvailable)]
+ private IDemoModeManager DemoModeManager { get; set; }
+
private bool _notificationsVisible;
/// <summary>
/// Gets or sets a value indicating whether to allow notifications visibility.
@@ -811,5 +818,91 @@ namespace Tango.FSE.UI.Notifications
RaisePropertyChanged(nameof(HasSnackbarItems));
});
}
+
+ /// <summary>
+ /// Called when is ready and user is logged-in. (happens every time a user logs-in)
+ /// </summary>
+ /// <param name="applicationManager"></param>
+ public void OnApplicationReady(IFSEApplicationManager applicationManager)
+ {
+ if (applicationManager.DemoMode)
+ {
+ DemoModeManager.InsertCommand(() =>
+ {
+ ShowInfo("This is a standard information message.");
+ }, "Emulate Info Message", "Emulates a standard information message box.");
+
+ DemoModeManager.InsertCommand(() =>
+ {
+ ShowWarning("Something bad is about to happen.");
+ }, "Emulate Warning Message", "Emulates a standard warning message box.");
+
+ DemoModeManager.InsertCommand(() =>
+ {
+ ShowWarningQuestion("Something bad is about to happen. Are you sure?");
+ }, "Emulate Warning Question Message", "Emulates a standard warning question message box.");
+
+ DemoModeManager.InsertCommand(() =>
+ {
+ ShowError("Something bad happened.");
+ }, "Emulate Error Message", "Emulates a standard error message box.");
+
+ DemoModeManager.InsertCommand(() =>
+ {
+ ShowSuccess("The operation completed successfully.");
+ }, "Emulate Success Message", "Emulates a standard success message box.");
+
+ DemoModeManager.InsertCommand(() =>
+ {
+ PushSnackbarItem(MessageType.Info, "Some Information", true, "This is a standard information message.\nTap to see more details.", TimeSpan.FromSeconds(5), null, () =>
+ {
+ ShowInfo("This is a standard information message.");
+ });
+ }, "Emulate Info Snackbar", "Creates an information snackbar with timeout and press action.");
+
+ DemoModeManager.InsertCommand(() =>
+ {
+ PushSnackbarItem(MessageType.Warning, "Some Warning", true, "This is a standard warning message.\nTap to see more details.", TimeSpan.FromSeconds(5), null, () =>
+ {
+ ShowWarning("This is a standard warning message.");
+ });
+ }, "Emulate Warning Snackbar", "Creates a warning snackbar with timeout and press action.");
+
+ DemoModeManager.InsertCommand(() =>
+ {
+ PushSnackbarItem(MessageType.Error, "Fake Error Occurred", false, "This is a standard error message.\nTap to see more details.", null, null, () =>
+ {
+ ShowError("This is a standard warning message.");
+ });
+ }, "Emulate Error Snackbar", "Creates an error snackbar with no timeout and no ability to close.");
+
+ DemoModeManager.InsertCommand(() =>
+ {
+ PushSnackbarItem(MessageType.Success, "Operation Completed", true, "This is a standard success message.\nTap to close", TimeSpan.FromSeconds(5));
+ }, "Emulate Success Snackbar", "Creates a success snackbar with timeout and close press action.");
+
+ DemoModeManager.InsertCommand(() =>
+ {
+ var snackbar = PushProgressSnackbar("Background Operation", "The application is doing stuff in the background...");
+
+ Task.Factory.StartNew(() =>
+ {
+ for (int i = 0; i < 100; i++)
+ {
+ snackbar.Message = $"The application is doing stuff in the background ({i}/100)...";
+ Thread.Sleep(50);
+ }
+
+ snackbar.ProgressCompleted("Operation completed.", TimeSpan.FromSeconds(2));
+ });
+
+ }, "Emulate Progress Snackbar", "Creates a success snackbar with timeout and close press action.");
+
+ DemoModeManager.InsertCommand(() =>
+ {
+ PushErrorReportingSnackbar(new TimeoutException("This is a demo exception"), "Test Error", "This is a demo exception.");
+ }, "Emulate Bug Reporting Error", "Creates a snackbar notification with a fake error and bug reporting option.");
+ }
+ }
}
}
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/RemoteJob/DefaultRemoteJobProvider.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/RemoteJob/DefaultRemoteJobProvider.cs
index d67328bcd..55bf614f3 100644
--- a/Software/Visual_Studio/FSE/Tango.FSE.UI/RemoteJob/DefaultRemoteJobProvider.cs
+++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/RemoteJob/DefaultRemoteJobProvider.cs
@@ -7,6 +7,7 @@ using System.Threading.Tasks;
using Tango.Core;
using Tango.Core.DI;
using Tango.FSE.Common.Connection;
+using Tango.FSE.Common.FSEApplication;
using Tango.FSE.Common.Notifications;
using Tango.FSE.Common.RemoteJob;
using Tango.Integration.Operation;
@@ -31,7 +32,7 @@ namespace Tango.FSE.UI.RemoteJob
[TangoInject]
private INotificationProvider NotificationProvider { get; set; }
- public void OnApplicationStarted()
+ public void OnApplicationStarted(IFSEApplicationManager applicationManager)
{
MachineProvider.MachineConnected += MachineProvider_MachineConnected;
}
@@ -129,10 +130,5 @@ namespace Tango.FSE.UI.RemoteJob
}
}
}
-
- public void OnApplicationReady()
- {
- //Do Nothing.
- }
}
}
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Tango.FSE.UI.csproj b/Software/Visual_Studio/FSE/Tango.FSE.UI/Tango.FSE.UI.csproj
index 0772159b9..dce2cbb9e 100644
--- a/Software/Visual_Studio/FSE/Tango.FSE.UI/Tango.FSE.UI.csproj
+++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Tango.FSE.UI.csproj
@@ -224,6 +224,11 @@
<Compile Include="Converters\LiquidTypeToBrushConverter.cs" />
<Compile Include="Converters\MidTankLevelToElementHeightConverter.cs" />
<Compile Include="Converters\StringToFirstLetterConverter.cs" />
+ <Compile Include="DemoMode\DefaultDemoModeManager.cs" />
+ <Compile Include="DemoMode\DemoModeWindow.xaml.cs">
+ <DependentUpon>DemoModeWindow.xaml</DependentUpon>
+ </Compile>
+ <Compile Include="DemoMode\DemoModeWindowVM.cs" />
<Compile Include="Diagnostics\DefaultDiagnosticsProvider.cs" />
<Compile Include="Dialogs\ApplicationUpdateView.xaml.cs">
<DependentUpon>ApplicationUpdateView.xaml</DependentUpon>
@@ -381,6 +386,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
+ <Page Include="DemoMode\DemoModeWindow.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
<Page Include="Dialogs\ApplicationUpdateView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Tiles/DefaultDashboardManager.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/Tiles/DefaultDashboardManager.cs
index f2620fc6e..d03087ee2 100644
--- a/Software/Visual_Studio/FSE/Tango.FSE.UI/Tiles/DefaultDashboardManager.cs
+++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Tiles/DefaultDashboardManager.cs
@@ -6,6 +6,7 @@ using System.Text;
using System.Threading.Tasks;
using Tango.Core.DI;
using Tango.FSE.Common;
+using Tango.FSE.Common.FSEApplication;
using Tango.FSE.Common.Navigation;
using Tango.FSE.Common.Tiles;
using Tango.FSE.UI.ViewModels;
@@ -38,14 +39,14 @@ namespace Tango.FSE.UI.Tiles
}
}
- public async void OnApplicationStarted()
+ public async void OnApplicationStarted(IFSEApplicationManager applicationManager)
{
await Task.Delay(100);
Tiles.ToList().ForEach(x => TangoIOC.Default.Inject(x));
Tiles.ToList().ForEach(x => x.OnApplicationStarted());
}
- public async void OnApplicationReady()
+ public async void OnApplicationReady(IFSEApplicationManager applicationManager)
{
await Task.Delay(100);
Tiles.ToList().ForEach(x => x.OnApplicationReady());
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Updates/DefaultUpdatesManager.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/Updates/DefaultUpdatesManager.cs
index 4c4592c89..164886078 100644
--- a/Software/Visual_Studio/FSE/Tango.FSE.UI/Updates/DefaultUpdatesManager.cs
+++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Updates/DefaultUpdatesManager.cs
@@ -94,17 +94,9 @@ namespace Tango.FSE.UI.Updates
}
/// <summary>
- /// Called when the application has started (once before user login).
- /// </summary>
- public void OnApplicationStarted()
- {
- //Do nothing.
- }
-
- /// <summary>
/// Called when is ready and user is logged-in. (happens every time a user logs-in)
/// </summary>
- public async void OnApplicationReady()
+ public async void OnApplicationReady(IFSEApplicationManager applicationManager)
{
if (!_performedFirstCheck)
{
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/ViewModelLocator.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/ViewModelLocator.cs
index 159f6326b..862ade549 100644
--- a/Software/Visual_Studio/FSE/Tango.FSE.UI/ViewModelLocator.cs
+++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/ViewModelLocator.cs
@@ -60,6 +60,8 @@ using Tango.FSE.Common.RemoteJob;
using Tango.FSE.UI.RemoteJob;
using Tango.FSE.Common.WindowsManager;
using Tango.FSE.UI.WindowsManager;
+using Tango.FSE.Common.DemoMode;
+using Tango.FSE.UI.DemoMode;
namespace Tango.FSE.UI
{
@@ -95,6 +97,7 @@ namespace Tango.FSE.UI
TangoIOC.Default.Unregister<IDashboardManager>();
TangoIOC.Default.Unregister<IRemoteJobProvider>();
TangoIOC.Default.Unregister<IWindowsManager>();
+ TangoIOC.Default.Unregister<IDemoModeManager>();
//TangoIOC.Default.Unregister<ExternalBridgeScanner>();
//TangoIOC.Default.Unregister<IDiagnosticsFrameProvider>();
//TangoIOC.Default.Unregister<IEventLogger>();
@@ -130,6 +133,7 @@ namespace Tango.FSE.UI
TangoIOC.Default.Register<IRemoteJobProvider, DefaultRemoteJobProvider>();
TangoIOC.Default.Register<IDashboardManager, DefaultDashboardManager>();
TangoIOC.Default.Register<IWindowsManager, DefaultWindowsManager>();
+ TangoIOC.Default.Register<IDemoModeManager, DefaultDemoModeManager>();
TangoIOC.Default.Register<MainWindowVM>();
@@ -142,6 +146,7 @@ namespace Tango.FSE.UI
TangoIOC.Default.Register<AccountViewVM>();
TangoIOC.Default.Register<EventsViewVM>();
TangoIOC.Default.Register<SettingsViewVM>();
+ TangoIOC.Default.Register<DemoModeWindowVM>();
}
public static MainWindowVM MainWindowVM
@@ -223,5 +228,13 @@ namespace Tango.FSE.UI
return TangoIOC.Default.GetInstance<SettingsViewVM>();
}
}
+
+ public static DemoModeWindowVM DemoModeWindowVM
+ {
+ get
+ {
+ return TangoIOC.Default.GetInstance<DemoModeWindowVM>();
+ }
+ }
}
}