aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs')
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs51
1 files changed, 50 insertions, 1 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 d9c64b9e3..f124ebb54 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs
@@ -15,6 +15,11 @@ using Tango.Settings;
using Tango.MachineStudio.Common.EventLogging;
using Tango.BL.Enumerations;
using Tango.Core.DI;
+using Tango.MachineStudio.UI.TFS;
+using Tango.TFS;
+using Tango.MachineStudio.Common.Notifications;
+using Tango.MachineStudio.UI.ViewModels;
+using Tango.MachineStudio.UI.Views;
namespace Tango.MachineStudio.UI
{
@@ -82,7 +87,26 @@ namespace Tango.MachineStudio.UI
Application.Current.Dispatcher.Invoke(() =>
{
- ExceptionWindow exWin = new ExceptionWindow(e.Exception);
+ 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)
+ {
+ bug = tfsClient.CreateBug();
+ }
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine(ex.ToString());
+ }
+
+ ExceptionWindow exWin = new ExceptionWindow(e.Exception, bug != null);
exWin.ShowDialog();
switch (exWin.Resolution)
@@ -101,6 +125,31 @@ namespace Tango.MachineStudio.UI
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) =>
+ {
+ using (notification.PushTaskItem("Uploading bug report..."))
+ {
+ 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);
+ }
+ }
+
+ }, null);
+ }
+
+ break;
}
});
}