aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2019-03-18 12:00:50 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2019-03-18 12:00:50 +0200
commitb73ca494e24ad83f8768946a5bd2e91a60d7d65e (patch)
treee65285f9af71da2dc75b22b85b070d18a138ba69 /Software/Visual_Studio
parent1b0cc929b5641c58faf5830ec70d3dec4030b1fd (diff)
downloadTango-b73ca494e24ad83f8768946a5bd2e91a60d7d65e.tar.gz
Tango-b73ca494e24ad83f8768946a5bd2e91a60d7d65e.zip
Implemented open dispensers & machine designer via double click.
Diffstat (limited to 'Software/Visual_Studio')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/MachineStudio.Dispensers/Views/DispensersView.xaml5
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs3
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachinesView.xaml5
-rw-r--r--Software/Visual_Studio/Tango.SharedUI/Controls/DoubleClickDataGrid.cs37
-rw-r--r--Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj3
5 files changed, 48 insertions, 5 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/MachineStudio.Dispensers/Views/DispensersView.xaml b/Software/Visual_Studio/MachineStudio/Modules/MachineStudio.Dispensers/Views/DispensersView.xaml
index a1d080380..a8262667e 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/MachineStudio.Dispensers/Views/DispensersView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/MachineStudio.Dispensers/Views/DispensersView.xaml
@@ -8,6 +8,7 @@
xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI"
xmlns:vm="clr-namespace:Tango.MachineStudio.Dispensers.ViewModels"
+ xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI"
xmlns:global="clr-namespace:Tango.MachineStudio.Dispensers"
xmlns:local="clr-namespace:Tango.MachineStudio.Dispensers.Views"
mc:Ignorable="d"
@@ -54,7 +55,7 @@
</StackPanel>
</Grid>
<Grid IsEnabled="{Binding IsFree}">
- <DataGrid Margin="0 0 0 10" BorderBrush="Silver" IsReadOnly="True" BorderThickness="1" Background="#93FFFFFF" AlternatingRowBackground="#C9F6F6F6" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" ItemsSource="{Binding Dispensers}" SelectedItem="{Binding SelectedDispenser}">
+ <controls:DoubleClickDataGrid Style="{StaticResource {x:Type DataGrid}}" DoubleClickCommand="{Binding ManageDispenserCommand}" Margin="0 0 0 10" BorderBrush="Silver" IsReadOnly="True" BorderThickness="1" Background="#93FFFFFF" AlternatingRowBackground="#C9F6F6F6" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" ItemsSource="{Binding Dispensers}" SelectedItem="{Binding SelectedDispenser}">
<DataGrid.CellStyle>
<Style TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}">
<Setter Property="BorderThickness" Value="0"/>
@@ -73,7 +74,7 @@
<DataGridTextColumn Header="INSTALLED" Binding="{Binding IsInstalled}" Width="Auto" />
<DataGridTextColumn Header="LAST UPDATED" Binding="{Binding LastUpdated,Converter={StaticResource DateTimeUTCToShortDateTimeConverter}}" Width="1*" />
</DataGrid.Columns>
- </DataGrid>
+ </controls:DoubleClickDataGrid>
</Grid>
</DockPanel>
</Grid>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs
index 044217c62..15033e295 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs
@@ -168,6 +168,9 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
/// </summary>
public RelayCommand RemoveSpoolCommand { get; set; }
+ /// <summary>
+ /// Gets or sets the clone machine command.
+ /// </summary>
public RelayCommand CloneMachineCommand { get; set; }
#endregion
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachinesView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachinesView.xaml
index c6587b564..faa6b1086 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachinesView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachinesView.xaml
@@ -7,6 +7,7 @@
xmlns:global="clr-namespace:Tango.MachineStudio.MachineDesigner"
xmlns:observables="clr-namespace:Tango.BL.Entities;assembly=Tango.BL"
xmlns:vm="clr-namespace:Tango.MachineStudio.MachineDesigner.ViewModels"
+ xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI"
xmlns:shapes="clr-namespace:Tango.SharedUI.Shapes;assembly=Tango.SharedUI"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI"
@@ -59,7 +60,7 @@
</StackPanel>
</Grid>
<Grid IsEnabled="{Binding IsFree}">
- <DataGrid Margin="0 0 0 10" SelectionMode="Single" SelectionUnit="FullRow" BorderBrush="Silver" IsReadOnly="True" BorderThickness="1" Background="#93FFFFFF" AlternatingRowBackground="#C9F6F6F6" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" ItemsSource="{Binding MachinesAdapter.Machines}" SelectedItem="{Binding SelectedMachine}">
+ <controls:DoubleClickDataGrid Style="{StaticResource {x:Type DataGrid}}" DoubleClickCommand="{Binding EditMachineCommand}" Margin="0 0 0 10" SelectionMode="Single" SelectionUnit="FullRow" BorderBrush="Silver" IsReadOnly="True" BorderThickness="1" Background="#93FFFFFF" AlternatingRowBackground="#C9F6F6F6" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" ItemsSource="{Binding MachinesAdapter.Machines}" SelectedItem="{Binding SelectedMachine}">
<DataGrid.CellStyle>
<Style TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}">
<Setter Property="BorderThickness" Value="0"/>
@@ -75,7 +76,7 @@
<DataGridTextColumn Header="DEMO MACHINE" Binding="{Binding IsDemo}" Width="Auto" />
<DataGridTextColumn Header="LAST UPDATED" Binding="{Binding LastUpdated,Converter={StaticResource DateTimeUTCToShortDateTimeConverter}}" Width="1*" />
</DataGrid.Columns>
- </DataGrid>
+ </controls:DoubleClickDataGrid>
</Grid>
</DockPanel>
</Grid>
diff --git a/Software/Visual_Studio/Tango.SharedUI/Controls/DoubleClickDataGrid.cs b/Software/Visual_Studio/Tango.SharedUI/Controls/DoubleClickDataGrid.cs
new file mode 100644
index 000000000..85b104aa8
--- /dev/null
+++ b/Software/Visual_Studio/Tango.SharedUI/Controls/DoubleClickDataGrid.cs
@@ -0,0 +1,37 @@
+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.Input;
+
+namespace Tango.SharedUI.Controls
+{
+ public class DoubleClickDataGrid : DataGrid
+ {
+ public ICommand DoubleClickCommand
+ {
+ get { return (ICommand)GetValue(DoubleClickCommandProperty); }
+ set { SetValue(DoubleClickCommandProperty, value); }
+ }
+ public static readonly DependencyProperty DoubleClickCommandProperty =
+ DependencyProperty.Register("DoubleClickCommand", typeof(ICommand), typeof(DoubleClickDataGrid), new PropertyMetadata(null));
+
+
+
+ public DoubleClickDataGrid()
+ {
+ this.MouseDoubleClick += DoubleClickDataGrid_MouseDoubleClick;
+ }
+
+ private void DoubleClickDataGrid_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
+ {
+ if (SelectedItem != null)
+ {
+ DoubleClickCommand?.Execute(SelectedItem);
+ }
+ }
+ }
+}
diff --git a/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj b/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj
index 65f2fe46b..a8bd06040 100644
--- a/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj
+++ b/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj
@@ -67,6 +67,7 @@
<Compile Include="Components\SelectedObjectCollection.cs" />
<Compile Include="Components\TextController.cs" />
<Compile Include="Controls\AdornerContentPresenter.cs" />
+ <Compile Include="Controls\DoubleClickDataGrid.cs" />
<Compile Include="Controls\HexagonControl.cs" />
<Compile Include="Controls\HiveControl.xaml.cs">
<DependentUpon>HiveControl.xaml</DependentUpon>
@@ -234,7 +235,7 @@
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>
- <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" />
+ <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" />
</VisualStudio>
</ProjectExtensions>
</Project> \ No newline at end of file