From ee697f7a3350d0a97bddee4de3a2ae4f9d285052 Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Wed, 2 May 2018 17:36:54 +0300 Subject: merge --- .../Views/MachineTechView.xaml | 6 +- .../Converters/PermissionToVisibilityConverter.cs | 38 +++ .../Tango.MachineStudio.Common/IStudioViewModel.cs | 5 + .../StudioApplication/IStudioApplicationManager.cs | 8 + .../Tango.MachineStudio.Common/StudioViewModel.cs | 89 +++++++ .../Tango.MachineStudio.Common.csproj | 4 + .../Tango.MachineStudio.UI/App.xaml.cs | 51 +++- .../Tango.MachineStudio.UI/Console/CodeTemplate.cs | 23 ++ .../Console/ConsoleManager.cs | 39 ++++ .../Console/ConsoleOnExecuteParameters.cs | 26 +++ .../Console/ConsoleWindow.xaml | 223 ++++++++++++++++++ .../Console/ConsoleWindow.xaml.cs | 43 ++++ .../Console/ConsoleWindowVM.cs | 257 +++++++++++++++++++++ .../Tango.MachineStudio.UI/Images/bug-resolved.png | Bin 0 -> 6496 bytes .../DefaultStudioApplicationManager.cs | 21 ++ .../TFS/SystemInformationModel.cs | 2 + .../TFS/SystemInformationTemplate.cshtml | 25 +- .../TFS/TeamFoundationServiceExtendedClient.cs | 103 ++++++++- .../TFS/WorkItemValidationAttribute.cs | 10 +- .../Tango.MachineStudio.UI.csproj | 24 ++ .../Tango.MachineStudio.UI/ViewModelLocator.cs | 12 +- .../ViewModels/LoadingViewVM.cs | 8 +- .../ViewModels/MainViewVM.cs | 84 ++++++- .../ViewModels/ResolvedIssuesViewVM.cs | 61 +++++ .../Tango.MachineStudio.UI/Views/MainView.xaml | 48 +++- .../Views/ReportIssueView.xaml | 110 +++++---- .../Views/ResolvedIssuesView.xaml | 89 +++++++ .../Views/ResolvedIssuesView.xaml.cs | 28 +++ .../Windows/ExceptionResolutions.cs | 3 +- .../Windows/ExceptionWindow.xaml | 12 +- .../Windows/ExceptionWindow.xaml.cs | 7 +- 31 files changed, 1394 insertions(+), 65 deletions(-) create mode 100644 Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Converters/PermissionToVisibilityConverter.cs create mode 100644 Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Console/CodeTemplate.cs create mode 100644 Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Console/ConsoleManager.cs create mode 100644 Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Console/ConsoleOnExecuteParameters.cs create mode 100644 Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Console/ConsoleWindow.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Console/ConsoleWindow.xaml.cs create mode 100644 Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Console/ConsoleWindowVM.cs create mode 100644 Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/bug-resolved.png create mode 100644 Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ResolvedIssuesViewVM.cs create mode 100644 Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ResolvedIssuesView.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ResolvedIssuesView.xaml.cs (limited to 'Software/Visual_Studio/MachineStudio') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml index 3d4ecdac1..53fcafb8f 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml @@ -220,9 +220,9 @@ - Version Name: - Version Number: - Build Date: + Version Name: + Version Number: + Build Date: Diagnostics Frame Size: diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Converters/PermissionToVisibilityConverter.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Converters/PermissionToVisibilityConverter.cs new file mode 100644 index 000000000..08e7d1c12 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Converters/PermissionToVisibilityConverter.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Data; +using Tango.BL.Entities; +using Tango.BL.Enumerations; +using Tango.Core.DI; +using Tango.MachineStudio.Common.Authentication; + +namespace Tango.MachineStudio.Common.Converters +{ + public class PermissionToVisibilityConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + User user = value as User; + + if (user != null) + { + if (user.HasPermission((Permissions)parameter)) + { + return Visibility.Visible; + } + } + + return Visibility.Collapsed; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/IStudioViewModel.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/IStudioViewModel.cs index 35ed50cd9..4203a1e8b 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/IStudioViewModel.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/IStudioViewModel.cs @@ -38,5 +38,10 @@ namespace Tango.MachineStudio.Common /// /// The arguments. void OnModuleRequest(params object[] args); + + /// + /// Called when the application has been started + /// + void OnApplicationStarted(); } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs index be793ac81..1de18ac94 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Windows; using Tango.Integration.Services; namespace Tango.MachineStudio.Common.StudioApplication @@ -53,5 +54,12 @@ namespace Tango.MachineStudio.Common.StudioApplication /// Gets the machine studio application version. /// String Version { get; } + + /// + /// Notify the application manager about an external opened window. + /// When application exists. All registered windows will be closed. + /// + /// The window. + void RegisterOpenedWindow(Window window); } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioViewModel.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioViewModel.cs index 9c7e52d23..77fad1fc6 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioViewModel.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioViewModel.cs @@ -7,6 +7,79 @@ using Tango.SharedUI; namespace Tango.MachineStudio.Common { + /// + /// Represents a Machine Studio view model + /// + /// The type of the module. + /// + /// + public abstract class StudioViewModelInternal : ViewModel, IStudioViewModel + { + /// + /// Gets or sets a value indicating whether this view model studio module is currently loaded. + /// + public bool IsModuleLoaded { get; private set; } + + /// + /// Initializes a new instance of the class. + /// + public StudioViewModelInternal() : base() + { + + } + + /// + /// Called when another module has wants to navigate to this module with some arguments. + /// + /// The arguments. + public virtual void OnModuleRequest(params object[] args) + { + + } + + /// + /// Called when the user has navigated out of the module. + /// + public virtual void OnNavigatedFrom() + { + IsModuleLoaded = false; + } + + /// + /// Called when the user has navigated in to the module. + /// + public virtual void OnNavigatedTo() + { + IsModuleLoaded = true; + } + + /// + /// Called before the application is shutting down. + /// Return false to cancel the shutdown in case an important process is in progress. + /// + /// + public virtual Task OnShutdownRequest() + { + return Task.FromResult(true); + } + + /// + /// Called when application is shutting down. + /// + public virtual void OnShuttingDown() + { + + } + + /// + /// Called when the application has been started + /// + public virtual void OnApplicationStarted() + { + + } + } + /// /// Represents a Machine Studio view model /// @@ -70,6 +143,14 @@ namespace Tango.MachineStudio.Common { } + + /// + /// Called when the application has been started + /// + public virtual void OnApplicationStarted() + { + + } } /// @@ -90,6 +171,14 @@ namespace Tango.MachineStudio.Common } + /// + /// Called when the application has been started + /// + public virtual void OnApplicationStarted() + { + + } + /// /// Called when another module has wants to navigate to this module with some arguments. /// diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj index e4a2720b9..ac6f84618 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj @@ -89,6 +89,7 @@ RealTimeGraphControl.xaml + @@ -287,5 +288,8 @@ True + + + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs index d9c64b9e3..f124ebb54 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs @@ -15,6 +15,11 @@ using Tango.Settings; using Tango.MachineStudio.Common.EventLogging; using Tango.BL.Enumerations; using Tango.Core.DI; +using Tango.MachineStudio.UI.TFS; +using Tango.TFS; +using Tango.MachineStudio.Common.Notifications; +using Tango.MachineStudio.UI.ViewModels; +using Tango.MachineStudio.UI.Views; namespace Tango.MachineStudio.UI { @@ -82,7 +87,26 @@ namespace Tango.MachineStudio.UI Application.Current.Dispatcher.Invoke(() => { - ExceptionWindow exWin = new ExceptionWindow(e.Exception); + WorkItem bug = null; + TeamFoundationServiceExtendedClient tfsClient = null; + INotificationProvider notification = null; + + try + { + tfsClient = TangoIOC.Default.GetInstance(); + notification = TangoIOC.Default.GetInstance(); + + if (tfsClient != null && tfsClient.IsInitialized) + { + bug = tfsClient.CreateBug(); + } + } + catch (Exception ex) + { + Debug.WriteLine(ex.ToString()); + } + + ExceptionWindow exWin = new ExceptionWindow(e.Exception, bug != null); exWin.ShowDialog(); switch (exWin.Resolution) @@ -100,6 +124,31 @@ namespace Tango.MachineStudio.UI e.TryRecover = false; LogManager.Log("User selection was to shutdown the application. Restarting..."); Environment.Exit(0); + break; + case ExceptionResolutions.Report: + e.TryRecover = true; + LogManager.Log("User selection was to report the issue."); + + if (bug != null) + { + notification.ShowModalDialog(new ReportIssueViewVM(tfsClient.Project, bug), async (vm) => + { + using (notification.PushTaskItem("Uploading bug report...")) + { + try + { + tfsClient.FinalizeBug(vm.WorkItem); + await tfsClient.UploadWorkItem(vm.WorkItem); + } + catch (Exception ex) + { + notification.ShowError("An error occurred while trying to create the issue." + Environment.NewLine + ex.Message); + } + } + + }, null); + } + break; } }); diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Console/CodeTemplate.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Console/CodeTemplate.cs new file mode 100644 index 000000000..4b307051f --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Console/CodeTemplate.cs @@ -0,0 +1,23 @@ +using System; +using System.Text; +using System.Linq; +using System.Drawing; +using System.Diagnostics; +using System.Windows.Forms; +using System.Threading; +using System.Threading.Tasks; +using System.Collections.Generic; +using Tango.MachineStudio.Common.Notifications; +using Tango.MachineStudio.UI.Console; + +public void OnExecute(ConsoleManager manager) +{ + manager.InvokeUI(() => + { + + var notification = manager.TangoIOC.GetInstance(); + notification.ShowInfo("Hello world!"); + + }); +} + diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Console/ConsoleManager.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Console/ConsoleManager.cs new file mode 100644 index 000000000..e2d525d95 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Console/ConsoleManager.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core.DI; +using Tango.MachineStudio.Common.Modules; + +namespace Tango.MachineStudio.UI.Console +{ + public class ConsoleManager + { + public TangoIOC TangoIOC { get; set; } + private Action _writeLine; + + public ConsoleManager(Action writeLine) + { + _writeLine = writeLine; + TangoIOC = TangoIOC.Default; + } + + public void WriteLine(String text) + { + _writeLine(text); + } + + public void InvokeUI(Action action) + { + Core.Helpers.ThreadsHelper.InvokeUI(action); + } + + public void StartModule(String name) + { + IStudioModuleLoader loader = TangoIOC.Default.GetInstance(); + var module = loader.AllModules.SingleOrDefault(x => x.Name == name); + TangoIOC.Default.GetInstance().StartModule(module); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Console/ConsoleOnExecuteParameters.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Console/ConsoleOnExecuteParameters.cs new file mode 100644 index 000000000..b06637ccd --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Console/ConsoleOnExecuteParameters.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Scripting; + +namespace Tango.MachineStudio.UI.Console +{ + public class ConsoleOnExecuteParameters : OnExecuteParameters + { + /// + /// Provides access to the script stub manager. + /// + public ConsoleManager manager; + + /// + /// Initializes a new instance of the class. + /// + /// The manager. + public ConsoleOnExecuteParameters(ConsoleManager manager) + { + this.manager = manager; + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Console/ConsoleWindow.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Console/ConsoleWindow.xaml new file mode 100644 index 000000000..22338fea7 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Console/ConsoleWindow.xaml @@ -0,0 +1,223 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LOG + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Console/ConsoleWindow.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Console/ConsoleWindow.xaml.cs new file mode 100644 index 000000000..de2c728b0 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Console/ConsoleWindow.xaml.cs @@ -0,0 +1,43 @@ +using MahApps.Metro.Controls; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; + +namespace Tango.MachineStudio.UI.Console +{ + /// + /// Interaction logic for ConsoleWindow.xaml + /// + public partial class ConsoleWindow : MetroWindow + { + private ConsoleWindowVM _vm; + + public ConsoleWindow() + { + InitializeComponent(); + + this.Loaded += (_, __) => + { + _vm = this.DataContext as ConsoleWindowVM; + _vm.SetLogTextBox(txtLog); + }; + } + + //Auto scroll to bottom of response log each time it is changed. + private void TextBox_TextChanged(object sender, TextChangedEventArgs e) + { + txtLog.SelectionStart = txtLog.Text.Length; + txtLog.ScrollToEnd(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Console/ConsoleWindowVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Console/ConsoleWindowVM.cs new file mode 100644 index 000000000..a3a0a734e --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Console/ConsoleWindowVM.cs @@ -0,0 +1,257 @@ +using Microsoft.Win32; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using System.Windows.Controls; +using System.Windows.Threading; +using Tango.Core.Commands; +using Tango.Core.Helpers; +using Tango.MachineStudio.Common.Modules; +using Tango.MachineStudio.Common.Notifications; +using Tango.Scripting; +using Tango.SharedUI; + +namespace Tango.MachineStudio.UI.Console +{ + public class ConsoleWindowVM : ViewModel + { + private IStudioModuleLoader _moduleLoader; + private INotificationProvider _notificatrion; + private TextBox _txtLog; + private String _currentFile; + + + /// + /// Gets or sets the additional highlight C# types. + /// + public ObservableCollection> HighlightTypes { get; set; } + + internal void SetLogTextBox(TextBox txtLog) + { + _txtLog = txtLog; + } + + /// + /// Gets or sets the intellisense types. + /// + public ObservableCollection> IntellisenseTypes { get; set; } + + private String _code; + /// + /// Gets or sets the code. + /// + public String Code + { + get { return _code; } + set { _code = value; RaisePropertyChangedAuto(); } + } + + private bool _isRunning; + /// + /// Gets or sets a value indicating whether a stub is currently running. + /// + public bool IsRunning + { + get { return _isRunning; } + set { _isRunning = value; RaisePropertyChanged(nameof(IsRunning)); InvalidateRelayCommands(); } + } + + /// + /// Gets or sets the run command. + /// + public RelayCommand RunCommand { get; set; } + + /// + /// Gets or sets the stop command. + /// + public RelayCommand StopCommand { get; set; } + + /// + /// Gets or sets the clear command. + /// + public RelayCommand ClearCommand { get; set; } + + /// + /// Gets or sets the new command. + /// + public RelayCommand NewCommand { get; set; } + + /// + /// Gets or sets the open command. + /// + public RelayCommand OpenCommand { get; set; } + + /// + /// Gets or sets the save command. + /// + public RelayCommand SaveCommand { get; set; } + + /// + /// Gets or sets the save as command. + /// + public RelayCommand SaveAsCommand { get; set; } + + public ConsoleWindowVM(IStudioModuleLoader moduleLoader, INotificationProvider notification) + { + _moduleLoader = moduleLoader; + _notificatrion = notification; + + RunCommand = new RelayCommand(Run); + StopCommand = new RelayCommand(Stop); + + HighlightTypes = new ObservableCollection>(); + IntellisenseTypes = new ObservableCollection>(); + + IntellisenseTypes.Add(new KeyValuePair("manager", typeof(ConsoleManager))); + + foreach (var moduleType in moduleLoader.UserModules.SelectMany(x => x.MainViewType.Assembly.GetTypes())) + { + if (!moduleType.FullName.Contains("<") && !moduleType.FullName.Contains(">")) + { + HighlightTypes.Add(new KeyValuePair(moduleType.FullName, moduleType)); + } + } + + foreach (var type in this.GetType().Assembly.GetTypes()) + { + if (!type.FullName.Contains("<") && !type.FullName.Contains(">")) + { + HighlightTypes.Add(new KeyValuePair(type.Name, type)); + } + } + + foreach (var type in typeof(INotificationProvider).Assembly.GetTypes()) + { + if (!type.FullName.Contains("<") && !type.FullName.Contains(">")) + { + HighlightTypes.Add(new KeyValuePair(type.Name, type)); + } + } + + HighlightTypes.Add(new KeyValuePair("Thread", typeof(Thread))); + HighlightTypes.Add(new KeyValuePair("DateTime", typeof(DateTime))); + HighlightTypes.Add(new KeyValuePair("TimeSpan", typeof(TimeSpan))); + HighlightTypes.Add(new KeyValuePair("Dispatcher", typeof(Dispatcher))); + HighlightTypes.Add(new KeyValuePair("Task", typeof(Task))); + HighlightTypes.Add(new KeyValuePair("List", typeof(IList))); + HighlightTypes.Add(new KeyValuePair("int", typeof(Int32))); + HighlightTypes.Add(new KeyValuePair("double", typeof(Double))); + HighlightTypes.Add(new KeyValuePair("String", typeof(String))); + HighlightTypes.Add(new KeyValuePair("string", typeof(String))); + + foreach (var item in HighlightTypes) + { + IntellisenseTypes.Add(item); + } + + Code = EmbeddedResourceHelper.GetEmbeddedResourceText("Tango.MachineStudio.UI.Console.CodeTemplate.cs"); + + NewCommand = new RelayCommand(CreateNew); + OpenCommand = new RelayCommand(OpenFile); + SaveCommand = new RelayCommand(SaveFile); + SaveAsCommand = new RelayCommand(SaveAsFile); + ClearCommand = new RelayCommand(ClearLog); + } + + private void Stop() + { + + } + + private async void Run() + { + ScriptEngine engine = new ScriptEngine(new ConsoleOnExecuteParameters(new ConsoleManager(WriteLine))); + engine.Stop(); + engine.ReferencedAssemblies.Add(this.GetType()); + engine.ReferencedAssemblies.Add(typeof(INotificationProvider)); + + foreach (var module in _moduleLoader.AllModules) + { + engine.ReferencedAssemblies.Add(module.GetType()); + } + + await engine.Run(Code); + } + + private void WriteLine(String text) + { + InvokeUI(() => + { + _txtLog.AppendText(text); + }); + } + + /// + /// Clears the log. + /// + private void ClearLog() + { + _txtLog.Clear(); + } + + /// + /// Saves the selected script file. + /// + private void SaveFile() + { + if (_currentFile == null) + { + SaveAsFile(); + } + else + { + File.WriteAllText(_currentFile, Code); + } + } + + /// + /// Saves the selected script file. + /// + private void SaveAsFile() + { + SaveFileDialog dlg = new SaveFileDialog(); + dlg.Filter = "C# Script Files|*.cs"; + dlg.DefaultExt = ".cs"; + if (dlg.ShowDialog().Value) + { + File.WriteAllText(dlg.FileName, Code); + _currentFile = dlg.FileName; + } + } + + /// + /// Opens a script from HD. + /// + private void OpenFile() + { + OpenFileDialog dlg = new OpenFileDialog(); + dlg.Filter = "C# Script Files|*.cs"; + if (dlg.ShowDialog().Value) + { + OpenFile(dlg.FileName); + } + } + + /// + /// Opens the file. + /// + /// The file. + private void OpenFile(String file) + { + Code = File.ReadAllText(file); + _currentFile = file; + } + + private void CreateNew() + { + _txtLog.Clear(); + _currentFile = null; + Code = String.Empty; + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/bug-resolved.png b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/bug-resolved.png new file mode 100644 index 000000000..e49f62923 Binary files /dev/null and b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/bug-resolved.png differ 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 0bbcfd313..4c02be2b2 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs @@ -42,6 +42,22 @@ namespace Tango.MachineStudio.UI.StudioApplication _moduleLoader = moduleLoader; _navigationManager = navigationManager; _openedWindows = new List(); + + Task.Factory.StartNew(() => + { + while (MainWindow.Instance == null) + { + Thread.Sleep(100); + } + + InvokeUI(() => + { + MainWindow.Instance.ContentRendered += (_, __) => + { + TangoIOC.Default.GetAllInstancesByBase().ToList().ForEach(x => x.OnApplicationStarted()); + }; + }); + }); } /// @@ -229,6 +245,11 @@ namespace Tango.MachineStudio.UI.StudioApplication } } + /// + /// Notify the application manager about an external opened window. + /// When application exists. All registered windows will be closed. + /// + /// The window. public void RegisterOpenedWindow(Window window) { _openedWindows.Add(window); diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/SystemInformationModel.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/SystemInformationModel.cs index eb9ef8012..5dde73744 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/SystemInformationModel.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/SystemInformationModel.cs @@ -15,5 +15,7 @@ namespace Tango.MachineStudio.UI.TFS public String HostName { get; set; } public Machine Machine { get; set; } public String ConfigurationString { get; set; } + public String LoadedHardwareConfigurationString { get; set; } + public String LoadedProcessParametersString { get; set; } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/SystemInformationTemplate.cshtml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/SystemInformationTemplate.cshtml index 7b0c4a896..54db28e32 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/SystemInformationTemplate.cshtml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/SystemInformationTemplate.cshtml @@ -60,11 +60,32 @@ -
Configuration
+
Machine Configuration
@vm.ConfigurationString
+ +
Hardware Configuration
+ if (vm.LoadedHardwareConfigurationString != null) + { +
@vm.LoadedHardwareConfigurationString
+ } + else + { +
NOT SET
+ } + +
Process Parameters
+ + if (vm.LoadedProcessParametersString != null) + { +
@vm.LoadedProcessParametersString
+ } + else + { +
NOT SET
+ } } else { -
Not Connected
+
NOT CONNECTED
} \ No newline at end of file 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 27b257e61..79572eb71 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/TeamFoundationServiceExtendedClient.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/TeamFoundationServiceExtendedClient.cs @@ -1,8 +1,10 @@ using System; using System.Collections.Generic; +using System.Collections.ObjectModel; using System.IO; using System.Linq; using System.Text; +using System.Threading; using System.Threading.Tasks; using System.Windows; using Tango.BL.Entities; @@ -21,6 +23,13 @@ namespace Tango.MachineStudio.UI.TFS { public Project Project { get; private set; } + private ObservableCollection _resolvedWorkItems; + public ObservableCollection ResolvedWorkItems + { + get { return _resolvedWorkItems; } + set { _resolvedWorkItems = value; RaisePropertyChangedAuto(); } + } + private bool _isInitialized; public bool IsInitialized { @@ -30,7 +39,20 @@ namespace Tango.MachineStudio.UI.TFS public TeamFoundationServiceExtendedClient(string collectionURL, string userName, string personalToken) : base(collectionURL, userName, personalToken) { + ResolvedWorkItems = new ObservableCollection(); + TangoIOC.Default.GetInstance().CurrentUserChanged += TeamFoundationServiceExtendedClient_CurrentUserChanged; + } + private void TeamFoundationServiceExtendedClient_CurrentUserChanged(object sender, User user) + { + if (user != null) + { + Task.Factory.StartNew(async () => + { + Thread.Sleep(5000); + await UpdateCurrentUserResolvedWorkItems(); + }); + } } public Task UploadWorkItem(WorkItem workItem) @@ -38,14 +60,53 @@ namespace Tango.MachineStudio.UI.TFS return UploadWorkItem(Project, workItem); } + public async Task UpdateCurrentUserResolvedWorkItems() + { + try + { + IStudioApplicationManager app = TangoIOC.Default.GetInstance(); + var items = await GetWorkItemsCreatedBy(Project, GetUserTeamMember()); + items.Where(x => x.StepsToReproduce != null).ToList().ForEach(x => x.StepsToReproduce = x.StepsToReproduce.Replace("
", "").Replace("
", "")); + ResolvedWorkItems = items.Where(x => x.State == State.Resolved && x.ResolvedReason == ResolvedReason.Fixed && x.IsBuildVersionValid && x.FoundInBuildVersion < Version.Parse(app.Version)).ToObservableCollection(); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error getting the current user resolved work items."); + } + } + + public async Task CloseWorkItem(WorkItem workItem) + { + await SetWorkItemState(Project, workItem, State.Closed); + var updated = await AddWorkItemComment(Project, workItem, GetUserTeamMember(), "Bug has been verified and closed by " + GetUserTeamMember().DisplayName + " (via Tango Software)."); + ResolvedWorkItems.Remove(workItem); + return updated; + } + + public async Task ReactivateWorkItem(WorkItem workItem) + { + await SetWorkItemState(Project, workItem, State.New); + var updated = await AddWorkItemComment(Project, workItem, GetUserTeamMember(), "Bug has been reactivated by " + GetUserTeamMember().DisplayName + " (via Tango Software)."); + updated = await SetWorkItemAssignment(Project, updated, workItem.ResolvedBy); + ResolvedWorkItems.Remove(workItem); + return updated; + } + public void Initialize() { Task.Factory.StartNew(() => { if (!IsInitialized) { - Project = GetProject("Tango").Result; - IsInitialized = true; + try + { + Project = GetProject("Tango").Result; + IsInitialized = true; + } + catch (Exception ex) + { + LogManager.Log(ex, "Error initializing the Team Foundation Service client."); + } } }); } @@ -60,7 +121,7 @@ namespace Tango.MachineStudio.UI.TFS item.Area = Project.Areas.FirstOrDefault(); item.Iteration = Project.Iterations.FirstOrDefault(); - TeamMember currentUser = Project.Members.SingleOrDefault(x => x.UniqueName.ToLower().Contains(auth.CurrentUser.Email.ToLower())); + TeamMember currentUser = GetUserTeamMember(); item.CreatedBy = currentUser; item.ChangedBy = currentUser; item.AuthorizedAs = currentUser; @@ -82,6 +143,14 @@ namespace Tango.MachineStudio.UI.TFS Name = "Screen Capture.jpg", }); + return item; + } + + public void FinalizeBug(WorkItem item) + { + IAuthenticationProvider auth = TangoIOC.Default.GetInstance(); + IStudioApplicationManager app = TangoIOC.Default.GetInstance(); + FileLogger appFileLogger = LogManager.Default.RegisteredLoggers.FirstOrDefault(x => x.GetType() == typeof(FileLogger)) as FileLogger; FileLogger embeddedFileLogger = MachineOperator.EmbeddedLogManager.RegisteredLoggers.FirstOrDefault(x => x.GetType() == typeof(FileLogger)) as FileLogger; @@ -113,7 +182,7 @@ namespace Tango.MachineStudio.UI.TFS SystemInformationModel sysModel = new SystemInformationModel(); sysModel.ApplicationVersion = app.Version; - sysModel.EmbeddedVersion = "Fake Version"; + sysModel.EmbeddedVersion = "N/A"; sysModel.HostName = Environment.MachineName; sysModel.UserName = auth.CurrentUser.Contact.FullName; @@ -122,17 +191,18 @@ namespace Tango.MachineStudio.UI.TFS Machine machine = app.ConnectedMachine.Machine; sysModel.Machine = machine; + sysModel.EmbeddedVersion = app.ConnectedMachine.DeviceInformation.Version; MachineDesigner.Views.MainView machineView = new MachineDesigner.Views.MainView(); machineView.Width = 1280; machineView.Height = 1100; - machineView.PanelColumnDefinition.Width = new System.Windows.GridLength(0); + machineView.PanelColumnDefinition.Width = new GridLength(0); machineView.stackHeader.Visibility = Visibility.Collapsed; machineView.Background = System.Windows.Media.Brushes.White; machineView.DataContext = new MachineDesigner.ViewModels.MainViewVM() { SelectedMachine = machine, Configuration = machine.Configuration }; String configImageFile = PathHelper.GetTempFilePath(); - machineView.RenderToFile(configImageFile, System.Drawing.Imaging.ImageFormat.Jpeg, new System.Windows.Size(machineView.Width, machineView.Height), 100); + machineView.RenderToFile(configImageFile, System.Drawing.Imaging.ImageFormat.Jpeg, new Size(machineView.Width, machineView.Height), 100); item.Attachments.Add(new Attachment() { @@ -141,7 +211,17 @@ namespace Tango.MachineStudio.UI.TFS Name = "Machine Configuration.jpg" }); - sysModel.ConfigurationString = machine.Configuration.CloneConfiguration().ToJsonString(); + sysModel.ConfigurationString = machine.Configuration.CloneConfiguration().ToJsonString(nameof(Configuration.MachinesConfigurations), nameof(Configuration.MachineVersions)); + + if (app.ConnectedMachine.CurrentProcessParameters != null) + { + sysModel.LoadedProcessParametersString = app.ConnectedMachine.CurrentProcessParameters.ToJsonString(nameof(ProcessParametersTable.ProcessParametersTablesGroup)); + } + + if (app.ConnectedMachine.CurrentHardwareConfiguration != null) + { + sysModel.LoadedHardwareConfigurationString = app.ConnectedMachine.CurrentHardwareConfiguration.ToJsonString(); + } } String html = String.Empty; @@ -154,7 +234,14 @@ namespace Tango.MachineStudio.UI.TFS item.SystemInformation = CodeGeneration.Helper.Parse(html, sysModel); - return item; + item.StepsToReproduce = String.Format("
{0}
", item.StepsToReproduce); + } + + private TeamMember GetUserTeamMember() + { + IAuthenticationProvider auth = TangoIOC.Default.GetInstance(); + TeamMember currentUser = Project.Members.SingleOrDefault(x => x.UniqueName.ToLower().Contains(auth.CurrentUser.Email.ToLower())); + return currentUser; } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/WorkItemValidationAttribute.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/WorkItemValidationAttribute.cs index 1418d0576..3e85f91b4 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/WorkItemValidationAttribute.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/WorkItemValidationAttribute.cs @@ -16,13 +16,19 @@ namespace Tango.MachineStudio.UI.TFS if (String.IsNullOrWhiteSpace(item.Title)) { - ErrorMessage = "Title is empty"; + ErrorMessage = "Title is required."; return false; } if (item.AssignedTo == null) { - ErrorMessage = "Assigned To is empty"; + ErrorMessage = "Assigned To field is required."; + return false; + } + + if (String.IsNullOrWhiteSpace(item.StepsToReproduce)) + { + ErrorMessage = "Please enter steps to reproduce."; return false; } 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 8ab6bb188..5d685c112 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 @@ -131,6 +131,13 @@ MSBuild:Compile Designer + + + + + ConsoleWindow.xaml + + HtmlWindow.xaml @@ -161,6 +168,7 @@ + @@ -190,6 +198,9 @@ ReportIssueView.xaml + + ResolvedIssuesView.xaml + ShutdownView.xaml @@ -203,6 +214,10 @@ ModuleWindow.xaml + + Designer + MSBuild:Compile + MSBuild:Compile Designer @@ -270,6 +285,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -355,6 +374,10 @@ {e4927038-348d-4295-aaf4-861c58cb3943} Tango.PMR + + {401989E7-AE1E-4002-B0EE-9A9F63740B97} + Tango.Scripting + {d8f1ad85-526a-4f50-b6dc-d437af63d8d8} Tango.Settings @@ -460,6 +483,7 @@ + diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs index 8e6f11452..931130a05 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs @@ -13,6 +13,7 @@ using Tango.MachineStudio.Common.Speech; using Tango.MachineStudio.Common.StudioApplication; using Tango.MachineStudio.Common.Video; using Tango.MachineStudio.UI.Authentication; +using Tango.MachineStudio.UI.Console; using Tango.MachineStudio.UI.Html; using Tango.MachineStudio.UI.Modules; using Tango.MachineStudio.UI.Navigation; @@ -64,7 +65,6 @@ namespace Tango.MachineStudio.UI TangoIOC.Default.Unregister(); TangoIOC.Default.Unregister(); - TangoIOC.Default.Register(new TeamFoundationServiceExtendedClient("https://twinetfs.visualstudio.com/DefaultCollection", "Roy", "szzfokrceo4rhd4eqi5qpmxn3pa5iwl3q7tlqd36l2m7smz2ynoa")); TangoIOC.Default.Register(); TangoIOC.Default.Register(); TangoIOC.Default.Register(); @@ -76,6 +76,7 @@ namespace Tango.MachineStudio.UI TangoIOC.Default.Register(); TangoIOC.Default.Register(); TangoIOC.Default.Register(); + TangoIOC.Default.Register(new TeamFoundationServiceExtendedClient("https://twinetfs.visualstudio.com", String.Empty, "szzfokrceo4rhd4eqi5qpmxn3pa5iwl3q7tlqd36l2m7smz2ynoa")); TangoIOC.Default.Register(); TangoIOC.Default.Register(); @@ -85,6 +86,7 @@ namespace Tango.MachineStudio.UI TangoIOC.Default.Register(); TangoIOC.Default.Register(); TangoIOC.Default.Register(); + TangoIOC.Default.Register(); //Register View (Supervising Controller Pattern). //if (!ViewModelBase.IsInDesignModeStatic) @@ -157,5 +159,13 @@ namespace Tango.MachineStudio.UI return TangoIOC.Default.GetInstance(); } } + + public ConsoleWindowVM ConsoleWindowVM + { + get + { + return TangoIOC.Default.GetInstance(); + } + } } } \ No newline at end of file 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 2b2b442f7..29f9102ac 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs @@ -16,6 +16,7 @@ using Tango.BL; using Tango.MachineStudio.Common.EventLogging; using Tango.BL.Enumerations; using Tango.MachineStudio.UI.TFS; +using Tango.MachineStudio.Common; namespace Tango.MachineStudio.UI.ViewModels { @@ -23,7 +24,7 @@ namespace Tango.MachineStudio.UI.ViewModels /// Represents the Machine Studio loading view, view model. ///
/// - public class LoadingViewVM : ViewModel + public class LoadingViewVM : StudioViewModelInternal { private INotificationProvider _notificationProvider; private TeamFoundationServiceExtendedClient _tfs; @@ -55,6 +56,11 @@ namespace Tango.MachineStudio.UI.ViewModels _navigationManager = navigationManager; _studioModuleLoader = studioModuleLoader; _notificationProvider = notificationProvider; + } + + public override void OnApplicationStarted() + { + base.OnApplicationStarted(); Load(); } 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 0882267e8..04b973f23 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs @@ -148,6 +148,16 @@ namespace Tango.MachineStudio.UI.ViewModels /// public RelayCommand ReportIssueCommand { get; set; } + /// + /// Gets or sets the open resolved bugs. + /// + public RelayCommand OpenResolvedBugsCommand { get; set; } + + /// + /// Gets or sets the open developer console command. + /// + public RelayCommand OpenDeveloperConsoleCommand { get; set; } + private IAuthenticationProvider _authenticationProvider; /// /// Gets or sets the authentication provider. @@ -302,6 +312,8 @@ namespace Tango.MachineStudio.UI.ViewModels ResolveMachineEventCommand = new RelayCommand(ResolveMachineEvent); ReportIssueCommand = new RelayCommand(ReportIssue); + OpenResolvedBugsCommand = new RelayCommand(OpenResolvedBugs); + OpenDeveloperConsoleCommand = new RelayCommand(OpenDeveloperConsole); } private void MachineEventsStateProvider_EventsResolved(object sender, IEnumerable e) @@ -321,7 +333,7 @@ namespace Tango.MachineStudio.UI.ViewModels { while (!DisableCheckForUpdates) { - Thread.Sleep(TimeSpan.FromMinutes(1)); + Thread.Sleep(TimeSpan.FromMinutes(0.2)); try { @@ -649,10 +661,78 @@ namespace Tango.MachineStudio.UI.ViewModels { using (_notificationProvider.PushTaskItem("Uploading bug report...")) { - await TFSClient.UploadWorkItem(vm.WorkItem); + try + { + TFSClient.FinalizeBug(vm.WorkItem); + await TFSClient.UploadWorkItem(vm.WorkItem); + } + catch (Exception ex) + { + _notificationProvider.ShowError("An error occurred while trying to create the issue." + Environment.NewLine + ex.Message); + } } }, null); } + + private void OpenResolvedBugs() + { + ResolvedIssuesViewVM vm = null; + + vm = new ResolvedIssuesViewVM(TFSClient, async (item) => + { + //Approve + using (_notificationProvider.PushTaskItem("Approving issue...")) + { + vm.IsAvailable = false; + try + { + await TFSClient.CloseWorkItem(item); + } + catch (Exception ex) + { + _notificationProvider.ShowError("An error occurred while trying to update the issue." + Environment.NewLine + ex.Message); + } + vm.IsAvailable = true; + + if (TFSClient.ResolvedWorkItems.Count == 0) + { + vm.Close(); + } + } + }, async (item) => + { + //Decline + using (_notificationProvider.PushTaskItem("Reactivating issue...")) + { + vm.IsAvailable = false; + try + { + await TFSClient.ReactivateWorkItem(item); + } + catch (Exception ex) + { + _notificationProvider.ShowError("An error occurred while trying to update the issue." + Environment.NewLine + ex.Message); + } + + vm.IsAvailable = true; + + if (TFSClient.ResolvedWorkItems.Count == 0) + { + vm.Close(); + } + } + }); + + _notificationProvider.ShowModalDialog(vm, (_) => { }, null); + } + + private void OpenDeveloperConsole() + { + Console.ConsoleWindow console = new Console.ConsoleWindow(); + ApplicationManager.RegisterOpenedWindow(console); + console.Owner = MainWindow.Instance; + console.Show(); + } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ResolvedIssuesViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ResolvedIssuesViewVM.cs new file mode 100644 index 000000000..552880792 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ResolvedIssuesViewVM.cs @@ -0,0 +1,61 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core.Commands; +using Tango.MachineStudio.Common.Notifications; +using Tango.MachineStudio.UI.TFS; +using Tango.TFS; + +namespace Tango.MachineStudio.UI.ViewModels +{ + public class ResolvedIssuesViewVM : DialogViewVM + { + private Action _onApprove; + private Action _onDecline; + + public TeamFoundationServiceExtendedClient TFSClient { get; set; } + + public RelayCommand ApproveCommand { get; set; } + + public RelayCommand DeclineCommand { get; set; } + + private bool _isAvailable; + + public bool IsAvailable + { + get { return _isAvailable; } + set { _isAvailable = value; RaisePropertyChangedAuto(); } + } + + public ResolvedIssuesViewVM() : base() + { + IsAvailable = true; + ApproveCommand = new RelayCommand(ApproveIssue); + DeclineCommand = new RelayCommand(DeclineIssue); + } + + public ResolvedIssuesViewVM(TeamFoundationServiceExtendedClient tfsClient, Action onApprove, Action onDecline) : this() + { + TFSClient = tfsClient; + _onApprove = onApprove; + _onDecline = onDecline; + } + + private void DeclineIssue(WorkItem workItem) + { + _onDecline(workItem); + } + + private void ApproveIssue(WorkItem workItem) + { + _onApprove(workItem); + } + + public void Close() + { + Accept(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml index 86723479b..8417c70c8 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml @@ -10,9 +10,11 @@ xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:entities="clr-namespace:Tango.BL.Entities;assembly=Tango.BL" + xmlns:enumerations="clr-namespace:Tango.BL.Enumerations;assembly=Tango.BL" xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:db="clr-namespace:Tango.MachineStudio.DB.Views;assembly=Tango.MachineStudio.DB" xmlns:local="clr-namespace:Tango.MachineStudio.UI.Views" + xmlns:commonConverters="clr-namespace:Tango.MachineStudio.Common.Converters;assembly=Tango.MachineStudio.Common" mc:Ignorable="d" d:DesignHeight="720" d:DesignWidth="1270" Background="Transparent" DataContext="{Binding MainViewVM, Source={StaticResource Locator}}"> @@ -22,6 +24,7 @@ + @@ -189,7 +192,16 @@ Speech - + + + + + 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 f2e3038b9..37cd0b793 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="650" Background="White" d:DataContext="{d:DesignInstance Type=vm:ReportIssueViewVM, IsDesignTimeCreatable=False}"> + mc:Ignorable="d" Width="530" Height="680" Background="White" d:DataContext="{d:DesignInstance Type=vm:ReportIssueViewVM, IsDesignTimeCreatable=False}"> @@ -36,53 +36,85 @@ - - + + + + + + - - - + + + + - Tags - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + Tags (highlight selected tags) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Steps To Reproduce + + + + + + + + - + - * + * diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ResolvedIssuesView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ResolvedIssuesView.xaml new file mode 100644 index 000000000..4fb457f87 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ResolvedIssuesView.xaml @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + Resolved Issues + + + + Below you can find issues reported by you that have been flagged as resolved by the development team. + Please verify each one and report back by pressing 'FIXED' or 'NOT FIXED'. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Steps To Reproduce + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ResolvedIssuesView.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ResolvedIssuesView.xaml.cs new file mode 100644 index 000000000..7825bf587 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ResolvedIssuesView.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.MachineStudio.UI.Views +{ + /// + /// Interaction logic for ResolvedBugsView.xaml + /// + public partial class ResolvedIssuesView : UserControl + { + public ResolvedIssuesView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Windows/ExceptionResolutions.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Windows/ExceptionResolutions.cs index 2e7327559..e27a84c3b 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Windows/ExceptionResolutions.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Windows/ExceptionResolutions.cs @@ -10,6 +10,7 @@ namespace Tango.MachineStudio.UI.Windows { Shutdown, Restart, - Ignore + Ignore, + Report } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Windows/ExceptionWindow.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Windows/ExceptionWindow.xaml index 892e4944f..147b40892 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Windows/ExceptionWindow.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Windows/ExceptionWindow.xaml @@ -5,7 +5,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:Tango.MachineStudio.UI.Windows" mc:Ignorable="d" - WindowStyle="None" ResizeMode="NoResize" Topmost="True" AllowsTransparency="True" WindowStartupLocation="CenterScreen" d:DesignHeight="300" d:DesignWidth="300" Width="610" Height="410" Background="Transparent" d:DataContext="{d:DesignInstance Type=local:ExceptionWindow, IsDesignTimeCreatable=False}"> + WindowStyle="None" ResizeMode="NoResize" Topmost="True" AllowsTransparency="True" WindowStartupLocation="CenterScreen" Width="800" Height="600" Background="Transparent" d:DataContext="{d:DesignInstance Type=local:ExceptionWindow, IsDesignTimeCreatable=False}"> @@ -48,8 +48,16 @@ - + + + + diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Windows/ExceptionWindow.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Windows/ExceptionWindow.xaml.cs index 0f74fee17..0a6f2de39 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Windows/ExceptionWindow.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Windows/ExceptionWindow.xaml.cs @@ -33,10 +33,15 @@ namespace Tango.MachineStudio.UI.Windows DataContext = this; } - public ExceptionWindow(Exception ex) : this() + public ExceptionWindow(Exception ex, bool canReport) : this() { Exception = ex.FlattenException(); ResolveCommand = new RelayCommand(Resolve); + + if (!canReport) + { + btnReport.Visibility = Visibility.Collapsed; + } } private void Resolve(ExceptionResolutions resolution) -- cgit v1.3.1