aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2019-01-02 08:47:29 +0200
committerShlomo Hecht <shlomo@twine-s.com>2019-01-02 08:47:29 +0200
commit520e878bf98efcec9c75abcfe483175ff72620a2 (patch)
tree62a7221e3c22187821f6a5e399eca0f7bd31168a /Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings
parent30574fe4a6e1bb4f60a43e9000acaf919811689a (diff)
parent25f5e6ddef7ef2fa0a747305847eeb4ceee5a2c9 (diff)
downloadTango-520e878bf98efcec9c75abcfe483175ff72620a2.tar.gz
Tango-520e878bf98efcec9c75abcfe483175ff72620a2.zip
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings')
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Tango.PPC.MachineSettings.csproj6
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs154
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml53
3 files changed, 201 insertions, 12 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Tango.PPC.MachineSettings.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Tango.PPC.MachineSettings.csproj
index 9d44a6a63..e8d5b49d6 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Tango.PPC.MachineSettings.csproj
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Tango.PPC.MachineSettings.csproj
@@ -121,6 +121,10 @@
<Project>{b112d89a-a106-41ae-a0c1-4abc84c477f5}</Project>
<Name>Tango.DragAndDrop</Name>
</ProjectReference>
+ <ProjectReference Include="..\..\..\Tango.Integration\Tango.Integration.csproj">
+ <Project>{4206ac58-3b57-4699-8835-90bf6db01a61}</Project>
+ <Name>Tango.Integration</Name>
+ </ProjectReference>
<ProjectReference Include="..\..\..\Tango.Logging\Tango.Logging.csproj">
<Project>{bc932dbd-7cdb-488c-99e4-f02cf441f55e}</Project>
<Name>Tango.Logging</Name>
@@ -160,7 +164,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/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs
index 6bbe1c47b..7896367ec 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
+using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -43,6 +44,47 @@ namespace Tango.PPC.MachineSettings.ViewModels
set { _selectedJobTypes = value; RaisePropertyChangedAuto(); }
}
+ private SelectedObjectCollection<ColorSpaces> _selectedColorSpaces;
+ public SelectedObjectCollection<ColorSpaces> SelectedColorSpaces
+ {
+ get { return _selectedColorSpaces; }
+ set { _selectedColorSpaces = value; RaisePropertyChangedAuto(); }
+ }
+
+ private bool _enableHotSpot;
+ public bool EnableHotSpot
+ {
+ get { return _enableHotSpot; }
+ set { _enableHotSpot = value; RaisePropertyChangedAuto(); OnEnableHotSpotChanged(); }
+ }
+
+ private String _hotSpotPassword;
+ public String HotSpotPassword
+ {
+ get { return _hotSpotPassword; }
+ set { _hotSpotPassword = value; RaisePropertyChangedAuto(); }
+ }
+
+ private bool _enableExternalBridge;
+ public bool EnableExternalBridge
+ {
+ get { return _enableExternalBridge; }
+ set { _enableExternalBridge = value; RaisePropertyChangedAuto(); OnEnableExternalBridgeChanged(); }
+ }
+
+ private String _externalBridgePassword;
+ public String ExternalBridgePassword
+ {
+ get { return _externalBridgePassword; }
+ set { _externalBridgePassword = value; RaisePropertyChangedAuto(); }
+ }
+
+ private bool _enableRemoteAssistance;
+ public bool EnableRemoteAssistance
+ {
+ get { return _enableRemoteAssistance; }
+ set { _enableRemoteAssistance = value; RaisePropertyChangedAuto(); OnEnableRemoteAssistanceChanged(); }
+ }
#endregion
@@ -73,10 +115,26 @@ namespace Tango.PPC.MachineSettings.ViewModels
private async void Save()
{
- Machine.SupportedJobTypes = SelectedJobTypes.SynchedSource.ToList();
- Machine.ShallowCopyTo(MachineProvider.Machine);
- await MachineProvider.SaveMachine();
- await NavigationManager.NavigateBack();
+ if (Validate())
+ {
+ Machine.SupportedJobTypes = SelectedJobTypes.SynchedSource.ToList();
+ Machine.SupportedColorSpaces = SelectedColorSpaces.SynchedSource.ToList();
+ Machine.ShallowCopyTo(MachineProvider.Machine);
+
+ Settings.EnableHotSpot = EnableHotSpot;
+ Settings.HotSpotPassword = HotSpotPassword;
+ Settings.EnableExternalBridge = EnableExternalBridge;
+ Settings.ExternalBridgePassword = ExternalBridgePassword;
+ Settings.Save();
+
+ await MachineProvider.SaveMachine();
+ await NavigationManager.NavigateBack();
+ }
+ }
+
+ protected override void OnValidating()
+ {
+ base.OnValidating();
}
/// <summary>
@@ -95,7 +153,95 @@ namespace Tango.PPC.MachineSettings.ViewModels
MachineProvider.Machine.ShallowCopyTo(Machine);
RaisePropertyChanged(nameof(Machine));
+ _enableHotSpot = HotSpotProvider.IsEnabled;
+ RaisePropertyChanged(nameof(EnableHotSpot));
+
+ HotSpotPassword = Settings.HotSpotPassword;
+
+ _enableExternalBridge = ExternalBridgeService.Enabled;
+ RaisePropertyChanged(nameof(EnableExternalBridge));
+
+ ExternalBridgePassword = Settings.ExternalBridgePassword;
+
+ _enableRemoteAssistance = RemoteAssistanceProvider.IsEnabled;
+ RaisePropertyChanged(nameof(EnableRemoteAssistance));
+
+
SelectedJobTypes = new SelectedObjectCollection<JobTypes>(Enum.GetValues(typeof(JobTypes)).Cast<JobTypes>().ToObservableCollection(), Machine.SupportedJobTypes.ToObservableCollection());
+ SelectedColorSpaces = new SelectedObjectCollection<ColorSpaces>(Enum.GetValues(typeof(ColorSpaces)).Cast<ColorSpaces>().Where(x => x.IsUserSpace()).ToObservableCollection(), Machine.SupportedColorSpaces.ToObservableCollection());
+ }
+
+ private async void OnEnableRemoteAssistanceChanged()
+ {
+ if (EnableRemoteAssistance)
+ {
+ try
+ {
+ await RemoteAssistanceProvider.EnableRemoteAssistance();
+ }
+ catch
+ {
+ await NotificationProvider.ShowError("An error occurred while trying to activate the remote assistance service. Please check your device settings and try again.");
+ _enableRemoteAssistance = false;
+ }
+ }
+ else
+ {
+ try
+ {
+ await RemoteAssistanceProvider.DisableRemoteAssistance();
+ }
+ catch
+ {
+ await NotificationProvider.ShowError("An error occurred while trying to deactivate the remote assistance service. Please check your device settings and try again.");
+ _enableRemoteAssistance = true;
+ }
+ }
+
+ RaisePropertyChanged(nameof(EnableRemoteAssistance));
+ }
+
+ private async void OnEnableHotSpotChanged()
+ {
+ if (EnableHotSpot)
+ {
+ if (HotSpotPassword == null || HotSpotPassword.Length < 8 || HotSpotPassword.Length > 16)
+ {
+ await NotificationProvider.ShowError("Hot spot requires a password of 8 to 16 characters.");
+ _enableHotSpot = false;
+ RaisePropertyChanged(nameof(EnableHotSpot));
+ return;
+ }
+
+ try
+ {
+ await HotSpotProvider.EnableHotSpot(HotSpotPassword);
+ }
+ catch
+ {
+ await NotificationProvider.ShowError("An error occurred while trying to activate the hot spot network. Please check your device settings and try again.");
+ _enableHotSpot = false;
+ }
+ }
+ else
+ {
+ try
+ {
+ await HotSpotProvider.DisableHotSpot();
+ }
+ catch
+ {
+ await NotificationProvider.ShowError("An error occurred while trying to deactivate the hot spot network.");
+ _enableHotSpot = true;
+ }
+ }
+
+ RaisePropertyChanged(nameof(EnableHotSpot));
+ }
+
+ private void OnEnableExternalBridgeChanged()
+ {
+ ExternalBridgeService.Enabled = EnableExternalBridge;
}
}
}
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml
index 4823f0811..d1de12664 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml
@@ -43,6 +43,15 @@
<touch:TouchExpander Header="Connectivity" IsExpanded="True" FontSize="{StaticResource TangoExpanderHeaderFontSize}">
<StackPanel Margin="10 30 10 10">
<connectivity:AvailableWiFiConnectionsControl DataContext="{Binding ConnectivityProvider}" />
+
+ <controls:TableGrid Margin="10" RowHeight="60" MakeFirstColumnVerticalAlignmentBottom="False" TextElement.FontSize="{StaticResource TangoDefaultFontSize}">
+ <TextBlock VerticalAlignment="Center">Enable Hot Spot</TextBlock>
+ <touch:TouchToggleSlider Style="{StaticResource TangoToggleButtonGrayAccent}" HorizontalAlignment="Right" Margin="0 0 110 0" Width="90" IsChecked="{Binding EnableHotSpot}"></touch:TouchToggleSlider>
+
+
+ <TextBlock VerticalAlignment="Bottom">Hot Spot Password</TextBlock>
+ <touch:TouchTextBox IsPassword="True" Watermark="•••••••" HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="200" Text="{Binding HotSpotPassword}" KeyboardContainer="{Binding ElementName=Container}"></touch:TouchTextBox>
+ </controls:TableGrid>
</StackPanel>
</touch:TouchExpander>
@@ -50,10 +59,10 @@
<touch:TouchExpander Margin="0 20 0 0" Header="External Bridge" IsExpanded="True" FontSize="{StaticResource TangoExpanderHeaderFontSize}">
<controls:TableGrid Margin="10" RowHeight="70" MakeFirstColumnVerticalAlignmentBottom="False" TextElement.FontSize="{StaticResource TangoDefaultFontSize}">
<TextBlock VerticalAlignment="Center">Enable External Bridge Service</TextBlock>
- <touch:TouchToggleSlider Style="{StaticResource TangoToggleButtonGrayAccent}" HorizontalAlignment="Right" Margin="0 0 110 0" Width="90" IsChecked="{Binding Machine.EnableExternalBridge}"></touch:TouchToggleSlider>
+ <touch:TouchToggleSlider Style="{StaticResource TangoToggleButtonGrayAccent}" HorizontalAlignment="Right" Margin="0 0 110 0" Width="90" IsChecked="{Binding EnableExternalBridge}"></touch:TouchToggleSlider>
<TextBlock VerticalAlignment="Bottom">External Bridge Password</TextBlock>
- <touch:TouchTextBox IsPassword="True" HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="200" Text="{Binding Machine.ExternalBridgePassword}" KeyboardContainer="{Binding ElementName=Container}"></touch:TouchTextBox>
+ <touch:TouchTextBox IsPassword="True" Watermark="•••••••" HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="200" Text="{Binding ExternalBridgePassword}" KeyboardContainer="{Binding ElementName=Container}"></touch:TouchTextBox>
</controls:TableGrid>
</touch:TouchExpander>
@@ -85,20 +94,50 @@
</ItemsControl.ItemTemplate>
</ItemsControl>
+ <TextBlock VerticalAlignment="Center">Supported Color Spaces/Catalogs</TextBlock>
+ <ItemsControl ItemsSource="{Binding SelectedColorSpaces}">
+ <ItemsControl.ItemsPanel>
+ <ItemsPanelTemplate>
+ <WrapPanel IsItemsHost="True" Orientation="Horizontal" />
+ </ItemsPanelTemplate>
+ </ItemsControl.ItemsPanel>
+ <ItemsControl.ItemTemplate>
+ <DataTemplate>
+ <touch:TouchToggleButton IsChecked="{Binding IsSelected}" Content="{Binding Data}" CornerRadius="5" CheckedContent="{Binding Data}" Padding="10" Margin="5">
+ <touch:TouchToggleButton.Style>
+ <Style TargetType="touch:TouchToggleButton">
+ <Setter Property="Background" Value="{StaticResource TangoGrayBrush}"></Setter>
+ <Style.Triggers>
+ <Trigger Property="IsChecked" Value="True">
+ <Setter Property="Background" Value="{StaticResource TangoMidAccentBrush}"></Setter>
+ </Trigger>
+ </Style.Triggers>
+ </Style>
+ </touch:TouchToggleButton.Style>
+ </touch:TouchToggleButton>
+ </DataTemplate>
+ </ItemsControl.ItemTemplate>
+ </ItemsControl>
+
<TextBlock VerticalAlignment="Bottom">Default Media</TextBlock>
<touch:TouchComboBox HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="200" ItemsSource="{Binding Adapter.Rmls}" SelectedItem="{Binding Machine.DefaultRml}" DisplayMemberPath="Name"></touch:TouchComboBox>
- <TextBlock VerticalAlignment="Bottom">Default Color Space/Catalog</TextBlock>
- <touch:TouchComboBox HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="200" ItemsSource="{Binding Adapter.ColorSpaces}" SelectedItem="{Binding Machine.DefaultColorSpace}" DisplayMemberPath="Name"></touch:TouchComboBox>
-
- <TextBlock VerticalAlignment="Bottom">Default Spool</TextBlock>
- <touch:TouchComboBox HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="200" ItemsSource="{Binding Adapter.SpoolTypes}" SelectedItem="{Binding Machine.DefaultSpoolType}" DisplayMemberPath="Name"></touch:TouchComboBox>
+ <!--<TextBlock VerticalAlignment="Bottom">Default Spool</TextBlock>
+ <touch:TouchComboBox HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="200" ItemsSource="{Binding Adapter.SpoolTypes}" SelectedItem="{Binding Machine.DefaultSpoolType}" DisplayMemberPath="Name"></touch:TouchComboBox>-->
<TextBlock VerticalAlignment="Bottom">Default Segment Length</TextBlock>
<touch:TouchNumericTextBox HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="200" Minimum="1" Maximum="1000" Value="{Binding Machine.DefaultSegmentLength}" HasDecimalPoint="True" KeyboardContainer="{Binding ElementName=Container}"></touch:TouchNumericTextBox>
</controls:TableGrid>
</touch:TouchExpander>
+
+ <!--REMOTE ASSISTANCE-->
+ <touch:TouchExpander Margin="0 20 0 0" Header="Remote Assistance" IsExpanded="True" FontSize="{StaticResource TangoExpanderHeaderFontSize}">
+ <controls:TableGrid Margin="10" RowHeight="70" MakeFirstColumnVerticalAlignmentBottom="False" TextElement.FontSize="{StaticResource TangoDefaultFontSize}">
+ <TextBlock VerticalAlignment="Center">Enable Remote Assistance</TextBlock>
+ <touch:TouchToggleSlider Style="{StaticResource TangoToggleButtonGrayAccent}" HorizontalAlignment="Right" Margin="0 0 110 0" Width="90" IsChecked="{Binding EnableRemoteAssistance}"></touch:TouchToggleSlider>
+ </controls:TableGrid>
+ </touch:TouchExpander>
</StackPanel>
</touch:LightTouchScrollViewer>
</Grid>