aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI')
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Html/DefaultHtmlPresenter.cs25
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Html/HtmlWindow.xaml37
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Html/HtmlWindow.xaml.cs48
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj8
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs7
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs40
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml88
7 files changed, 228 insertions, 25 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Html/DefaultHtmlPresenter.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Html/DefaultHtmlPresenter.cs
new file mode 100644
index 000000000..eff8c98a0
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Html/DefaultHtmlPresenter.cs
@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using Tango.BL.Entities;
+using Tango.MachineStudio.Common.Html;
+using Tango.MachineStudio.UI.Windows;
+
+namespace Tango.MachineStudio.UI.Html
+{
+ public class DefaultHtmlPresenter : IHtmlPresenter
+ {
+ public bool DisplayHtml(HtmlPage html)
+ {
+ HtmlWindow dialog = new HtmlWindow(html);
+ dialog.Owner = Application.Current.MainWindow;
+ MainWindow.Instance.shadowGrid.Visibility = Visibility.Visible;
+ var result = dialog.ShowDialog();
+ MainWindow.Instance.shadowGrid.Visibility = Visibility.Hidden;
+ return result.Value;
+ }
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Html/HtmlWindow.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Html/HtmlWindow.xaml
new file mode 100644
index 000000000..654d2d0eb
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Html/HtmlWindow.xaml
@@ -0,0 +1,37 @@
+<Window x:Class="Tango.MachineStudio.UI.Html.HtmlWindow"
+ 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:mahapps="http://metro.mahapps.com/winfx/xaml/controls"
+ xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:local="clr-namespace:Tango.MachineStudio.UI.Windows"
+ mc:Ignorable="d"
+ Title="Machine Studio" Height="500" Width="800" WindowStyle="None" ResizeMode="NoResize" WindowStartupLocation="CenterOwner" Background="Transparent">
+ <Grid>
+ <Grid>
+ <Border Background="White" Padding="10" BorderThickness="1" BorderBrush="{StaticResource AccentColorBrush}">
+ <Border.Effect>
+ <DropShadowEffect ShadowDepth="0" BlurRadius="10"></DropShadowEffect>
+ </Border.Effect>
+
+ <Grid>
+ <DockPanel Margin="10">
+ <Grid DockPanel.Dock="Bottom">
+ <Button Margin="10 10 0 0" Width="140" HorizontalAlignment="Right" Click="OKClicked">OK</Button>
+ </Grid>
+ <WebBrowser x:Name="webBrowser"
+ OverridesDefaultStyle="False"
+ ScrollViewer.CanContentScroll="False"
+ ScrollViewer.HorizontalScrollBarVisibility="Hidden"
+ ScrollViewer.VerticalScrollBarVisibility="Hidden"></WebBrowser>
+ </DockPanel>
+
+ <Button Click="CloseClicked" HorizontalAlignment="Right" VerticalAlignment="Top" Width="20" Height="20" Margin="0 -6 -4 0" Padding="0" Style="{StaticResource MaterialDesignFlatButton}" Foreground="Black">
+ <materialDesign:PackIcon Kind="Close" Width="16" Height="16"></materialDesign:PackIcon>
+ </Button>
+ </Grid>
+ </Border>
+ </Grid>
+ </Grid>
+</Window>
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Html/HtmlWindow.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Html/HtmlWindow.xaml.cs
new file mode 100644
index 000000000..9f37eba06
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Html/HtmlWindow.xaml.cs
@@ -0,0 +1,48 @@
+using MahApps.Metro.Controls;
+using MaterialDesignThemes.Wpf;
+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;
+using Tango.BL.Entities;
+using Tango.Core.Commands;
+
+namespace Tango.MachineStudio.UI.Html
+{
+ /// <summary>
+ /// Interaction logic for DialogWindow.xaml
+ /// </summary>
+ public partial class HtmlWindow : Window
+ {
+ public HtmlWindow(HtmlPage html)
+ {
+ InitializeComponent();
+
+ webBrowser.Loaded += (_, __) =>
+ {
+ webBrowser.NavigateToString(html.Html);
+ };
+ }
+
+ private void OKClicked(object sender, RoutedEventArgs e)
+ {
+ DialogResult = true;
+ Close();
+ }
+
+ private void CloseClicked(object sender, RoutedEventArgs e)
+ {
+ DialogResult = false;
+ Close();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj
index 07b1f44fe..4befd2f5c 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj
@@ -143,6 +143,10 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
+ <Compile Include="Html\DefaultHtmlPresenter.cs" />
+ <Compile Include="Html\HtmlWindow.xaml.cs">
+ <DependentUpon>HtmlWindow.xaml</DependentUpon>
+ </Compile>
<Compile Include="Modules\DefaultStudioModuleLoader.cs" />
<Compile Include="Notifications\TextInputBoxWindow.xaml.cs">
<DependentUpon>TextInputBoxWindow.xaml</DependentUpon>
@@ -199,6 +203,10 @@
<Compile Include="Windows\ModuleWindow.xaml.cs">
<DependentUpon>ModuleWindow.xaml</DependentUpon>
</Compile>
+ <Page Include="Html\HtmlWindow.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ <SubType>Designer</SubType>
+ </Page>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs
index 571122eb5..bbb916d02 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs
@@ -7,12 +7,15 @@ using Tango.Logging;
using Tango.MachineStudio.Common.Authentication;
using Tango.MachineStudio.Common.Diagnostics;
using Tango.MachineStudio.Common.EventLogging;
+using Tango.MachineStudio.Common.Html;
using Tango.MachineStudio.Common.Modules;
using Tango.MachineStudio.Common.Navigation;
using Tango.MachineStudio.Common.Notifications;
+using Tango.MachineStudio.Common.Speech;
using Tango.MachineStudio.Common.StudioApplication;
using Tango.MachineStudio.Common.Video;
using Tango.MachineStudio.UI.Authentication;
+using Tango.MachineStudio.UI.Html;
using Tango.MachineStudio.UI.Modules;
using Tango.MachineStudio.UI.Navigation;
using Tango.MachineStudio.UI.Notifications;
@@ -59,6 +62,8 @@ namespace Tango.MachineStudio.UI
SimpleIoc.Default.Unregister<IVideoCaptureProvider>();
SimpleIoc.Default.Unregister<IDiagnosticsFrameProvider>();
SimpleIoc.Default.Unregister<IEventLogger>();
+ SimpleIoc.Default.Unregister<ISpeechProvider>();
+ SimpleIoc.Default.Unregister<IHtmlPresenter>();
SimpleIoc.Default.Register<INotificationProvider, DefaultNotificationProvider>();
SimpleIoc.Default.Register<IAuthenticationProvider, DefaultAuthenticationProvider>();
@@ -69,6 +74,8 @@ namespace Tango.MachineStudio.UI
SimpleIoc.Default.Register<IVideoCaptureProvider, DefaultVideoCaptureProvider>();
SimpleIoc.Default.Register<IDiagnosticsFrameProvider, DefaultDiagnosticsFrameProvider>();
SimpleIoc.Default.Register<IEventLogger, DefaultEventLogger>();
+ SimpleIoc.Default.Register<ISpeechProvider, DefaultSpeechProvider>();
+ SimpleIoc.Default.Register<IHtmlPresenter, DefaultHtmlPresenter>();
SimpleIoc.Default.Register<MainViewVM>();
SimpleIoc.Default.Register<LoadingViewVM>();
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs
index c9f4b3441..3cb728395 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs
@@ -20,10 +20,12 @@ using Tango.MachineStudio.Common;
using Tango.MachineStudio.Common.Authentication;
using Tango.MachineStudio.Common.Diagnostics;
using Tango.MachineStudio.Common.EventLogging;
+using Tango.MachineStudio.Common.Html;
using Tango.MachineStudio.Common.Messages;
using Tango.MachineStudio.Common.Modules;
using Tango.MachineStudio.Common.Navigation;
using Tango.MachineStudio.Common.Notifications;
+using Tango.MachineStudio.Common.Speech;
using Tango.MachineStudio.Common.StudioApplication;
using Tango.MachineStudio.Common.Update;
using Tango.MachineStudio.UI.StudioApplication;
@@ -49,6 +51,7 @@ namespace Tango.MachineStudio.UI.ViewModels
private bool _isDisconnecting;
private Thread _updateCheckThread;
private IEventLogger _eventLogger;
+ private IHtmlPresenter _htmlPresenter;
/// <summary>
/// Gets or sets the current loaded module.
@@ -129,6 +132,16 @@ namespace Tango.MachineStudio.UI.ViewModels
/// </summary>
public RelayCommand UpdateCenterCommand { get; set; }
+ /// <summary>
+ /// Gets or sets the toggle speech command.
+ /// </summary>
+ public RelayCommand ToggleSpeechCommand { get; set; }
+
+ /// <summary>
+ /// Gets or sets the display HTML command.
+ /// </summary>
+ public RelayCommand<MachinesEvent> ResolveMachineEventCommand { get; set; }
+
private IAuthenticationProvider _authenticationProvider;
/// <summary>
/// Gets or sets the authentication provider.
@@ -169,6 +182,11 @@ namespace Tango.MachineStudio.UI.ViewModels
set { _applicationManager = value; RaisePropertyChangedAuto(); }
}
+ /// <summary>
+ /// Gets or sets the speech provider.
+ /// </summary>
+ public ISpeechProvider SpeechProvider { get; set; }
+
private bool _isUpdateAvailable;
/// <summary>
/// Gets or sets a value indicating whether a new version update is available.
@@ -228,7 +246,9 @@ namespace Tango.MachineStudio.UI.ViewModels
IStudioApplicationManager applicationManager,
INavigationManager navigationManager,
IEventLogger eventLogger,
- IDiagnosticsFrameProvider frameProvider) : base(view)
+ IDiagnosticsFrameProvider frameProvider,
+ ISpeechProvider speechProvider,
+ IHtmlPresenter htmlPresenter) : base(view)
{
_eventLogger = eventLogger;
_navigation = navigationManager;
@@ -237,6 +257,8 @@ namespace Tango.MachineStudio.UI.ViewModels
NotificationProvider = notificationProvider;
ApplicationManager = applicationManager;
DiagnosticsFrameProvider = frameProvider;
+ SpeechProvider = speechProvider;
+ _htmlPresenter = htmlPresenter;
StartModuleCommand = new RelayCommand<IStudioModule>(StartModule);
@@ -263,6 +285,10 @@ namespace Tango.MachineStudio.UI.ViewModels
machine.MachineEventsStateProvider.EventsResolved += MachineEventsStateProvider_EventsResolved;
}
};
+
+ ToggleSpeechCommand = new RelayCommand(() => { SpeechProvider.Mute = !SpeechProvider.Mute; });
+
+ ResolveMachineEventCommand = new RelayCommand<MachinesEvent>(ResolveMachineEvent);
}
private void MachineEventsStateProvider_EventsResolved(object sender, IEnumerable<MachinesEvent> e)
@@ -542,5 +568,17 @@ namespace Tango.MachineStudio.UI.ViewModels
{
_applicationManager.ShutDown();
}
+
+ /// <summary>
+ /// Displays the HTML.
+ /// </summary>
+ /// <param name="machineEvent">The HTML page.</param>
+ private void ResolveMachineEvent(MachinesEvent machineEvent)
+ {
+ if (_htmlPresenter.DisplayHtml(machineEvent.EventType.HtmlPage))
+ {
+ //Send resolved to embedded !
+ }
+ }
}
}
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml
index b7a4cc93f..3301fd9f3 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml
@@ -172,6 +172,24 @@
</StackPanel>
</Button>
<Separator/>
+ <Button Command="{Binding ToggleSpeechCommand}">
+ <StackPanel Orientation="Horizontal">
+ <materialDesign:PackIcon Width="24" Height="24">
+ <materialDesign:PackIcon.Style>
+ <Style TargetType="materialDesign:PackIcon">
+ <Setter Property="Kind" Value="VolumeHigh"></Setter>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding SpeechProvider.Mute}" Value="True">
+ <Setter Property="Kind" Value="VolumeOff"></Setter>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </materialDesign:PackIcon.Style>
+ </materialDesign:PackIcon>
+ <TextBlock Margin="5 0 0 0" VerticalAlignment="Center">Speech</TextBlock>
+ </StackPanel>
+ </Button>
+ <Separator/>
<Button Command="{Binding ExitCommand}">
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="CloseCircleOutline" Width="24" Height="24" />
@@ -437,37 +455,59 @@
<ItemsControl.ItemTemplate>
<DataTemplate DataType="{x:Type entities:MachinesEvent}">
<Border BorderThickness="0 0 0 1" BorderBrush="#E1E1E1" Padding="5">
- <StackPanel>
- <StackPanel Orientation="Horizontal">
- <materialDesign:PackIcon Width="24" Height="24">
- <materialDesign:PackIcon.Style>
- <Style TargetType="materialDesign:PackIcon">
- <Setter Property="Kind" Value="AlertCircle"></Setter>
- <Setter Property="Foreground" Value="#464646"></Setter>
+ <DockPanel>
+ <Grid DockPanel.Dock="Right" HorizontalAlignment="Right" VerticalAlignment="Center">
+ <ContentControl>
+ <ContentControl.Style>
+ <Style TargetType="ContentControl">
+ <Setter Property="Content" Value="{x:Null}"></Setter>
<Style.Triggers>
- <DataTrigger Binding="{Binding Category}" Value="Warning">
- <Setter Property="Kind" Value="Alert"></Setter>
- <Setter Property="Foreground" Value="#FFA300"></Setter>
- </DataTrigger>
- <DataTrigger Binding="{Binding Category}" Value="Error">
- <Setter Property="Kind" Value="AlertOctagon"></Setter>
- <Setter Property="Foreground" Value="#FF5C5C"></Setter>
- </DataTrigger>
- <DataTrigger Binding="{Binding Category}" Value="Critical">
- <Setter Property="Kind" Value="BellPlus"></Setter>
- <Setter Property="Foreground" Value="Red"></Setter>
+ <DataTrigger Binding="{Binding EventType.HtmlPage,Converter={StaticResource NullObjectToBooleanConverter}}" Value="True">
+ <Setter Property="Content">
+ <Setter.Value>
+ <Button Style="{StaticResource emptyButton}" Cursor="Hand" Margin="5" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.ResolveMachineEventCommand}" CommandParameter="{Binding}">
+ <materialDesign:PackIcon Kind="TelevisionGuide" Width="24" Height="24" />
+ </Button>
+ </Setter.Value>
+ </Setter>
</DataTrigger>
</Style.Triggers>
</Style>
- </materialDesign:PackIcon.Style>
- </materialDesign:PackIcon>
+ </ContentControl.Style>
+ </ContentControl>
+ </Grid>
+ <StackPanel>
+ <StackPanel Orientation="Horizontal">
+ <materialDesign:PackIcon Width="24" Height="24">
+ <materialDesign:PackIcon.Style>
+ <Style TargetType="materialDesign:PackIcon">
+ <Setter Property="Kind" Value="AlertCircle"></Setter>
+ <Setter Property="Foreground" Value="#464646"></Setter>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding Category}" Value="Warning">
+ <Setter Property="Kind" Value="Alert"></Setter>
+ <Setter Property="Foreground" Value="#FFA300"></Setter>
+ </DataTrigger>
+ <DataTrigger Binding="{Binding Category}" Value="Error">
+ <Setter Property="Kind" Value="AlertOctagon"></Setter>
+ <Setter Property="Foreground" Value="#FF5C5C"></Setter>
+ </DataTrigger>
+ <DataTrigger Binding="{Binding Category}" Value="Critical">
+ <Setter Property="Kind" Value="BellPlus"></Setter>
+ <Setter Property="Foreground" Value="Red"></Setter>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </materialDesign:PackIcon.Style>
+ </materialDesign:PackIcon>
- <StackPanel Margin="10 0 0 0" VerticalAlignment="Top">
- <TextBlock Text="{Binding EventType.Name}"></TextBlock>
- <TextBlock Margin="0 5 0 0" Text="{Binding Description}" FontSize="10" Foreground="DimGray" TextWrapping="Wrap"></TextBlock>
+ <StackPanel Margin="10 0 0 0" VerticalAlignment="Top">
+ <TextBlock Text="{Binding EventType.Name}"></TextBlock>
+ <TextBlock Margin="0 5 0 0" Text="{Binding Description}" FontSize="10" Foreground="DimGray" TextWrapping="Wrap"></TextBlock>
+ </StackPanel>
</StackPanel>
</StackPanel>
- </StackPanel>
+ </DockPanel>
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>