diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-04-24 19:05:53 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-04-24 19:05:53 +0300 |
| commit | 97e45f70267d961168b77b149022b94022e0e199 (patch) | |
| tree | 89bf6c1c893ab099ef99690d155a0855ba8a9d92 /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels | |
| parent | 8046598cb1439b66a8d6e556a61b715fc859a6b0 (diff) | |
| download | Tango-97e45f70267d961168b77b149022b94022e0e199.tar.gz Tango-97e45f70267d961168b77b149022b94022e0e199.zip | |
Working on reporting...
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels')
3 files changed, 83 insertions, 2 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs index 512341f7e..2b2b442f7 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs @@ -15,6 +15,7 @@ using Tango.SharedUI; using Tango.BL; using Tango.MachineStudio.Common.EventLogging; using Tango.BL.Enumerations; +using Tango.MachineStudio.UI.TFS; namespace Tango.MachineStudio.UI.ViewModels { @@ -25,6 +26,7 @@ namespace Tango.MachineStudio.UI.ViewModels public class LoadingViewVM : ViewModel { private INotificationProvider _notificationProvider; + private TeamFoundationServiceExtendedClient _tfs; private INavigationManager _navigationManager; private IStudioModuleLoader _studioModuleLoader; private IEventLogger _eventLogger; @@ -45,8 +47,9 @@ namespace Tango.MachineStudio.UI.ViewModels /// <param name="navigationManager">The navigation manager.</param> /// <param name="studioModuleLoader">The studio module loader.</param> /// <param name="notificationProvider">The notification provider.</param> - public LoadingViewVM(IStudioApplicationManager applicationManager, INavigationManager navigationManager, IStudioModuleLoader studioModuleLoader, INotificationProvider notificationProvider, IEventLogger eventLogger) + public LoadingViewVM(IStudioApplicationManager applicationManager, INavigationManager navigationManager, IStudioModuleLoader studioModuleLoader, INotificationProvider notificationProvider, IEventLogger eventLogger, TeamFoundationServiceExtendedClient teamFoundationClient) { + _tfs = teamFoundationClient; _eventLogger = eventLogger; ApplicationManager = applicationManager; _navigationManager = navigationManager; @@ -66,6 +69,15 @@ namespace Tango.MachineStudio.UI.ViewModels { try { + try + { + _tfs.Initialize(); + } + catch (Exception ex) + { + LogManager.Log(ex, "Could not initialize Team Foundation Service client."); + } + ObservablesEntitiesAdapter.Instance.Initialize(); _eventLogger.Log(EventTypes.ApplicationStarted, "Application Started!"); 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 2144983de..0882267e8 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs @@ -29,6 +29,7 @@ using Tango.MachineStudio.Common.StudioApplication; using Tango.MachineStudio.Common.Update; using Tango.MachineStudio.UI.StudioApplication; using Tango.MachineStudio.UI.SupervisingController; +using Tango.MachineStudio.UI.TFS; using Tango.MachineStudio.UI.Views; using Tango.MachineStudio.UI.Windows; using Tango.PMR.Stubs; @@ -142,6 +143,11 @@ namespace Tango.MachineStudio.UI.ViewModels /// </summary> public RelayCommand<MachinesEvent> ResolveMachineEventCommand { get; set; } + /// <summary> + /// Gets or sets the report issue command. + /// </summary> + public RelayCommand ReportIssueCommand { get; set; } + private IAuthenticationProvider _authenticationProvider; /// <summary> /// Gets or sets the authentication provider. @@ -183,6 +189,11 @@ namespace Tango.MachineStudio.UI.ViewModels } /// <summary> + /// Gets or sets the TFS client. + /// </summary> + public TeamFoundationServiceExtendedClient TFSClient { get; set; } + + /// <summary> /// Gets or sets the speech provider. /// </summary> public ISpeechProvider SpeechProvider { get; set; } @@ -247,8 +258,9 @@ namespace Tango.MachineStudio.UI.ViewModels IEventLogger eventLogger, IDiagnosticsFrameProvider frameProvider, ISpeechProvider speechProvider, - IHtmlPresenter htmlPresenter) : base() + IHtmlPresenter htmlPresenter, TeamFoundationServiceExtendedClient tfs) : base() { + TFSClient = tfs; _eventLogger = eventLogger; _navigation = navigationManager; AuthenticationProvider = authenticationProvider; @@ -288,6 +300,8 @@ namespace Tango.MachineStudio.UI.ViewModels ToggleSpeechCommand = new RelayCommand(() => { SpeechProvider.Mute = !SpeechProvider.Mute; }); ResolveMachineEventCommand = new RelayCommand<MachinesEvent>(ResolveMachineEvent); + + ReportIssueCommand = new RelayCommand(ReportIssue); } private void MachineEventsStateProvider_EventsResolved(object sender, IEnumerable<MachinesEvent> e) @@ -628,5 +642,17 @@ namespace Tango.MachineStudio.UI.ViewModels _notificationProvider.ShowWarning("Could not locate guidance content for the specified event."); } } + + private void ReportIssue() + { + _notificationProvider.ShowModalDialog<ReportIssueViewVM, ReportIssueView>(new ReportIssueViewVM(TFSClient.Project, TFSClient.CreateBug()), async (vm) => + { + using (_notificationProvider.PushTaskItem("Uploading bug report...")) + { + await TFSClient.UploadWorkItem(vm.WorkItem); + } + + }, null); + } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ReportIssueViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ReportIssueViewVM.cs new file mode 100644 index 000000000..9660db8a5 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ReportIssueViewVM.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.MachineStudio.Common.Notifications; +using Tango.MachineStudio.UI.TFS; +using Tango.SharedUI.Components; +using Tango.TFS; + +namespace Tango.MachineStudio.UI.ViewModels +{ + public class ReportIssueViewVM : DialogViewVM + { + public SelectedObjectCollection<Tag> SelectedTags { get; set; } + + public Project Project { get; set; } + + [WorkItemValidation] + public WorkItem WorkItem { get; set; } + + public ReportIssueViewVM() : base() + { + + } + + public ReportIssueViewVM(Project project, WorkItem workItem) : this() + { + Project = project; + WorkItem = workItem; + SelectedTags = new SelectedObjectCollection<Tag>(Project.Tags.ToObservableCollection(), new System.Collections.ObjectModel.ObservableCollection<Tag>()); + } + + protected override void Accept() + { + if (Validate()) + { + WorkItem.Tags = SelectedTags.SynchedSource.ToList(); + base.Accept(); + } + } + } +} |
