diff options
| author | Avi Levkovich <avi@twine-s.com> | 2019-01-17 15:44:21 +0200 |
|---|---|---|
| committer | Avi Levkovich <avi@twine-s.com> | 2019-01-17 15:44:21 +0200 |
| commit | 589f7f5d7bf90b16a0d5cd416f180a6349d8ad42 (patch) | |
| tree | 6a21decd622c5fb1eb22d1354e64353471749056 /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ReportIssueViewVM.cs | |
| parent | 58cdf26ffe2af6f38991b4b52ab723bb8bf53a69 (diff) | |
| parent | 7ec8ef0db960af495ead5e63b10e6b85f2a08b56 (diff) | |
| download | Tango-589f7f5d7bf90b16a0d5cd416f180a6349d8ad42.tar.gz Tango-589f7f5d7bf90b16a0d5cd416f180a6349d8ad42.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/_git/Tango
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; |
