diff options
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI')
12 files changed, 108 insertions, 42 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs index 2ea0ebd38..7eab5066a 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs @@ -25,6 +25,8 @@ using Tango.Core; using Tango.BL; using Tango.Integration.Operation; using System.Net; +using System.Globalization; +using System.Windows.Markup; namespace Tango.MachineStudio.UI { @@ -40,6 +42,18 @@ namespace Tango.MachineStudio.UI protected override void OnStartup(StartupEventArgs e) { + //Set culture info. + var enUSCulture = new CultureInfo("en-US"); + + Thread.CurrentThread.CurrentCulture = enUSCulture; + Thread.CurrentThread.CurrentUICulture = enUSCulture; + CultureInfo.DefaultThreadCurrentCulture = enUSCulture; + CultureInfo.DefaultThreadCurrentUICulture = enUSCulture; + + FrameworkElement.LanguageProperty.OverrideMetadata( + typeof(FrameworkElement), + new FrameworkPropertyMetadata(XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag))); + StartupArgs = e.Args; #if DEBUG @@ -88,6 +102,17 @@ namespace Tango.MachineStudio.UI ApplyEFCacheSettings(); WebRequest.DefaultWebProxy = null; + + GetLastApplicationCrashFromWindows(); + } + + private async void GetLastApplicationCrashFromWindows() + { + var logItem = await exceptionTrapper.GetLastApplicationCrashEventLog(); + if (logItem != null) + { + LogManager.Log(logItem); + } } private void ApplyEFCacheSettings() diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/MessageBoxWindow.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/MessageBoxWindow.xaml index 888f49d3f..c26fae591 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/MessageBoxWindow.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/MessageBoxWindow.xaml @@ -31,7 +31,7 @@ <Grid> <StackPanel Orientation="Horizontal" VerticalAlignment="Top" Margin="0 30 0 0"> <materialDesign:PackIcon Kind="{Binding RelativeSource={RelativeSource AncestorType=Window},Path=IconKind}" VerticalAlignment="Top" Width="50" Height="50" Foreground="{Binding RelativeSource={RelativeSource AncestorType=Window},Path=IconColor}" /> - <TextBlock Padding="0 10 0 0" TextWrapping="Wrap" Margin="10 0 0 0" VerticalAlignment="Top" FontSize="14" Text="{Binding RelativeSource={RelativeSource AncestorType=Window},Path=Message}" Width="400" Foreground="{StaticResource Dialog.Foreground}"></TextBlock> + <TextBox Style="{x:Null}" BorderThickness="0" Background="Transparent" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden" IsReadOnly="True" Padding="0 10 0 0" TextWrapping="Wrap" Margin="10 0 0 0" VerticalAlignment="Top" FontSize="14" Text="{Binding RelativeSource={RelativeSource AncestorType=Window},Path=Message}" Width="400" Foreground="{StaticResource Dialog.Foreground}"></TextBox> </StackPanel> </Grid> </DockPanel> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs index 20cfa84df..03c55f1c8 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs @@ -4,5 +4,5 @@ using System.Runtime.InteropServices; [assembly: System.Windows.ThemeInfo(System.Windows.ResourceDictionaryLocation.None, System.Windows.ResourceDictionaryLocation.SourceAssembly)] [assembly: AssemblyTitle("Tango - Machine Studio")] -[assembly: AssemblyVersion("4.1.10.0")] +[assembly: AssemblyVersion("4.2.0.0")] [assembly: ComVisible(false)]
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs index ed5f8b394..feed9e193 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs @@ -132,8 +132,6 @@ namespace Tango.MachineStudio.UI.StudioApplication { if (e == Transport.TransportComponentState.Disconnected || e == Transport.TransportComponentState.Failed) { - bool reconnect = ConnectedMachine is IExternalBridgeSecureClient; - ConnectedMachine = null; if (e == Transport.TransportComponentState.Failed) @@ -147,7 +145,7 @@ namespace Tango.MachineStudio.UI.StudioApplication ConnectionLostViewVM vm = new ConnectionLostViewVM() { Exception = failed_reason, - AutoReconnect = reconnect, + AutoReconnect = true, }; InvokeUI(() => @@ -293,7 +291,7 @@ namespace Tango.MachineStudio.UI.StudioApplication var eventLogger = TangoIOC.Default.GetInstance<IEventLogger>(); if (eventLogger != null) { - eventLogger.Log(EventTypes.APPLICATION_TERMINATED, "Application Terminated!"); + //eventLogger.Log(EventTypes.APPLICATION_TERMINATED, "Application Terminated!"); eventLogger.FlushAll(); } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/TeamFoundationServiceExtendedClient.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/TeamFoundationServiceExtendedClient.cs index 7b1727ec3..b716ed1fb 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/TeamFoundationServiceExtendedClient.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/TeamFoundationServiceExtendedClient.cs @@ -15,8 +15,10 @@ using Tango.Core.Helpers; using Tango.Core.IO; using Tango.Integration.Operation; using Tango.Logging; +using Tango.MachineStudio.Common; using Tango.MachineStudio.Common.Authentication; using Tango.MachineStudio.Common.StudioApplication; +using Tango.Settings; using Tango.SharedUI.Helpers; using Tango.TFS; @@ -159,6 +161,7 @@ namespace Tango.MachineStudio.UI.TFS item.Severity = Severity.Medium; item.State = State.New; item.Type = WorkItemType.Bug; + item.Environment = SettingsManager.Default.GetOrCreate<MachineStudioSettings>().DeploymentSlot.ToDescription(); foreach (var window in Application.Current.Windows.OfType<Window>().Where(x => !String.IsNullOrWhiteSpace(x.Title))) { diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/TeamMembersProvider.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/TeamMembersProvider.cs index 0691ca6bd..464599452 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/TeamMembersProvider.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/TeamMembersProvider.cs @@ -13,7 +13,8 @@ namespace Tango.MachineStudio.UI.TFS { public IEnumerable GetSuggestions(string filter) { - return TangoIOC.Default.GetInstance<TeamFoundationServiceExtendedClient>().Project.Members.Where(x => x.AssignName.ToLower().Contains(filter.ToLower())); + var members = TangoIOC.Default.GetInstance<TeamFoundationServiceExtendedClient>().Project.Members; + return members.Where(x => x.AssignName.ToLower().Contains(filter.ToLower())); } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj index 2fc1c1e7d..3783b54f8 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj @@ -355,6 +355,10 @@ <Link>Tango.ColorLib_v3.dll</Link> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </Content> + <Content Include="..\..\Build\ColorLib\Debug\Tango.ColorLib_v4.dll"> + <Link>Tango.ColorLib_v4.dll</Link> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </Content> <Content Include="..\..\tcc\benchmarks\benchmarks_rgb_lab.csv"> <Link>TCC\benchmarks_rgb_lab.csv</Link> <CopyToOutputDirectory>Always</CopyToOutputDirectory> @@ -430,6 +434,10 @@ <Project>{63561e19-ff5a-414b-a5ef-e30711543e1d}</Project> <Name>Tango.Emulations</Name> </ProjectReference> + <ProjectReference Include="..\..\Tango.Git\Tango.Git.csproj"> + <Project>{99081c0e-065c-4d68-bf60-f82330cca02d}</Project> + <Name>Tango.Git</Name> + </ProjectReference> <ProjectReference Include="..\..\Tango.Integration\Tango.Integration.csproj"> <Project>{4206ac58-3b57-4699-8835-90bf6db01a61}</Project> <Name>Tango.Integration</Name> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ConnectedMachineViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ConnectedMachineViewVM.cs index 302c50e8e..30b2c83fd 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ConnectedMachineViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ConnectedMachineViewVM.cs @@ -97,7 +97,7 @@ namespace Tango.MachineStudio.UI.ViewModels { var jobRuns = await db.JobRuns.Where(x => x.MachineGuid == ApplicationManager.Machine.Guid).Select(x => new { x.StartDate, x.EndDate, x.EndPosition }).ToListAsync(); - TotalMachineWorkTime = TimeSpan.FromHours(jobRuns.Select(x => x.EndDate - x.StartDate).Sum(x => x.TotalHours)).ToString(@"hh\:mm\:ss"); + TotalMachineWorkTime = TimeSpan.FromHours(jobRuns.Select(x => x.EndDate - x.StartDate).Sum(x => x.TotalHours)).ToStringUnlimitedHours(); int meters = (int)jobRuns.Select(x => x.EndPosition).Sum(); TotalMachineMeters = $"{meters.ToString("N0")} meters"; diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs index 97ff894df..f4645ecf2 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs @@ -263,7 +263,7 @@ namespace Tango.MachineStudio.UI.ViewModels return; } - _eventLogger.Log(EventTypes.APPLICATION_STARTED, "Application Started!"); + //_eventLogger.Log(EventTypes.APPLICATION_STARTED, "Application Started!"); _navigationManager.NavigateTo(NavigationView.MainView); diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs index 0e02d779f..4f8c8a9b1 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs @@ -58,8 +58,9 @@ namespace Tango.MachineStudio.UI.ViewModels private IEventLogger _eventLogger; private MachineStudioSettings _settings; private MachineStudioWebClient _machineStudioWebClient; - private IExternalBridgeSecureClient _reconnectionMachine; + private IExternalBridgeClient _reconnectionMachine; private MachineLoginViewVM _reconnectionMachineConfig; + private bool _lastUploadHardwareConfigLocal; /// <summary> /// Gets or sets the current loaded module. @@ -350,9 +351,16 @@ namespace Tango.MachineStudio.UI.ViewModels ApplicationManager.ReconnectionRequired += ApplicationManager_ReconnectionRequired; } - private void ApplicationManager_ReconnectionRequired(object sender, EventArgs e) + private async void ApplicationManager_ReconnectionRequired(object sender, EventArgs e) { - ConnectToMachineSecure(_reconnectionMachine, _reconnectionMachineConfig); + if (_reconnectionMachine is IExternalBridgeSecureClient client) + { + ConnectToMachineSecure(client, _reconnectionMachineConfig); + } + else + { + await ConnectToMachineLocal(_reconnectionMachine, _reconnectionMachine.Machine, _lastUploadHardwareConfigLocal); + } } private void MachineEventsStateProvider_EventsResolved(object sender, IEnumerable<MachinesEvent> e) @@ -486,41 +494,15 @@ namespace Tango.MachineStudio.UI.ViewModels { if (vm.SelectedMachine != null) { - using (NotificationProvider.PushTaskItem("Connecting to " + x.SelectedMachine.ToString() + "...")) - { - try - { - await x.SelectedMachine.Connect(); - x.SelectedMachine.SerialNumber = vm.SelectedMachine.SerialNumber; - ApplicationManager.SetConnectedMachine(x.SelectedMachine); - - PostMessage(new MachineConnectionChangedMessage() { Machine = x.SelectedMachine }); - _settings.LastVirtualMachineSerialNumber = vm.SelectedMachine.SerialNumber; - _settings.Save(); - - if (x.UploadHardwareConfiguration) - { - UploadHardwareConfiguration(false); - } - } - catch (Exception ex) - { - LogManager.Log(ex); - - _notificationProvider.ShowError("Could not connect to the selected machine." + Environment.NewLine + ex.Message); - - } - - InvalidateRelayCommands(); - } + await ConnectToMachineLocal(x.SelectedMachine, vm.SelectedMachine, x.UploadHardwareConfiguration); } }); } - InvalidateRelayCommands(); + base.InvalidateRelayCommands(); } - InvalidateRelayCommands(); + base.InvalidateRelayCommands(); }); } else @@ -585,6 +567,41 @@ namespace Tango.MachineStudio.UI.ViewModels InvalidateRelayCommands(); } + private async Task ConnectToMachineLocal(IExternalBridgeClient client, Machine machine, bool uploadHardwareConfig) + { + using (NotificationProvider.PushTaskItem("Connecting to " + client.ToString() + "...")) + { + try + { + _reconnectionMachine = client; + + await client.Connect(); + client.SerialNumber = machine.SerialNumber; + ApplicationManager.SetConnectedMachine(client); + + PostMessage(new MachineConnectionChangedMessage() { Machine = client }); + _settings.LastVirtualMachineSerialNumber = machine.SerialNumber; + _settings.Save(); + + _lastUploadHardwareConfigLocal = uploadHardwareConfig; + + if (uploadHardwareConfig) + { + UploadHardwareConfiguration(false); + } + } + catch (Exception ex) + { + LogManager.Log(ex); + + _notificationProvider.ShowError("Could not connect to the selected machine." + Environment.NewLine + ex.Message); + + } + + InvalidateRelayCommands(); + } + } + private async void ConnectToMachineSecure(IExternalBridgeSecureClient machine, MachineLoginViewVM config) { using (NotificationProvider.PushTaskItem("Connecting to machine " + machine.ToString() + "...")) @@ -600,6 +617,10 @@ namespace Tango.MachineStudio.UI.ViewModels Intent = config.Intent, UserName = AuthenticationProvider.CurrentUser.Contact.FullName, RequireSafetyLevelOperations = config.RequireSafetyOperations + }, new PMR.Integration.ConfigureProtocolRequest() + { + EnableCompression = true, + GenericProtocol = PMR.Integration.GenericMessageProtocol.Bson }); _reconnectionMachine = machine; diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml index 295d6b2dc..600104095 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml @@ -19,6 +19,8 @@ <converters:BooleanToVisibilityInverseConverter x:Key="BooleanToVisibilityInverseConverter"></converters:BooleanToVisibilityInverseConverter> <converters:BooleanInverseConverter x:Key="BooleanInverseConverter"></converters:BooleanInverseConverter> <converters:ByteArrayToFileSizeConverter x:Key="ByteArrayToFileSizeConverter" /> + <converters:GenericMessageProtocolToStringConverter x:Key="GenericMessageProtocolToStringConverter" /> + <converters:BooleanToYesNoConverter x:Key="BooleanToYesNoConverter" /> </UserControl.Resources> <Grid> @@ -95,6 +97,10 @@ <Run Text="{Binding Adapter.TransferRate,Converter={StaticResource ByteArrayToFileSizeConverter},Mode=OneWay}"></Run> <Run Text="/ sec"></Run> </TextBlock> + <TextBlock FontWeight="SemiBold" Text="Compression:" /> + <TextBlock Text="{Binding Adapter.EnableCompression,Mode=OneWay,Converter={StaticResource BooleanToYesNoConverter}}" /> + <TextBlock FontWeight="SemiBold" Text="Generic Protocol:" /> + <TextBlock Text="{Binding GenericProtocol,Mode=OneWay,Converter={StaticResource GenericMessageProtocolToStringConverter}}" /> <TextBlock FontWeight="SemiBold" Text="Diagnostics Frame Rate:" /> <TextBlock> <Run Text="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.DiagnosticsFrameProvider.FrameRate,Mode=OneWay,IsAsync=True}"></Run> @@ -138,6 +144,10 @@ <Run Text="{Binding Adapter.TransferRate,Converter={StaticResource ByteArrayToFileSizeConverter},Mode=OneWay}"></Run> <Run Text="/ sec"></Run> </TextBlock> + <TextBlock FontWeight="SemiBold" Text="Compression:" /> + <TextBlock Text="{Binding Adapter.EnableCompression,Mode=OneWay,Converter={StaticResource BooleanToYesNoConverter}}" /> + <TextBlock FontWeight="SemiBold" Text="Generic Protocol:" /> + <TextBlock Text="{Binding GenericProtocol,Mode=OneWay,Converter={StaticResource GenericMessageProtocolToStringConverter}}" /> <TextBlock FontWeight="SemiBold" Text="Diagnostics Frame Rate:" /> <TextBlock> <Run Text="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.DiagnosticsFrameProvider.FrameRate,Mode=OneWay,IsAsync=True}"></Run> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/FirmwareUpgradeView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/FirmwareUpgradeView.xaml index 233f8e4cb..5cf23e79e 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/FirmwareUpgradeView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/FirmwareUpgradeView.xaml @@ -87,7 +87,7 @@ <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center"> <TextBlock HorizontalAlignment="Center" FontSize="18" FontWeight="SemiBold">Upgrading Machine Firmware</TextBlock> <TextBlock Margin="0 40 0 0" HorizontalAlignment="Center" Foreground="{StaticResource GrayBrush}" Text="{Binding Handler.Message,Converter={StaticResource EnumToDescriptionConverter},Mode=OneWay}"></TextBlock> - <ProgressBar Height="15" Width="600" Margin="0 5 0 0" Maximum="{Binding Handler.Total,Mode=OneWay}" Value="{Binding Handler.Current,Mode=OneWay}" ></ProgressBar> + <ProgressBar Height="15" Width="600" Margin="0 5 0 0" Maximum="{Binding Handler.Total,Mode=OneWay}" Value="{Binding Handler.Current,Mode=OneWay}" IsIndeterminate="{Binding Handler.IsIndeterminate,Mode=OneWay}"></ProgressBar> <Button Width="150" Background="{StaticResource RedBrush100}" BorderBrush="{StaticResource RedBrush100}" Margin="0 40 0 0" Height="35" Command="{Binding AbortCommand}">ABORT</Button> </StackPanel> </Grid> |
