aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-10-14 10:17:23 +0300
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-10-14 10:17:23 +0300
commit709f074dcd5cde75434fdb5c46b71e1cfcb22612 (patch)
treef2db75c40f1ab7127bee5df70818aa0160aaf244 /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician
parent5a1081358fb466d4368715c22b70b439251d8b30 (diff)
parent87437f979da7baf9a65d98140b361ee85d6966d5 (diff)
downloadTango-709f074dcd5cde75434fdb5c46b71e1cfcb22612.tar.gz
Tango-709f074dcd5cde75434fdb5c46b71e1cfcb22612.zip
MERGE
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/HeaterElementEditor.xaml2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj10
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/ImportProjectTabViewVM.cs25
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs64
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/ImportProjectTabView.xaml43
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/ImportProjectTabView.xaml.cs28
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml11
7 files changed, 172 insertions, 11 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/HeaterElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/HeaterElementEditor.xaml
index 3ffeaaa77..5c7d361ef 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/HeaterElementEditor.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/HeaterElementEditor.xaml
@@ -146,7 +146,7 @@
<ColumnDefinition Width="175"/>
</Grid.ColumnDefinitions>
- <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="Gray" FontSize="16" FontWeight="SemiBold">ITC</TextBlock>
+ <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="Gray" FontSize="16" FontWeight="SemiBold">TWI</TextBlock>
<Grid Grid.Column="1">
<Button Style="{x:Null}" Width="60" Height="60" HorizontalAlignment="Right" Cursor="Hand" Command="{Binding SetCommand}">
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj
index aca44f07f..4cb8c5cee 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj
@@ -289,8 +289,12 @@
<Compile Include="TechnicianModule.cs" />
<Compile Include="TechnicianModuleSettings.cs" />
<Compile Include="ViewModelLocator.cs" />
+ <Compile Include="ViewModels\ImportProjectTabViewVM.cs" />
<Compile Include="ViewModels\MachineTechTabVM.cs" />
<Compile Include="ViewModels\MachineTechViewVM.cs" />
+ <Compile Include="Views\ImportProjectTabView.xaml.cs">
+ <DependentUpon>ImportProjectTabView.xaml</DependentUpon>
+ </Compile>
<Compile Include="Views\MachineTechView.xaml.cs">
<DependentUpon>MachineTechView.xaml</DependentUpon>
</Compile>
@@ -482,6 +486,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
+ <Page Include="Views\ImportProjectTabView.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
<Page Include="Views\MachineTechView.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@@ -717,7 +725,7 @@
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>
- <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" />
+ <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" />
</VisualStudio>
</ProjectExtensions>
</Project> \ No newline at end of file
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/ImportProjectTabViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/ImportProjectTabViewVM.cs
new file mode 100644
index 000000000..751a563bf
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/ImportProjectTabViewVM.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.MachineStudio.Technician.Project;
+using Tango.SharedUI;
+using Tango.SharedUI.Components;
+
+namespace Tango.MachineStudio.Technician.ViewModels
+{
+ public class ImportProjectTabViewVM : DialogViewVM
+ {
+ public String ProjectName { get; set; }
+
+ public SelectedObjectCollection<MachineTechViewProjectTab> Tabs { get; set; }
+
+ public ImportProjectTabViewVM(List<MachineTechViewProjectTab> tabs, String projectName)
+ {
+ ProjectName = projectName;
+ Tabs = new SelectedObjectCollection<MachineTechViewProjectTab>(new ObservableCollection<MachineTechViewProjectTab>(tabs), new ObservableCollection<MachineTechViewProjectTab>());
+ }
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs
index 59cd6fe19..46d745139 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs
@@ -38,6 +38,7 @@ using Microsoft.WindowsAPICodePack.Dialogs;
using RealTimeGraphX;
using RealTimeGraphX.WPF.DataSeries;
using RealTimeGraphX.DataPoints;
+using Tango.MachineStudio.Technician.Views;
namespace Tango.MachineStudio.Technician.ViewModels
{
@@ -267,6 +268,15 @@ namespace Tango.MachineStudio.Technician.ViewModels
/// Gets or sets the rename tab command.
/// </summary>
public RelayCommand RenameTabCommand { get; set; }
+
+ /// <summary>
+ /// Gets or sets the import project tabs command.
+ /// </summary>
+ /// <value>
+ /// The import project tabs command.
+ /// </value>
+ public RelayCommand ImportProjectTabsCommand { get; set; }
+
#endregion
#region Constructors
@@ -340,6 +350,7 @@ namespace Tango.MachineStudio.Technician.ViewModels
RemoveTabCommand = new RelayCommand<MachineTechTabVM>(RemoveTab);
NewProjectCommand = new RelayCommand(CreateNewProject);
RenameTabCommand = new RelayCommand(RenameTab);
+ ImportProjectTabsCommand = new RelayCommand(ImportProjectTabs);
}
#endregion
@@ -1788,12 +1799,12 @@ namespace Tango.MachineStudio.Technician.ViewModels
/// Opens the specified project file path.
/// </summary>
/// <param name="fileName">File path.</param>
- public void OpenProjectFile(String fileName)
+ public MachineTechViewProject OpenProjectFile(String fileName, bool load = true)
{
+ MachineTechViewProject project = null;
+
try
{
- MachineTechViewProject project = null;
-
project = MachineTechViewProject.Load(fileName);
if (project.Tabs.Count == 0)
@@ -1807,27 +1818,35 @@ namespace Tango.MachineStudio.Technician.ViewModels
project.Tabs.Add(tab);
}
- LoadProject(project);
- _lastTechProjectFile = fileName;
+ if (load)
+ {
+ LoadProject(project);
+ _lastTechProjectFile = fileName;
+ }
}
catch (Exception ex)
{
LogManager.Log(ex, $"Error loading project file {fileName}.");
_notification.ShowError("An error occurred while trying to load the tech board project file.");
}
+
+ return project;
}
/// <summary>
/// Loads the specified project.
/// </summary>
/// <param name="project">The project.</param>
- public void LoadProject(MachineTechViewProject project)
+ public void LoadProject(MachineTechViewProject project, bool appendToCurrentProject = false)
{
using (_notification.PushTaskItem("Loading technician project file..."))
{
- Tabs.Clear();
- _singleControllers.Clear();
- _multiControllers.Clear();
+ if (!appendToCurrentProject)
+ {
+ Tabs.Clear();
+ _singleControllers.Clear();
+ _multiControllers.Clear();
+ }
foreach (var tab in project.Tabs)
{
@@ -2012,6 +2031,33 @@ namespace Tango.MachineStudio.Technician.ViewModels
}
}
+ /// <summary>
+ /// Imports a project file tabs to the current project.
+ /// </summary>
+ private void ImportProjectTabs()
+ {
+ OpenFileDialog dlg = new OpenFileDialog();
+ dlg.Title = "Select Technician Project File";
+ dlg.Filter = "Technician Project File|*.tpf";
+
+ if (dlg.ShowDialog().Value)
+ {
+ var project = OpenProjectFile(dlg.FileName, false);
+
+ if (project != null)
+ {
+ var vm = new ImportProjectTabViewVM(project.Tabs, Path.GetFileNameWithoutExtension(dlg.FileName));
+ _notification.ShowModalDialog<ImportProjectTabViewVM, ImportProjectTabView>(vm, (x) =>
+ {
+ project.Tabs.Clear();
+ project.Tabs.AddRange(vm.Tabs.SynchedSource.ToList());
+ LoadProject(project, true);
+
+ }, () => { });
+ }
+ }
+ }
+
#endregion
#region IStudioModuleVM
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/ImportProjectTabView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/ImportProjectTabView.xaml
new file mode 100644
index 000000000..b0d6b23fb
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/ImportProjectTabView.xaml
@@ -0,0 +1,43 @@
+<UserControl x:Class="Tango.MachineStudio.Technician.Views.ImportProjectTabView"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
+ xmlns:vm="clr-namespace:Tango.MachineStudio.Technician.ViewModels"
+ xmlns:local="clr-namespace:Tango.MachineStudio.Technician.Views"
+ mc:Ignorable="d"
+ d:DesignHeight="220" d:DesignWidth="600" Background="Transparent" Height="400" d:DataContext="{d:DesignInstance Type=vm:ImportProjectTabViewVM, IsDesignTimeCreatable=False}">
+ <Grid>
+ <DockPanel LastChildFill="True">
+ <StackPanel Orientation="Horizontal" VerticalAlignment="Bottom" HorizontalAlignment="Right" DockPanel.Dock="Bottom">
+ <Button Style="{StaticResource MaterialDesignFlatButton}" IsDefault="True" Margin="0 8 8 0" Command="{Binding OKCommand}">
+ IMPORT
+ </Button>
+ <Button Style="{StaticResource MaterialDesignFlatButton}" IsCancel="False" Margin="0 8 8 0" Command="{Binding CloseCommand}">
+ CANCEL
+ </Button>
+ </StackPanel>
+ <StackPanel DockPanel.Dock="Top" VerticalAlignment="Top" Margin="0 30 0 0">
+ <StackPanel Orientation="Horizontal">
+ <materialDesign:PackIcon Kind="Table" VerticalAlignment="Top" Width="50" Height="50" Foreground="#202020" />
+ <TextBlock Padding="0 10 0 0" TextWrapping="Wrap" Margin="10 0 0 0" VerticalAlignment="Top" FontSize="14" Text="IMPORT PROJECT TABS" Width="400"></TextBlock>
+ </StackPanel>
+ </StackPanel>
+
+ <Grid Margin="60 20 30 20">
+ <Border BorderThickness="1" BorderBrush="Gainsboro" Padding="5" CornerRadius="5">
+ <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
+ <ItemsControl ItemsSource="{Binding Tabs}">
+ <ItemsControl.ItemTemplate>
+ <DataTemplate>
+ <CheckBox Content="{Binding Data.Name}" IsChecked="{Binding IsSelected}" Margin="0 2" />
+ </DataTemplate>
+ </ItemsControl.ItemTemplate>
+ </ItemsControl>
+ </ScrollViewer>
+ </Border>
+ </Grid>
+ </DockPanel>
+ </Grid>
+</UserControl>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/ImportProjectTabView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/ImportProjectTabView.xaml.cs
new file mode 100644
index 000000000..31b403dc7
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/ImportProjectTabView.xaml.cs
@@ -0,0 +1,28 @@
+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.Navigation;
+using System.Windows.Shapes;
+
+namespace Tango.MachineStudio.Technician.Views
+{
+ /// <summary>
+ /// Interaction logic for ImportProjectTabView.xaml
+ /// </summary>
+ public partial class ImportProjectTabView : UserControl
+ {
+ public ImportProjectTabView()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml
index 3d129a252..0b2cad073 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml
@@ -147,6 +147,17 @@
<fa:ImageAwesome Icon="FolderOpen" Width="16" />
</MenuItem.Icon>
</MenuItem>
+ <MenuItem MinWidth="180" Header="Import" VerticalContentAlignment="Center">
+ <MenuItem.Icon>
+ <fa:ImageAwesome Icon="ArrowRight" Width="16" />
+ </MenuItem.Icon>
+
+ <MenuItem Header="Import Project Tabs" VerticalContentAlignment="Center" Command="{Binding ImportProjectTabsCommand}">
+ <MenuItem.Icon>
+ <fa:ImageAwesome Icon="Table" Width="16" />
+ </MenuItem.Icon>
+ </MenuItem>
+ </MenuItem>
<Separator/>
<MenuItem Header="Save" Command="{Binding SaveProjectCommand}">
<MenuItem.Icon>