diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-12-17 16:43:40 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-12-17 16:43:40 +0200 |
| commit | ae1cfd30f1efbd385eac04b3d02fa1ed161058a3 (patch) | |
| tree | 5b77d7484e80491b06f1b726a57a61c782b5569e /Software/Visual_Studio/PPC/Tango.PPC.Common | |
| parent | 8270aa37dee33cda98603a995de823df393f7294 (diff) | |
| download | Tango-ae1cfd30f1efbd385eac04b3d02fa1ed161058a3.tar.gz Tango-ae1cfd30f1efbd385eac04b3d02fa1ed161058a3.zip | |
Add AppButtons to PPC.
Implemented Stop & Start job app buttons!
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common')
6 files changed, 139 insertions, 3 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/HotSpot/DefaultHotSpotProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/HotSpot/DefaultHotSpotProvider.cs index 1126a84bc..5a6b2405c 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/HotSpot/DefaultHotSpotProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/HotSpot/DefaultHotSpotProvider.cs @@ -77,8 +77,12 @@ namespace Tango.PPC.Common.HotSpot { try { - CmdCommand command = new CmdCommand("netsh", $"wlan set hostednetwork mode=allow ssid='{"Tango_" + _machineProvider.Machine.SerialNumber}' key='{password}'"); + CmdCommand command = new CmdCommand("netsh", $"wlan set hostednetwork mode=allow ssid='{"Tango-" + _machineProvider.Machine.SerialNumber}' key='{password}'"); await command.Run(); + + command = new CmdCommand("netsh", "wlan start hosted network"); + await command.Run(); + IsEnabled = true; } catch (Exception ex) 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 ead508488..31e3290d8 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs @@ -136,7 +136,7 @@ namespace Tango.PPC.Common.MachineSetup LogManager.Log("Installing remote assistance..."); UpdateProgress("Installing remote assistance", "Installing..."); - await _remoteAssistance.InstallRemoteAssistance(); + //await _remoteAssistance.InstallRemoteAssistance(); //Create temporary folders for packages. var _newPackageTempFolder = TemporaryManager.CreateFolder(); diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/AppButton.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/AppButton.cs new file mode 100644 index 000000000..d5d6a0891 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/AppButton.cs @@ -0,0 +1,112 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core; +using Tango.Core.Commands; +using Tango.Core.DI; + +namespace Tango.PPC.Common.Notifications +{ + /// <summary> + /// Represents an app button that will be displayed in the layout view. + /// </summary> + /// <seealso cref="ExtendedObject" /> + public abstract class AppButton : ExtendedObject + { + /// <summary> + /// Occurs when the button has been pressed. + /// </summary> + public event Action Pressed; + + private String _text; + /// <summary> + /// Gets or sets the text. + /// </summary> + public String Text + { + get { return _text; } + set { _text = value; RaisePropertyChangedAuto(); } + } + + private bool _isEnabled; + /// <summary> + /// Gets or sets a value indicating whether this instance is enabled. + /// </summary> + public bool IsEnabled + { + get { return _isEnabled; } + set { _isEnabled = value; RaisePropertyChangedAuto(); } + } + + private RelayCommand _command; + /// <summary> + /// Gets or sets the command. + /// </summary> + public RelayCommand Command + { + get { return _command; } + set { _command = value; RaisePropertyChangedAuto(); } + } + + /// <summary> + /// Initializes a new instance of the <see cref="AppButton"/> class. + /// </summary> + public AppButton() + { + + } + + /// <summary> + /// Initializes a new instance of the <see cref="AppButton"/> class. + /// </summary> + /// <param name="text">The text.</param> + /// <param name="isEnabled">if set to <c>true</c> [is enabled].</param> + /// <param name="onExecute">The on execute.</param> + /// <param name="canExecute">The can execute.</param> + public AppButton(String text, bool isEnabled) : this() + { + Text = text; + IsEnabled = isEnabled; + Command = new RelayCommand(() => + { + Pressed?.Invoke(); + }); + } + + /// <summary> + /// Initializes a new instance of the <see cref="AppButton"/> class. + /// </summary> + /// <param name="text">The text.</param> + /// <param name="command">The command.</param> + public AppButton(String text, RelayCommand command) : this(text, true) + { + Command = command; + } + + /// <summary> + /// Invalidates the button state. + /// </summary> + public void RaiseCanExecute() + { + Command.RaiseCanExecuteChanged(); + } + + /// <summary> + /// Pops this instance. + /// </summary> + public void Pop() + { + TangoIOC.Default.GetInstance<INotificationProvider>().PopAppButton(this); + } + + /// <summary> + /// Pushes this instance. + /// </summary> + public void Push() + { + TangoIOC.Default.GetInstance<INotificationProvider>().PushAppButton(this); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/INotificationProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/INotificationProvider.cs index c43e96b10..c4e82b7d2 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/INotificationProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/INotificationProvider.cs @@ -58,6 +58,11 @@ namespace Tango.PPC.Common.Notifications FrameworkElement CurrentDialog { get; } /// <summary> + /// Gets the current app button. + /// </summary> + AppButton CurrentAppButton { get; } + + /// <summary> /// Gets a value indicating whether this instance has a dialog. /// </summary> bool HasDialog { get; } @@ -203,5 +208,17 @@ namespace Tango.PPC.Common.Notifications /// Gets or sets a value indicating whether to allow notifications visibility. /// </summary> bool NotificationsVisible { get; set; } + + /// <summary> + /// Pushes the app button. + /// </summary> + /// <param name="appButton">The app button.</param> + void PushAppButton(AppButton appButton); + + /// <summary> + /// Pops the app button. + /// </summary> + /// <param name="appButton">The app button.</param> + void PopAppButton(AppButton appButton); } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/Merged.xaml b/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/Merged.xaml index 01d69ecc9..266bef3eb 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/Merged.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/Merged.xaml @@ -44,6 +44,8 @@ <converters:ByteArrayToFileSizeConverter x:Key="ByteArrayToFileSizeConverter" /> <converters:EnumToVisibilityConverter x:Key="EnumToVisibilityConverter" /> <converters:DateTimeUTCToStringConverter x:Key="DateTimeUTCToStringConverter" /> + <converters:NullObjectToBooleanConverter x:Key="NullObjectToBooleanConverter" /> + <converters:IsNullToVisibilityConverter x:Key="IsNullToVisibilityConverter" /> <Style TargetType="FrameworkElement"> <Setter Property="TextElement.FontFamily" Value="{StaticResource TangoFlexoFontFamily}"></Setter> 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 2f95d5060..faea5ed41 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 @@ -150,6 +150,7 @@ <Compile Include="Navigation\INavigationObjectReceiver.cs" /> <Compile Include="Navigation\INavigationResultProvider.cs" /> <Compile Include="Notifications\AppBarItem.cs" /> + <Compile Include="Notifications\AppButton.cs" /> <Compile Include="Notifications\ItemBase.cs" /> <Compile Include="Notifications\NotificationItem.cs" /> <Compile Include="Notifications\NotificationItems\MessageNotificationItem.cs" /> @@ -330,7 +331,7 @@ </Target> <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 |
