diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-12-12 18:23:24 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-12-12 18:23:24 +0200 |
| commit | d9a89773f2f283fbf5596799dd4d50d231817203 (patch) | |
| tree | d213bc8024342356dc54654235b77decbdbd26b8 /Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings | |
| parent | de0b06ac48e9765914f4e07c0e03497033066296 (diff) | |
| download | Tango-d9a89773f2f283fbf5596799dd4d50d231817203.tar.gz Tango-d9a89773f2f283fbf5596799dd4d50d231817203.zip | |
IHotSpot Provider & IRemoteAssistance Provider.
Diffstat (limited to 'Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings')
| -rw-r--r-- | Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs | 54 | ||||
| -rw-r--r-- | Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml | 8 |
2 files changed, 59 insertions, 3 deletions
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 267012e2e..7c6bed928 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 @@ -72,6 +72,13 @@ namespace Tango.PPC.MachineSettings.ViewModels set { _externalBridgePassword = value; RaisePropertyChangedAuto(); } } + private bool _enableRemoteAssistance; + public bool EnableRemoteAssistance + { + get { return _enableRemoteAssistance; } + set { _enableRemoteAssistance = value; RaisePropertyChangedAuto(); OnEnableRemoteAssistanceChanged(); } + } + #endregion #region Commands @@ -137,13 +144,54 @@ namespace Tango.PPC.MachineSettings.ViewModels Machine = new Machine(); MachineProvider.Machine.ShallowCopyTo(Machine); RaisePropertyChanged(nameof(Machine)); - _enableHotSpot = ConnectivityProvider.IsHotspotActive; + + _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()); } + 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) @@ -158,7 +206,7 @@ namespace Tango.PPC.MachineSettings.ViewModels try { - await ConnectivityProvider.EnableHotSpot(HotSpotPassword); + await HotSpotProvider.EnableHotSpot(HotSpotPassword); } catch { @@ -170,7 +218,7 @@ namespace Tango.PPC.MachineSettings.ViewModels { try { - await ConnectivityProvider.DisableHotSpot(); + await HotSpotProvider.DisableHotSpot(); } catch { 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 7a64891c9..337647790 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 @@ -108,6 +108,14 @@ </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> |
