diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-01-16 15:13:55 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-01-16 15:13:55 +0200 |
| commit | 92c52918e13dbbaf2a658945c349a6d04c29aa81 (patch) | |
| tree | 82967e8201bcf009c8a51ea2284a759fae3fd69b /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ReportIssueViewVM.cs | |
| parent | e87626ffc0298426d8242c2453a6992d94f38e1f (diff) | |
| download | Tango-92c52918e13dbbaf2a658945c349a6d04c29aa81.tar.gz Tango-92c52918e13dbbaf2a658945c349a6d04c29aa81.zip | |
Added custom image support for bug reporting.
Fixed issue with dispensers filter search.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ReportIssueViewVM.cs')
| -rw-r--r-- | Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ReportIssueViewVM.cs | 36 |
1 files changed, 35 insertions, 1 deletions
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 96800d9cf..21330a4fc 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ReportIssueViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ReportIssueViewVM.cs @@ -1,8 +1,11 @@ -using System; +using Microsoft.Win32; +using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.Core.Commands; using Tango.MachineStudio.Common; using Tango.MachineStudio.Common.Notifications; using Tango.MachineStudio.UI.TFS; @@ -24,9 +27,19 @@ namespace Tango.MachineStudio.UI.ViewModels [WorkItemValidation] public WorkItem WorkItem { get; set; } + private String _imageFile; + public String ImageFile + { + get { return _imageFile; } + set { _imageFile = value; RaisePropertyChangedAuto(); } + } + + public RelayCommand BrowseImageCommand { get; set; } + public ReportIssueViewVM() : base() { _settings = SettingsManager.Default.GetOrCreate<MachineStudioSettings>(); + BrowseImageCommand = new RelayCommand(BrowseImage); } public ReportIssueViewVM(Project project, WorkItem workItem) : this() @@ -55,12 +68,33 @@ namespace Tango.MachineStudio.UI.ViewModels SelectedTags = new SelectedObjectCollection<Tag>(Project.Tags.ToObservableCollection(), workItem.Tags.ToObservableCollection()); } + private void BrowseImage() + { + OpenFileDialog dlg = new OpenFileDialog(); + dlg.Title = "Select image file"; + dlg.Filter = "Image Files|*.jpg;*.bmp;*.png"; + if (dlg.ShowDialog().Value) + { + ImageFile = dlg.FileName; + } + } + protected override void Accept() { if (Validate()) { WorkItem.Tags = SelectedTags.SynchedSource.ToList(); + if (ImageFile != null && File.Exists(ImageFile)) + { + WorkItem.Attachments.Add(new Attachment() + { + Description = "User Image", + FilePath = ImageFile, + Name = Path.GetFileName(ImageFile), + }); + } + try { _settings.DefaultIssueReportArea = WorkItem.Area.Name; |
