From e87626ffc0298426d8242c2453a6992d94f38e1f Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Wed, 16 Jan 2019 14:30:46 +0200 Subject: Fixed issue with cached tokens when authenticating users in machine service with AD. Improved Login View. --- .../Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels') diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs index 4ebf3d96d..c8e25e2d4 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs @@ -87,6 +87,17 @@ namespace Tango.MachineStudio.UI.ViewModels set { _rememberMe = value; RaisePropertyChangedAuto(); } } + private bool _enableSlotSelection; + /// + /// Gets or sets a value indicating whether to enable the deployment slot selection. + /// + public bool EnableSlotSelection + { + get { return _enableSlotSelection; } + set { _enableSlotSelection = value; RaisePropertyChangedAuto(); } + } + + /// /// Gets or sets the login command. /// @@ -100,6 +111,8 @@ namespace Tango.MachineStudio.UI.ViewModels /// The notification provider. public LoginViewVM(IAuthenticationProvider authenticationProvider, INavigationManager navigationManager, INotificationProvider notificationProvider, IEventLogger eventLogger) { + EnableSlotSelection = true; + _settings = SettingsManager.Default.GetOrCreate(); _notificationProvider = notificationProvider; @@ -137,6 +150,8 @@ namespace Tango.MachineStudio.UI.ViewModels await Task.Factory.StartNew(() => { + + _settings.DeploymentSlot = DeploymentSlot; _authenticationProvider.Login(Email, Password); @@ -151,6 +166,8 @@ namespace Tango.MachineStudio.UI.ViewModels _settings.Save(); _eventLogger.Log("User logged in."); + + EnableSlotSelection = false; }); } catch (Exception ex) -- cgit v1.3.1 From 92c52918e13dbbaf2a658945c349a6d04c29aa81 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Wed, 16 Jan 2019 15:13:55 +0200 Subject: Added custom image support for bug reporting. Fixed issue with dispensers filter search. --- .../ViewModels/MainViewVM.cs | 14 ++++++--- .../DefaultStudioApplicationManager.cs | 1 - .../TFS/TeamFoundationServiceExtendedClient.cs | 31 +++++++++++-------- .../Tango.MachineStudio.UI.csproj | 2 +- .../ViewModels/ReportIssueViewVM.cs | 36 +++++++++++++++++++++- .../Views/ReportIssueView.xaml | 14 +++++++-- 6 files changed, 76 insertions(+), 22 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels') diff --git a/Software/Visual_Studio/MachineStudio/Modules/MachineStudio.Dispensers/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/MachineStudio.Dispensers/ViewModels/MainViewVM.cs index d92d86580..2bd7e16a0 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/MachineStudio.Dispensers/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/MachineStudio.Dispensers/ViewModels/MainViewVM.cs @@ -11,6 +11,7 @@ using System.Data.Entity; using Tango.MachineStudio.Common.Notifications; using Tango.MachineStudio.Dispensers.Contracts; using Tango.Core.Commands; +using Tango.Core.Threading; namespace Tango.MachineStudio.Dispensers.ViewModels { @@ -19,6 +20,7 @@ namespace Tango.MachineStudio.Dispensers.ViewModels private ObservablesContext _dbContext; private ObservablesContext _activeContext; private INotificationProvider _notification; + private ActionTimer _filter_timer; private ObservableCollection _dispensers; public ObservableCollection Dispensers @@ -68,6 +70,7 @@ namespace Tango.MachineStudio.Dispensers.ViewModels public MainViewVM(INotificationProvider notificationProvider) { _notification = notificationProvider; + _filter_timer = new ActionTimer(TimeSpan.FromMilliseconds(200)); ManageDispenserCommand = new RelayCommand(() => LoadSelectedDispenser(), () => SelectedDispenser != null); BackToDispensersCommand = new RelayCommand(() => { View.NavigateTo(DispensersNavigationView.DispensersView); }); @@ -76,13 +79,16 @@ namespace Tango.MachineStudio.Dispensers.ViewModels RemoveDispenserCommand = new RelayCommand(RemoveSelectedDispenser, () => SelectedDispenser != null); } - private async void OnFilterChanged() + private void OnFilterChanged() { if (Filter != null) { - IsFree = false; - Dispensers = (await _dbContext.Dispensers.Where(x => x.SerialNumber.ToLower().StartsWith(Filter.ToLower())).Include(x => x.DispenserType).Include(x => x.IdsPacks).ToListAsync()).ToObservableCollection(); - IsFree = true; + _filter_timer.ResetReplace(() => + { + IsFree = false; + Dispensers = _dbContext.Dispensers.Where(x => x.SerialNumber.ToLower().StartsWith(Filter.ToLower())).Include(x => x.DispenserType).Include(x => x.IdsPacks).ToList().ToObservableCollection(); + IsFree = true; + }); } } 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().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 - + \ 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(); + BrowseImageCommand = new RelayCommand(BrowseImage); } public ReportIssueViewVM(Project project, WorkItem workItem) : this() @@ -55,12 +68,33 @@ namespace Tango.MachineStudio.UI.ViewModels SelectedTags = new SelectedObjectCollection(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}"> @@ -91,11 +91,21 @@ + + + + Attach Image + + + + + + - + Steps To Reproduce -- cgit v1.3.1