aboutsummaryrefslogtreecommitdiffstats
path: root/Software
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2020-12-23 14:37:21 +0200
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2020-12-23 14:37:21 +0200
commit673094ec9200776ff0867ee74be29dff3e275294 (patch)
treef39936ff09a0e16cb5ac0f2d528a3e1eaf288517 /Software
parent7b6ec0a4e66a4402d5ee0beb4b34b18604e28cd8 (diff)
downloadTango-673094ec9200776ff0867ee74be29dff3e275294.tar.gz
Tango-673094ec9200776ff0867ee74be29dff3e275294.zip
Added basic support for csv job.
Diffstat (limited to 'Software')
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportCsvJobView.xaml38
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportCsvJobView.xaml.cs28
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportCsvJobViewVM.cs76
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/csv.pngbin0 -> 2613 bytes
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj13
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs21
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest2
-rw-r--r--Software/Visual_Studio/Tango.Explorer/ExplorerFileDefinition.cs7
-rw-r--r--Software/Visual_Studio/Tango.Explorer/Images/csv.pngbin0 -> 2613 bytes
-rw-r--r--Software/Visual_Studio/Tango.Explorer/Tango.Explorer.csproj3
-rw-r--r--Software/Visual_Studio/Tango.Touch/Controls/TouchComboBox.xaml4
11 files changed, 188 insertions, 4 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportCsvJobView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportCsvJobView.xaml
new file mode 100644
index 000000000..e1caea66d
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportCsvJobView.xaml
@@ -0,0 +1,38 @@
+<UserControl x:Class="Tango.PPC.Jobs.Dialogs.ImportCsvJobView"
+ 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:local="clr-namespace:Tango.PPC.Jobs.Dialogs"
+ xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch"
+ mc:Ignorable="d"
+ Background="{StaticResource TangoPrimaryBackgroundBrush}" d:DesignHeight="555" d:DesignWidth="560" Width="570" Height="700" d:DataContext="{d:DesignInstance Type=local:ImportCsvJobViewVM, IsDesignTimeCreatable=False}">
+ <Grid Margin="20">
+ <DockPanel>
+ <Grid DockPanel.Dock="Bottom">
+ <touch:TouchButton HorizontalAlignment="Left" CornerRadius="25" Command="{Binding CloseCommand}" Style="{StaticResource TangoHollowButton}" Width="150" Height="50" VerticalAlignment="Bottom">CANCEL</touch:TouchButton>
+ <touch:TouchButton HorizontalAlignment="Right" CornerRadius="25" Command="{Binding OKCommand}" Style="{StaticResource TangoHollowButton}" Width="150" Height="50" VerticalAlignment="Bottom">IMPORT</touch:TouchButton>
+ </Grid>
+ <StackPanel>
+ <Grid HorizontalAlignment="Center">
+ <Image Source="../Images/job.png" Stretch="Uniform" Height="120"></Image>
+ <Image Source="../Images/csv.png" Stretch="Uniform" Height="48" HorizontalAlignment="Right" VerticalAlignment="Bottom" RenderOptions.BitmapScalingMode="Fant" Margin="10"></Image>
+ </Grid>
+ <TextBlock HorizontalAlignment="Center" Margin="0 20 0 0" FontSize="{StaticResource TangoHeaderFontSize}">IMPORT CSV JOB</TextBlock>
+ <TextBlock Margin="20 10" HorizontalAlignment="Center" TextWrapping="Wrap" TextAlignment="Center">A csv job file has been selected from the storage device. press 'IMPORT' to add the job to your job list.</TextBlock>
+
+ <StackPanel Margin="80">
+ <StackPanel>
+ <TextBlock FontSize="{StaticResource TangoSmallFontSize}">Job Name</TextBlock>
+ <touch:TouchTextBox Text="{Binding Name}" Watermark="Name" Margin="0 -2 0 0"></touch:TouchTextBox>
+ </StackPanel>
+
+ <StackPanel Margin="0 40 0 0">
+ <TextBlock FontSize="{StaticResource TangoSmallFontSize}">Thread Type</TextBlock>
+ <touch:TouchComboBox ItemsSource="{Binding Rmls}" SelectedItem="{Binding SelectedRml}" DisplayMemberPath="Name"></touch:TouchComboBox>
+ </StackPanel>
+ </StackPanel>
+ </StackPanel>
+ </DockPanel>
+ </Grid>
+</UserControl>
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportCsvJobView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportCsvJobView.xaml.cs
new file mode 100644
index 000000000..67fc5ec82
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportCsvJobView.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.PPC.Jobs.Dialogs
+{
+ /// <summary>
+ /// Interaction logic for ImportJobView.xaml
+ /// </summary>
+ public partial class ImportCsvJobView : UserControl
+ {
+ public ImportCsvJobView()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportCsvJobViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportCsvJobViewVM.cs
new file mode 100644
index 000000000..ffa406795
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportCsvJobViewVM.cs
@@ -0,0 +1,76 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.BL;
+using Tango.BL.Builders;
+using Tango.BL.Entities;
+using Tango.Core.Commands;
+using Tango.Core.DI;
+using Tango.PPC.Common;
+using Tango.PPC.Common.Connection;
+using Tango.Settings;
+using Tango.SharedUI;
+
+namespace Tango.PPC.Jobs.Dialogs
+{
+ public class ImportCsvJobViewVM : DialogViewVM
+ {
+ [TangoInject]
+ private IMachineProvider MachineProvider { get; set; }
+
+ private String _name;
+ public String Name
+ {
+ get { return _name; }
+ set { _name = value; RaisePropertyChangedAuto(); }
+ }
+
+ private List<Rml> _rmls;
+ public List<Rml> Rmls
+ {
+ get { return _rmls; }
+ set { _rmls = value; RaisePropertyChangedAuto(); }
+ }
+
+ private Rml _selectedRml;
+ public Rml SelectedRml
+ {
+ get { return _selectedRml; }
+ set { _selectedRml = value; RaisePropertyChangedAuto(); }
+ }
+
+ private bool _importAndEdit;
+ public bool ImportAndEdit
+ {
+ get { return _importAndEdit; }
+ set { _importAndEdit = value; RaisePropertyChangedAuto(); }
+ }
+
+ public ImportCsvJobViewVM()
+ {
+ TangoIOC.Default.Inject(this);
+ }
+
+ public async Task Init()
+ {
+ var settings = SettingsManager.Default.GetOrCreate<PPCSettings>();
+
+ using (ObservablesContext db = ObservablesContext.CreateDefault())
+ {
+ Rmls = await new RmlsCollectionBuilder(db).SetAll().ForHeadType(MachineProvider.Machine.MachineHeadType).ForSite(MachineProvider.Machine.SiteGuid).BuildListAsync();
+
+ if (settings.DefaultRmlGuid != null)
+ {
+ SelectedRml = Rmls.SingleOrDefault(x => x.Guid == settings.DefaultRmlGuid);
+ }
+
+ if (SelectedRml == null)
+ {
+ SelectedRml = Rmls.FirstOrDefault();
+ }
+ }
+ }
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/csv.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/csv.png
new file mode 100644
index 000000000..5ff44818b
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/csv.png
Binary files differ
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj
index 33b9de808..278b7376b 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj
@@ -92,6 +92,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
+ <Page Include="Dialogs\ImportCsvJobView.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ <SubType>Designer</SubType>
+ </Page>
<Page Include="Dialogs\ImportTwnFileView.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@@ -193,6 +197,10 @@
<DependentUpon>BasicColorCorrectionView.xaml</DependentUpon>
</Compile>
<Compile Include="Dialogs\BasicColorCorrectionViewVM.cs" />
+ <Compile Include="Dialogs\ImportCsvJobView.xaml.cs">
+ <DependentUpon>ImportCsvJobView.xaml</DependentUpon>
+ </Compile>
+ <Compile Include="Dialogs\ImportCsvJobViewVM.cs" />
<Compile Include="Dialogs\ImportTwnFileView.xaml.cs">
<DependentUpon>ImportTwnFileView.xaml</DependentUpon>
</Compile>
@@ -506,10 +514,13 @@
<ItemGroup>
<Resource Include="Images\sync_job.png" />
</ItemGroup>
+ <ItemGroup>
+ <Resource Include="Images\csv.png" />
+ </ItemGroup>
<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
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs
index 64931cbe3..4ae98b1d0 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs
@@ -738,6 +738,7 @@ namespace Tango.PPC.Jobs.ViewModels
StorageProvider.RegisterFileHandler(ExplorerFileDefinition.Job.Extension, HandleJobFileLoaded);
StorageProvider.RegisterFileHandler(ExplorerFileDefinition.ColorProfile.Extension, HandleColorProfileFileLoaded);
StorageProvider.RegisterFileHandler(ExplorerFileDefinition.Pulse.Extension, HandlePulseFileLoaded);
+ StorageProvider.RegisterFileHandler(ExplorerFileDefinition.CsvFile.Extension, HandleCsvJobFileLoaded);
//Load catalogs.
using (ObservablesContext db = ObservablesContext.CreateDefault())
@@ -873,6 +874,26 @@ namespace Tango.PPC.Jobs.ViewModels
#endregion
+ #region Handle CSV Job File Loading From Storage
+
+ private async void HandleCsvJobFileLoaded(List<ExplorerFileItem> files)
+ {
+ var item = files.FirstOrDefault();
+ if (item == null) return;
+
+ var vm = new ImportCsvJobViewVM();
+ vm.Name = Path.GetFileNameWithoutExtension(item.Name);
+ await vm.Init();
+ await NotificationProvider.ShowDialog<ImportCsvJobViewVM>(vm);
+
+ if (vm.DialogResult)
+ {
+
+ }
+ }
+
+ #endregion
+
#region Handle TCC File Loading From Storage
private async void HandleColorProfileFileLoaded(List<ExplorerFileItem> tccFiles)
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest
index d72e75011..efc5f8179 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest
@@ -16,7 +16,7 @@
Remove this element if your application requires this virtualization for backwards
compatibility.
-->
- <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
+ <!--<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />-->
</requestedPrivileges>
</security>
</trustInfo>
diff --git a/Software/Visual_Studio/Tango.Explorer/ExplorerFileDefinition.cs b/Software/Visual_Studio/Tango.Explorer/ExplorerFileDefinition.cs
index d9c5d61e7..a1c4a05ae 100644
--- a/Software/Visual_Studio/Tango.Explorer/ExplorerFileDefinition.cs
+++ b/Software/Visual_Studio/Tango.Explorer/ExplorerFileDefinition.cs
@@ -70,6 +70,13 @@ namespace Tango.Explorer
Extension = ".tfp",
};
+ public static ExplorerFileDefinition CsvFile => new ExplorerFileDefinition()
+ {
+ Icon = ResourceHelper.GetImageFromResources("/Images/csv.png"),
+ Description = "CSV File",
+ Extension = ".csv",
+ };
+
static ExplorerFileDefinition()
{
_definitions = typeof(ExplorerFileDefinition).GetProperties(BindingFlags.Public | BindingFlags.Static).Where(x => x.PropertyType == typeof(ExplorerFileDefinition)).ToList().Select(x => x.GetValue(null, null) as ExplorerFileDefinition).ToList();
diff --git a/Software/Visual_Studio/Tango.Explorer/Images/csv.png b/Software/Visual_Studio/Tango.Explorer/Images/csv.png
new file mode 100644
index 000000000..5ff44818b
--- /dev/null
+++ b/Software/Visual_Studio/Tango.Explorer/Images/csv.png
Binary files differ
diff --git a/Software/Visual_Studio/Tango.Explorer/Tango.Explorer.csproj b/Software/Visual_Studio/Tango.Explorer/Tango.Explorer.csproj
index 5412405ef..3e791d54b 100644
--- a/Software/Visual_Studio/Tango.Explorer/Tango.Explorer.csproj
+++ b/Software/Visual_Studio/Tango.Explorer/Tango.Explorer.csproj
@@ -117,5 +117,8 @@
<ItemGroup>
<Resource Include="Images\firmware.png" />
</ItemGroup>
+ <ItemGroup>
+ <Resource Include="Images\csv.png" />
+ </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> \ No newline at end of file
diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchComboBox.xaml b/Software/Visual_Studio/Tango.Touch/Controls/TouchComboBox.xaml
index 738fe6a3c..f8ee069f0 100644
--- a/Software/Visual_Studio/Tango.Touch/Controls/TouchComboBox.xaml
+++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchComboBox.xaml
@@ -31,7 +31,7 @@
<DataTemplate>
<Border>
<DockPanel>
- <Label VerticalAlignment="Center" Padding="30" FontSize="{StaticResource TangoComboBoxItemFontSize}">
+ <Label VerticalAlignment="Center" Padding="30" Foreground="{StaticResource TangoDarkForegroundBrush}" FontSize="{StaticResource TangoComboBoxItemFontSize}">
<Label.Style>
<Style TargetType="Label">
<Setter Property="Background" Value="Transparent"></Setter>
@@ -64,7 +64,7 @@
<Setter Property="SelectedItemTemplate">
<Setter.Value>
<DataTemplate>
- <Label VerticalAlignment="Center" Padding="5 5 5 2">
+ <Label VerticalAlignment="Center" Padding="5 5 5 2" Foreground="{StaticResource TangoDarkForegroundBrush}">
<Label.Content>
<MultiBinding Converter="{StaticResource DisplayMemberPathConverter}">
<Binding Path="." />