From d9a89773f2f283fbf5596799dd4d50d231817203 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Wed, 12 Dec 2018 18:23:24 +0200 Subject: IHotSpot Provider & IRemoteAssistance Provider. --- .../Build/Shortcuts/Machine Emulator.lnk | Bin 1445 -> 1471 bytes .../Build/Shortcuts/Machine Studio.lnk | Bin 1516 -> 1516 bytes .../Build/Shortcuts/Proto Compiler GUI.lnk | Bin 1444 -> 1464 bytes .../Views/JobView.xaml | 6 +- .../ViewModels/MainViewVM.cs | 54 +++++++++- .../Tango.PPC.MachineSettings/Views/MainView.xaml | 8 ++ .../Connectivity/IConnectivityProvider.cs | 18 ---- .../HotSpot/DefaultHotSpotProvider.cs | 114 ++++++++++++++++++++ .../Tango.PPC.Common/HotSpot/IHotSpotProvider.cs | 32 ++++++ .../MachineSetup/MachineSetupManager.cs | 88 ++++++++++------ .../PPC/Tango.PPC.Common/PPCSettings.cs | 5 + .../PPC/Tango.PPC.Common/PPCViewModel.cs | 14 +++ .../DefaultRemoteAssistanceProvider.cs | 115 +++++++++++++++++++++ .../RemoteAssistance/IRemoteAssistanceProvider.cs | 39 +++++++ .../PPC/Tango.PPC.Common/Scripting/CmdCommand.cs | 1 + .../PPC/Tango.PPC.Common/Tango.PPC.Common.csproj | 6 +- .../Connectivity/DefaultConnectivityProvider.cs | 57 ---------- .../PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs | 2 +- .../PPC/Tango.PPC.UI/Tango.PPC.UI.csproj | 6 +- .../PPC/Tango.PPC.UI/ViewModelLocator.cs | 6 ++ .../Visual_Studio/PPC/Tango.PPC.UI/app.manifest | 76 ++++++++++++++ .../PPC/Tango.PPC.Updater/Tango.PPC.Updater.csproj | 4 + .../PPC/Tango.PPC.Updater/app.manifest | 76 ++++++++++++++ 23 files changed, 612 insertions(+), 115 deletions(-) create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/HotSpot/DefaultHotSpotProvider.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/HotSpot/IHotSpotProvider.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteAssistance/DefaultRemoteAssistanceProvider.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteAssistance/IRemoteAssistanceProvider.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Updater/app.manifest (limited to 'Software/Visual_Studio') diff --git a/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk b/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk index 2577f9a96..83636b215 100644 Binary files a/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk and b/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk differ diff --git a/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk b/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk index fe3b0d60c..fdcc9c9f3 100644 Binary files a/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk and b/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk differ diff --git a/Software/Visual_Studio/Build/Shortcuts/Proto Compiler GUI.lnk b/Software/Visual_Studio/Build/Shortcuts/Proto Compiler GUI.lnk index a1cb5f5c1..bbe8a4be2 100644 Binary files a/Software/Visual_Studio/Build/Shortcuts/Proto Compiler GUI.lnk and b/Software/Visual_Studio/Build/Shortcuts/Proto Compiler GUI.lnk differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml index b9c27e4f9..4fba0cc0b 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml @@ -740,7 +740,11 @@ Segment Length - + + + + + 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(Enum.GetValues(typeof(JobTypes)).Cast().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 @@ + + + + + Enable Remote Assistance + + + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Connectivity/IConnectivityProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connectivity/IConnectivityProvider.cs index 077f05110..85c25128a 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Connectivity/IConnectivityProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connectivity/IConnectivityProvider.cs @@ -79,23 +79,5 @@ namespace Tango.PPC.Common.Connectivity /// The network. /// void Disconnect(WiFiNetwork network); - - /// - /// Gets a value indicating whether the hot spot network is active. - /// - bool IsHotspotActive { get; } - - /// - /// Enables the hot spot. - /// - /// The password. - /// - Task EnableHotSpot(String password); - - /// - /// Disables the hot spot. - /// - /// - Task DisableHotSpot(); } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/HotSpot/DefaultHotSpotProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/HotSpot/DefaultHotSpotProvider.cs new file mode 100644 index 000000000..1126a84bc --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/HotSpot/DefaultHotSpotProvider.cs @@ -0,0 +1,114 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core; +using Tango.PPC.Common.Application; +using Tango.PPC.Common.Connection; +using Tango.PPC.Common.Scripting; +using Tango.Settings; + +namespace Tango.PPC.Common.HotSpot +{ + /// + /// Represents the default hot spot provider. + /// + /// + /// + public class DefaultHotSpotProvider : ExtendedObject, IHotSpotProvider + { + private IMachineProvider _machineProvider; + + private bool _isEnabled; + /// + /// Gets a value indicating whether the hot spot network is active. + /// + public bool IsEnabled + { + get { return _isEnabled; } + private set { _isEnabled = value; RaisePropertyChangedAuto(); } + } + + /// + /// Initializes a new instance of the class. + /// + /// The application manager. + /// The machine provider. + public DefaultHotSpotProvider(IPPCApplicationManager applicationManager, IMachineProvider machineProvider) + { + _machineProvider = machineProvider; + applicationManager.ApplicationReady += ApplicationManager_ApplicationReady; + } + + /// + /// Handles the ApplicationReady event of the ApplicationManager. + /// + /// The source of the event. + /// The instance containing the event data. + private void ApplicationManager_ApplicationReady(object sender, EventArgs e) + { + Task.Factory.StartNew(async () => + { + var settings = SettingsManager.Default.GetOrCreate(); + + if (settings.EnableHotSpot) + { + try + { + await EnableHotSpot(settings.HotSpotPassword); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error starting on application startup."); + } + } + }); + } + + /// + /// Enables the hot spot. + /// + /// The password. + /// + public async Task EnableHotSpot(string password) + { + if (!IsEnabled) + { + try + { + CmdCommand command = new CmdCommand("netsh", $"wlan set hostednetwork mode=allow ssid='{"Tango_" + _machineProvider.Machine.SerialNumber}' key='{password}'"); + await command.Run(); + IsEnabled = true; + } + catch (Exception ex) + { + LogManager.Log(ex, "Error activating hot spot."); + throw; + } + } + } + + /// + /// Disables the hot spot. + /// + /// + public async Task DisableHotSpot() + { + if (IsEnabled) + { + try + { + CmdCommand command = new CmdCommand("netsh", "wlan stop hosted network"); + await command.Run(); + IsEnabled = false; + } + catch (Exception ex) + { + LogManager.Log(ex, "Error deactivating hot spot."); + throw; + } + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/HotSpot/IHotSpotProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/HotSpot/IHotSpotProvider.cs new file mode 100644 index 000000000..1a4dabae3 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/HotSpot/IHotSpotProvider.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Common.HotSpot +{ + /// + /// Represents a hot-spot network provider. + /// + public interface IHotSpotProvider + { + /// + /// Gets a value indicating whether the hot spot network is active. + /// + bool IsEnabled { get; } + + /// + /// Enables the hot spot. + /// + /// The password. + /// + Task EnableHotSpot(String password); + + /// + /// Disables the hot spot. + /// + /// + Task DisableHotSpot(); + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs index 3c70e0744..3d816c89a 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs @@ -74,14 +74,25 @@ namespace Tango.PPC.Common.MachineSetup { LogManager.Log($"Starting machine setup for serial number {serialNumber}..."); - //Connecting to machine... - LogManager.Log("Initiating machine connection..."); + IMachineOperator op = null; - UpdateProgress("Connecting to machine", "Connecting..."); - IMachineOperator op = await DefaultMachineProvider.CreateMinimalMachineOperator((msg) => + var demoMode = SettingsManager.Default.GetOrCreate().DemoMode; + + if (!demoMode) { - UpdateProgress("Connecting to machine", msg); - }); + //Connecting to machine... + LogManager.Log("Initiating machine connection..."); + + UpdateProgress("Connecting to machine", "Connecting..."); + op = await DefaultMachineProvider.CreateMinimalMachineOperator((msg) => + { + UpdateProgress("Connecting to machine", msg); + }); + } + else + { + LogManager.Log("Application in demo mode. Skipping machine connection..."); + } //Connect to machine service and get matching packages for this machine. UpdateProgress("Downloading software package", "Connecting to machine service..."); @@ -238,39 +249,50 @@ namespace Tango.PPC.Common.MachineSetup throw LogManager.Log(ex, "Setup manager error while trying to synchronize database."); } - //Updating firmware - UpdateProgress("Updating Firmware", "Connecting to firmware device..."); - LogManager.Log(""); - LogManager.Log("-------------------------------------------------------------------------"); - LogManager.Log("Updating Firmware..."); - - UpdateProgress("Updating Firmware", "Loading firmware package..."); - var tfpPath = Path.Combine(_newPackageTempFolder, "firmware_package.tfp"); - var stream = new FileStream(tfpPath, FileMode.Open); - var handler = await op.UpgradeFirmware(stream); - handler.Failed += (_, ex) => + if (!demoMode) { - stream.Dispose(); - result.SetException(ex); - }; - handler.Completed += (_, __) => + //Updating firmware + UpdateProgress("Updating Firmware", "Connecting to firmware device..."); + LogManager.Log(""); + LogManager.Log("-------------------------------------------------------------------------"); + LogManager.Log("Updating Firmware..."); + + UpdateProgress("Updating Firmware", "Loading firmware package..."); + var tfpPath = Path.Combine(_newPackageTempFolder, "firmware_package.tfp"); + var stream = new FileStream(tfpPath, FileMode.Open); + var handler = await op.UpgradeFirmware(stream); + handler.Failed += (_, ex) => + { + stream.Dispose(); + result.SetException(ex); + }; + handler.Completed += (_, __) => + { + UpdateProgress("Updating Firmware", "Firmware update completed successfully."); + stream.Dispose(); + result.SetResult(new MachineSetupResult() + { + UpdatePackagePath = _newPackageTempFolder, + }); + }; + handler.Canceled += (_, __) => + { + stream.Dispose(); + result.SetException(new Exception("The operation has been canceled.")); + }; + handler.Progress += (_, e) => + { + UpdateProgress("Updating Firmware", e.Message, false, e.Current, e.Total); + }; + } + else { - UpdateProgress("Updating Firmware", "Firmware update completed successfully."); - stream.Dispose(); + LogManager.Log("Application in demo mode. Skipping firmware upgrade..."); result.SetResult(new MachineSetupResult() { UpdatePackagePath = _newPackageTempFolder, }); - }; - handler.Canceled += (_, __) => - { - stream.Dispose(); - result.SetException(new Exception("The operation has been canceled.")); - }; - handler.Progress += (_, e) => - { - UpdateProgress("Updating Firmware", e.Message, false, e.Current, e.Total); - }; + } } catch (Exception ex) { diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs index b6ab9c163..142c3afe9 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs @@ -80,6 +80,11 @@ namespace Tango.PPC.Common /// public String HotSpotPassword { get; set; } + /// + /// Gets or sets a value indicating whether to enable team viewer service. + /// + public bool EnableRemoteAssistance { get; set; } + /// /// Initializes a new instance of the class. /// diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCViewModel.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCViewModel.cs index dc67d2137..289683855 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCViewModel.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCViewModel.cs @@ -11,9 +11,11 @@ using Tango.PPC.Common.Connection; using Tango.PPC.Common.Connectivity; using Tango.PPC.Common.EventLogging; using Tango.PPC.Common.ExternalBridge; +using Tango.PPC.Common.HotSpot; using Tango.PPC.Common.Navigation; using Tango.PPC.Common.Notifications; using Tango.PPC.Common.Printing; +using Tango.PPC.Common.RemoteAssistance; using Tango.PPC.Common.Storage; using Tango.Settings; using Tango.SharedUI; @@ -83,6 +85,18 @@ namespace Tango.PPC.Common [TangoInject] public IConnectivityProvider ConnectivityProvider { get; set; } + /// + /// Gets or sets the hot spot provider. + /// + [TangoInject] + public IHotSpotProvider HotSpotProvider { get; set; } + + /// + /// Gets or sets the remote assistance provider. + /// + [TangoInject] + public IRemoteAssistanceProvider RemoteAssistanceProvider { get; set; } + /// /// Gets or sets the storage provider. /// diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteAssistance/DefaultRemoteAssistanceProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteAssistance/DefaultRemoteAssistanceProvider.cs new file mode 100644 index 000000000..53596544a --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteAssistance/DefaultRemoteAssistanceProvider.cs @@ -0,0 +1,115 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core; +using Tango.PPC.Common.Connection; +using Tango.PPC.Common.Scripting; + +namespace Tango.PPC.Common.RemoteAssistance +{ + /// + /// Represents the default remote assistance provider. + /// + /// + /// + public class DefaultRemoteAssistanceProvider : ExtendedObject, IRemoteAssistanceProvider + { + private IMachineProvider _machineProvider; + + private bool _isEnabled; + /// + /// Gets a value indicating whether the remote assistance service is enabled. + /// + public bool IsEnabled + { + get { return _isEnabled; } + private set { _isEnabled = value; RaisePropertyChangedAuto(); } + } + + /// + /// Initializes a new instance of the class. + /// + /// The machine provider. + public DefaultRemoteAssistanceProvider(IMachineProvider machineProvider) + { + _machineProvider = machineProvider; + } + + /// + /// Enables the remote assistance. + /// + /// + public async Task EnableRemoteAssistance() + { + if (!IsEnabled) + { + try + { + CmdCommand command = new CmdCommand("sc.exe", "config TeamViewer start=auto"); + command.Timeout = TimeSpan.FromSeconds(10); + await command.Run(); + + command = new CmdCommand("net", "start TeamViewer"); + command.Timeout = TimeSpan.FromSeconds(10); + await command.Run(); + + IsEnabled = true; + } + catch (Exception ex) + { + LogManager.Log(ex, "Error enabling remote assistance."); + throw; + } + } + } + + /// + /// Disables the remote assistance. + /// + /// + public async Task DisableRemoteAssistance() + { + if (IsEnabled) + { + try + { + CmdCommand command = new CmdCommand("sc.exe", "config TeamViewer start=disabled"); + command.Timeout = TimeSpan.FromSeconds(10); + await command.Run(); + + command = new CmdCommand("net", "stop TeamViewer"); + command.Timeout = TimeSpan.FromSeconds(10); + await command.Run(); + IsEnabled = false; + } + catch (Exception ex) + { + LogManager.Log(ex, "Error disabling remote assistance."); + throw; + } + } + } + + /// + /// Installs the remote assistance. + /// + /// Name of the group. + /// Name of the computer. + /// + public async Task InstallRemoteAssistance(string groupName, string computerName) + { + try + { + CmdCommand command = new CmdCommand("msiexec.exe", $"/i \"C:\\Program Files(x86)\\TeamViewer\\TeamViewer_Host.msi\" /qn CUSTOMCONFIGID=ke43ann APITOKEN=4765529-gon1LwO1N1TTrlLI21ji ASSIGNMENTOPTIONS=\" --reassign --alias {"TANGO-" + _machineProvider.Machine.SerialNumber} --grant-easy-access\""); + await command.Run(); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error installing remote assistance."); + throw; + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteAssistance/IRemoteAssistanceProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteAssistance/IRemoteAssistanceProvider.cs new file mode 100644 index 000000000..288b5c652 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteAssistance/IRemoteAssistanceProvider.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Common.RemoteAssistance +{ + /// + /// Represents a remote assistance provider. + /// + public interface IRemoteAssistanceProvider + { + /// + /// Gets a value indicating whether the remote assistance service is enabled. + /// + bool IsEnabled { get; } + + /// + /// Enables the remote assistance. + /// + /// + Task EnableRemoteAssistance(); + + /// + /// Disables the remote assistance. + /// + /// + Task DisableRemoteAssistance(); + + /// + /// Installs the remote assistance. + /// + /// Name of the group. + /// Name of the computer. + /// + Task InstallRemoteAssistance(String groupName, String computerName); + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Scripting/CmdCommand.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Scripting/CmdCommand.cs index 2ee0d83d9..abae98f06 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Scripting/CmdCommand.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Scripting/CmdCommand.cs @@ -29,6 +29,7 @@ namespace Tango.PPC.Common.Scripting _process.StartInfo.RedirectStandardError = true; _process.StartInfo.RedirectStandardOutput = true; _process.StartInfo.Arguments = arguments; + _process.StartInfo.Verb = "runas"; Arguments = arguments; } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj b/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj index b9d9c7620..2f95d5060 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj @@ -128,6 +128,8 @@ + + @@ -158,6 +160,8 @@ + + @@ -326,7 +330,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Connectivity/DefaultConnectivityProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Connectivity/DefaultConnectivityProvider.cs index fbc619e12..a05e66f10 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Connectivity/DefaultConnectivityProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Connectivity/DefaultConnectivityProvider.cs @@ -138,18 +138,6 @@ namespace Tango.PPC.UI.Connectivity { await Connect(auto_connect_network); } - - if (settings.EnableHotSpot) - { - try - { - await EnableHotSpot(settings.HotSpotPassword); - } - catch (Exception ex) - { - LogManager.Log(ex, "Error starting on application startup."); - } - } }); } @@ -289,50 +277,5 @@ namespace Tango.PPC.UI.Connectivity IsConnected = connected; ConnectionStateChanged?.Invoke(this, new ConnectionStateEventArgs() { IsConnected = connected }); } - - /// - /// Enables the hot spot. - /// - /// The password. - /// - public async Task EnableHotSpot(string password) - { - if (!IsHotspotActive) - { - try - { - CmdCommand command = new CmdCommand("netsh", $"wlan set hostednetwork mode=allow ssid='{"Tango_" + _machineProvider.Machine.SerialNumber}' key='{password}'"); - await command.Run(); - IsHotspotActive = true; - } - catch (Exception ex) - { - LogManager.Log(ex, "Error activating hot spot."); - throw; - } - } - } - - /// - /// Disables the hot spot. - /// - /// - public async Task DisableHotSpot() - { - if (IsHotspotActive) - { - try - { - CmdCommand command = new CmdCommand("netsh", "wlan stop hosted network"); - await command.Run(); - IsHotspotActive = false; - } - catch (Exception ex) - { - LogManager.Log(ex, "Error deactivating hot spot."); - throw; - } - } - } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs index c21f513ae..740b0d203 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs @@ -8,4 +8,4 @@ using System.Windows; // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Tango PPC Application")] -[assembly: AssemblyVersion("2.0.13.1608")] +[assembly: AssemblyVersion("2.0.15.1608")] diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj index 786eca0c9..406568f71 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj @@ -50,6 +50,9 @@ prompt 4 + + app.manifest + ..\..\packages\ControlzEx.3.0.2.4\lib\net45\ControlzEx.dll @@ -253,6 +256,7 @@ ResXFileCodeGenerator Resources.Designer.cs + SettingsSingleFileGenerator @@ -468,7 +472,7 @@ del "$(TargetDir)firmware_package.tfp" - + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs index 11751d822..645456216 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs @@ -10,12 +10,14 @@ using Tango.PPC.Common.Connectivity; using Tango.PPC.Common.Diagnostics; using Tango.PPC.Common.EventLogging; using Tango.PPC.Common.ExternalBridge; +using Tango.PPC.Common.HotSpot; using Tango.PPC.Common.MachineSetup; using Tango.PPC.Common.MachineUpdate; using Tango.PPC.Common.Modules; using Tango.PPC.Common.Navigation; using Tango.PPC.Common.Notifications; using Tango.PPC.Common.Printing; +using Tango.PPC.Common.RemoteAssistance; using Tango.PPC.Common.Storage; using Tango.PPC.Common.Threading; using Tango.PPC.UI.Authentication; @@ -60,6 +62,8 @@ namespace Tango.PPC.UI TangoIOC.Default.Unregister(); TangoIOC.Default.Unregister(); TangoIOC.Default.Unregister(); + TangoIOC.Default.Unregister(); + TangoIOC.Default.Unregister(); TangoIOC.Default.Unregister(); TangoIOC.Default.Register(new DefaultDispatcherProvider(Application.Current.Dispatcher)); @@ -77,6 +81,8 @@ namespace Tango.PPC.UI TangoIOC.Default.Register(); TangoIOC.Default.Register(); TangoIOC.Default.Register(); + TangoIOC.Default.Register(); + TangoIOC.Default.Register(); TangoIOC.Default.Register(); //TangoIOC.Default.Register(new TeamFoundationServiceExtendedClient("https://twinetfs.visualstudio.com", String.Empty, "szzfokrceo4rhd4eqi5qpmxn3pa5iwl3q7tlqd36l2m7smz2ynoa")); diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest new file mode 100644 index 000000000..d72e75011 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Updater/Tango.PPC.Updater.csproj b/Software/Visual_Studio/PPC/Tango.PPC.Updater/Tango.PPC.Updater.csproj index 11cc17854..3f232c4d2 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Updater/Tango.PPC.Updater.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.Updater/Tango.PPC.Updater.csproj @@ -33,6 +33,9 @@ prompt 4 + + app.manifest + @@ -87,6 +90,7 @@ ResXFileCodeGenerator Resources.Designer.cs + SettingsSingleFileGenerator Settings.Designer.cs diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Updater/app.manifest b/Software/Visual_Studio/PPC/Tango.PPC.Updater/app.manifest new file mode 100644 index 000000000..d72e75011 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Updater/app.manifest @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.3.1