From 565afd35baab8b2846ebc80a6802a375b3fd876e Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Sun, 1 Sep 2019 17:46:47 +0300 Subject: Added bug reporting module to PPC !! --- .../PPC/Modules/Tango.PPC.BugReporting/App.xaml | 11 ++ .../Tango.PPC.BugReporting/BugReportingModule.cs | 104 ++++++++++++ .../Tango.PPC.BugReporting/BugReportingSettings.cs | 15 ++ .../Images/bug_reporting.png | Bin 0 -> 2178 bytes .../Properties/AssemblyInfo.cs | 20 +++ .../Properties/Resources.Designer.cs | 63 +++++++ .../Properties/Resources.resx | 117 +++++++++++++ .../Properties/Settings.Designer.cs | 26 +++ .../Properties/Settings.settings | 7 + .../TFS/SystemInformationModel.cs | 21 +++ .../TFS/SystemInformationTemplate.cshtml | 91 ++++++++++ .../TFS/TeamFoundationServicePPCClient.cs | 155 +++++++++++++++++ .../Tango.PPC.BugReporting.csproj | 183 +++++++++++++++++++++ .../Tango.PPC.BugReporting/ViewModelLocator.cs | 34 ++++ .../ViewModels/MainViewVM.cs | 183 +++++++++++++++++++++ .../Tango.PPC.BugReporting/Views/MainView.xaml | 94 +++++++++++ .../Tango.PPC.BugReporting/Views/MainView.xaml.cs | 28 ++++ .../PPC/Modules/Tango.PPC.BugReporting/app.config | 61 +++++++ .../Modules/Tango.PPC.BugReporting/packages.config | 7 + .../Tango.PPC.Technician/TechnicianModule.cs | 2 +- Software/Visual_Studio/PPC/Tango.PPC.UI/App.config | 10 +- .../Visual_Studio/PPC/Tango.PPC.UI/Images/bug.png | Bin 0 -> 5276 bytes .../PPCApplication/DefaultPPCApplicationManager.cs | 2 +- .../PPC/Tango.PPC.UI/Tango.PPC.UI.csproj | 9 +- 24 files changed, 1237 insertions(+), 6 deletions(-) create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/App.xaml create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/BugReportingModule.cs create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/BugReportingSettings.cs create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/Images/bug_reporting.png create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/Properties/AssemblyInfo.cs create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/Properties/Resources.Designer.cs create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/Properties/Resources.resx create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/Properties/Settings.Designer.cs create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/Properties/Settings.settings create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/TFS/SystemInformationModel.cs create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/TFS/SystemInformationTemplate.cshtml create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/TFS/TeamFoundationServicePPCClient.cs create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/Tango.PPC.BugReporting.csproj create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/ViewModelLocator.cs create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/ViewModels/MainViewVM.cs create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/Views/MainView.xaml create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/Views/MainView.xaml.cs create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/app.config create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/packages.config create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Images/bug.png (limited to 'Software/Visual_Studio/PPC') diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/App.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/App.xaml new file mode 100644 index 000000000..b6c322d95 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/App.xaml @@ -0,0 +1,11 @@ + + + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/BugReportingModule.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/BugReportingModule.cs new file mode 100644 index 000000000..e65b44698 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/BugReportingModule.cs @@ -0,0 +1,104 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Media.Imaging; +using Tango.BL.Enumerations; +using Tango.PPC.Common; +using Tango.PPC.BugReporting.Views; +using Tango.SharedUI.Helpers; +using Tango.Settings; +using System.Diagnostics; + +namespace Tango.PPC.BugReporting +{ + /// + /// Represents a PPC . + /// + /// + [PPCModule(5)] + public class BugReportingModule : PPCModuleBase + { + /// + /// Initializes a new instance of the class. + /// + public BugReportingModule() : base() + { + IsVisibleInMenu = false; + + try + { + var settings = SettingsManager.Default.GetOrCreate(); + IsVisibleInMenu = settings.DeploymentSlot != Web.DeploymentSlot.PROD; + } + catch (Exception ex) + { + Debug.WriteLine("Could not retrieve settings for PPC!\n" + ex.ToString()); + } + } + + /// + /// Gets the module name. + /// + public override string Name + { + get + { + return "Report Issue"; + } + } + + /// + /// Gets the module description. + /// + public override string Description + { + get + { + return "Bug Reporting Module"; + } + } + + /// + /// Gets the module cover image. + /// + public override BitmapSource Image + { + get + { + return ResourceHelper.GetImageFromResources("Images/bug_reporting.png"); + } + } + + /// + /// Gets the module entry point view type. + /// + public override Type MainViewType + { + get + { + return typeof(MainView); + } + } + + /// + /// Gets the permission required to see and load this module. + /// + public override Permissions Permission + { + get + { + return Permissions.RunPPC; + } + } + + /// + /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + /// + public override void Dispose() + { + //Dispose module here... + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/BugReportingSettings.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/BugReportingSettings.cs new file mode 100644 index 000000000..d2548a656 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/BugReportingSettings.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Settings; + +namespace Tango.PPC.BugReporting +{ + public class BugReportingSettings : SettingsBase + { + public String LastCreatedBy { get; set; } + public String LastAssignedTo { get; set; } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/Images/bug_reporting.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/Images/bug_reporting.png new file mode 100644 index 000000000..a0908bb40 Binary files /dev/null and b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/Images/bug_reporting.png differ diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/Properties/AssemblyInfo.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..ae128036e --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/Properties/AssemblyInfo.cs @@ -0,0 +1,20 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Tango bug reporting module")] +[assembly: AssemblyVersion("2.0.1.1407")] + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/Properties/Resources.Designer.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/Properties/Resources.Designer.cs new file mode 100644 index 000000000..72dc0bbc4 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Tango.PPC.BugReporting.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Tango.PPC.BugReporting.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/Properties/Resources.resx b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/Properties/Resources.resx new file mode 100644 index 000000000..af7dbebba --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/Properties/Settings.Designer.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/Properties/Settings.Designer.cs new file mode 100644 index 000000000..28bddb8f3 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Tango.PPC.BugReporting.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.8.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/Properties/Settings.settings b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/Properties/Settings.settings new file mode 100644 index 000000000..033d7a5e9 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/TFS/SystemInformationModel.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/TFS/SystemInformationModel.cs new file mode 100644 index 000000000..e2fc518c9 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/TFS/SystemInformationModel.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Entities; + +namespace Tango.PPC.BugReporting.TFS +{ + public class SystemInformationModel + { + public String ApplicationVersion { get; set; } + public String EmbeddedVersion { get; set; } + public String UserName { get; set; } + 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/PPC/Modules/Tango.PPC.BugReporting/TFS/SystemInformationTemplate.cshtml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/TFS/SystemInformationTemplate.cshtml new file mode 100644 index 000000000..b2d909c80 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/TFS/SystemInformationTemplate.cshtml @@ -0,0 +1,91 @@ +@{ + Tango.PPC.BugReporting.TFS.SystemInformationModel vm = Model as Tango.PPC.BugReporting.TFS.SystemInformationModel; +} + +
+
System Information
+ + + + + + + + + + + + + + + + + + + + + + + + +
Application Version:@vm.ApplicationVersion
Embedded Version:@vm.EmbeddedVersion
Host Name:@vm.HostName
User:@vm.UserName
+ +
Machine
+ + @if (vm.Machine != null) + { + + + + + + + + + + + + + + + + + + + + + + + + +
Organization:@vm.Machine.Organization.Name
Name:@vm.Machine.Name
S/N:@vm.Machine.SerialNumber
Version:@vm.Machine.MachineVersion.Version
+ +
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
+ } +
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/TFS/TeamFoundationServicePPCClient.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/TFS/TeamFoundationServicePPCClient.cs new file mode 100644 index 000000000..56a94afef --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/TFS/TeamFoundationServicePPCClient.cs @@ -0,0 +1,155 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Entities; +using Tango.Core.DI; +using Tango.Integration.Operation; +using Tango.Logging; +using Tango.PPC.Common.Application; +using Tango.PPC.Common.Connection; +using Tango.TFS; +using Tango.Core.ExtensionMethods; +using Tango.Core.Helpers; + +namespace Tango.PPC.BugReporting.TFS +{ + public class TeamFoundationServicePPCClient : TeamFoundationServiceClient + { + private IPPCApplicationManager _applicationManager; + private IMachineProvider _machineProvider; + + public Project Project { get; private set; } + + public event EventHandler Initialized; + + public bool IsInitialized { get; private set; } + + public TeamFoundationServicePPCClient(string collectionURL, string userName, string personalToken) : base(collectionURL, userName, personalToken) + { + _applicationManager = TangoIOC.Default.GetInstance(); + _machineProvider = TangoIOC.Default.GetInstance(); + _applicationManager.ApplicationReady += ApplicationManager_ApplicationReady; + } + + private void ApplicationManager_ApplicationReady(object sender, EventArgs e) + { + Init(); + } + + private async void Init() + { + try + { + Project = await GetProject("Tango"); + IsInitialized = true; + Initialized?.Invoke(this, new EventArgs()); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error initializing TFS."); + } + } + + public async Task SubmitBug(String title, String steps, TeamMember createdBy, TeamMember assignedTo, Severity severity) + { + WorkItem item = new WorkItem(); + + await Task.Factory.StartNew(() => + { + item.Title = title; + + item.Area = Project.GetAreaByName("PPC"); + item.Iteration = Project.Iterations.FirstOrDefault(); + + item.CreatedBy = createdBy; + item.ChangedBy = createdBy; + item.AuthorizedAs = createdBy; + item.AssignedTo = assignedTo; + + item.StepsToReproduce = steps; + + item.FoundInBuild = _applicationManager.Version.ToString(); + item.Priority = Priority.Priority3; + item.Severity = severity; + item.State = State.New; + item.Type = WorkItemType.Bug; + + 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; + + var tempFolder = TemporaryManager.CreateFolder(); + + if (appFileLogger != null) + { + var appLogFile = tempFolder.CreateImaginaryFile(); + File.Copy(appFileLogger.LogFile, appLogFile.Path); + + item.Attachments.Add(new Attachment() + { + Description = "Application Log File", + FilePath = appLogFile.Path, + Name = Path.GetFileName(appFileLogger.LogFile), + }); + } + + if (embeddedFileLogger != null && File.Exists(embeddedFileLogger.LogFile)) + { + var embeddedLogFile = tempFolder.CreateImaginaryFile(); + File.Copy(embeddedFileLogger.LogFile, embeddedLogFile.Path); + + item.Attachments.Add(new Attachment() + { + Description = "Embedded Log File", + FilePath = embeddedLogFile.Path, + Name = Path.GetFileName(embeddedFileLogger.LogFile), + }); + } + + SystemInformationModel sysModel = new SystemInformationModel(); + sysModel.ApplicationVersion = _applicationManager.Version.ToString(); + sysModel.EmbeddedVersion = "N/A"; + sysModel.HostName = Environment.MachineName; + sysModel.UserName = createdBy.AssignName; + + IMachineOperator op = _machineProvider.MachineOperator; + + if (op.Status != MachineStatuses.Disconnected) + { + Machine machine = _machineProvider.Machine; + + sysModel.Machine = machine; + sysModel.EmbeddedVersion = op.DeviceInformation.Version; + + sysModel.ConfigurationString = machine.Configuration.Clone().ToJsonString(); + + if (op.CurrentProcessParameters != null) + { + sysModel.LoadedProcessParametersString = op.CurrentProcessParameters.ToJsonString(nameof(ProcessParametersTable.ProcessParametersTablesGroup)); + } + + if (op.CurrentHardwareConfiguration != null) + { + sysModel.LoadedHardwareConfigurationString = op.CurrentHardwareConfiguration.ToJsonString(); + } + } + + String html = String.Empty; + + using (var stream = EmbeddedResourceHelper.GetEmbeddedResourceStream("Tango.PPC.BugReporting.TFS.SystemInformationTemplate.cshtml")) + { + StreamReader reader = new StreamReader(stream); + html = reader.ReadToEnd(); + } + + item.SystemInformation = CodeGeneration.Helper.Parse(html, sysModel); + + item.StepsToReproduce = String.Format("
{0}
", item.StepsToReproduce); + }); + + await UploadWorkItem(Project, item); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/Tango.PPC.BugReporting.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/Tango.PPC.BugReporting.csproj new file mode 100644 index 000000000..aa400aed2 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/Tango.PPC.BugReporting.csproj @@ -0,0 +1,183 @@ + + + + + Debug + AnyCPU + {8146FA0A-0725-4A1A-82E6-696C58F33A2B} + library + Tango.PPC.BugReporting + Tango.PPC.BugReporting + v4.6.1 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + + + + true + full + false + ..\..\..\Build\PPC\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + ..\..\..\Build\PPC\Release\ + TRACE + prompt + 4 + + + + ..\..\..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.dll + True + + + ..\..\..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.SqlServer.dll + + + ..\..\..\packages\FontAwesome.WPF.4.7.0.9\lib\net40\FontAwesome.WPF.dll + + + ..\..\..\packages\Google.Protobuf.3.4.1\lib\net45\Google.Protobuf.dll + + + + + + ..\..\..\packages\Expression.Blend.Sdk.1.0.2\lib\net45\System.Windows.Interactivity.dll + + + + + + + + + 4.0 + + + + + + + + MSBuild:Compile + Designer + + + Designer + MSBuild:Compile + + + + + GlobalVersionInfo.cs + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + + + + + MainView.xaml + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + {f441feee-322a-4943-b566-110e12fd3b72} + Tango.BL + + + {caedae94-11ed-473c-888a-268a6d38cd20} + Tango.CodeGeneration + + + {a34ee0f0-649d-41c8-8489-b6f1cc6924ee} + Tango.Core + + + {b112d89a-a106-41ae-a0c1-4abc84c477f5} + Tango.DragAndDrop + + + {4206ac58-3b57-4699-8835-90bf6db01a61} + Tango.Integration + + + {bc932dbd-7cdb-488c-99e4-f02cf441f55e} + Tango.Logging + + + {e4927038-348d-4295-aaf4-861c58cb3943} + Tango.PMR + + + {d8f1ad85-526a-4f50-b6dc-d437af63d8d8} + Tango.Settings + + + {8491d07b-c1f6-4b62-a412-41b9fd2d6538} + Tango.SharedUI + + + {998f8471-dc1b-41b6-9d96-354e1b4e7a32} + Tango.TFS + + + {fd86424c-6e84-491b-8df9-3d0f5c236a2a} + Tango.Touch + + + {74e700b0-1156-4126-be40-ee450d3c3026} + Tango.Transport + + + {5001990f-977b-48ff-b217-0236a5022ad8} + Tango.Web + + + {0be74eee-22cb-4dba-b896-793b9e1a3ac0} + Tango.PPC.Common + + + + + + + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/ViewModelLocator.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/ViewModelLocator.cs new file mode 100644 index 000000000..1f71ca2c1 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/ViewModelLocator.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core.DI; +using Tango.PPC.BugReporting.TFS; +using Tango.PPC.BugReporting.ViewModels; + +namespace Tango.PPC.BugReporting +{ + public static class ViewModelLocator + { + /// + /// Initializes a new instance of the ViewModelLocator class. + /// + static ViewModelLocator() + { + TangoIOC.Default.Register(new TeamFoundationServicePPCClient("https://twinetfs.visualstudio.com", String.Empty, "szzfokrceo4rhd4eqi5qpmxn3pa5iwl3q7tlqd36l2m7smz2ynoa")); + TangoIOC.Default.Register(); + } + + /// + /// Gets the main view VM. + /// + public static MainViewVM MainViewVM + { + get + { + return TangoIOC.Default.GetInstance(); + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/ViewModels/MainViewVM.cs new file mode 100644 index 000000000..e0cf17f79 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/ViewModels/MainViewVM.cs @@ -0,0 +1,183 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core.Commands; +using Tango.PPC.BugReporting.TFS; +using Tango.PPC.Common; +using Tango.Settings; +using Tango.TFS; +using Tango.Touch.Controls; + +namespace Tango.PPC.BugReporting.ViewModels +{ + /// + /// Represents the main view VM and entry point for . + /// + /// + public class MainViewVM : PPCViewModel + { + private TeamFoundationServicePPCClient _tfsService; + private BugReportingSettings _settings; + + public AutoCompleteProvider TeamMembersProvider { get; set; } + + private String _title; + public String Title + { + get { return _title; } + set { _title = value; RaisePropertyChangedAuto(); } + } + + private String _steps; + public String Steps + { + get { return _steps; } + set { _steps = value; RaisePropertyChangedAuto(); } + } + + private TeamMember _fromMember; + public TeamMember FromMember + { + get { return _fromMember; } + set { _fromMember = value; RaisePropertyChangedAuto(); } + } + + private TeamMember _toMember; + public TeamMember ToMember + { + get { return _toMember; } + set { _toMember = value; RaisePropertyChangedAuto(); } + } + + private Severity _severity; + public Severity Severity + { + get { return _severity; } + set { _severity = value; RaisePropertyChangedAuto(); } + } + + private List _members; + public List Members + { + get { return _members; } + set { _members = value; RaisePropertyChangedAuto(); } + } + + public RelayCommand SubmitCommand { get; set; } + + /// + /// Initializes a new instance of the class. + /// + public MainViewVM() + { + TeamMembersProvider = new AutoCompleteProvider((member, filter) => + { + if (filter != null && member != null) + { + return member.DisplayName.ToLower().Contains(filter.ToLower()); + } + else + { + return false; + } + }); + + Severity = Severity.Medium; + + SubmitCommand = new RelayCommand(SubmitBug); + } + + /// + /// Initializes a new instance of the class. + /// + /// The TFS service. + public MainViewVM(TeamFoundationServicePPCClient tfsService) : this() + { + _tfsService = tfsService; + _tfsService.Initialized += _tfsService_Initialized; + } + + private void _tfsService_Initialized(object sender, EventArgs e) + { + Members = _tfsService.Project.Members.ToList(); + } + + private async void SubmitBug() + { + if (String.IsNullOrWhiteSpace(Title)) + { + await NotificationProvider.ShowError("Report title is required."); + return; + } + + if (FromMember == null) + { + await NotificationProvider.ShowError("Created By team member is required."); + return; + } + + if (ToMember == null) + { + await NotificationProvider.ShowError("Assigned To team member is required."); + return; + } + + try + { + IsFree = false; + await _tfsService.SubmitBug(Title, Steps, FromMember, ToMember, Severity); + await NotificationProvider.ShowSuccess("Issue reported successfully"); + await NavigationManager.NavigateBack(); + + _settings.LastCreatedBy = FromMember.Email; + _settings.LastAssignedTo = ToMember.Email; + _settings.Save(); + + Title = null; + Steps = null; + Severity = Severity.Medium; + } + catch (Exception ex) + { + LogManager.Log(ex, "Error on TFS bug reporting."); + await NotificationProvider.ShowError("An error occurred while trying to submit the report. Please restart the application and try again."); + } + finally + { + IsFree = true; + } + } + + public async override void OnNavigatedTo() + { + base.OnNavigatedTo(); + + Title = null; + Steps = null; + Severity = Severity.Medium; + + if (!_tfsService.IsInitialized) + { + await NotificationProvider.ShowError("The reporting service was not initialized properly. Issue reporting is currently disabled."); + await NavigationManager.NavigateBack(); + return; + } + + FromMember = Members.SingleOrDefault(x => x.Email == _settings.LastCreatedBy); + ToMember = Members.SingleOrDefault(x => x.Email == _settings.LastAssignedTo); + } + + /// + /// Called when the application has been started + /// + public override void OnApplicationStarted() + { + //Start initializing here rather then in the constructor. + + _settings = SettingsManager.Default.GetOrCreate(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/Views/MainView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/Views/MainView.xaml new file mode 100644 index 000000000..563cd49a6 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/Views/MainView.xaml @@ -0,0 +1,94 @@ + + + + + + + + + + + + + Report Issue + + + + + + + + SUBMIT + + + + Submitting report.. + + + + + + + + + + + Details + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Steps To Reproduce + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/Views/MainView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/Views/MainView.xaml.cs new file mode 100644 index 000000000..56342d3c2 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/Views/MainView.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.PPC.BugReporting.Views +{ + /// + /// Interaction logic for MainView.xaml + /// + public partial class MainView : UserControl + { + public MainView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/app.config b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/app.config new file mode 100644 index 000000000..1e22e6a88 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/app.config @@ -0,0 +1,61 @@ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/packages.config b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/packages.config new file mode 100644 index 000000000..80367fdd2 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/packages.config @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/TechnicianModule.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/TechnicianModule.cs index 07ef8cabf..55fea1323 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/TechnicianModule.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/TechnicianModule.cs @@ -11,7 +11,7 @@ using Tango.SharedUI.Helpers; namespace Tango.PPC.Technician { - [PPCModule(5)] + [PPCModule(20)] public class TechnicianModule : PPCModuleBase { public override string Name => "Technician"; diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/App.config b/Software/Visual_Studio/PPC/Tango.PPC.UI/App.config index 9d2de4c50..77255b814 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/App.config +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/App.config @@ -10,8 +10,14 @@ - - + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/bug.png b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/bug.png new file mode 100644 index 000000000..ed4b8e6e6 Binary files /dev/null and b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/bug.png differ diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs index 0e1ff1d2b..6a9e42ce5 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs @@ -225,7 +225,7 @@ namespace Tango.PPC.UI.PPCApplication ObservablesStaticCollections.Instance.Initialize(); LogManager.Log("Loading machine from database..."); _machineContext = ObservablesContext.CreateDefault(); - _machine = new MachineBuilder(_machineContext).SetFirst().WithSettings().WithOrganization().WithConfiguration().WithSpools().WithCats().Build(); + _machine = new MachineBuilder(_machineContext).SetFirst().WithVersion().WithSettings().WithOrganization().WithConfiguration().WithSpools().WithCats().Build(); } initialized = true; diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj index c2025b733..ff1ffa040 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj @@ -12,7 +12,7 @@ 512 {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 4 - false + true false @@ -320,6 +320,7 @@ + @@ -404,6 +405,10 @@ {6aa425c9-ea6a-4b01-aaed-5ff122e8b663} Tango.WiFi + + {8146fa0a-0725-4a1a-82e6-696c58f33a2b} + Tango.PPC.BugReporting + {a8077b3e-8dd6-4572-8ec4-a27bdc91b70a} Tango.PPC.Events @@ -555,7 +560,7 @@ del "$(TargetDir)firmware_package.tfp" - + \ No newline at end of file -- cgit v1.3.1