diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2018-03-06 12:11:22 +0200 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2018-03-06 12:11:22 +0200 |
| commit | 99715aa1c659a3d5d7709cb16d5dfe1b1c29a135 (patch) | |
| tree | d003fe1c07117036039294ffc8b6ba51096938d4 /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI | |
| parent | ce68bf700e2e6535e1ed155fe2806c1ed6030edd (diff) | |
| parent | 7e6c673cc8b04086fa3c78cd1bf5e31085fd8cc8 (diff) | |
| download | Tango-99715aa1c659a3d5d7709cb16d5dfe1b1c29a135.tar.gz Tango-99715aa1c659a3d5d7709cb16d5dfe1b1c29a135.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI')
4 files changed, 57 insertions, 1 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs index b3c4f5cb3..bc57aee20 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs @@ -8,6 +8,7 @@ using Tango.Core; using Tango.BL.Entities; using Tango.MachineStudio.Common.Authentication; using Tango.BL; +using Tango.BL.Enumerations; namespace Tango.MachineStudio.UI.Authentication { diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs index a07c0ef13..1c9b8732f 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs @@ -193,6 +193,56 @@ namespace Tango.MachineStudio.UI.Notifications } /// <summary> + /// Shows the specified view with the specified view model as it's data context. + /// </summary> + /// <typeparam name="VM">The type of the mm.</typeparam> + /// <typeparam name="View">The type of the view.</typeparam> + /// <param name="vm">The view model.</param> + /// <param name="view">The view.</param> + /// <param name="onAccept">The accept action.</param> + /// <param name="onCancel">The cancel action.</param> + public void ShowModalDialog<VM, View>(VM vm, View view, Action<VM> onAccept, Action onCancel) where View : FrameworkElement where VM : DialogViewVM + { + DialogWindow dialog = new DialogWindow(); + dialog.Owner = Application.Current.MainWindow; + dialog.InnerContent = view; + MainWindow.Instance.shadowGrid.Visibility = Visibility.Visible; + view.Loaded += (x, y) => + { + VM context = vm; + dialog.DataContext = context; + + Action onAcceptAction = null; + onAcceptAction = new Action(() => + { + dialog.Close(); + onAccept(context); + context.Accepted -= onAcceptAction; + }); + + Action onCancelAction = null; + onCancelAction = new Action(() => + { + dialog.Close(); + + if (onCancel != null) + { + onCancel(); + } + + context.Canceled -= onCancelAction; + }); + + context.Accepted += onAcceptAction; + context.Canceled += onCancelAction; + + context.OnShow(); + }; + dialog.ShowDialog(); + MainWindow.Instance.shadowGrid.Visibility = Visibility.Hidden; + } + + /// <summary> /// Creates a new view by a naming convention of the specified view model type. /// </summary> /// <typeparam name="VM">The type of the view model.</typeparam> 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 dd534eba1..52bd44239 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 @@ -335,6 +335,10 @@ <Project>{74e700b0-1156-4126-be40-ee450d3c3026}</Project> <Name>Tango.Transport</Name> </ProjectReference> + <ProjectReference Include="..\Modules\Tango.MachineStudio.ColorLab\Tango.MachineStudio.ColorLab.csproj"> + <Project>{4d183aca-552b-4135-ae81-7c5a8e5fc3b1}</Project> + <Name>Tango.MachineStudio.ColorLab</Name> + </ProjectReference> <ProjectReference Include="..\Modules\Tango.MachineStudio.DataCapture\Tango.MachineStudio.DataCapture.csproj"> <Project>{fc337a7f-1214-41d8-9992-78092a3b961e}</Project> <Name>Tango.MachineStudio.DataCapture</Name> 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 f2c9ddba5..a4256436c 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml @@ -293,13 +293,14 @@ <ItemsControl.ItemTemplate> <DataTemplate> <materialDesign:Card Width="300" Margin="10" Height="400" Visibility="{Binding InNewWindow,Converter={StaticResource BooleanToVisibilityInverseConverter}}"> - <Grid > + <Grid> <Grid.RowDefinitions> <RowDefinition Height="180" /> <RowDefinition Height="*" /> <RowDefinition Height="Auto" /> </Grid.RowDefinitions> <Image Source="{Binding Image,Mode=OneWay}" Stretch="Fill" RenderOptions.BitmapScalingMode="Fant" /> + <Rectangle VerticalAlignment="Bottom" Stroke="Silver"></Rectangle> <Button Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.StartModuleCommand}" CommandParameter="{Binding}" Grid.Row="0" Margin="0,0,20,-35" HorizontalAlignment="Right" Width="70" Height="70" VerticalAlignment="Bottom" Style="{StaticResource MaterialDesignFloatingActionMiniButton}" ToolTip="Start This Module"> <materialDesign:PackIcon Kind="Play" Width="30" Height="30" /> </Button> |
