diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-08-16 15:59:12 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-08-16 15:59:12 +0300 |
| commit | 04fd2234090e23ff2e648d997a1cc753c9354941 (patch) | |
| tree | 5624cfac25a0439ad6dfaae64132fbe5b62a50a0 /Software/Visual_Studio | |
| parent | 9dbb8f8eb3d07ee07cf7ce1beab72df056e157c6 (diff) | |
| download | Tango-04fd2234090e23ff2e648d997a1cc753c9354941.tar.gz Tango-04fd2234090e23ff2e648d997a1cc753c9354941.zip | |
Implemented full machine setup with connectivity and communication testing!
Fixed an issue with auto reset event on transport and logging :/
Diffstat (limited to 'Software/Visual_Studio')
15 files changed, 444 insertions, 165 deletions
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 281c68a77..5ecd170af 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs @@ -216,7 +216,7 @@ namespace Tango.PPC.Common.MachineSetup runner.Log += (x, msg) => { LogManager.Log(msg); - ProgressLog.Invoke(this, msg); + ProgressLog?.Invoke(this, msg); }; runner.ScriptExecuting += (x, item) => 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 ec51b9a98..d338b3ff1 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Connectivity/DefaultConnectivityProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Connectivity/DefaultConnectivityProvider.cs @@ -219,7 +219,6 @@ namespace Tango.PPC.UI.Connectivity { result = await network.Connect(auth); await RefreshAvailableWiFiNetworks(); - return result; } if (result) diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineSetupViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineSetupViewVM.cs index a81db331c..57c2200c6 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineSetupViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineSetupViewVM.cs @@ -8,6 +8,9 @@ using System.Threading.Tasks; using Tango.Core; using Tango.Core.Commands; using Tango.Core.Helpers; +using Tango.Integration.Operation; +using Tango.Logging; +using Tango.PMR.Connection; using Tango.PPC.Common; using Tango.PPC.Common.Application; using Tango.PPC.Common.MachineSetup; @@ -16,6 +19,7 @@ using Tango.PPC.UI.ViewsContracts; using Tango.Settings; using Tango.SharedUI.Helpers; using Tango.SQLExaminer; +using Tango.Transport.Adapters; namespace Tango.PPC.UI.ViewModels { @@ -36,6 +40,19 @@ namespace Tango.PPC.UI.ViewModels Failed, } + public enum MachineSetupView + { + WelcomeView, + WiFiSelectionView, + WiFiTestView, + EmbeddedWelcomeView, + EmbeddedTestView, + SetupWelcomeView, + SetupProgressView, + SetupCompletedView, + SetupFailedView, + } + private MachineSetupResult _setup_result; #region Properties @@ -85,19 +102,46 @@ namespace Tango.PPC.UI.ViewModels set { _state = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } } + private String _machineConnectionStatus; + public String MachineConnectionStatus + { + get { return _machineConnectionStatus; } + set { _machineConnectionStatus = value; RaisePropertyChangedAuto(); } + } + #endregion #region Commands /// <summary> - /// Gets or sets the start command. + /// Gets or sets the complete command. + /// </summary> + public RelayCommand CompleteCommand { get; set; } + + /// <summary> + /// Gets or sets the navigate to WiFi command. /// </summary> - public RelayCommand StartCommand { get; set; } + public RelayCommand NavigateToWiFiCommand { get; set; } /// <summary> - /// Gets or sets the complete command. + /// Gets or sets the skip embedded test command. /// </summary> - public RelayCommand CompleteCommand { get; set; } + public RelayCommand SkipEmbeddedTestCommand { get; set; } + + /// <summary> + /// Gets or sets the perform embedded test command. + /// </summary> + public RelayCommand PerformEmbeddedTestCommand { get; set; } + + /// <summary> + /// Gets or sets the install command. + /// </summary> + public RelayCommand InstallCommand { get; set; } + + /// <summary> + /// Gets or sets the restart command. + /// </summary> + public RelayCommand RestartCommand { get; set; } #endregion @@ -111,16 +155,31 @@ namespace Tango.PPC.UI.ViewModels public MachineSetupViewVM(IPPCApplicationManager applicationManager, IMachineSetupManager machineSetupManager) { MachineSetupManager = machineSetupManager; - MachineSetupManager.ProgressLog += (x, msg) => AppendLog(msg); + //MachineSetupManager.ProgressLog += (x, msg) => AppendLog(msg); MachineSetupManager.ProgressStep += (x, step) => AppendLog(Environment.NewLine + "-----------" + step.ToDescription().ToUpper() + "-----------" + Environment.NewLine); HostAddress = "localhost\\SQLEXPRESS"; SerialNumber = "1111"; - StartCommand = new RelayCommand(StartSetup, () => !String.IsNullOrWhiteSpace(HostAddress) && !String.IsNullOrWhiteSpace(SerialNumber) && State == MachineSetupStates.None); CompleteCommand = new RelayCommand(CompleteSetup, () => State == MachineSetupStates.Completed); applicationManager.SetupRequired += ApplicationManager_SetupRequired; + + NavigateToWiFiCommand = new RelayCommand(EnsureWiFi); + + PerformEmbeddedTestCommand = new RelayCommand(PerformEmbeddedTest); + SkipEmbeddedTestCommand = new RelayCommand(SkipEmbeddedTest); + InstallCommand = new RelayCommand(Install); + RestartCommand = new RelayCommand(() => { NavigateTo(MachineSetupView.WelcomeView); }); + + if (!LogManager.Categories.Contains(LogCategory.Debug)) + { + LogManager.Categories.Add(LogCategory.Debug); + } + + var logger = new SimpleStringLogger(); + LogManager.RegisterLogger(logger); + logger.LogReceived += Logger_LogReceived; } #endregion @@ -138,6 +197,12 @@ namespace Tango.PPC.UI.ViewModels NavigationManager.NavigateTo(NavigationView.MachineSetupView); } + + private void Logger_LogReceived(object sender, LogItemBase e) + { + AppendLog(e.Message); + } + #endregion #region Private Methods @@ -158,10 +223,142 @@ namespace Tango.PPC.UI.ViewModels } /// <summary> - /// Starts the setup. + /// Completes the setup. + /// </summary> + private void CompleteSetup() + { + String updater_exe = AssemblyHelper.GetCurrentAssemblyFolder() + "\\Tango.PPC.Updater.exe"; + + LogManager.Log("Completing machine setup..."); + LogManager.Log($"Executing '{updater_exe}' with arguments '{_setup_result.UpdatePackagePath}'..."); + Process.Start(updater_exe, _setup_result.UpdatePackagePath); + LogManager.Log("Terminating application process!"); + Environment.Exit(0); + } + + /// <summary> + /// Navigates to the specified view. /// </summary> - private async void StartSetup() + /// <param name="view">The view.</param> + private Task NavigateTo(MachineSetupView view) { + return View.NavigateTo(view); + } + + #endregion + + #region WiFi + + private async void EnsureWiFi() + { + await NavigateTo(MachineSetupView.WiFiTestView); + + await Task.Delay(2000); + + bool connected = await ConnectivityProvider.CheckInternetConnection(); + + if (connected) + { + await NavigateTo(MachineSetupView.EmbeddedWelcomeView); + } + else + { + await NavigateTo(MachineSetupView.WiFiSelectionView); + await ConnectivityProvider.RefreshAvailableWiFiNetworks(); + + ConnectivityProvider.ConnectionStateChanged += ConnectivityProvider_ConnectionStateChanged; + } + } + + private void ConnectivityProvider_ConnectionStateChanged(object sender, Common.Connectivity.ConnectionStateEventArgs e) + { + if (e.IsConnected) + { + ConnectivityProvider.ConnectionStateChanged -= ConnectivityProvider_ConnectionStateChanged; + EnsureWiFi(); + } + } + + #endregion + + #region Embedded + + private async void PerformEmbeddedTest() + { + await NavigateTo(MachineSetupView.EmbeddedTestView); + + try + { + MachineConnectionStatus = "Scanning for the machine..."; + + LogManager.Log("Starting machine connection procedure..."); + + TimeSpan timeout = TimeSpan.FromSeconds(SettingsManager.Default.GetOrCreate<PPCSettings>().MachineScanningTimeoutSeconds); + + LogManager.Log("Scanning for machine on available serial ports..."); + Transport.Discovery.UsbCommunicationScanner<ConnectRequest, ConnectResponse> scanner = new Transport.Discovery.UsbCommunicationScanner<ConnectRequest, ConnectResponse>(UsbSerialBaudRates.BR_9600); + + scanner.ScanningPort += (port) => + { + MachineConnectionStatus = $"Scanning for the machine on {port}..."; + }; + + var response = await scanner.Scan(new ConnectRequest() { Password = "1234" }, timeout); + + MachineConnectionStatus = "Machine discovered on port: " + response.Adapter.Address + ", trying to connect..."; + + LogManager.Log("Machine discovered on port: " + response.Adapter.Address); + LogManager.Log("Device Information:"); + LogManager.Log(response.Response.DeviceInformation.ToJsonString()); + + LogManager.Log("Disconnecting machine operator..."); + + IMachineOperator op = new MachineOperator(response.Adapter); + + op.EnableDiagnostics = false; + op.EnableEmbeddedDebugging = false; + op.EnableEventsNotification = false; + + LogManager.Log("Connecting machine operator..."); + await op.Connect(); + + MachineConnectionStatus = "Test completed successfully!"; + + await Task.Delay(1000); + + try + { + await op.Disconnect(); + } + catch { } + + await NavigateTo(MachineSetupView.SetupWelcomeView); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error while trying to scan and connect to the machine."); + MachineConnectionStatus = "Test Failed!"; + await Task.Delay(2000); + await NavigateTo(MachineSetupView.EmbeddedWelcomeView); + } + } + + private async void SkipEmbeddedTest() + { + if (await NotificationProvider.ShowQuestion("Are you sure you want to skip the machine communication test?")) + { + + } + } + + #endregion + + #region Setup + + private async void Install() + { + await NavigateTo(MachineSetupView.SetupProgressView); + LogManager.Log("Starting machine setup..."); State = MachineSetupStates.Working; @@ -172,31 +369,17 @@ namespace Tango.PPC.UI.ViewModels Settings.ApplicationState = ApplicationStates.SemiSetup; Settings.Save(); State = MachineSetupStates.Completed; - LogManager.Log("Machine setup completed."); + await NavigateTo(MachineSetupView.SetupCompletedView); } catch (Exception ex) { LogManager.Log(ex, "Machine setup failed."); State = MachineSetupStates.Failed; - await NotificationProvider.ShowInfo(ex.Message); + await NavigateTo(MachineSetupView.SetupFailedView); } } - /// <summary> - /// Completes the setup. - /// </summary> - private void CompleteSetup() - { - String updater_exe = AssemblyHelper.GetCurrentAssemblyFolder() + "\\Tango.PPC.Updater.exe"; - - LogManager.Log("Completing machine setup..."); - LogManager.Log($"Executing '{updater_exe}' with arguments '{_setup_result.UpdatePackagePath}'..."); - Process.Start(updater_exe, _setup_result.UpdatePackagePath); - LogManager.Log("Terminating application process!"); - Environment.Exit(0); - } - #endregion } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineSetupView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineSetupView.xaml index e67905eba..a097eeb45 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineSetupView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineSetupView.xaml @@ -4,17 +4,24 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:vm="clr-namespace:Tango.PPC.UI.ViewModels" + xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" xmlns:global="clr-namespace:Tango.PPC.UI" xmlns:setup="clr-namespace:Tango.PPC.Common.MachineSetup;assembly=Tango.PPC.Common" + xmlns:connectivity="clr-namespace:Tango.PPC.Common.Connectivity;assembly=Tango.PPC.Common" xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" xmlns:local="clr-namespace:Tango.PPC.UI.Views" mc:Ignorable="d" - d:DesignHeight="2000" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:MachineSetupViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MachineSetupViewVM}"> + d:DesignHeight="1280" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:MachineSetupViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MachineSetupViewVM}"> <Grid Background="{StaticResource TangoPrimaryBackgroundBrush}"> - <Grid x:Name="Container"> + <Grid> <DockPanel> - <Grid DockPanel.Dock="Bottom" Height="200" Background="{StaticResource TangoMidBackgroundBrush}" Visibility="{Binding State,Converter={StaticResource EnumToVisibilityConverter},ConverterParameter='Working,Failed,Completed'}"> + <StackPanel DockPanel.Dock="Top" HorizontalAlignment="Center" Margin="0 100 0 0"> + <Image Source="/Images/package.png" Width="180" Height="180" /> + <TextBlock HorizontalAlignment="Center" FontSize="{StaticResource TangoHeaderFontSize}" Margin="30">MACHINE SETUP WIZARD</TextBlock> + </StackPanel> + + <Grid DockPanel.Dock="Bottom" Height="200" Background="{StaticResource TangoMidBackgroundBrush}"> <Border BorderThickness="0 1 0 0" BorderBrush="{StaticResource TangoGrayBrush}"> <TextBox x:Name="txtLog" SelectionBrush="Transparent" IsReadOnly="True" Padding="5" Background="Transparent" AcceptsReturn="True" TextWrapping="Wrap" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto"> @@ -22,63 +29,129 @@ </Border> </Grid> - <StackPanel HorizontalAlignment="Center" Margin="0 200 0 0"> - <Image Source="/Images/package.png" Width="180" Height="180" /> - <TextBlock HorizontalAlignment="Center" Foreground="{StaticResource TangoPrimaryAccentBrush}" FontSize="{StaticResource TangoHeaderFontSize}" Margin="30">MACHINE SETUP</TextBlock> + <controls:NavigationControl x:Name="navigationControl" TransitionType="Slide" KeepElementsAttached="True" Margin="0 20 0 0" SelectedIndex="0"> + + <Grid controls:NavigationControl.NavigationName="WelcomeView"> + <StackPanel HorizontalAlignment="Center" Margin="0 100 0 0"> + <TextBlock TextAlignment="Center" LineHeight="20" Margin="20 0" TextWrapping="Wrap" FontSize="{StaticResource TangoTitleFontSize}"> + <Run>Welcome to the machine setup wizard!</Run> + <Run>In the next steps the software will gather required information, perform tests and apply an initial configuration to this machine.</Run> + <LineBreak/> + <LineBreak/> + <Run>Press 'START' to initiate the setup process.</Run> + </TextBlock> + + <touch:TouchButton Margin="0 250 0 0" Padding="20" Width="300" CornerRadius="35" Command="{Binding NavigateToWiFiCommand}">START</touch:TouchButton> + </StackPanel> + </Grid> + + <Grid controls:NavigationControl.NavigationName="WiFiSelectionView"> + <DockPanel> + <TextBlock DockPanel.Dock="Top" Margin="20 0" FontSize="{StaticResource TangoTitleFontSize}" HorizontalAlignment="Center" TextWrapping="Wrap" TextAlignment="Center"> + <Run>We need an active internet connection in order to fetch the latest software package and machine configuration.</Run> + <LineBreak/> + <LineBreak/> + <Run>Please connect to one of the available WiFi networks.</Run> + </TextBlock> + + <connectivity:AvailableWiFiConnectionsControl DataContext="{Binding ConnectivityProvider}" Margin="50 100 50 20" BorderBrush="{StaticResource TangoDividerBrush}" BorderThickness="0 1 0 0" /> + </DockPanel> + </Grid> + + <Grid controls:NavigationControl.NavigationName="WiFiTestView"> + <StackPanel HorizontalAlignment="Center" Margin="0 200 0 0"> + <TextBlock DockPanel.Dock="Top" Margin="20 0" FontSize="{StaticResource TangoTitleFontSize}" HorizontalAlignment="Center" TextWrapping="Wrap" TextAlignment="Center"> + Checking internet connection, please wait... + </TextBlock> + <touch:TouchBusyIndicator Width="250" Margin="0 100 0 0" Height="250" IsIndeterminate="True" /> + </StackPanel> + </Grid> - <StackPanel Visibility="{Binding State,Converter={StaticResource EnumToVisibilityConverter},ConverterParameter='None'}"> - <TextBlock TextAlignment="Center" LineHeight="25"> - <Run>This machine has not been configured yet and require several steps in order to be ready.</Run> - <LineBreak/> - <Run>Enter this machine serial number, synchronization server address and tap 'INSTALL'.</Run> - </TextBlock> + <Grid controls:NavigationControl.NavigationName="EmbeddedWelcomeView"> + <StackPanel HorizontalAlignment="Center" Margin="0 100 0 0"> + <TextBlock TextAlignment="Center" LineHeight="20" Margin="20 0" TextWrapping="Wrap" FontSize="{StaticResource TangoTitleFontSize}"> + <Run>It is recommended to perform a quick communication test with the machine before proceeding. Please turn on and connect the machine, then tap 'PERFORM TEST'.</Run> + </TextBlock> - <StackPanel Width="500" Margin="0 100 0 0" TextElement.FontSize="{StaticResource TangoTitleFontSize}"> - <TextBlock>SERIAL NUMBER</TextBlock> - <touch:TouchTextBox Foreground="{StaticResource TangoGrayTextBrush}" Margin="0 10 0 0" Text="{Binding SerialNumber}" KeyboardContainer="{Binding ElementName=Container}" /> + <StackPanel Orientation="Horizontal" Margin="0 250 0 0" HorizontalAlignment="Center"> + <touch:TouchButton Margin="10" Background="{StaticResource TangoGrayBrush}" Padding="20" Width="300" CornerRadius="35" Command="{Binding SkipEmbeddedTestCommand}">SKIP</touch:TouchButton> + <touch:TouchButton Margin="10" Padding="20" Width="300" CornerRadius="35" Command="{Binding PerformEmbeddedTestCommand}">PERFORM TEST</touch:TouchButton> + </StackPanel> + </StackPanel> + </Grid> + + <Grid controls:NavigationControl.NavigationName="EmbeddedTestView"> + <StackPanel HorizontalAlignment="Center" Margin="0 200 0 0"> + <TextBlock Text="{Binding MachineConnectionStatus}" DockPanel.Dock="Top" Margin="20 0" FontSize="{StaticResource TangoTitleFontSize}" HorizontalAlignment="Center" TextWrapping="Wrap" TextAlignment="Center"></TextBlock> + <touch:TouchProgressBar Height="20" Width="700" Margin="0 40 0 0" IsIndeterminate="True" /> + </StackPanel> + </Grid> + + <Grid controls:NavigationControl.NavigationName="SetupWelcomeView"> + <StackPanel> + <TextBlock TextAlignment="Center" LineHeight="25" FontSize="{StaticResource TangoTitleFontSize}" Margin="40 0" TextWrapping="Wrap"> + The next step is to download the latest software package and synchronize the machine data. Enter the machine serial number, service address and press 'INSTALL'. + </TextBlock> + + <StackPanel Width="500" Margin="0 100 0 0" TextElement.FontSize="{StaticResource TangoTitleFontSize}"> + <TextBlock>SERIAL NUMBER</TextBlock> + <touch:TouchTextBox Foreground="{StaticResource TangoGrayTextBrush}" Margin="0 10 0 0" Text="{Binding SerialNumber}" KeyboardContainer="{Binding ElementName=Container}" /> - <TextBlock Margin="0 40 0 0">MACHINE SERVICE ADDRESS</TextBlock> - <touch:TouchTextBox Foreground="{StaticResource TangoGrayTextBrush}" Margin="0 10 0 0" Text="{Binding HostAddress}" KeyboardContainer="{Binding ElementName=Container}" /> + <TextBlock Margin="0 80 0 0">MACHINE SERVICE ADDRESS</TextBlock> + <touch:TouchTextBox Foreground="{StaticResource TangoGrayTextBrush}" Margin="0 10 0 0" Text="{Binding HostAddress}" KeyboardContainer="{Binding ElementName=Container}" /> - <touch:TouchButton Margin="0 200 0 0" Padding="20" Width="300" CornerRadius="35" Command="{Binding StartCommand}">INSTALL</touch:TouchButton> + <touch:TouchButton Margin="0 200 0 0" Padding="20" Width="300" CornerRadius="35" Command="{Binding InstallCommand}">INSTALL</touch:TouchButton> + </StackPanel> </StackPanel> - </StackPanel> + </Grid> - <StackPanel Visibility="{Binding State,Converter={StaticResource EnumToVisibilityConverter},ConverterParameter='Working'}"> - <TextBlock TextAlignment="Center"> + <Grid controls:NavigationControl.NavigationName="SetupProgressView"> + <StackPanel> + <TextBlock TextAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}"> <Run>Please wait while we setting up this machine.</Run> <Run>Do not turn off this PC.</Run> - </TextBlock> + </TextBlock> - <touch:TouchBusyIndicator Width="100" Height="100" Margin="0 80 0 0"> - <touch:TouchBusyIndicator.Style> - <Style TargetType="touch:TouchBusyIndicator"> - <Setter Property="IsIndeterminate" Value="False"></Setter> - <Style.Triggers> - <DataTrigger Binding="{Binding State}" Value="Working"> - <Setter Property="IsIndeterminate" Value="True"></Setter> - </DataTrigger> - </Style.Triggers> - </Style> - </touch:TouchBusyIndicator.Style> - </touch:TouchBusyIndicator> - <touch:TouchStepProgressBar FontSize="10" Width="720" Height="50" Margin="0 100 0 0" ItemsSource="{Binding Source={x:Type setup:MachineSetupSteps},Converter={StaticResource EnumToItemsSourceConverter}}" SelectedValue="{Binding MachineSetupManager.CurrentStep}" SelectedValuePath="Value" DisplayMemberPath="DisplayName" /> + <touch:TouchBusyIndicator Width="100" Height="100" Margin="0 80 0 0"> + <touch:TouchBusyIndicator.Style> + <Style TargetType="touch:TouchBusyIndicator"> + <Setter Property="IsIndeterminate" Value="False"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding State}" Value="Working"> + <Setter Property="IsIndeterminate" Value="True"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </touch:TouchBusyIndicator.Style> + </touch:TouchBusyIndicator> + <touch:TouchStepProgressBar FontSize="10" Width="720" Height="50" Margin="0 100 0 0" ItemsSource="{Binding Source={x:Type setup:MachineSetupSteps},Converter={StaticResource EnumToItemsSourceConverter}}" SelectedValue="{Binding MachineSetupManager.CurrentStep}" SelectedValuePath="Value" DisplayMemberPath="DisplayName" /> - <StackPanel Margin="100 100 100 0" Visibility="{Binding MachineSetupManager.CurrentStep,Converter={StaticResource EnumToVisibilityConverter},ConverterParameter='DownloadingPackage'}"> - <TextBlock Text="{Binding MachineSetupManager.DownloadingPackagesStatus,Mode=OneWay}"></TextBlock> - <touch:TouchProgressBar Margin="0 10 0 0" Height="10" Maximum="100" Value="{Binding MachineSetupManager.DownloadingPackagesProgress,Mode=OneWay}" /> + <StackPanel Margin="100 100 100 0" Visibility="{Binding MachineSetupManager.CurrentStep,Converter={StaticResource EnumToVisibilityConverter},ConverterParameter='DownloadingPackage'}"> + <TextBlock Text="{Binding MachineSetupManager.DownloadingPackagesStatus,Mode=OneWay}"></TextBlock> + <touch:TouchProgressBar Margin="0 10 0 0" Height="10" Maximum="100" Value="{Binding MachineSetupManager.DownloadingPackagesProgress,Mode=OneWay}" /> + </StackPanel> </StackPanel> - </StackPanel> + </Grid> - <StackPanel Visibility="{Binding State,Converter={StaticResource EnumToVisibilityConverter},ConverterParameter='Completed'}"> + <Grid controls:NavigationControl.NavigationName="SetupCompletedView"> <StackPanel HorizontalAlignment="Center" Margin="0 50 0 0"> <touch:TouchIcon Icon="Check" Foreground="{StaticResource TangoPrimaryAccentBrush}" Width="70" Height="70" /> <TextBlock VerticalAlignment="Center" Margin="0 10 0 0" Foreground="{StaticResource TangoPrimaryAccentBrush}" FontSize="{StaticResource TangoTitleFontSize}">Setup completed successfully. Machine is ready!</TextBlock> + + <touch:TouchButton Margin="0 200 0 0" Padding="20" Width="300" CornerRadius="35" Command="{Binding CompleteCommand}">RESTART</touch:TouchButton> </StackPanel> + </Grid> - <touch:TouchButton Margin="0 200 0 0" Padding="20" Width="300" CornerRadius="35" Command="{Binding CompleteCommand}">RESTART</touch:TouchButton> - </StackPanel> - </StackPanel> + <Grid controls:NavigationControl.NavigationName="SetupFailedView"> + <StackPanel HorizontalAlignment="Center" Margin="0 50 0 0"> + <touch:TouchIcon Icon="AlertOctagon" Foreground="{StaticResource TangoErrorBrush}" Width="70" Height="70" /> + <TextBlock VerticalAlignment="Center" Margin="0 10 0 0" Foreground="{StaticResource TangoErrorBrush}" FontSize="{StaticResource TangoTitleFontSize}">Setup failed, tap 'RESTART' to restart the process.</TextBlock> + + <touch:TouchButton Margin="0 200 0 0" Padding="20" Width="300" CornerRadius="35" Command="{Binding RestartCommand}">RESTART</touch:TouchButton> + </StackPanel> + </Grid> + + </controls:NavigationControl> </DockPanel> </Grid> </Grid> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineSetupView.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineSetupView.xaml.cs index a2c20ecc2..aee809e9c 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineSetupView.xaml.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineSetupView.xaml.cs @@ -12,6 +12,7 @@ using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; +using Tango.PPC.UI.ViewModels; using Tango.PPC.UI.ViewsContracts; namespace Tango.PPC.UI.Views @@ -35,5 +36,17 @@ namespace Tango.PPC.UI.Views txtLog.SelectionStart = txtLog.Text.Length; txtLog.ScrollToEnd(); } + + public Task NavigateTo(MachineSetupViewVM.MachineSetupView view) + { + TaskCompletionSource<object> source = new TaskCompletionSource<object>(); + + navigationControl.NavigateTo(view.ToString(),() => + { + source.SetResult(new object()); + }); + + return source.Task; + } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewsContracts/IMachineSetupView.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewsContracts/IMachineSetupView.cs index c9ff93280..65b194f7b 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewsContracts/IMachineSetupView.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewsContracts/IMachineSetupView.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using Tango.PPC.Common; +using static Tango.PPC.UI.ViewModels.MachineSetupViewVM; namespace Tango.PPC.UI.ViewsContracts { @@ -18,5 +19,11 @@ namespace Tango.PPC.UI.ViewsContracts /// </summary> /// <param name="log">The log.</param> void AppendLog(String log); + + /// <summary> + /// Navigates to the specified machine setup view. + /// </summary> + /// <param name="view">The view.</param> + Task NavigateTo(MachineSetupView view); } } diff --git a/Software/Visual_Studio/Tango.BL/Entities/Machine.cs b/Software/Visual_Studio/Tango.BL/Entities/Machine.cs index c5d033dc4..3c9271fff 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/Machine.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/Machine.cs @@ -159,28 +159,6 @@ namespace Tango.BL.Entities } - protected Boolean _enablewifi; - - /// <summary> - /// Gets or sets the machine enable wifi. - /// </summary> - - [Column("ENABLE_WIFI")] - - public Boolean EnableWifi - { - get - { - return _enablewifi; - } - - set - { - _enablewifi = value; RaisePropertyChanged(nameof(EnableWifi)); - } - - } - protected Boolean _enableexternalbridge; /// <summary> diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/MACHINE.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/MACHINE.cs index d1917e428..615012c19 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/MACHINE.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/MACHINE.cs @@ -32,7 +32,6 @@ namespace Tango.DAL.Remote.DB public string ORGANIZATION_GUID { get; set; } public string MACHINE_VERSION_GUID { get; set; } public string CONFIGURATION_GUID { get; set; } - public bool ENABLE_WIFI { get; set; } public bool ENABLE_EXTERNAL_BRIDGE { get; set; } public string EXTERNAL_BRIDGE_PASSWORD { get; set; } public string DEFAULT_RML_GUID { get; set; } diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx index ea08f9446..8809518b5 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx @@ -684,7 +684,6 @@ <Property Name="ORGANIZATION_GUID" Type="varchar" MaxLength="36" Nullable="false" /> <Property Name="MACHINE_VERSION_GUID" Type="varchar" MaxLength="36" Nullable="false" /> <Property Name="CONFIGURATION_GUID" Type="varchar" MaxLength="36" Nullable="false" /> - <Property Name="ENABLE_WIFI" Type="bit" Nullable="false" /> <Property Name="ENABLE_EXTERNAL_BRIDGE" Type="bit" Nullable="false" /> <Property Name="EXTERNAL_BRIDGE_PASSWORD" Type="varchar" MaxLength="100" /> <Property Name="DEFAULT_RML_GUID" Type="varchar" MaxLength="36" /> @@ -3736,7 +3735,6 @@ <Property Name="ORGANIZATION_GUID" Type="String" Nullable="false" MaxLength="36" FixedLength="false" Unicode="false" /> <Property Name="MACHINE_VERSION_GUID" Type="String" Nullable="false" MaxLength="36" FixedLength="false" Unicode="false" /> <Property Name="CONFIGURATION_GUID" Type="String" Nullable="false" MaxLength="36" FixedLength="false" Unicode="false" /> - <Property Name="ENABLE_WIFI" Type="Boolean" Nullable="false" /> <Property Name="ENABLE_EXTERNAL_BRIDGE" Type="Boolean" Nullable="false" /> <Property Name="EXTERNAL_BRIDGE_PASSWORD" Type="String" MaxLength="100" FixedLength="false" Unicode="false" /> <Property Name="DEFAULT_RML_GUID" Type="String" MaxLength="36" FixedLength="false" Unicode="false" /> @@ -5970,7 +5968,6 @@ <ScalarProperty Name="DEFAULT_RML_GUID" ColumnName="DEFAULT_RML_GUID" /> <ScalarProperty Name="EXTERNAL_BRIDGE_PASSWORD" ColumnName="EXTERNAL_BRIDGE_PASSWORD" /> <ScalarProperty Name="ENABLE_EXTERNAL_BRIDGE" ColumnName="ENABLE_EXTERNAL_BRIDGE" /> - <ScalarProperty Name="ENABLE_WIFI" ColumnName="ENABLE_WIFI" /> <ScalarProperty Name="CONFIGURATION_GUID" ColumnName="CONFIGURATION_GUID" /> <ScalarProperty Name="MACHINE_VERSION_GUID" ColumnName="MACHINE_VERSION_GUID" /> <ScalarProperty Name="ORGANIZATION_GUID" ColumnName="ORGANIZATION_GUID" /> diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram index 406d3e7fb..cc0d83531 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram @@ -5,80 +5,80 @@ <!-- Diagram content (shape and connector positions) --> <edmx:Diagrams> <Diagram DiagramId="f9ae01d708754bbd997add25a4bacc79" Name="Diagram1"> - <EntityTypeShape EntityType="RemoteModel.ACTION_TYPES" Width="1.5" PointX="11.25" PointY="41.125" /> - <EntityTypeShape EntityType="RemoteModel.ADDRESS" Width="1.5" PointX="0.75" PointY="34.875" /> - <EntityTypeShape EntityType="RemoteModel.APPLICATION_DISPLAY_PANEL_VERSIONS" Width="1.5" PointX="0.75" PointY="53.875" /> - <EntityTypeShape EntityType="RemoteModel.APPLICATION_FIRMWARE_VERSIONS" Width="1.5" PointX="0.75" PointY="43.75" /> - <EntityTypeShape EntityType="RemoteModel.APPLICATION_OS_VERSIONS" Width="1.5" PointX="0.75" PointY="56.75" /> + <EntityTypeShape EntityType="RemoteModel.ACTION_TYPES" Width="1.5" PointX="8.25" PointY="70.125" /> + <EntityTypeShape EntityType="RemoteModel.ADDRESS" Width="1.5" PointX="0.75" PointY="34.75" /> + <EntityTypeShape EntityType="RemoteModel.APPLICATION_DISPLAY_PANEL_VERSIONS" Width="1.5" PointX="0.75" PointY="56.75" /> + <EntityTypeShape EntityType="RemoteModel.APPLICATION_FIRMWARE_VERSIONS" Width="1.5" PointX="0.75" PointY="50.875" /> + <EntityTypeShape EntityType="RemoteModel.APPLICATION_OS_VERSIONS" Width="1.5" PointX="0.75" PointY="53.875" /> <EntityTypeShape EntityType="RemoteModel.BRUSH_STOPS" Width="1.5" PointX="15" PointY="15.125" /> - <EntityTypeShape EntityType="RemoteModel.CARTRIDGE_TYPES" Width="1.5" PointX="9" PointY="62.875" /> + <EntityTypeShape EntityType="RemoteModel.CARTRIDGE_TYPES" Width="1.5" PointX="8" PointY="1.25" /> <EntityTypeShape EntityType="RemoteModel.CAT" Width="1.5" PointX="7.5" PointY="18.625" /> - <EntityTypeShape EntityType="RemoteModel.CCT" Width="1.5" PointX="5.25" PointY="39.875" /> + <EntityTypeShape EntityType="RemoteModel.CCT" Width="1.5" PointX="5.25" PointY="43" /> <EntityTypeShape EntityType="RemoteModel.COLOR_CATALOGS" Width="1.5" PointX="12.75" PointY="9.5" /> - <EntityTypeShape EntityType="RemoteModel.COLOR_SPACES" Width="1.5" PointX="3" PointY="7.25" /> + <EntityTypeShape EntityType="RemoteModel.COLOR_SPACES" Width="1.5" PointX="3" PointY="2.5" /> <EntityTypeShape EntityType="RemoteModel.CONFIGURATION" Width="1.5" PointX="3" PointY="49" /> - <EntityTypeShape EntityType="RemoteModel.CONTACT" Width="1.5" PointX="0.75" PointY="39.125" /> - <EntityTypeShape EntityType="RemoteModel.CUSTOMER" Width="1.5" PointX="8.25" PointY="30.25" /> - <EntityTypeShape EntityType="RemoteModel.DISPENSER_TYPES" Width="1.5" PointX="9" PointY="5.25" /> - <EntityTypeShape EntityType="RemoteModel.EMBEDDED_FIRMWARE_VERSIONS" Width="1.5" PointX="0.75" PointY="50.875" /> - <EntityTypeShape EntityType="RemoteModel.EVENT_TYPES" Width="1.5" PointX="11.25" PointY="36.25" /> - <EntityTypeShape EntityType="RemoteModel.EVENT_TYPES_ACTIONS" Width="1.5" PointX="13.5" PointY="37.125" /> - <EntityTypeShape EntityType="RemoteModel.EVENT_TYPES_CATEGORIES" Width="1.5" PointX="9" PointY="40.25" /> - <EntityTypeShape EntityType="RemoteModel.EVENT_TYPES_GROUPS" Width="1.5" PointX="9" PointY="33.875" /> - <EntityTypeShape EntityType="RemoteModel.FIBER_SHAPES" Width="1.5" PointX="0.75" PointY="19.125" /> - <EntityTypeShape EntityType="RemoteModel.FIBER_SYNTHS" Width="1.5" PointX="0.75" PointY="14.625" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_BLOWER_TYPES" Width="1.5" PointX="3.75" PointY="59.25" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_BLOWERS" Width="1.5" PointX="6" PointY="51" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_BREAK_SENSOR_TYPES" Width="1.5" PointX="0.75" PointY="64.25" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_BREAK_SENSORS" Width="1.5" PointX="3" PointY="55" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_DANCER_TYPES" Width="1.5" PointX="0.75" PointY="60.25" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_DANCERS" Width="1.5" PointX="3" PointY="43.25" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_MOTOR_TYPES" Width="1.5" PointX="9.75" PointY="69.125" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_MOTORS" Width="1.5" PointX="12" PointY="51.875" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_PID_CONTROL_TYPES" Width="1.5" PointX="7.75" PointY="59.25" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_PID_CONTROLS" Width="1.5" PointX="10" PointY="44.625" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_SPEED_SENSOR_TYPES" Width="1.5" PointX="3.75" PointY="63.25" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_SPEED_SENSORS" Width="1.5" PointX="6" PointY="55" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_VERSIONS" Width="1.5" PointX="0.75" PointY="46.625" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_WINDER_TYPES" Width="1.5" PointX="6.75" PointY="63.25" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_WINDERS" Width="1.5" PointX="9" PointY="51.125" /> - <EntityTypeShape EntityType="RemoteModel.HTML_PAGES" Width="1.5" PointX="9" PointY="37" /> - <EntityTypeShape EntityType="RemoteModel.IDS_PACK_FORMULAS" Width="1.5" PointX="9" PointY="54.625" /> - <EntityTypeShape EntityType="RemoteModel.IDS_PACKS" Width="1.5" PointX="11.25" PointY="31" /> + <EntityTypeShape EntityType="RemoteModel.CONTACT" Width="1.5" PointX="0.75" PointY="39" /> + <EntityTypeShape EntityType="RemoteModel.CUSTOMER" Width="1.5" PointX="8.25" PointY="33.125" /> + <EntityTypeShape EntityType="RemoteModel.DISPENSER_TYPES" Width="1.5" PointX="8" PointY="61.5" /> + <EntityTypeShape EntityType="RemoteModel.EMBEDDED_FIRMWARE_VERSIONS" Width="1.5" PointX="0.75" PointY="48" /> + <EntityTypeShape EntityType="RemoteModel.EVENT_TYPES" Width="1.5" PointX="5.25" PointY="57.25" /> + <EntityTypeShape EntityType="RemoteModel.EVENT_TYPES_ACTIONS" Width="1.5" PointX="10.5" PointY="58.125" /> + <EntityTypeShape EntityType="RemoteModel.EVENT_TYPES_CATEGORIES" Width="1.5" PointX="3" PointY="58.125" /> + <EntityTypeShape EntityType="RemoteModel.EVENT_TYPES_GROUPS" Width="1.5" PointX="3" PointY="61.25" /> + <EntityTypeShape EntityType="RemoteModel.FIBER_SHAPES" Width="1.5" PointX="0.75" PointY="14.625" /> + <EntityTypeShape EntityType="RemoteModel.FIBER_SYNTHS" Width="1.5" PointX="0.75" PointY="31.625" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_BLOWER_TYPES" Width="1.5" PointX="6.75" PointY="66.375" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_BLOWERS" Width="1.5" PointX="9" PointY="47.125" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_BREAK_SENSOR_TYPES" Width="1.5" PointX="3.75" PointY="33.375" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_BREAK_SENSORS" Width="1.5" PointX="6" PointY="37.125" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_DANCER_TYPES" Width="1.5" PointX="3.75" PointY="70.375" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_DANCERS" Width="1.5" PointX="6" PointY="51.375" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_MOTOR_TYPES" Width="1.5" PointX="8.75" PointY="51.25" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_MOTORS" Width="1.5" PointX="11" PointY="39" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_PID_CONTROL_TYPES" Width="1.5" PointX="5.75" PointY="62.375" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_PID_CONTROLS" Width="1.5" PointX="8" PointY="40.625" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_SPEED_SENSOR_TYPES" Width="1.5" PointX="0.75" PointY="60.375" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_SPEED_SENSORS" Width="1.5" PointX="3" PointY="44.125" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_VERSIONS" Width="1.5" PointX="0.75" PointY="43.75" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_WINDER_TYPES" Width="1.5" PointX="3.75" PointY="66.375" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_WINDERS" Width="1.5" PointX="6" PointY="47.25" /> + <EntityTypeShape EntityType="RemoteModel.HTML_PAGES" Width="1.5" PointX="3" PointY="54.875" /> + <EntityTypeShape EntityType="RemoteModel.IDS_PACK_FORMULAS" Width="1.5" PointX="8" PointY="57.25" /> + <EntityTypeShape EntityType="RemoteModel.IDS_PACKS" Width="1.5" PointX="10.25" PointY="27" /> <EntityTypeShape EntityType="RemoteModel.JOB_RUNS" Width="1.5" PointX="12.75" PointY="20.75" /> <EntityTypeShape EntityType="RemoteModel.JOB" Width="1.5" PointX="10.5" PointY="15.5" /> - <EntityTypeShape EntityType="RemoteModel.LINEAR_MASS_DENSITY_UNITS" Width="1.5" PointX="0.75" PointY="28.75" /> - <EntityTypeShape EntityType="RemoteModel.LIQUID_TYPES" Width="1.5" PointX="6" PointY="12.75" /> + <EntityTypeShape EntityType="RemoteModel.LINEAR_MASS_DENSITY_UNITS" Width="1.5" PointX="0.75" PointY="19.125" /> + <EntityTypeShape EntityType="RemoteModel.LIQUID_TYPES" Width="1.5" PointX="6" PointY="6.75" /> <EntityTypeShape EntityType="RemoteModel.LIQUID_TYPES_RMLS" Width="1.5" PointX="8.25" PointY="15" /> - <EntityTypeShape EntityType="RemoteModel.MACHINE_STUDIO_VERSIONS" Width="1.5" PointX="10.5" PointY="1.125" /> - <EntityTypeShape EntityType="RemoteModel.MACHINE_VERSIONS" Width="1.5" PointX="3" PointY="25.25" /> - <EntityTypeShape EntityType="RemoteModel.MACHINE" Width="1.5" PointX="5.25" PointY="17" /> - <EntityTypeShape EntityType="RemoteModel.MACHINES_CONFIGURATIONS" Width="1.5" PointX="7.5" PointY="23.125" /> - <EntityTypeShape EntityType="RemoteModel.MACHINES_EVENTS" Width="1.5" PointX="13.5" PointY="24.625" /> - <EntityTypeShape EntityType="RemoteModel.MEDIA_COLORS" Width="1.5" PointX="0.75" PointY="22.5" /> - <EntityTypeShape EntityType="RemoteModel.MEDIA_CONDITIONS" Width="1.5" PointX="0.75" PointY="31.625" /> - <EntityTypeShape EntityType="RemoteModel.MEDIA_MATERIALS" Width="1.5" PointX="0.75" PointY="25.875" /> - <EntityTypeShape EntityType="RemoteModel.MEDIA_PURPOSES" Width="1.5" PointX="0.75" PointY="11.625" /> - <EntityTypeShape EntityType="RemoteModel.MID_TANK_TYPES" Width="1.5" PointX="9" PointY="65.875" /> - <EntityTypeShape EntityType="RemoteModel.ORGANIZATION" Width="1.5" PointX="3" PointY="37.125" /> - <EntityTypeShape EntityType="RemoteModel.PERMISSION" Width="1.5" PointX="9.25" PointY="77" /> - <EntityTypeShape EntityType="RemoteModel.PROCESS_PARAMETERS_TABLES" Width="1.5" PointX="7.5" PointY="44" /> - <EntityTypeShape EntityType="RemoteModel.PROCESS_PARAMETERS_TABLES_GROUPS" Width="1.5" PointX="5.25" PointY="45.5" /> + <EntityTypeShape EntityType="RemoteModel.MACHINE_STUDIO_VERSIONS" Width="1.5" PointX="10.5" PointY="9.75" /> + <EntityTypeShape EntityType="RemoteModel.MACHINE_VERSIONS" Width="1.5" PointX="3" PointY="6.25" /> + <EntityTypeShape EntityType="RemoteModel.MACHINE" Width="1.5" PointX="5.25" PointY="17.125" /> + <EntityTypeShape EntityType="RemoteModel.MACHINES_CONFIGURATIONS" Width="1.5" PointX="13.5" PointY="24.125" /> + <EntityTypeShape EntityType="RemoteModel.MACHINES_EVENTS" Width="1.5" PointX="7.5" PointY="10.625" /> + <EntityTypeShape EntityType="RemoteModel.MEDIA_COLORS" Width="1.5" PointX="0.75" PointY="28.375" /> + <EntityTypeShape EntityType="RemoteModel.MEDIA_CONDITIONS" Width="1.5" PointX="0.75" PointY="11.625" /> + <EntityTypeShape EntityType="RemoteModel.MEDIA_MATERIALS" Width="1.5" PointX="0.75" PointY="25.375" /> + <EntityTypeShape EntityType="RemoteModel.MEDIA_PURPOSES" Width="1.5" PointX="0.75" PointY="22.5" /> + <EntityTypeShape EntityType="RemoteModel.MID_TANK_TYPES" Width="1.5" PointX="8" PointY="22.875" /> + <EntityTypeShape EntityType="RemoteModel.ORGANIZATION" Width="1.5" PointX="3" PointY="37" /> + <EntityTypeShape EntityType="RemoteModel.PERMISSION" Width="1.5" PointX="11.25" PointY="33" /> + <EntityTypeShape EntityType="RemoteModel.PROCESS_PARAMETERS_TABLES" Width="1.5" PointX="7.5" PointY="26.125" /> + <EntityTypeShape EntityType="RemoteModel.PROCESS_PARAMETERS_TABLES_GROUPS" Width="1.5" PointX="5.25" PointY="27.625" /> <EntityTypeShape EntityType="RemoteModel.RML" Width="1.5" PointX="3" PointY="16.25" /> - <EntityTypeShape EntityType="RemoteModel.ROLE" Width="1.5" PointX="9.25" PointY="72.875" /> - <EntityTypeShape EntityType="RemoteModel.ROLES_PERMISSIONS" Width="1.5" PointX="11.5" PointY="73" /> + <EntityTypeShape EntityType="RemoteModel.ROLE" Width="1.5" PointX="11.25" PointY="1.875" /> + <EntityTypeShape EntityType="RemoteModel.ROLES_PERMISSIONS" Width="1.5" PointX="13.5" PointY="2" /> <EntityTypeShape EntityType="RemoteModel.SEGMENT" Width="1.5" PointX="12.75" PointY="17.25" /> - <EntityTypeShape EntityType="RemoteModel.SPOOL_TYPES" Width="1.5" PointX="3" PointY="2.5" /> - <EntityTypeShape EntityType="RemoteModel.sysdiagram" Width="1.5" PointX="5.75" PointY="0.75" /> - <EntityTypeShape EntityType="RemoteModel.TANGO_VERSIONS" Width="1.5" PointX="10.5" PointY="11" /> - <EntityTypeShape EntityType="RemoteModel.TECH_CONTROLLERS" Width="1.5" PointX="5.75" PointY="3.75" /> - <EntityTypeShape EntityType="RemoteModel.TECH_DISPENSERS" Width="1.5" PointX="7.75" PointY="0.75" /> - <EntityTypeShape EntityType="RemoteModel.TECH_IOS" Width="1.5" PointX="2.75" PointY="11.75" /> - <EntityTypeShape EntityType="RemoteModel.TECH_MONITORS" Width="1.5" PointX="12.75" PointY="0.75" /> - <EntityTypeShape EntityType="RemoteModel.TECH_VALVES" Width="1.5" PointX="13.75" PointY="5.75" /> - <EntityTypeShape EntityType="RemoteModel.USER" Width="1.5" PointX="8.25" PointY="8.875" /> - <EntityTypeShape EntityType="RemoteModel.USERS_ROLES" Width="1.5" PointX="11.5" PointY="5.875" /> - <EntityTypeShape EntityType="RemoteModel.WINDING_METHODS" Width="1.5" PointX="8.25" PointY="27.125" /> + <EntityTypeShape EntityType="RemoteModel.SPOOL_TYPES" Width="1.5" PointX="3" PointY="11.125" /> + <EntityTypeShape EntityType="RemoteModel.sysdiagram" Width="1.5" PointX="14.75" PointY="9.75" /> + <EntityTypeShape EntityType="RemoteModel.TANGO_VERSIONS" Width="1.5" PointX="10.5" PointY="5.625" /> + <EntityTypeShape EntityType="RemoteModel.TECH_CONTROLLERS" Width="1.5" PointX="15.75" PointY="0.75" /> + <EntityTypeShape EntityType="RemoteModel.TECH_DISPENSERS" Width="1.5" PointX="15.75" PointY="4.75" /> + <EntityTypeShape EntityType="RemoteModel.TECH_IOS" Width="1.5" PointX="16.75" PointY="7.75" /> + <EntityTypeShape EntityType="RemoteModel.TECH_MONITORS" Width="1.5" PointX="17.75" PointY="0.75" /> + <EntityTypeShape EntityType="RemoteModel.TECH_VALVES" Width="1.5" PointX="17.75" PointY="12.75" /> + <EntityTypeShape EntityType="RemoteModel.USER" Width="1.5" PointX="8.25" PointY="4.875" /> + <EntityTypeShape EntityType="RemoteModel.USERS_ROLES" Width="1.5" PointX="13.5" PointY="5.875" /> + <EntityTypeShape EntityType="RemoteModel.WINDING_METHODS" Width="1.5" PointX="8.25" PointY="36.25" /> <AssociationConnector Association="RemoteModel.FK_EVENTS_ACTIONS_ACTIONS" /> <AssociationConnector Association="RemoteModel.FK_ORGANIZATIONS_ADDRESSES" /> <AssociationConnector Association="RemoteModel.FK_USERS_ADDRESSES" /> diff --git a/Software/Visual_Studio/Tango.Logging/LogManager.cs b/Software/Visual_Studio/Tango.Logging/LogManager.cs index 91f6423d0..2d99c4fac 100644 --- a/Software/Visual_Studio/Tango.Logging/LogManager.cs +++ b/Software/Visual_Studio/Tango.Logging/LogManager.cs @@ -259,7 +259,7 @@ namespace Tango.Logging { while (_isStarted) { - if (_logs.Count > 0) + while (_logs.Count > 0) { LogItemBase log; diff --git a/Software/Visual_Studio/Tango.Logging/SimpleStringLogger.cs b/Software/Visual_Studio/Tango.Logging/SimpleStringLogger.cs index 1b0780e58..4f22dcf6c 100644 --- a/Software/Visual_Studio/Tango.Logging/SimpleStringLogger.cs +++ b/Software/Visual_Studio/Tango.Logging/SimpleStringLogger.cs @@ -28,10 +28,9 @@ namespace Tango.Logging Enabled = true; } - public SimpleStringLogger(params LogCategory[] categories) + public SimpleStringLogger(params LogCategory[] categories) : this() { Categories = categories.ToList(); - Enabled = true; } public void OnLog(LogItemBase log) diff --git a/Software/Visual_Studio/Tango.SharedUI/Controls/NavigationControl.cs b/Software/Visual_Studio/Tango.SharedUI/Controls/NavigationControl.cs index 2b59bb663..c8b6d3afb 100644 --- a/Software/Visual_Studio/Tango.SharedUI/Controls/NavigationControl.cs +++ b/Software/Visual_Studio/Tango.SharedUI/Controls/NavigationControl.cs @@ -17,6 +17,8 @@ namespace Tango.SharedUI.Controls [ContentProperty(nameof(Elements))] public class NavigationControl : UserControl { + private Action _onCompleted; + #region Transition Types public enum TransitionTypes @@ -218,6 +220,22 @@ namespace Tango.SharedUI.Controls DependencyProperty.Register("KeepElementsAttached", typeof(bool), typeof(NavigationControl), new PropertyMetadata(false)); + + public int SelectedIndex + { + get { return (int)GetValue(SelectedIndexProperty); } + set { SetValue(SelectedIndexProperty, value); } + } + + // Using a DependencyProperty as the backing store for SelectedIndex. This enables animation, styling, binding, etc... + public static readonly DependencyProperty SelectedIndexProperty = + DependencyProperty.Register("SelectedIndex", typeof(int), typeof(NavigationControl), new PropertyMetadata(0, (d, e) => (d as NavigationControl).OnSelectedIndexChanged())); + + private void OnSelectedIndexChanged() + { + SelectedElement = Elements[SelectedIndex > Elements.Count - 1 ? 0 : SelectedIndex]; + } + #endregion #region Attached Properties @@ -373,6 +391,8 @@ namespace Tango.SharedUI.Controls if (fromVM != null && fromVM != toVM) fromVM.OnNavigatedFrom(); if (toVM != null) toVM.OnNavigatedTo(); + + _onCompleted?.Invoke(); }; switch (TransitionType) @@ -478,6 +498,13 @@ namespace Tango.SharedUI.Controls public FrameworkElement NavigateTo(String navigationName) { + return NavigateTo(navigationName, null); + } + + public FrameworkElement NavigateTo(String navigationName, Action onCompleted = null) + { + _onCompleted = onCompleted; + var element = Elements.SingleOrDefault(x => GetNavigationName(x) == navigationName || x.GetType().Name == navigationName); if (element != null) diff --git a/Software/Visual_Studio/Tango.Transport/Discovery/UsbCommunicationScanner.cs b/Software/Visual_Studio/Tango.Transport/Discovery/UsbCommunicationScanner.cs index 1284490da..aec553191 100644 --- a/Software/Visual_Studio/Tango.Transport/Discovery/UsbCommunicationScanner.cs +++ b/Software/Visual_Studio/Tango.Transport/Discovery/UsbCommunicationScanner.cs @@ -31,6 +31,8 @@ namespace Tango.Transport.Discovery /// <seealso cref="Tango.Transport.Discovery.ICommunicationScanner{Tango.Transport.Adapters.UsbTransportAdapter, TRequest, TResponse}" /> public class UsbCommunicationScanner<TRequest, TResponse> : ICommunicationScanner<UsbTransportAdapter, TRequest, TResponse> where TRequest : IMessage where TResponse : IMessage { + public event Action<String> ScanningPort; + /// <summary> /// Gets the baud rate. /// </summary> @@ -80,6 +82,8 @@ namespace Tango.Transport.Discovery logManager.Log("Scanning " + port.ToString() + "..."); + ScanningPort?.Invoke(port.Port); + SafeFileHandle hFile = UsbComPortWin32.CreateFile(@"\\.\" + port.Port, -1073741824, 0, IntPtr.Zero, 3, UsbComPortWin32.dwFlagsAndAttributes, IntPtr.Zero); if (hFile.IsInvalid) { diff --git a/Software/Visual_Studio/Tango.Transport/TransporterBase.cs b/Software/Visual_Studio/Tango.Transport/TransporterBase.cs index c67489007..6376a43ce 100644 --- a/Software/Visual_Studio/Tango.Transport/TransporterBase.cs +++ b/Software/Visual_Studio/Tango.Transport/TransporterBase.cs @@ -822,7 +822,7 @@ namespace Tango.Transport { while (State == TransportComponentState.Connected) { - if (Adapter != null && _sendingQueue.Count > 0) + while (Adapter != null && _sendingQueue.Count > 0) { TransportMessageBase message; if (_sendingQueue.TryDequeue(out message)) @@ -901,7 +901,7 @@ namespace Tango.Transport { byte[] data; - if (Adapter != null && _arrivedResponses.Count > 0) + while (Adapter != null && _arrivedResponses.Count > 0) { if (_arrivedResponses.TryDequeue(out data)) { |
