From d33c19b3ac6803de4b5c8d475832efef131c1a45 Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Wed, 30 Dec 2020 15:11:34 +0000 Subject: Revert "Hope it is fine" --- .../Events/PushEmulatedEventRequest.cs | 20 +++ .../Events/PushEmulatedEventResponse.cs | 12 ++ .../Information/GetMachineInformationRequest.cs | 12 ++ .../Information/GetMachineInformationResponse.cs | 13 ++ .../Information/InformationPackage.cs | 19 +++ .../Insights/InsightsDownloadCompletedRequest.cs | 13 ++ .../Insights/InsightsDownloadCompletedResponse.cs | 12 ++ .../Insights/InsightsMinDateRequest.cs | 12 ++ .../Insights/InsightsMinDateResponse.cs | 13 ++ .../Tango.PPC.Shared/Insights/InsightsRequest.cs | 25 +++ .../Tango.PPC.Shared/Insights/InsightsResponse.cs | 14 ++ .../PPC/Tango.PPC.Shared/Jobs/RemoteJobProgress.cs | 21 +++ .../PPC/Tango.PPC.Shared/Jobs/RemoteJobStage.cs | 18 ++ .../Jobs/RemoteJobUpdateRequest.cs | 13 ++ .../Jobs/RemoteJobUpdateResponse.cs | 22 +++ .../Tango.PPC.Shared/Logs/GetLogFilesRequest.cs | 13 ++ .../Tango.PPC.Shared/Logs/GetLogFilesResponse.cs | 18 ++ .../PPC/Tango.PPC.Shared/Logs/RemoteLogFile.cs | 17 ++ .../PPC/Tango.PPC.Shared/Logs/RemoteLogFileType.cs | 14 ++ .../Performance/PerformancePackage.cs | 25 +++ .../Performance/StartPerformanceUpdatesRequest.cs | 12 ++ .../Performance/StartPerformanceUpdatesResponse.cs | 13 ++ .../Tango.PPC.Shared/Properties/AssemblyInfo.cs | 23 +++ .../Properties/Resources.Designer.cs | 62 +++++++ .../PPC/Tango.PPC.Shared/Properties/Resources.resx | 117 +++++++++++++ .../Properties/Settings.Designer.cs | 30 ++++ .../Tango.PPC.Shared/Properties/Settings.settings | 7 + .../SimulateApplicationExceptionRequest.cs | 13 ++ .../SimulateApplicationExceptionResponse.cs | 12 ++ .../StartRemoteApplicationUpgradeRequest.cs | 15 ++ .../StartRemoteApplicationUpgradeResponse.cs | 24 +++ .../StartRemoteFirmwareUpgradeRequest.cs | 13 ++ .../StartRemoteFirmwareUpgradeResponse.cs | 24 +++ .../PPC/Tango.PPC.Shared/SQL/ExecuteSqlRequest.cs | 13 ++ .../PPC/Tango.PPC.Shared/SQL/ExecuteSqlResponse.cs | 19 +++ .../PPC/Tango.PPC.Shared/SQL/RemoteSqlColumn.cs | 52 ++++++ .../SQL/RemoteSqlColumnCollection.cs | 78 +++++++++ .../PPC/Tango.PPC.Shared/SQL/RemoteSqlDataSet.cs | 188 +++++++++++++++++++++ .../PPC/Tango.PPC.Shared/SQL/RemoteSqlRow.cs | 153 +++++++++++++++++ .../PPC/Tango.PPC.Shared/Tango.PPC.Shared.csproj | 148 ++++++++++++++++ .../PPC/Tango.PPC.Shared/Themes/Generic.xaml | 6 + .../Updates/GetUpdatesAndPackagesRequest.cs | 13 ++ .../Updates/GetUpdatesAndPackagesResponse.cs | 22 +++ .../Updates/PackageInstallation.cs | 26 +++ .../Updates/PackageInstallationState.cs | 15 ++ .../PPC/Tango.PPC.Shared/Updates/PackageType.cs | 14 ++ 46 files changed, 1438 insertions(+) create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Shared/Events/PushEmulatedEventRequest.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Shared/Events/PushEmulatedEventResponse.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Shared/Information/GetMachineInformationRequest.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Shared/Information/GetMachineInformationResponse.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Shared/Information/InformationPackage.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Shared/Insights/InsightsDownloadCompletedRequest.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Shared/Insights/InsightsDownloadCompletedResponse.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Shared/Insights/InsightsMinDateRequest.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Shared/Insights/InsightsMinDateResponse.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Shared/Insights/InsightsRequest.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Shared/Insights/InsightsResponse.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Shared/Jobs/RemoteJobProgress.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Shared/Jobs/RemoteJobStage.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Shared/Jobs/RemoteJobUpdateRequest.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Shared/Jobs/RemoteJobUpdateResponse.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Shared/Logs/GetLogFilesRequest.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Shared/Logs/GetLogFilesResponse.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Shared/Logs/RemoteLogFile.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Shared/Logs/RemoteLogFileType.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Shared/Performance/PerformancePackage.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Shared/Performance/StartPerformanceUpdatesRequest.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Shared/Performance/StartPerformanceUpdatesResponse.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Shared/Properties/AssemblyInfo.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Shared/Properties/Resources.Designer.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Shared/Properties/Resources.resx create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Shared/Properties/Settings.Designer.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Shared/Properties/Settings.settings create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Shared/RemoteActions/SimulateApplicationExceptionRequest.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Shared/RemoteActions/SimulateApplicationExceptionResponse.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Shared/RemoteUpgrade/StartRemoteApplicationUpgradeRequest.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Shared/RemoteUpgrade/StartRemoteApplicationUpgradeResponse.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Shared/RemoteUpgrade/StartRemoteFirmwareUpgradeRequest.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Shared/RemoteUpgrade/StartRemoteFirmwareUpgradeResponse.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Shared/SQL/ExecuteSqlRequest.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Shared/SQL/ExecuteSqlResponse.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Shared/SQL/RemoteSqlColumn.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Shared/SQL/RemoteSqlColumnCollection.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Shared/SQL/RemoteSqlDataSet.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Shared/SQL/RemoteSqlRow.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Shared/Tango.PPC.Shared.csproj create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Shared/Themes/Generic.xaml create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Shared/Updates/GetUpdatesAndPackagesRequest.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Shared/Updates/GetUpdatesAndPackagesResponse.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Shared/Updates/PackageInstallation.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Shared/Updates/PackageInstallationState.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Shared/Updates/PackageType.cs (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Shared') diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/Events/PushEmulatedEventRequest.cs b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Events/PushEmulatedEventRequest.cs new file mode 100644 index 000000000..3546c285f --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Events/PushEmulatedEventRequest.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PMR.Diagnostics; + +namespace Tango.PPC.Shared.Events +{ + public class PushEmulatedEventRequest + { + public Event Event { get; set; } + public TimeSpan Timeout { get; set; } + + public PushEmulatedEventRequest() + { + Timeout = TimeSpan.FromSeconds(5); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/Events/PushEmulatedEventResponse.cs b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Events/PushEmulatedEventResponse.cs new file mode 100644 index 000000000..2fb3a2a70 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Events/PushEmulatedEventResponse.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Shared.Events +{ + public class PushEmulatedEventResponse + { + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/Information/GetMachineInformationRequest.cs b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Information/GetMachineInformationRequest.cs new file mode 100644 index 000000000..1464c15ac --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Information/GetMachineInformationRequest.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Shared.Information +{ + public class GetMachineInformationRequest + { + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/Information/GetMachineInformationResponse.cs b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Information/GetMachineInformationResponse.cs new file mode 100644 index 000000000..e88bfce05 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Information/GetMachineInformationResponse.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Shared.Information +{ + public class GetMachineInformationResponse + { + public InformationPackage Package { get; set; } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/Information/InformationPackage.cs b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Information/InformationPackage.cs new file mode 100644 index 000000000..e48413db6 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Information/InformationPackage.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.SystemInfo; + +namespace Tango.PPC.Shared.Information +{ + public class InformationPackage + { + public List System { get; set; } + + public InformationPackage() + { + System = new List(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/Insights/InsightsDownloadCompletedRequest.cs b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Insights/InsightsDownloadCompletedRequest.cs new file mode 100644 index 000000000..f298f6a6b --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Insights/InsightsDownloadCompletedRequest.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Shared.Insights +{ + public class InsightsDownloadCompletedRequest + { + public String InisightsFilePath { get; set; } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/Insights/InsightsDownloadCompletedResponse.cs b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Insights/InsightsDownloadCompletedResponse.cs new file mode 100644 index 000000000..04fd3d1b9 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Insights/InsightsDownloadCompletedResponse.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Shared.Insights +{ + public class InsightsDownloadCompletedResponse + { + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/Insights/InsightsMinDateRequest.cs b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Insights/InsightsMinDateRequest.cs new file mode 100644 index 000000000..1bb70c396 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Insights/InsightsMinDateRequest.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Shared.Insights +{ + public class InsightsMinDateRequest + { + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/Insights/InsightsMinDateResponse.cs b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Insights/InsightsMinDateResponse.cs new file mode 100644 index 000000000..7d0e0db84 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Insights/InsightsMinDateResponse.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Shared.Insights +{ + public class InsightsMinDateResponse + { + public DateTime? MinDate { get; set; } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/Insights/InsightsRequest.cs b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Insights/InsightsRequest.cs new file mode 100644 index 000000000..b34895e78 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Insights/InsightsRequest.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Shared.Insights +{ + public class InsightsRequest + { + public DateTime StartDateUTC { get; set; } + public DateTime EndDateUTC { get; set; } + + public bool IncludeEvents { get; set; } + public bool IncludeStatuses { get; set; } + public bool IncludeApplicationExceptions { get; set; } + + public InsightsRequest() + { + IncludeEvents = true; + IncludeStatuses = true; + IncludeApplicationExceptions = true; + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/Insights/InsightsResponse.cs b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Insights/InsightsResponse.cs new file mode 100644 index 000000000..38333a459 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Insights/InsightsResponse.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Shared.Insights +{ + public class InsightsResponse + { + public String InisightsFilePath { get; set; } + public long InsightsFileLength { get; set; } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/Jobs/RemoteJobProgress.cs b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Jobs/RemoteJobProgress.cs new file mode 100644 index 000000000..d91d612d1 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Jobs/RemoteJobProgress.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core; +using Tango.PMR.Printing; + +namespace Tango.PPC.Shared.Jobs +{ + public class RemoteJobProgress + { + public RemoteJobStage Stage { get; set; } + public JobStatus JobStatus { get; set; } + + public RemoteJobProgress() + { + JobStatus = new JobStatus(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/Jobs/RemoteJobStage.cs b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Jobs/RemoteJobStage.cs new file mode 100644 index 000000000..5235b995b --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Jobs/RemoteJobStage.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Shared.Jobs +{ + public enum RemoteJobStage + { + None, + Started, + Running, + Failed, + Aborted, + Completed + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/Jobs/RemoteJobUpdateRequest.cs b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Jobs/RemoteJobUpdateRequest.cs new file mode 100644 index 000000000..1322031ac --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Jobs/RemoteJobUpdateRequest.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Shared.Jobs +{ + public class RemoteJobUpdateRequest + { + + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/Jobs/RemoteJobUpdateResponse.cs b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Jobs/RemoteJobUpdateResponse.cs new file mode 100644 index 000000000..0bb32d266 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Jobs/RemoteJobUpdateResponse.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.DTO; +using Tango.Core; + +namespace Tango.PPC.Shared.Jobs +{ + public class RemoteJobUpdateResponse + { + public JobDTO Job { get; set; } + public ProcessParametersTableDTO ProcessParameters { get; set; } + public RemoteJobProgress Progress { get; set; } + + public RemoteJobUpdateResponse() + { + Progress = new RemoteJobProgress(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/Logs/GetLogFilesRequest.cs b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Logs/GetLogFilesRequest.cs new file mode 100644 index 000000000..bb5d21837 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Logs/GetLogFilesRequest.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Shared.Logs +{ + public class GetLogFilesRequest + { + public RemoteLogFileType LogFileType { get; set; } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/Logs/GetLogFilesResponse.cs b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Logs/GetLogFilesResponse.cs new file mode 100644 index 000000000..cf5d59726 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Logs/GetLogFilesResponse.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Shared.Logs +{ + public class GetLogFilesResponse + { + public List LogFiles { get; set; } + + public GetLogFilesResponse() + { + LogFiles = new List(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/Logs/RemoteLogFile.cs b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Logs/RemoteLogFile.cs new file mode 100644 index 000000000..fc2ba88c4 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Logs/RemoteLogFile.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Shared.Logs +{ + public class RemoteLogFile + { + public String Name { get; set; } + public DateTime DateModified { get; set; } + public DateTime DateCreated { get; set; } + public String Path { get; set; } + public long Length { get; set; } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/Logs/RemoteLogFileType.cs b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Logs/RemoteLogFileType.cs new file mode 100644 index 000000000..958b4c195 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Logs/RemoteLogFileType.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Shared.Logs +{ + public enum RemoteLogFileType + { + Application, + Firmware + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/Performance/PerformancePackage.cs b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Performance/PerformancePackage.cs new file mode 100644 index 000000000..855437bcc --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Performance/PerformancePackage.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Shared.Performance +{ + public class PerformancePackage + { + public int CPU { get; set; } + public int ApplicationCPU { get; set; } + + public int RAM { get; set; } + public int ApplicationRAM { get; set; } + public int MaxRAM { get; set; } + + public int Temperature { get; set; } + + public int AvailableDiskSpace { get; set; } + public int DiskCapacity { get; set; } + + public DateTime DateTime { get; set; } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/Performance/StartPerformanceUpdatesRequest.cs b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Performance/StartPerformanceUpdatesRequest.cs new file mode 100644 index 000000000..69fbaf631 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Performance/StartPerformanceUpdatesRequest.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Shared.Performance +{ + public class StartPerformanceUpdatesRequest + { + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/Performance/StartPerformanceUpdatesResponse.cs b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Performance/StartPerformanceUpdatesResponse.cs new file mode 100644 index 000000000..196225572 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Performance/StartPerformanceUpdatesResponse.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Shared.Performance +{ + public class StartPerformanceUpdatesResponse + { + public PerformancePackage Package { get; set; } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/Properties/AssemblyInfo.cs b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..c9efeb790 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Properties/AssemblyInfo.cs @@ -0,0 +1,23 @@ +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 Panel PC Shared Library")] +[assembly: AssemblyVersion("1.0.0.0")] + +[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) +)] + +//Friends With +[assembly: InternalsVisibleTo("Tango.PPC.UI")] diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/Properties/Resources.Designer.cs b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Properties/Resources.Designer.cs new file mode 100644 index 000000000..416184c0f --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Properties/Resources.Designer.cs @@ -0,0 +1,62 @@ +//------------------------------------------------------------------------------ +// +// 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.Shared.Properties { + + + /// + /// 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", "4.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 ((resourceMan == null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Tango.PPC.Shared.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/Tango.PPC.Shared/Properties/Resources.resx b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Properties/Resources.resx new file mode 100644 index 000000000..af7dbebba --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/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/Tango.PPC.Shared/Properties/Settings.Designer.cs b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Properties/Settings.Designer.cs new file mode 100644 index 000000000..0b65472a5 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// 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.Shared.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.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/Tango.PPC.Shared/Properties/Settings.settings b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Properties/Settings.settings new file mode 100644 index 000000000..033d7a5e9 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/RemoteActions/SimulateApplicationExceptionRequest.cs b/Software/Visual_Studio/PPC/Tango.PPC.Shared/RemoteActions/SimulateApplicationExceptionRequest.cs new file mode 100644 index 000000000..76216edad --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/RemoteActions/SimulateApplicationExceptionRequest.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Shared.RemoteActions +{ + public class SimulateApplicationExceptionRequest + { + public bool CrashApplication { get; set; } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/RemoteActions/SimulateApplicationExceptionResponse.cs b/Software/Visual_Studio/PPC/Tango.PPC.Shared/RemoteActions/SimulateApplicationExceptionResponse.cs new file mode 100644 index 000000000..e0b71ddf4 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/RemoteActions/SimulateApplicationExceptionResponse.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Shared.RemoteActions +{ + public class SimulateApplicationExceptionResponse + { + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/RemoteUpgrade/StartRemoteApplicationUpgradeRequest.cs b/Software/Visual_Studio/PPC/Tango.PPC.Shared/RemoteUpgrade/StartRemoteApplicationUpgradeRequest.cs new file mode 100644 index 000000000..bd2d6eba3 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/RemoteUpgrade/StartRemoteApplicationUpgradeRequest.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Shared.RemoteUpgrade +{ + public class StartRemoteApplicationUpgradeRequest + { + public String RemoteTupFilePath { get; set; } + public bool SetupFirmware { get; set; } = true; + public bool SetupFPGA { get; set; } = true; + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/RemoteUpgrade/StartRemoteApplicationUpgradeResponse.cs b/Software/Visual_Studio/PPC/Tango.PPC.Shared/RemoteUpgrade/StartRemoteApplicationUpgradeResponse.cs new file mode 100644 index 000000000..89f2b4e71 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/RemoteUpgrade/StartRemoteApplicationUpgradeResponse.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core; + +namespace Tango.PPC.Shared.RemoteUpgrade +{ + public class StartRemoteApplicationUpgradeResponse + { + public TangoProgress Progress { get; set; } + + public StartRemoteApplicationUpgradeResponse() + { + Progress = new TangoProgress() + { + Message = "Initializing...", + IsIndeterminate = true, + Maximum = 100 + }; + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/RemoteUpgrade/StartRemoteFirmwareUpgradeRequest.cs b/Software/Visual_Studio/PPC/Tango.PPC.Shared/RemoteUpgrade/StartRemoteFirmwareUpgradeRequest.cs new file mode 100644 index 000000000..9dedc0b2d --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/RemoteUpgrade/StartRemoteFirmwareUpgradeRequest.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Shared.RemoteUpgrade +{ + public class StartRemoteFirmwareUpgradeRequest + { + public String RemoteTfpFilePath { get; set; } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/RemoteUpgrade/StartRemoteFirmwareUpgradeResponse.cs b/Software/Visual_Studio/PPC/Tango.PPC.Shared/RemoteUpgrade/StartRemoteFirmwareUpgradeResponse.cs new file mode 100644 index 000000000..32fcd19c0 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/RemoteUpgrade/StartRemoteFirmwareUpgradeResponse.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core; + +namespace Tango.PPC.Shared.RemoteUpgrade +{ + public class StartRemoteFirmwareUpgradeResponse + { + public TangoProgress Progress { get; set; } + + public StartRemoteFirmwareUpgradeResponse() + { + Progress = new TangoProgress() + { + Message = "Initializing...", + IsIndeterminate = true, + Maximum = 100 + }; + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/SQL/ExecuteSqlRequest.cs b/Software/Visual_Studio/PPC/Tango.PPC.Shared/SQL/ExecuteSqlRequest.cs new file mode 100644 index 000000000..7802fc3f7 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/SQL/ExecuteSqlRequest.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Shared.SQL +{ + public class ExecuteSqlRequest + { + public String SQL { get; set; } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/SQL/ExecuteSqlResponse.cs b/Software/Visual_Studio/PPC/Tango.PPC.Shared/SQL/ExecuteSqlResponse.cs new file mode 100644 index 000000000..2db90a336 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/SQL/ExecuteSqlResponse.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Shared.SQL +{ + public class ExecuteSqlResponse + { + public int AffectedRecords { get; set; } + public RemoteSqlDataSet DataSet { get; set; } + + public ExecuteSqlResponse() + { + DataSet = new RemoteSqlDataSet(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/SQL/RemoteSqlColumn.cs b/Software/Visual_Studio/PPC/Tango.PPC.Shared/SQL/RemoteSqlColumn.cs new file mode 100644 index 000000000..54431bdbe --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/SQL/RemoteSqlColumn.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Shared.SQL +{ + /// + /// Represents a column. + /// + public class RemoteSqlColumn + { + /// + /// Gets or sets the column name. + /// + public String Name { get; set; } + + /// + /// Gets or sets the column index. + /// + public int Index { get; set; } + + /// + /// Initializes a new instance of the class. + /// + public RemoteSqlColumn() + { + + } + + /// + /// Initializes a new instance of the class. + /// + /// The column name. + public RemoteSqlColumn(String name) + { + Name = name; + } + + /// + /// Returns a that represents this instance. + /// + /// + /// A that represents this instance. + /// + public override string ToString() + { + return Name; + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/SQL/RemoteSqlColumnCollection.cs b/Software/Visual_Studio/PPC/Tango.PPC.Shared/SQL/RemoteSqlColumnCollection.cs new file mode 100644 index 000000000..dfda6c3b7 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/SQL/RemoteSqlColumnCollection.cs @@ -0,0 +1,78 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Shared.SQL +{ + /// + /// Represents a columns collection. + /// + /// + public class RemoteSqlColumnCollection : Collection + { + private Dictionary _dictionary; + + /// + /// Initializes a new instance of the class. + /// + public RemoteSqlColumnCollection() + { + _dictionary = new Dictionary(); + } + + /// + /// Inserts an element into the at the specified index. + /// + /// The zero-based index at which should be inserted. + /// The object to insert. The value can be null for reference types. + protected override void InsertItem(int index, RemoteSqlColumn item) + { + item.Index = Count; + _dictionary.Add(item.Name, item); + base.InsertItem(index, item); + } + + /// + /// Removes the element at the specified index of the . + /// + /// The zero-based index of the element to remove. + /// + protected override void RemoveItem(int index) + { + throw new NotSupportedException(); + } + + /// + /// Removes all elements from the . + /// + protected override void ClearItems() + { + _dictionary.Clear(); + base.ClearItems(); + } + + /// + /// Replaces the element at the specified index. + /// + /// The zero-based index of the element to replace. + /// The new value for the element at the specified index. The value can be null for reference types. + /// + protected override void SetItem(int index, RemoteSqlColumn item) + { + throw new NotSupportedException(); + } + + /// + /// Gets the column index by column name. + /// + /// Column name. + /// + public int GetIndexOf(String columnName) + { + return _dictionary[columnName].Index; + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/SQL/RemoteSqlDataSet.cs b/Software/Visual_Studio/PPC/Tango.PPC.Shared/SQL/RemoteSqlDataSet.cs new file mode 100644 index 000000000..72b8d2eb2 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/SQL/RemoteSqlDataSet.cs @@ -0,0 +1,188 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Collections.Specialized; +using System.Data.SqlClient; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Shared.SQL +{ + /// + /// Represents remote database query result composed of rows and columns. + /// + /// + /// + /// + /// The following example demonstrates how to set the connected machine's demo state and query for the connected machine's jobs. + /// + /// + /// + /// + public class RemoteSqlDataSet + { + /// + /// Gets or sets the dataset columns. + /// + public RemoteSqlColumnCollection Columns { get; set; } + + private ObservableCollection _rows; + /// + /// Gets or sets the dataset rows. + /// + public ObservableCollection Rows + { + get { return _rows; } + set { _rows = value; OnRowsChanged(); } + } + + /// + /// Initializes a new instance of the class. + /// + public RemoteSqlDataSet() + { + Columns = new RemoteSqlColumnCollection(); + Rows = new ObservableCollection(); + } + + private void OnRowsChanged() + { + if (Rows != null) + { + Rows.CollectionChanged -= Rows_CollectionChanged; + Rows.CollectionChanged += Rows_CollectionChanged; + + InitRows(); + } + } + + private void Rows_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) + { + InitRows(); + } + + private void InitRows() + { + if (Rows != null) + { + foreach (var row in Rows.ToList()) + { + row.Init( + (key) => + { + return row.Values[Columns.GetIndexOf(key)]; + }, + (index) => + { + return row.Values[index]; + }); + } + } + } + + /// + /// Creates a new using the specified . + /// + /// The reader. + /// + public static Task Load(SqlDataReader reader) + { + return Task.Factory.StartNew(() => + { + bool columnsRead = false; + RemoteSqlDataSet dataSet = new RemoteSqlDataSet(); + + try + { + while (reader.Read()) + { + RemoteSqlRow row = new RemoteSqlRow(); + + for (int i = 0; i < reader.FieldCount; i++) + { + if (!columnsRead) + { + dataSet.Columns.Add(new RemoteSqlColumn() + { + Name = reader.GetName(i) + }); + } + + row.Values.Add(reader.GetValue(i)); + } + + columnsRead = true; + dataSet.Rows.Add(row); + } + } + finally + { + reader.Close(); + } + + return dataSet; + }); + } + + /// + /// Returns a that represents this instance. + /// + /// + /// A that represents this instance. + /// + public override string ToString() + { + return String.Join(", ", Columns.Select(x => x.Name)) + "\n" + String.Join(Environment.NewLine, Rows.Select(x => x.ToString())); + } + + /// + /// Formats this dataset as a string with columns and rows. + /// + /// + public String ToTableString() + { + Dictionary columnsMaxLength = new Dictionary(); + + for (int i = 0; i < Columns.Count; i++) + { + columnsMaxLength.Add(i, Columns[i].Name.Length); + } + + foreach (var row in Rows) + { + for (int i = 0; i < row.Values.Count; i++) + { + int valueLength = row.Values[i].ToStringSafe().Length; + + if (valueLength > columnsMaxLength[i]) + { + columnsMaxLength[i] = valueLength; + } + } + } + + String str = String.Empty; + + for (int i = 0; i < Columns.Count; i++) + { + str += $"{Columns[i].Name.PadRight(columnsMaxLength[i])}{(i < Columns.Count - 1 ? " | " : "")}"; + } + + int width = str.Length; + str += Environment.NewLine + String.Empty.PadRight(width, '-'); + + foreach (var row in Rows) + { + str += Environment.NewLine; + + for (int i = 0; i < row.Values.Count; i++) + { + str += $"{row.Values[i].ToStringSafe().PadRight(columnsMaxLength[i])}{(i < Columns.Count - 1 ? " | " : "")}"; + } + } + + return str; + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/SQL/RemoteSqlRow.cs b/Software/Visual_Studio/PPC/Tango.PPC.Shared/SQL/RemoteSqlRow.cs new file mode 100644 index 000000000..dfabacfea --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/SQL/RemoteSqlRow.cs @@ -0,0 +1,153 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.Diagnostics; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Entities; + +namespace Tango.PPC.Shared.SQL +{ + /// + /// Represents a row. + /// + /// + /// + /// + /// The following example demonstrates how to set the connected machine's demo state and query for the connected machine's jobs. + /// + /// + /// + /// + public class RemoteSqlRow + { + private Func _getFuncKey; + private Func _getFuncIndex; + + /// + /// Gets or sets the row values. + /// + public List Values { get; set; } + + /// + /// Initializes a new instance of the class. + /// + public RemoteSqlRow() + { + Values = new List(); + } + + /// + /// Gets a row value by its column name. + /// + /// Name of the column. + /// The column value. + public Object Get(String columnName) + { + return _getFuncKey.Invoke(columnName); + } + + /// + /// Gets a row value by its column index. + /// + /// Index of the column. + /// The column value. + public Object Get(int columnIndex) + { + return _getFuncIndex.Invoke(columnIndex); + } + + /// + /// Gets a row value as type T by its column name. + /// + /// Expected column type. + /// Name of the column. + /// The column value. + public T Get(String columnName) + { + var value = _getFuncKey.Invoke(columnName); + + if (typeof(T) != value.GetType()) + { + return (T)Convert.ChangeType(value, typeof(T)); + } + else + { + return (T)value; + } + } + + /// + /// Gets a row value by its column index. + /// + /// Expected column type + /// Index of the column. + /// The column value. + public T Get(int columnIndex) + { + var value = _getFuncIndex.Invoke(columnIndex); + + if (typeof(T) != value.GetType()) + { + return (T)Convert.ChangeType(value, typeof(T)); + } + else + { + return (T)value; + } + } + + internal void Init(Func getFuncKey, Func getFuncIndex) + { + _getFuncKey = getFuncKey; + _getFuncIndex = getFuncIndex; + } + + /// + /// Returns a that represents this instance. + /// + /// + /// A that represents this instance. + /// + public override string ToString() + { + return String.Join(", ", Values); + } + + /// + /// Creates an object of type T and maps this row to it based on its properties decorated with . + /// + /// + /// + public T Map() where T : class, new() + { + var obj = Activator.CreateInstance(); + Map(obj); + return obj; + } + + /// + /// Maps this row to the specified object based on its properties decorated with . + /// + /// Model type + /// The object. + public void Map(T obj) where T : class + { + foreach (var prop in typeof(T).GetPropertiesWithAttribute()) + { + try + { + var columnName = prop.GetCustomAttribute().Name; + var value = Get(columnName).ToStringSafe(); + prop.SetValue(obj, Convert.ChangeType(value, prop.PropertyType)); + } + catch (Exception ex) + { + Debug.WriteLine(ex); + } + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/Tango.PPC.Shared.csproj b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Tango.PPC.Shared.csproj new file mode 100644 index 000000000..8c3908bba --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Tango.PPC.Shared.csproj @@ -0,0 +1,148 @@ + + + + + Debug + AnyCPU + {208C8BD8-72C6-4E3C-ACAA-351091A2ACC7} + library + Tango.PPC.Shared + Tango.PPC.Shared + v4.6.1 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + true + + + true + full + false + ..\..\Build\PPC\Debug\ + DEBUG;TRACE + prompt + 4 + ..\..\Build\PPC\Debug\Tango.PPC.Shared.xml + 1591 + + + pdbonly + true + ..\..\Build\PPC\Release\ + TRACE + prompt + 4 + ..\..\Build\PPC\Release\Tango.PPC.Shared.xml + 1591 + + + + + + + + + + + + + 4.0 + + + + + + + + MSBuild:Compile + Designer + + + + + GlobalVersionInfo.cs + + + + + + + + + + + + + + + + + + + + + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + + + + + + + + + + + + + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + {f441feee-322a-4943-b566-110e12fd3b72} + Tango.BL + + + {A34EE0F0-649D-41C8-8489-B6F1CC6924EE} + Tango.Core + + + {E4927038-348D-4295-AAF4-861C58CB3943} + Tango.PMR + + + {997a961c-beda-4b56-aa0f-c39e532f7ffa} + Tango.SystemInfo + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/Themes/Generic.xaml b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Themes/Generic.xaml new file mode 100644 index 000000000..1226f66d1 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Themes/Generic.xaml @@ -0,0 +1,6 @@ + + + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/Updates/GetUpdatesAndPackagesRequest.cs b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Updates/GetUpdatesAndPackagesRequest.cs new file mode 100644 index 000000000..f8cadc49d --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Updates/GetUpdatesAndPackagesRequest.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Shared.Updates +{ + public class GetUpdatesAndPackagesRequest + { + + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/Updates/GetUpdatesAndPackagesResponse.cs b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Updates/GetUpdatesAndPackagesResponse.cs new file mode 100644 index 000000000..d264739d7 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Updates/GetUpdatesAndPackagesResponse.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.DTO; + +namespace Tango.PPC.Shared.Updates +{ + public class GetUpdatesAndPackagesResponse + { + public List Updates { get; set; } + + public List Packages { get; set; } + + public GetUpdatesAndPackagesResponse() + { + Updates = new List(); + Packages = new List(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/Updates/PackageInstallation.cs b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Updates/PackageInstallation.cs new file mode 100644 index 000000000..639fd76bf --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Updates/PackageInstallation.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Shared.Updates +{ + public class PackageInstallation + { + public String PackageName { get; set; } + + public PackageType Type { get; set; } + + public DateTime InstallationDate { get; set; } + + public PackageInstallationState State { get; set; } + + public String FailedReason { get; set; } + + public PackageInstallation() + { + InstallationDate = DateTime.Now; + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/Updates/PackageInstallationState.cs b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Updates/PackageInstallationState.cs new file mode 100644 index 000000000..51ae2abce --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Updates/PackageInstallationState.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Shared.Updates +{ + public enum PackageInstallationState + { + NotInstalled, + Installed, + Failed, + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/Updates/PackageType.cs b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Updates/PackageType.cs new file mode 100644 index 000000000..0e553ca21 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Updates/PackageType.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Shared.Updates +{ + public enum PackageType + { + Pre, + Post + } +} -- cgit v1.3.1