396 lines
15 KiB
Plaintext
396 lines
15 KiB
Plaintext
|
|
using System;
|
||
|
|
using System.Collections.Generic;
|
||
|
|
using System.Collections.ObjectModel;
|
||
|
|
using System.ComponentModel;
|
||
|
|
using System.Linq;
|
||
|
|
using System.Text;
|
||
|
|
using System.Threading.Tasks;
|
||
|
|
using System.Drawing;
|
||
|
|
using System.Reflection;
|
||
|
|
using System.Windows.Media.Imaging;
|
||
|
|
// ReSharper disable InconsistentNaming
|
||
|
|
|
||
|
|
namespace DTS.Common
|
||
|
|
{
|
||
|
|
public static class AssemblyInfo
|
||
|
|
{
|
||
|
|
public static Dictionary<string, BitmapImage> AssemblyImage = new Dictionary<string, BitmapImage>();
|
||
|
|
|
||
|
|
public static BitmapImage GetImage(string asmName)
|
||
|
|
{
|
||
|
|
return LoadImages().Where(x => x.AssemblyName == asmName).Select(z => z.AssemblyImage).FirstOrDefault();
|
||
|
|
}
|
||
|
|
|
||
|
|
private static List<AssemblyNameImage> LoadImages()
|
||
|
|
{
|
||
|
|
var tilesLocation = Properties.Settings.Default.TilesLocation;
|
||
|
|
return new List<AssemblyNameImage>
|
||
|
|
{
|
||
|
|
new AssemblyNameImage(eAssemblyGroups.Hardware.ToString(), AssemblyNames.DataRecorders.ToString(),
|
||
|
|
new BitmapImage(new Uri(tilesLocation + AssemblyNames.DataRecorders + ".png", UriKind.Relative)),
|
||
|
|
0),
|
||
|
|
new AssemblyNameImage(eAssemblyGroups.Hardware.ToString(), AssemblyNames.SensorTemplates.ToString(),
|
||
|
|
new BitmapImage(new Uri(tilesLocation + AssemblyNames.SensorTemplates + ".png", UriKind.Relative)),
|
||
|
|
0),
|
||
|
|
new AssemblyNameImage(eAssemblyGroups.Hardware.ToString(), AssemblyNames.SensorDatabase.ToString(),
|
||
|
|
new BitmapImage(new Uri(tilesLocation + AssemblyNames.SensorDatabase + ".png", UriKind.Relative)),
|
||
|
|
0),
|
||
|
|
new AssemblyNameImage(eAssemblyGroups.Prepare.ToString(), AssemblyNames.GroupTemplate.ToString(),
|
||
|
|
new BitmapImage(new Uri(tilesLocation + AssemblyNames.GroupTemplate + ".png", UriKind.Relative)),
|
||
|
|
1),
|
||
|
|
new AssemblyNameImage(eAssemblyGroups.Prepare.ToString(), AssemblyNames.Groups.ToString(),
|
||
|
|
new BitmapImage(new Uri(tilesLocation + AssemblyNames.Groups + ".png", UriKind.Relative)), 1),
|
||
|
|
new AssemblyNameImage(eAssemblyGroups.Prepare.ToString(), AssemblyNames.CustomerDetails.ToString(),
|
||
|
|
new BitmapImage(new Uri(tilesLocation + AssemblyNames.CustomerDetails + ".png", UriKind.Relative)),
|
||
|
|
1),
|
||
|
|
new AssemblyNameImage(eAssemblyGroups.Prepare.ToString(), AssemblyNames.EngineerDetails.ToString(),
|
||
|
|
new BitmapImage(new Uri(tilesLocation + AssemblyNames.EngineerDetails + ".png", UriKind.Relative)),
|
||
|
|
1),
|
||
|
|
new AssemblyNameImage(eAssemblyGroups.Prepare.ToString(), AssemblyNames.LabDetails.ToString(),
|
||
|
|
new BitmapImage(new Uri(tilesLocation + AssemblyNames.LabDetails + ".png", UriKind.Relative)), 1),
|
||
|
|
new AssemblyNameImage(eAssemblyGroups.Prepare.ToString(), AssemblyNames.TestSetups.ToString(),
|
||
|
|
new BitmapImage(new Uri(tilesLocation + AssemblyNames.TestSetups + ".png", UriKind.Relative)), 1),
|
||
|
|
new AssemblyNameImage(eAssemblyGroups.Prepare.ToString(), AssemblyNames.CustomChannels.ToString(),
|
||
|
|
new BitmapImage(new Uri(tilesLocation + AssemblyNames.CustomChannels + ".png", UriKind.Relative)),
|
||
|
|
1),
|
||
|
|
new AssemblyNameImage(eAssemblyGroups.Diagnostics.ToString(), AssemblyNames.CheckChannels.ToString(),
|
||
|
|
new BitmapImage(new Uri(tilesLocation + AssemblyNames.CheckChannels + ".png", UriKind.Relative)),
|
||
|
|
2),
|
||
|
|
new AssemblyNameImage(eAssemblyGroups.Diagnostics.ToString(), AssemblyNames.CheckTrigger.ToString(),
|
||
|
|
new BitmapImage(new Uri(tilesLocation + AssemblyNames.CheckTrigger + ".png", UriKind.Relative)), 2),
|
||
|
|
new AssemblyNameImage(eAssemblyGroups.Record.ToString(), AssemblyNames.RunTest.ToString(),
|
||
|
|
new BitmapImage(new Uri(tilesLocation + AssemblyNames.RunTest + ".png", UriKind.Relative)), 3),
|
||
|
|
new AssemblyNameImage(eAssemblyGroups.Record.ToString(), AssemblyNames.DownloadData.ToString(),
|
||
|
|
new BitmapImage(new Uri(tilesLocation + AssemblyNames.DownloadData + ".png", UriKind.Relative)), 3),
|
||
|
|
new AssemblyNameImage(eAssemblyGroups.Review.ToString(), AssemblyNames.ViewData.ToString(),
|
||
|
|
new BitmapImage(new Uri(tilesLocation + AssemblyNames.ViewData + ".png", UriKind.Relative)), 4),
|
||
|
|
new AssemblyNameImage(eAssemblyGroups.Review.ToString(), AssemblyNames.ExportData.ToString(),
|
||
|
|
new BitmapImage(new Uri(tilesLocation + AssemblyNames.ExportData + ".png", UriKind.Relative)), 4),
|
||
|
|
new AssemblyNameImage(eAssemblyGroups.Administrative.ToString(), AssemblyNames.ManageUsers.ToString(),
|
||
|
|
new BitmapImage(new Uri(tilesLocation + AssemblyNames.ManageUsers + ".png", UriKind.Relative)), 5),
|
||
|
|
new AssemblyNameImage(eAssemblyGroups.Administrative.ToString(),
|
||
|
|
AssemblyNames.SystemSettings.ToString(),
|
||
|
|
new BitmapImage(new Uri(tilesLocation + AssemblyNames.SystemSettings + ".png", UriKind.Relative)),
|
||
|
|
5),
|
||
|
|
new AssemblyNameImage(eAssemblyGroups.Administrative.ToString(), AssemblyNames.Networking.ToString(),
|
||
|
|
new BitmapImage(new Uri(tilesLocation + AssemblyNames.Networking + ".png", UriKind.Relative)), 5),
|
||
|
|
|
||
|
|
//Not avaiable yet...
|
||
|
|
new AssemblyNameImage(eAssemblyGroups.Viewer.ToString(), AssemblyNames.Navigation.ToString(),
|
||
|
|
new BitmapImage(new Uri(tilesLocation + AssemblyNames.Navigation + ".png", UriKind.Relative)), 5),
|
||
|
|
new AssemblyNameImage(eAssemblyGroups.Viewer.ToString(), AssemblyNames.Eu.ToString(),
|
||
|
|
new BitmapImage(new Uri(tilesLocation + AssemblyNames.Eu + ".png", UriKind.Relative)), 5),
|
||
|
|
new AssemblyNameImage(eAssemblyGroups.Viewer.ToString(), AssemblyNames.Mv.ToString(),
|
||
|
|
new BitmapImage(new Uri(tilesLocation + AssemblyNames.Mv + ".png", UriKind.Relative)), 5),
|
||
|
|
new AssemblyNameImage(eAssemblyGroups.Viewer.ToString(), AssemblyNames.Edc.ToString(),
|
||
|
|
new BitmapImage(new Uri(tilesLocation + AssemblyNames.Edc + ".png", UriKind.Relative)), 5),
|
||
|
|
new AssemblyNameImage(eAssemblyGroups.Viewer.ToString(), AssemblyNames.Tests.ToString(),
|
||
|
|
new BitmapImage(new Uri(tilesLocation + AssemblyNames.Tests + ".png", UriKind.Relative)), 5),
|
||
|
|
new AssemblyNameImage(eAssemblyGroups.Viewer.ToString(), AssemblyNames.Graphs.ToString(),
|
||
|
|
new BitmapImage(new Uri(tilesLocation + AssemblyNames.Graphs + ".png", UriKind.Relative)), 5),
|
||
|
|
new AssemblyNameImage(eAssemblyGroups.Viewer.ToString(), AssemblyNames.Legend.ToString(),
|
||
|
|
new BitmapImage(new Uri(tilesLocation + AssemblyNames.Legend + ".png", UriKind.Relative)), 5),
|
||
|
|
new AssemblyNameImage(eAssemblyGroups.Viewer.ToString(), AssemblyNames.Diag.ToString(),
|
||
|
|
new BitmapImage(new Uri(tilesLocation + AssemblyNames.Diag + ".png", UriKind.Relative)), 5),
|
||
|
|
new AssemblyNameImage(eAssemblyGroups.Viewer.ToString(), AssemblyNames.Stats.ToString(),
|
||
|
|
new BitmapImage(new Uri(tilesLocation + AssemblyNames.Stats + ".png", UriKind.Relative)), 5),
|
||
|
|
new AssemblyNameImage(eAssemblyGroups.Viewer.ToString(), AssemblyNames.Cursor.ToString(),
|
||
|
|
new BitmapImage(new Uri(tilesLocation + AssemblyNames.Cursor + ".png", UriKind.Relative)), 5),
|
||
|
|
new AssemblyNameImage(eAssemblyGroups.Viewer.ToString(), AssemblyNames.Property.ToString(),
|
||
|
|
new BitmapImage(new Uri(tilesLocation + AssemblyNames.Property + ".png", UriKind.Relative)), 5),
|
||
|
|
|
||
|
|
};
|
||
|
|
}
|
||
|
|
|
||
|
|
public static Type ImageAttribute;
|
||
|
|
}
|
||
|
|
|
||
|
|
public class AssemblyNameImage : INotifyPropertyChanged
|
||
|
|
{
|
||
|
|
public AssemblyNameImage()
|
||
|
|
{
|
||
|
|
}
|
||
|
|
|
||
|
|
public AssemblyNameImage(string group, string name, BitmapImage image, int sort)
|
||
|
|
{
|
||
|
|
_assemblyGroup = group;
|
||
|
|
_assemblyName = name;
|
||
|
|
_assemblyImage = image;
|
||
|
|
_sortOrder = sort;
|
||
|
|
OnPropertyChanged("AssemblyGroup");
|
||
|
|
OnPropertyChanged("AssemblyName");
|
||
|
|
OnPropertyChanged("AssemblyImage");
|
||
|
|
}
|
||
|
|
|
||
|
|
private string _assemblyGroup = string.Empty;
|
||
|
|
|
||
|
|
public string AssemblyGroup
|
||
|
|
{
|
||
|
|
get => _assemblyGroup;
|
||
|
|
set
|
||
|
|
{
|
||
|
|
_assemblyGroup = value;
|
||
|
|
OnPropertyChanged("AssemblyGroup");
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
private string _assemblyName = string.Empty;
|
||
|
|
|
||
|
|
public string AssemblyName
|
||
|
|
{
|
||
|
|
get => _assemblyName;
|
||
|
|
set
|
||
|
|
{
|
||
|
|
_assemblyName = value;
|
||
|
|
OnPropertyChanged("AssemblyName");
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
private eAssemblyRegion _assemblyRegion = eAssemblyRegion.NotAssigned;
|
||
|
|
|
||
|
|
public eAssemblyRegion AssemblyRegion
|
||
|
|
{
|
||
|
|
get => _assemblyRegion;
|
||
|
|
set
|
||
|
|
{
|
||
|
|
_assemblyRegion = value;
|
||
|
|
OnPropertyChanged("AssemblyRegion");
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
BitmapImage _assemblyImage = new BitmapImage();
|
||
|
|
|
||
|
|
public BitmapImage AssemblyImage
|
||
|
|
{
|
||
|
|
get => _assemblyImage;
|
||
|
|
set
|
||
|
|
{
|
||
|
|
_assemblyImage = value;
|
||
|
|
OnPropertyChanged("AssemblyImage");
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
private int _sortOrder = 0;
|
||
|
|
|
||
|
|
public int SortOrder
|
||
|
|
{
|
||
|
|
get => _sortOrder;
|
||
|
|
set
|
||
|
|
{
|
||
|
|
_sortOrder = value;
|
||
|
|
OnPropertyChanged("SortOrder");
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
///<summary>
|
||
|
|
///Occurs when a property value changes.
|
||
|
|
///</summary>
|
||
|
|
public event PropertyChangedEventHandler PropertyChanged;
|
||
|
|
|
||
|
|
private void OnPropertyChanged(string propertyName)
|
||
|
|
{
|
||
|
|
var eventHandler = PropertyChanged;
|
||
|
|
if (eventHandler != null)
|
||
|
|
{
|
||
|
|
eventHandler(this, new PropertyChangedEventArgs(propertyName));
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
public class AssemblyGroups : INotifyPropertyChanged
|
||
|
|
{
|
||
|
|
public AssemblyGroups()
|
||
|
|
{
|
||
|
|
}
|
||
|
|
|
||
|
|
private string _asemblyGroupName = string.Empty;
|
||
|
|
|
||
|
|
public string AssemblyGroupName
|
||
|
|
{
|
||
|
|
get => _asemblyGroupName;
|
||
|
|
set
|
||
|
|
{
|
||
|
|
_asemblyGroupName = value;
|
||
|
|
OnPropertyChanged("AssemblyGroupName");
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
private List<AssemblyNameImage> _assemblyList = new List<AssemblyNameImage>();
|
||
|
|
|
||
|
|
public List<AssemblyNameImage> AssemblyList
|
||
|
|
{
|
||
|
|
get => _assemblyList;
|
||
|
|
set
|
||
|
|
{
|
||
|
|
_assemblyList = value;
|
||
|
|
OnPropertyChanged("AssemblyList");
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
private int _sortOrder = 0;
|
||
|
|
|
||
|
|
public int SortOrder
|
||
|
|
{
|
||
|
|
get => _sortOrder;
|
||
|
|
set
|
||
|
|
{
|
||
|
|
_sortOrder = value;
|
||
|
|
OnPropertyChanged("SortOrder");
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
///<summary>
|
||
|
|
///Occurs when a property value changes.
|
||
|
|
///</summary>
|
||
|
|
public event PropertyChangedEventHandler PropertyChanged;
|
||
|
|
|
||
|
|
private void OnPropertyChanged(string propertyName)
|
||
|
|
{
|
||
|
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public enum eAssemblyGroups
|
||
|
|
{
|
||
|
|
Hardware,
|
||
|
|
Prepare,
|
||
|
|
Diagnostics,
|
||
|
|
Record,
|
||
|
|
Review,
|
||
|
|
Administrative,
|
||
|
|
Viewer
|
||
|
|
}
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Assembly Names, aka Pluggable components, aka Modules.
|
||
|
|
/// </summary>
|
||
|
|
public enum AssemblyNames
|
||
|
|
{
|
||
|
|
CheckChannels,
|
||
|
|
CheckTrigger,
|
||
|
|
CustomChannels,
|
||
|
|
CustomerDetails,
|
||
|
|
DataRecorders,
|
||
|
|
DownloadData,
|
||
|
|
EngineerDetails,
|
||
|
|
LabDetails,
|
||
|
|
ExportData,
|
||
|
|
Groups,
|
||
|
|
GroupTemplate,
|
||
|
|
ManageUsers,
|
||
|
|
RunTest,
|
||
|
|
SensorDatabase,
|
||
|
|
SensorTemplates,
|
||
|
|
SystemSettings,
|
||
|
|
TestSetups,
|
||
|
|
ViewData,
|
||
|
|
Networking,
|
||
|
|
IsoSettings,
|
||
|
|
PowerAndBattery,
|
||
|
|
RealtimeSettings,
|
||
|
|
TablesSettings,
|
||
|
|
TestSettings,
|
||
|
|
QASettings,
|
||
|
|
UISettings,
|
||
|
|
DB,
|
||
|
|
Navigation,
|
||
|
|
Eu,
|
||
|
|
Mv,
|
||
|
|
Edc,
|
||
|
|
Tests,
|
||
|
|
Graphs,
|
||
|
|
Legend,
|
||
|
|
Diag,
|
||
|
|
Stats,
|
||
|
|
Cursor,
|
||
|
|
Property,
|
||
|
|
Graph,
|
||
|
|
GraphList,
|
||
|
|
CPU,
|
||
|
|
GroupImport,
|
||
|
|
TestSummaryList,
|
||
|
|
Filter,
|
||
|
|
ChartOptions,
|
||
|
|
TestModification,
|
||
|
|
AddCalculatedChannel,
|
||
|
|
TTSImport,
|
||
|
|
StatusAndProgressBar,
|
||
|
|
SensorsList,
|
||
|
|
HardwareList,
|
||
|
|
GroupTemplateList,
|
||
|
|
GroupList,
|
||
|
|
TestSetupsList,
|
||
|
|
CachedItemsList,
|
||
|
|
RealtimeModule,
|
||
|
|
TemplateChannelList,
|
||
|
|
DatabaseServices,
|
||
|
|
GroupChannelList,
|
||
|
|
RegionOfInterestChannels,
|
||
|
|
Diagnostics,
|
||
|
|
ChannelCodes,
|
||
|
|
ChannelCodeBuilder,
|
||
|
|
SoftwareFilters,
|
||
|
|
SensorSettingsModule,
|
||
|
|
SquibsModule,
|
||
|
|
ViewerSettings,
|
||
|
|
HamburgerMenu,
|
||
|
|
AddEditHardware,
|
||
|
|
ExtraProperties,
|
||
|
|
PSDReport,
|
||
|
|
PSDReportResults,
|
||
|
|
PSDReportSettings
|
||
|
|
}
|
||
|
|
|
||
|
|
public enum eAssemblyRegion
|
||
|
|
{
|
||
|
|
NotAssigned,
|
||
|
|
NavigationRegion,
|
||
|
|
EuRegion,
|
||
|
|
MvRegion,
|
||
|
|
EdcRegion,
|
||
|
|
TestsRegion,
|
||
|
|
GraphsRegion,
|
||
|
|
LegendRegion,
|
||
|
|
DiagRegion,
|
||
|
|
StatsRegion,
|
||
|
|
CursorRegion,
|
||
|
|
PropertyRegion,
|
||
|
|
DisplayRegion,
|
||
|
|
GraphRegion,
|
||
|
|
GraphListRegion,
|
||
|
|
TestSummaryRegion,
|
||
|
|
FilterRegion,
|
||
|
|
ChartOptionsRegion,
|
||
|
|
TestModificationRegion,
|
||
|
|
AddCalculatedChannelRegion,
|
||
|
|
TTSImportRegion,
|
||
|
|
StatusAndProgressBarRegion,
|
||
|
|
SensorsListRegion,
|
||
|
|
HardwareListRegion,
|
||
|
|
GroupTemplateListRegion,
|
||
|
|
GroupListRegion,
|
||
|
|
TestSetupsListRegion,
|
||
|
|
CachedItemsListRegion,
|
||
|
|
RealtimeModuleRegion,
|
||
|
|
TemplateChannelListRegion,
|
||
|
|
DatabaseServicesRegion,
|
||
|
|
CustomChannelsRegion,
|
||
|
|
GroupChannelListRegion,
|
||
|
|
RegionOfInterestChannelsRegion,
|
||
|
|
DiagnosticsRegion,
|
||
|
|
ChannelCodesRegion,
|
||
|
|
ChannelCodeBuilderRegion,
|
||
|
|
SoftwareFiltersRegion,
|
||
|
|
SensorSettingsModuleRegion,
|
||
|
|
SquibsModuleRegion,
|
||
|
|
ViewerSettingsRegion,
|
||
|
|
HamburgerMenuRegion,
|
||
|
|
AddEditHardwareRegion,
|
||
|
|
ExtraPropertiesRegion,
|
||
|
|
PSDReportRegion,
|
||
|
|
PSDReportResultsRegion,
|
||
|
|
PSDReportSettingsRegion,
|
||
|
|
}
|
||
|
|
}
|