diff options
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs')
| -rw-r--r-- | Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs | 84 |
1 files changed, 82 insertions, 2 deletions
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 0882267e8..04b973f23 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs @@ -148,6 +148,16 @@ namespace Tango.MachineStudio.UI.ViewModels /// </summary> public RelayCommand ReportIssueCommand { get; set; } + /// <summary> + /// Gets or sets the open resolved bugs. + /// </summary> + public RelayCommand OpenResolvedBugsCommand { get; set; } + + /// <summary> + /// Gets or sets the open developer console command. + /// </summary> + public RelayCommand OpenDeveloperConsoleCommand { get; set; } + private IAuthenticationProvider _authenticationProvider; /// <summary> /// Gets or sets the authentication provider. @@ -302,6 +312,8 @@ namespace Tango.MachineStudio.UI.ViewModels ResolveMachineEventCommand = new RelayCommand<MachinesEvent>(ResolveMachineEvent); ReportIssueCommand = new RelayCommand(ReportIssue); + OpenResolvedBugsCommand = new RelayCommand(OpenResolvedBugs); + OpenDeveloperConsoleCommand = new RelayCommand(OpenDeveloperConsole); } private void MachineEventsStateProvider_EventsResolved(object sender, IEnumerable<MachinesEvent> e) @@ -321,7 +333,7 @@ namespace Tango.MachineStudio.UI.ViewModels { while (!DisableCheckForUpdates) { - Thread.Sleep(TimeSpan.FromMinutes(1)); + Thread.Sleep(TimeSpan.FromMinutes(0.2)); try { @@ -649,10 +661,78 @@ namespace Tango.MachineStudio.UI.ViewModels { using (_notificationProvider.PushTaskItem("Uploading bug report...")) { - await TFSClient.UploadWorkItem(vm.WorkItem); + try + { + TFSClient.FinalizeBug(vm.WorkItem); + await TFSClient.UploadWorkItem(vm.WorkItem); + } + catch (Exception ex) + { + _notificationProvider.ShowError("An error occurred while trying to create the issue." + Environment.NewLine + ex.Message); + } } }, null); } + + private void OpenResolvedBugs() + { + ResolvedIssuesViewVM vm = null; + + vm = new ResolvedIssuesViewVM(TFSClient, async (item) => + { + //Approve + using (_notificationProvider.PushTaskItem("Approving issue...")) + { + vm.IsAvailable = false; + try + { + await TFSClient.CloseWorkItem(item); + } + catch (Exception ex) + { + _notificationProvider.ShowError("An error occurred while trying to update the issue." + Environment.NewLine + ex.Message); + } + vm.IsAvailable = true; + + if (TFSClient.ResolvedWorkItems.Count == 0) + { + vm.Close(); + } + } + }, async (item) => + { + //Decline + using (_notificationProvider.PushTaskItem("Reactivating issue...")) + { + vm.IsAvailable = false; + try + { + await TFSClient.ReactivateWorkItem(item); + } + catch (Exception ex) + { + _notificationProvider.ShowError("An error occurred while trying to update the issue." + Environment.NewLine + ex.Message); + } + + vm.IsAvailable = true; + + if (TFSClient.ResolvedWorkItems.Count == 0) + { + vm.Close(); + } + } + }); + + _notificationProvider.ShowModalDialog<ResolvedIssuesViewVM, ResolvedIssuesView>(vm, (_) => { }, null); + } + + private void OpenDeveloperConsole() + { + Console.ConsoleWindow console = new Console.ConsoleWindow(); + ApplicationManager.RegisterOpenedWindow(console); + console.Owner = MainWindow.Instance; + console.Show(); + } } } |
