diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2018-08-02 10:24:54 +0300 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2018-08-02 10:24:54 +0300 |
| commit | 66aa9beeec79e5f828fc13ce7a5e41c15227ec9a (patch) | |
| tree | a74f7e1b4da57063046177139a5e2db188b13f48 /Software/Visual_Studio/MachineStudio | |
| parent | ad93ce8b0f13540aafe55bc3ba9d7d72aa1fc7e2 (diff) | |
| parent | 9e979a9b18727fdc9f128da5a7d2347dff2d0705 (diff) | |
| download | Tango-66aa9beeec79e5f828fc13ce7a5e41c15227ec9a.tar.gz Tango-66aa9beeec79e5f828fc13ce7a5e41c15227ec9a.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/MachineStudio')
17 files changed, 265 insertions, 129 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Properties/AssemblyInfo.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Properties/AssemblyInfo.cs index 17c753cc1..205323af0 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Properties/AssemblyInfo.cs @@ -5,7 +5,7 @@ using System.Runtime.InteropServices; using System.Windows; [assembly: AssemblyTitle("Tango - Machine Studio Color Lab Module")] -[assembly: AssemblyVersion("2.0.6.1407")] +[assembly: AssemblyVersion("2.0.7.1657")] [assembly: ComVisible(false)] diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/MainViewVM.cs index 688f90817..5b317e6d2 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/MainViewVM.cs @@ -425,6 +425,26 @@ namespace Tango.MachineStudio.ColorLab.ViewModels }).ToObservableCollection(); LiquidVolumes.ToList().ForEach(x => x.VolumeChanged += (s, e) => OnLiquidVolumeChanged()); + + InvalidateLiquidFactorsCalibrationData(); + + SelectedMachine.Modified -= SelectedMachine_Modified; + SelectedMachine.Modified += SelectedMachine_Modified; + } + } + + private void SelectedMachine_Modified(object sender, ObservableModifiedEventArgs e) + { + if (e.IsOtherContext) + { + InvokeUI(async () => + { + if (SelectedMachine != null) + { + await SelectedMachine.Reload(_dbContext); + OnSelectedMachineChanged(); + } + }); } } @@ -433,7 +453,7 @@ namespace Tango.MachineStudio.ColorLab.ViewModels try { if (LiquidsCalibrationData == null || _prevent_inverse_conversion) return; - + //TODO: This is temporary because of out of range volumes. if (LiquidVolumes.Where(x => x.IdsPack.IdsPackFormula.Code == IdsPackFormulas.StandardColor.ToInt32()).Sum(x => x.Volume) > 200) { diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Properties/AssemblyInfo.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Properties/AssemblyInfo.cs index 81868f7a8..da66a79d8 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Properties/AssemblyInfo.cs @@ -5,7 +5,7 @@ using System.Runtime.InteropServices; using System.Windows; [assembly: AssemblyTitle("Tango - Machine Studio Developer Module")] -[assembly: AssemblyVersion("2.0.8.1304")] +[assembly: AssemblyVersion("2.0.10.1828")] [assembly: ComVisible(false)] diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs index a58757633..569359066 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs @@ -180,8 +180,8 @@ namespace Tango.MachineStudio.Developer.ViewModels if (_selectedMachine != null) { - _selectedMachine.Saved -= SelectedMachine_Saved; - _selectedMachine.Saved += SelectedMachine_Saved; + _selectedMachine.Modified -= SelectedMachine_Modified; + _selectedMachine.Modified += SelectedMachine_Modified; } } } @@ -627,6 +627,11 @@ namespace Tango.MachineStudio.Developer.ViewModels /// Gets or sets the display job embroidery file command. /// </summary> public RelayCommand<Job> DisplayJobEmbroideryFileCommand { get; set; } + + /// <summary> + /// Gets or sets the reload machines command. + /// </summary> + public RelayCommand ReloadMachinesCommand { get; set; } #endregion #region Constructors @@ -703,6 +708,7 @@ namespace Tango.MachineStudio.Developer.ViewModels PushProcessParametersCommand = new RelayCommand(PushProcessParameters, () => SelectedRML != null && SelectedRML.ProcessParametersTablesGroups.Count > 0 && SelectedProcessParametersTable != null && MachineOperator != null); ImportEmbroideryFileCommand = new RelayCommand(ImportEmbroideryFile, () => SelectedMachine != null); DisplayJobEmbroideryFileCommand = new RelayCommand<Job>(DisplayJobEmbroideryFile); + ReloadMachinesCommand = new RelayCommand(ReloadMachine); ApplicationManager.ConnectedMachineChanged += ApplicationManager_ConnectedMachineChanged; @@ -850,10 +856,21 @@ namespace Tango.MachineStudio.Developer.ViewModels /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> - private void SelectedMachine_Saved(object sender, EventArgs e) + private void SelectedMachine_Modified(object sender, ObservableModifiedEventArgs e) { - InvalidateLiquidFactorsAndProcessTables(); - SelectedMachine.Reload(_machineDbContext); + if (e.IsOtherContext) + { + InvokeUI(() => + { + SelectedMachine.Reload(_machineDbContext); + InvalidateLiquidFactorsAndProcessTables(); + + if (SelectedSegment != null) + { + OnSelectedSegmentChanged(); + } + }); + } } /// <summary> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MachineJobSelectionView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MachineJobSelectionView.xaml index 4593ef259..c151b62bc 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MachineJobSelectionView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MachineJobSelectionView.xaml @@ -35,16 +35,22 @@ <Grid Background="#B1FFFFFF"> <StackPanel> <TextBlock Margin="40 20" FontSize="30" FontWeight="SemiBold" FontStyle="Italic">TARGET MACHINE</TextBlock> - <ComboBox ItemsSource="{Binding Machines}" FontSize="20" SelectedItem="{Binding SelectedMachine}" materialDesign:HintAssist.Hint="Serial Number" Margin="40 0 40 0"> - <ComboBox.ItemTemplate> - <DataTemplate> - <StackPanel> - <TextBlock Text="{Binding SerialNumber}" FontWeight="Bold" FontStyle="Italic"></TextBlock> - <TextBlock FontSize="11" Text="{Binding Name}" Foreground="Gray"></TextBlock> - </StackPanel> - </DataTemplate> - </ComboBox.ItemTemplate> - </ComboBox> + + <DockPanel Margin="40 0 40 0"> + <Button Command="{Binding ReloadMachinesCommand}" DockPanel.Dock="Right" ToolTip="Reload" Foreground="#404040" Margin="20 0 0 0" Padding="0" Width="40" Height="Auto" Style="{StaticResource MaterialDesignFlatButton}"> + <materialDesign:PackIcon Kind="Refresh" Width="24" Height="24" /> + </Button> + <ComboBox ItemsSource="{Binding Machines}" FontSize="20" SelectedItem="{Binding SelectedMachine}" materialDesign:HintAssist.Hint="Serial Number"> + <ComboBox.ItemTemplate> + <DataTemplate> + <StackPanel> + <TextBlock Text="{Binding SerialNumber}" FontWeight="Bold" FontStyle="Italic"></TextBlock> + <TextBlock FontSize="11" Text="{Binding Name}" Foreground="Gray"></TextBlock> + </StackPanel> + </DataTemplate> + </ComboBox.ItemTemplate> + </ComboBox> + </DockPanel> <designer:MachineView Width="600" IsHitTestVisible="False" Margin="0 40 0 0" DataContext="{Binding SelectedMachine}" /> <Button Command="{Binding EditMachineCommand}" HorizontalAlignment="Right" Margin="0 10 20 20" Style="{StaticResource MaterialDesignFlatButton}"> <StackPanel Orientation="Horizontal"> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs index d63e07594..706f82774 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs @@ -46,6 +46,12 @@ namespace Tango.MachineStudio.Common /// </summary> public Rect LastBounds { get; set; } + public String DefaultIssueReportAssignTo { get; set; } + + public String DefaultIssueReportArea { get; set; } + + public List<String> DefaultIssueReportTags { get; set; } + /// <summary> /// Initializes a new instance of the <see cref="MachineStudio"/> class. /// </summary> @@ -54,7 +60,7 @@ namespace Tango.MachineStudio.Common LastBounds = new Rect(); LoggingCategories = new List<LogCategory>(); UpdateServiceAddress = "http://twine01/MachineStudioUpdateService/MachineStudioUpdateService.svc"; - + DefaultIssueReportTags = new List<string>(); } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Properties/AssemblyInfo.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Properties/AssemblyInfo.cs index 2c48de076..a653afb0d 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Properties/AssemblyInfo.cs @@ -5,7 +5,7 @@ using System.Runtime.InteropServices; using System.Windows; [assembly: AssemblyTitle("Tango - Machine Studio Common Components")] -[assembly: AssemblyVersion("2.0.13.1304")] +[assembly: AssemblyVersion("2.0.14.1828")] [assembly: ComVisible(false)] [assembly:ThemeInfo( 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 99a6174a8..ed2cbdbd7 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs @@ -28,12 +28,12 @@ namespace Tango.MachineStudio.UI /// <summary> /// Interaction logic for App.xaml /// </summary> - public partial class App : Application + public partial class App : Application { private WpfGlobalExceptionTrapper exceptionTrapper; private LogManager LogManager = LogManager.Default; - protected override void OnStartup(StartupEventArgs e) + protected override void OnStartup(StartupEventArgs e) { #if DEBUG @@ -84,90 +84,98 @@ namespace Tango.MachineStudio.UI { try { - if (Application.Current == null) + try { - new Application { ShutdownMode = ShutdownMode.OnExplicitShutdown }; + if (Application.Current == null) + { + new Application { ShutdownMode = ShutdownMode.OnExplicitShutdown }; + } } - } - catch { } + catch { } - try - { - var eventLogger = TangoIOC.Default.GetInstance<IEventLogger>(); - if (eventLogger != null) + try { - eventLogger.Log(e.Exception, "Application Crashed!"); + var eventLogger = TangoIOC.Default.GetInstance<IEventLogger>(); + if (eventLogger != null) + { + eventLogger.Log(e.Exception, "Application Crashed!"); + } } - } - catch { } - - Application.Current.Dispatcher.Invoke(() => - { - WorkItem bug = null; - TeamFoundationServiceExtendedClient tfsClient = null; - INotificationProvider notification = null; + catch { } - try + Application.Current.Dispatcher.Invoke(() => { - tfsClient = TangoIOC.Default.GetInstance<TeamFoundationServiceExtendedClient>(); - notification = TangoIOC.Default.GetInstance<INotificationProvider>(); + WorkItem bug = null; + TeamFoundationServiceExtendedClient tfsClient = null; + INotificationProvider notification = null; + + try + { + tfsClient = TangoIOC.Default.GetInstance<TeamFoundationServiceExtendedClient>(); + notification = TangoIOC.Default.GetInstance<INotificationProvider>(); - if (tfsClient != null && tfsClient.IsInitialized) + if (tfsClient != null && tfsClient.IsInitialized) + { + bug = tfsClient.CreateBug(); + } + } + catch (Exception ex) { - bug = tfsClient.CreateBug(); + Debug.WriteLine(ex.ToString()); } - } - catch (Exception ex) - { - Debug.WriteLine(ex.ToString()); - } - ExceptionWindow exWin = new ExceptionWindow(e.Exception, bug != null); - exWin.ShowDialog(); + ExceptionWindow exWin = new ExceptionWindow(e.Exception, bug != null); + exWin.ShowDialog(); - switch (exWin.Resolution) - { - case ExceptionResolutions.Ignore: - e.TryRecover = true; - break; - case ExceptionResolutions.Restart: - e.TryRecover = false; - LogManager.Log("User selection was to restart the application. Restarting..."); - Process.Start(Application.ResourceAssembly.Location); - Environment.Exit(0); - break; - case ExceptionResolutions.Shutdown: - e.TryRecover = false; - LogManager.Log("User selection was to shutdown the application. Restarting..."); - Environment.Exit(0); - break; - case ExceptionResolutions.Report: - e.TryRecover = true; - LogManager.Log("User selection was to report the issue."); + switch (exWin.Resolution) + { + case ExceptionResolutions.Ignore: + e.TryRecover = true; + break; + case ExceptionResolutions.Restart: + e.TryRecover = false; + LogManager.Log("User selection was to restart the application. Restarting..."); + Process.Start(Application.ResourceAssembly.Location); + Environment.Exit(0); + break; + case ExceptionResolutions.Shutdown: + e.TryRecover = false; + LogManager.Log("User selection was to shutdown the application. Restarting..."); + Environment.Exit(0); + break; + case ExceptionResolutions.Report: + e.TryRecover = true; + LogManager.Log("User selection was to report the issue."); - if (bug != null) - { - notification.ShowModalDialog<ReportIssueViewVM, ReportIssueView>(new ReportIssueViewVM(tfsClient.Project, bug), async (vm) => + if (bug != null) { - using (notification.PushTaskItem("Uploading bug report...")) + notification.ShowModalDialog<ReportIssueViewVM, ReportIssueView>(new ReportIssueViewVM(tfsClient.Project, bug), async (vm) => { - try + using (notification.PushTaskItem("Uploading bug report...")) { - tfsClient.FinalizeBug(vm.WorkItem); - await tfsClient.UploadWorkItem(vm.WorkItem); + try + { + tfsClient.FinalizeBug(vm.WorkItem); + await tfsClient.UploadWorkItem(vm.WorkItem); + } + catch (Exception ex) + { + notification.ShowError("An error occurred while trying to create the issue." + Environment.NewLine + ex.Message); + } } - catch (Exception ex) - { - notification.ShowError("An error occurred while trying to create the issue." + Environment.NewLine + ex.Message); - } - } - }, null); - } + }, null); + } - break; - } - }); + break; + } + }); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error in global exception trapper!"); + MessageBox.Show(ex.ToStringSafe()); + } } #endregion 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 121d4ab07..5c08c868b 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("2.1.12.18210")] +[assembly: AssemblyVersion("2.1.14.18213")] [assembly: ComVisible(false)]
\ No newline at end of file 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 3dbee402b..d81a78a93 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/TeamFoundationServiceExtendedClient.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/TeamFoundationServiceExtendedClient.cs @@ -10,6 +10,7 @@ using System.Windows; using Tango.BL.Entities; using Tango.Core.DI; using Tango.Core.Helpers; +using Tango.Core.IO; using Tango.Integration.Operation; using Tango.Logging; using Tango.MachineStudio.Common.Authentication; @@ -21,6 +22,8 @@ namespace Tango.MachineStudio.UI.TFS { public class TeamFoundationServiceExtendedClient : TeamFoundationServiceClient { + private TemporaryFolder _tempFolder; + public Project Project { get; private set; } private ObservableCollection<WorkItem> _resolvedWorkItems; @@ -39,6 +42,8 @@ namespace Tango.MachineStudio.UI.TFS public TeamFoundationServiceExtendedClient(string collectionURL, string userName, string personalToken) : base(collectionURL, userName, personalToken) { + _tempFolder = TemporaryManager.CreateFolder(); + ResolvedWorkItems = new ObservableCollection<WorkItem>(); TangoIOC.Default.GetInstance<IAuthenticationProvider>().CurrentUserChanged += TeamFoundationServiceExtendedClient_CurrentUserChanged; } @@ -136,7 +141,7 @@ namespace Tango.MachineStudio.UI.TFS item.Type = WorkItemType.Bug; var bitmap = UIHelper.TakeSnapshot(MainWindow.Instance); - var tempFile = TemporaryManager.CreateFile(); + var tempFile = _tempFolder.CreateFile(); bitmap.SaveJpeg(tempFile.Path, 30); item.Attachments.Add(new Attachment() @@ -159,7 +164,7 @@ namespace Tango.MachineStudio.UI.TFS if (appFileLogger != null) { - var appLogFile = TemporaryManager.CreateFile(); + var appLogFile = _tempFolder.CreateImaginaryFile(); File.Copy(appFileLogger.LogFile, appLogFile.Path); item.Attachments.Add(new Attachment() @@ -172,7 +177,7 @@ namespace Tango.MachineStudio.UI.TFS if (embeddedFileLogger != null && File.Exists(embeddedFileLogger.LogFile)) { - var embeddedLogFile = TemporaryManager.CreateFile(); + var embeddedLogFile = _tempFolder.CreateImaginaryFile(); File.Copy(appFileLogger.LogFile, embeddedLogFile.Path); item.Attachments.Add(new Attachment() @@ -204,7 +209,7 @@ namespace Tango.MachineStudio.UI.TFS machineView.Background = System.Windows.Media.Brushes.White; machineView.DataContext = new MachineDesigner.ViewModels.MainViewVM() { SelectedMachine = machine, Configuration = machine.Configuration }; - var configImageFile = TemporaryManager.CreateFile(); + var configImageFile = _tempFolder.CreateImaginaryFile(); machineView.RenderToFile(configImageFile.Path, System.Drawing.Imaging.ImageFormat.Jpeg, new Size(machineView.Width, machineView.Height), 100); item.Attachments.Add(new Attachment() 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 35a4b0e9d..5467c53a0 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ConnectedMachineViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ConnectedMachineViewVM.cs @@ -20,6 +20,7 @@ namespace Tango.MachineStudio.UI.ViewModels Disconnect, UploadHardwareConfig, Reset, + TurnOffHeaters } private IStudioApplicationManager _applicationManager; @@ -45,31 +46,22 @@ namespace Tango.MachineStudio.UI.ViewModels public RelayCommand ResetCommand { get; set; } + public RelayCommand TurnOffHeatersCommand { get; set; } + public ConnectedMachineViewVM(IStudioApplicationManager application, IDiagnosticsFrameProvider frameProvider) { ApplicationManager = application; - DisconnectCommand = new RelayCommand(Disconnect); - UploadHardwareConfigurationCommand = new RelayCommand(UploadHardwareConfiguration); - ResetCommand = new RelayCommand(Reset); + DisconnectCommand = new RelayCommand(() => AcceptResult(ConnectedMachineVMResult.Disconnect)); + UploadHardwareConfigurationCommand = new RelayCommand(() => AcceptResult(ConnectedMachineVMResult.UploadHardwareConfig)); + ResetCommand = new RelayCommand(() => AcceptResult(ConnectedMachineVMResult.Reset)); + TurnOffHeatersCommand = new RelayCommand(() => AcceptResult(ConnectedMachineVMResult.TurnOffHeaters)); DiagnosticsFrameProvider = frameProvider; } - private void Reset() - { - Result = ConnectedMachineVMResult.Reset; - Accept(); - } - - private void UploadHardwareConfiguration() - { - Result = ConnectedMachineVMResult.UploadHardwareConfig; - Accept(); - } - - private void Disconnect() + private void AcceptResult(ConnectedMachineVMResult result) { - Result = ConnectedMachineVMResult.Disconnect; + Result = result; Accept(); } } 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 d0bddf3f2..df1ea5f7e 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs @@ -554,8 +554,8 @@ namespace Tango.MachineStudio.UI.ViewModels } catch (Exception ex) { - LogManager.Log(ex, "Error upload hardware configuration."); - NotificationProvider.ShowError("Error upload hardware configuration." + Environment.NewLine + ex.Message); + LogManager.Log(ex, "Error uploading hardware configuration."); + NotificationProvider.ShowError("Error uploading hardware configuration." + Environment.NewLine + ex.Message); } } } @@ -564,7 +564,7 @@ namespace Tango.MachineStudio.UI.ViewModels { if (NotificationProvider.ShowQuestion("This will reset the embedded device. Are you sure?")) { - using (NotificationProvider.PushTaskItem("Uploading hardware configuration...")) + using (NotificationProvider.PushTaskItem("Resetting the embedded device...")) { try { @@ -579,6 +579,25 @@ namespace Tango.MachineStudio.UI.ViewModels } } } + else if (x.Result == ConnectedMachineViewVM.ConnectedMachineVMResult.TurnOffHeaters) + { + if (NotificationProvider.ShowQuestion("This will reset the process parameters. Are you sure?")) + { + using (NotificationProvider.PushTaskItem("Resetting process parameters...")) + { + try + { + await ApplicationManager.ConnectedMachine.UploadProcessParameters(new ProcessParametersTable()); + NotificationProvider.ShowInfo("Heaters are turned off."); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error resetting process parameters."); + NotificationProvider.ShowError("Error resetting process parameters." + Environment.NewLine + ex.Message); + } + } + } + } }); } @@ -744,7 +763,9 @@ namespace Tango.MachineStudio.UI.ViewModels private void ReportIssue() { - _notificationProvider.ShowModalDialog<ReportIssueViewVM, ReportIssueView>(new ReportIssueViewVM(TFSClient.Project, TFSClient.CreateBug()), async (vm) => + var bug = TFSClient.CreateBug(); + + _notificationProvider.ShowModalDialog<ReportIssueViewVM, ReportIssueView>(new ReportIssueViewVM(TFSClient.Project, bug), async (vm) => { using (_notificationProvider.PushTaskItem("Uploading bug report...")) { diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ReportIssueViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ReportIssueViewVM.cs index 2935ff81b..96800d9cf 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ReportIssueViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ReportIssueViewVM.cs @@ -3,8 +3,10 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.MachineStudio.Common; using Tango.MachineStudio.Common.Notifications; using Tango.MachineStudio.UI.TFS; +using Tango.Settings; using Tango.SharedUI; using Tango.SharedUI.Components; using Tango.TFS; @@ -13,6 +15,8 @@ namespace Tango.MachineStudio.UI.ViewModels { public class ReportIssueViewVM : DialogViewVM { + private MachineStudioSettings _settings; + public SelectedObjectCollection<Tag> SelectedTags { get; set; } public Project Project { get; set; } @@ -22,14 +26,33 @@ namespace Tango.MachineStudio.UI.ViewModels public ReportIssueViewVM() : base() { - + _settings = SettingsManager.Default.GetOrCreate<MachineStudioSettings>(); } public ReportIssueViewVM(Project project, WorkItem workItem) : this() { Project = project; WorkItem = workItem; - SelectedTags = new SelectedObjectCollection<Tag>(Project.Tags.ToObservableCollection(), new System.Collections.ObjectModel.ObservableCollection<Tag>()); + + var area = project.Areas.FirstOrDefault(x => x.Name == _settings.DefaultIssueReportArea); + if (area != null) + { + workItem.Area = area; + } + + var assignedTo = project.Members.FirstOrDefault(x => x.Email == _settings.DefaultIssueReportAssignTo); + if (assignedTo != null) + { + workItem.AssignedTo = assignedTo; + } + + var tags = project.Tags.Where(x => _settings.DefaultIssueReportTags.Contains(x.Name)).ToList(); + if (tags != null) + { + workItem.Tags = tags; + } + + SelectedTags = new SelectedObjectCollection<Tag>(Project.Tags.ToObservableCollection(), workItem.Tags.ToObservableCollection()); } protected override void Accept() @@ -37,6 +60,16 @@ namespace Tango.MachineStudio.UI.ViewModels if (Validate()) { WorkItem.Tags = SelectedTags.SynchedSource.ToList(); + + try + { + _settings.DefaultIssueReportArea = WorkItem.Area.Name; + _settings.DefaultIssueReportAssignTo = WorkItem.AssignedTo.Email; + _settings.DefaultIssueReportTags = WorkItem.Tags.Select(x => x.Name).ToList(); + _settings.Save(); + } + catch { } + base.Accept(); } } 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 aa2b014fe..995ac4575 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml @@ -46,11 +46,17 @@ </Grid> <Grid Grid.Row="1" Margin="10 0 10 10"> + <Grid.RowDefinitions> - <RowDefinition Height="1*"/> - <RowDefinition Height="50"/> + <RowDefinition Height="1*"></RowDefinition> + <RowDefinition Height="Auto"></RowDefinition> </Grid.RowDefinitions> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="1*"></ColumnDefinition> + <ColumnDefinition Width="Auto"></ColumnDefinition> + </Grid.ColumnDefinitions> + <Grid d:DataContext="{d:DesignInstance Type=integ:MachineOperator, IsDesignTimeCreatable=False}"> <ContentControl Content="{Binding ApplicationManager.ConnectedMachine}"> <ContentControl.Resources> @@ -125,18 +131,31 @@ </ContentControl> </Grid> - <Grid Grid.Row="1"> + <Grid Grid.Row="1" Grid.ColumnSpan="2"> <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Height="40" VerticalAlignment="Bottom"> - <Button Height="Auto" Width="140" Command="{Binding ResetCommand}" Background="#FF5454" BorderBrush="#FF5454" Margin="0 0 10 0" ToolTip="Reset the embedded device">RESET</Button> - <Button Height="Auto" Command="{Binding UploadHardwareConfigurationCommand}" ToolTip="Upload the current hardware configuration stored for this machine"> - <StackPanel Orientation="Horizontal"> - <TextBlock VerticalAlignment="Center">UPLOAD HW CONFIG</TextBlock> - <materialDesign:PackIcon Margin="10 0 0 0" Width="16" Height="16" VerticalAlignment="Center" Kind="ArrowRightBold"/> - </StackPanel> - </Button> - <Button Height="Auto" Width="140" Command="{Binding DisconnectCommand}" Margin="10 0 0 0">DISCONNECT</Button> + + </StackPanel> + </Grid> + + <Grid Grid.Row="1" Grid.ColumnSpan="2"> + <StackPanel HorizontalAlignment="Right" Orientation="Horizontal"> + <Button DockPanel.Dock="Bottom" Height="40" Width="170" Command="{Binding UploadHardwareConfigurationCommand}" ToolTip="Upload the current hardware configuration stored for this machine">UPLOAD HW CONFIG</Button> + <Button DockPanel.Dock="Bottom" Height="40" Width="140" Command="{Binding DisconnectCommand}" Margin="10 0 0 0">DISCONNECT</Button> </StackPanel> </Grid> + + <Grid Grid.Column="1"> + <DockPanel> + <StackPanel> + <Button FontSize="11" Height="40" Width="140" Command="{Binding ResetCommand}" Background="Transparent" BorderBrush="#202020" Foreground="#202020" Margin="0 2" ToolTip="Reset the embedded device">RESET</Button> + <Button FontSize="11" Height="40" Width="140" Command="{Binding TurnOffHeatersCommand}" Background="Transparent" BorderBrush="#202020" Foreground="#202020" Margin="0 2" ToolTip="Resets the current process parameters in the embedded device"> + <TextBlock TextWrapping="Wrap" TextAlignment="Center"> + TURN OFF HEATERS + </TextBlock> + </Button> + </StackPanel> + </DockPanel> + </Grid> </Grid> </Grid> </Grid> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ReportIssueView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ReportIssueView.xaml index 2a6228eda..aa2a70a5f 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ReportIssueView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ReportIssueView.xaml @@ -40,7 +40,7 @@ <StackPanel DockPanel.Dock="Top"> <DockPanel> <materialDesign:PackIcon Kind="Pencil" Width="24" Height="24" VerticalAlignment="Center" Margin="0 0 10 0" /> - <TextBox materialDesign:HintAssist.Hint="Title" materialDesign:HintAssist.IsFloating="True" FontSize="16" Text="{Binding WorkItem.Title}"></TextBox> + <TextBox x:Name="txt_title" materialDesign:HintAssist.Hint="Title" materialDesign:HintAssist.IsFloating="True" FontSize="16" Text="{Binding WorkItem.Title}"></TextBox> </DockPanel> <DockPanel Margin="0 10 0 0"> @@ -114,7 +114,7 @@ <ItemsControl ItemsSource="{Binding ValidationErrors}" HorizontalAlignment="Left" Margin="5" VerticalAlignment="Center" Visibility="Visible"> <ItemsControl.ItemTemplate> <DataTemplate> - <TextBlock Foreground="#FF4C4C" Margin="0 2 0 0"><Run>*</Run> <Run Text="{Binding Path=*,Mode=OneWay}"></Run></TextBlock> + <TextBlock Foreground="#FF4C4C" Margin="0 2 0 0"><Run>*</Run> <Run Text="{Binding Path=.,Mode=OneWay}"></Run></TextBlock> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ReportIssueView.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ReportIssueView.xaml.cs index 91a288d3e..72bef1205 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ReportIssueView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ReportIssueView.xaml.cs @@ -23,6 +23,13 @@ namespace Tango.MachineStudio.UI.Views public ReportIssueView() { InitializeComponent(); + + this.Loaded += ReportIssueView_Loaded; + } + + private void ReportIssueView_Loaded(object sender, RoutedEventArgs e) + { + txt_title.Focus(); } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/MachineStudioUpdateService.svc.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/MachineStudioUpdateService.svc.cs index 9ec234449..3320a86c7 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/MachineStudioUpdateService.svc.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UpdateService/MachineStudioUpdateService.svc.cs @@ -67,6 +67,8 @@ namespace Tango.MachineStudio.UpdateService var latestVersion = db.MachineStudioVersions.ToList().OrderByDescending(x => Version.Parse(x.Version)).FirstOrDefault(); Version currentVersion = Version.Parse(request.Version); + bool isForcedUpdate = db.MachineStudioVersions.ToList().Exists(x => x.ForceUpdate && Version.Parse(x.Version) > currentVersion); + if (latestVersion != null && Version.Parse(latestVersion.Version) > currentVersion) { response.IsUpdateAvailable = true; @@ -76,7 +78,7 @@ namespace Tango.MachineStudio.UpdateService response.Password = ConfigurationManager.AppSettings["Password"].ToString(); response.FilePath = latestVersion.FtpFilePath; response.Version = latestVersion.Version; - response.ForcedUpdate = latestVersion.ForceUpdate; + response.ForcedUpdate = isForcedUpdate; } } else |
