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 | |
| 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')
5 files changed, 66 insertions, 18 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs index 6146d8f45..2e23d9d61 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs @@ -379,6 +379,5 @@ namespace Tango.MachineStudio.UI.StudioApplication ConnectedMachine = null; } } - } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/TeamFoundationServiceExtendedClient.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/TeamFoundationServiceExtendedClient.cs index addd2f4fb..df831afb9 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/TeamFoundationServiceExtendedClient.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/TeamFoundationServiceExtendedClient.cs @@ -159,22 +159,27 @@ namespace Tango.MachineStudio.UI.TFS item.State = State.New; item.Type = WorkItemType.Bug; - var bitmap = UIHelper.TakeSnapshot(MainWindow.Instance); - - if (!_tempFolder.Exists()) + foreach (var window in Application.Current.Windows.OfType<Window>().Where(x => !String.IsNullOrWhiteSpace(x.Title))) { - _tempFolder = TemporaryManager.CreateFolder(); - } + var bitmap = UIHelper.TakeSnapshot(window); - var tempFile = _tempFolder.CreateFile(); - bitmap.SaveJpeg(tempFile.Path, 30); + if (!_tempFolder.Exists()) + { + _tempFolder = TemporaryManager.CreateFolder(); + } - item.Attachments.Add(new Attachment() - { - Description = "Screen Capture", - FilePath = tempFile.Path, - Name = "Screen Capture.jpg", - }); + var tempFile = _tempFolder.CreateFile(); + bitmap.SaveJpeg(tempFile.Path, 30); + + String title = window.Title; + + item.Attachments.Add(new Attachment() + { + Description = title + " Screen Capture", + FilePath = tempFile.Path, + Name = $"{title}.jpg", + }); + } return item; } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj index 706b1c8f7..9f2cddd68 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj @@ -609,7 +609,7 @@ copy /Y "$(SolutionDir)Referenced Assemblies\Microsoft.WITDataStore32.dll" "$(Ta </Target> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_UseGlobalSettings="False" BuildVersion_DetectChanges="True" BuildVersion_UpdateFileVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.DeltaBaseYearDayOfYear" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_StartDate="2000/1/1" /> + <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_BuildVersioningStyle="None.None.Increment.DeltaBaseYearDayOfYear" BuildVersion_UpdateFileVersion="True" BuildVersion_DetectChanges="True" BuildVersion_UseGlobalSettings="False" /> </VisualStudio> </ProjectExtensions> </Project>
\ No newline at end of file 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; diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ReportIssueView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ReportIssueView.xaml index aa2a70a5f..7387c4ae5 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ReportIssueView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ReportIssueView.xaml @@ -12,7 +12,7 @@ xmlns:tfs="clr-namespace:Tango.TFS;assembly=Tango.TFS" xmlns:tfss="clr-namespace:Tango.MachineStudio.UI.TFS" xmlns:local="clr-namespace:Tango.MachineStudio.UI.Views" - mc:Ignorable="d" Width="530" Height="680" Background="White" d:DataContext="{d:DesignInstance Type=vm:ReportIssueViewVM, IsDesignTimeCreatable=False}"> + mc:Ignorable="d" Width="530" Height="720" Background="White" d:DataContext="{d:DesignInstance Type=vm:ReportIssueViewVM, IsDesignTimeCreatable=False}"> <UserControl.Resources> <converters:EnumToItemsSourceConverter x:Key="EnumToItemsSourceConverter" /> @@ -91,11 +91,21 @@ </ItemsControl.ItemTemplate> </ItemsControl> </ScrollViewer> + + <DockPanel Margin="0 20 0 0"> + <materialDesign:PackIcon Kind="FileImage" Width="24" Height="24" VerticalAlignment="Center" Margin="0 0 10 0" /> + <TextBlock VerticalAlignment="Center"><Run>Attach Image</Run></TextBlock> + </DockPanel> + <DockPanel Margin="30 0 0 0"> + <Button DockPanel.Dock="Right" Margin="10 0 0 0" Style="{StaticResource MaterialDesignFlatButton}" Command="{Binding BrowseImageCommand}">BROWSE</Button> + <TextBox IsReadOnly="True" Text="{Binding ImageFile}"></TextBox> + </DockPanel> </StackPanel> + <Grid> <DockPanel> - <DockPanel Margin="0 10 0 0" DockPanel.Dock="Top"> + <DockPanel Margin="0 20 0 0" DockPanel.Dock="Top"> <materialDesign:PackIcon Kind="ChartTimeline" Width="24" Height="24" VerticalAlignment="Center" Margin="0 0 10 0" /> <TextBlock VerticalAlignment="Center">Steps To Reproduce</TextBlock> </DockPanel> |
