e-register manual programming
This commit is contained in:
parent
828f8631ec
commit
3edc7df3a9
@ -155,7 +155,7 @@
|
||||
</site>
|
||||
<site name="MeterProcessState" id="2">
|
||||
<application path="/" applicationPool="Clr4IntegratedAppPool">
|
||||
<virtualDirectory path="/" physicalPath="C:\Users\drabesch_ro\Repo\lab\la_operations\laa_production\Common\Service\MeterProcessState" />
|
||||
<virtualDirectory path="/" physicalPath="C:\Users\SZLATEV\source\repos\laa_production\Common\Service\MeterProcessState" />
|
||||
</application>
|
||||
<bindings>
|
||||
<binding protocol="http" bindingInformation="*:56011:localhost" />
|
||||
|
||||
@ -820,6 +820,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Debug", "Debug", "{7C77A79B
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TempPE", "TempPE", "{91CA9896-2288-4967-8991-AC49A77B6058}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common.GUI", "Ui\Common.GUI\Common.GUI.csproj", "{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SharedMSBuildProjectFiles) = preSolution
|
||||
Utils\DateTimeServerShared\DateTimeServerShared.projitems*{4806d89a-fbfb-41bc-aaa7-2242444bf55a}*SharedItemsImports = 4
|
||||
@ -5846,6 +5848,70 @@ Global
|
||||
{FDE234FD-FF24-479F-B5CA-DFB74B4636DA}.XP32bit|x64.Build.0 = Release|Any CPU
|
||||
{FDE234FD-FF24-479F-B5CA-DFB74B4636DA}.XP32bit|x86.ActiveCfg = Release|Any CPU
|
||||
{FDE234FD-FF24-479F-B5CA-DFB74B4636DA}.XP32bit|x86.Build.0 = Release|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}._MANUAL_CONTROL|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}._MANUAL_CONTROL|Any CPU.Build.0 = Release|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}._MANUAL_CONTROL|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}._MANUAL_CONTROL|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}._MANUAL_CONTROL|x64.ActiveCfg = Release|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}._MANUAL_CONTROL|x64.Build.0 = Release|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}._MANUAL_CONTROL|x86.ActiveCfg = Release|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}._MANUAL_CONTROL|x86.Build.0 = Release|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}.COM|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}.COM|Any CPU.Build.0 = Release|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}.COM|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}.COM|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}.COM|x64.ActiveCfg = Release|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}.COM|x64.Build.0 = Release|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}.COM|x86.ActiveCfg = Release|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}.COM|x86.Build.0 = Release|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}.GenesisDisplayTool_V01|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}.GenesisDisplayTool_V01|Any CPU.Build.0 = Release|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}.GenesisDisplayTool_V01|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}.GenesisDisplayTool_V01|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}.GenesisDisplayTool_V01|x64.ActiveCfg = Release|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}.GenesisDisplayTool_V01|x64.Build.0 = Release|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}.GenesisDisplayTool_V01|x86.ActiveCfg = Release|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}.GenesisDisplayTool_V01|x86.Build.0 = Release|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}.PerformTest|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}.PerformTest|Any CPU.Build.0 = Release|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}.PerformTest|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}.PerformTest|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}.PerformTest|x64.ActiveCfg = Release|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}.PerformTest|x64.Build.0 = Release|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}.PerformTest|x86.ActiveCfg = Release|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}.PerformTest|x86.Build.0 = Release|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}.Release|x64.Build.0 = Release|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}.Release|x86.Build.0 = Release|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}.ReleaseTest|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}.ReleaseTest|Any CPU.Build.0 = Release|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}.ReleaseTest|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}.ReleaseTest|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}.ReleaseTest|x64.ActiveCfg = Release|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}.ReleaseTest|x64.Build.0 = Release|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}.ReleaseTest|x86.ActiveCfg = Release|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}.ReleaseTest|x86.Build.0 = Release|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}.XP32bit|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}.XP32bit|Any CPU.Build.0 = Release|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}.XP32bit|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}.XP32bit|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}.XP32bit|x64.ActiveCfg = Release|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}.XP32bit|x64.Build.0 = Release|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}.XP32bit|x86.ActiveCfg = Release|Any CPU
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}.XP32bit|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@ -6052,6 +6118,7 @@ Global
|
||||
{B2EAC69C-22C9-41D5-987B-5E1F435C0CBC} = {A778164E-C265-4B13-82A1-FF227AC3D668}
|
||||
{7C77A79B-646C-4CF8-AD1C-930E0B059829} = {B2EAC69C-22C9-41D5-987B-5E1F435C0CBC}
|
||||
{91CA9896-2288-4967-8991-AC49A77B6058} = {7C77A79B-646C-4CF8-AD1C-930E0B059829}
|
||||
{25A3BC33-563A-41EC-A1CB-4C5F520DDD53} = {03D4F23E-7E4A-4091-BC96-036C996D351A}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {4BCB7B69-696C-436A-86F7-C91EA5588164}
|
||||
|
||||
@ -70,10 +70,6 @@
|
||||
<Project>{62490923-CD17-45A6-B79F-A027927C75B5}</Project>
|
||||
<Name>Common.Logic.Extensions.SQL</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Service\MeterProcessState\MeterProcessState.csproj">
|
||||
<Project>{1057AD21-BA22-4CAB-B3FE-88C5C9980E6A}</Project>
|
||||
<Name>MeterProcessState</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="test.txt" />
|
||||
|
||||
@ -1,124 +1,148 @@
|
||||
namespace CommonConsole
|
||||
{
|
||||
using Common.Hardware.SIRT;
|
||||
using Common.Hardware.SIRT.Parameters;
|
||||
using Common.Hardware.WaterMeter.eRegister;
|
||||
using Common.Hardware.WaterMeter.eRegister.Features;
|
||||
using Newtonsoft.Json;
|
||||
using Common.Hardware.WaterMeter.eRegister.Models;
|
||||
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using static Xylem.Common.Service.MeterProcessState.Controllers.OldPasswordController;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
|
||||
public class Program
|
||||
public static class Program
|
||||
{
|
||||
public class FeatureDictionary : SortedDictionary<string, PropertyInfo>
|
||||
{
|
||||
public PropertyInfo FeatureInfo { get; set; }
|
||||
}
|
||||
|
||||
public static void Main()
|
||||
{
|
||||
var features = new SortedDictionary<bool, SortedDictionary<string, SortedDictionary<string, FeatureDictionary>>>();
|
||||
|
||||
ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) =>
|
||||
void ParseType(Type type)
|
||||
{
|
||||
return true;
|
||||
};
|
||||
// $"https://nodes.sms-esaap.com:8081/api/v3/custom/keysetkeys?orderNumber=3229547&radioAdress=241630563"
|
||||
using (var request = new HttpRequestMessage(HttpMethod.Put, $"https://nodes.sms-esaap.com:8081/api/v3/custom/keysetkeys?orderNumber=3229547&radioAdress=241630563"))
|
||||
{
|
||||
request.Headers.Add("Cache-Control", "no-cache");
|
||||
request.Headers.Add("X-Node-Token", "d5b8c0b2-81f6-4421-80d0-44eb2093e616");
|
||||
|
||||
using (var response = new HttpClient().SendAsync(request).Result)
|
||||
foreach (var property in type.GetProperties(BindingFlags.Public | BindingFlags.Instance))
|
||||
{
|
||||
var content = response.Content.ReadAsStringAsync().Result;
|
||||
var x = MeterPw.FromJson(content);
|
||||
var propertyType = property.PropertyType;
|
||||
|
||||
if (!typeof(Pam).IsAssignableFrom(propertyType))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var pamAttribute = property.GetCustomAttribute<PamAttribute>();
|
||||
|
||||
if (pamAttribute is null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var isSingleCmd = pamAttribute.IsSingleCmd;
|
||||
|
||||
if (!features.ContainsKey(isSingleCmd))
|
||||
{
|
||||
features[isSingleCmd] = new SortedDictionary<string, SortedDictionary<string, FeatureDictionary>>();
|
||||
}
|
||||
|
||||
var _features = features[isSingleCmd];
|
||||
var authBytes = pamAttribute.AuthLevel.AuthBytes();
|
||||
var authLevel = $"{authBytes.LastOrDefault():X2}";
|
||||
|
||||
if (authBytes.Length > 0)
|
||||
{
|
||||
authLevel = $"{authBytes[1]:X2}";
|
||||
}
|
||||
|
||||
if (!_features.ContainsKey(authLevel))
|
||||
{
|
||||
_features[authLevel] = new SortedDictionary<string, FeatureDictionary>();
|
||||
}
|
||||
|
||||
var __features = _features[authLevel];
|
||||
var pam = Activator.CreateInstance(property.PropertyType) as Pam;
|
||||
var cmdHex = pam.CmdHex;
|
||||
|
||||
if (cmdHex.Length == 2)
|
||||
{
|
||||
cmdHex = $"00-{cmdHex}";
|
||||
}
|
||||
|
||||
if (!__features.ContainsKey(cmdHex))
|
||||
{
|
||||
__features[cmdHex] = new FeatureDictionary();
|
||||
}
|
||||
|
||||
var ___features = __features[cmdHex];
|
||||
___features.FeatureInfo = property;
|
||||
|
||||
foreach (var _property in propertyType.GetProperties(BindingFlags.Public | BindingFlags.Instance))
|
||||
{
|
||||
if (_property.CanWrite && _property.PropertyType != typeof(byte[]))
|
||||
{
|
||||
___features[_property.Name] = _property;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//var client = new SIRTClient("COM6");
|
||||
ParseType(typeof(EregisterFeatures));
|
||||
ParseType(typeof(EregisterDebugFeatures));
|
||||
|
||||
//client.OpenConnection();
|
||||
//Console.ReadKey();
|
||||
//client.CloseConnection();
|
||||
}
|
||||
}
|
||||
var types = new HashSet<string>();
|
||||
|
||||
public class SIRTClient
|
||||
{
|
||||
private readonly ConcurrentDictionary<uint, EregisterTask> tasks;
|
||||
private readonly SIRTBroadcaster broadcaster;
|
||||
|
||||
public SIRTClient(string comPort)
|
||||
{
|
||||
this.tasks = new ConcurrentDictionary<uint, EregisterTask>();
|
||||
this.broadcaster = new SIRTBroadcaster(comPort);
|
||||
this.broadcaster.Activated += this.Broadcaster_Activated;
|
||||
this.broadcaster.Connected += this.Broadcaster_Connected;
|
||||
this.broadcaster.Disconnected += this.Broadcaster_Disconnected;
|
||||
this.broadcaster.Logging += this.Broadcaster_Logging;
|
||||
this.broadcaster.MessageReceived += this.Broadcaster_MessageReceived;
|
||||
}
|
||||
|
||||
internal void CloseConnection() => this.broadcaster.Close();
|
||||
|
||||
internal void OpenConnection() => this.broadcaster.Open();
|
||||
|
||||
private void Broadcaster_Activated()
|
||||
{
|
||||
Console.WriteLine(nameof(Broadcaster_Activated));
|
||||
|
||||
this.tasks.GetOrAdd(4291796386, _ =>
|
||||
foreach (var kvp in features)
|
||||
{
|
||||
var task = new EregisterTask(868)
|
||||
Console.WriteLine(kvp.Key ? "Single PAM:" : "Combined PAM:");
|
||||
|
||||
foreach (var _kvp in kvp.Value)
|
||||
{
|
||||
Cmd = SIRTMessage.W_PAM,
|
||||
P1 = new P811
|
||||
Console.WriteLine($" Auth level {_kvp.Key}:");
|
||||
|
||||
foreach (var __kvp in _kvp.Value)
|
||||
{
|
||||
DelPamSemi = true,
|
||||
},
|
||||
Data = new ChangeRadioId
|
||||
{
|
||||
Address = 309030150
|
||||
Console.WriteLine($" {__kvp.Key} {__kvp.Value.FeatureInfo.Name}");
|
||||
|
||||
}.Append(new ProvidePin
|
||||
{
|
||||
AuthLevel = AuthLevel.III
|
||||
}),
|
||||
RequestAddress = 4291796386,
|
||||
ResponseAddress = 309030150
|
||||
};
|
||||
foreach (var ___kvp in __kvp.Value)
|
||||
{
|
||||
Console.WriteLine($"\t\t{___kvp.Key} - {___kvp.Value.PropertyType.Name}");
|
||||
|
||||
task.Completed += this.Task_Completed;
|
||||
types.Add(___kvp.Value.PropertyType.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.broadcaster.EnqueueTask(task);
|
||||
Console.WriteLine();
|
||||
|
||||
return task;
|
||||
});
|
||||
}
|
||||
var _types = types.ToList();
|
||||
_types.Sort();
|
||||
|
||||
private void Broadcaster_Connected() => Console.WriteLine(nameof(Broadcaster_Connected));
|
||||
|
||||
private void Broadcaster_Disconnected() => Console.WriteLine(nameof(Broadcaster_Disconnected));
|
||||
|
||||
private void Broadcaster_Logging(string message)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void Broadcaster_MessageReceived(SIRTMessage message)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void Task_Completed(SIRTTask task)
|
||||
{
|
||||
task.Completed -= this.Task_Completed;
|
||||
|
||||
Console.WriteLine($"Task_Completed: {task}");
|
||||
File.WriteAllText($"..\\..\\Tasks\\{task.RequestAddress}.json", JsonConvert.SerializeObject(task, new JsonSerializerSettings
|
||||
foreach (var type in _types)
|
||||
{
|
||||
Formatting = Formatting.Indented
|
||||
}));
|
||||
Console.WriteLine(type);
|
||||
}
|
||||
|
||||
Console.WriteLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//AuthLevel
|
||||
//Boolean
|
||||
//Byte
|
||||
//DecimalPointLocations
|
||||
//FactoryState
|
||||
//Int32
|
||||
//MBusModes
|
||||
//MessurementUnits
|
||||
//MeterTypes
|
||||
//Options
|
||||
//OTAMode
|
||||
//RegisterMode
|
||||
//ResetMode
|
||||
//String
|
||||
//Types
|
||||
//UInt16
|
||||
//UInt32
|
||||
//WakeUpMode
|
||||
@ -1,32 +1,54 @@
|
||||
namespace Common.Hardware.Ports
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
public static class SerialDataExtensions
|
||||
{
|
||||
private const int ByteSize = 8;
|
||||
private const int SByteSize = 16;
|
||||
private const int Int16Size = 16;
|
||||
private const int UInt16Size = 16;
|
||||
private const int Int32Size = 32;
|
||||
private const int UInt32Size = 32;
|
||||
private const int Int64Size = 64;
|
||||
private const int UInt64Size = 64;
|
||||
|
||||
public static byte[] GetBitsBE(this byte value)
|
||||
{
|
||||
var bytes = new byte[8];
|
||||
var bits = new byte[ByteSize];
|
||||
|
||||
for (int i = 7, x = 0; i >= 0; i--, x++)
|
||||
{
|
||||
bytes[x] = (byte)((value >> i) % 2);
|
||||
bits[x] = (byte)((value >> i) & 1);
|
||||
}
|
||||
|
||||
return bytes;
|
||||
return bits;
|
||||
}
|
||||
|
||||
public static byte[] GetBitsLE(this byte value)
|
||||
{
|
||||
var bytes = new byte[8];
|
||||
var bits = new byte[ByteSize];
|
||||
|
||||
for (var i = 0; i < 8; i++)
|
||||
for (var i = 0; i < ByteSize; i++)
|
||||
{
|
||||
bytes[i] = (byte)((value >> i) % 2);
|
||||
bits[i] = (byte)((value >> i) & 1);
|
||||
}
|
||||
|
||||
return bytes;
|
||||
return bits;
|
||||
}
|
||||
|
||||
public static byte[] GetBitsLE(this ushort value)
|
||||
{
|
||||
var bits = new byte[UInt16Size];
|
||||
|
||||
for (var i = 0; i < UInt16Size; i++)
|
||||
{
|
||||
bits[i] = (byte)((value >> i) & 1);
|
||||
}
|
||||
|
||||
return bits;
|
||||
}
|
||||
|
||||
public static byte GetByteLE(this byte[] bits)
|
||||
@ -38,7 +60,7 @@
|
||||
|
||||
var value = default(byte);
|
||||
|
||||
for (var i = 0; i < 8; i++)
|
||||
for (var i = 0; i < ByteSize; i++)
|
||||
{
|
||||
value ^= (byte)(bits[i] << i);
|
||||
}
|
||||
@ -417,6 +439,27 @@
|
||||
return value;
|
||||
}
|
||||
|
||||
public static ushort ToUIint16LEFromBits(this byte[] bits)
|
||||
{
|
||||
const int size = 16;
|
||||
|
||||
if (bits is null)
|
||||
{
|
||||
bits = new byte[size];
|
||||
}
|
||||
|
||||
Array.Resize(ref bits, size);
|
||||
|
||||
ushort value = 0;
|
||||
|
||||
for (var i = 0; i < size; i++)
|
||||
{
|
||||
value ^= (ushort)(bits[i] << i);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
public static uint ToUInt32LE(this byte[] bytes, int start = 0)
|
||||
{
|
||||
var value = default(uint);
|
||||
|
||||
@ -161,23 +161,15 @@
|
||||
this.processingTask = Task.Factory.StartNew(() =>
|
||||
{
|
||||
var manualResetEventSlim = new ManualResetEventSlim();
|
||||
var addresses = default(ICollection<uint>);
|
||||
|
||||
while (!this.cancellationToken.IsCancellationRequested)
|
||||
{
|
||||
// addresses = this.GetAddressesInPamPool();
|
||||
|
||||
foreach (var tasksQueue in this.tasks.Values.ToArray())
|
||||
{
|
||||
if (tasksQueue.TryPeek(out var task) && task.State == SIRTTaskState.Pending)
|
||||
{
|
||||
// if (addresses.Count < 5 && !addresses.Any(x => x == task.RequestAddress) && !addresses.Any(x => x == task.ResponseAddress))
|
||||
{
|
||||
this.serialPort.Write(task.Start());
|
||||
this.Logging?.Invoke(task.ToString());
|
||||
|
||||
// addresses.Add(task.RequestAddress);
|
||||
}
|
||||
this.serialPort.Write(task.Start());
|
||||
this.Logging?.Invoke(task.ToString());
|
||||
}
|
||||
|
||||
manualResetEventSlim.Wait(100);
|
||||
|
||||
@ -100,14 +100,10 @@
|
||||
private EregisterProgrammingParameters GetProgrammingParameters()
|
||||
{
|
||||
var alarms = new AlarmsMask(this.SEMI.AlarmActiveInformation);
|
||||
var dataLogContent = new ChangeDataLoggerSettings
|
||||
{
|
||||
LogContent = this.SEMI.LogContent
|
||||
};
|
||||
var fdrLogContent = new ChangeDataLoggerSettings
|
||||
{
|
||||
LogContent = this.SEMI.FixedDateReadingContent
|
||||
};
|
||||
var dataLogContent = new ChangeDataLoggerSettings();
|
||||
dataLogContent.SetLogContent(this.SEMI.LogContent);
|
||||
var fdrLogContent = new ChangeDataLoggerSettings();
|
||||
fdrLogContent.SetLogContent(this.SEMI.FixedDateReadingContent);
|
||||
|
||||
var parameters = new EregisterProgrammingParameters
|
||||
{
|
||||
|
||||
@ -207,7 +207,7 @@
|
||||
|
||||
if (authLevel != AuthLevel.O)
|
||||
{
|
||||
var _bytes = ((long)authLevel).GetBytesLE();
|
||||
var _bytes = ((ulong)authLevel).GetBytesLE();
|
||||
|
||||
Array.Resize(ref bytes, 6);
|
||||
Array.Copy(_bytes, 0, bytes, 0, 6);
|
||||
|
||||
@ -4,96 +4,106 @@
|
||||
|
||||
public class ChangeDataLoggerSettings : Pam
|
||||
{
|
||||
private readonly byte[] contentBits = new byte[16];
|
||||
|
||||
public ChangeDataLoggerSettings() : base(5, ChangeDataLoggerSettings)
|
||||
{
|
||||
}
|
||||
|
||||
public ushort TimeInterval { get; set; }
|
||||
|
||||
public ushort LogContent { get; set; }
|
||||
|
||||
public byte ForwardCounter
|
||||
public ushort LogContent => this.contentBits.ToUIint16LEFromBits();
|
||||
|
||||
public bool ForwardCounter
|
||||
{
|
||||
get => (byte)(this.LogContent >> 12 & 1);
|
||||
set => this.LogContent ^= (ushort)(value << 12);
|
||||
get => this.contentBits[12] == 1;
|
||||
set => this.contentBits[12] = (byte)(value ? 1 : 0);
|
||||
}
|
||||
|
||||
public byte TimeOfMinimumFlow
|
||||
public bool TimeOfMinimumFlow
|
||||
{
|
||||
get => (byte)(this.LogContent >> 11 & 1);
|
||||
set => this.LogContent ^= (ushort)(value << 11);
|
||||
get => this.contentBits[11] == 1;
|
||||
set => this.contentBits[11] = (byte)(value ? 1 : 0);
|
||||
}
|
||||
|
||||
public byte MinimumFlow
|
||||
public bool MinimumFlow
|
||||
{
|
||||
get => (byte)(this.LogContent >> 10 & 1);
|
||||
set => this.LogContent ^= (ushort)(value << 10);
|
||||
get => this.contentBits[10] == 1;
|
||||
set => this.contentBits[10] = (byte)(value ? 1 : 0);
|
||||
}
|
||||
|
||||
public byte TimeOfBrokenPipe
|
||||
public bool TimeOfBrokenPipe
|
||||
{
|
||||
get => (byte)(this.LogContent >> 9 & 1);
|
||||
set => this.LogContent ^= (ushort)(value << 9);
|
||||
get => this.contentBits[9] == 1;
|
||||
set => this.contentBits[9] = (byte)(value ? 1 : 0);
|
||||
}
|
||||
|
||||
public byte BrokenPipeFlow
|
||||
public bool BrokenPipeFlow
|
||||
{
|
||||
get => (byte)(this.LogContent >> 8 & 1);
|
||||
set => this.LogContent ^= (ushort)(value << 8);
|
||||
get => this.contentBits[8] == 1;
|
||||
set => this.contentBits[8] = (byte)(value ? 1 : 0);
|
||||
}
|
||||
|
||||
public byte CurrentFlow
|
||||
public bool CurrentFlow
|
||||
{
|
||||
get => (byte)(this.LogContent >> 7 & 1);
|
||||
set => this.LogContent ^= (ushort)(value << 7);
|
||||
get => this.contentBits[7] == 1;
|
||||
set => this.contentBits[7] = (byte)(value ? 1 : 0);
|
||||
}
|
||||
|
||||
public byte TimeOfPeakFlow
|
||||
public bool TimeOfPeakFlow
|
||||
{
|
||||
get => (byte)(this.LogContent >> 6 & 1);
|
||||
set => this.LogContent ^= (ushort)(value << 6);
|
||||
get => this.contentBits[6] == 1;
|
||||
set => this.contentBits[6] = (byte)(value ? 1 : 0);
|
||||
}
|
||||
|
||||
public byte PeakFlow
|
||||
public bool PeakFlow
|
||||
{
|
||||
get => (byte)(this.LogContent >> 5 & 1);
|
||||
set => this.LogContent ^= (ushort)(value << 5);
|
||||
get => this.contentBits[5] == 1;
|
||||
set => this.contentBits[5] = (byte)(value ? 1 : 0);
|
||||
}
|
||||
|
||||
public byte TimeOfMaximumFlow
|
||||
public bool TimeOfMaximumFlow
|
||||
{
|
||||
get => (byte)(this.LogContent >> 4 & 1);
|
||||
set => this.LogContent ^= (ushort)(value << 4);
|
||||
get => this.contentBits[4] == 1;
|
||||
set => this.contentBits[4] = (byte)(value ? 1 : 0);
|
||||
}
|
||||
|
||||
public byte MaximumFlow
|
||||
public bool MaximumFlow
|
||||
{
|
||||
get => (byte)(this.LogContent >> 3 & 1);
|
||||
set => this.LogContent ^= (ushort)(value << 3);
|
||||
get => this.contentBits[3] == 1;
|
||||
set => this.contentBits[3] = (byte)(value ? 1 : 0);
|
||||
}
|
||||
|
||||
public byte BackwardVolume
|
||||
public bool BackwardVolume
|
||||
{
|
||||
get => (byte)(this.LogContent >> 2 & 1);
|
||||
set => this.LogContent ^= (ushort)(value << 2);
|
||||
get => this.contentBits[2] == 1;
|
||||
set => this.contentBits[2] = (byte)(value ? 1 : 0);
|
||||
}
|
||||
|
||||
public byte Counter
|
||||
public bool Counter
|
||||
{
|
||||
get => (byte)(this.LogContent >> 1 & 1);
|
||||
set => this.LogContent ^= (ushort)(value << 1);
|
||||
get => this.contentBits[1] == 1;
|
||||
set => this.contentBits[1] = (byte)(value ? 1 : 0);
|
||||
}
|
||||
|
||||
public byte AlarmState
|
||||
public bool AlarmState
|
||||
{
|
||||
get => (byte)(this.LogContent >> 0 & 1);
|
||||
set => this.LogContent ^= (ushort)(value << 0);
|
||||
get => this.contentBits[0] == 1;
|
||||
set => this.contentBits[0] = (byte)(value ? 1 : 0);
|
||||
}
|
||||
|
||||
public void SetLogContent(ushort value)
|
||||
=> value.GetBitsLE()
|
||||
.CopyTo(this.contentBits, 0);
|
||||
|
||||
public override byte[] ToByteArray()
|
||||
{
|
||||
this.TimeInterval.GetBytesBE().CopyTo(this.bytes, 1);
|
||||
this.LogContent.GetBytesBE().CopyTo(this.bytes, 3);
|
||||
this.TimeInterval
|
||||
.GetBytesBE()
|
||||
.CopyTo(this.bytes, 1);
|
||||
this.LogContent
|
||||
.GetBytesBE()
|
||||
.CopyTo(this.bytes, 3);
|
||||
|
||||
return base.ToByteArray();
|
||||
}
|
||||
|
||||
@ -4,6 +4,8 @@
|
||||
|
||||
public class ChangeFixedDateReadingSettings : Pam
|
||||
{
|
||||
private readonly byte[] contentBits = new byte[16];
|
||||
|
||||
public ChangeFixedDateReadingSettings() : base(4, ChangeFixedDateReadingSettings)
|
||||
{
|
||||
}
|
||||
@ -14,88 +16,97 @@
|
||||
set => this.bytes[1] = value;
|
||||
}
|
||||
|
||||
public ushort LogContent
|
||||
public ushort LogContent => this.contentBits.ToUIint16LEFromBits();
|
||||
|
||||
public bool ForwardCounter
|
||||
{
|
||||
get => this.bytes.ToUInt16BE(2);
|
||||
set => value.GetBytesBE().CopyTo(this.bytes, 2);
|
||||
get => this.contentBits[12] == 1;
|
||||
set => this.contentBits[12] = (byte)(value ? 1 : 0);
|
||||
}
|
||||
|
||||
public byte ForwardCounter
|
||||
public bool TimeOfMinimumFlow
|
||||
{
|
||||
get => (byte)(this.LogContent >> 12 & 1);
|
||||
set => this.LogContent ^= (ushort)(value << 12);
|
||||
get => this.contentBits[11] == 1;
|
||||
set => this.contentBits[11] = (byte)(value ? 1 : 0);
|
||||
}
|
||||
|
||||
public byte TimeOfMinimumFlow
|
||||
public bool MinimumFlow
|
||||
{
|
||||
get => (byte)(this.LogContent >> 11 & 1);
|
||||
set => this.LogContent ^= (ushort)(value << 11);
|
||||
get => this.contentBits[10] == 1;
|
||||
set => this.contentBits[10] = (byte)(value ? 1 : 0);
|
||||
}
|
||||
|
||||
public byte MinimumFlow
|
||||
public bool TimeOfBrokenPipe
|
||||
{
|
||||
get => (byte)(this.LogContent >> 10 & 1);
|
||||
set => this.LogContent ^= (ushort)(value << 10);
|
||||
get => this.contentBits[9] == 1;
|
||||
set => this.contentBits[9] = (byte)(value ? 1 : 0);
|
||||
}
|
||||
|
||||
public byte TimeOfBrokenPipe
|
||||
public bool BrokenPipeFlow
|
||||
{
|
||||
get => (byte)(this.LogContent >> 9 & 1);
|
||||
set => this.LogContent ^= (ushort)(value << 9);
|
||||
get => this.contentBits[8] == 1;
|
||||
set => this.contentBits[8] = (byte)(value ? 1 : 0);
|
||||
}
|
||||
|
||||
public byte BrokenPipeFlow
|
||||
public bool CurrentFlow
|
||||
{
|
||||
get => (byte)(this.LogContent >> 8 & 1);
|
||||
set => this.LogContent ^= (ushort)(value << 8);
|
||||
get => this.contentBits[7] == 1;
|
||||
set => this.contentBits[7] = (byte)(value ? 1 : 0);
|
||||
}
|
||||
|
||||
public byte CurrentFlow
|
||||
public bool TimeOfPeakFlow
|
||||
{
|
||||
get => (byte)(this.LogContent >> 7 & 1);
|
||||
set => this.LogContent ^= (ushort)(value << 7);
|
||||
get => this.contentBits[6] == 1;
|
||||
set => this.contentBits[6] = (byte)(value ? 1 : 0);
|
||||
}
|
||||
|
||||
public byte TimeOfPeakFlow
|
||||
public bool PeakFlow
|
||||
{
|
||||
get => (byte)(this.LogContent >> 6 & 1);
|
||||
set => this.LogContent ^= (ushort)(value << 6);
|
||||
get => this.contentBits[5] == 1;
|
||||
set => this.contentBits[5] = (byte)(value ? 1 : 0);
|
||||
}
|
||||
|
||||
public byte PeakFlow
|
||||
public bool TimeOfMaximumFlow
|
||||
{
|
||||
get => (byte)(this.LogContent >> 5 & 1);
|
||||
set => this.LogContent ^= (ushort)(value << 5);
|
||||
get => this.contentBits[4] == 1;
|
||||
set => this.contentBits[4] = (byte)(value ? 1 : 0);
|
||||
}
|
||||
|
||||
public byte TimeOfMaximumFlow
|
||||
public bool MaximumFlow
|
||||
{
|
||||
get => (byte)(this.LogContent >> 4 & 1);
|
||||
set => this.LogContent ^= (ushort)(value << 4);
|
||||
get => this.contentBits[3] == 1;
|
||||
set => this.contentBits[3] = (byte)(value ? 1 : 0);
|
||||
}
|
||||
|
||||
public byte MaximumFlow
|
||||
public bool BackwardVolume
|
||||
{
|
||||
get => (byte)(this.LogContent >> 3 & 1);
|
||||
set => this.LogContent ^= (ushort)(value << 3);
|
||||
get => this.contentBits[2] == 1;
|
||||
set => this.contentBits[2] = (byte)(value ? 1 : 0);
|
||||
}
|
||||
|
||||
public byte BackwardVolume
|
||||
public bool Counter
|
||||
{
|
||||
get => (byte)(this.LogContent >> 2 & 1);
|
||||
set => this.LogContent ^= (ushort)(value << 2);
|
||||
get => this.contentBits[1] == 1;
|
||||
set => this.contentBits[1] = (byte)(value ? 1 : 0);
|
||||
}
|
||||
|
||||
public byte Counter
|
||||
public bool AlarmState
|
||||
{
|
||||
get => (byte)(this.LogContent >> 1 & 1);
|
||||
set => this.LogContent ^= (ushort)(value << 1);
|
||||
get => this.contentBits[0] == 1;
|
||||
set => this.contentBits[0] = (byte)(value ? 1 : 0);
|
||||
}
|
||||
|
||||
public byte AlarmState
|
||||
public void SetLogContent(ushort value)
|
||||
=> value.GetBitsLE()
|
||||
.CopyTo(this.contentBits, 0);
|
||||
|
||||
public override byte[] ToByteArray()
|
||||
{
|
||||
get => (byte)(this.LogContent >> 0 & 1);
|
||||
set => this.LogContent ^= (ushort)(value << 0);
|
||||
this.LogContent
|
||||
.GetBytesBE()
|
||||
.CopyTo(this.bytes, 3);
|
||||
|
||||
return base.ToByteArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -34,7 +34,9 @@
|
||||
|
||||
public string HexKey
|
||||
{
|
||||
get => BitConverter.ToString(this.Key).Replace("-", string.Empty);
|
||||
get => BitConverter
|
||||
.ToString(this.Key)
|
||||
.Replace("-", string.Empty);
|
||||
set => this.Key = value.GetEncryptionKey();
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,6 +5,8 @@
|
||||
protected DebugCmd(byte code) : base(3, GetDebug)
|
||||
=> this.bytes[2] = code;
|
||||
|
||||
public override string CmdHex => $"{base.CmdHex}-{this.bytes[2]:X2}";
|
||||
|
||||
public static implicit operator byte[](DebugCmd cmd) => cmd.bytes;
|
||||
|
||||
/// <summary>
|
||||
|
||||
@ -12,6 +12,8 @@
|
||||
this.bytes[0] = cmd;
|
||||
}
|
||||
|
||||
public virtual string CmdHex => $"{this.bytes[0]:X2}";
|
||||
|
||||
public Pam Append(Pam pam)
|
||||
{
|
||||
var appendBytes = pam.ToByteArray();
|
||||
|
||||
@ -123,85 +123,85 @@
|
||||
public ushort Data_Logging_Period { get; set; }
|
||||
|
||||
[CompareProperty]
|
||||
public byte Data_Logging_Forward_Counter { get; set; }
|
||||
public bool Data_Logging_Forward_Counter { get; set; }
|
||||
|
||||
[CompareProperty]
|
||||
public byte Data_Logging_Time_Of_Minimum_Flow { get; set; }
|
||||
public bool Data_Logging_Time_Of_Minimum_Flow { get; set; }
|
||||
|
||||
[CompareProperty]
|
||||
public byte Data_Logging_Minimum_Flow { get; set; }
|
||||
public bool Data_Logging_Minimum_Flow { get; set; }
|
||||
|
||||
[CompareProperty]
|
||||
public byte Data_Logging_Time_Of_Broken_Pipe { get; set; }
|
||||
public bool Data_Logging_Time_Of_Broken_Pipe { get; set; }
|
||||
|
||||
[CompareProperty]
|
||||
public byte Data_Logging_Broken_Pipe_Flow { get; set; }
|
||||
public bool Data_Logging_Broken_Pipe_Flow { get; set; }
|
||||
|
||||
[CompareProperty]
|
||||
public byte Data_Logging_Current_Flow { get; set; }
|
||||
public bool Data_Logging_Current_Flow { get; set; }
|
||||
|
||||
[CompareProperty]
|
||||
public byte Data_Logging_Time_Of_Peak_Flow { get; set; }
|
||||
public bool Data_Logging_Time_Of_Peak_Flow { get; set; }
|
||||
|
||||
[CompareProperty]
|
||||
public byte Data_Logging_Peak_Flow { get; set; }
|
||||
public bool Data_Logging_Peak_Flow { get; set; }
|
||||
|
||||
[CompareProperty]
|
||||
public byte Data_Logging_Time_Of_Maximum_Flow { get; set; }
|
||||
public bool Data_Logging_Time_Of_Maximum_Flow { get; set; }
|
||||
|
||||
[CompareProperty]
|
||||
public byte Data_Logging_Maximum_Flow { get; set; }
|
||||
public bool Data_Logging_Maximum_Flow { get; set; }
|
||||
|
||||
[CompareProperty]
|
||||
public byte Data_Logging_Backward_Volume { get; set; }
|
||||
public bool Data_Logging_Backward_Volume { get; set; }
|
||||
|
||||
[CompareProperty]
|
||||
public byte Data_Logging_Counter { get; set; }
|
||||
public bool Data_Logging_Counter { get; set; }
|
||||
|
||||
[CompareProperty]
|
||||
public byte Data_Logging_Alarm_State { get; set; }
|
||||
public bool Data_Logging_Alarm_State { get; set; }
|
||||
|
||||
[CompareProperty]
|
||||
public byte FDR_Day_Of_Data_Reading { get; set; }
|
||||
|
||||
[CompareProperty]
|
||||
public byte FDR_Forward_Counter { get; set; }
|
||||
public bool FDR_Forward_Counter { get; set; }
|
||||
|
||||
[CompareProperty]
|
||||
public byte FDR_Time_Of_Minimum_Flow { get; set; }
|
||||
public bool FDR_Time_Of_Minimum_Flow { get; set; }
|
||||
|
||||
[CompareProperty]
|
||||
public byte FDR_Minimum_Flow { get; set; }
|
||||
public bool FDR_Minimum_Flow { get; set; }
|
||||
|
||||
[CompareProperty]
|
||||
public byte FDR_Time_Of_Broken_Pipe { get; set; }
|
||||
public bool FDR_Time_Of_Broken_Pipe { get; set; }
|
||||
|
||||
[CompareProperty]
|
||||
public byte FDR_Broken_Pipe_Flow { get; set; }
|
||||
public bool FDR_Broken_Pipe_Flow { get; set; }
|
||||
|
||||
[CompareProperty]
|
||||
public byte FDR_Current_Flow { get; set; }
|
||||
public bool FDR_Current_Flow { get; set; }
|
||||
|
||||
[CompareProperty]
|
||||
public byte FDR_Time_Of_Peak_Flow { get; set; }
|
||||
public bool FDR_Time_Of_Peak_Flow { get; set; }
|
||||
|
||||
[CompareProperty]
|
||||
public byte FDR_Peak_Flow { get; set; }
|
||||
public bool FDR_Peak_Flow { get; set; }
|
||||
|
||||
[CompareProperty]
|
||||
public byte FDR_Time_Of_Maximum_Flow { get; set; }
|
||||
public bool FDR_Time_Of_Maximum_Flow { get; set; }
|
||||
|
||||
[CompareProperty]
|
||||
public byte FDR_Maximum_Flow { get; set; }
|
||||
public bool FDR_Maximum_Flow { get; set; }
|
||||
|
||||
[CompareProperty]
|
||||
public byte FDR_Backward_Volume { get; set; }
|
||||
public bool FDR_Backward_Volume { get; set; }
|
||||
|
||||
[CompareProperty]
|
||||
public byte FDR_Counter { get; set; }
|
||||
public bool FDR_Counter { get; set; }
|
||||
|
||||
[CompareProperty]
|
||||
public byte FDR_Alarm_State { get; set; }
|
||||
public bool FDR_Alarm_State { get; set; }
|
||||
|
||||
public byte PowerLevelHex { get; set; }
|
||||
|
||||
|
||||
14
Common/Ui/Common.GUI/App.config
Normal file
14
Common/Ui/Common.GUI/App.config
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8.1" />
|
||||
</startup>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.2.1.0" newVersion="4.2.1.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
9
Common/Ui/Common.GUI/App.xaml
Normal file
9
Common/Ui/Common.GUI/App.xaml
Normal file
@ -0,0 +1,9 @@
|
||||
<Application x:Class="Common.GUI.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:VM="clr-namespace:Common.GUI.ViewModels"
|
||||
Startup="Application_Startup">
|
||||
<Application.Resources>
|
||||
<VM:VMLocator x:Key="VMLocator" />
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
34
Common/Ui/Common.GUI/App.xaml.cs
Normal file
34
Common/Ui/Common.GUI/App.xaml.cs
Normal file
@ -0,0 +1,34 @@
|
||||
namespace Common.GUI
|
||||
{
|
||||
using Common.GUI.Models.Base;
|
||||
|
||||
using System;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows;
|
||||
|
||||
public partial class App : Application
|
||||
{
|
||||
private void Application_Startup(object sender, StartupEventArgs args)
|
||||
{
|
||||
if (!User32DllImports.ShowRunningInstance())
|
||||
{
|
||||
var mainWindow = new MainWindow();
|
||||
this.MainWindow = mainWindow;
|
||||
this.MainWindow.Show();
|
||||
this.NavigateToPage(args, mainWindow);
|
||||
}
|
||||
}
|
||||
|
||||
private void NavigateToPage(StartupEventArgs args, MainWindow mainWindow)
|
||||
{
|
||||
var argsLine = string.Join(" ", args.Args ?? Array.Empty<string>());
|
||||
var pageMatch = Regex.Match(argsLine, "--page\\s*(?<page>[a-zA-Z0-9]+)");
|
||||
|
||||
if (pageMatch.Success)
|
||||
{
|
||||
var page = $"Pages/{pageMatch.Groups["page"].Value}.xaml";
|
||||
mainWindow.Source = new Uri(page, UriKind.Relative);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
186
Common/Ui/Common.GUI/Common.GUI.csproj
Normal file
186
Common/Ui/Common.GUI/Common.GUI.csproj
Normal file
@ -0,0 +1,186 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{25A3BC33-563A-41EC-A1CB-4C5F520DDD53}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<RootNamespace>Common.GUI</RootNamespace>
|
||||
<AssemblyName>Common.GUI</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<NoWarn>IDE0003;IDE0049;</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=9.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Microsoft.Bcl.AsyncInterfaces.9.0.1\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Extensions.DependencyInjection, Version=9.0.0.1, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Microsoft.Extensions.DependencyInjection.9.0.1\lib\net462\Microsoft.Extensions.DependencyInjection.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions, Version=9.0.0.1, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.9.0.1\lib\net462\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\System.Runtime.CompilerServices.Unsafe.6.1.0\lib\net462\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\System.Threading.Tasks.Extensions.4.6.0\lib\net462\System.Threading.Tasks.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xaml">
|
||||
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="App.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Compile Include="Controls\Eregister\EregisterFeaturesItemsControl.xaml.cs">
|
||||
<DependentUpon>EregisterFeaturesItemsControl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Pages\Eregister\ManualProgrammingPage.xaml.cs">
|
||||
<DependentUpon>ManualProgrammingPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ViewModels\Base\MessageHandler.cs" />
|
||||
<Compile Include="Models\Base\User32DllImports.cs" />
|
||||
<Compile Include="Models\Base\WindowCommands.cs" />
|
||||
<Compile Include="Pages\TestPage.xaml.cs">
|
||||
<DependentUpon>TestPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ViewModels\Eregister\EregisterFeatureItemVM.cs" />
|
||||
<Compile Include="ViewModels\Eregister\EregisterManualProgrammingVM.cs" />
|
||||
<Compile Include="ViewModels\VMLocator.cs" />
|
||||
<Page Include="Controls\Eregister\EregisterFeaturesItemsControl.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Controls\MainLayout.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Controls\MainMenu.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Pages\Eregister\ManualProgrammingPage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Pages\MainPage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="MainWindow.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Compile Include="App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ViewModels\Base\Command.cs" />
|
||||
<Compile Include="ViewModels\Base\Command[T].cs" />
|
||||
<Compile Include="ViewModels\Controls\MessageVM.cs" />
|
||||
<Compile Include="ViewModels\Controls\MainLayoutVM.cs" />
|
||||
<Compile Include="ViewModels\Controls\MainMenuVM.cs" />
|
||||
<Compile Include="ViewModels\Pages\MainPageVM.cs" />
|
||||
<Compile Include="ViewModels\Base\VM.cs" />
|
||||
<Compile Include="ViewModels\Base\VM[T].cs" />
|
||||
<Compile Include="Controls\MainLayout.xaml.cs">
|
||||
<DependentUpon>MainLayout.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Controls\MainMenu.xaml.cs">
|
||||
<DependentUpon>MainMenu.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Pages\MainPage.xaml.cs">
|
||||
<DependentUpon>MainPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="MainWindow.xaml.cs">
|
||||
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Page Include="Pages\TestPage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<None Include="packages.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Models\Data\" />
|
||||
<Folder Include="Models\Http\" />
|
||||
<Folder Include="Models\Pages\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Hardware\WaterMeter\eRegister\Common.Hardware.WaterMeter.eRegister\Common.Hardware.WaterMeter.eRegister.csproj">
|
||||
<Project>{4E8BB839-D40A-488C-88CE-F21811F1F476}</Project>
|
||||
<Name>Common.Hardware.WaterMeter.eRegister</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>del /Q /S *.xml *.pdb</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@ -0,0 +1,38 @@
|
||||
<ItemsControl x:Class="Common.GUI.Controls.Eregister.EregisterFeaturesItemsControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:VM="clr-namespace:Common.GUI.ViewModels.Eregister"
|
||||
xmlns:Local="clr-namespace:Common.GUI.Controls.Eregister">
|
||||
<ItemsControl.Resources>
|
||||
<DataTemplate DataType="{x:Type VM:EregisterFeatureParameterItemVM}">
|
||||
<Grid DataContext="{Binding .}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="16" />
|
||||
<ColumnDefinition Width="5" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Path Grid.Column="0" Grid.Row="0" />
|
||||
<TextBlock Grid.Column="2" Grid.Row="0" Text="{Binding Header}" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type VM:EregisterFeatureItemVM}">
|
||||
<Grid DataContext="{Binding .}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="16" />
|
||||
<ColumnDefinition Width="5" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Path Grid.Column="0" Grid.Row="0" />
|
||||
<RadioButton Grid.Column="2" Grid.Row="0" Content="{Binding Header}" />
|
||||
<Local:EregisterFeaturesItemsControl Grid.Column="1"
|
||||
Grid.ColumnSpan="2"
|
||||
Grid.Row="1"
|
||||
ItemsSource="{Binding ItemsSource}" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ItemsControl.Resources>
|
||||
</ItemsControl>
|
||||
@ -0,0 +1,9 @@
|
||||
namespace Common.GUI.Controls.Eregister
|
||||
{
|
||||
using System.Windows.Controls;
|
||||
|
||||
public partial class EregisterFeaturesItemsControl : ItemsControl
|
||||
{
|
||||
public EregisterFeaturesItemsControl() => this.InitializeComponent();
|
||||
}
|
||||
}
|
||||
38
Common/Ui/Common.GUI/Controls/MainLayout.xaml
Normal file
38
Common/Ui/Common.GUI/Controls/MainLayout.xaml
Normal file
@ -0,0 +1,38 @@
|
||||
<Grid x:Class="Common.GUI.Controls.MainLayout"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:Controls="clr-namespace:Common.GUI.Controls"
|
||||
DataContext="{Binding MainLayoutVM, Source={StaticResource VMLocator}}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Controls:MainMenu Grid.Row="0" />
|
||||
<ItemsControl Grid.Row="1"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Top">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
<!--<Border Background="Red"
|
||||
CornerRadius="4"
|
||||
Grid.Row="1"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="10"
|
||||
VerticalAlignment="Bottom">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="5" RenderingBias="Quality" ShadowDepth="1" Color="Red" />
|
||||
</Border.Effect>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Label Content="Title" Foreground="WhiteSmoke" Grid.Row="0" />
|
||||
<Label Content="Message" Foreground="WhiteSmoke" Grid.Row="1" />
|
||||
</Grid>
|
||||
</Border>-->
|
||||
</Grid>
|
||||
44
Common/Ui/Common.GUI/Controls/MainLayout.xaml.cs
Normal file
44
Common/Ui/Common.GUI/Controls/MainLayout.xaml.cs
Normal file
@ -0,0 +1,44 @@
|
||||
namespace Common.GUI.Controls
|
||||
{
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Markup;
|
||||
|
||||
[ContentProperty(nameof(Content))]
|
||||
public partial class MainLayout : Grid
|
||||
{
|
||||
public static readonly DependencyProperty ContentProperty = DependencyProperty.Register(
|
||||
name: nameof(Content)
|
||||
, propertyType: typeof(Grid)
|
||||
, ownerType: typeof(MainLayout)
|
||||
, typeMetadata: new PropertyMetadata(default(Grid), ContentChanged));
|
||||
|
||||
public MainLayout() => this.InitializeComponent();
|
||||
|
||||
public Grid Content
|
||||
{
|
||||
get => this.GetValue(ContentProperty) as Grid;
|
||||
set => this.SetValue(ContentProperty, value);
|
||||
}
|
||||
|
||||
private static void ContentChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs args)
|
||||
{
|
||||
if (dependencyObject is MainLayout mainLayout)
|
||||
{
|
||||
var children = mainLayout.Children;
|
||||
|
||||
if (args.OldValue is UIElement oldContent)
|
||||
{
|
||||
children.Remove(oldContent);
|
||||
}
|
||||
|
||||
if (args.NewValue is UIElement newContent)
|
||||
{
|
||||
children.Insert(1, newContent);
|
||||
|
||||
Grid.SetRow(newContent, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
10
Common/Ui/Common.GUI/Controls/MainMenu.xaml
Normal file
10
Common/Ui/Common.GUI/Controls/MainMenu.xaml
Normal file
@ -0,0 +1,10 @@
|
||||
<Menu x:Class="Common.GUI.Controls.MainMenu"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
DataContext="{Binding MainMenuVM, Source={StaticResource VMLocator}}">
|
||||
<MenuItem Header="Main" Command="{Binding NavigateCommand}" CommandParameter="Pages/MainPage.xaml"/>
|
||||
<MenuItem Header="Test" Command="{Binding NavigateCommand}" CommandParameter="Pages/TestPage.xaml"/>
|
||||
<MenuItem Header="e-register">
|
||||
<MenuItem Header="Manual programming" Command="{Binding NavigateCommand}" CommandParameter="Pages/Eregister/ManualProgrammingPage.xaml" />
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
9
Common/Ui/Common.GUI/Controls/MainMenu.xaml.cs
Normal file
9
Common/Ui/Common.GUI/Controls/MainMenu.xaml.cs
Normal file
@ -0,0 +1,9 @@
|
||||
namespace Common.GUI.Controls
|
||||
{
|
||||
using System.Windows.Controls;
|
||||
|
||||
public partial class MainMenu : Menu
|
||||
{
|
||||
public MainMenu() => this.InitializeComponent();
|
||||
}
|
||||
}
|
||||
6
Common/Ui/Common.GUI/MainWindow.xaml
Normal file
6
Common/Ui/Common.GUI/MainWindow.xaml
Normal file
@ -0,0 +1,6 @@
|
||||
<NavigationWindow x:Class="Common.GUI.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
ShowsNavigationUI="False"
|
||||
Source="Pages/MainPage.xaml">
|
||||
</NavigationWindow>
|
||||
9
Common/Ui/Common.GUI/MainWindow.xaml.cs
Normal file
9
Common/Ui/Common.GUI/MainWindow.xaml.cs
Normal file
@ -0,0 +1,9 @@
|
||||
namespace Common.GUI
|
||||
{
|
||||
using System.Windows.Navigation;
|
||||
|
||||
public partial class MainWindow : NavigationWindow
|
||||
{
|
||||
public MainWindow() => this.InitializeComponent();
|
||||
}
|
||||
}
|
||||
52
Common/Ui/Common.GUI/Models/Base/User32DllImports.cs
Normal file
52
Common/Ui/Common.GUI/Models/Base/User32DllImports.cs
Normal file
@ -0,0 +1,52 @@
|
||||
namespace Common.GUI.Models.Base
|
||||
{
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
internal class User32DllImports
|
||||
{
|
||||
[DllImport("User32.dll", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
internal static extern bool IsIconic([In] IntPtr windowHandle);
|
||||
|
||||
[DllImport("User32.dll", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
internal static extern bool SetForegroundWindow([In] IntPtr windowHandle);
|
||||
|
||||
[DllImport("User32.dll", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
internal static extern bool ShowWindow([In] IntPtr windowHandle, [In] WindowCommands command);
|
||||
|
||||
public static bool ShowRunningInstance()
|
||||
{
|
||||
var currentProcess = Process.GetCurrentProcess();
|
||||
var runningInstanceShown = false;
|
||||
|
||||
foreach (var process in Process.GetProcessesByName(currentProcess.ProcessName))
|
||||
{
|
||||
if (process.Id != currentProcess.Id && process.MainModule.FileName == currentProcess.MainModule.FileName)
|
||||
{
|
||||
var windowHandle = process.MainWindowHandle;
|
||||
|
||||
if (windowHandle != IntPtr.Zero)
|
||||
{
|
||||
if (IsIconic(windowHandle))
|
||||
{
|
||||
ShowWindow(windowHandle, WindowCommands.Restore);
|
||||
}
|
||||
|
||||
SetForegroundWindow(windowHandle);
|
||||
App.Current.Shutdown();
|
||||
|
||||
runningInstanceShown = true;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return runningInstanceShown;
|
||||
}
|
||||
}
|
||||
}
|
||||
17
Common/Ui/Common.GUI/Models/Base/WindowCommands.cs
Normal file
17
Common/Ui/Common.GUI/Models/Base/WindowCommands.cs
Normal file
@ -0,0 +1,17 @@
|
||||
namespace Common.GUI.Models.Base
|
||||
{
|
||||
internal enum WindowCommands : int
|
||||
{
|
||||
Hide = 0x0,
|
||||
ShowNormal = 0x1,
|
||||
ShowMinimized = 0x2,
|
||||
ShowMaximized = 0x3,
|
||||
ShowNormalNotActive = 0x4,
|
||||
Minimize = 0x6,
|
||||
ShowMinimizedNotActive = 0x7,
|
||||
ShowCurrentNotActive = 0x8,
|
||||
Restore = 0x9,
|
||||
ShowDefault = 0xA,
|
||||
ForceMinimize = 0xB
|
||||
}
|
||||
}
|
||||
158
Common/Ui/Common.GUI/Pages/Eregister/ManualProgrammingPage.xaml
Normal file
158
Common/Ui/Common.GUI/Pages/Eregister/ManualProgrammingPage.xaml
Normal file
@ -0,0 +1,158 @@
|
||||
<Page x:Class="Common.GUI.Pages.Eregister.ManualProgrammingPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:Controls="clr-namespace:Common.GUI.Controls"
|
||||
xmlns:VM="clr-namespace:Common.GUI.ViewModels.Eregister">
|
||||
<Controls:MainLayout>
|
||||
<Grid DataContext="{Binding EregisterManualProgrammingVM, Source={StaticResource VMLocator}}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ScrollViewer Grid.Column="0">
|
||||
<ItemsControl ItemsSource="{Binding ItemsSource}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type VM:EregisterFeatureItemVM}" >
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock FontWeight="Bold"
|
||||
Grid.Row="0"
|
||||
Padding="10 3"
|
||||
Text="{Binding Header}" />
|
||||
<ItemsControl Grid.Row="1" ItemsSource="{Binding ItemsSource}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type VM:EregisterFeatureItemVM}" >
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0"
|
||||
Margin="20 0 0 0"
|
||||
Padding="10 3"
|
||||
Text="{Binding Header}" />
|
||||
<ItemsControl Grid.Row="1" ItemsSource="{Binding ItemsSource}" Margin="40 0 0 0">
|
||||
<ItemsControl.Resources>
|
||||
<DataTemplate DataType="{x:Type VM:EregisterFeatureBooleanValueVM}">
|
||||
<CheckBox Background="WhiteSmoke"
|
||||
Content="{Binding Header}"
|
||||
Foreground="DimGray"
|
||||
HorizontalAlignment="Stretch"
|
||||
IsChecked="{Binding Value}"
|
||||
Margin="0 0 10 2"/>
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type VM:EregisterFeatureByteValueVM}">
|
||||
<StackPanel Orientation="Horizontal"
|
||||
FlowDirection="LeftToRight"
|
||||
Margin="0 0 10 2">
|
||||
<TextBox Background="WhiteSmoke"
|
||||
BorderThickness="0 0 1 1"
|
||||
HorizontalAlignment="Right"
|
||||
Padding="10 3"
|
||||
Text="{Binding Value}"
|
||||
Width="150" />
|
||||
<TextBlock Foreground="DimGray"
|
||||
HorizontalAlignment="Stretch"
|
||||
Padding="10 3"
|
||||
Text="{Binding Header}" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type VM:EregisterFeatureInt32ValueVM}">
|
||||
<StackPanel Orientation="Horizontal"
|
||||
FlowDirection="LeftToRight"
|
||||
Margin="0 0 10 2">
|
||||
<TextBox Background="WhiteSmoke"
|
||||
BorderThickness="0 0 1 1"
|
||||
HorizontalAlignment="Right"
|
||||
Padding="10 3"
|
||||
Text="{Binding Value}"
|
||||
Width="150" />
|
||||
<TextBlock Foreground="DimGray"
|
||||
HorizontalAlignment="Stretch"
|
||||
Padding="10 3"
|
||||
Text="{Binding Header}" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type VM:EregisterFeatureUInt16ValueVM}">
|
||||
<StackPanel Orientation="Horizontal"
|
||||
FlowDirection="LeftToRight"
|
||||
Margin="0 0 10 2">
|
||||
<TextBox Background="WhiteSmoke"
|
||||
BorderThickness="0 0 1 1"
|
||||
HorizontalAlignment="Right"
|
||||
Padding="10 3"
|
||||
Text="{Binding Value}"
|
||||
Width="150" />
|
||||
<TextBlock Foreground="DimGray"
|
||||
HorizontalAlignment="Stretch"
|
||||
Padding="10 3"
|
||||
Text="{Binding Header}" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type VM:EregisterFeatureUInt32ValueVM}">
|
||||
<StackPanel Orientation="Horizontal"
|
||||
FlowDirection="LeftToRight"
|
||||
Margin="0 0 10 2">
|
||||
<TextBox Background="WhiteSmoke"
|
||||
BorderThickness="0 0 1 1"
|
||||
HorizontalAlignment="Right"
|
||||
Padding="10 3"
|
||||
Text="{Binding Value}"
|
||||
Width="150" />
|
||||
<TextBlock Foreground="DimGray"
|
||||
HorizontalAlignment="Stretch"
|
||||
Padding="10 3"
|
||||
Text="{Binding Header}" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type VM:EregisterFeatureOptionValueVM}">
|
||||
<StackPanel FlowDirection="LeftToRight"
|
||||
Orientation="Horizontal"
|
||||
Margin="0 0 10 2">
|
||||
<ComboBox Background="WhiteSmoke"
|
||||
BorderThickness="0"
|
||||
HorizontalAlignment="Right"
|
||||
ItemsSource="{Binding Options}"
|
||||
Padding="10 3"
|
||||
SelectedValue="{Binding Value}"
|
||||
SelectedValuePath="{Binding Content}"
|
||||
Width="150" />
|
||||
<TextBlock Foreground="DimGray"
|
||||
HorizontalAlignment="Stretch"
|
||||
Padding="10 3"
|
||||
Text="{Binding Header}" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type VM:EregisterFeatureStringValueVM}">
|
||||
<StackPanel FlowDirection="LeftToRight"
|
||||
Orientation="Horizontal"
|
||||
Margin="0 0 10 2">
|
||||
<TextBox Background="WhiteSmoke"
|
||||
BorderThickness="0 0 1 1"
|
||||
HorizontalAlignment="Right"
|
||||
Padding="10 3"
|
||||
Text="{Binding Value}"
|
||||
Width="150" />
|
||||
<TextBlock Foreground="DimGray"
|
||||
HorizontalAlignment="Stretch"
|
||||
Padding="10 3"
|
||||
Text="{Binding Header}" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ItemsControl.Resources>
|
||||
</ItemsControl>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</Controls:MainLayout>
|
||||
</Page>
|
||||
@ -0,0 +1,9 @@
|
||||
namespace Common.GUI.Pages.Eregister
|
||||
{
|
||||
using System.Windows.Controls;
|
||||
|
||||
public partial class ManualProgrammingPage : Page
|
||||
{
|
||||
public ManualProgrammingPage() => this.InitializeComponent();
|
||||
}
|
||||
}
|
||||
10
Common/Ui/Common.GUI/Pages/MainPage.xaml
Normal file
10
Common/Ui/Common.GUI/Pages/MainPage.xaml
Normal file
@ -0,0 +1,10 @@
|
||||
<Page x:Class="Common.GUI.MainPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:Controls="clr-namespace:Common.GUI.Controls">
|
||||
<Controls:MainLayout>
|
||||
<Grid DataContext="{Binding MainPageVM, Source={StaticResource VMLocator}}">
|
||||
<Label Content="Main page" />
|
||||
</Grid>
|
||||
</Controls:MainLayout>
|
||||
</Page>
|
||||
9
Common/Ui/Common.GUI/Pages/MainPage.xaml.cs
Normal file
9
Common/Ui/Common.GUI/Pages/MainPage.xaml.cs
Normal file
@ -0,0 +1,9 @@
|
||||
namespace Common.GUI
|
||||
{
|
||||
using System.Windows.Controls;
|
||||
|
||||
public partial class MainPage : Page
|
||||
{
|
||||
public MainPage() => this.InitializeComponent();
|
||||
}
|
||||
}
|
||||
10
Common/Ui/Common.GUI/Pages/TestPage.xaml
Normal file
10
Common/Ui/Common.GUI/Pages/TestPage.xaml
Normal file
@ -0,0 +1,10 @@
|
||||
<Page x:Class="Common.GUI.Pages.TestPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:Controls="clr-namespace:Common.GUI.Controls">
|
||||
<Controls:MainLayout>
|
||||
<Grid>
|
||||
<Label Content="Test page" />
|
||||
</Grid>
|
||||
</Controls:MainLayout>
|
||||
</Page>
|
||||
28
Common/Ui/Common.GUI/Pages/TestPage.xaml.cs
Normal file
28
Common/Ui/Common.GUI/Pages/TestPage.xaml.cs
Normal file
@ -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 Common.GUI.Pages
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for TestPage.xaml
|
||||
/// </summary>
|
||||
public partial class TestPage : Page
|
||||
{
|
||||
public TestPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -7,12 +7,12 @@ 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("Common.UI.VFM")]
|
||||
[assembly: AssemblyTitle("Common.GUI")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Common.UI.VFM")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2024")]
|
||||
[assembly: AssemblyProduct("Common.GUI")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2025")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
@ -8,10 +8,10 @@
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Common.UI.VFM.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
namespace Common.GUI.Properties
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
@ -19,43 +19,51 @@ namespace Common.UI.VFM.Properties {
|
||||
// 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.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
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() {
|
||||
internal Resources()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[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("Common.UI.VFM.Properties.Resources", typeof(Resources).Assembly);
|
||||
internal static global::System.Resources.ResourceManager ResourceManager
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((resourceMan == null))
|
||||
{
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Common.GUI.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
internal static global::System.Globalization.CultureInfo Culture
|
||||
{
|
||||
get
|
||||
{
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
set
|
||||
{
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
@ -8,17 +8,21 @@
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Common.UI.VFM.Properties {
|
||||
|
||||
|
||||
namespace Common.GUI.Properties
|
||||
{
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
[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 {
|
||||
|
||||
public static Settings Default
|
||||
{
|
||||
get
|
||||
{
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
25
Common/Ui/Common.GUI/ViewModels/Base/Command.cs
Normal file
25
Common/Ui/Common.GUI/ViewModels/Base/Command.cs
Normal file
@ -0,0 +1,25 @@
|
||||
namespace Common.GUI.ViewModels.Base
|
||||
{
|
||||
using System;
|
||||
using System.Windows.Input;
|
||||
|
||||
public class Command : ICommand
|
||||
{
|
||||
private readonly Action executable;
|
||||
|
||||
public Command(Action executable)
|
||||
=> this.executable = executable;
|
||||
|
||||
public event EventHandler CanExecuteChanged
|
||||
{
|
||||
add => CommandManager.RequerySuggested += value;
|
||||
remove => CommandManager.RequerySuggested -= value;
|
||||
}
|
||||
|
||||
public bool CanExecute(object _)
|
||||
=> this.executable != null;
|
||||
|
||||
public void Execute(object _)
|
||||
=> this.executable?.Invoke();
|
||||
}
|
||||
}
|
||||
25
Common/Ui/Common.GUI/ViewModels/Base/Command[T].cs
Normal file
25
Common/Ui/Common.GUI/ViewModels/Base/Command[T].cs
Normal file
@ -0,0 +1,25 @@
|
||||
namespace Common.GUI.ViewModels.Base
|
||||
{
|
||||
using System;
|
||||
using System.Windows.Input;
|
||||
|
||||
public class Command<T> : ICommand
|
||||
{
|
||||
private readonly Action<T> executable;
|
||||
|
||||
public Command(Action<T> executable)
|
||||
=> this.executable = executable;
|
||||
|
||||
public event EventHandler CanExecuteChanged
|
||||
{
|
||||
add => CommandManager.RequerySuggested += value;
|
||||
remove => CommandManager.RequerySuggested -= value;
|
||||
}
|
||||
|
||||
public bool CanExecute(object _)
|
||||
=> this.executable != null;
|
||||
|
||||
public void Execute(object o)
|
||||
=> this.executable?.Invoke(o is T t ? t : default(T));
|
||||
}
|
||||
}
|
||||
11
Common/Ui/Common.GUI/ViewModels/Base/MessageHandler.cs
Normal file
11
Common/Ui/Common.GUI/ViewModels/Base/MessageHandler.cs
Normal file
@ -0,0 +1,11 @@
|
||||
namespace Common.GUI.ViewModels.Base
|
||||
{
|
||||
using Common.GUI.ViewModels.Controls;
|
||||
|
||||
using System;
|
||||
|
||||
public class MessageHandler
|
||||
{
|
||||
public event Action<MessageVM> MessageReceived;
|
||||
}
|
||||
}
|
||||
31
Common/Ui/Common.GUI/ViewModels/Base/VM.cs
Normal file
31
Common/Ui/Common.GUI/ViewModels/Base/VM.cs
Normal file
@ -0,0 +1,31 @@
|
||||
namespace Common.GUI.ViewModels.Base
|
||||
{
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
public class VM : INotifyPropertyChanged, IDisposable
|
||||
{
|
||||
public VM()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
public virtual void Dispose()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected void NotifyPropertyChanged([CallerMemberName] string member = "")
|
||||
=> this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(member));
|
||||
|
||||
protected void SetValue(Action setterAction, [CallerMemberName] string member = "")
|
||||
{
|
||||
setterAction?.Invoke();
|
||||
|
||||
this.NotifyPropertyChanged(member);
|
||||
}
|
||||
}
|
||||
}
|
||||
18
Common/Ui/Common.GUI/ViewModels/Base/VM[T].cs
Normal file
18
Common/Ui/Common.GUI/ViewModels/Base/VM[T].cs
Normal file
@ -0,0 +1,18 @@
|
||||
namespace Common.GUI.ViewModels.Base
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
public class VM<T> : VM where T : VM<T>
|
||||
{
|
||||
protected void SetValue(Action<T> setterAction, [CallerMemberName] string member = "")
|
||||
{
|
||||
if (this is T t)
|
||||
{
|
||||
setterAction?.Invoke(t);
|
||||
|
||||
this.NotifyPropertyChanged(member);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
24
Common/Ui/Common.GUI/ViewModels/Controls/MainLayoutVM.cs
Normal file
24
Common/Ui/Common.GUI/ViewModels/Controls/MainLayoutVM.cs
Normal file
@ -0,0 +1,24 @@
|
||||
namespace Common.GUI.ViewModels.Controls
|
||||
{
|
||||
using Common.GUI.Models.Base;
|
||||
using Common.GUI.ViewModels.Base;
|
||||
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
public class MainLayoutVM : VM<MainLayoutVM>
|
||||
{
|
||||
private readonly MessageHandler messageHandler;
|
||||
|
||||
public MainLayoutVM(MessageHandler messageHandler)
|
||||
{
|
||||
this.messageHandler = messageHandler;
|
||||
this.messageHandler.MessageReceived += this.MessageReceived;
|
||||
this.Messages = new ObservableCollection<MessageVM>();
|
||||
}
|
||||
|
||||
public ObservableCollection<MessageVM> Messages { get; }
|
||||
|
||||
private void MessageReceived(MessageVM message)
|
||||
=> this.Messages.Add(message);
|
||||
}
|
||||
}
|
||||
24
Common/Ui/Common.GUI/ViewModels/Controls/MainMenuVM.cs
Normal file
24
Common/Ui/Common.GUI/ViewModels/Controls/MainMenuVM.cs
Normal file
@ -0,0 +1,24 @@
|
||||
namespace Common.GUI.ViewModels.Controls
|
||||
{
|
||||
using Common.GUI.ViewModels.Base;
|
||||
|
||||
using System;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Navigation;
|
||||
|
||||
public class MainMenuVM : VM<MainMenuVM>
|
||||
{
|
||||
public MainMenuVM()
|
||||
=> this.NavigateCommand = new Command<string>(this.NavigateCommandHandler);
|
||||
|
||||
public ICommand NavigateCommand { get; }
|
||||
|
||||
private void NavigateCommandHandler(string page)
|
||||
{
|
||||
if (App.Current.MainWindow is NavigationWindow navigationWindow)
|
||||
{
|
||||
navigationWindow.Navigate(new Uri(page, UriKind.Relative));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
17
Common/Ui/Common.GUI/ViewModels/Controls/MessageVM.cs
Normal file
17
Common/Ui/Common.GUI/ViewModels/Controls/MessageVM.cs
Normal file
@ -0,0 +1,17 @@
|
||||
namespace Common.GUI.ViewModels.Controls
|
||||
{
|
||||
using Common.GUI.ViewModels.Base;
|
||||
|
||||
public class MessageVM : VM<MessageVM>
|
||||
{
|
||||
public MessageVM(string title, string message)
|
||||
{
|
||||
this.Title = title;
|
||||
this.Message = message;
|
||||
}
|
||||
|
||||
public string Title { get; }
|
||||
|
||||
public string Message { get; }
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,86 @@
|
||||
namespace Common.GUI.ViewModels.Eregister
|
||||
{
|
||||
using Common.GUI.ViewModels.Base;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Reflection;
|
||||
|
||||
public class EregisterFeatureItemVM : VM<EregisterFeatureItemVM>
|
||||
{
|
||||
public string Header { get; set; }
|
||||
|
||||
public ObservableCollection<EregisterFeatureItemVM> ItemsSource { get; }
|
||||
= new ObservableCollection<EregisterFeatureItemVM>();
|
||||
}
|
||||
|
||||
public class EregisterFeatureParameterItemVM : EregisterFeatureItemVM
|
||||
{
|
||||
private readonly PropertyInfo propertyInfo;
|
||||
|
||||
public EregisterFeatureParameterItemVM(PropertyInfo propertyInfo, string header)
|
||||
{
|
||||
this.Header = header;
|
||||
this.propertyInfo = propertyInfo;
|
||||
}
|
||||
|
||||
private object value;
|
||||
public object Value
|
||||
{
|
||||
get => this.value;
|
||||
set => this.SetValue(() => this.value = value);
|
||||
}
|
||||
}
|
||||
|
||||
public class EregisterFeatureBooleanValueVM : EregisterFeatureParameterItemVM
|
||||
{
|
||||
public EregisterFeatureBooleanValueVM(PropertyInfo propertyInfo, string header) : base(propertyInfo, header)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class EregisterFeatureByteValueVM : EregisterFeatureParameterItemVM
|
||||
{
|
||||
public EregisterFeatureByteValueVM(PropertyInfo propertyInfo, string header) : base(propertyInfo, header)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class EregisterFeatureInt32ValueVM : EregisterFeatureParameterItemVM
|
||||
{
|
||||
public EregisterFeatureInt32ValueVM(PropertyInfo propertyInfo, string header) : base(propertyInfo, header)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class EregisterFeatureUInt16ValueVM : EregisterFeatureParameterItemVM
|
||||
{
|
||||
public EregisterFeatureUInt16ValueVM(PropertyInfo propertyInfo, string header) : base(propertyInfo, header)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class EregisterFeatureUInt32ValueVM : EregisterFeatureParameterItemVM
|
||||
{
|
||||
public EregisterFeatureUInt32ValueVM(PropertyInfo propertyInfo, string header) : base(propertyInfo, header)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class EregisterFeatureStringValueVM : EregisterFeatureParameterItemVM
|
||||
{
|
||||
public EregisterFeatureStringValueVM(PropertyInfo propertyInfo, string header) : base(propertyInfo, header)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class EregisterFeatureOptionValueVM : EregisterFeatureParameterItemVM
|
||||
{
|
||||
public EregisterFeatureOptionValueVM(PropertyInfo propertyInfo, string header)
|
||||
: base(propertyInfo, header)
|
||||
=> this.Options = Enum.GetNames(propertyInfo.PropertyType);
|
||||
|
||||
public ICollection<string> Options { get; set; }
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,155 @@
|
||||
namespace Common.GUI.ViewModels.Eregister
|
||||
{
|
||||
using Common.GUI.ViewModels.Base;
|
||||
using Common.Hardware.WaterMeter.eRegister.Features;
|
||||
using Common.Hardware.WaterMeter.eRegister.Models;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Reflection;
|
||||
|
||||
public class EregisterManualProgrammingVM : VM<EregisterManualProgrammingVM>
|
||||
{
|
||||
public EregisterManualProgrammingVM()
|
||||
{
|
||||
this.ItemsSource = new ObservableCollection<EregisterFeatureItemVM>();
|
||||
|
||||
this.InitializeEregisterManualProgrammingVM();
|
||||
}
|
||||
|
||||
public ObservableCollection<EregisterFeatureItemVM> ItemsSource { get; }
|
||||
|
||||
private void InitializeEregisterManualProgrammingVM()
|
||||
{
|
||||
var features = new SortedDictionary<bool, SortedDictionary<string, SortedDictionary<string, FeatureDictionary>>>();
|
||||
|
||||
void ParseType(Type type)
|
||||
{
|
||||
foreach (var property in type.GetProperties(BindingFlags.Public | BindingFlags.Instance))
|
||||
{
|
||||
var propertyType = property.PropertyType;
|
||||
|
||||
if (!typeof(Pam).IsAssignableFrom(propertyType))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var pamAttribute = property.GetCustomAttribute<PamAttribute>();
|
||||
|
||||
if (pamAttribute is null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var isSingleCmd = pamAttribute.IsSingleCmd;
|
||||
|
||||
if (!features.ContainsKey(isSingleCmd))
|
||||
{
|
||||
features[isSingleCmd] = new SortedDictionary<string, SortedDictionary<string, FeatureDictionary>>();
|
||||
}
|
||||
|
||||
var _features = features[isSingleCmd];
|
||||
var authLevel = $"{pamAttribute.AuthLevel}";
|
||||
|
||||
if (!_features.ContainsKey(authLevel))
|
||||
{
|
||||
_features[authLevel] = new SortedDictionary<string, FeatureDictionary>();
|
||||
}
|
||||
|
||||
var __features = _features[authLevel];
|
||||
var pam = Activator.CreateInstance(property.PropertyType) as Pam;
|
||||
var cmdHex = $"{property.Name}: {pam.CmdHex}";
|
||||
|
||||
if (!__features.ContainsKey(cmdHex))
|
||||
{
|
||||
__features[cmdHex] = new FeatureDictionary();
|
||||
}
|
||||
|
||||
var ___features = __features[cmdHex];
|
||||
___features.FeatureInfo = property;
|
||||
|
||||
foreach (var _property in propertyType.GetProperties(BindingFlags.Public | BindingFlags.Instance))
|
||||
{
|
||||
if (_property.CanWrite && _property.PropertyType != typeof(byte[]))
|
||||
{
|
||||
___features[_property.Name] = _property;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ParseType(typeof(EregisterFeatures));
|
||||
ParseType(typeof(EregisterDebugFeatures));
|
||||
|
||||
foreach (var kvp in features)
|
||||
{
|
||||
var type = kvp.Key ? "Single PAM" : "Multi PAM";
|
||||
|
||||
foreach (var _kvp in kvp.Value)
|
||||
{
|
||||
var _item = new EregisterFeatureItemVM
|
||||
{
|
||||
Header = $"{type} - Auth level {_kvp.Key}"
|
||||
};
|
||||
|
||||
foreach (var __kvp in _kvp.Value)
|
||||
{
|
||||
var __item = new EregisterFeatureItemVM
|
||||
{
|
||||
Header = $"{__kvp.Key}"
|
||||
};
|
||||
|
||||
foreach (var ___kvp in __kvp.Value)
|
||||
{
|
||||
var header = ___kvp.Key;
|
||||
var propertyInfo = ___kvp.Value;
|
||||
var propertyType = propertyInfo.PropertyType;
|
||||
var ___item = default(EregisterFeatureParameterItemVM);
|
||||
|
||||
if (propertyType == typeof(bool))
|
||||
{
|
||||
___item = new EregisterFeatureBooleanValueVM(propertyInfo, header);
|
||||
}
|
||||
else if (propertyType == typeof(byte))
|
||||
{
|
||||
___item = new EregisterFeatureByteValueVM(propertyInfo, header);
|
||||
}
|
||||
else if (propertyType == typeof(int))
|
||||
{
|
||||
___item = new EregisterFeatureInt32ValueVM(propertyInfo, header);
|
||||
}
|
||||
else if (propertyType == typeof(ushort))
|
||||
{
|
||||
___item = new EregisterFeatureUInt16ValueVM(propertyInfo, header);
|
||||
}
|
||||
else if (propertyType == typeof(uint))
|
||||
{
|
||||
___item = new EregisterFeatureUInt32ValueVM(propertyInfo, header);
|
||||
}
|
||||
else if (propertyType.IsEnum)
|
||||
{
|
||||
___item = new EregisterFeatureOptionValueVM(propertyInfo, header);
|
||||
}
|
||||
else
|
||||
{
|
||||
___item = new EregisterFeatureStringValueVM(propertyInfo, header);
|
||||
}
|
||||
|
||||
__item.ItemsSource.Add(___item);
|
||||
}
|
||||
|
||||
_item.ItemsSource.Add(__item);
|
||||
}
|
||||
|
||||
this.ItemsSource.Add(_item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class FeatureDictionary : SortedDictionary<string, PropertyInfo>
|
||||
{
|
||||
public PropertyInfo FeatureInfo { get; set; }
|
||||
}
|
||||
}
|
||||
9
Common/Ui/Common.GUI/ViewModels/Pages/MainPageVM.cs
Normal file
9
Common/Ui/Common.GUI/ViewModels/Pages/MainPageVM.cs
Normal file
@ -0,0 +1,9 @@
|
||||
namespace Common.GUI.ViewModels.Pages
|
||||
{
|
||||
using Common.GUI.ViewModels.Base;
|
||||
|
||||
public class MainPageVM : VM<MainPageVM>
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
42
Common/Ui/Common.GUI/ViewModels/VMLocator.cs
Normal file
42
Common/Ui/Common.GUI/ViewModels/VMLocator.cs
Normal file
@ -0,0 +1,42 @@
|
||||
namespace Common.GUI.ViewModels
|
||||
{
|
||||
using Common.GUI.ViewModels.Base;
|
||||
using Common.GUI.ViewModels.Controls;
|
||||
using Common.GUI.ViewModels.Eregister;
|
||||
using Common.GUI.ViewModels.Pages;
|
||||
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
using System.Windows;
|
||||
|
||||
public class VMLocator
|
||||
{
|
||||
private static readonly ServiceProvider serviceProvider = ConfigureServices();
|
||||
|
||||
public VMLocator() => App.Current.Exit += this.App_Exit;
|
||||
|
||||
public MainLayoutVM MainLayoutVM => serviceProvider.GetService<MainLayoutVM>();
|
||||
|
||||
public MainMenuVM MainMenuVM => serviceProvider.GetService<MainMenuVM>();
|
||||
|
||||
public MainPageVM MainPageVM => serviceProvider.GetService<MainPageVM>();
|
||||
|
||||
public EregisterManualProgrammingVM EregisterManualProgrammingVM => serviceProvider.GetService<EregisterManualProgrammingVM>();
|
||||
|
||||
private void App_Exit(object sender, ExitEventArgs args)
|
||||
{
|
||||
App.Current.Exit -= this.App_Exit;
|
||||
|
||||
serviceProvider.Dispose();
|
||||
}
|
||||
|
||||
private static ServiceProvider ConfigureServices()
|
||||
=> new ServiceCollection()
|
||||
.AddScoped<MessageHandler>()
|
||||
.AddTransient<MainLayoutVM>()
|
||||
.AddTransient<MainMenuVM>()
|
||||
.AddScoped<MainPageVM>()
|
||||
.AddScoped<EregisterManualProgrammingVM>()
|
||||
.BuildServiceProvider();
|
||||
}
|
||||
}
|
||||
8
Common/Ui/Common.GUI/packages.config
Normal file
8
Common/Ui/Common.GUI/packages.config
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.Bcl.AsyncInterfaces" version="9.0.1" targetFramework="net481" />
|
||||
<package id="Microsoft.Extensions.DependencyInjection" version="9.0.1" targetFramework="net481" />
|
||||
<package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="9.0.1" targetFramework="net481" />
|
||||
<package id="System.Runtime.CompilerServices.Unsafe" version="6.1.0" targetFramework="net481" />
|
||||
<package id="System.Threading.Tasks.Extensions" version="4.6.0" targetFramework="net481" />
|
||||
</packages>
|
||||
@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<appSettings>
|
||||
<add key="PortName" value="COM16"/>
|
||||
<add key="SqlConnectionString" value="Server=SLASQL01.emea.sensus.net; Database=Auftrag; User ID=sa; Password=sqlserver;"/>
|
||||
<!--<add key="LabelServer" value="http://localhost:57680"/>-->
|
||||
<add key="LabelServer" value="http://delaz1label"/>
|
||||
</appSettings>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6"/></startup></configuration>
|
||||
@ -1,194 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{9C1C5522-E986-4FD6-8F2F-19821D704A88}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<RootNamespace>Common.UI.VFM</RootNamespace>
|
||||
<AssemblyName>Common.UI.VFM</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Deterministic>true</Deterministic>
|
||||
<TargetFrameworkProfile />
|
||||
<IsWebBootstrapper>true</IsWebBootstrapper>
|
||||
<PublishUrl>\\SLA12IIS01\LaaProductionWeb\vfm\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Web</InstallFrom>
|
||||
<UpdateEnabled>true</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<InstallUrl>http://sla12iis01.emea.sensus.net/LaaProductionWeb/vfm/</InstallUrl>
|
||||
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
|
||||
<WebPage>publish.htm</WebPage>
|
||||
<ApplicationRevision>7</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<PublishWizardCompleted>true</PublishWizardCompleted>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<NoWarn>IDE0003;IDE0049;</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ManifestCertificateThumbprint>2AAD7D379BFB7F46CA9B0F35907CFDA28F27D632</ManifestCertificateThumbprint>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ManifestKeyFile>Common.UI.VFM_1_TemporaryKey.pfx</ManifestKeyFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<GenerateManifests>true</GenerateManifests>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SignManifests>false</SignManifests>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Xaml">
|
||||
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="Views\App.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Compile Include="Converters\BooleanInverterConverter.cs" />
|
||||
<Compile Include="Converters\BooleanToVisibilityConverter.cs" />
|
||||
<Compile Include="Converters\ProcessstateToColorConverter.cs" />
|
||||
<Compile Include="Converters\ProcessStateToImageConverter.cs" />
|
||||
<Compile Include="Converters\ProcessStateToImageSourceConverter.cs" />
|
||||
<Compile Include="Converters\StringToVisibilityConverter.cs" />
|
||||
<Compile Include="Models\OmniValuesModel.cs" />
|
||||
<Compile Include="Models\OmniShipmentModel.cs" />
|
||||
<Compile Include="Models\ProcessResult.cs" />
|
||||
<Compile Include="Models\ProcessState.cs" />
|
||||
<Compile Include="ViewModels\ProcessStepViewModel.cs" />
|
||||
<Compile Include="ViewModels\ShipmnetViewModel.cs" />
|
||||
<Compile Include="Views\ShipmentView.xaml.cs">
|
||||
<DependentUpon>ShipmentView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Page Include="Views\EmptyView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\MainWindow.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Compile Include="Views\App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ViewModels\AppViewModel.cs" />
|
||||
<Compile Include="Views\EmptyView.xaml.cs">
|
||||
<DependentUpon>EmptyView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ViewModels\EmptyViewModel.cs" />
|
||||
<Compile Include="Views\MainWindow.xaml.cs">
|
||||
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Page Include="Views\ShipmentView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ViewModels\MainWindowViewModel.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<None Include="App.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Hardware\Common.Hardware.Ports\Common.Hardware.Ports.csproj">
|
||||
<Project>{9AE071C0-DB12-4E09-A3C7-43F6DCD518D6}</Project>
|
||||
<Name>Common.Hardware.Ports</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Hardware\WaterMeter\OmniPlus\Common.Hardware.WaterMeter.OmniPlus.Features\Common.Hardware.WaterMeter.OmniPlus.Features.csproj">
|
||||
<Project>{9D89FA2A-1217-4CE9-B217-E7602B974EA9}</Project>
|
||||
<Name>Common.Hardware.WaterMeter.OmniPlus.Features</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Hardware\WaterMeter\OmniPlus\Common.Hardware.WaterMeter.OmniPlus\Common.Hardware.WaterMeter.OmniPlus.csproj">
|
||||
<Project>{6480CC2A-AB54-4A26-8413-D5141431C080}</Project>
|
||||
<Name>Common.Hardware.WaterMeter.OmniPlus</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Logic\Common.Logic.Extensions.Http\Common.Logic.Extensions.Http.csproj">
|
||||
<Project>{57ddae1e-fd6b-47e0-ad5e-8ccfad07f1d7}</Project>
|
||||
<Name>Common.Logic.Extensions.Http</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Logic\Common.Logic.Extensions.SQL\Common.Logic.Extensions.SQL.csproj">
|
||||
<Project>{62490923-CD17-45A6-B79F-A027927C75B5}</Project>
|
||||
<Name>Common.Logic.Extensions.SQL</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include=".NETFramework,Version=v4.6">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Microsoft .NET Framework 4.6 %28x86 and x64%29</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
@ -1,24 +0,0 @@
|
||||
namespace Common.UI.VFM.Converters
|
||||
{
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
public class BooleanInverterConverter : IValueConverter
|
||||
{
|
||||
public Object Convert(Object value, Type targetType, Object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is Boolean _value)
|
||||
{
|
||||
return !_value;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public Object ConvertBack(Object value, Type targetType, Object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,25 +0,0 @@
|
||||
namespace Common.UI.VFM.Converters
|
||||
{
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
public class BooleanToVisibilityConverter : IValueConverter
|
||||
{
|
||||
public Object Convert(Object value, Type targetType, Object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is Boolean visible && visible)
|
||||
{
|
||||
return Visibility.Visible;
|
||||
}
|
||||
|
||||
return Visibility.Collapsed;
|
||||
}
|
||||
|
||||
public Object ConvertBack(Object value, Type targetType, Object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,36 +0,0 @@
|
||||
namespace Common.UI.VFM.Converters
|
||||
{
|
||||
using Common.UI.VFM.Models;
|
||||
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
public class ProcessStateToImageConverter : IValueConverter
|
||||
{
|
||||
public Object Convert(Object value, Type targetType, Object parameter, CultureInfo culture)
|
||||
{
|
||||
var ressources = Application.Current.Resources;
|
||||
|
||||
if (value is ProcessState state)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case ProcessState.Undefined: return ressources["BiPlay"];
|
||||
case ProcessState.Started: return ressources["BiPause"];
|
||||
case ProcessState.Success: return ressources["BiCheck"];
|
||||
case ProcessState.Warning: return ressources["BiWarning"];
|
||||
case ProcessState.Error: return ressources["BiError"];
|
||||
}
|
||||
}
|
||||
|
||||
return ressources["PlayCircleDrawingImage"];
|
||||
}
|
||||
|
||||
public Object ConvertBack(Object value, Type targetType, Object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,36 +0,0 @@
|
||||
namespace Common.UI.VFM.Converters
|
||||
{
|
||||
using Common.UI.VFM.Models;
|
||||
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
public class ProcessStateToImageSourceConverter : IValueConverter
|
||||
{
|
||||
public Object Convert(Object value, Type targetType, Object parameter, CultureInfo culture)
|
||||
{
|
||||
var ressources = Application.Current.Resources;
|
||||
|
||||
if (value is ProcessState state)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case ProcessState.Undefined: return ressources["PlayCircleDrawingImage"];
|
||||
case ProcessState.Started: return ressources["PauseCircleDrawingImage"];
|
||||
case ProcessState.Success: return ressources["CheckCircleDrawingImage"];
|
||||
case ProcessState.Warning: return ressources["WarningCircleDrawingImage"];
|
||||
case ProcessState.Error: return ressources["ErrorCircleDrawingImage"];
|
||||
}
|
||||
}
|
||||
|
||||
return ressources["PlayCircleDrawingImage"];
|
||||
}
|
||||
|
||||
public Object ConvertBack(Object value, Type targetType, Object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,34 +0,0 @@
|
||||
namespace Common.UI.VFM.Converters
|
||||
{
|
||||
using Common.UI.VFM.Models;
|
||||
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Media;
|
||||
|
||||
public class ProcessstateToColorConverter : IValueConverter
|
||||
{
|
||||
public Object Convert(Object value, Type targetType, Object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is ProcessState state)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case ProcessState.Undefined: return Brushes.DimGray;
|
||||
case ProcessState.Started: return Brushes.DimGray;
|
||||
case ProcessState.Success: return Brushes.Green;
|
||||
case ProcessState.Warning: return Brushes.DimGray;
|
||||
case ProcessState.Error: return Brushes.Red;
|
||||
}
|
||||
}
|
||||
|
||||
return Brushes.DimGray;
|
||||
}
|
||||
|
||||
public Object ConvertBack(Object value, Type targetType, Object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,25 +0,0 @@
|
||||
namespace Common.UI.VFM.Converters
|
||||
{
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
public class StringToVisibilityConverter : IValueConverter
|
||||
{
|
||||
public Object Convert(Object value, Type targetType, Object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is String text && !String.IsNullOrWhiteSpace(text))
|
||||
{
|
||||
return Visibility.Visible;
|
||||
}
|
||||
|
||||
return Visibility.Collapsed;
|
||||
}
|
||||
|
||||
public Object ConvertBack(Object value, Type targetType, Object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,118 +0,0 @@
|
||||
namespace Common.UI.VFM.Models
|
||||
{
|
||||
using System;
|
||||
using Common.Hardware.WaterMeter.OmniPlus.Features;
|
||||
|
||||
public class OmniValuesModel
|
||||
{
|
||||
public Int32 Orderno { get; set; }
|
||||
|
||||
public Int16 Positionno { get; set; }
|
||||
|
||||
public Int32 ProductionOrderno { get; set; }
|
||||
|
||||
public Int32 OrderIdentno { get; set; }
|
||||
|
||||
public Int32 Count { get; set; }
|
||||
|
||||
public Int32 Boxno { get; set; }
|
||||
|
||||
public Int32 Serialno { get; set; }
|
||||
|
||||
public String DbCustId { get; set; }
|
||||
|
||||
public Int32 FactId { get; set; }
|
||||
|
||||
public String EheadPcb { get; set; }
|
||||
|
||||
public String MeterPcb { get; set; }
|
||||
|
||||
public Byte ProductionStatus { get; set; }
|
||||
|
||||
public String Partno { get; set; }
|
||||
|
||||
public String DescriptionL1 { get; set; }
|
||||
|
||||
public String DescriptionL2 { get; set; }
|
||||
|
||||
public String Variant { get; set; }
|
||||
|
||||
public String SQLErrors { get; set; }
|
||||
|
||||
public Double MaxGPM { get; set; }
|
||||
|
||||
public Double MaxACC { get; set; }
|
||||
|
||||
public Double MidGPM { get; set; }
|
||||
|
||||
public Double MidACC { get; set; }
|
||||
|
||||
public Double MinGPM { get; set; }
|
||||
|
||||
public Double MinACC { get; set; }
|
||||
|
||||
public DateTime TestDate { get; set; }
|
||||
|
||||
public Boolean Succeeded { get; set; }
|
||||
|
||||
public Single CalibrationFactor { get; set; }
|
||||
|
||||
public Int32 TestRunId { get; set; }
|
||||
|
||||
public Byte Size { get; set; }
|
||||
|
||||
public Byte Range { get; set; }
|
||||
|
||||
public Byte Direction { get; set; }
|
||||
|
||||
public Byte IntPart { get; set; }
|
||||
|
||||
public Int32 Fraction { get; set; }
|
||||
|
||||
public Int16 Crf { get; set; }
|
||||
|
||||
public Byte Ppr { get; set; }
|
||||
|
||||
public Byte MeterUnits { get; set; }
|
||||
|
||||
public Byte FlowUnits { get; set; }
|
||||
|
||||
public Byte FlowRate { get; set; }
|
||||
|
||||
public Byte PulseWeight { get; set; }
|
||||
|
||||
public Byte PulseWidth { get; set; }
|
||||
|
||||
public Byte PulseUpdate { get; set; }
|
||||
|
||||
public Byte AlarmPercistancePeriodDays { get; set; }
|
||||
|
||||
public Int32 DataLogIntervalMinutes { get; set; }
|
||||
|
||||
public Int16 NumberOfReadingDigits { get; set; }
|
||||
|
||||
public Int32 OptionalUniDirFields { get; set; }
|
||||
|
||||
public String ReadingPreset { get; set; }
|
||||
|
||||
public String DeviceID { get; set; }
|
||||
|
||||
public Single LeakAlarmGPM { get; set; }
|
||||
|
||||
public Int64 LeakAlarmHours { get; set; }
|
||||
|
||||
public Single HighFlowAlarmGPM { get; set; }
|
||||
|
||||
public Int64 HighFlowAlarmHours { get; set; }
|
||||
|
||||
public Single ReverseFlowAlarmGPM { get; set; }
|
||||
|
||||
public Int64 ReverseFlowAlarmMinutes { get; set; }
|
||||
|
||||
public UInt32 ManifacturingTime { get; set; }
|
||||
|
||||
public SystemParameters SystemParameters { get; set; }
|
||||
|
||||
public ConfigurationParameters ConfigurationParameters { get; set; }
|
||||
}
|
||||
}
|
||||
@ -1,11 +0,0 @@
|
||||
namespace Common.UI.VFM.Models
|
||||
{
|
||||
using System;
|
||||
|
||||
public class ProcessResult
|
||||
{
|
||||
public ProcessState State { get; set; }
|
||||
|
||||
public String Message { get; set; }
|
||||
}
|
||||
}
|
||||
@ -1,11 +0,0 @@
|
||||
namespace Common.UI.VFM.Models
|
||||
{
|
||||
public enum ProcessState
|
||||
{
|
||||
Undefined = -1,
|
||||
Started = 0,
|
||||
Success = 1,
|
||||
Warning = 2,
|
||||
Error = 3,
|
||||
}
|
||||
}
|
||||
@ -1,88 +0,0 @@
|
||||
namespace Common.UI.VFM.ViewModels
|
||||
{
|
||||
using Common.UI.VFM.Views;
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Configuration;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
|
||||
public class AppViewModel : INotifyPropertyChanged
|
||||
{
|
||||
protected AppViewModel() => App.Exiting += this.Dispose;
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
protected String PortName => ConfigurationManager.AppSettings[nameof(this.PortName)];
|
||||
|
||||
protected String SqlConnectionString => ConfigurationManager.AppSettings[nameof(this.SqlConnectionString)];
|
||||
|
||||
protected String LabelServer => ConfigurationManager.AppSettings[nameof(this.LabelServer)];
|
||||
|
||||
public virtual void Dispose() => App.Exiting -= this.Dispose;
|
||||
|
||||
protected void NotifyPropertyChanged([CallerMemberName] String property = "")
|
||||
=> this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(property));
|
||||
|
||||
protected void Set(Action setExpression, [CallerMemberName] String property = "")
|
||||
{
|
||||
setExpression?.Invoke();
|
||||
|
||||
this.NotifyPropertyChanged(property);
|
||||
}
|
||||
|
||||
protected class Command : ICommand
|
||||
{
|
||||
private readonly Action executable;
|
||||
|
||||
public Command(Action executable)
|
||||
{
|
||||
this.executable = executable;
|
||||
}
|
||||
|
||||
public event EventHandler CanExecuteChanged
|
||||
{
|
||||
add => CommandManager.RequerySuggested += value;
|
||||
remove => CommandManager.RequerySuggested -= value;
|
||||
}
|
||||
|
||||
public bool CanExecute(Object _)
|
||||
{
|
||||
return this.executable != null;
|
||||
}
|
||||
|
||||
public void Execute(Object _)
|
||||
{
|
||||
this.executable?.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
protected class Command<T> : ICommand
|
||||
{
|
||||
private readonly Action<T> executable;
|
||||
|
||||
public Command(Action<T> executable)
|
||||
{
|
||||
this.executable = executable;
|
||||
}
|
||||
|
||||
public event EventHandler CanExecuteChanged
|
||||
{
|
||||
add => CommandManager.RequerySuggested += value;
|
||||
remove => CommandManager.RequerySuggested -= value;
|
||||
}
|
||||
|
||||
public bool CanExecute(Object _)
|
||||
{
|
||||
return this.executable != null;
|
||||
}
|
||||
|
||||
public void Execute(Object parameter)
|
||||
{
|
||||
this.executable?.Invoke(parameter is T t ? t : default(T));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,6 +0,0 @@
|
||||
namespace Common.UI.VFM.ViewModels
|
||||
{
|
||||
public class EmptyViewModel : AppViewModel
|
||||
{
|
||||
}
|
||||
}
|
||||
@ -1,12 +0,0 @@
|
||||
namespace Common.UI.VFM.ViewModels
|
||||
{
|
||||
public class MainWindowViewModel : AppViewModel
|
||||
{
|
||||
private AppViewModel content;
|
||||
public AppViewModel Content
|
||||
{
|
||||
get => this.content ?? new ShipmnetViewModel();
|
||||
set => this.Set(() => this.content = value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,49 +0,0 @@
|
||||
namespace Common.UI.VFM.ViewModels
|
||||
{
|
||||
using Common.UI.VFM.Models;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows;
|
||||
|
||||
public class ProcessStepViewModel : AppViewModel
|
||||
{
|
||||
private readonly Func<ProcessResult> process;
|
||||
|
||||
public ProcessStepViewModel(String name, Func<ProcessResult> process)
|
||||
{
|
||||
this.Name = name;
|
||||
this.process = process;
|
||||
this.State = ProcessState.Undefined;
|
||||
}
|
||||
|
||||
public String Name { get; }
|
||||
|
||||
private ProcessState state;
|
||||
public ProcessState State
|
||||
{
|
||||
get => this.state;
|
||||
set => this.Set(() => this.state = value);
|
||||
}
|
||||
|
||||
private String message;
|
||||
public String Message
|
||||
{
|
||||
get => this.message;
|
||||
set => this.Set(() => this.message = value);
|
||||
}
|
||||
|
||||
internal ProcessResult StartProcessing()
|
||||
{
|
||||
this.State = ProcessState.Started;
|
||||
var result = this.process.Invoke();
|
||||
this.State = result.State;
|
||||
this.Message = result.Message;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static implicit operator ProcessStepViewModel(KeyValuePair<String, Func<ProcessResult>> kvp)
|
||||
=> new ProcessStepViewModel(kvp.Key, kvp.Value);
|
||||
}
|
||||
}
|
||||
@ -1,224 +0,0 @@
|
||||
namespace Common.UI.VFM.ViewModels
|
||||
{
|
||||
using Common.UI.VFM.Models;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
|
||||
public class ShipmnetViewModel : AppViewModel
|
||||
{
|
||||
private readonly OmniShipmentModel model;
|
||||
|
||||
public ShipmnetViewModel() : base()
|
||||
{
|
||||
this.resetted = true;
|
||||
this.model = new OmniShipmentModel(this.PortName, this.SqlConnectionString, this.LabelServer);
|
||||
this.ResetProcessState = new Command(this.ResetProcessStateHandler);
|
||||
this.StartProcessing = new Command(this.StartProcessingHandler);
|
||||
this.ReprintBoxLable = new Command(this.ReprintBoxLableHandler);
|
||||
this.ReprintTestLable = new Command(this.ReprintTestLableHandler);
|
||||
this.Processes = new ObservableCollection<ProcessStepViewModel>(this.LoadProcesses());
|
||||
}
|
||||
|
||||
public String CustId
|
||||
{
|
||||
get => this.model.CustId;
|
||||
set => this.Set(() =>
|
||||
{
|
||||
this.model.CustId = value?.Trim();
|
||||
this.ReprintEnabled = !this.Proccessing && this.model.WasPrinted();
|
||||
});
|
||||
}
|
||||
|
||||
public String MeterPcb
|
||||
{
|
||||
get => this.model.MeterPcb;
|
||||
set => this.Set(() =>
|
||||
{
|
||||
this.model.MeterPcb = value?.Trim();
|
||||
this.ReprintEnabled = !this.Proccessing && this.model.WasPrinted();
|
||||
});
|
||||
}
|
||||
|
||||
private Boolean reprintEnabled;
|
||||
public Boolean ReprintEnabled
|
||||
{
|
||||
get => this.reprintEnabled;
|
||||
set => this.Set(() => this.reprintEnabled = value);
|
||||
}
|
||||
|
||||
private String message;
|
||||
public String Message
|
||||
{
|
||||
get => this.message;
|
||||
set => this.Set(() => this.message = value);
|
||||
}
|
||||
|
||||
private Boolean resetted;
|
||||
private Boolean processing;
|
||||
public Boolean Proccessing
|
||||
{
|
||||
get => this.processing;
|
||||
set => this.Set(() => this.processing = value);
|
||||
}
|
||||
|
||||
public ICommand ResetProcessState { get; }
|
||||
|
||||
public ICommand StartProcessing { get; }
|
||||
|
||||
public ICommand ReprintBoxLable { get; }
|
||||
|
||||
public ICommand ReprintTestLable { get; }
|
||||
|
||||
public ObservableCollection<ProcessStepViewModel> Processes { get; }
|
||||
|
||||
private IEnumerable<ProcessStepViewModel> LoadProcesses()
|
||||
{
|
||||
foreach (var kvp in this.model.GetProcesses())
|
||||
{
|
||||
yield return kvp;
|
||||
}
|
||||
}
|
||||
|
||||
private void ReprintBoxLableHandler()
|
||||
{
|
||||
if (!this.Proccessing)
|
||||
{
|
||||
Task.Factory
|
||||
.StartNew(state =>
|
||||
{
|
||||
if (state is ShipmnetViewModel viewModel)
|
||||
{
|
||||
var model = viewModel.model;
|
||||
model.LoadProductionOrderData();
|
||||
model.LoadProductionTestData();
|
||||
model.LoadDefaultValues();
|
||||
// model.PrintBoxLabel();
|
||||
}
|
||||
|
||||
}, this, CancellationToken.None)
|
||||
.ContinueWith(task =>
|
||||
{
|
||||
if (task.AsyncState is ShipmnetViewModel viewModel)
|
||||
{
|
||||
if (task.Exception != null)
|
||||
{
|
||||
viewModel.Message = task.Exception.Message;
|
||||
}
|
||||
|
||||
viewModel.Proccessing = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void ReprintTestLableHandler()
|
||||
{
|
||||
if (!this.Proccessing)
|
||||
{
|
||||
Task.Factory
|
||||
.StartNew(state =>
|
||||
{
|
||||
if (state is ShipmnetViewModel viewModel)
|
||||
{
|
||||
var model = viewModel.model;
|
||||
model.LoadProductionOrderData();
|
||||
model.LoadProductionTestData();
|
||||
model.LoadDefaultValues();
|
||||
// model.PrintTestLabel();
|
||||
}
|
||||
|
||||
}, this, CancellationToken.None)
|
||||
.ContinueWith(task =>
|
||||
{
|
||||
if (task.AsyncState is ShipmnetViewModel viewModel)
|
||||
{
|
||||
if (task.Exception != null)
|
||||
{
|
||||
viewModel.Message = task.Exception.Message;
|
||||
}
|
||||
|
||||
viewModel.Proccessing = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void ResetProcessStateHandler()
|
||||
{
|
||||
if (!this.resetted)
|
||||
{
|
||||
this.resetted = true;
|
||||
this.CustId = default(String);
|
||||
this.MeterPcb = default(String);
|
||||
this.Message = default(String);
|
||||
|
||||
foreach (var process in this.Processes)
|
||||
{
|
||||
process.State = ProcessState.Undefined;
|
||||
process.Message = default(String);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void StartProcessingHandler()
|
||||
{
|
||||
if (!this.Proccessing && this.resetted)
|
||||
{
|
||||
Task.Factory
|
||||
.StartNew(state =>
|
||||
{
|
||||
if (state is ShipmnetViewModel viewModel)
|
||||
{
|
||||
viewModel.resetted = false;
|
||||
viewModel.Proccessing = true;
|
||||
viewModel.ReprintEnabled = false;
|
||||
viewModel.Message = "Programmierung lauft ... Bitte warten!";
|
||||
|
||||
viewModel.model.Initialize();
|
||||
|
||||
var proccessed = true;
|
||||
|
||||
foreach (var process in viewModel.Processes)
|
||||
{
|
||||
var result = process.StartProcessing();
|
||||
|
||||
if (result.State == ProcessState.Error)
|
||||
{
|
||||
viewModel.Message = "Programmierung wurde abgebrochen!";
|
||||
proccessed = false;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (proccessed)
|
||||
{
|
||||
viewModel.model.Finish();
|
||||
|
||||
viewModel.Message = "Programmierung erfolgreich abgeschlossen! Etiketten werden gedruckt.";
|
||||
}
|
||||
|
||||
viewModel.Proccessing = false;
|
||||
viewModel.ReprintEnabled = true;
|
||||
}
|
||||
|
||||
}, this, CancellationToken.None)
|
||||
.ContinueWith(task =>
|
||||
{
|
||||
if (task.AsyncState is ShipmnetViewModel viewModel)
|
||||
{
|
||||
if (task.Exception != null)
|
||||
{
|
||||
viewModel.Message = task.Exception.Message;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,165 +0,0 @@
|
||||
<Application x:Class="Common.UI.VFM.Views.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:C="clr-namespace:Common.UI.VFM.Converters"
|
||||
StartupUri="MainWindow.xaml">
|
||||
<Application.Resources>
|
||||
|
||||
<C:BooleanInverterConverter x:Key="BooleanInverter" />
|
||||
<C:BooleanToVisibilityConverter x:Key="BooleanToVisibility" />
|
||||
<C:ProcessstateToColorConverter x:Key="ProcessstateToColor" />
|
||||
<C:ProcessStateToImageConverter x:Key="ProcessStateToImage" />
|
||||
<C:ProcessStateToImageSourceConverter x:Key="ProcessStateToImageSource" />
|
||||
<C:StringToVisibilityConverter x:Key="StringToVisibility" />
|
||||
|
||||
<DrawingImage x:Key="PlayCircleDrawingImage">
|
||||
<DrawingImage.Drawing>
|
||||
<GeometryDrawing Brush="Gray" >
|
||||
<GeometryDrawing.Geometry>
|
||||
<GeometryGroup>
|
||||
<Geometry>M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14m0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16</Geometry>
|
||||
<Geometry>M6.271 5.055a.5.5 0 0 1 .52.038l3.5 2.5a.5.5 0 0 1 0 .814l-3.5 2.5A.5.5 0 0 1 6 10.5v-5a.5.5 0 0 1 .271-.445</Geometry>
|
||||
</GeometryGroup>
|
||||
</GeometryDrawing.Geometry>
|
||||
</GeometryDrawing>
|
||||
</DrawingImage.Drawing>
|
||||
</DrawingImage>
|
||||
|
||||
<DrawingImage x:Key="PauseCircleDrawingImage">
|
||||
<DrawingImage.Drawing>
|
||||
<GeometryDrawing Brush="Gray" >
|
||||
<GeometryDrawing.Geometry>
|
||||
<GeometryGroup>
|
||||
<Geometry>M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14m0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16</Geometry>
|
||||
<Geometry>M5 6.25a1.25 1.25 0 1 1 2.5 0v3.5a1.25 1.25 0 1 1-2.5 0zm3.5 0a1.25 1.25 0 1 1 2.5 0v3.5a1.25 1.25 0 1 1-2.5 0z</Geometry>
|
||||
</GeometryGroup>
|
||||
</GeometryDrawing.Geometry>
|
||||
</GeometryDrawing>
|
||||
</DrawingImage.Drawing>
|
||||
</DrawingImage>
|
||||
|
||||
<DrawingImage x:Key="CheckCircleDrawingImage">
|
||||
<DrawingImage.Drawing>
|
||||
<GeometryDrawing Brush="Green" >
|
||||
<GeometryDrawing.Geometry>
|
||||
<GeometryGroup>
|
||||
<Geometry>M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14m0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16</Geometry>
|
||||
<Geometry>m10.97 4.97-.02.022-3.473 4.425-2.093-2.094a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-1.071-1.05</Geometry>
|
||||
</GeometryGroup>
|
||||
</GeometryDrawing.Geometry>
|
||||
</GeometryDrawing>
|
||||
</DrawingImage.Drawing>
|
||||
</DrawingImage>
|
||||
|
||||
<DrawingImage x:Key="WarningCircleDrawingImage">
|
||||
<DrawingImage.Drawing>
|
||||
<GeometryDrawing Brush="Orange" >
|
||||
<GeometryDrawing.Geometry>
|
||||
<GeometryGroup>
|
||||
<Geometry>M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14m0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16</Geometry>
|
||||
<Geometry>M7.002 11a1 1 0 1 1 2 0 1 1 0 0 1-2 0M7.1 4.995a.905.905 0 1 1 1.8 0l-.35 3.507a.552.552 0 0 1-1.1 0z</Geometry>
|
||||
</GeometryGroup>
|
||||
</GeometryDrawing.Geometry>
|
||||
</GeometryDrawing>
|
||||
</DrawingImage.Drawing>
|
||||
</DrawingImage>
|
||||
|
||||
<DrawingImage x:Key="ErrorCircleDrawingImage">
|
||||
<DrawingImage.Drawing>
|
||||
<GeometryDrawing Brush="Red" >
|
||||
<GeometryDrawing.Geometry>
|
||||
<GeometryGroup>
|
||||
<Geometry>M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14m0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16</Geometry>
|
||||
<Geometry>M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708</Geometry>
|
||||
</GeometryGroup>
|
||||
</GeometryDrawing.Geometry>
|
||||
</GeometryDrawing>
|
||||
</DrawingImage.Drawing>
|
||||
</DrawingImage>
|
||||
|
||||
<DrawingImage x:Key="SpinnerDrawingImage">
|
||||
<DrawingImage.Drawing>
|
||||
<GeometryDrawing Brush="Gray" >
|
||||
<GeometryDrawing.Geometry>
|
||||
<GeometryGroup>
|
||||
<EllipseGeometry Center="8, 8" RadiusX="3.5" RadiusY="4" />
|
||||
<EllipseGeometry Center="8, 8" RadiusX="3.5" RadiusY="3.5" />
|
||||
</GeometryGroup>
|
||||
</GeometryDrawing.Geometry>
|
||||
</GeometryDrawing>
|
||||
</DrawingImage.Drawing>
|
||||
</DrawingImage>
|
||||
|
||||
<Style x:Key="BiPlay" TargetType="Image">
|
||||
<Setter Property="Height" Value="16" />
|
||||
<Setter Property="HorizontalAlignment" Value="Center" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="Width" Value="16" />
|
||||
<Setter Property="Stretch" Value="Uniform" />
|
||||
<Setter Property="Source" Value="{StaticResource PlayCircleDrawingImage}" />
|
||||
</Style>
|
||||
|
||||
<Style x:Key="BiPause" TargetType="Image">
|
||||
<Setter Property="Height" Value="16" />
|
||||
<Setter Property="HorizontalAlignment" Value="Center" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="Width" Value="16" />
|
||||
<Setter Property="Stretch" Value="Uniform" />
|
||||
<Setter Property="Source" Value="{StaticResource PauseCircleDrawingImage}" />
|
||||
</Style>
|
||||
|
||||
<Style x:Key="BiSpinner" TargetType="Image">
|
||||
<Setter Property="Height" Value="16" />
|
||||
<Setter Property="HorizontalAlignment" Value="Center" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="Width" Value="16" />
|
||||
<Setter Property="Stretch" Value="Fill" />
|
||||
<Setter Property="Source" Value="{StaticResource SpinnerDrawingImage}" />
|
||||
<Setter Property="RenderTransform">
|
||||
<Setter.Value>
|
||||
<RotateTransform CenterX="8" CenterY="8" />
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<EventTrigger RoutedEvent="Loaded">
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
<DoubleAnimation Storyboard.TargetProperty="(Image.RenderTransform).(RotateTransform.Angle)"
|
||||
To="360"
|
||||
Duration="0:0:1"
|
||||
RepeatBehavior="Forever" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</EventTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="BiCheck" TargetType="Image">
|
||||
<Setter Property="Height" Value="16" />
|
||||
<Setter Property="HorizontalAlignment" Value="Center" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="Width" Value="16" />
|
||||
<Setter Property="Stretch" Value="Uniform" />
|
||||
<Setter Property="Source" Value="{StaticResource CheckCircleDrawingImage}" />
|
||||
</Style>
|
||||
|
||||
<Style x:Key="BiWarning" TargetType="Image">
|
||||
<Setter Property="Height" Value="16" />
|
||||
<Setter Property="HorizontalAlignment" Value="Center" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="Width" Value="16" />
|
||||
<Setter Property="Stretch" Value="Uniform" />
|
||||
<Setter Property="Source" Value="{StaticResource WarningCircleDrawingImage}" />
|
||||
</Style>
|
||||
|
||||
<Style x:Key="BiError" TargetType="Image">
|
||||
<Setter Property="Height" Value="16" />
|
||||
<Setter Property="HorizontalAlignment" Value="Center" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="Width" Value="16" />
|
||||
<Setter Property="Stretch" Value="Uniform" />
|
||||
<Setter Property="Source" Value="{StaticResource ErrorCircleDrawingImage}" />
|
||||
</Style>
|
||||
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
@ -1,12 +0,0 @@
|
||||
namespace Common.UI.VFM.Views
|
||||
{
|
||||
using System;
|
||||
using System.Windows;
|
||||
|
||||
public partial class App : Application
|
||||
{
|
||||
internal static event Action Exiting;
|
||||
|
||||
protected override void OnExit(ExitEventArgs e) => Exiting?.Invoke();
|
||||
}
|
||||
}
|
||||
@ -1,8 +0,0 @@
|
||||
<Grid x:Class="Common.UI.VFM.Views.EmptyView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:VM="clr-namespace:Common.UI.VFM.ViewModels">
|
||||
<Grid.DataContext>
|
||||
<VM:EmptyViewModel />
|
||||
</Grid.DataContext>
|
||||
</Grid>
|
||||
@ -1,9 +0,0 @@
|
||||
namespace Common.UI.VFM.Views
|
||||
{
|
||||
using System.Windows.Controls;
|
||||
|
||||
public partial class EmptyView : Grid
|
||||
{
|
||||
public EmptyView() => this.InitializeComponent();
|
||||
}
|
||||
}
|
||||
@ -1,28 +0,0 @@
|
||||
<Window x:Class="Common.UI.VFM.Views.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:V="clr-namespace:Common.UI.VFM.Views"
|
||||
xmlns:VM="clr-namespace:Common.UI.VFM.ViewModels"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
WindowStyle="SingleBorderWindow"
|
||||
WindowState="Normal"
|
||||
Title="MainWindow"
|
||||
Height="800"
|
||||
Width="600"
|
||||
Background="WhiteSmoke">
|
||||
|
||||
<Window.DataContext>
|
||||
<VM:MainWindowViewModel />
|
||||
</Window.DataContext>
|
||||
|
||||
<ContentControl Content="{Binding Content}" >
|
||||
<ContentControl.Resources>
|
||||
<DataTemplate DataType="{x:Type VM:EmptyViewModel}">
|
||||
<V:EmptyView />
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type VM:ShipmnetViewModel}">
|
||||
<V:ShipmentView />
|
||||
</DataTemplate>
|
||||
</ContentControl.Resources>
|
||||
</ContentControl>
|
||||
</Window>
|
||||
@ -1,9 +0,0 @@
|
||||
namespace Common.UI.VFM.Views
|
||||
{
|
||||
using System.Windows;
|
||||
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
public MainWindow() => this.InitializeComponent();
|
||||
}
|
||||
}
|
||||
@ -1,178 +0,0 @@
|
||||
<Grid x:Class="Common.UI.VFM.Views.ShipmentView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:VM="clr-namespace:Common.UI.VFM.ViewModels"
|
||||
Margin="10">
|
||||
|
||||
<Grid.DataContext>
|
||||
<VM:ShipmnetViewModel />
|
||||
</Grid.DataContext>
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="10" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="10" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="10" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock FontFamily="Verdana"
|
||||
FontSize="20"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="2"
|
||||
Grid.Row="0"
|
||||
HorizontalAlignment="Center"
|
||||
Padding="0, 10"
|
||||
Text="OMNI+ Versand fertig machen" />
|
||||
|
||||
<TextBlock FontFamily="Verdana"
|
||||
FontSize="13"
|
||||
Foreground="DimGray"
|
||||
Grid.Column="0"
|
||||
Grid.Row="2"
|
||||
Margin="0, 0, 3, 3"
|
||||
Text="Deckelnr." />
|
||||
<TextBox FontFamily="Verdana"
|
||||
FontSize="13"
|
||||
Foreground="DimGray"
|
||||
GotFocus="TextBox_GotFocus"
|
||||
Grid.Column="0"
|
||||
Grid.Row="3"
|
||||
IsEnabled="{Binding Proccessing, Converter={StaticResource BooleanInverter}}"
|
||||
Margin="0, 0, 3, 0"
|
||||
Padding="5"
|
||||
Text="{Binding CustId}"
|
||||
Name="InputCustId"/>
|
||||
|
||||
<TextBlock FontFamily="Verdana"
|
||||
FontSize="13"
|
||||
Foreground="DimGray"
|
||||
Grid.Column="1"
|
||||
Grid.Row="2"
|
||||
Margin="3, 0, 0, 3"
|
||||
Text="Zählernr." />
|
||||
<TextBox FontFamily="Verdana"
|
||||
FontSize="13"
|
||||
Foreground="DimGray"
|
||||
GotFocus="TextBox_GotFocus"
|
||||
Grid.Column="1"
|
||||
Grid.Row="3"
|
||||
IsEnabled="{Binding Proccessing, Converter={StaticResource BooleanInverter}}"
|
||||
Padding="5"
|
||||
Margin="3, 0, 0, 0"
|
||||
Text="{Binding MeterPcb}"
|
||||
Name="InputPcbId"/>
|
||||
|
||||
<ScrollViewer BorderThickness="0"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="2"
|
||||
Grid.Row="5"
|
||||
HorizontalAlignment="Stretch"
|
||||
HorizontalContentAlignment="Stretch"
|
||||
HorizontalScrollBarVisibility="Disabled"
|
||||
VerticalAlignment="Stretch"
|
||||
VerticalContentAlignment="Stretch"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
<ItemsControl Background="White"
|
||||
BorderThickness="1, 1, 0, 0"
|
||||
BorderBrush="LightGray"
|
||||
ItemsSource="{Binding Processes}"
|
||||
Margin="0"
|
||||
VerticalAlignment="Top">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type VM:ProcessStepViewModel}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="8*" />
|
||||
<ColumnDefinition Width="1*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Border BorderThickness="0, 0, 1, 1" BorderBrush="LightGray" Grid.Column="0">
|
||||
<StackPanel>
|
||||
<TextBlock FontFamily="Verdana"
|
||||
FontSize="13"
|
||||
Foreground="DimGray"
|
||||
Padding="10, 5"
|
||||
Text="{Binding Name}"/>
|
||||
<TextBlock FontSize="11"
|
||||
Foreground="{Binding State, Converter={StaticResource ProcessstateToColor}}"
|
||||
Padding="10, 0, 10, 3"
|
||||
Text="{Binding Message}"
|
||||
TextWrapping="Wrap"
|
||||
Visibility="{Binding Message, Converter={StaticResource StringToVisibility}}"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Border BorderThickness="0, 0, 1, 1" BorderBrush="LightGray" Grid.Column="1" Padding="10, 5">
|
||||
<Image Style="{Binding State, Converter={StaticResource ProcessStateToImage}}" />
|
||||
</Border>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</ScrollViewer>
|
||||
|
||||
<Border BorderThickness="0"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="2"
|
||||
Grid.Row="8"
|
||||
Margin="0, 6, 0, 0" >
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock FontSize="13"
|
||||
Foreground="DimGray"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="2"
|
||||
Grid.Row="0"
|
||||
HorizontalAlignment="Right"
|
||||
Padding="0, 5"
|
||||
Text="{Binding Message}"
|
||||
TextWrapping="Wrap"
|
||||
Visibility="{Binding Message, Converter={StaticResource StringToVisibility}}"/>
|
||||
<Button Command="{Binding ReprintBoxLable}"
|
||||
Content="Kartonlabel nachdrucken"
|
||||
Cursor="Hand"
|
||||
FontFamily="Verdana"
|
||||
FontSize="13"
|
||||
Grid.Column="0"
|
||||
Grid.Row="1"
|
||||
Visibility="{Binding ReprintEnabled, Converter={StaticResource BooleanToVisibility}}"
|
||||
Margin="0, 0, 5, 0"
|
||||
Padding="10, 4" />
|
||||
<Button Command="{Binding ReprintTestLable}"
|
||||
Content="Prüflabel nachdrucken"
|
||||
Cursor="Hand"
|
||||
FontFamily="Verdana"
|
||||
FontSize="13"
|
||||
Grid.Column="1"
|
||||
Grid.Row="1"
|
||||
Visibility="{Binding ReprintEnabled, Converter={StaticResource BooleanToVisibility}}"
|
||||
Margin="0, 0, 5, 0"
|
||||
Padding="10, 4" />
|
||||
<Button Command="{Binding StartProcessing}"
|
||||
Content="VSFM Starten"
|
||||
Cursor="Hand"
|
||||
FontFamily="Verdana"
|
||||
FontSize="13"
|
||||
Grid.Column="3"
|
||||
Grid.Row="1"
|
||||
IsEnabled="{Binding Proccessing, Converter={StaticResource BooleanInverter}}"
|
||||
Padding="10, 4"
|
||||
Name="StartVFM"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
@ -1,43 +0,0 @@
|
||||
namespace Common.UI.VFM.Views
|
||||
{
|
||||
using Common.UI.VFM.ViewModels;
|
||||
|
||||
using System;
|
||||
using System.Windows.Controls;
|
||||
|
||||
public partial class ShipmentView : Grid
|
||||
{
|
||||
public ShipmentView()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
|
||||
App.Current.Activated += App_Currrent_Activated;
|
||||
}
|
||||
|
||||
private void App_Currrent_Activated(Object sender, EventArgs e)
|
||||
{
|
||||
if (!this.InputCustId.IsFocused && !this.InputPcbId.IsFocused)
|
||||
{
|
||||
this.InputCustId.Focus();
|
||||
}
|
||||
}
|
||||
|
||||
private void TextBox_GotFocus(object sender, System.Windows.RoutedEventArgs e)
|
||||
{
|
||||
if (this.DataContext is ShipmnetViewModel viewModel)
|
||||
{
|
||||
viewModel.ResetProcessState.Execute(null);
|
||||
}
|
||||
}
|
||||
|
||||
private void InputCustId_TextChanged(Object sender, TextChangedEventArgs e)
|
||||
{
|
||||
this.InputPcbId.Focus();
|
||||
}
|
||||
|
||||
private void InputPcbId_TextChanged(Object sender, TextChangedEventArgs e)
|
||||
{
|
||||
this.StartVFM.Focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -141,8 +141,13 @@
|
||||
<Compile Include="Controls\MainMenu.xaml.cs">
|
||||
<DependentUpon>MainMenu.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Controls\SIRT.xaml.cs">
|
||||
<DependentUpon>SIRT.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Infrastructure\BooleanToBorderConverter.cs" />
|
||||
<Compile Include="Infrastructure\ErrorManager.cs" />
|
||||
<Compile Include="Models\AuftragDbContext.cs" />
|
||||
<Compile Include="Models\EregisterManualProgrammingModel.cs" />
|
||||
<Compile Include="Models\Eregister_Shared.cs" />
|
||||
<Compile Include="Models\HttpContext.cs" />
|
||||
<Compile Include="Models\P2000_Shared.cs" />
|
||||
@ -160,13 +165,18 @@
|
||||
<Compile Include="Pages\EregisterInitialize.xaml.cs">
|
||||
<DependentUpon>EregisterInitialize.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Pages\EregisterManualProgramming.xaml.cs">
|
||||
<DependentUpon>EregisterManualProgramming.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Pages\Home.xaml.cs">
|
||||
<DependentUpon>Home.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ViewModels\Controls\SIRTVM.cs" />
|
||||
<Compile Include="ViewModels\EregisterFinalizeVM.cs" />
|
||||
<Compile Include="ViewModels\EregisterHeaderVM.cs" />
|
||||
<Compile Include="ViewModels\EregisterInitializeVM.cs" />
|
||||
<Compile Include="Models\EregisterPropertiesModel.cs" />
|
||||
<Compile Include="ViewModels\EregisterManualProgrammingVM.cs" />
|
||||
<Compile Include="ViewModels\EregisterTaskVM.cs" />
|
||||
<Compile Include="ViewModels\GridItem.cs" />
|
||||
<Compile Include="ViewModels\GridItem[T].cs" />
|
||||
@ -192,6 +202,10 @@
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Controls\SIRT.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Pages\EregisterFinalize.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
@ -221,6 +235,10 @@
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Pages\EregisterManualProgramming.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Pages\Home.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
||||
5
Common/Ui/Common.UI/Controls/SIRT.xaml
Normal file
5
Common/Ui/Common.UI/Controls/SIRT.xaml
Normal file
@ -0,0 +1,5 @@
|
||||
<Grid x:Class="Common.UI.Controls.SIRT"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Button Content="Start" Click="Button_Click" />
|
||||
</Grid>
|
||||
77
Common/Ui/Common.UI/Controls/SIRT.xaml.cs
Normal file
77
Common/Ui/Common.UI/Controls/SIRT.xaml.cs
Normal file
@ -0,0 +1,77 @@
|
||||
namespace Common.UI.Controls
|
||||
{
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
|
||||
public partial class SIRT : Grid
|
||||
{
|
||||
public SIRT() => this.InitializeComponent();
|
||||
|
||||
public ICommand Activated
|
||||
{
|
||||
get => this.GetValue(ConnectedProeprty) as ICommand;
|
||||
set => this.SetValue(ConnectedProeprty, value);
|
||||
}
|
||||
|
||||
public ICommand Connected
|
||||
{
|
||||
get => this.GetValue(ConnectedProeprty) as ICommand;
|
||||
set => this.SetValue(ConnectedProeprty, value);
|
||||
}
|
||||
|
||||
public ICommand Disconnected
|
||||
{
|
||||
get => this.GetValue(DisconnectedProeprty) as ICommand;
|
||||
set => this.SetValue(DisconnectedProeprty, value);
|
||||
}
|
||||
|
||||
private void Button_Click(System.Object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public partial class SIRT
|
||||
{
|
||||
public static readonly DependencyProperty ActivatedProeprty = DependencyProperty.Register(
|
||||
name: nameof(Activated)
|
||||
, propertyType: typeof(ICommand)
|
||||
, ownerType: typeof(SIRT)
|
||||
, typeMetadata: new FrameworkPropertyMetadata(
|
||||
defaultValue: null
|
||||
, propertyChangedCallback: ActivatedPropertyChanged));
|
||||
|
||||
public static readonly DependencyProperty ConnectedProeprty = DependencyProperty.Register(
|
||||
name: nameof(Connected)
|
||||
, propertyType: typeof(ICommand)
|
||||
, ownerType: typeof(SIRT)
|
||||
, typeMetadata: new FrameworkPropertyMetadata(
|
||||
defaultValue: null
|
||||
, propertyChangedCallback: ConnectedCommandPropertyChanged));
|
||||
|
||||
public static readonly DependencyProperty DisconnectedProeprty = DependencyProperty.Register(
|
||||
name: nameof(Disconnected)
|
||||
, propertyType: typeof(ICommand)
|
||||
, ownerType: typeof(SIRT)
|
||||
, typeMetadata: new FrameworkPropertyMetadata(
|
||||
defaultValue: null
|
||||
, propertyChangedCallback: DisconnectedPropertyChanged));
|
||||
|
||||
private static void ActivatedPropertyChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs args)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
private static void ConnectedCommandPropertyChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs args)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private static void DisconnectedPropertyChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs args)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,16 +1,30 @@
|
||||
namespace Common.UI.Infrastructure
|
||||
{
|
||||
using System;
|
||||
using System.Configuration;
|
||||
|
||||
public static class Appsettings
|
||||
{
|
||||
private static readonly Configuration configuration = ConfigurationManager.OpenExeConfiguration(typeof(Appsettings).Assembly.Location);
|
||||
private static readonly string dll = typeof(Appsettings).Assembly.Location;
|
||||
|
||||
public static string Get(string name)
|
||||
public static string Get(string settingKey)
|
||||
{
|
||||
ConfigurationManager.RefreshSection("appSettings");
|
||||
var settingValue = default(string);
|
||||
|
||||
return configuration?.AppSettings?.Settings?[name]?.Value;
|
||||
try
|
||||
{
|
||||
settingValue = ConfigurationManager
|
||||
.OpenExeConfiguration(dll)
|
||||
.AppSettings
|
||||
.Settings[settingKey]
|
||||
.Value;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
ErrorManager.NotifyError(e.GetType().Name, e.ToString());
|
||||
}
|
||||
|
||||
return settingValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
25
Common/Ui/Common.UI/Infrastructure/ErrorManager.cs
Normal file
25
Common/Ui/Common.UI/Infrastructure/ErrorManager.cs
Normal file
@ -0,0 +1,25 @@
|
||||
namespace Common.UI.Infrastructure
|
||||
{
|
||||
using System;
|
||||
|
||||
public class Error
|
||||
{
|
||||
public string Title { get; set; }
|
||||
|
||||
public string Message { get; set; }
|
||||
}
|
||||
|
||||
public static class ErrorManager
|
||||
{
|
||||
public static event Action<Error> Error;
|
||||
|
||||
public static void NotifyError(string title, string message)
|
||||
{
|
||||
Error?.Invoke(new Error
|
||||
{
|
||||
Title = title,
|
||||
Message = message
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2,6 +2,6 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
ShowsNavigationUI="False"
|
||||
Source="Pages/Home.xaml"
|
||||
Source="Pages/EregisterManualProgramming.xaml"
|
||||
Title="TestBench UI">
|
||||
</NavigationWindow>
|
||||
|
||||
@ -0,0 +1,14 @@
|
||||
namespace Common.UI.Models
|
||||
{
|
||||
using Common.Hardware.SIRT;
|
||||
|
||||
public class EregisterManualProgrammingModel
|
||||
{
|
||||
private readonly SIRTFactory sirtFactory;
|
||||
|
||||
public EregisterManualProgrammingModel()
|
||||
{
|
||||
this.sirtFactory = new SIRTFactory();
|
||||
}
|
||||
}
|
||||
}
|
||||
14
Common/Ui/Common.UI/Pages/EregisterManualProgramming.xaml
Normal file
14
Common/Ui/Common.UI/Pages/EregisterManualProgramming.xaml
Normal file
@ -0,0 +1,14 @@
|
||||
<Page x:Class="Common.UI.Pages.EregisterManualProgramming"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:ViewModels="clr-namespace:Common.UI.ViewModels">
|
||||
<Page.DataContext>
|
||||
<ViewModels:EregisterManualProgrammingVM />
|
||||
</Page.DataContext>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
</Grid>
|
||||
</Page>
|
||||
@ -0,0 +1,9 @@
|
||||
namespace Common.UI.Pages
|
||||
{
|
||||
using System.Windows.Controls;
|
||||
|
||||
public partial class EregisterManualProgramming : Page
|
||||
{
|
||||
public EregisterManualProgramming() => this.InitializeComponent();
|
||||
}
|
||||
}
|
||||
8
Common/Ui/Common.UI/ViewModels/Controls/SIRTVM.cs
Normal file
8
Common/Ui/Common.UI/ViewModels/Controls/SIRTVM.cs
Normal file
@ -0,0 +1,8 @@
|
||||
namespace Common.UI.ViewModels.Controls
|
||||
{
|
||||
using Common.UI.Infrastructure;
|
||||
|
||||
public class SIRTVM : ViewModel<SIRTVM>
|
||||
{
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
namespace Common.UI.ViewModels
|
||||
{
|
||||
using Common.UI.Infrastructure;
|
||||
using Common.UI.Models;
|
||||
|
||||
public class EregisterManualProgrammingVM : ViewModel<EregisterManualProgrammingVM>
|
||||
{
|
||||
private readonly EregisterManualProgrammingModel model;
|
||||
|
||||
public EregisterManualProgrammingVM()
|
||||
{
|
||||
this.model = new EregisterManualProgrammingModel();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user