e-register init & final programming prepeared
This commit is contained in:
+5
-36
@@ -2,7 +2,6 @@
|
||||
{
|
||||
using Common.Hardware.SIRT;
|
||||
using Common.Hardware.SIRT.Parameters;
|
||||
using Common.Hardware.WaterMeter.eRegister.Features;
|
||||
using Common.Hardware.WaterMeter.eRegister.Models;
|
||||
|
||||
using System;
|
||||
@@ -34,15 +33,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
internal IEnumerable<EregisterTask> LoadCustomTasks()
|
||||
{
|
||||
var features = parameters.LoadCustomFeatures();
|
||||
|
||||
this.LoadProgrammingParameters(features);
|
||||
|
||||
return this.runningTasks.AsEnumerable();
|
||||
}
|
||||
|
||||
internal IEnumerable<EregisterTask> LoadInspectionFinalizationTasks()
|
||||
{
|
||||
var features = parameters.LoadInspectionFinalizationFeatures();
|
||||
@@ -72,20 +62,6 @@
|
||||
|
||||
this.LoadProgrammingParameters(features);
|
||||
|
||||
this.runningTasks.Enqueue(new EregisterCheckInitializationTask(this.parameters, features.Frequency)
|
||||
{
|
||||
SlotNr = features.SlotNr,
|
||||
PoNr = features.PoNr,
|
||||
SerialNr = features.SerialNr,
|
||||
P1 = new P811
|
||||
{
|
||||
DelPamSemi = true,
|
||||
},
|
||||
RequestAddress = features.RequestAddress,
|
||||
ResponseAddress = features.ResponseAddress,
|
||||
EncryptionKey = features.EncryptionKey
|
||||
});
|
||||
|
||||
return this.runningTasks.AsEnumerable();
|
||||
}
|
||||
|
||||
@@ -142,6 +118,7 @@
|
||||
|
||||
var frequency = this.parameters.Frequency;
|
||||
|
||||
// Determinates the radio address of the end point and the encryption status
|
||||
this.runningTasks.Enqueue(new EregisterTask(frequency)
|
||||
{
|
||||
SlotNr = features.SlotNr,
|
||||
@@ -157,8 +134,9 @@
|
||||
EncryptionKey = features.EncryptionKey,
|
||||
Name = "Dummy PAM"
|
||||
});
|
||||
|
||||
this.runningTasks.Enqueue(new EregisterTask(frequency)
|
||||
|
||||
// Determinates the state of the endpoint
|
||||
this.runningTasks.Enqueue(new EregisterCheckInitializationTask(this.parameters, features.Frequency)
|
||||
{
|
||||
SlotNr = features.SlotNr,
|
||||
PoNr = features.PoNr,
|
||||
@@ -167,18 +145,9 @@
|
||||
{
|
||||
DelPamSemi = true,
|
||||
},
|
||||
Data = new OpticalTelegram
|
||||
{
|
||||
Minutes = 0
|
||||
}
|
||||
.Append(new ProvidePin
|
||||
{
|
||||
AuthLevel = AuthLevel.III
|
||||
}),
|
||||
RequestAddress = features.RequestAddress,
|
||||
ResponseAddress = features.ResponseAddress,
|
||||
EncryptionKey = features.EncryptionKey,
|
||||
Name = "Get Debug"
|
||||
EncryptionKey = features.EncryptionKey
|
||||
});
|
||||
|
||||
foreach (var pam in features.BuildPams())
|
||||
|
||||
+7
-4
@@ -22,8 +22,11 @@
|
||||
this.requestParameters = requestParameters;
|
||||
this.pendingState = SIRTTaskState.Completed;
|
||||
this.Name = "Final Check";
|
||||
this.Data = new OpticalTelegram { Minutes = 0 }
|
||||
.Append(new ProvidePin { AuthLevel = AuthLevel.III });
|
||||
this.Data = new RequestDebugTelegram()
|
||||
.Append(new ProvidePin
|
||||
{
|
||||
AuthLevel = AuthLevel.III
|
||||
});
|
||||
}
|
||||
|
||||
protected override void EndProcessResponse(SIRTMessage response)
|
||||
@@ -159,8 +162,8 @@
|
||||
FDR_Time_Of_Maximum_Flow = fdrLogContent.TimeOfMaximumFlow,
|
||||
FDR_Time_Of_Minimum_Flow = fdrLogContent.TimeOfMinimumFlow,
|
||||
FDR_Time_Of_Peak_Flow = fdrLogContent.TimeOfPeakFlow,
|
||||
TransmissionIntervalFinalization = (byte)this.SEMI.TransmissionInterval,
|
||||
LATWindowsFinalization = this.SEMI.LATInterval,
|
||||
TransmissionIntervalFinal = (byte)this.SEMI.TransmissionInterval,
|
||||
LATWindowsFinal = this.SEMI.LATInterval,
|
||||
MBusStatus = this.SEMI.MBusStatus,
|
||||
Adresse = this.SEMI.Address,
|
||||
};
|
||||
|
||||
+6
-24
@@ -20,26 +20,14 @@
|
||||
this.pendingState = SIRTTaskState.Completed;
|
||||
this.Name = "Initial Check";
|
||||
|
||||
|
||||
if (parameters.IsFuhzoe)
|
||||
this.Data = new OpticalTelegram
|
||||
{
|
||||
this.Data = new RequestDebugTelegram()
|
||||
.Append(new ProvidePin
|
||||
{
|
||||
AuthLevel = AuthLevel.III
|
||||
});
|
||||
Minutes = 0
|
||||
}
|
||||
else
|
||||
.Append(new ProvidePin
|
||||
{
|
||||
this.Data = new OpticalTelegram
|
||||
{
|
||||
Minutes = parameters.LED_On_Minutes
|
||||
}
|
||||
.Append(new ProvidePin
|
||||
{
|
||||
AuthLevel = AuthLevel.III
|
||||
});
|
||||
}
|
||||
AuthLevel = AuthLevel.III
|
||||
});
|
||||
}
|
||||
|
||||
protected override void EndProcessResponse(SIRTMessage response)
|
||||
@@ -57,19 +45,13 @@
|
||||
|
||||
if (this.DEBUG != null && this.SEMI != null)
|
||||
{
|
||||
if (this.DEBUG.BatteryVoltage <= this.parameters.MinBatteryVoltage)
|
||||
{
|
||||
message.AppendLine();
|
||||
message.AppendLine($"- Die Batteriespannung ({this.DEBUG.BatteryVoltage}) liegt unter dem angegebenen Minimum von ({this.parameters.MinBatteryVoltage}). ");
|
||||
}
|
||||
|
||||
if (this.SEMI.BatteryRemainingYears <= this.parameters.MinBatteryRemainingYears)
|
||||
{
|
||||
message.AppendLine();
|
||||
message.AppendLine($"- Die Batterielaufzeit ({this.SEMI.BatteryRemainingYears}) liegt unter dem angegebenen Minimum von ({this.parameters.MinBatteryRemainingYears}). ");
|
||||
}
|
||||
|
||||
// Min metrology FW version ( >= 1108) CSD dependent
|
||||
// Min metrology FW version (>= 1108) CSD dependent
|
||||
if (!string.IsNullOrWhiteSpace(this.parameters.MinMetrologyFWVersion))
|
||||
{
|
||||
var culture = CultureInfo.CurrentCulture;
|
||||
|
||||
-16
@@ -19,22 +19,6 @@
|
||||
this.eregisters = new List<Eregister>();
|
||||
}
|
||||
|
||||
public IEnumerable<IEnumerable<EregisterTask>> LoadCustomTasks(EregisterProgrammingParametersList parametersList)
|
||||
{
|
||||
this.eregisters.Clear();
|
||||
|
||||
foreach (var parameters in parametersList)
|
||||
{
|
||||
var eregister = new Eregister(parameters, this.sirtFactory.EnqueueTask);
|
||||
|
||||
this.sirtFactory.DequeueTasks(parameters.RequestAddress);
|
||||
this.sirtFactory.DequeueTasks(parameters.ResponseAddress);
|
||||
this.eregisters.Add(eregister);
|
||||
|
||||
yield return eregister.LoadCustomTasks();
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<IEnumerable<EregisterTask>> LoadInspectionFinalizationTasks(EregisterProgrammingParametersList parametersList)
|
||||
{
|
||||
this.eregisters.Clear();
|
||||
|
||||
+9
-6
@@ -1,6 +1,5 @@
|
||||
namespace Common.Hardware.WaterMeter.eRegister
|
||||
{
|
||||
using Common.Hardware.Ports;
|
||||
using Common.Hardware.SIRT;
|
||||
using Common.Hardware.SIRT.Parameters;
|
||||
using Common.Hardware.WaterMeter.eRegister.Features;
|
||||
@@ -113,6 +112,13 @@
|
||||
var data = response.Data;
|
||||
var length = data.Length;
|
||||
|
||||
// TODO: get is encrypted from the data crc BUP, DEBUG, SEMI
|
||||
|
||||
if (this.IsEncrypted)
|
||||
{
|
||||
data = data.DecryptResponse(this.EncryptionKey);
|
||||
}
|
||||
|
||||
if (length > 0)
|
||||
{
|
||||
var type = data[0];
|
||||
@@ -121,12 +127,14 @@
|
||||
{
|
||||
this.Label = nameof(SIRTMessage.BUP);
|
||||
this.BUP = new BUP(data, this.P11);
|
||||
this.IsEncrypted = this.BUP.Crc != 0;
|
||||
this.NotifyTelegram(this.BUP);
|
||||
}
|
||||
else if (type == SIRTMessage.LAT)
|
||||
{
|
||||
this.Label = nameof(SIRTMessage.LAT);
|
||||
this.LAT = new LAT(data, this.P11);
|
||||
this.IsEncrypted = this.LAT.Crc != 0;
|
||||
this.NotifyTelegram(this.LAT);
|
||||
}
|
||||
else if (type == SIRTMessage.DEBUG)
|
||||
@@ -175,11 +183,6 @@
|
||||
{
|
||||
this.Label = "NA";
|
||||
}
|
||||
|
||||
if (this.IsEncrypted)
|
||||
{
|
||||
data = data.DecryptResponse(this.EncryptionKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (response.Cmd == SIRTMessage.ACKNANSW)
|
||||
|
||||
+1
@@ -2,6 +2,7 @@
|
||||
{
|
||||
public enum WakeUpMode : byte
|
||||
{
|
||||
/// Stay awake
|
||||
StayAwake = 0x00,
|
||||
/// Go to sleep with radio activate on by water flow.
|
||||
SleepAutoOn = 0x03,
|
||||
|
||||
+157
-187
@@ -61,7 +61,7 @@
|
||||
public byte TransmissionIntervalInitialization { get; set; }
|
||||
|
||||
[CompareProperty]
|
||||
public byte TransmissionIntervalFinalization { get; set; }
|
||||
public byte TransmissionIntervalFinal { get; set; }
|
||||
|
||||
[CompareProperty]
|
||||
public byte MBusStatus { get; set; }
|
||||
@@ -69,7 +69,7 @@
|
||||
public byte LatWindowsInitialization { get; set; }
|
||||
|
||||
[CompareProperty]
|
||||
public byte LATWindowsFinalization { get; set; }
|
||||
public byte LATWindowsFinal { get; set; }
|
||||
|
||||
public byte UnitsOfMessure { get; set; }
|
||||
|
||||
@@ -252,38 +252,6 @@
|
||||
|
||||
public uint ResponseAddress => (uint)(this.Adresse % 10_000_000_000);
|
||||
|
||||
internal EregisterFeatures LoadCustomFeatures()
|
||||
{
|
||||
var features = new EregisterFeatures
|
||||
{
|
||||
SlotNr = this.Slotno,
|
||||
SerialNr = this.SerienNr,
|
||||
PoNr = this.FertigungsauftragNr,
|
||||
RequestAddress = this.RequestAddress,
|
||||
ResponseAddress = this.ResponseAddress,
|
||||
Frequency = this.Frequency,
|
||||
EncryptionKey = this.EncryptionKey.GetEncryptionKey(),
|
||||
ChangeWakeUp = new ChangeWakeUp
|
||||
{
|
||||
WakeUpMode = WakeUpMode.StayAwake
|
||||
},
|
||||
ChangeNumberOfLatWindows = new ChangeNumberOfLatWindows
|
||||
{
|
||||
N = 1
|
||||
},
|
||||
ChangeTransmissionInterval = new ChangeTransmissionInterval
|
||||
{
|
||||
Seconds = 1
|
||||
},
|
||||
ChangeRadioId = new ChangeRadioId
|
||||
{
|
||||
Address = this.ResponseAddress
|
||||
}
|
||||
};
|
||||
|
||||
return features;
|
||||
}
|
||||
|
||||
internal EregisterFeatures LoadInspectionFinalizationFeatures()
|
||||
{
|
||||
var features = new EregisterFeatures
|
||||
@@ -297,136 +265,139 @@
|
||||
EncryptionKey = this.EncryptionKey.GetEncryptionKey(),
|
||||
};
|
||||
|
||||
if (!this.IsValid || this.StatusFertigung != 30)
|
||||
if (this.IsValid)
|
||||
{
|
||||
return features;
|
||||
}
|
||||
if (this.StatusFertigung != 30)
|
||||
{
|
||||
features.ChangeMeterReading = new ChangeMeterReading(333_333_333);
|
||||
|
||||
features.Debug = new EregisterDebugFeatures();
|
||||
|
||||
if (!this.IsEbeling && !this.IsFuhzoe)
|
||||
{
|
||||
features.ChangeWakeUp = new ChangeWakeUp
|
||||
{
|
||||
WakeUpMode = WakeUpMode.StayAwake
|
||||
};
|
||||
features.ChangeMeterReading = new ChangeMeterReading(this.DisplayVolume);
|
||||
features.Debug.SetActivationByThreshold = new SetActivationByThreshold
|
||||
{
|
||||
Rotations = this.ActivationByThreshold
|
||||
};
|
||||
features.Debug.DisableOTAFirmwareUpdate = new DisableOTAFirmwareUpdate
|
||||
{
|
||||
Mode = (OTAMode)this.DisableOTA
|
||||
};
|
||||
//TODO: features.Debug.ChangeState = new ChangeState
|
||||
//{
|
||||
// Mode = FactoryState.Shipment
|
||||
//};
|
||||
features.ChangeTransmissionInterval = new ChangeTransmissionInterval
|
||||
{
|
||||
Seconds = this.TransmissionIntervalFinalization,
|
||||
};
|
||||
features.OpenMeteringTransmitionIntervalWMBus = new OpenMeteringTransmitionIntervalWMBus
|
||||
{
|
||||
Seconds = this.OpenMeteringTransmissionIntervalSeconds
|
||||
};
|
||||
}
|
||||
|
||||
if (!this.IsEbeling)
|
||||
{
|
||||
features.ChangeSensusRFEncryptionKey = new ChangeSensusRFEncryptionKey
|
||||
{
|
||||
HexKey = this.EncryptionKey
|
||||
};
|
||||
features.ChangeNumberOfLatWindows = new ChangeNumberOfLatWindows
|
||||
{
|
||||
N = this.LATWindowsFinalization
|
||||
};
|
||||
}
|
||||
|
||||
features.ChangeRadioId = new ChangeRadioId(this.ResponseAddress);
|
||||
features.ChangeMeterId = new ChangeMeterId(this.MeterId);
|
||||
features.SetDateAndTime = new SetDateAndTime
|
||||
{
|
||||
SecondsSince20000101 = new Epoch20000101
|
||||
{
|
||||
DateTime = DateTime.UtcNow.AddHours(this.UTC_Offset)
|
||||
return features;
|
||||
}
|
||||
};
|
||||
features.WirelessMBusMode = new WirelessMBusMode(this.MBusStatus);
|
||||
features.SetPowerLevelSensusRF = new SetPowerLevel
|
||||
{
|
||||
Value = (byte)(this.PowerLevelHex & 127)
|
||||
};
|
||||
features.SetPowerLevelFlexNet = new SetPowerLevel
|
||||
{
|
||||
Value = (byte)(this.PowerLevelHex | 128)
|
||||
};
|
||||
|
||||
features.Debug = new EregisterDebugFeatures();
|
||||
features.ChangeMeterReading = new ChangeMeterReading(this.DisplayVolume);
|
||||
features.ChangeRadioId = new ChangeRadioId(this.ResponseAddress);
|
||||
features.ChangeMeterId = new ChangeMeterId(this.MeterId);
|
||||
features.DeactivateAlarms = new DeactivateAlarms
|
||||
{
|
||||
Backflow = this.Alarm_Backflow,
|
||||
BrokenPipe = this.Alarm_Broken_Pipe,
|
||||
Leak = this.Alarm_Leakage,
|
||||
LowBattery = this.Alarm_Low_Battery,
|
||||
MagneticTamper = this.Alarm_Magnetic_Tamper,
|
||||
MediumAbsent = this.Alarm_Medium_Absent,
|
||||
MetrologyUnavailable = this.Alarm_Metrology_Unavailable,
|
||||
SpecificError = this.Alarm_Specific_Error,
|
||||
};
|
||||
features.ResetAlarms = new ResetAlarms(0xFF);
|
||||
features.SetDateAndTime = new SetDateAndTime
|
||||
{
|
||||
SecondsSince20000101 = new Epoch20000101
|
||||
{
|
||||
DateTime = DateTime.UtcNow.AddHours(this.UTC_Offset)
|
||||
}
|
||||
};
|
||||
features.ChangeCustomerText = new ChangeCustomerText
|
||||
{
|
||||
Text = this.CustomerSpecificText
|
||||
};
|
||||
features.ParameterizeLeakageDetection = new ParameterizeLeakageDetection
|
||||
{
|
||||
Value = (byte)(this.LeakagePeriod | (this.LeakageThreshold * (byte)Math.Pow(2, 3)))
|
||||
};
|
||||
features.ParameterizeBrokenPipeDetection = new ParameterizeBrokenPipeDetection
|
||||
{
|
||||
Value = (byte)(this.BrokenPipePeriod | (this.BrokenPipeThreshold * (byte)Math.Pow(2, 3)))
|
||||
};
|
||||
features.SetHistoricalErrorLimit = new SetHistoricalErrorLimit
|
||||
{
|
||||
Value = this.History_Error_Limits_Days
|
||||
};
|
||||
features.ChangeDataLoggerSettings = new ChangeDataLoggerSettings
|
||||
{
|
||||
TimeInterval = this.Data_Logging_Period,
|
||||
ForwardCounter = this.Data_Logging_Forward_Counter,
|
||||
TimeOfMinimumFlow = this.Data_Logging_Time_Of_Minimum_Flow,
|
||||
MinimumFlow = this.Data_Logging_Minimum_Flow,
|
||||
TimeOfBrokenPipe = this.Data_Logging_Time_Of_Broken_Pipe,
|
||||
BrokenPipeFlow = this.Data_Logging_Broken_Pipe_Flow,
|
||||
CurrentFlow = this.Data_Logging_Current_Flow,
|
||||
TimeOfPeakFlow = this.Data_Logging_Time_Of_Peak_Flow,
|
||||
PeakFlow = this.Data_Logging_Peak_Flow,
|
||||
TimeOfMaximumFlow = this.Data_Logging_Time_Of_Maximum_Flow,
|
||||
MaximumFlow = this.Data_Logging_Maximum_Flow,
|
||||
BackwardVolume = this.Data_Logging_Backward_Volume,
|
||||
Counter = this.Data_Logging_Counter,
|
||||
AlarmState = this.Data_Logging_Alarm_State,
|
||||
};
|
||||
features.ChangeFixedDateReadingSettings = new ChangeFixedDateReadingSettings
|
||||
{
|
||||
DayOfMonth = this.FDR_Day_Of_Data_Reading,
|
||||
ForwardCounter = this.FDR_Forward_Counter,
|
||||
TimeOfMinimumFlow = this.FDR_Time_Of_Minimum_Flow,
|
||||
MinimumFlow = this.FDR_Minimum_Flow,
|
||||
TimeOfBrokenPipe = this.FDR_Time_Of_Broken_Pipe,
|
||||
BrokenPipeFlow = this.FDR_Broken_Pipe_Flow,
|
||||
CurrentFlow = this.FDR_Current_Flow,
|
||||
TimeOfPeakFlow = this.FDR_Time_Of_Peak_Flow,
|
||||
PeakFlow = this.FDR_Peak_Flow,
|
||||
TimeOfMaximumFlow = this.FDR_Time_Of_Maximum_Flow,
|
||||
MaximumFlow = this.FDR_Maximum_Flow,
|
||||
BackwardVolume = this.FDR_Backward_Volume,
|
||||
Counter = this.FDR_Counter,
|
||||
AlarmState = this.FDR_Alarm_State,
|
||||
};
|
||||
features.WirelessMBusMode = new WirelessMBusMode(this.MBusStatus);
|
||||
features.SetPowerLevelSensusRF = new SetPowerLevel
|
||||
{
|
||||
Value = (byte)(this.PowerLevelHex & 127)
|
||||
};
|
||||
features.SetPowerLevelFlexNet = new SetPowerLevel
|
||||
{
|
||||
Value = (byte)(this.PowerLevelHex | 128)
|
||||
};
|
||||
|
||||
features.DeactivateAlarms = new DeactivateAlarms
|
||||
{
|
||||
Backflow = this.Alarm_Backflow,
|
||||
BrokenPipe = this.Alarm_Broken_Pipe,
|
||||
Leak = this.Alarm_Leakage,
|
||||
LowBattery = this.Alarm_Low_Battery,
|
||||
MagneticTamper = this.Alarm_Magnetic_Tamper,
|
||||
MediumAbsent = this.Alarm_Medium_Absent,
|
||||
MetrologyUnavailable = this.Alarm_Metrology_Unavailable,
|
||||
SpecificError = this.Alarm_Specific_Error,
|
||||
};
|
||||
features.ResetAlarms = new ResetAlarms(0xFF);
|
||||
features.ChangeCustomerText = new ChangeCustomerText
|
||||
{
|
||||
Text = this.CustomerSpecificText
|
||||
};
|
||||
features.ParameterizeLeakageDetection = new ParameterizeLeakageDetection
|
||||
{
|
||||
Value = (byte)(this.LeakagePeriod | (this.LeakageThreshold * (byte)Math.Pow(2, 3)))
|
||||
};
|
||||
features.ParameterizeBrokenPipeDetection = new ParameterizeBrokenPipeDetection
|
||||
{
|
||||
Value = (byte)(this.BrokenPipePeriod | (this.BrokenPipeThreshold * (byte)Math.Pow(2, 3)))
|
||||
};
|
||||
features.SetHistoricalErrorLimit = new SetHistoricalErrorLimit
|
||||
{
|
||||
Value = this.History_Error_Limits_Days
|
||||
};
|
||||
features.ChangeDataLoggerSettings = new ChangeDataLoggerSettings
|
||||
{
|
||||
TimeInterval = this.Data_Logging_Period,
|
||||
ForwardCounter = this.Data_Logging_Forward_Counter,
|
||||
TimeOfMinimumFlow = this.Data_Logging_Time_Of_Minimum_Flow,
|
||||
MinimumFlow = this.Data_Logging_Minimum_Flow,
|
||||
TimeOfBrokenPipe = this.Data_Logging_Time_Of_Broken_Pipe,
|
||||
BrokenPipeFlow = this.Data_Logging_Broken_Pipe_Flow,
|
||||
CurrentFlow = this.Data_Logging_Current_Flow,
|
||||
TimeOfPeakFlow = this.Data_Logging_Time_Of_Peak_Flow,
|
||||
PeakFlow = this.Data_Logging_Peak_Flow,
|
||||
TimeOfMaximumFlow = this.Data_Logging_Time_Of_Maximum_Flow,
|
||||
MaximumFlow = this.Data_Logging_Maximum_Flow,
|
||||
BackwardVolume = this.Data_Logging_Backward_Volume,
|
||||
Counter = this.Data_Logging_Counter,
|
||||
AlarmState = this.Data_Logging_Alarm_State,
|
||||
};
|
||||
features.ChangeFixedDateReadingSettings = new ChangeFixedDateReadingSettings
|
||||
{
|
||||
DayOfMonth = this.FDR_Day_Of_Data_Reading,
|
||||
ForwardCounter = this.FDR_Forward_Counter,
|
||||
TimeOfMinimumFlow = this.FDR_Time_Of_Minimum_Flow,
|
||||
MinimumFlow = this.FDR_Minimum_Flow,
|
||||
TimeOfBrokenPipe = this.FDR_Time_Of_Broken_Pipe,
|
||||
BrokenPipeFlow = this.FDR_Broken_Pipe_Flow,
|
||||
CurrentFlow = this.FDR_Current_Flow,
|
||||
TimeOfPeakFlow = this.FDR_Time_Of_Peak_Flow,
|
||||
PeakFlow = this.FDR_Peak_Flow,
|
||||
TimeOfMaximumFlow = this.FDR_Time_Of_Maximum_Flow,
|
||||
MaximumFlow = this.FDR_Maximum_Flow,
|
||||
BackwardVolume = this.FDR_Backward_Volume,
|
||||
Counter = this.FDR_Counter,
|
||||
AlarmState = this.FDR_Alarm_State,
|
||||
};
|
||||
if (!this.IsEbeling && !this.IsFuhzoe)
|
||||
{
|
||||
features.Debug.DisableOTAFirmwareUpdate = new DisableOTAFirmwareUpdate
|
||||
{
|
||||
Mode = (OTAMode)this.DisableOTA
|
||||
};
|
||||
features.Debug.SetActivationByThreshold = new SetActivationByThreshold
|
||||
{
|
||||
Rotations = this.ActivationByThreshold
|
||||
};
|
||||
features.OpenMeteringTransmitionIntervalWMBus = new OpenMeteringTransmitionIntervalWMBus
|
||||
{
|
||||
Seconds = this.OpenMeteringTransmissionIntervalSeconds
|
||||
};
|
||||
|
||||
features.ChangeWakeUp = new ChangeWakeUp
|
||||
{
|
||||
Mode = this.Wake_Up_Interval
|
||||
};
|
||||
}
|
||||
|
||||
if (!this.IsEbeling)
|
||||
{
|
||||
features.ChangeTransmissionInterval = new ChangeTransmissionInterval
|
||||
{
|
||||
Seconds = this.TransmissionIntervalFinal,
|
||||
};
|
||||
features.ChangeNumberOfLatWindows = new ChangeNumberOfLatWindows
|
||||
{
|
||||
N = this.LATWindowsFinal
|
||||
};
|
||||
features.ChangeSensusRFEncryptionKey = new ChangeSensusRFEncryptionKey
|
||||
{
|
||||
HexKey = this.EncryptionKey
|
||||
};
|
||||
//features.Debug.ChangeState = new ChangeState
|
||||
//{
|
||||
// Mode = FactoryState.Shipment
|
||||
//};
|
||||
}
|
||||
}
|
||||
|
||||
return features;
|
||||
}
|
||||
@@ -444,36 +415,35 @@
|
||||
EncryptionKey = this.EncryptionKey.GetEncryptionKey(),
|
||||
};
|
||||
|
||||
if (!this.IsValid)
|
||||
if (this.IsValid)
|
||||
{
|
||||
return features;
|
||||
}
|
||||
|
||||
features.ChangeWakeUp = new ChangeWakeUp(WakeUpMode.StayAwake);
|
||||
features.ChangeTransmissionInterval = new ChangeTransmissionInterval(this.TransmissionIntervalInitialization);
|
||||
features.ChangeNumberOfLatWindows = new ChangeNumberOfLatWindows(this.LatWindowsInitialization);
|
||||
features.WirelessMBusMode = new WirelessMBusMode(this.MBusStatus);
|
||||
features.ChangeMeterReading = new ChangeMeterReading(111111111);
|
||||
features.SetMetrologyParameters = new SetMetrologyParameters
|
||||
{
|
||||
UseCandIRules = this.Ruecklaufsperre,
|
||||
DecimalPoint = (DecimalPointLocations)this.DecimalPoint,
|
||||
FactoryCalibration = this.FactoryCalibration,
|
||||
MeterSize = this.MeterSize,
|
||||
OffsetFactor = this.OffsetFactor,
|
||||
OffsetTime = this.OffsetTime,
|
||||
Units = (MessurementUnits)this.UnitsOfMessure,
|
||||
Vpp = this.VolumePerPulse,
|
||||
VppLED = (uint)this.VolumePerLedPulse
|
||||
};
|
||||
|
||||
features.Debug = new EregisterDebugFeatures
|
||||
{
|
||||
SetMeterType = new SetMeterType
|
||||
features.ChangeWakeUp = new ChangeWakeUp(WakeUpMode.StayAwake);
|
||||
features.ChangeTransmissionInterval = new ChangeTransmissionInterval(this.TransmissionIntervalInitialization);
|
||||
features.ChangeNumberOfLatWindows = new ChangeNumberOfLatWindows(this.LatWindowsInitialization);
|
||||
features.ChangeMeterReading = new ChangeMeterReading(000_000_010);
|
||||
features.WirelessMBusMode = new WirelessMBusMode(this.MBusStatus);
|
||||
features.SetMetrologyParameters = new SetMetrologyParameters
|
||||
{
|
||||
Type = (MeterTypes)this.CandIType
|
||||
},
|
||||
};
|
||||
UseCandIRules = this.Ruecklaufsperre,
|
||||
DecimalPoint = (DecimalPointLocations)this.DecimalPoint,
|
||||
FactoryCalibration = this.FactoryCalibration,
|
||||
MeterSize = this.MeterSize,
|
||||
OffsetFactor = this.OffsetFactor,
|
||||
OffsetTime = this.OffsetTime,
|
||||
Units = (MessurementUnits)this.UnitsOfMessure,
|
||||
Vpp = this.VolumePerPulse,
|
||||
VppLED = (uint)this.VolumePerLedPulse
|
||||
};
|
||||
|
||||
features.Debug = new EregisterDebugFeatures
|
||||
{
|
||||
SetMeterType = new SetMeterType
|
||||
{
|
||||
Type = (MeterTypes)this.CandIType
|
||||
},
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
return features;
|
||||
}
|
||||
|
||||
-8
@@ -14,14 +14,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
internal IEnumerable<EregisterFeatures> LoadCustomFeatures()
|
||||
{
|
||||
foreach (var parameters in this)
|
||||
{
|
||||
yield return parameters.LoadCustomFeatures();
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<EregisterFeatures> LoadInspectionFinalizationFeatures()
|
||||
{
|
||||
foreach (var parameters in this)
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<add key="ConnectionString" value="Server=SLASQL01.emea.sensus.net; Database=Auftrag; User ID=sa; Password=sqlserver;" />
|
||||
<add key="EncryptionKeisUrl" value="http://sla12iis01.emea.sensus.net/LaaProductionWeb/api/eregister/radiokey/byserialno/{0}" />
|
||||
<add key="SIRTComPorts" value="COM6, COM8" />
|
||||
<add key="PSNR" value="2001" />
|
||||
<add key="PSNR" value="1" />
|
||||
</appSettings>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
|
||||
@@ -14,6 +14,21 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<Deterministic>true</Deterministic>
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
@@ -135,9 +150,6 @@
|
||||
<Compile Include="Pages\EregisterFinalize.xaml.cs">
|
||||
<DependentUpon>EregisterFinalize.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Pages\EregisterManuelProgramming.xaml.cs">
|
||||
<DependentUpon>EregisterManuelProgramming.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Infrastructure\BooleanToBackgroundConverter.cs" />
|
||||
<Compile Include="Infrastructure\BooleanToVisibilityConverter.cs" />
|
||||
<Compile Include="Infrastructure\DeviceManager.cs" />
|
||||
@@ -145,24 +157,17 @@
|
||||
<Compile Include="Infrastructure\ViewModel.cs" />
|
||||
<Compile Include="Models\HomeModel.cs" />
|
||||
<Compile Include="Models\SettingsModel.cs" />
|
||||
<Compile Include="Pages\Eregister.xaml.cs">
|
||||
<DependentUpon>Eregister.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Pages\EregisterInitialize.xaml.cs">
|
||||
<DependentUpon>EregisterInitialize.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Pages\Home.xaml.cs">
|
||||
<DependentUpon>Home.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Pages\Settings.xaml.cs">
|
||||
<DependentUpon>Settings.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ViewModels\EregisterFinalizeVM.cs" />
|
||||
<Compile Include="ViewModels\EregisterHeaderVM.cs" />
|
||||
<Compile Include="ViewModels\EregisterInitializeVM.cs" />
|
||||
<Compile Include="Models\EregisterPropertiesModel.cs" />
|
||||
<Compile Include="ViewModels\EregisterTaskVM.cs" />
|
||||
<Compile Include="ViewModels\EregisterVM.cs" />
|
||||
<Compile Include="ViewModels\GridItem.cs" />
|
||||
<Compile Include="ViewModels\GridItem[T].cs" />
|
||||
<Compile Include="ViewModels\HomeViewModel.cs" />
|
||||
@@ -170,7 +175,6 @@
|
||||
<Compile Include="ViewModels\MainMenuViewModel.cs" />
|
||||
<Compile Include="ViewModels\MainMenuVM.cs" />
|
||||
<Compile Include="ViewModels\MainWindowVM.cs" />
|
||||
<Compile Include="ViewModels\SettingsViewModel.cs" />
|
||||
<Compile Include="ViewModels\SIRTBroadcasterVM.cs" />
|
||||
<Compile Include="ViewModels\SIRTConnectionVM.cs" />
|
||||
<Compile Include="Controls\SIRTBroadcasters.xaml.cs">
|
||||
@@ -192,10 +196,6 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Pages\EregisterManuelProgramming.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="MainWindow.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
@@ -217,10 +217,6 @@
|
||||
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Page Include="Pages\Eregister.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Pages\EregisterInitialize.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
@@ -229,10 +225,6 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Pages\Settings.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Controls\SIRTBroadcasters.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
@@ -282,5 +274,12 @@
|
||||
<Name>Common.Hardware.WaterMeter.eRegister</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<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,4 +1,4 @@
|
||||
<Grid x:Class="Common.UI.Views.SIRTBroadcasters"
|
||||
<Grid x:Class="Common.UI.Controls.SIRTBroadcasters"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vm="clr-namespace:Common.UI.ViewModels">
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Common.UI.Views
|
||||
namespace Common.UI.Controls
|
||||
{
|
||||
using System.Windows.Controls;
|
||||
|
||||
|
||||
@@ -1,680 +0,0 @@
|
||||
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:VM="clr-namespace:Common.UI.ViewModels"
|
||||
xmlns:Controls="clr-namespace:Common.UI.Controls"
|
||||
xmlns:Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero2" x:Class="Common.UI.Pages.Eregister"
|
||||
WindowTitle="UI / Eregister test environment"
|
||||
Title="Eregister">
|
||||
<Page.Resources>
|
||||
<Style x:Key="FocusVisual">
|
||||
<Setter Property="Control.Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate>
|
||||
<Rectangle Margin="2" SnapsToDevicePixels="true" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" StrokeThickness="1" StrokeDashArray="1 2"/>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<LinearGradientBrush x:Key="ComboBox.Static.Background" EndPoint="0,1" StartPoint="0,0">
|
||||
<GradientStop Color="White" Offset="0.0"/>
|
||||
<GradientStop Color="White" Offset="1.0"/>
|
||||
</LinearGradientBrush>
|
||||
<SolidColorBrush x:Key="ComboBox.Static.Border" Color="#FFBFBFBF"/>
|
||||
<SolidColorBrush x:Key="ComboBox.Static.Editable.Background" Color="#FFFFFFFF"/>
|
||||
<SolidColorBrush x:Key="ComboBox.Static.Editable.Border" Color="White"/>
|
||||
<SolidColorBrush x:Key="ComboBox.Static.Editable.Button.Background" Color="Transparent"/>
|
||||
<SolidColorBrush x:Key="ComboBox.Static.Editable.Button.Border" Color="Transparent"/>
|
||||
<SolidColorBrush x:Key="ComboBox.MouseOver.Glyph" Color="#FF000000"/>
|
||||
<LinearGradientBrush x:Key="ComboBox.MouseOver.Background" EndPoint="0,1" StartPoint="0,0">
|
||||
<GradientStop Color="White" Offset="0.0"/>
|
||||
<GradientStop Color="White" Offset="1.0"/>
|
||||
</LinearGradientBrush>
|
||||
<SolidColorBrush x:Key="ComboBox.MouseOver.Border" Color="#FF7EB4EA"/>
|
||||
<SolidColorBrush x:Key="ComboBox.MouseOver.Editable.Background" Color="#FFFFFFFF"/>
|
||||
<SolidColorBrush x:Key="ComboBox.MouseOver.Editable.Border" Color="#FF7EB4EA"/>
|
||||
<LinearGradientBrush x:Key="ComboBox.MouseOver.Editable.Button.Background" EndPoint="0,1" StartPoint="0,0">
|
||||
<GradientStop Color="White" Offset="0.0"/>
|
||||
<GradientStop Color="White" Offset="1.0"/>
|
||||
</LinearGradientBrush>
|
||||
<SolidColorBrush x:Key="ComboBox.MouseOver.Editable.Button.Border" Color="White"/>
|
||||
<SolidColorBrush x:Key="ComboBox.Pressed.Glyph" Color="#FF000000"/>
|
||||
<LinearGradientBrush x:Key="ComboBox.Pressed.Background" EndPoint="0,1" StartPoint="0,0">
|
||||
<GradientStop Color="White" Offset="0.0"/>
|
||||
<GradientStop Color="White" Offset="1.0"/>
|
||||
</LinearGradientBrush>
|
||||
<SolidColorBrush x:Key="ComboBox.Pressed.Border" Color="White"/>
|
||||
<SolidColorBrush x:Key="ComboBox.Pressed.Editable.Background" Color="#FFFFFFFF"/>
|
||||
<SolidColorBrush x:Key="ComboBox.Pressed.Editable.Border" Color="White"/>
|
||||
<LinearGradientBrush x:Key="ComboBox.Pressed.Editable.Button.Background" EndPoint="0,1" StartPoint="0,0">
|
||||
<GradientStop Color="#FFDAEBFC" Offset="0.0"/>
|
||||
<GradientStop Color="#FFC4E0FC" Offset="1.0"/>
|
||||
</LinearGradientBrush>
|
||||
<SolidColorBrush x:Key="ComboBox.Pressed.Editable.Button.Border" Color="#FF569DE5"/>
|
||||
<SolidColorBrush x:Key="ComboBox.Disabled.Glyph" Color="#FFBFBFBF"/>
|
||||
<SolidColorBrush x:Key="ComboBox.Disabled.Background" Color="#FFF0F0F0"/>
|
||||
<SolidColorBrush x:Key="ComboBox.Disabled.Border" Color="#FFD9D9D9"/>
|
||||
<SolidColorBrush x:Key="ComboBox.Disabled.Editable.Background" Color="#FFFFFFFF"/>
|
||||
<SolidColorBrush x:Key="ComboBox.Disabled.Editable.Border" Color="#FFBFBFBF"/>
|
||||
<SolidColorBrush x:Key="ComboBox.Disabled.Editable.Button.Background" Color="Transparent"/>
|
||||
<SolidColorBrush x:Key="ComboBox.Disabled.Editable.Button.Border" Color="Transparent"/>
|
||||
<SolidColorBrush x:Key="ComboBox.Static.Glyph" Color="#FF606060"/>
|
||||
<Style x:Key="ComboBoxToggleButton" TargetType="{x:Type ToggleButton}">
|
||||
<Setter Property="OverridesDefaultStyle" Value="true"/>
|
||||
<Setter Property="IsTabStop" Value="false"/>
|
||||
<Setter Property="Focusable" Value="false"/>
|
||||
<Setter Property="ClickMode" Value="Press"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type ToggleButton}">
|
||||
<Border x:Name="templateRoot"
|
||||
BorderBrush="{StaticResource ComboBox.Static.Border}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
Background="{StaticResource ComboBox.Static.Background}"
|
||||
SnapsToDevicePixels="true">
|
||||
<Border x:Name="splitBorder" BorderBrush="Transparent" BorderThickness="1" HorizontalAlignment="Right" Margin="0" SnapsToDevicePixels="true" Width="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}">
|
||||
<Path x:Name="arrow" Data="F1 M 0,0 L 2.667,2.66665 L 5.3334,0 L 5.3334,-1.78168 L 2.6667,0.88501 L0,-1.78168 L0,0 Z" Fill="{StaticResource ComboBox.Static.Glyph}" HorizontalAlignment="Center" Margin="0" VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<MultiDataTrigger>
|
||||
<MultiDataTrigger.Conditions>
|
||||
<Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="true"/>
|
||||
<Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="false"/>
|
||||
<Condition Binding="{Binding IsPressed, RelativeSource={RelativeSource Self}}" Value="false"/>
|
||||
<Condition Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}" Value="true"/>
|
||||
</MultiDataTrigger.Conditions>
|
||||
<Setter Property="Background" TargetName="templateRoot" Value="{StaticResource ComboBox.Static.Editable.Background}"/>
|
||||
<Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.Static.Editable.Border}"/>
|
||||
<Setter Property="Background" TargetName="splitBorder" Value="{StaticResource ComboBox.Static.Editable.Button.Background}"/>
|
||||
<Setter Property="BorderBrush" TargetName="splitBorder" Value="{StaticResource ComboBox.Static.Editable.Button.Border}"/>
|
||||
</MultiDataTrigger>
|
||||
<Trigger Property="IsMouseOver" Value="true">
|
||||
<Setter Property="Fill" TargetName="arrow" Value="{StaticResource ComboBox.MouseOver.Glyph}"/>
|
||||
</Trigger>
|
||||
<MultiDataTrigger>
|
||||
<MultiDataTrigger.Conditions>
|
||||
<Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="true"/>
|
||||
<Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="false"/>
|
||||
</MultiDataTrigger.Conditions>
|
||||
<Setter Property="Background" TargetName="templateRoot" Value="{StaticResource ComboBox.MouseOver.Background}"/>
|
||||
<Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.MouseOver.Border}"/>
|
||||
</MultiDataTrigger>
|
||||
<MultiDataTrigger>
|
||||
<MultiDataTrigger.Conditions>
|
||||
<Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="true"/>
|
||||
<Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="true"/>
|
||||
</MultiDataTrigger.Conditions>
|
||||
<Setter Property="Background" TargetName="templateRoot" Value="{StaticResource ComboBox.MouseOver.Editable.Background}"/>
|
||||
<Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.MouseOver.Editable.Border}"/>
|
||||
<Setter Property="Background" TargetName="splitBorder" Value="{StaticResource ComboBox.MouseOver.Editable.Button.Background}"/>
|
||||
<Setter Property="BorderBrush" TargetName="splitBorder" Value="{StaticResource ComboBox.MouseOver.Editable.Button.Border}"/>
|
||||
</MultiDataTrigger>
|
||||
<Trigger Property="IsPressed" Value="true">
|
||||
<Setter Property="Fill" TargetName="arrow" Value="{StaticResource ComboBox.Pressed.Glyph}"/>
|
||||
</Trigger>
|
||||
<MultiDataTrigger>
|
||||
<MultiDataTrigger.Conditions>
|
||||
<Condition Binding="{Binding IsPressed, RelativeSource={RelativeSource Self}}" Value="true"/>
|
||||
<Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="false"/>
|
||||
</MultiDataTrigger.Conditions>
|
||||
<Setter Property="Background" TargetName="templateRoot" Value="{StaticResource ComboBox.Pressed.Background}"/>
|
||||
<Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.Pressed.Border}"/>
|
||||
</MultiDataTrigger>
|
||||
<MultiDataTrigger>
|
||||
<MultiDataTrigger.Conditions>
|
||||
<Condition Binding="{Binding IsPressed, RelativeSource={RelativeSource Self}}" Value="true"/>
|
||||
<Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="true"/>
|
||||
</MultiDataTrigger.Conditions>
|
||||
<Setter Property="Background" TargetName="templateRoot" Value="{StaticResource ComboBox.Pressed.Editable.Background}"/>
|
||||
<Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.Pressed.Editable.Border}"/>
|
||||
<Setter Property="Background" TargetName="splitBorder" Value="{StaticResource ComboBox.Pressed.Editable.Button.Background}"/>
|
||||
<Setter Property="BorderBrush" TargetName="splitBorder" Value="{StaticResource ComboBox.Pressed.Editable.Button.Border}"/>
|
||||
</MultiDataTrigger>
|
||||
<Trigger Property="IsEnabled" Value="false">
|
||||
<Setter Property="Fill" TargetName="arrow" Value="{StaticResource ComboBox.Disabled.Glyph}"/>
|
||||
</Trigger>
|
||||
<MultiDataTrigger>
|
||||
<MultiDataTrigger.Conditions>
|
||||
<Condition Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}" Value="false"/>
|
||||
<Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="false"/>
|
||||
</MultiDataTrigger.Conditions>
|
||||
<Setter Property="Background" TargetName="templateRoot" Value="{StaticResource ComboBox.Disabled.Background}"/>
|
||||
<Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.Disabled.Border}"/>
|
||||
</MultiDataTrigger>
|
||||
<MultiDataTrigger>
|
||||
<MultiDataTrigger.Conditions>
|
||||
<Condition Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}" Value="false"/>
|
||||
<Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="true"/>
|
||||
</MultiDataTrigger.Conditions>
|
||||
<Setter Property="Background" TargetName="templateRoot" Value="{StaticResource ComboBox.Disabled.Editable.Background}"/>
|
||||
<Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.Disabled.Editable.Border}"/>
|
||||
<Setter Property="Background" TargetName="splitBorder" Value="{StaticResource ComboBox.Disabled.Editable.Button.Background}"/>
|
||||
<Setter Property="BorderBrush" TargetName="splitBorder" Value="{StaticResource ComboBox.Disabled.Editable.Button.Border}"/>
|
||||
</MultiDataTrigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<ControlTemplate x:Key="ComboBoxTemplate" TargetType="{x:Type ComboBox}">
|
||||
<Grid x:Name="templateRoot" SnapsToDevicePixels="true">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition MinWidth="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" Width="0"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Popup x:Name="PART_Popup" AllowsTransparency="true" Grid.ColumnSpan="2" IsOpen="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Margin="1" PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}" Placement="Bottom">
|
||||
<Themes:SystemDropShadowChrome x:Name="shadow"
|
||||
Color="Transparent"
|
||||
MaxHeight="{TemplateBinding MaxDropDownHeight}"
|
||||
MinWidth="{Binding ActualWidth, ElementName=templateRoot}">
|
||||
<Border x:Name="dropDownBorder"
|
||||
BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}"
|
||||
BorderThickness="1"
|
||||
Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}">
|
||||
<ScrollViewer x:Name="DropDownScrollViewer">
|
||||
<Grid x:Name="grid" RenderOptions.ClearTypeHint="Enabled">
|
||||
<Canvas x:Name="canvas"
|
||||
HorizontalAlignment="Left"
|
||||
Height="0"
|
||||
VerticalAlignment="Top"
|
||||
Width="0">
|
||||
<Rectangle x:Name="opaqueRect"
|
||||
Fill="{Binding Background, ElementName=dropDownBorder}"
|
||||
Height="{Binding ActualHeight, ElementName=dropDownBorder}"
|
||||
Width="{Binding ActualWidth, ElementName=dropDownBorder}"/>
|
||||
</Canvas>
|
||||
<ItemsPresenter x:Name="ItemsPresenter"
|
||||
KeyboardNavigation.DirectionalNavigation="Contained"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
</Themes:SystemDropShadowChrome>
|
||||
</Popup>
|
||||
<ToggleButton x:Name="toggleButton" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Grid.ColumnSpan="2" IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Style="{StaticResource ComboBoxToggleButton}"/>
|
||||
<ContentPresenter x:Name="contentPresenter"
|
||||
ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
|
||||
ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
|
||||
Content="{TemplateBinding SelectionBoxItem}"
|
||||
ContentStringFormat="{TemplateBinding SelectionBoxItemStringFormat}"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
IsHitTestVisible="false" Margin="{TemplateBinding Padding}"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="HasDropShadow" SourceName="PART_Popup" Value="true">
|
||||
<Setter Property="Margin" TargetName="shadow" Value="0,0,5,5"/>
|
||||
<Setter Property="Color" TargetName="shadow" Value="#71000000"/>
|
||||
</Trigger>
|
||||
<Trigger Property="HasItems" Value="false">
|
||||
<Setter Property="Height" TargetName="dropDownBorder" Value="95"/>
|
||||
</Trigger>
|
||||
<MultiTrigger>
|
||||
<MultiTrigger.Conditions>
|
||||
<Condition Property="IsGrouping" Value="true"/>
|
||||
<Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false"/>
|
||||
</MultiTrigger.Conditions>
|
||||
<Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
|
||||
</MultiTrigger>
|
||||
<Trigger Property="ScrollViewer.CanContentScroll" SourceName="DropDownScrollViewer" Value="false">
|
||||
<Setter Property="Canvas.Top" TargetName="opaqueRect" Value="{Binding VerticalOffset, ElementName=DropDownScrollViewer}"/>
|
||||
<Setter Property="Canvas.Left" TargetName="opaqueRect" Value="{Binding HorizontalOffset, ElementName=DropDownScrollViewer}"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
<SolidColorBrush x:Key="TextBox.Static.Background" Color="#FFFFFFFF"/>
|
||||
<Style x:Key="ComboBoxEditableTextBox" TargetType="{x:Type TextBox}">
|
||||
<Setter Property="OverridesDefaultStyle" Value="true"/>
|
||||
<Setter Property="AllowDrop" Value="true"/>
|
||||
<Setter Property="MinWidth" Value="0"/>
|
||||
<Setter Property="MinHeight" Value="0"/>
|
||||
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
|
||||
<Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst"/>
|
||||
<Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type TextBox}">
|
||||
<ScrollViewer x:Name="PART_ContentHost"
|
||||
Background="Transparent"
|
||||
Focusable="false"
|
||||
HorizontalScrollBarVisibility="Hidden"
|
||||
VerticalScrollBarVisibility="Hidden"/>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<ControlTemplate x:Key="ComboBoxEditableTemplate" TargetType="{x:Type ComboBox}">
|
||||
<Grid x:Name="templateRoot" SnapsToDevicePixels="true">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition MinWidth="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" Width="0"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Popup x:Name="PART_Popup" AllowsTransparency="true" Grid.ColumnSpan="2" IsOpen="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}}" PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}" Placement="Bottom">
|
||||
<Themes:SystemDropShadowChrome x:Name="shadow" Color="Transparent" MaxHeight="{TemplateBinding MaxDropDownHeight}" MinWidth="{Binding ActualWidth, ElementName=templateRoot}">
|
||||
<Border x:Name="dropDownBorder" BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}" BorderThickness="1" Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}">
|
||||
<ScrollViewer x:Name="DropDownScrollViewer">
|
||||
<Grid x:Name="grid" RenderOptions.ClearTypeHint="Enabled">
|
||||
<Canvas x:Name="canvas" HorizontalAlignment="Left" Height="0" VerticalAlignment="Top" Width="0">
|
||||
<Rectangle x:Name="opaqueRect" Fill="{Binding Background, ElementName=dropDownBorder}" Height="{Binding ActualHeight, ElementName=dropDownBorder}" Width="{Binding ActualWidth, ElementName=dropDownBorder}"/>
|
||||
</Canvas>
|
||||
<ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Contained" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
</Themes:SystemDropShadowChrome>
|
||||
</Popup>
|
||||
<ToggleButton x:Name="toggleButton" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Grid.ColumnSpan="2" IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Style="{StaticResource ComboBoxToggleButton}"/>
|
||||
<Border x:Name="border"
|
||||
Background="{StaticResource TextBox.Static.Background}"
|
||||
Margin="{TemplateBinding BorderThickness}">
|
||||
<TextBox x:Name="PART_EditableTextBox"
|
||||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
IsReadOnly="{Binding IsReadOnly, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
Style="{StaticResource ComboBoxEditableTextBox}"
|
||||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
|
||||
</Border>
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsEnabled" Value="false">
|
||||
<Setter Property="Opacity" TargetName="border" Value="0.56"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsKeyboardFocusWithin" Value="true">
|
||||
<Setter Property="Foreground" Value="Black"/>
|
||||
</Trigger>
|
||||
<Trigger Property="HasDropShadow" SourceName="PART_Popup" Value="true">
|
||||
<Setter Property="Margin" TargetName="shadow" Value="0,0,5,5"/>
|
||||
<Setter Property="Color" TargetName="shadow" Value="#71000000"/>
|
||||
</Trigger>
|
||||
<Trigger Property="HasItems" Value="false">
|
||||
<Setter Property="Height" TargetName="dropDownBorder" Value="95"/>
|
||||
</Trigger>
|
||||
<MultiTrigger>
|
||||
<MultiTrigger.Conditions>
|
||||
<Condition Property="IsGrouping" Value="true"/>
|
||||
<Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false"/>
|
||||
</MultiTrigger.Conditions>
|
||||
<Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
|
||||
</MultiTrigger>
|
||||
<Trigger Property="ScrollViewer.CanContentScroll" SourceName="DropDownScrollViewer" Value="false">
|
||||
<Setter Property="Canvas.Top" TargetName="opaqueRect" Value="{Binding VerticalOffset, ElementName=DropDownScrollViewer}"/>
|
||||
<Setter Property="Canvas.Left" TargetName="opaqueRect" Value="{Binding HorizontalOffset, ElementName=DropDownScrollViewer}"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
<Style x:Key="ComboBoxStyle" TargetType="{x:Type ComboBox}">
|
||||
<Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/>
|
||||
<Setter Property="Background" Value="{StaticResource ComboBox.Static.Background}"/>
|
||||
<Setter Property="BorderBrush" Value="{StaticResource ComboBox.Static.Border}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
|
||||
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
|
||||
<Setter Property="Padding" Value="6,3,5,3"/>
|
||||
<Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
|
||||
<Setter Property="ScrollViewer.PanningMode" Value="Both"/>
|
||||
<Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
|
||||
<Setter Property="Template" Value="{StaticResource ComboBoxTemplate}"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsEditable" Value="true">
|
||||
<Setter Property="IsTabStop" Value="false"/>
|
||||
<Setter Property="Padding" Value="2"/>
|
||||
<Setter Property="Template" Value="{StaticResource ComboBoxEditableTemplate}"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
<Style x:Key="TreeViewItemFocusVisual">
|
||||
<Setter Property="Control.Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate>
|
||||
<Rectangle/>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<SolidColorBrush x:Key="TreeViewItem.TreeArrow.Static.Checked.Fill" Color="#FF595959"/>
|
||||
<SolidColorBrush x:Key="TreeViewItem.TreeArrow.Static.Checked.Stroke" Color="#FF262626"/>
|
||||
<SolidColorBrush x:Key="TreeViewItem.TreeArrow.MouseOver.Stroke" Color="#FF27C7F7"/>
|
||||
<SolidColorBrush x:Key="TreeViewItem.TreeArrow.MouseOver.Fill" Color="#FFCCEEFB"/>
|
||||
<SolidColorBrush x:Key="TreeViewItem.TreeArrow.MouseOver.Checked.Stroke" Color="#FF1CC4F7"/>
|
||||
<SolidColorBrush x:Key="TreeViewItem.TreeArrow.MouseOver.Checked.Fill" Color="#FF82DFFB"/>
|
||||
<PathGeometry x:Key="TreeArrow" Figures="M0,0 L0,6 L6,0 z"/>
|
||||
<SolidColorBrush x:Key="TreeViewItem.TreeArrow.Static.Fill" Color="#FFFFFFFF"/>
|
||||
<SolidColorBrush x:Key="TreeViewItem.TreeArrow.Static.Stroke" Color="#FF818181"/>
|
||||
<Style x:Key="ExpandCollapseToggleStyle" TargetType="{x:Type ToggleButton}">
|
||||
<Setter Property="Focusable" Value="False"/>
|
||||
<Setter Property="Width" Value="16"/>
|
||||
<Setter Property="Height" Value="16"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type ToggleButton}">
|
||||
<Border Background="Transparent" Height="16" Padding="5,5,5,5" Width="16">
|
||||
<Path x:Name="ExpandPath" Data="{StaticResource TreeArrow}" Fill="{StaticResource TreeViewItem.TreeArrow.Static.Fill}" Stroke="{StaticResource TreeViewItem.TreeArrow.Static.Stroke}">
|
||||
<Path.RenderTransform>
|
||||
<RotateTransform Angle="135" CenterY="3" CenterX="3"/>
|
||||
</Path.RenderTransform>
|
||||
</Path>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsChecked" Value="True">
|
||||
<Setter Property="RenderTransform" TargetName="ExpandPath">
|
||||
<Setter.Value>
|
||||
<RotateTransform Angle="180" CenterY="3" CenterX="3"/>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="Fill" TargetName="ExpandPath" Value="{StaticResource TreeViewItem.TreeArrow.Static.Checked.Fill}"/>
|
||||
<Setter Property="Stroke" TargetName="ExpandPath" Value="{StaticResource TreeViewItem.TreeArrow.Static.Checked.Stroke}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Stroke" TargetName="ExpandPath" Value="{StaticResource TreeViewItem.TreeArrow.MouseOver.Stroke}"/>
|
||||
<Setter Property="Fill" TargetName="ExpandPath" Value="{StaticResource TreeViewItem.TreeArrow.MouseOver.Fill}"/>
|
||||
</Trigger>
|
||||
<MultiTrigger>
|
||||
<MultiTrigger.Conditions>
|
||||
<Condition Property="IsMouseOver" Value="True"/>
|
||||
<Condition Property="IsChecked" Value="True"/>
|
||||
</MultiTrigger.Conditions>
|
||||
<Setter Property="Stroke" TargetName="ExpandPath" Value="{StaticResource TreeViewItem.TreeArrow.MouseOver.Checked.Stroke}"/>
|
||||
<Setter Property="Fill" TargetName="ExpandPath" Value="{StaticResource TreeViewItem.TreeArrow.MouseOver.Checked.Fill}"/>
|
||||
</MultiTrigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<Style x:Key="TreeViewItemWithValueStyle" TargetType="{x:Type TreeViewItem}">
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
|
||||
<Setter Property="Padding" Value="1,0,0,0"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
|
||||
<Setter Property="FocusVisualStyle" Value="{StaticResource TreeViewItemFocusVisual}"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type TreeViewItem}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition MinWidth="19" Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<ToggleButton x:Name="Expander" ClickMode="Press" IsChecked="{Binding IsExpanded, RelativeSource={RelativeSource TemplatedParent}}" Style="{StaticResource ExpandCollapseToggleStyle}"/>
|
||||
<Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Grid.Column="1" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
|
||||
<ContentPresenter x:Name="PART_Header" ContentSource="Header" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
|
||||
</Border>
|
||||
<ItemsPresenter x:Name="ItemsHost" Grid.ColumnSpan="2" Grid.Column="1" Grid.Row="1"/>
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsExpanded" Value="false">
|
||||
<Setter Property="Visibility" TargetName="ItemsHost" Value="Collapsed"/>
|
||||
</Trigger>
|
||||
<Trigger Property="HasItems" Value="false">
|
||||
<Setter Property="Visibility" TargetName="Expander" Value="Hidden"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsSelected" Value="true">
|
||||
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}"/>
|
||||
</Trigger>
|
||||
<MultiTrigger>
|
||||
<MultiTrigger.Conditions>
|
||||
<Condition Property="IsSelected" Value="true"/>
|
||||
<Condition Property="IsSelectionActive" Value="false"/>
|
||||
</MultiTrigger.Conditions>
|
||||
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightBrushKey}}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightTextBrushKey}}"/>
|
||||
</MultiTrigger>
|
||||
<Trigger Property="IsEnabled" Value="false">
|
||||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="VirtualizingPanel.IsVirtualizing" Value="true">
|
||||
<Setter Property="ItemsPanel">
|
||||
<Setter.Value>
|
||||
<ItemsPanelTemplate>
|
||||
<VirtualizingStackPanel/>
|
||||
</ItemsPanelTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Page.Resources>
|
||||
<Page.DataContext>
|
||||
<VM:EregisterVM />
|
||||
</Page.DataContext>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Controls:MainMenu Grid.Row="0" />
|
||||
<Border BorderBrush="LightGray"
|
||||
BorderThickness="0, 0, 0, 1"
|
||||
Grid.Row="1">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Column="0" Orientation="Horizontal">
|
||||
<ComboBox HorizontalAlignment="Left"
|
||||
IsEnabled="{Binding IsConnectEnabled}"
|
||||
ItemsSource="{Binding COMPorts}"
|
||||
Margin="5"
|
||||
Padding="3"
|
||||
SelectedItem="{Binding COMPort}"
|
||||
Style="{DynamicResource ComboBoxStyle}"
|
||||
VerticalAlignment="Stretch"
|
||||
Width="80" />
|
||||
<Button Background="White"
|
||||
BorderBrush="#FFC0C0C0"
|
||||
Command="{Binding ConnectCommand}"
|
||||
Content="Connect"
|
||||
HorizontalAlignment="Left"
|
||||
Visibility="{Binding IsConnectEnabled, Converter={StaticResource BooleanToVisibility}}"
|
||||
Margin="0, 5, 5, 5"
|
||||
Padding="15, 0"
|
||||
VerticalAlignment="Stretch" />
|
||||
<Button Background="White"
|
||||
BorderBrush="#FFC0C0C0"
|
||||
Command="{Binding DisconnectCommand}"
|
||||
Content="Disconnect"
|
||||
HorizontalAlignment="Left"
|
||||
Visibility="{Binding IsDisconnectEnabled, Converter={StaticResource BooleanToVisibility}}"
|
||||
Margin="0, 5, 5, 5"
|
||||
Padding="15, 0"
|
||||
VerticalAlignment="Stretch" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="2" Orientation="Horizontal">
|
||||
<Label Content="{Binding SirtId}"
|
||||
FontSize="11"
|
||||
FontWeight="bold"
|
||||
Margin="5"
|
||||
Padding="0"
|
||||
VerticalAlignment="Stretch"
|
||||
VerticalContentAlignment="Center"/>
|
||||
<Label Content="{Binding Frequency}"
|
||||
FontSize="11"
|
||||
FontWeight="bold"
|
||||
Margin="0, 5, 5, 5"
|
||||
Padding="0"
|
||||
VerticalAlignment="Stretch"
|
||||
VerticalContentAlignment="Center" />
|
||||
<Border Background="{Binding IsConnected, Converter={StaticResource BooleanToBackground}}"
|
||||
BorderBrush="{Binding IsConnected, Converter={StaticResource BooleanToBorder}}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="7"
|
||||
Height="14"
|
||||
Margin="5, 5, 15, 5"
|
||||
VerticalAlignment="Center"
|
||||
Width="14"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
<Grid Grid.Row="2" Visibility="{Binding IsConnected, Converter={StaticResource BooleanToVisibility}}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition MinWidth="100" Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="1*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="1*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid Grid.Column="0"
|
||||
Visibility="{Binding IsConnected, Converter={StaticResource BooleanToVisibility}}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Label Background="LightGray"
|
||||
Content="{Binding AddressesCount}"
|
||||
FontSize="12"
|
||||
FontWeight="Bold"
|
||||
Grid.Row="0"
|
||||
Margin="0"
|
||||
Padding="10, 5, 25, 5"/>
|
||||
<ScrollViewer Grid.Row="1"
|
||||
HorizontalScrollBarVisibility="Hidden"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
<ItemsControl ItemsSource="{Binding Addresses}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<RadioButton Command="{Binding Path=DataContext.PickAddressCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Page}}}"
|
||||
CommandParameter="{Binding .}"
|
||||
Content="{Binding .}"
|
||||
FontSize="12"
|
||||
FontWeight="Bold"
|
||||
Foreground="DimGray"
|
||||
GroupName="addresses"
|
||||
HorizontalAlignment="Stretch"
|
||||
HorizontalContentAlignment="Left"
|
||||
Margin="5, 0, 0, 0"
|
||||
Padding="10, 3, 25, 3"
|
||||
VerticalAlignment="Top"
|
||||
VerticalContentAlignment="Center"/>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
<GridSplitter BorderBrush="LightGray"
|
||||
BorderThickness="1, 0, 1, 0"
|
||||
Grid.Column="1"
|
||||
ResizeBehavior="PreviousAndNext"
|
||||
ResizeDirection="Columns"
|
||||
Width="3" />
|
||||
<Grid Grid.Column="2"
|
||||
Visibility="{Binding AddressSelected, Converter={StaticResource BooleanToVisibility}}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Label Background="LightGray"
|
||||
Content="{Binding Address}"
|
||||
FontSize="12"
|
||||
FontWeight="Bold"
|
||||
Grid.Row="0"
|
||||
HorizontalAlignment="Stretch"
|
||||
HorizontalContentAlignment="Stretch"
|
||||
Margin="0"
|
||||
Padding="10, 5, 10, 5">
|
||||
<Label.ContentTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Column="0"
|
||||
Margin="0"
|
||||
Padding="0"
|
||||
Text="{Binding .}" />
|
||||
<Path Cursor="Hand"
|
||||
Fill="Red"
|
||||
Grid.Column="1"
|
||||
Height="12"
|
||||
Stretch="Uniform"
|
||||
Width="12">
|
||||
<Path.Data>
|
||||
<GeometryGroup>
|
||||
<PathGeometry Figures="M6.5 1h3a.5.5 0 0 1 .5.5v1H6v-1a.5.5 0 0 1 .5-.5M11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3A1.5 1.5 0 0 0 5 1.5v1H1.5a.5.5 0 0 0 0 1h.538l.853 10.66A2 2 0 0 0 4.885 16h6.23a2 2 0 0 0 1.994-1.84l.853-10.66h.538a.5.5 0 0 0 0-1zm1.958 1-.846 10.58a1 1 0 0 1-.997.92h-6.23a1 1 0 0 1-.997-.92L3.042 3.5zm-7.487 1a.5.5 0 0 1 .528.47l.5 8.5a.5.5 0 0 1-.998.06L5 5.03a.5.5 0 0 1 .47-.53Zm5.058 0a.5.5 0 0 1 .47.53l-.5 8.5a.5.5 0 1 1-.998-.06l.5-8.5a.5.5 0 0 1 .528-.47M8 4.5a.5.5 0 0 1 .5.5v8.5a.5.5 0 0 1-1 0V5a.5.5 0 0 1 .5-.5" />
|
||||
</GeometryGroup>
|
||||
</Path.Data>
|
||||
<Path.InputBindings>
|
||||
<MouseBinding Command="{Binding Path=DataContext.RemoveAddressCommand
|
||||
, RelativeSource={RelativeSource Mode=FindAncestor
|
||||
, AncestorType={x:Type Page}}}"
|
||||
MouseAction="LeftClick" />
|
||||
</Path.InputBindings>
|
||||
</Path>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</Label.ContentTemplate>
|
||||
</Label>
|
||||
<ScrollViewer Grid.Row="1"
|
||||
HorizontalScrollBarVisibility="Hidden"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
<ItemsControl ItemsSource="{Binding EregisterProperties}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type VM:KvpViewModel}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="210" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Label BorderBrush="LightGray"
|
||||
BorderThickness="0, 0, 1, 1"
|
||||
Content="{Binding Key}"
|
||||
FontSize="12"
|
||||
FontWeight="Bold"
|
||||
Grid.Column="0"
|
||||
Grid.Row="{Binding Row}"
|
||||
Margin="0"
|
||||
Padding="10, 5"/>
|
||||
<Label BorderBrush="LightGray"
|
||||
BorderThickness="0, 0, 0, 1"
|
||||
Content="{Binding Value}"
|
||||
FontSize="12"
|
||||
FontWeight="Bold"
|
||||
Grid.Column="1"
|
||||
Grid.Row="{Binding Row}"
|
||||
Margin="0"
|
||||
Padding="10, 5" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
<GridSplitter BorderBrush="LightGray"
|
||||
BorderThickness="1, 0, 1, 0"
|
||||
Grid.Column="3"
|
||||
ResizeBehavior="PreviousAndNext"
|
||||
ResizeDirection="Columns"
|
||||
Width="3" />
|
||||
<Grid Grid.Column="4"
|
||||
Visibility="{Binding AddressSelected, Converter={StaticResource BooleanToVisibility}}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Button Command="{Binding StartProgrammingCommand}"
|
||||
Content="Start programming"
|
||||
Grid.Row="0"
|
||||
HorizontalAlignment="Left"
|
||||
Padding="30, 5"/>
|
||||
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Page>
|
||||
@@ -1,9 +0,0 @@
|
||||
namespace Common.UI.Pages
|
||||
{
|
||||
using System.Windows.Controls;
|
||||
|
||||
public partial class Eregister : Page
|
||||
{
|
||||
public Eregister() => this.InitializeComponent();
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,6 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:Controls="clr-namespace:Common.UI.Controls"
|
||||
xmlns:VM="clr-namespace:Common.UI.ViewModels"
|
||||
xmlns:V="clr-namespace:Common.UI.Views"
|
||||
WindowTitle="TestBench UI / Eregister finalize">
|
||||
<Page.DataContext>
|
||||
<VM:EregisterFinalizeVM />
|
||||
@@ -14,7 +13,7 @@
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<V:SIRTBroadcasters Grid.Row="0" />
|
||||
<Controls:SIRTBroadcasters Grid.Row="0" />
|
||||
<ScrollViewer Grid.Row="1"
|
||||
HorizontalAlignment="Stretch"
|
||||
HorizontalScrollBarVisibility="Disabled"
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:Controls="clr-namespace:Common.UI.Controls"
|
||||
xmlns:VM="clr-namespace:Common.UI.ViewModels"
|
||||
xmlns:V="clr-namespace:Common.UI.Views"
|
||||
WindowTitle="TestBench UI / Eregister initialize">
|
||||
<Page.DataContext>
|
||||
<VM:EregisterInitializeVM />
|
||||
@@ -14,7 +13,7 @@
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<V:SIRTBroadcasters Background="#FFF0F0F0" Grid.Row="0" />
|
||||
<Controls:SIRTBroadcasters Background="#FFF0F0F0" Grid.Row="0" />
|
||||
<ScrollViewer Grid.Row="1"
|
||||
HorizontalAlignment="Stretch"
|
||||
HorizontalScrollBarVisibility="Disabled"
|
||||
|
||||
@@ -1,104 +0,0 @@
|
||||
<Page x:Class="Common.UI.EregisterManuelProgramming"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:Controls="clr-namespace:Common.UI.Controls"
|
||||
xmlns:VM="clr-namespace:Common.UI.ViewModels"
|
||||
xmlns:v="clr-namespace:Common.UI.Views">
|
||||
<Page.DataContext>
|
||||
<VM:EregisterInitializeVM />
|
||||
</Page.DataContext>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<v:SIRTBroadcasters Grid.Row="0" />
|
||||
<ScrollViewer Grid.Row="1" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
|
||||
<Controls:GridLayout ItemsSource="{Binding ProgrammingTasks}">
|
||||
<Controls:GridLayout.Resources>
|
||||
<DataTemplate DataType="{x:Type VM:EregisterTaskVM}" >
|
||||
<Border Background="{Binding Label, Converter={StaticResource TaskStateToBG}}"
|
||||
BorderBrush="{Binding Label, Converter={StaticResource TaskStateToFG}}"
|
||||
BorderThickness="1"
|
||||
Margin="5, 5, 0, 0"
|
||||
Padding="5">
|
||||
<Grid MinHeight="70">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock FontFamily="Consolas"
|
||||
FontSize="11"
|
||||
FontWeight="Bold"
|
||||
Foreground="{Binding Label, Converter={StaticResource TaskStateToFG}}"
|
||||
Grid.Row="0"
|
||||
Margin="0, 0, 0, 0" >
|
||||
<Run Text="{Binding SlotNr, StringFormat='EP:{0}'}" />
|
||||
<Run Text="{Binding PoNr, StringFormat='FA:{0}'}" />
|
||||
<Run Text="{Binding SerialNr, StringFormat='SN:{0}'}" />
|
||||
</TextBlock>
|
||||
<TextBlock FontFamily="Consolas"
|
||||
FontSize="11"
|
||||
FontWeight="Bold"
|
||||
Foreground="{Binding Label, Converter={StaticResource TaskStateToFG}}"
|
||||
Grid.Row="1"
|
||||
Margin="0, 5, 0, 0" >
|
||||
<Run FontWeight="Bold" Text="{Binding Address, StringFormat='RA:{0}'}" />
|
||||
<Run Text="{Binding Name}" />
|
||||
</TextBlock>
|
||||
<TextBlock FontFamily="Consolas"
|
||||
FontSize="11"
|
||||
FontWeight="Bold"
|
||||
Foreground="{Binding Label, Converter={StaticResource TaskStateToFG}}"
|
||||
Grid.Row="2"
|
||||
Margin="0, 5, 0, 0" >
|
||||
<Run Text="{Binding Frequency, StringFormat='RF:{0}MHz'}" />
|
||||
<Run Text="{Binding RSSI, StringFormat='RSSI:{0}'}" />
|
||||
</TextBlock>
|
||||
<TextBlock FontFamily="Consolas"
|
||||
FontSize="14"
|
||||
FontWeight="Bold"
|
||||
Foreground="{Binding Label, Converter={StaticResource TaskStateToFG}}"
|
||||
Grid.Row="3"
|
||||
Margin="0, 5, 0, 0" >
|
||||
<Run Text="{Binding Label}" />
|
||||
</TextBlock>
|
||||
</Grid>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</Controls:GridLayout.Resources>
|
||||
</Controls:GridLayout>
|
||||
</ScrollViewer>
|
||||
<Border BorderBrush="LightGray"
|
||||
BorderThickness="0, 1, 0, 0"
|
||||
Grid.Row="2" >
|
||||
<StackPanel Orientation="Horizontal" Margin="5">
|
||||
<Button Content="Start Programming"
|
||||
Command="{Binding StartProgrammingCommand}"
|
||||
Grid.Row="2"
|
||||
HorizontalAlignment="Left"
|
||||
IsEnabled="{Binding StartEnabled}"
|
||||
Margin="0, 0, 5, 0"
|
||||
Padding="20, 3"/>
|
||||
<Button Content="Stop Programming"
|
||||
Command="{Binding StopProgrammingCommand}"
|
||||
Grid.Row="2"
|
||||
HorizontalAlignment="Left"
|
||||
IsEnabled="{Binding StopEnabled}"
|
||||
Margin="0, 0, 5, 0"
|
||||
Padding="20, 3"/>
|
||||
<Label FontWeight="Bold"
|
||||
HorizontalAlignment="Stretch"
|
||||
HorizontalContentAlignment="Center"
|
||||
Margin="0"
|
||||
Padding="10, 0"
|
||||
Content="{Binding TimeElapsed}"
|
||||
VerticalAlignment="Stretch"
|
||||
VerticalContentAlignment="Center" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Page>
|
||||
@@ -1,9 +0,0 @@
|
||||
namespace Common.UI
|
||||
{
|
||||
using System.Windows.Controls;
|
||||
|
||||
public partial class EregisterManuelProgramming : Page
|
||||
{
|
||||
public EregisterManuelProgramming() => this.InitializeComponent();
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
<Page x:Class="Common.UI.Pages.Settings"
|
||||
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"
|
||||
xmlns:Controls="clr-namespace:Common.UI.Controls"
|
||||
WindowTitle="UI / Settings"
|
||||
Title="Settings">
|
||||
<Page.DataContext>
|
||||
<ViewModels:SettingsViewModel />
|
||||
</Page.DataContext>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Controls:MainMenu Grid.Row="0" />
|
||||
<Label Content="{Binding Id}" Grid.Row="1" />
|
||||
</Grid>
|
||||
</Page>
|
||||
@@ -1,9 +0,0 @@
|
||||
namespace Common.UI.Pages
|
||||
{
|
||||
using System.Windows.Controls;
|
||||
|
||||
public partial class Settings : Page
|
||||
{
|
||||
public Settings() => this.InitializeComponent();
|
||||
}
|
||||
}
|
||||
@@ -18,10 +18,12 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
|
||||
using SystemTimer = System.Timers.Timer;
|
||||
|
||||
internal class EregisterInitializeVM : ViewModel<EregisterInitializeVM>
|
||||
{
|
||||
private readonly ILogger logger;
|
||||
protected readonly System.Timers.Timer timer;
|
||||
protected readonly SystemTimer timer;
|
||||
protected readonly SIRTFactory sirtFactory;
|
||||
protected readonly EregisterFactory eregisterFactory;
|
||||
|
||||
@@ -33,7 +35,7 @@
|
||||
|
||||
public EregisterInitializeVM()
|
||||
{
|
||||
this.timer = new System.Timers.Timer
|
||||
this.timer = new SystemTimer
|
||||
{
|
||||
AutoReset = true,
|
||||
Enabled = false,
|
||||
@@ -88,10 +90,7 @@
|
||||
{
|
||||
if (int.TryParse($"{Appsettings.Get("PSNR")}", out var psnr))
|
||||
{
|
||||
this.sharedId = AuftragDbContext
|
||||
.P2000Shared
|
||||
.LoadPendingAction(psnr)
|
||||
?.Id ?? 0;
|
||||
this.sharedId = AuftragDbContext.P2000Shared.LoadPendingAction(psnr)?.Id ?? 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,18 +106,18 @@
|
||||
this.cancellationTokenSource = new CancellationTokenSource();
|
||||
this.cancellationToken = this.cancellationTokenSource.Token;
|
||||
this.programmingTask = Task
|
||||
.Run(async () =>
|
||||
{
|
||||
await this.PrepareProgrammingAsync();
|
||||
await this.eregisterFactory.StartProgrammingAsync(this.cancellationToken);
|
||||
})
|
||||
.ContinueWith(_ =>
|
||||
{
|
||||
this.timer.Stop();
|
||||
.Run(async () =>
|
||||
{
|
||||
await this.PrepareProgrammingAsync();
|
||||
await this.eregisterFactory.StartProgrammingAsync(this.cancellationToken);
|
||||
})
|
||||
.ContinueWith(_ =>
|
||||
{
|
||||
this.timer.Stop();
|
||||
|
||||
this.StartEnabled = true;
|
||||
this.StopEnabled = false;
|
||||
});
|
||||
this.StartEnabled = true;
|
||||
this.StopEnabled = false;
|
||||
});
|
||||
|
||||
this.timer.Start();
|
||||
}
|
||||
@@ -151,8 +150,29 @@
|
||||
|
||||
protected virtual async Task PrepareProgrammingAsync(Func<EregisterProgrammingParametersList, IEnumerable<IEnumerable<EregisterTask>>> taskSource = null)
|
||||
{
|
||||
var actions = AuftragDbContext.Eregister_Shared.LoadActions(this.sharedId);
|
||||
var parametersList = AuftragDbContext.LoadEregisterProgrammingParametersListForSharedId(this.sharedId);
|
||||
var actions = AuftragDbContext.Eregister_Shared.LoadActions(this.sharedId);
|
||||
|
||||
foreach (var eparameters in parametersList)
|
||||
{
|
||||
foreach (var action in actions)
|
||||
{
|
||||
if (action.SerialNr == eparameters.SerienNr)
|
||||
{
|
||||
if (eparameters.Adresse != action.FinalAddress)
|
||||
{
|
||||
eparameters.Adresse = action.FinalAddress;
|
||||
}
|
||||
|
||||
if (eparameters.TempAdresse != action.TempAddress)
|
||||
{
|
||||
eparameters.TempAdresse = action.TempAddress;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var uriFormat = Appsettings.Get("EncryptionKeisUrl");
|
||||
var httpClient = new HttpClient();
|
||||
|
||||
@@ -1,394 +0,0 @@
|
||||
namespace Common.UI.ViewModels
|
||||
{
|
||||
using Common.Hardware.Ports;
|
||||
using Common.Hardware.SIRT;
|
||||
using Common.Hardware.SIRT.Parameters;
|
||||
using Common.Hardware.WaterMeter.eRegister;
|
||||
using Common.Hardware.WaterMeter.eRegister.Features;
|
||||
using Common.Hardware.WaterMeter.eRegister.Models;
|
||||
using Common.UI.Infrastructure;
|
||||
using Common.UI.Models;
|
||||
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
|
||||
internal class EregisterVM : ViewModel<EregisterVM>
|
||||
{
|
||||
private readonly SIRTFactory sirtFactory;
|
||||
private readonly DeviceManager deviceManager;
|
||||
private readonly EregisterPropertiesModel eregister;
|
||||
|
||||
private SIRTBroadcaster broadcaster;
|
||||
|
||||
public EregisterVM() : base()
|
||||
{
|
||||
this.IsConnectEnabled = true;
|
||||
this.eregister = new EregisterPropertiesModel();
|
||||
this.sirtFactory = AppHost.GetService<SIRTFactory>();
|
||||
this.deviceManager = AppHost.GetService<DeviceManager>();
|
||||
this.deviceManager.COMPortsChanged += this.UpdateComports;
|
||||
this.COMPorts = new ObservableCollection<string>();
|
||||
this.Addresses = new ObservableCollection<uint>();
|
||||
this.EregisterProperties = new ObservableCollection<KvpViewModel>();
|
||||
this.ConnectCommand = new Command(this.ConnectCommandHandler);
|
||||
this.DisconnectCommand = new Command(this.DisconnectCommandHandler);
|
||||
this.PickAddressCommand = new Command<uint>(this.PickAddressCommandHandler);
|
||||
this.RemoveAddressCommand = new Command(this.RemoveAddressCommandHandler);
|
||||
this.StartProgrammingCommand = new Command(this.StartProgrammingCommandHandler);
|
||||
}
|
||||
|
||||
private string comPort;
|
||||
public string COMPort
|
||||
{
|
||||
get => this.comPort;
|
||||
set => this.Set(vm => vm.comPort = value);
|
||||
}
|
||||
|
||||
private string sirtId;
|
||||
public string SirtId
|
||||
{
|
||||
get => this.sirtId;
|
||||
set => this.Set(vm => vm.sirtId = value);
|
||||
}
|
||||
|
||||
private string frequency;
|
||||
public string Frequency
|
||||
{
|
||||
get => this.frequency;
|
||||
set => this.Set(vm => vm.frequency = value);
|
||||
}
|
||||
|
||||
private bool? connected;
|
||||
public bool? IsConnected
|
||||
{
|
||||
get => this.connected;
|
||||
set => this.Set(vm => vm.connected = value);
|
||||
}
|
||||
|
||||
private bool connectEnabled;
|
||||
public bool IsConnectEnabled
|
||||
{
|
||||
get => this.connectEnabled;
|
||||
set => this.Set(vm => vm.connectEnabled = value);
|
||||
}
|
||||
|
||||
private bool disconnectEnabled;
|
||||
public bool IsDisconnectEnabled
|
||||
{
|
||||
get => this.disconnectEnabled;
|
||||
set => this.Set(vm => vm.disconnectEnabled = value);
|
||||
}
|
||||
|
||||
private string addressesCount;
|
||||
public string AddressesCount
|
||||
{
|
||||
get => this.addressesCount;
|
||||
set => this.Set(vm => vm.addressesCount = value);
|
||||
}
|
||||
|
||||
private uint? address;
|
||||
public uint? Address
|
||||
{
|
||||
get => this.address;
|
||||
set => this.Set(vm => vm.address = value);
|
||||
}
|
||||
|
||||
private bool addressSelected;
|
||||
public bool AddressSelected
|
||||
{
|
||||
get => this.addressSelected;
|
||||
set => this.Set(vm => vm.addressSelected = value);
|
||||
}
|
||||
|
||||
public ICommand ConnectCommand { get; }
|
||||
|
||||
public ICommand DisconnectCommand { get; }
|
||||
|
||||
public ICommand PickAddressCommand { get; }
|
||||
|
||||
public ICommand RemoveAddressCommand { get; }
|
||||
|
||||
public ICommand StartProgrammingCommand { get; }
|
||||
|
||||
public ObservableCollection<string> COMPorts { get; }
|
||||
|
||||
public ObservableCollection<uint> Addresses { get; }
|
||||
|
||||
public ObservableCollection<KvpViewModel> EregisterProperties { get; }
|
||||
|
||||
internal override void ViewModel_Loaded(object _)
|
||||
{
|
||||
this.UpdateComports();
|
||||
|
||||
foreach (var property in this.eregister.GetProperties())
|
||||
{
|
||||
this.EregisterProperties.Add(new KvpViewModel
|
||||
{
|
||||
Key = property.Key,
|
||||
Value = property.Value,
|
||||
Row = this.EregisterProperties.Count
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void ConnectCommandHandler()
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(this.COMPort))
|
||||
{
|
||||
this.sirtFactory.ConnectSIRT(this.COMPort, broadcaster =>
|
||||
{
|
||||
this.broadcaster = broadcaster;
|
||||
this.broadcaster.Activated += this.Broadcaster_Activated;
|
||||
this.broadcaster.Connected += this.Broadcaster_Connected;
|
||||
this.broadcaster.Disconnected += this.Broadcaster_Disconnected;
|
||||
this.broadcaster.Logging += this.Broadcaster_Log;
|
||||
this.broadcaster.MessageReceived += this.GetAvailableAddresses;
|
||||
});
|
||||
|
||||
this.IsConnected = false;
|
||||
this.IsConnectEnabled = false;
|
||||
this.IsDisconnectEnabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void GetAvailableAddresses(SIRTMessage message)
|
||||
{
|
||||
if (message.Cmd != SIRTMessage.FROMAIR)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var address = message.Address;
|
||||
|
||||
if (uint.MinValue >= address || address >= uint.MaxValue)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var rssi = new RSSI(message.P2, this.broadcaster.Frequency);
|
||||
|
||||
if (rssi.Dbm < -70)
|
||||
{
|
||||
this.InvokeAsync(() => this.Addresses.Remove(address));
|
||||
}
|
||||
else
|
||||
{
|
||||
bool? inserted = false;
|
||||
|
||||
for (var i = 0; i < this.Addresses.Count; i++)
|
||||
{
|
||||
var _address = this.Addresses[i];
|
||||
|
||||
if (_address == address)
|
||||
{
|
||||
inserted = null;
|
||||
|
||||
break;
|
||||
}
|
||||
else if (_address > address)
|
||||
{
|
||||
this.InvokeAsync(() => this.Addresses.Insert(i, address));
|
||||
|
||||
inserted = true;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (inserted != null && inserted == false)
|
||||
{
|
||||
this.InvokeAsync(() => this.Addresses.Add(address));
|
||||
}
|
||||
}
|
||||
|
||||
this.AddressesCount = $"e-registers count: {this.Addresses.Count}";
|
||||
}
|
||||
|
||||
private void Broadcaster_Log(string message)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void Broadcaster_Disconnected()
|
||||
{
|
||||
this.IsConnected = null;
|
||||
this.IsConnectEnabled = true;
|
||||
this.IsDisconnectEnabled = false;
|
||||
this.SirtId = default(string);
|
||||
this.Frequency = default(string);
|
||||
this.broadcaster.Activated -= this.Broadcaster_Activated;
|
||||
this.broadcaster.Connected -= this.Broadcaster_Connected;
|
||||
this.broadcaster.Disconnected -= this.Broadcaster_Disconnected;
|
||||
this.broadcaster.Logging -= this.Broadcaster_Log;
|
||||
this.broadcaster.MessageReceived -= this.GetAvailableAddresses;
|
||||
}
|
||||
|
||||
private void Broadcaster_Connected()
|
||||
{
|
||||
this.InvokeAsync(() =>
|
||||
{
|
||||
this.IsConnected = false;
|
||||
this.IsConnectEnabled = false;
|
||||
this.IsDisconnectEnabled = true;
|
||||
});
|
||||
}
|
||||
|
||||
private void Broadcaster_Activated()
|
||||
{
|
||||
this.InvokeAsync(() =>
|
||||
{
|
||||
this.IsConnected = true;
|
||||
this.IsConnectEnabled = false;
|
||||
this.IsDisconnectEnabled = true;
|
||||
this.SirtId = this.broadcaster.HexId;
|
||||
this.Frequency = $"{this.broadcaster.Frequency}Mhz";
|
||||
this.broadcaster.MessageReceived += this.GetAvailableAddresses;
|
||||
});
|
||||
}
|
||||
|
||||
private void DisconnectCommandHandler()
|
||||
{
|
||||
this.IsConnectEnabled = false;
|
||||
this.IsDisconnectEnabled = false;
|
||||
this.broadcaster.MessageReceived -= this.GetAvailableAddresses;
|
||||
|
||||
this.Addresses.Clear();
|
||||
this.RemoveAddressCommandHandler();
|
||||
|
||||
Task.Run(() => this.sirtFactory.CloseConnection(this.COMPort));
|
||||
}
|
||||
|
||||
private void UpdateComports()
|
||||
{
|
||||
this.InvokeAsync(() =>
|
||||
{
|
||||
this.COMPorts.Clear();
|
||||
|
||||
foreach (var comPort in this.deviceManager.COMPorts)
|
||||
{
|
||||
this.COMPorts.Add(comPort);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void PickAddressCommandHandler(uint address)
|
||||
{
|
||||
this.RemoveAddressCommandHandler();
|
||||
|
||||
if (address > 0 && address < uint.MaxValue)
|
||||
{
|
||||
this.Address = address;
|
||||
this.AddressSelected = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void RemoveAddressCommandHandler()
|
||||
{
|
||||
this.Address = null;
|
||||
this.AddressSelected = false;
|
||||
}
|
||||
|
||||
private async void StartProgrammingCommandHandler()
|
||||
{
|
||||
var parametersList = AuftragDbContext.LoadEregisterProgrammingParametersListForSharedId(1);
|
||||
var parameters = parametersList.FirstOrDefault();
|
||||
|
||||
if (parameters is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var encryptionKey = default(string);
|
||||
var uriFormat = Appsettings.Get("EncryptionKeisUrl");
|
||||
var httpClient = new HttpClient();
|
||||
|
||||
using (var httpResponeMessage = await httpClient.GetAsync(string.Format(uriFormat, parameters.SerienNr)))
|
||||
{
|
||||
if (httpResponeMessage.IsSuccessStatusCode)
|
||||
{
|
||||
var content = await httpResponeMessage.Content?.ReadAsStringAsync();
|
||||
encryptionKey = content?.Trim('"');
|
||||
}
|
||||
}
|
||||
|
||||
var features = new EregisterFeatures
|
||||
{
|
||||
SlotNr = parameters.Slotno,
|
||||
SerialNr = parameters.SerienNr,
|
||||
PoNr = parameters.FertigungsauftragNr,
|
||||
RequestAddress = parameters.RequestAddress,
|
||||
ResponseAddress = parameters.ResponseAddress,
|
||||
Frequency = parameters.Frequency,
|
||||
EncryptionKey = parameters.EncryptionKey.GetEncryptionKey(),
|
||||
//ChangeRadioId = new ChangeRadioId
|
||||
//{
|
||||
// Address = 2000000000
|
||||
//},
|
||||
//ChangeMeterReading = new ChangeMeterReading
|
||||
//{
|
||||
// DisplayVolume = parameters.DisplayVolume
|
||||
//}
|
||||
Debug = new EregisterDebugFeatures
|
||||
{
|
||||
RequestDebugTelegram = new RequestDebugTelegram()
|
||||
}
|
||||
};
|
||||
|
||||
var pams = features.BuildPams();
|
||||
|
||||
foreach (var pam in features.BuildPams())
|
||||
{
|
||||
var task = new EregisterTask(this.broadcaster.Frequency)
|
||||
{
|
||||
P1 = new P811
|
||||
{
|
||||
DelPamSemi = true,
|
||||
WakeUpCmd = true
|
||||
},
|
||||
RequestAddress = 4291189262,
|
||||
ResponseAddress = 2000000000,
|
||||
Data = pam.Value,
|
||||
IsEncrypted = true,
|
||||
EncryptionKey = encryptionKey.GetEncryptionKey()
|
||||
};
|
||||
task.Telegram += this.UpdateParameters;
|
||||
task.Completed += this.TaskCompleted;
|
||||
|
||||
this.broadcaster.EnqueueTask(task);
|
||||
}
|
||||
}
|
||||
|
||||
private void TaskCompleted(SIRTTask task)
|
||||
{
|
||||
if (task is EregisterTask _task)
|
||||
{
|
||||
_task.Telegram -= this.UpdateParameters;
|
||||
_task.Completed -= this.TaskCompleted;
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateParameters(object telegram)
|
||||
{
|
||||
if (telegram != null)
|
||||
{
|
||||
this.InvokeAsync(() =>
|
||||
{
|
||||
this.eregister.AddMessage(telegram);
|
||||
|
||||
foreach (var kvp in this.eregister.GetProperties())
|
||||
{
|
||||
var property = this.EregisterProperties.FirstOrDefault(x => x.Key == kvp.Key);
|
||||
|
||||
if (property != null)
|
||||
{
|
||||
property.Value = kvp.Value;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
namespace Common.UI.ViewModels
|
||||
{
|
||||
using Common.UI.Infrastructure;
|
||||
using Common.UI.Models;
|
||||
|
||||
internal class SettingsViewModel : ViewModel<SettingsViewModel>
|
||||
{
|
||||
private readonly SettingsModel model;
|
||||
|
||||
public SettingsViewModel()
|
||||
: base()
|
||||
=> this.model = AppHost.GetService<SettingsModel>();
|
||||
|
||||
public string Id => this.model.Id;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user