Compare commits
16 Commits
main
...
Suggestion
| Author | SHA1 | Date | |
|---|---|---|---|
| 0384a4575d | |||
| 57b8791dc0 | |||
| d2ba4baa1d | |||
| 0779c768dd | |||
| 40bc57f265 | |||
| 46eaea558d | |||
| b1be14153f | |||
| a753f1c7a7 | |||
| ff9add4081 | |||
| c7306e8217 | |||
| ffde99f83d | |||
| 2782bc17be | |||
| 9636ff0457 | |||
| d2665d17fa | |||
| a0ef457995 | |||
| f8174d752c |
@@ -4,15 +4,16 @@
|
|||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
|
||||||
<Title>Ads Manager</Title>
|
<Title>Ads Manager</Title>
|
||||||
<Authors>M.Heisig</Authors>
|
<Authors>M.Heisig</Authors>
|
||||||
<Company>Heisig GmbH</Company>
|
<Company>Heisig GmbH</Company>
|
||||||
<Description>Wrapper für den Ads Client von Beckhoff um automatische reconnects und onlinechanges zu behandeln.</Description>
|
<Description>Wrapper für den Ads Client von Beckhoff um automatische reconnects und onlinechanges zu behandeln.</Description>
|
||||||
<PackageReadmeFile>README.md</PackageReadmeFile>
|
<PackageReadmeFile>README.md</PackageReadmeFile>
|
||||||
<PackageOutputPath>C:\Users\matthias.heisig\Documents\nuget_packages</PackageOutputPath>
|
<PackageOutputPath>C:\Users\C.Bliestle\Documents\0010_Obducat\WPF_HMI_Infineon\packages</PackageOutputPath>
|
||||||
<PackageProjectUrl>https://gitlab.cmblu.de/matthias.heisig/ads-wrapper</PackageProjectUrl>
|
<PackageProjectUrl>https://gitlab.cmblu.de/matthias.heisig/ads-wrapper</PackageProjectUrl>
|
||||||
<Version>1.0.0.7</Version>
|
<Version>1.0.0.7</Version>
|
||||||
|
<Platforms>x64</Platforms>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -1,20 +1,20 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio Version 17
|
# Visual Studio Version 18
|
||||||
VisualStudioVersion = 17.8.34525.116
|
VisualStudioVersion = 18.2.11415.280 d18.0
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AdsManager", "AdsManager.csproj", "{4B80F068-4E6D-4D2D-831B-8150970600C7}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AdsManager", "AdsManager.csproj", "{4B80F068-4E6D-4D2D-831B-8150970600C7}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|x64 = Debug|x64
|
||||||
Release|Any CPU = Release|Any CPU
|
Release|x64 = Release|x64
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{4B80F068-4E6D-4D2D-831B-8150970600C7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{4B80F068-4E6D-4D2D-831B-8150970600C7}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
{4B80F068-4E6D-4D2D-831B-8150970600C7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{4B80F068-4E6D-4D2D-831B-8150970600C7}.Debug|x64.Build.0 = Debug|x64
|
||||||
{4B80F068-4E6D-4D2D-831B-8150970600C7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{4B80F068-4E6D-4D2D-831B-8150970600C7}.Release|x64.ActiveCfg = Release|x64
|
||||||
{4B80F068-4E6D-4D2D-831B-8150970600C7}.Release|Any CPU.Build.0 = Release|Any CPU
|
{4B80F068-4E6D-4D2D-831B-8150970600C7}.Release|x64.Build.0 = Release|x64
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
{"AdsAdress":"10.103.32.50.1.1","AdsPort":851,"ReconnectIntervalMS":1000,"OnlineChangeCntVar":"TWinCAT_SystemInfoVarList._AppInfo.OnlineChangeCnt"}
|
|
||||||
25
uniper_hmi/Infineon.sln
Normal file
25
uniper_hmi/Infineon.sln
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 18
|
||||||
|
VisualStudioVersion = 18.2.11415.280
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InfineonHMI", "UniperHMI\InfineonHMI.csproj", "{8D725B27-1242-4C66-ACD8-45F02098C7D3}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|x64 = Debug|x64
|
||||||
|
Release|x64 = Release|x64
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{8D725B27-1242-4C66-ACD8-45F02098C7D3}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{8D725B27-1242-4C66-ACD8-45F02098C7D3}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{8D725B27-1242-4C66-ACD8-45F02098C7D3}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{8D725B27-1242-4C66-ACD8-45F02098C7D3}.Release|x64.Build.0 = Release|x64
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {13973C5F-C164-4478-A4B1-1694557CC459}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
2
uniper_hmi/Infineon.sln.DotSettings
Normal file
2
uniper_hmi/Infineon.sln.DotSettings
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||||
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Infineon/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
|
||||||
# Visual Studio Version 17
|
|
||||||
VisualStudioVersion = 17.8.34408.163
|
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UniperHMI", "UniperHMI\UniperHMI.csproj", "{8D725B27-1242-4C66-ACD8-45F02098C7D3}"
|
|
||||||
EndProject
|
|
||||||
Global
|
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
|
||||||
Debug|Any CPU = Debug|Any CPU
|
|
||||||
Release|Any CPU = Release|Any CPU
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
|
||||||
{8D725B27-1242-4C66-ACD8-45F02098C7D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{8D725B27-1242-4C66-ACD8-45F02098C7D3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{8D725B27-1242-4C66-ACD8-45F02098C7D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{8D725B27-1242-4C66-ACD8-45F02098C7D3}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
|
||||||
HideSolutionNode = FALSE
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
|
||||||
SolutionGuid = {13973C5F-C164-4478-A4B1-1694557CC459}
|
|
||||||
EndGlobalSection
|
|
||||||
EndGlobal
|
|
||||||
BIN
uniper_hmi/UniperHMI/3rdParty/AdsManager.dll
vendored
Normal file
BIN
uniper_hmi/UniperHMI/3rdParty/AdsManager.dll
vendored
Normal file
Binary file not shown.
BIN
uniper_hmi/UniperHMI/Anlagenuebersicht.png
Normal file
BIN
uniper_hmi/UniperHMI/Anlagenuebersicht.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 123 KiB |
@@ -1,7 +1,7 @@
|
|||||||
<Application x:Class="UniperHMI.App"
|
<Application x:Class="InfineonHMI.App"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:local="clr-namespace:UniperHMI">
|
xmlns:local="clr-namespace:InfineonHMI">
|
||||||
<Application.Resources>
|
<Application.Resources>
|
||||||
<!-- MahApps Metro style themes -->
|
<!-- MahApps Metro style themes -->
|
||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ using Microsoft.Extensions.DependencyInjection;
|
|||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
using TcEventLoggerAdsProxyLib;
|
using TcEventLoggerAdsProxyLib;
|
||||||
|
|
||||||
namespace UniperHMI;
|
namespace InfineonHMI;
|
||||||
|
|
||||||
public partial class App : Application
|
public partial class App : Application
|
||||||
{
|
{
|
||||||
@@ -18,10 +18,6 @@ public partial class App : Application
|
|||||||
services.AddSingleton<MainWindow>();
|
services.AddSingleton<MainWindow>();
|
||||||
services.AddSingleton<MainWindowVM>();
|
services.AddSingleton<MainWindowVM>();
|
||||||
services.AddSingleton<IAdsManager, AdsManager>();
|
services.AddSingleton<IAdsManager, AdsManager>();
|
||||||
services.AddTransient<AutomaticModePageVM>();
|
|
||||||
services.AddTransient<BatteryOverviewPageVM>();
|
|
||||||
services.AddTransient<StringOverviewPageVM>();
|
|
||||||
services.AddTransient<ModuleOverviewPageVM>();
|
|
||||||
services.AddSingleton<TcEventLogger>();
|
services.AddSingleton<TcEventLogger>();
|
||||||
})
|
})
|
||||||
.Build();
|
.Build();
|
||||||
|
|||||||
50
uniper_hmi/UniperHMI/Common/FlowStationsViewModelBase.cs
Normal file
50
uniper_hmi/UniperHMI/Common/FlowStationsViewModelBase.cs
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reactive.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using InfineonHMI.Model;
|
||||||
|
|
||||||
|
namespace InfineonHMI.Common
|
||||||
|
{
|
||||||
|
public sealed partial class FlowStationsViewModelBase : ObservableValidator, IChangeTrackingEx
|
||||||
|
{
|
||||||
|
private ObservableCollection<StationEntry> initFlowStations = new();
|
||||||
|
[ObservableProperty]
|
||||||
|
private ObservableCollection<StationEntry> flowStations = new ObservableCollection<StationEntry>();
|
||||||
|
|
||||||
|
public void AcceptChanges()
|
||||||
|
{
|
||||||
|
initFlowStations = new(FlowStations);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsChanged => !initFlowStations.Equals(FlowStations);
|
||||||
|
public void DiscardChanges()
|
||||||
|
{
|
||||||
|
FlowStations = new(initFlowStations);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public sealed partial class FlowReceipe : ObservableValidator, IChangeTrackingEx
|
||||||
|
{
|
||||||
|
|
||||||
|
private ObservableCollection<FlowReceipeEntry> initEntries = new();
|
||||||
|
[ObservableProperty] private ObservableCollection<FlowReceipeEntry> flowReceipeEntries;
|
||||||
|
|
||||||
|
|
||||||
|
public void AcceptChanges()
|
||||||
|
{
|
||||||
|
initEntries = new(FlowReceipeEntries);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsChanged => !FlowReceipeEntries.Equals(initEntries);
|
||||||
|
public void DiscardChanges()
|
||||||
|
{
|
||||||
|
FlowReceipeEntries = new(initEntries);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
14
uniper_hmi/UniperHMI/Common/IChangeTrackingEx.cs
Normal file
14
uniper_hmi/UniperHMI/Common/IChangeTrackingEx.cs
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace InfineonHMI.Common
|
||||||
|
{
|
||||||
|
public interface IChangeTrackingEx : IChangeTracking
|
||||||
|
{
|
||||||
|
void DiscardChanges();
|
||||||
|
}
|
||||||
|
}
|
||||||
176
uniper_hmi/UniperHMI/Common/L4ItXmlSerializer.cs
Normal file
176
uniper_hmi/UniperHMI/Common/L4ItXmlSerializer.cs
Normal file
@@ -0,0 +1,176 @@
|
|||||||
|
using System.IO;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Security.Cryptography;
|
||||||
|
using System.Text;
|
||||||
|
using System.Xml;
|
||||||
|
using System.Xml.Serialization;
|
||||||
|
|
||||||
|
namespace InfineonHMI.Common;
|
||||||
|
|
||||||
|
public static class L4ItXmlSerializer
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Serializes an object.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
|
/// <param name="serializableObject"></param>
|
||||||
|
/// <param name="fileName"></param>
|
||||||
|
/// <param name="encrypt"></param>
|
||||||
|
/// <param name="rootElementName"></param>
|
||||||
|
|
||||||
|
public static void SerializeObject<T>(T serializableObject, string fileName, bool encrypt = false, string? rootElementName = null)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(fileName))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (serializableObject == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
XmlSerializer serializer;
|
||||||
|
if (rootElementName != null)
|
||||||
|
{
|
||||||
|
var xmlRoot = new XmlRootAttribute(rootElementName);
|
||||||
|
serializer = new XmlSerializer(serializableObject.GetType(), xmlRoot);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
serializer = new XmlSerializer(serializableObject.GetType());
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var dir = new FileInfo(fileName).DirectoryName;
|
||||||
|
if (dir != null && !Directory.Exists(dir)) // Überprüfen Sie, ob dir nicht null ist, bevor Sie es verwenden
|
||||||
|
Directory.CreateDirectory(dir);
|
||||||
|
|
||||||
|
var xmlDocument = new XmlDocument();
|
||||||
|
using var stream = new MemoryStream();
|
||||||
|
serializer.Serialize(stream, serializableObject);
|
||||||
|
stream.Position = 0;
|
||||||
|
xmlDocument.Load(stream);
|
||||||
|
if (encrypt && false)
|
||||||
|
{
|
||||||
|
//FileEncryption.SaveEncryptedToFile(fileName, xmlDocument.OuterXml);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
xmlDocument.Save(fileName);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.Write(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Deserializes an xml file into an object list
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
|
/// <param name="fileName"></param>
|
||||||
|
/// <param name="decrypt"></param>
|
||||||
|
/// <param name="rootElementName"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
///
|
||||||
|
///
|
||||||
|
public static T DeSerializeObject<T>(string fileName, bool decrypt = false, string? rootElementName = null)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(fileName) || !File.Exists(fileName)) return default!;
|
||||||
|
|
||||||
|
T objectOut;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string xmlString;
|
||||||
|
if (decrypt && false)
|
||||||
|
{
|
||||||
|
//xmlString = FileEncryption.ReadDecryptedFromFile(fileName)!;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var xmlDocument = new XmlDocument();
|
||||||
|
xmlDocument.Load(fileName);
|
||||||
|
xmlString = xmlDocument.OuterXml;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(xmlString))
|
||||||
|
{
|
||||||
|
// Handle empty xmlString if necessary
|
||||||
|
return default!;
|
||||||
|
}
|
||||||
|
|
||||||
|
using var read = new StringReader(xmlString);
|
||||||
|
var outType = typeof(T);
|
||||||
|
|
||||||
|
XmlSerializer serializer;
|
||||||
|
if (rootElementName != null)
|
||||||
|
{
|
||||||
|
var root = new XmlRootAttribute(rootElementName);
|
||||||
|
serializer = new XmlSerializer(outType, root);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
serializer = new XmlSerializer(outType);
|
||||||
|
}
|
||||||
|
|
||||||
|
using XmlReader reader = new XmlTextReader(read);
|
||||||
|
objectOut = (T)serializer.Deserialize(reader)!;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.Write(ex);
|
||||||
|
return default!;
|
||||||
|
}
|
||||||
|
|
||||||
|
return objectOut;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string Encrypt(string encryptString)
|
||||||
|
{
|
||||||
|
string EncryptionKey = "0ram@1234xxxxxxxxxxtttttuuuuuiiiiio"; //we can change the code converstion key as per our requirement
|
||||||
|
byte[] clearBytes = Encoding.Unicode.GetBytes(encryptString);
|
||||||
|
using (Aes encryptor = Aes.Create())
|
||||||
|
{
|
||||||
|
Rfc2898DeriveBytes pdb = new Rfc2898DeriveBytes(EncryptionKey, new byte[] {
|
||||||
|
0x49, 0x76, 0x61, 0x6e, 0x20, 0x4d, 0x65, 0x64, 0x76, 0x65, 0x64, 0x65, 0x76
|
||||||
|
});
|
||||||
|
encryptor.Key = pdb.GetBytes(32);
|
||||||
|
encryptor.IV = pdb.GetBytes(16);
|
||||||
|
using (MemoryStream ms = new MemoryStream())
|
||||||
|
{
|
||||||
|
using (CryptoStream cs = new CryptoStream(ms, encryptor.CreateEncryptor(), CryptoStreamMode.Write))
|
||||||
|
{
|
||||||
|
cs.Write(clearBytes, 0, clearBytes.Length);
|
||||||
|
cs.Close();
|
||||||
|
}
|
||||||
|
encryptString = Convert.ToBase64String(ms.ToArray());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return encryptString;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string Decrypt(string cipherText)
|
||||||
|
{
|
||||||
|
string EncryptionKey = "0ram@1234xxxxxxxxxxtttttuuuuuiiiiio"; //we can change the code converstion key as per our requirement, but the decryption key should be same as encryption key
|
||||||
|
cipherText = cipherText.Replace(" ", "+");
|
||||||
|
byte[] cipherBytes = Convert.FromBase64String(cipherText);
|
||||||
|
using (Aes encryptor = Aes.Create())
|
||||||
|
{
|
||||||
|
Rfc2898DeriveBytes pdb = new Rfc2898DeriveBytes(EncryptionKey, new byte[] {
|
||||||
|
0x49, 0x76, 0x61, 0x6e, 0x20, 0x4d, 0x65, 0x64, 0x76, 0x65, 0x64, 0x65, 0x76
|
||||||
|
});
|
||||||
|
encryptor.Key = pdb.GetBytes(32);
|
||||||
|
encryptor.IV = pdb.GetBytes(16);
|
||||||
|
using (MemoryStream ms = new MemoryStream())
|
||||||
|
{
|
||||||
|
using (CryptoStream cs = new CryptoStream(ms, encryptor.CreateDecryptor(), CryptoStreamMode.Write))
|
||||||
|
{
|
||||||
|
cs.Write(cipherBytes, 0, cipherBytes.Length);
|
||||||
|
cs.Close();
|
||||||
|
}
|
||||||
|
cipherText = Encoding.Unicode.GetString(ms.ToArray());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return cipherText;
|
||||||
|
}
|
||||||
|
}
|
||||||
100
uniper_hmi/UniperHMI/Common/MediaContainer.xaml
Normal file
100
uniper_hmi/UniperHMI/Common/MediaContainer.xaml
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
<UserControl x:Class="Common.MediaContainer"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:common="clr-namespace:Common"
|
||||||
|
xmlns:HMIToolkit="clr-namespace:HMIToolkit"
|
||||||
|
d:DataContext="{d:DesignInstance Type=common:MediaContainerVm, IsDesignTimeCreatable=True}"
|
||||||
|
mc:Ignorable="d">
|
||||||
|
|
||||||
|
<UserControl.Resources>
|
||||||
|
<HMIToolkit:FeedbackToColorConverter x:Key="feedbackConverter" />
|
||||||
|
</UserControl.Resources>
|
||||||
|
<!-- :DataContext="{d:DesignInstance Type=local:AnalogValueVM, IsDesignTimeCreatable=True}" -->
|
||||||
|
<!-- Style to see things in the designer-->
|
||||||
|
<d:DesignerProperties.DesignStyle>
|
||||||
|
<Style TargetType="UserControl">
|
||||||
|
<!-- Property="Background" Value="White" /> -->
|
||||||
|
<Setter Property="Height" Value="Auto" />
|
||||||
|
<Setter Property="Width" Value="Auto"></Setter>
|
||||||
|
</Style>
|
||||||
|
</d:DesignerProperties.DesignStyle>
|
||||||
|
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Border Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="3" BorderBrush="White" BorderThickness="2"/>
|
||||||
|
<!-- <Label Grid.Column="0" Content="{Binding SName}" VerticalAlignment="Center" HorizontalAlignment="Left"/> -->
|
||||||
|
<Label Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3" HorizontalContentAlignment="Center" Content="{Binding SName, Mode=OneWay }" FontSize="35"/>
|
||||||
|
|
||||||
|
<Grid Grid.Row="1" Grid.Column="2">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition/>
|
||||||
|
<RowDefinition/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Border Grid.Row="0" BorderBrush="White" BorderThickness="1" />
|
||||||
|
<Border Grid.Row="1" BorderBrush="White" BorderThickness="1" />
|
||||||
|
<Label Grid.Row="0" VerticalAlignment="Center" Content="Übervoll" HorizontalContentAlignment="Center" HorizontalAlignment="Center" FontSize="30"/>
|
||||||
|
<RadioButton Margin="5" Grid.Row="1" IsChecked="{Binding Overload}" HorizontalAlignment="Center" VerticalAlignment="Center" IsEnabled="False"/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<Grid Grid.Column="1" Grid.Row="1">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition/>
|
||||||
|
<RowDefinition/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Border Grid.Row="0" BorderBrush="White" BorderThickness="1" />
|
||||||
|
<Border Grid.Row="1" BorderBrush="White" BorderThickness="1" />
|
||||||
|
<Label Grid.Row="0" VerticalAlignment="Center" Content="Voll" HorizontalAlignment="Center" FontSize="30"/>
|
||||||
|
<RadioButton Grid.Row="1" Margin="5" IsChecked="{Binding Full}" HorizontalAlignment="Center" VerticalAlignment="Center" IsEnabled="False"/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<Grid Grid.Row="1" Grid.Column="0">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition/>
|
||||||
|
<RowDefinition/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Border Grid.Row="0" BorderBrush="White" BorderThickness="1" />
|
||||||
|
<Border Grid.Row="1" BorderBrush="White" BorderThickness="1" />
|
||||||
|
<Label Grid.Row="0" VerticalAlignment="Center" Content="Leer" HorizontalAlignment="Center" FontSize="30"/>
|
||||||
|
<RadioButton Grid.Row="1" Margin="5" IsChecked="{Binding Empty}" HorizontalAlignment="Center" VerticalAlignment="Center" IsEnabled="False"/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<Border Grid.Column="1" Grid.Row="1" BorderBrush="White" BorderThickness="1"/>
|
||||||
|
|
||||||
|
<HMIToolkit:BinaryValveControl Grid.Row="2" Grid.Column="0" DataContext="{Binding FillValveControlVm}"/>
|
||||||
|
<HMIToolkit:BinaryValveControl Grid.Row="2" Grid.Column="1" DataContext="{Binding DrainValveControlVm}"/>
|
||||||
|
<HMIToolkit:BinaryValveControl Grid.Row="2" Grid.Column="2" DataContext="{Binding PumpValveControlVm}"/>
|
||||||
|
|
||||||
|
<!--<Button x:Name="btnOpen"
|
||||||
|
Grid.Column="0"
|
||||||
|
DataContext="{Binding EmptyButton}"
|
||||||
|
Command="{Binding ButtonClickedCommand}"
|
||||||
|
IsEnabled="{Binding XRelease}"
|
||||||
|
Background="{Binding IFeedback, Converter={StaticResource feedbackConverter}}"
|
||||||
|
Content="Leeren"
|
||||||
|
Height="100"
|
||||||
|
FontSize="30"/>-->
|
||||||
|
|
||||||
|
<!--<Button x:Name="btnFill"
|
||||||
|
Grid.Column="1"
|
||||||
|
DataContext="{Binding FillButton}"
|
||||||
|
Command="{Binding ButtonClickedCommand}"
|
||||||
|
IsEnabled="{Binding XRelease}"
|
||||||
|
Background="{Binding IFeedback, Converter={StaticResource feedbackConverter}}"
|
||||||
|
Content="Füllen"
|
||||||
|
Height="100"
|
||||||
|
FontSize="30"/>-->
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
31
uniper_hmi/UniperHMI/Common/MediaContainer.xaml.cs
Normal file
31
uniper_hmi/UniperHMI/Common/MediaContainer.xaml.cs
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
|
namespace Common;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Interaktionslogik für AnalogValue.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class MediaContainer : UserControl
|
||||||
|
{
|
||||||
|
public bool IsReadonly { get; set; }
|
||||||
|
|
||||||
|
public MediaContainer()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
// Unloaded += OnUnloaded;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnUnloaded(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var disposable = DataContext as IDisposable;
|
||||||
|
disposable?.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void NumberValidation(object sender, TextCompositionEventArgs e)
|
||||||
|
{
|
||||||
|
Regex regex = new("^[-+]?[0-9]*,?[0-9]+$");
|
||||||
|
e.Handled = regex.IsMatch(e.Text);
|
||||||
|
}
|
||||||
|
}
|
||||||
87
uniper_hmi/UniperHMI/Common/MediaContainerVm.cs
Normal file
87
uniper_hmi/UniperHMI/Common/MediaContainerVm.cs
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using TwinCAT.TypeSystem;
|
||||||
|
using Heisig.HMI.AdsManager;
|
||||||
|
using HMIToolkit;
|
||||||
|
|
||||||
|
namespace Common;
|
||||||
|
|
||||||
|
public sealed partial class MediaContainerVm : ObservableValidator, IDisposable
|
||||||
|
{
|
||||||
|
|
||||||
|
private IAdsManager? _adsManager;
|
||||||
|
private string? _variableName;
|
||||||
|
|
||||||
|
[ObservableProperty] private string? sName = "No Name";
|
||||||
|
|
||||||
|
[ObservableProperty] private bool empty = false;
|
||||||
|
|
||||||
|
[ObservableProperty] private bool full = false;
|
||||||
|
|
||||||
|
[ObservableProperty] private bool overload = false;
|
||||||
|
|
||||||
|
[ObservableProperty] private BinaryValveControlVM? fillValveControlVm;
|
||||||
|
|
||||||
|
[ObservableProperty] private BinaryValveControlVM? drainValveControlVm;
|
||||||
|
|
||||||
|
[ObservableProperty] private BinaryValveControlVM? pumpValveControlVm;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public MediaContainerVm()
|
||||||
|
{
|
||||||
|
sName = "No Name";
|
||||||
|
FillValveControlVm = new();
|
||||||
|
DrainValveControlVm = new();
|
||||||
|
PumpValveControlVm = new();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public MediaContainerVm(IAdsManager adsManager, string variableName)
|
||||||
|
{
|
||||||
|
_adsManager = adsManager;
|
||||||
|
_variableName = variableName;
|
||||||
|
|
||||||
|
sName = "No Name";
|
||||||
|
|
||||||
|
FillValveControlVm = new BinaryValveControlVM(_adsManager, _variableName + ".stFillingValve");
|
||||||
|
DrainValveControlVm = new BinaryValveControlVM(_adsManager, _variableName + ".stDrainValve");
|
||||||
|
PumpValveControlVm = new BinaryValveControlVM(_adsManager, _variableName + ".stPumpValve");
|
||||||
|
|
||||||
|
_adsManager.Register(_variableName + ".xEmpty", EmptyChanged);
|
||||||
|
_adsManager.Register(_variableName + ".xFull", FullChanged);
|
||||||
|
_adsManager.Register(_variableName + ".xOverload", OverloadChanged);
|
||||||
|
|
||||||
|
}
|
||||||
|
private void EmptyChanged(object? sender, ValueChangedEventArgs e)
|
||||||
|
{
|
||||||
|
Empty = (bool)e.Value;
|
||||||
|
}
|
||||||
|
private void FullChanged(object? sender, ValueChangedEventArgs e)
|
||||||
|
{
|
||||||
|
Full = (bool)e.Value;
|
||||||
|
}
|
||||||
|
private void OverloadChanged(object? sender, ValueChangedEventArgs e)
|
||||||
|
{
|
||||||
|
Overload = (bool)e.Value;
|
||||||
|
}
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
FillValveControlVm?.Dispose();
|
||||||
|
DrainValveControlVm?.Dispose();
|
||||||
|
PumpValveControlVm?.Dispose();
|
||||||
|
|
||||||
|
FillValveControlVm = null;
|
||||||
|
DrainValveControlVm = null;
|
||||||
|
PumpValveControlVm = null;
|
||||||
|
|
||||||
|
|
||||||
|
_adsManager?.Deregister(_variableName + ".xEmpty", EmptyChanged);
|
||||||
|
_adsManager?.Deregister(_variableName + ".xFull", FullChanged);
|
||||||
|
_adsManager?.Deregister(_variableName + ".xOverload", OverloadChanged);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
77
uniper_hmi/UniperHMI/Common/PackMLControl.xaml
Normal file
77
uniper_hmi/UniperHMI/Common/PackMLControl.xaml
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
<UserControl x:Class="Common.PackMLControl"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:common="clr-namespace:Common"
|
||||||
|
xmlns:HMIToolkit="clr-namespace:HMIToolkit"
|
||||||
|
d:DataContext="{d:DesignInstance Type=common:PackMLControlVM, IsDesignTimeCreatable=True}"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Width="Auto"
|
||||||
|
Height="Auto"
|
||||||
|
MinHeight="800"
|
||||||
|
MinWidth="500">
|
||||||
|
<UserControl.Resources>
|
||||||
|
<HMIToolkit:FeedbackToColorConverter x:Key="feedbackConverter"/>
|
||||||
|
</UserControl.Resources>
|
||||||
|
<!-- :DataContext="{d:DesignInstance Type=local:AnalogValueVM, IsDesignTimeCreatable=True}" -->
|
||||||
|
<!-- Style to see things in the designer-->
|
||||||
|
<d:DesignerProperties.DesignStyle>
|
||||||
|
<Style TargetType="UserControl">
|
||||||
|
<!--<Setter Property="Background" Value="Transparent" />-->
|
||||||
|
<Setter Property="Height" Value="300" />
|
||||||
|
<Setter Property="Width" Value="250" />
|
||||||
|
</Style>
|
||||||
|
</d:DesignerProperties.DesignStyle>
|
||||||
|
|
||||||
|
<Grid Height="Auto">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="250"/>
|
||||||
|
<ColumnDefinition Width="250"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="15*"/>
|
||||||
|
<RowDefinition Height="8*"/>
|
||||||
|
<RowDefinition Height="15*"/>
|
||||||
|
<RowDefinition Height="15*"/>
|
||||||
|
<RowDefinition Height="1*"/>
|
||||||
|
<RowDefinition Height="10*"/>
|
||||||
|
<RowDefinition Height="10*"/>
|
||||||
|
<RowDefinition Height="10*"/>
|
||||||
|
<RowDefinition Height="10*"/>
|
||||||
|
<RowDefinition Height="10*"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Border Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="2" BorderBrush="White" BorderThickness="2"/>
|
||||||
|
<!-- <Label Grid.Column="0" Content="{Binding SName}" VerticalAlignment="Center" HorizontalAlignment="Left"/> -->
|
||||||
|
<Label Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Content="{Binding STitle}" HorizontalAlignment="Center" FontSize="44"/>
|
||||||
|
|
||||||
|
<Label Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Margin="10" Content="{Binding SCurrentState}" FontSize="32"/>
|
||||||
|
<Border Grid.Row="1" Grid.Column="0" Grid.RowSpan="1" Grid.ColumnSpan="2" BorderBrush="White" BorderThickness="1,1,1,0"></Border>
|
||||||
|
<Label Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" Margin="10" Content="{Binding SCurrentMode}" FontSize="32"/>
|
||||||
|
<Border Grid.Row="2" Grid.Column="0" Grid.RowSpan="1" Grid.ColumnSpan="2" BorderBrush="White" BorderThickness="1,0,1,1"></Border>
|
||||||
|
|
||||||
|
|
||||||
|
<Border Grid.Row="0" Grid.Column="0" Grid.RowSpan="10" Grid.ColumnSpan="2" BorderBrush="White" BorderThickness="1"></Border>
|
||||||
|
<Border Grid.Row="4" Grid.Column="0" Grid.RowSpan="1" Grid.ColumnSpan="2" BorderBrush="White" BorderThickness="2"></Border>
|
||||||
|
|
||||||
|
<Button Visibility="Visible" Grid.Row="3" Grid.Column="0" Content="Produktion" Margin="5" DataContext="{Binding ProdModeButtonVm}" Command="{Binding ButtonClickedCommand}" IsEnabled="{Binding XRelease}" Background="{Binding IFeedback, Converter={StaticResource feedbackConverter}}" FontSize="32" />
|
||||||
|
<Button Visibility="Visible" Grid.Row="3" Grid.Column="1" Content="Manuell" Margin="5" DataContext="{Binding ManualModeButtonVm}" Command="{Binding ButtonClickedCommand}" IsEnabled="{Binding XRelease}" Background="{Binding IFeedback, Converter={StaticResource feedbackConverter}}" FontSize="32" />
|
||||||
|
|
||||||
|
|
||||||
|
<Button Visibility="Visible" Grid.Row="5" Grid.Column="0" Content="Start" Margin="5" DataContext="{Binding StartButtonVm}" Command="{Binding ButtonClickedCommand}" IsEnabled="{Binding XRelease}" Background="{Binding IFeedback, Converter={StaticResource feedbackConverter}}" FontSize="32" />
|
||||||
|
<Button Visibility="Visible" Grid.Row="5" Grid.Column="1" Content="Complete" Margin="5" DataContext="{Binding CompleteButtonVm}" Command="{Binding ButtonClickedCommand}" IsEnabled="{Binding XRelease}" Background="{Binding IFeedback, Converter={StaticResource feedbackConverter}}" FontSize="32" />
|
||||||
|
|
||||||
|
<Button Visibility="Visible" Grid.Row="6" Grid.Column="0" Content="Hold" Margin="5" DataContext="{Binding HoldButtonVm}" Command="{Binding ButtonClickedCommand}" IsEnabled="{Binding XRelease}" Background="{Binding IFeedback, Converter={StaticResource feedbackConverter}}" FontSize="32" />
|
||||||
|
<Button Visibility="Visible" Grid.Row="6" Grid.Column="1" Content="Unhold" Margin="5" DataContext="{Binding UnholdButtonVm}" Command="{Binding ButtonClickedCommand}" IsEnabled="{Binding XRelease}" Background="{Binding IFeedback, Converter={StaticResource feedbackConverter}}" FontSize="32" />
|
||||||
|
|
||||||
|
<Button Visibility="Visible" Grid.Row="7" Grid.Column="0" Content="Suspend" Margin="5" DataContext="{Binding SuspendButtonVm}" Command="{Binding ButtonClickedCommand}" IsEnabled="{Binding XRelease}" Background="{Binding IFeedback, Converter={StaticResource feedbackConverter}}" FontSize="32" />
|
||||||
|
<Button Visibility="Visible" Grid.Row="7" Grid.Column="1" Content="Unsuspend" Margin="5" DataContext="{Binding UnsuspendButtonVm}" Command="{Binding ButtonClickedCommand}" IsEnabled="{Binding XRelease}" Background="{Binding IFeedback, Converter={StaticResource feedbackConverter}}" FontSize="32" />
|
||||||
|
|
||||||
|
<Button Visibility="Visible" Grid.Row="8" Grid.Column="0" Content="Stop" Margin="5" DataContext="{Binding StopButtonVm}" Command="{Binding ButtonClickedCommand}" IsEnabled="{Binding XRelease}" Background="{Binding IFeedback, Converter={StaticResource feedbackConverter}}" FontSize="32" />
|
||||||
|
<Button Visibility="Visible" Grid.Row="8" Grid.Column="1" Content="Abbruch" Margin="5" DataContext="{Binding AbortButtonVm}" Command="{Binding ButtonClickedCommand}" IsEnabled="{Binding XRelease}" Background="{Binding IFeedback, Converter={StaticResource feedbackConverter}}" FontSize="32" />
|
||||||
|
|
||||||
|
<Button Visibility="Visible" Grid.Row="9" Grid.Column="0" Content="Clear" Margin="5" DataContext="{Binding ClearButtonVm}" Command="{Binding ButtonClickedCommand}" IsEnabled="{Binding XRelease}" Background="{Binding IFeedback, Converter={StaticResource feedbackConverter}}" FontSize="32" />
|
||||||
|
<Button Visibility="Visible" Grid.Row="9" Grid.Column="1" Content="Reset" Margin="5" DataContext="{Binding ResetButtonVm}" Command="{Binding ButtonClickedCommand}" IsEnabled="{Binding XRelease}" Background="{Binding IFeedback, Converter={StaticResource feedbackConverter}}" FontSize="32" />
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
@@ -13,16 +13,15 @@ using System.Windows.Media.Imaging;
|
|||||||
using System.Windows.Navigation;
|
using System.Windows.Navigation;
|
||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
namespace UniperHMI
|
namespace Common;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Interaktionslogik für WorkingModeSelectionControl.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class PackMLControl : UserControl
|
||||||
{
|
{
|
||||||
/// <summary>
|
public PackMLControl()
|
||||||
/// Interaktionslogik für ModuleOverviewPage.xaml
|
{
|
||||||
/// </summary>
|
InitializeComponent();
|
||||||
public partial class ModuleOverviewPage : Page
|
}
|
||||||
{
|
}
|
||||||
public ModuleOverviewPage()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
215
uniper_hmi/UniperHMI/Common/PackMLControlVm.cs
Normal file
215
uniper_hmi/UniperHMI/Common/PackMLControlVm.cs
Normal file
@@ -0,0 +1,215 @@
|
|||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using CommunityToolkit.Mvvm.Input;
|
||||||
|
using TwinCAT.TypeSystem;
|
||||||
|
using Heisig.HMI.AdsManager;
|
||||||
|
using HMIToolkit;
|
||||||
|
using InfineonHMI.Common;
|
||||||
|
|
||||||
|
namespace Common;
|
||||||
|
|
||||||
|
public sealed partial class PackMLControlVM : ObservableValidator, IDisposable
|
||||||
|
{
|
||||||
|
|
||||||
|
private IAdsManager _adsManager;
|
||||||
|
private readonly string _variableName;
|
||||||
|
|
||||||
|
[ObservableProperty] private string? sTitle;
|
||||||
|
|
||||||
|
[ObservableProperty] private string? sCurrentMode;
|
||||||
|
|
||||||
|
[ObservableProperty] private string? sCurrentState;
|
||||||
|
|
||||||
|
[ObservableProperty] private HMIControlButtonVM? prodModeButtonVm;
|
||||||
|
[ObservableProperty] private HMIControlButtonVM? manualModeButtonVm;
|
||||||
|
[ObservableProperty] private HMIControlButtonVM? clearButtonVm;
|
||||||
|
[ObservableProperty] private HMIControlButtonVM? resetButtonVm;
|
||||||
|
[ObservableProperty] private HMIControlButtonVM? startButtonVm;
|
||||||
|
[ObservableProperty] private HMIControlButtonVM? abortButtonVm;
|
||||||
|
[ObservableProperty] private HMIControlButtonVM? holdButtonVm;
|
||||||
|
[ObservableProperty] private HMIControlButtonVM? stopButtonVm;
|
||||||
|
[ObservableProperty] private HMIControlButtonVM? suspendButtonVm;
|
||||||
|
[ObservableProperty] private HMIControlButtonVM? unholdButtonVm;
|
||||||
|
[ObservableProperty] private HMIControlButtonVM? unsuspendButtonVm;
|
||||||
|
[ObservableProperty] private HMIControlButtonVM? completeButtonVm;
|
||||||
|
|
||||||
|
[ObservableProperty] private bool canUserInteract;
|
||||||
|
|
||||||
|
public PackMLControlVM()
|
||||||
|
{
|
||||||
|
SCurrentMode = "Modus: ";
|
||||||
|
SCurrentState = "Aktueller Zustand: ";
|
||||||
|
STitle = "Betriebsart";
|
||||||
|
ProdModeButtonVm = new();
|
||||||
|
ManualModeButtonVm = new();
|
||||||
|
ClearButtonVm= new();
|
||||||
|
ResetButtonVm= new();
|
||||||
|
StartButtonVm = new();
|
||||||
|
AbortButtonVm = new();
|
||||||
|
HoldButtonVm = new();
|
||||||
|
StopButtonVm = new();
|
||||||
|
SuspendButtonVm = new();
|
||||||
|
UnholdButtonVm = new();
|
||||||
|
UnsuspendButtonVm = new();
|
||||||
|
CompleteButtonVm = new();
|
||||||
|
|
||||||
|
var currentUser = Users.getCurrentUser();
|
||||||
|
canUserInteract = currentUser.UserLevel > 50;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PackMLControlVM(IAdsManager adsManager, string variableName)
|
||||||
|
{
|
||||||
|
|
||||||
|
_adsManager = adsManager;
|
||||||
|
_variableName = variableName;
|
||||||
|
STitle = "Betriebsart";
|
||||||
|
|
||||||
|
SCurrentMode = "Modus: ";
|
||||||
|
SCurrentState = "Aktueller Zustand: ";
|
||||||
|
|
||||||
|
ProdModeButtonVm = new(_adsManager, _variableName + ".stBtnProdMode");
|
||||||
|
ManualModeButtonVm = new(_adsManager, _variableName + ".stBtnManualMode");
|
||||||
|
ClearButtonVm = new(_adsManager, _variableName + ".stBtnClear");
|
||||||
|
ResetButtonVm = new(_adsManager, _variableName + ".stBtnReset");
|
||||||
|
StartButtonVm = new(_adsManager, _variableName + ".stBtnStart");
|
||||||
|
AbortButtonVm = new(_adsManager, _variableName + ".stBtnAbort");
|
||||||
|
HoldButtonVm = new(_adsManager, _variableName + ".stBtnHold");
|
||||||
|
StopButtonVm = new(_adsManager, _variableName + ".stBtnStop");
|
||||||
|
SuspendButtonVm = new(_adsManager, _variableName + ".stBtnSuspend");
|
||||||
|
UnholdButtonVm = new(_adsManager, _variableName + ".stBtnUnhold");
|
||||||
|
UnsuspendButtonVm = new(_adsManager, _variableName + ".stBtnUnsuspend");
|
||||||
|
CompleteButtonVm = new(_adsManager, _variableName + ".stBtnComplete");
|
||||||
|
|
||||||
|
_adsManager.Register(_variableName + ".eCurrentState", StateChanged);
|
||||||
|
_adsManager.Register(_variableName + ".eCurrentMode", ModeChanged);
|
||||||
|
|
||||||
|
var currentUser = Users.getCurrentUser();
|
||||||
|
canUserInteract = currentUser.UserLevel > 50;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void StateChanged(object? sender, ValueChangedEventArgs e)
|
||||||
|
{
|
||||||
|
var state = (int)e.Value;
|
||||||
|
var curState = "Aktueller Status: ";
|
||||||
|
switch (state)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
curState += "Undefined";
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
curState += "Clearing";
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
curState += "Stopped";
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
curState += "Starting";
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
curState += "Idle";
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
curState += "Suspended";
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
curState += "Execute";
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
curState += "Stopping";
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
curState += "Aborting";
|
||||||
|
break;
|
||||||
|
case 9:
|
||||||
|
curState += "Aborted";
|
||||||
|
break;
|
||||||
|
case 10:
|
||||||
|
curState += "Holding";
|
||||||
|
break;
|
||||||
|
case 11:
|
||||||
|
curState += "Held";
|
||||||
|
break;
|
||||||
|
case 12:
|
||||||
|
curState += "Unholding";
|
||||||
|
break;
|
||||||
|
case 13:
|
||||||
|
curState += "Suspending";
|
||||||
|
break;
|
||||||
|
case 14:
|
||||||
|
curState += "Unsuspending";
|
||||||
|
break;
|
||||||
|
case 15:
|
||||||
|
curState += "Resetting";
|
||||||
|
break;
|
||||||
|
case 16:
|
||||||
|
curState += "Completing";
|
||||||
|
break;
|
||||||
|
case 17:
|
||||||
|
curState += "Completed";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
curState += "Undefined";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
SCurrentState = curState;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ModeChanged(object? sender, ValueChangedEventArgs e)
|
||||||
|
{
|
||||||
|
var curMode = "Aktueller Modus: ";
|
||||||
|
var mode = (int)e.Value;
|
||||||
|
|
||||||
|
switch (mode)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
curMode += "Invalid";
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
curMode += "Production";
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
curMode += "Maintenance";
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
curMode += "Manual";
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
curMode += "change_over";
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
curMode += "clean";
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
curMode += "set up";
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
curMode += "empty out";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
curMode += "Invalid";
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
SCurrentMode = curMode;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
ProdModeButtonVm?.Dispose();
|
||||||
|
ManualModeButtonVm?.Dispose();
|
||||||
|
ClearButtonVm?.Dispose();
|
||||||
|
ResetButtonVm?.Dispose();
|
||||||
|
StartButtonVm?.Dispose();
|
||||||
|
AbortButtonVm?.Dispose();
|
||||||
|
HoldButtonVm?.Dispose();
|
||||||
|
StopButtonVm?.Dispose();
|
||||||
|
SuspendButtonVm?.Dispose();
|
||||||
|
UnholdButtonVm?.Dispose();
|
||||||
|
UnsuspendButtonVm?.Dispose();
|
||||||
|
CompleteButtonVm?.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
25
uniper_hmi/UniperHMI/Common/ParamControlFloat.xaml
Normal file
25
uniper_hmi/UniperHMI/Common/ParamControlFloat.xaml
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<UserControl x:Class="Common.ParamControlFloat"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:local="clr-namespace:Common"
|
||||||
|
d:DataContext="{d:DesignInstance Type=local:ParamControlFloatVm, IsDesignTimeCreatable=True}"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignWidth="600"
|
||||||
|
d:DesignHeight="120"
|
||||||
|
Width="Auto"
|
||||||
|
Height="Auto">
|
||||||
|
<Grid Height="70">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<!-- <ColumnDefinition Width="Auto" /> -->
|
||||||
|
<ColumnDefinition Width="400" />
|
||||||
|
<ColumnDefinition Width="200" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<Label x:Name="tbName" Grid.Column="0" Content="{Binding SName, Mode=OneWay }" FontSize="30" VerticalAlignment="Center"/>
|
||||||
|
<TextBox x:Name="tbValue" Text="{Binding Value, Mode=TwoWay, StringFormat=N2, UpdateSourceTrigger=PropertyChanged}" Margin="10" Width="Auto" FontSize="30" Grid.Column="1" MaxLines="1" HorizontalContentAlignment="Right" VerticalContentAlignment="Center" IsReadOnly="{Binding Readonly}" />
|
||||||
|
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
26
uniper_hmi/UniperHMI/Common/ParamControlFloat.xaml.cs
Normal file
26
uniper_hmi/UniperHMI/Common/ParamControlFloat.xaml.cs
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
|
namespace Common;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Interaktionslogik für AnalogValue.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class ParamControlFloat : UserControl
|
||||||
|
{
|
||||||
|
public bool IsReadonly { get; set; }
|
||||||
|
|
||||||
|
public ParamControlFloat()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
// Unloaded += OnUnloaded;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnUnloaded(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var disposable = DataContext as IDisposable;
|
||||||
|
disposable?.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
39
uniper_hmi/UniperHMI/Common/ParamControlFloatVM.cs
Normal file
39
uniper_hmi/UniperHMI/Common/ParamControlFloatVM.cs
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using InfineonHMI.Common;
|
||||||
|
|
||||||
|
namespace Common;
|
||||||
|
|
||||||
|
public sealed partial class ParamControlFloatVm : ObservableValidator, IDisposable, IChangeTrackingEx
|
||||||
|
{
|
||||||
|
private float initValue;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private string sName;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private float value;
|
||||||
|
|
||||||
|
|
||||||
|
public ParamControlFloatVm()
|
||||||
|
{
|
||||||
|
SName = "No Name:";
|
||||||
|
Value = 0.0f;
|
||||||
|
initValue = Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AcceptChanges()
|
||||||
|
{
|
||||||
|
initValue = Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsChanged => initValue != Value;
|
||||||
|
public void DiscardChanges()
|
||||||
|
{
|
||||||
|
Value = initValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
25
uniper_hmi/UniperHMI/Common/ParamControlInt.xaml
Normal file
25
uniper_hmi/UniperHMI/Common/ParamControlInt.xaml
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<UserControl x:Class="Common.ParamControlInt"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:common="clr-namespace:Common"
|
||||||
|
d:DataContext="{d:DesignInstance Type=common:ParamControlIntVm, IsDesignTimeCreatable=True}"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignWidth="600"
|
||||||
|
d:DesignHeight="120"
|
||||||
|
Width="Auto"
|
||||||
|
Height="Auto">
|
||||||
|
<Grid Height="70">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<!-- <ColumnDefinition Width="Auto" /> -->
|
||||||
|
<ColumnDefinition Width="400" />
|
||||||
|
<ColumnDefinition Width="200" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<Label x:Name="tbName" Grid.Column="0" Content="{Binding SName, Mode=OneWay }" FontSize="30" VerticalAlignment="Center"/>
|
||||||
|
<TextBox x:Name="tbValue" Text="{Binding Value, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Margin="10" Width="Auto" FontSize="30" Grid.Column="1" MaxLines="1" HorizontalContentAlignment="Right" VerticalContentAlignment="Center" IsReadOnly="{Binding Readonly}" />
|
||||||
|
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
31
uniper_hmi/UniperHMI/Common/ParamControlInt.xaml.cs
Normal file
31
uniper_hmi/UniperHMI/Common/ParamControlInt.xaml.cs
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
|
namespace Common;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Interaktionslogik für AnalogValue.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class ParamControlInt : UserControl
|
||||||
|
{
|
||||||
|
public bool IsReadonly { get; set; }
|
||||||
|
|
||||||
|
public ParamControlInt()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
// Unloaded += OnUnloaded;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnUnloaded(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var disposable = DataContext as IDisposable;
|
||||||
|
disposable?.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void NumberValidation(object sender, TextCompositionEventArgs e)
|
||||||
|
{
|
||||||
|
Regex regex = new("^[-+]?[0-9]*,?[0-9]+$");
|
||||||
|
e.Handled = regex.IsMatch(e.Text);
|
||||||
|
}
|
||||||
|
}
|
||||||
25
uniper_hmi/UniperHMI/Common/ParamControlIntRange.xaml
Normal file
25
uniper_hmi/UniperHMI/Common/ParamControlIntRange.xaml
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<UserControl x:Class="Common.ParamControlIntRange"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:common="clr-namespace:Common"
|
||||||
|
d:DataContext="{d:DesignInstance Type=common:ParamControlIntRangeVm, IsDesignTimeCreatable=True}"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignWidth="600"
|
||||||
|
d:DesignHeight="120"
|
||||||
|
Width="Auto"
|
||||||
|
Height="Auto">
|
||||||
|
<Grid Height="70">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<!-- <ColumnDefinition Width="Auto" /> -->
|
||||||
|
<ColumnDefinition Width="400" />
|
||||||
|
<ColumnDefinition Width="200" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<Label x:Name="tbName" Grid.Column="0" Content="{Binding SName, Mode=OneWay }" FontSize="30" VerticalAlignment="Center"/>
|
||||||
|
<TextBox x:Name="tbValue" Text="{Binding Value, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Margin="10" Width="Auto" FontSize="30" Grid.Column="1" MaxLines="1" HorizontalContentAlignment="Right" VerticalContentAlignment="Center" IsReadOnly="{Binding Readonly}" />
|
||||||
|
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
31
uniper_hmi/UniperHMI/Common/ParamControlIntRange.xaml.cs
Normal file
31
uniper_hmi/UniperHMI/Common/ParamControlIntRange.xaml.cs
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
|
namespace Common;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Interaktionslogik für AnalogValue.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class ParamControlIntRange : UserControl
|
||||||
|
{
|
||||||
|
public bool IsReadonly { get; set; }
|
||||||
|
|
||||||
|
public ParamControlIntRange()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
// Unloaded += OnUnloaded;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnUnloaded(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var disposable = DataContext as IDisposable;
|
||||||
|
disposable?.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void NumberValidation(object sender, TextCompositionEventArgs e)
|
||||||
|
{
|
||||||
|
Regex regex = new("^[-+]?[0-9]*,?[0-9]+$");
|
||||||
|
e.Handled = regex.IsMatch(e.Text);
|
||||||
|
}
|
||||||
|
}
|
||||||
80
uniper_hmi/UniperHMI/Common/ParamControlIntRangeVM.cs
Normal file
80
uniper_hmi/UniperHMI/Common/ParamControlIntRangeVM.cs
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using InfineonHMI.Common;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using TwinCAT.TypeSystem;
|
||||||
|
|
||||||
|
namespace Common;
|
||||||
|
|
||||||
|
public sealed class InRangeAttribute(string propMin, string propMax) : ValidationAttribute
|
||||||
|
{
|
||||||
|
public string PropMin { get; } = propMin;
|
||||||
|
public string PropMax { get; } = propMax;
|
||||||
|
|
||||||
|
protected override ValidationResult? IsValid(object? value, ValidationContext validationContext)
|
||||||
|
{
|
||||||
|
object instance = validationContext.ObjectInstance;
|
||||||
|
int minValue = (int)(instance.GetType().GetProperty(PropMin)?.GetValue(instance) ?? 1);
|
||||||
|
int maxValue = (int)(instance.GetType().GetProperty(PropMax)?.GetValue(instance) ?? 1);
|
||||||
|
int tempValue = (int)(value ?? 1);
|
||||||
|
|
||||||
|
if (tempValue <= maxValue && tempValue >= minValue)
|
||||||
|
return ValidationResult.Success;
|
||||||
|
|
||||||
|
return new($"Value has to be greater than {minValue} and smaller then {maxValue}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public sealed partial class ParamControlIntRangeVm : ObservableValidator, IDisposable, IChangeTrackingEx
|
||||||
|
{
|
||||||
|
private int initValue;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private int iMin;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private int iMax;
|
||||||
|
|
||||||
|
[ObservableProperty] private string sName;
|
||||||
|
|
||||||
|
|
||||||
|
private int value;
|
||||||
|
|
||||||
|
[InRangeAttribute(nameof(IMin), nameof(IMax))]
|
||||||
|
public int Value
|
||||||
|
{
|
||||||
|
get => this.value;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref this.value, value, true);
|
||||||
|
if (value >= IMin && value <= IMax)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public ParamControlIntRangeVm()
|
||||||
|
{
|
||||||
|
SName = "No Name:";
|
||||||
|
Value = 0;
|
||||||
|
initValue = Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AcceptChanges()
|
||||||
|
{
|
||||||
|
initValue = Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsChanged => initValue != Value;
|
||||||
|
public void DiscardChanges()
|
||||||
|
{
|
||||||
|
Value = initValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
38
uniper_hmi/UniperHMI/Common/ParamControlIntVM.cs
Normal file
38
uniper_hmi/UniperHMI/Common/ParamControlIntVM.cs
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using InfineonHMI.Common;
|
||||||
|
|
||||||
|
namespace Common;
|
||||||
|
|
||||||
|
public sealed partial class ParamControlIntVm : ObservableValidator, IDisposable, IChangeTrackingEx
|
||||||
|
{
|
||||||
|
private int initValue;
|
||||||
|
|
||||||
|
[ObservableProperty] private string sName;
|
||||||
|
|
||||||
|
[ObservableProperty] private int value;
|
||||||
|
|
||||||
|
|
||||||
|
public ParamControlIntVm()
|
||||||
|
{
|
||||||
|
SName = "No Name:";
|
||||||
|
Value = 0;
|
||||||
|
initValue = Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AcceptChanges()
|
||||||
|
{
|
||||||
|
initValue = Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsChanged => initValue != Value;
|
||||||
|
public void DiscardChanges()
|
||||||
|
{
|
||||||
|
Value = initValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
57
uniper_hmi/UniperHMI/Common/User.cs
Normal file
57
uniper_hmi/UniperHMI/Common/User.cs
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace InfineonHMI.Common;
|
||||||
|
|
||||||
|
public static class Users
|
||||||
|
{
|
||||||
|
|
||||||
|
private static User CurrentUser { get; set; }
|
||||||
|
public static ObservableCollection<User> UsersCollection { get; set; }
|
||||||
|
|
||||||
|
public static void setCurrentUser(User u)
|
||||||
|
{
|
||||||
|
CurrentUser = new User(u);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static User getCurrentUser()
|
||||||
|
{
|
||||||
|
if (CurrentUser == null)
|
||||||
|
CurrentUser = new User("undefined", "undef", 0);
|
||||||
|
|
||||||
|
return CurrentUser;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public class User
|
||||||
|
{
|
||||||
|
public string? UserName { get; set; }
|
||||||
|
|
||||||
|
public string PasswordHash { get; set; }
|
||||||
|
|
||||||
|
public int UserLevel { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public User()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public User(User u)
|
||||||
|
{
|
||||||
|
UserName = u.UserName;
|
||||||
|
PasswordHash = u.PasswordHash;
|
||||||
|
UserLevel = u.UserLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public User(string name, string hash, int level)
|
||||||
|
{
|
||||||
|
UserName = name;
|
||||||
|
PasswordHash = hash;
|
||||||
|
UserLevel = level;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
52
uniper_hmi/UniperHMI/Common/UserManagementWindow.xaml
Normal file
52
uniper_hmi/UniperHMI/Common/UserManagementWindow.xaml
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
<Window x:Class="InfineonHMI.Common.UserManagementWindow"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:common="clr-namespace:Common"
|
||||||
|
d:DesignHeight="800" d:DesignWidth="1500"
|
||||||
|
d:DataContext="{d:DesignInstance Type=common:UserManagementWindowVm, IsDesignTimeCreatable=True}"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="Benutzer anmelden"
|
||||||
|
Icon="../Resources/user.png"
|
||||||
|
Height="800"
|
||||||
|
Width="1500"
|
||||||
|
Background="Black">
|
||||||
|
<Grid Margin="20">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="550"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="400"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<Label Grid.Row="0" Grid.Column="0" Content="Benutzername:" FontSize="50" Margin="20"/>
|
||||||
|
<ComboBox Grid.Row="0"
|
||||||
|
Grid.Column="1"
|
||||||
|
FontSize="40"
|
||||||
|
Margin="20"
|
||||||
|
ItemsSource="{Binding SavedUsers}" SelectedItem="{Binding SelectedUsername}"/>
|
||||||
|
<Button Grid.Row="0" Grid.Column="2"
|
||||||
|
Margin="20" Content="Löschen" FontSize="40" Command="{Binding DeleteUserCommand}"/>
|
||||||
|
|
||||||
|
<Label Grid.Column="0" Grid.Row="1" Content="Neuer Benutzer: " FontSize="50" Margin="20" />
|
||||||
|
<TextBox Grid.Column="1" Grid.Row="1" Margin="20" Text="{Binding NewUser}"/>
|
||||||
|
<Button Grid.Row="1" Grid.Column="2" Margin="20" Content="Anmelden" FontSize="40" Command="{Binding LoginCommand}"/>
|
||||||
|
|
||||||
|
<Label Grid.Column="0" Grid.Row="2" Content="Passwort: " FontSize="50" Margin="20" />
|
||||||
|
<TextBox Grid.Column="1" Grid.Row="2" FontSize="50" Margin="20" Text="{Binding SelectedUserPassword, UpdateSourceTrigger=PropertyChanged}" Foreground="Transparent" Background="Transparent" />
|
||||||
|
<Button Grid.Row="2" Grid.Column="2" Margin="20" Content="Erstellen" FontSize="40" Command="{Binding CreateUserCommand}" IsEnabled="{Binding IsCreateCommandEnabled}"/>
|
||||||
|
|
||||||
|
<Label Grid.Column="0" Grid.Row="3" Content="Passwort wiederholen: " FontSize="50" Margin="20" />
|
||||||
|
<TextBox Grid.Column="1" Grid.Row="3" FontSize="50" Margin="20" Text="{Binding SelectedUserPasswordWdh, UpdateSourceTrigger=PropertyChanged}" Foreground="Transparent" Background="Transparent"/>
|
||||||
|
|
||||||
|
<Button Grid.Row="5" Grid.Column="2" Height="80" Margin="20" Content="Abmelden" FontSize="40" Command="{Binding LogoffCommand}"/>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
17
uniper_hmi/UniperHMI/Common/UserManagementWindow.xaml.cs
Normal file
17
uniper_hmi/UniperHMI/Common/UserManagementWindow.xaml.cs
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace InfineonHMI.Common;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Login or change user dialog.
|
||||||
|
/// </summary>
|
||||||
|
public partial class UserManagementWindow
|
||||||
|
{
|
||||||
|
public UserManagementWindow()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
// Center dialog to MainWindow
|
||||||
|
Owner = Application.Current.MainWindow;
|
||||||
|
WindowStartupLocation = WindowStartupLocation.CenterOwner;
|
||||||
|
}
|
||||||
|
}
|
||||||
214
uniper_hmi/UniperHMI/Common/UserManagementWindowVm.cs
Normal file
214
uniper_hmi/UniperHMI/Common/UserManagementWindowVm.cs
Normal file
@@ -0,0 +1,214 @@
|
|||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using CommunityToolkit.Mvvm.Input;
|
||||||
|
using Heisig.HMI.AdsManager;
|
||||||
|
using HMIToolkit;
|
||||||
|
using InfineonHMI.Common;
|
||||||
|
using MahApps.Metro.Controls;
|
||||||
|
using Microsoft.Win32;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.Drawing.Text;
|
||||||
|
using System.Security;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using TwinCAT.TypeSystem;
|
||||||
|
|
||||||
|
namespace Common;
|
||||||
|
|
||||||
|
public sealed partial class UserManagementWindowVm : ObservableValidator
|
||||||
|
{
|
||||||
|
|
||||||
|
private IAdsManager _adsManager;
|
||||||
|
private readonly string _variableName;
|
||||||
|
|
||||||
|
[ObservableProperty] private string? selectedUsername;
|
||||||
|
|
||||||
|
[ObservableProperty] private string newUser;
|
||||||
|
|
||||||
|
[ObservableProperty] private ObservableCollection<string>? savedUsers;
|
||||||
|
|
||||||
|
private ObservableCollection<User> users;
|
||||||
|
|
||||||
|
private UserManagementWindow dlg = new UserManagementWindow();
|
||||||
|
|
||||||
|
private string selectedUserPassword;
|
||||||
|
|
||||||
|
private string filePath = "C:\\ProgramData\\InfineonHMI_UserData\\Userdata.xml";
|
||||||
|
|
||||||
|
private string selectedUserPasswordWdh;
|
||||||
|
public User CurrentUser { get; set; }
|
||||||
|
public string SelectedUserPassword
|
||||||
|
{
|
||||||
|
get { return selectedUserPassword; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref selectedUserPassword, value);
|
||||||
|
IsCreateCommandEnabled = SelectedUserPasswordWdh.Equals(value) && !string.IsNullOrEmpty(value)&& CurrentUser.UserLevel>0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string? SelectedUserPasswordWdh
|
||||||
|
{
|
||||||
|
get { return selectedUserPasswordWdh; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref selectedUserPasswordWdh, value);
|
||||||
|
IsCreateCommandEnabled = SelectedUserPassword.Equals(value) && !string.IsNullOrEmpty(value) && CurrentUser.UserLevel > 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[ObservableProperty] private bool isCreateCommandEnabled;
|
||||||
|
|
||||||
|
|
||||||
|
public UserManagementWindowVm()
|
||||||
|
{
|
||||||
|
IsCreateCommandEnabled = false;
|
||||||
|
CurrentUser = new("default", "default", 0);
|
||||||
|
users = L4ItXmlSerializer.DeSerializeObject<ObservableCollection<User>>(filePath);
|
||||||
|
savedUsers = new ObservableCollection<string>();
|
||||||
|
foreach (var user in users)
|
||||||
|
{
|
||||||
|
if (user.UserName != null)
|
||||||
|
savedUsers.Add(user.UserName);
|
||||||
|
}
|
||||||
|
|
||||||
|
selectedUserPassword = "";
|
||||||
|
selectedUserPasswordWdh = "";
|
||||||
|
selectedUsername = "";
|
||||||
|
SelectedUserPasswordWdh = "";
|
||||||
|
SelectedUserPassword = "";
|
||||||
|
SelectedUsername = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public UserManagementWindowVm(User curUser)
|
||||||
|
{
|
||||||
|
IsCreateCommandEnabled = true;
|
||||||
|
if (curUser != null)
|
||||||
|
{
|
||||||
|
CurrentUser = curUser;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Todo: For Deployment, set Userlevel to 0 if default!
|
||||||
|
CurrentUser = new User("unknown", "default", 100);
|
||||||
|
}
|
||||||
|
users = L4ItXmlSerializer.DeSerializeObject<ObservableCollection<User>>(filePath);
|
||||||
|
savedUsers = new ObservableCollection<string>();
|
||||||
|
if (users == null)
|
||||||
|
{
|
||||||
|
users = new ObservableCollection<User>();
|
||||||
|
users.Add(new User("default", "ssW+1nwLrdWTKi1tkE/pfQ==", 100));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
foreach (var user in users)
|
||||||
|
{
|
||||||
|
if(user.UserName != null)
|
||||||
|
savedUsers.Add(user.UserName);
|
||||||
|
}
|
||||||
|
|
||||||
|
selectedUserPassword = "";
|
||||||
|
selectedUserPasswordWdh = "";
|
||||||
|
selectedUsername = "";
|
||||||
|
SelectedUserPasswordWdh = "";
|
||||||
|
SelectedUserPassword = "";
|
||||||
|
SelectedUsername = "";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public User GetCurrentUserLevel()
|
||||||
|
{
|
||||||
|
dlg.DataContext = this;
|
||||||
|
|
||||||
|
dlg.ShowDialog();
|
||||||
|
|
||||||
|
return CurrentUser;
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private void Login()
|
||||||
|
{
|
||||||
|
|
||||||
|
User userInFile = new User("default", "default", 0);
|
||||||
|
bool userFound = false;
|
||||||
|
foreach (var user in users)
|
||||||
|
{
|
||||||
|
if (user.UserName.Equals(SelectedUsername))
|
||||||
|
{
|
||||||
|
userInFile = user;
|
||||||
|
userFound = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (userFound && CheckPassword(userInFile))
|
||||||
|
{
|
||||||
|
CurrentUser = userInFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
dlg.Close();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private void Logoff()
|
||||||
|
{
|
||||||
|
CurrentUser = new User("default", "default", 0);
|
||||||
|
dlg.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private void CreateUser()
|
||||||
|
{
|
||||||
|
if(!SelectedUserPassword.Equals(SelectedUserPasswordWdh))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (users == null)
|
||||||
|
users = new ();
|
||||||
|
var u = new User
|
||||||
|
{
|
||||||
|
UserName = NewUser,
|
||||||
|
PasswordHash = L4ItXmlSerializer.Encrypt(SelectedUserPassword),
|
||||||
|
UserLevel = 100,
|
||||||
|
};
|
||||||
|
|
||||||
|
users.Add(new User(u));
|
||||||
|
SavedUsers.Add(NewUser);
|
||||||
|
|
||||||
|
SelectedUserPassword = "";
|
||||||
|
SelectedUserPasswordWdh = "";
|
||||||
|
|
||||||
|
L4ItXmlSerializer.SerializeObject(users, filePath);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private void DeleteUser()
|
||||||
|
{
|
||||||
|
if (SelectedUsername.Equals("default"))
|
||||||
|
return;
|
||||||
|
|
||||||
|
users.Remove(users.First(user => user.UserName.Equals(SelectedUsername)));
|
||||||
|
|
||||||
|
SavedUsers = new ObservableCollection<string>();
|
||||||
|
foreach (var user in users)
|
||||||
|
{
|
||||||
|
SavedUsers.Add(user.UserName);
|
||||||
|
}
|
||||||
|
|
||||||
|
L4ItXmlSerializer.SerializeObject(users, filePath);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool CheckPassword(User user)
|
||||||
|
{
|
||||||
|
var hashcode = L4ItXmlSerializer.Decrypt(user.PasswordHash);
|
||||||
|
if (hashcode.Equals(SelectedUserPassword))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
34
uniper_hmi/UniperHMI/Common/WorkingmodeToColorConverter.cs
Normal file
34
uniper_hmi/UniperHMI/Common/WorkingmodeToColorConverter.cs
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
using System.Diagnostics.Eventing.Reader;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Data;
|
||||||
|
|
||||||
|
namespace Common;
|
||||||
|
|
||||||
|
class WorkingmodeToColorConverter : IValueConverter
|
||||||
|
{
|
||||||
|
public Object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (targetType != typeof(System.Windows.Media.Brush))
|
||||||
|
throw new InvalidOperationException("The target must be a brush");
|
||||||
|
|
||||||
|
|
||||||
|
#pragma warning disable CS8604 // Mögliches Nullverweisargument.
|
||||||
|
var selected = (bool)value;
|
||||||
|
#pragma warning restore CS8604 // Mögliches Nullverweisargument.
|
||||||
|
|
||||||
|
if (selected)
|
||||||
|
{
|
||||||
|
return System.Windows.Media.Brushes.LightSeaGreen;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{ return DependencyProperty.UnsetValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
return DependencyProperty.UnsetValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,32 +2,31 @@
|
|||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Data;
|
using System.Windows.Data;
|
||||||
|
|
||||||
namespace UniperHMI
|
namespace InfineonHMI;
|
||||||
{
|
|
||||||
public class DateTimeToEventTimeConverter : IValueConverter
|
|
||||||
{
|
|
||||||
// 599264352000000000 ticks is a date used by beckhoff for events that didnt happen up to this point
|
|
||||||
public const long NoTime = 599264352000000000;
|
|
||||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
||||||
{
|
|
||||||
if (value is DateTime dt)
|
|
||||||
{
|
|
||||||
|
|
||||||
if (dt.Ticks == NoTime)
|
|
||||||
return "";
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CultureInfo cultureInfo = CultureInfo.CurrentCulture;
|
|
||||||
return dt.ToString("G", cultureInfo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
throw new InvalidOperationException("Target must be of type DateTime");
|
|
||||||
}
|
|
||||||
|
|
||||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
public class DateTimeToEventTimeConverter : IValueConverter
|
||||||
{
|
{
|
||||||
return DependencyProperty.UnsetValue;
|
// 599264352000000000 ticks is a date used by beckhoff for events that didnt happen up to this point
|
||||||
}
|
public const long NoTime = 599264352000000000;
|
||||||
}
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
}
|
{
|
||||||
|
if (value is DateTime dt)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (dt.Ticks == NoTime)
|
||||||
|
return "";
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CultureInfo cultureInfo = CultureInfo.CurrentCulture;
|
||||||
|
return dt.ToString("G", cultureInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
throw new InvalidOperationException("Target must be of type DateTime");
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
return DependencyProperty.UnsetValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
<Window xmlns:HMIToolkit="clr-namespace:HMIToolkit" x:Class="UniperHMI.BinaryValveWindow"
|
<Window xmlns:HMIToolkit="clr-namespace:HMIToolkit" x:Class="InfineonHMI.BinaryValveWindow"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:local="clr-namespace:UniperHMI"
|
xmlns:local="clr-namespace:HMIToolkit"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="BinaryValveWindow" SizeToContent="WidthAndHeight" ResizeMode="NoResize">
|
Title="BinaryValveWindow" SizeToContent="WidthAndHeight" ResizeMode="NoResize">
|
||||||
<Grid>
|
<Grid>
|
||||||
|
|||||||
@@ -1,15 +1,14 @@
|
|||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
|
||||||
namespace UniperHMI
|
namespace InfineonHMI;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Interaktionslogik für BinaryValveWindow.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class BinaryValveWindow : Window
|
||||||
{
|
{
|
||||||
/// <summary>
|
public BinaryValveWindow()
|
||||||
/// Interaktionslogik für BinaryValveWindow.xaml
|
{
|
||||||
/// </summary>
|
InitializeComponent();
|
||||||
public partial class BinaryValveWindow : Window
|
}
|
||||||
{
|
}
|
||||||
public BinaryValveWindow()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,23 +1,22 @@
|
|||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
|
||||||
|
|
||||||
namespace HMIToolkit
|
namespace HMIToolkit;
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Interaktionslogik für AnalogMotorControl.xaml
|
|
||||||
/// </summary>
|
|
||||||
public partial class AnalogMotorControl : UserControl
|
|
||||||
{
|
|
||||||
public AnalogMotorControl()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
// Unloaded += OnUnloaded;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnUnloaded(object? sender, EventArgs e)
|
/// <summary>
|
||||||
{
|
/// Interaktionslogik für AnalogMotorControl.xaml
|
||||||
var disposable = DataContext as IDisposable;
|
/// </summary>
|
||||||
disposable?.Dispose();
|
public partial class AnalogMotorControl : UserControl
|
||||||
}
|
{
|
||||||
}
|
public AnalogMotorControl()
|
||||||
}
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
// Unloaded += OnUnloaded;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnUnloaded(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var disposable = DataContext as IDisposable;
|
||||||
|
disposable?.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,82 +2,81 @@
|
|||||||
using TwinCAT.TypeSystem;
|
using TwinCAT.TypeSystem;
|
||||||
using Heisig.HMI.AdsManager;
|
using Heisig.HMI.AdsManager;
|
||||||
|
|
||||||
namespace HMIToolkit
|
namespace HMIToolkit;
|
||||||
|
|
||||||
|
public sealed partial class AnalogMotorControlVM : ObservableObject
|
||||||
{
|
{
|
||||||
public sealed partial class AnalogMotorControlVM : ObservableObject
|
[ObservableProperty]
|
||||||
{
|
private string sName = "No Name";
|
||||||
[ObservableProperty]
|
|
||||||
private string sName = "No Name";
|
|
||||||
|
|
||||||
public HMIControlButtonVM? AutomaticButton { get; private set; }
|
public HMIControlButtonVM? AutomaticButton { get; private set; }
|
||||||
public HMIControlButtonVM? ManualButton { get; private set; }
|
public HMIControlButtonVM? ManualButton { get; private set; }
|
||||||
public HMIControlButtonVM StartButton { get; private set; }
|
public HMIControlButtonVM StartButton { get; private set; }
|
||||||
public HMIControlButtonVM StopButton { get; private set; }
|
public HMIControlButtonVM StopButton { get; private set; }
|
||||||
public IntlkControlVM? Interlocks { get; private set; }
|
public IntlkControlVM? Interlocks { get; private set; }
|
||||||
public AnalogValueVM? Setpoint { get; private set; }
|
public AnalogValueVM? Setpoint { get; private set; }
|
||||||
public AnalogValueVM? ProcessValue { get; private set; }
|
public AnalogValueVM? ProcessValue { get; private set; }
|
||||||
|
|
||||||
private readonly string? _variableName;
|
private readonly string? _variableName;
|
||||||
|
|
||||||
private IAdsManager? _adsManager;
|
private IAdsManager? _adsManager;
|
||||||
|
|
||||||
public AnalogMotorControlVM()
|
public AnalogMotorControlVM()
|
||||||
{
|
{
|
||||||
AutomaticButton = new HMIControlButtonVM();
|
AutomaticButton = new HMIControlButtonVM();
|
||||||
ManualButton = new HMIControlButtonVM();
|
ManualButton = new HMIControlButtonVM();
|
||||||
StartButton = new HMIControlButtonVM();
|
StartButton = new HMIControlButtonVM();
|
||||||
StopButton = new HMIControlButtonVM();
|
StopButton = new HMIControlButtonVM();
|
||||||
Interlocks = new IntlkControlVM();
|
Interlocks = new IntlkControlVM();
|
||||||
Setpoint = new AnalogValueVM();
|
Setpoint = new AnalogValueVM();
|
||||||
ProcessValue = new AnalogValueVM();
|
ProcessValue = new AnalogValueVM();
|
||||||
}
|
}
|
||||||
|
|
||||||
public AnalogMotorControlVM(IAdsManager adsManager, string variableName)
|
public AnalogMotorControlVM(IAdsManager adsManager, string variableName)
|
||||||
{
|
{
|
||||||
_adsManager = adsManager;
|
_adsManager = adsManager;
|
||||||
_variableName = variableName;
|
_variableName = variableName;
|
||||||
AutomaticButton = new HMIControlButtonVM(_adsManager, _variableName + ".stAutomaticButton");
|
AutomaticButton = new HMIControlButtonVM(_adsManager, _variableName + ".stAutomaticButton");
|
||||||
ManualButton = new HMIControlButtonVM(_adsManager, _variableName + ".stManualButton");
|
ManualButton = new HMIControlButtonVM(_adsManager, _variableName + ".stManualButton");
|
||||||
StartButton = new HMIControlButtonVM(_adsManager, _variableName + ".stStartButton");
|
StartButton = new HMIControlButtonVM(_adsManager, _variableName + ".stStartButton");
|
||||||
StopButton = new HMIControlButtonVM(_adsManager, _variableName + ".stStopButton");
|
StopButton = new HMIControlButtonVM(_adsManager, _variableName + ".stStopButton");
|
||||||
Interlocks = new IntlkControlVM(_adsManager, _variableName + ".stInterlock");
|
Interlocks = new IntlkControlVM(_adsManager, _variableName + ".stInterlock");
|
||||||
Setpoint = new AnalogValueVM(_adsManager, _variableName + ".stSetpoint", false);
|
Setpoint = new AnalogValueVM(_adsManager, _variableName + ".stSetpoint", false);
|
||||||
ProcessValue = new AnalogValueVM(_adsManager, _variableName + ".stProcessValue", true);
|
ProcessValue = new AnalogValueVM(_adsManager, _variableName + ".stProcessValue", true);
|
||||||
|
|
||||||
|
|
||||||
_adsManager.Register(_variableName + ".sName", NameChanged);
|
_adsManager.Register(_variableName + ".sName", NameChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_adsManager?.Deregister(_variableName + ".sName", NameChanged);
|
_adsManager?.Deregister(_variableName + ".sName", NameChanged);
|
||||||
_adsManager = null;
|
_adsManager = null;
|
||||||
|
|
||||||
AutomaticButton?.Dispose();
|
AutomaticButton?.Dispose();
|
||||||
AutomaticButton = null;
|
AutomaticButton = null;
|
||||||
|
|
||||||
ManualButton?.Dispose();
|
ManualButton?.Dispose();
|
||||||
ManualButton = null;
|
ManualButton = null;
|
||||||
|
|
||||||
StartButton?.Dispose();
|
StartButton?.Dispose();
|
||||||
StartButton = null;
|
StartButton = null;
|
||||||
|
|
||||||
StopButton?.Dispose();
|
StopButton?.Dispose();
|
||||||
StopButton = null;
|
StopButton = null;
|
||||||
|
|
||||||
Interlocks?.Dispose();
|
Interlocks?.Dispose();
|
||||||
Interlocks = null;
|
Interlocks = null;
|
||||||
|
|
||||||
Setpoint?.Dispose();
|
Setpoint?.Dispose();
|
||||||
Setpoint = null;
|
Setpoint = null;
|
||||||
|
|
||||||
ProcessValue?.Dispose();
|
ProcessValue?.Dispose();
|
||||||
ProcessValue = null;
|
ProcessValue = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void NameChanged(object? sender, ValueChangedEventArgs e)
|
private void NameChanged(object? sender, ValueChangedEventArgs e)
|
||||||
{
|
{
|
||||||
SName = (string)e.Value;
|
SName = (string)e.Value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@@ -2,32 +2,31 @@
|
|||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
|
||||||
namespace HMIToolkit
|
namespace HMIToolkit;
|
||||||
|
|
||||||
|
public sealed partial class AnalogRangeValidator : ValidationRule
|
||||||
{
|
{
|
||||||
public sealed partial class AnalogRangeValidator : ValidationRule
|
public float Min { get; set; }
|
||||||
{
|
|
||||||
public float Min { get; set; }
|
|
||||||
|
|
||||||
public float Max { get; set; }
|
public float Max { get; set; }
|
||||||
|
|
||||||
public override ValidationResult Validate(object value, CultureInfo cultureInfo)
|
public override ValidationResult Validate(object value, CultureInfo cultureInfo)
|
||||||
{
|
{
|
||||||
float analogValue = 0;
|
float analogValue = 0;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (((string)value).Length > 0)
|
if (((string)value).Length > 0)
|
||||||
analogValue = float.Parse((string)value);
|
analogValue = float.Parse((string)value);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
return new ValidationResult(false, $"Illegal characters or {e.Message}");
|
return new ValidationResult(false, $"Illegal characters or {e.Message}");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((analogValue < Min) || (analogValue > Max))
|
if ((analogValue < Min) || (analogValue > Max))
|
||||||
return new ValidationResult(false, $"Please enter a value in the range: {Min}-{Max}.");
|
return new ValidationResult(false, $"Please enter a value in the range: {Min}-{Max}.");
|
||||||
|
|
||||||
return ValidationResult.ValidResult;
|
return ValidationResult.ValidResult;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@@ -26,8 +26,8 @@
|
|||||||
|
|
||||||
<!-- <Label Grid.Column="0" Content="{Binding SName}" VerticalAlignment="Center" HorizontalAlignment="Left"/> -->
|
<!-- <Label Grid.Column="0" Content="{Binding SName}" VerticalAlignment="Center" HorizontalAlignment="Left"/> -->
|
||||||
|
|
||||||
<TextBox x:Name="tbValue" Text="{Binding RValue, Mode=TwoWay, StringFormat=N2}" Grid.Column="0" MaxLines="1" Width="125" HorizontalContentAlignment="Right" VerticalContentAlignment="Center" IsReadOnly="{Binding Readonly}" />
|
<TextBox x:Name="tbValue" Text="{Binding RValue, Mode=TwoWay, StringFormat=N2}" Grid.Column="0" MaxLines="1" FontSize="40" Width="150" HorizontalContentAlignment="Center" VerticalAlignment="Center" VerticalContentAlignment="Center" HorizontalAlignment="Left" IsReadOnly="{Binding Readonly}" />
|
||||||
<Label Grid.Column="1" Content="{Binding SUnit}" VerticalAlignment="Center" HorizontalAlignment="Left"/>
|
<Label Grid.Column="1" Content="{Binding SUnit}" VerticalAlignment="Center" FontSize="35" HorizontalAlignment="Left"/>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|||||||
@@ -2,31 +2,30 @@
|
|||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
|
|
||||||
namespace HMIToolkit
|
namespace HMIToolkit;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Interaktionslogik für AnalogValue.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class AnalogValue : UserControl
|
||||||
{
|
{
|
||||||
/// <summary>
|
public bool IsReadonly { get; set; }
|
||||||
/// Interaktionslogik für AnalogValue.xaml
|
|
||||||
/// </summary>
|
|
||||||
public partial class AnalogValue : UserControl
|
|
||||||
{
|
|
||||||
public bool IsReadonly { get; set; }
|
|
||||||
|
|
||||||
public AnalogValue()
|
public AnalogValue()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
// Unloaded += OnUnloaded;
|
// Unloaded += OnUnloaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnUnloaded(object? sender, EventArgs e)
|
private void OnUnloaded(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var disposable = DataContext as IDisposable;
|
var disposable = DataContext as IDisposable;
|
||||||
disposable?.Dispose();
|
disposable?.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void NumberValidation(object sender, TextCompositionEventArgs e)
|
private void NumberValidation(object sender, TextCompositionEventArgs e)
|
||||||
{
|
{
|
||||||
Regex regex = new("^[-+]?[0-9]*,?[0-9]+$");
|
Regex regex = new("^[-+]?[0-9]*,?[0-9]+$");
|
||||||
e.Handled = regex.IsMatch(e.Text);
|
e.Handled = regex.IsMatch(e.Text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@@ -13,23 +13,22 @@ using System.Windows.Media.Imaging;
|
|||||||
using System.Windows.Navigation;
|
using System.Windows.Navigation;
|
||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
namespace HMIToolkit
|
namespace HMIToolkit;
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Interaktionslogik für AnalogValveControl.xaml
|
|
||||||
/// </summary>
|
|
||||||
public partial class AnalogValveControl : UserControl
|
|
||||||
{
|
|
||||||
public AnalogValveControl()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
// Unloaded += OnUnloaded;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnUnloaded(object? sender, EventArgs e)
|
/// <summary>
|
||||||
{
|
/// Interaktionslogik für AnalogValveControl.xaml
|
||||||
var disposable = DataContext as IDisposable;
|
/// </summary>
|
||||||
disposable?.Dispose();
|
public partial class AnalogValveControl : UserControl
|
||||||
}
|
{
|
||||||
}
|
public AnalogValveControl()
|
||||||
}
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
// Unloaded += OnUnloaded;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnUnloaded(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var disposable = DataContext as IDisposable;
|
||||||
|
disposable?.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,82 +2,81 @@
|
|||||||
using TwinCAT.TypeSystem;
|
using TwinCAT.TypeSystem;
|
||||||
using Heisig.HMI.AdsManager;
|
using Heisig.HMI.AdsManager;
|
||||||
|
|
||||||
namespace HMIToolkit
|
namespace HMIToolkit;
|
||||||
|
|
||||||
|
public sealed partial class AnalogValveControlVM : ObservableObject
|
||||||
{
|
{
|
||||||
public sealed partial class AnalogValveControlVM : ObservableObject
|
[ObservableProperty]
|
||||||
{
|
private string sName = "No Name";
|
||||||
[ObservableProperty]
|
|
||||||
private string sName = "No Name";
|
|
||||||
|
|
||||||
public HMIControlButtonVM? AutomaticButton { get; private set; }
|
public HMIControlButtonVM? AutomaticButton { get; private set; }
|
||||||
public HMIControlButtonVM? ManualButton { get; private set; }
|
public HMIControlButtonVM? ManualButton { get; private set; }
|
||||||
public HMIControlButtonVM? OpenButton { get; private set; }
|
public HMIControlButtonVM? OpenButton { get; private set; }
|
||||||
public HMIControlButtonVM? CloseButton { get; private set; }
|
public HMIControlButtonVM? CloseButton { get; private set; }
|
||||||
public IntlkControlVM? Interlocks { get; private set; }
|
public IntlkControlVM? Interlocks { get; private set; }
|
||||||
public AnalogValueVM? Setpoint { get; private set; }
|
public AnalogValueVM? Setpoint { get; private set; }
|
||||||
public AnalogValueVM? ProcessValue { get; private set; }
|
public AnalogValueVM? ProcessValue { get; private set; }
|
||||||
|
|
||||||
private readonly string? _variableName;
|
private readonly string? _variableName;
|
||||||
|
|
||||||
private IAdsManager? _adsManager;
|
private IAdsManager? _adsManager;
|
||||||
|
|
||||||
public AnalogValveControlVM()
|
public AnalogValveControlVM()
|
||||||
{
|
{
|
||||||
AutomaticButton = new HMIControlButtonVM();
|
AutomaticButton = new HMIControlButtonVM();
|
||||||
ManualButton = new HMIControlButtonVM();
|
ManualButton = new HMIControlButtonVM();
|
||||||
OpenButton = new HMIControlButtonVM();
|
OpenButton = new HMIControlButtonVM();
|
||||||
CloseButton = new HMIControlButtonVM();
|
CloseButton = new HMIControlButtonVM();
|
||||||
Interlocks = new IntlkControlVM();
|
Interlocks = new IntlkControlVM();
|
||||||
Setpoint = new AnalogValueVM();
|
Setpoint = new AnalogValueVM();
|
||||||
ProcessValue = new AnalogValueVM();
|
ProcessValue = new AnalogValueVM();
|
||||||
}
|
}
|
||||||
|
|
||||||
public AnalogValveControlVM(IAdsManager adsManager, string variableName)
|
public AnalogValveControlVM(IAdsManager adsManager, string variableName)
|
||||||
{
|
{
|
||||||
_adsManager = adsManager;
|
_adsManager = adsManager;
|
||||||
_variableName = variableName;
|
_variableName = variableName;
|
||||||
AutomaticButton = new HMIControlButtonVM(_adsManager, _variableName + ".stAutomaticButton");
|
AutomaticButton = new HMIControlButtonVM(_adsManager, _variableName + ".stAutomaticButton");
|
||||||
ManualButton = new HMIControlButtonVM(_adsManager, _variableName + ".stManualButton");
|
ManualButton = new HMIControlButtonVM(_adsManager, _variableName + ".stManualButton");
|
||||||
OpenButton = new HMIControlButtonVM(_adsManager, _variableName + ".stOpenButton");
|
OpenButton = new HMIControlButtonVM(_adsManager, _variableName + ".stOpenButton");
|
||||||
CloseButton = new HMIControlButtonVM(_adsManager, _variableName + ".stCloseButton");
|
CloseButton = new HMIControlButtonVM(_adsManager, _variableName + ".stCloseButton");
|
||||||
Interlocks = new IntlkControlVM(_adsManager, _variableName + ".stInterlock");
|
Interlocks = new IntlkControlVM(_adsManager, _variableName + ".stInterlock");
|
||||||
Setpoint = new AnalogValueVM(_adsManager, _variableName + ".stSetpoint", false);
|
Setpoint = new AnalogValueVM(_adsManager, _variableName + ".stSetpoint", false);
|
||||||
ProcessValue = new AnalogValueVM(_adsManager, _variableName + ".stProcessValue", true);
|
ProcessValue = new AnalogValueVM(_adsManager, _variableName + ".stProcessValue", true);
|
||||||
|
|
||||||
|
|
||||||
_adsManager.Register(_variableName + ".sName", NameChanged);
|
_adsManager.Register(_variableName + ".sName", NameChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_adsManager?.Deregister(_variableName + ".sName", NameChanged);
|
_adsManager?.Deregister(_variableName + ".sName", NameChanged);
|
||||||
_adsManager = null;
|
_adsManager = null;
|
||||||
|
|
||||||
AutomaticButton?.Dispose();
|
AutomaticButton?.Dispose();
|
||||||
AutomaticButton = null;
|
AutomaticButton = null;
|
||||||
|
|
||||||
ManualButton?.Dispose();
|
ManualButton?.Dispose();
|
||||||
ManualButton = null;
|
ManualButton = null;
|
||||||
|
|
||||||
OpenButton?.Dispose();
|
OpenButton?.Dispose();
|
||||||
OpenButton = null;
|
OpenButton = null;
|
||||||
|
|
||||||
CloseButton?.Dispose();
|
CloseButton?.Dispose();
|
||||||
CloseButton = null;
|
CloseButton = null;
|
||||||
|
|
||||||
Interlocks?.Dispose();
|
Interlocks?.Dispose();
|
||||||
Interlocks = null;
|
Interlocks = null;
|
||||||
|
|
||||||
Setpoint?.Dispose();
|
Setpoint?.Dispose();
|
||||||
Setpoint = null;
|
Setpoint = null;
|
||||||
|
|
||||||
ProcessValue?.Dispose();
|
ProcessValue?.Dispose();
|
||||||
ProcessValue = null;
|
ProcessValue = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void NameChanged(object? sender, ValueChangedEventArgs e)
|
private void NameChanged(object? sender, ValueChangedEventArgs e)
|
||||||
{
|
{
|
||||||
SName = (string)e.Value;
|
SName = (string)e.Value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@@ -8,31 +8,33 @@
|
|||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Height="Auto"
|
Height="Auto"
|
||||||
Width="Auto">
|
Width="Auto">
|
||||||
|
|
||||||
<UserControl.Resources>
|
<UserControl.Resources>
|
||||||
<local:FeedbackToColorConverter x:Key="feedbackConverter" />
|
<local:FeedbackToColorConverter x:Key="feedbackConverter" />
|
||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
<!-- Style to see things in the designer-->
|
<!-- Style to see things in the designer-->
|
||||||
<d:DesignerProperties.DesignStyle>
|
<d:DesignerProperties.DesignStyle>
|
||||||
<Style TargetType="UserControl">
|
<Style TargetType="UserControl">
|
||||||
<!-- Property="Background" Value="White" /> -->
|
<!--Property="Background" Value="White" />-->
|
||||||
<Setter Property="Height" Value="Auto" />
|
<Setter Property="Height" Value="Auto" />
|
||||||
<Setter Property="Width" Value="Auto" />
|
<Setter Property="Width" Value="Auto" />
|
||||||
</Style>
|
</Style>
|
||||||
</d:DesignerProperties.DesignStyle>
|
</d:DesignerProperties.DesignStyle>
|
||||||
|
<Border BorderThickness="2" BorderBrush="White">
|
||||||
<Grid Margin="5" ShowGridLines="True">
|
<Grid Margin="5">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="55" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
|
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<!-- Row 0 -->
|
<!-- Row 0 -->
|
||||||
<Label Grid.Row="0" Content="{Binding SName}" HorizontalAlignment="Center" FontSize="24" FontWeight="Bold"/>
|
<Label Grid.Row="0" Content="{Binding SName}" HorizontalAlignment="Center" FontSize="35" FontWeight="Bold"/>
|
||||||
|
|
||||||
<!-- Row 1 -->
|
<!-- Row 1 -->
|
||||||
<Label Grid.Row="1" Content="Interlocks:" Margin="0,0,0,-3"/>
|
<Label Grid.Row="1" Content="Interlocks:" FontSize="30"/>
|
||||||
|
|
||||||
<!-- Row 2 -->
|
<!-- Row 2 -->
|
||||||
<Grid Grid.Row="2">
|
<Grid Grid.Row="2">
|
||||||
@@ -49,9 +51,9 @@
|
|||||||
<ColumnDefinition Width="*" />
|
<ColumnDefinition Width="*" />
|
||||||
<ColumnDefinition Width="*" />
|
<ColumnDefinition Width="*" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Label Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Content="Control:" Margin="0,0,0,-3" />
|
<Label Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" FontSize="30" Content="Control:"/>
|
||||||
<Button x:Name="btnOpen" DataContext="{Binding OpenButton}" Command="{Binding ButtonClickedCommand}" IsEnabled="{Binding XRelease}" Background="{Binding IFeedback, Converter={StaticResource feedbackConverter}}" Grid.Row="1" Grid.Column="0" Content="Open" Height="80" Width="80" Margin="0,0,5,5" />
|
<Button x:Name="btnOpen" DataContext="{Binding OpenButton}" Command="{Binding ButtonClickedCommand}" IsEnabled="{Binding XRelease}" Background="{Binding IFeedback, Converter={StaticResource feedbackConverter}}" Grid.Row="1" Grid.Column="0" Content="Open" FontSize="40" Height="70" Width="150" Margin="0,0,5,5" />
|
||||||
<Button x:Name="btnClose" DataContext="{Binding CloseButton}" Command="{Binding ButtonClickedCommand}" IsEnabled="{Binding XRelease}" Background="{Binding IFeedback, Converter={StaticResource feedbackConverter}}" Grid.Row="1" Grid.Column="1" Content="Close" Height="80" Width="80" Margin="0,-5,0,0"/>
|
<Button x:Name="btnClose" DataContext="{Binding CloseButton}" Command="{Binding ButtonClickedCommand}" IsEnabled="{Binding XRelease}" Background="{Binding IFeedback, Converter={StaticResource feedbackConverter}}" Grid.Row="1" Grid.Column="1" Content="Close" FontSize="40" Height="70" Width="150" Margin="0,-5,0,0"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<!-- Row 4 -->
|
<!-- Row 4 -->
|
||||||
@@ -65,10 +67,11 @@
|
|||||||
<ColumnDefinition Width="*" />
|
<ColumnDefinition Width="*" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
<Label Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Content="Mode:" Margin="0,0,0,-3" />
|
<Label Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" FontSize="30" Content="Mode:" />
|
||||||
<Button x:Name="btnAuto" DataContext="{Binding AutomaticButton}" Command="{Binding ButtonClickedCommand}" IsEnabled="{Binding XRelease}" Grid.Row="1" Grid.Column="0" Content="Auto" Height="80" Width="80" Margin="0,0,5,0"/>
|
<Button x:Name="btnAuto" DataContext="{Binding AutomaticButton}" Command="{Binding ButtonClickedCommand}" IsEnabled="{Binding XRelease}" Grid.Row="1" Grid.Column="0" Content="Auto" FontSize="30" Height="70" Width="150" Margin="0,0,5,0"/>
|
||||||
<Button x:Name="btnManual" DataContext="{Binding ManualButton}" Command="{Binding ButtonClickedCommand}" IsEnabled="{Binding XRelease}" Grid.Row="1" Grid.Column="1" Content="Man" Height="80" Width="80" Margin="0,-5,0,-5"/>
|
<Button x:Name="btnManual" DataContext="{Binding ManualButton}" Command="{Binding ButtonClickedCommand}" IsEnabled="{Binding XRelease}" Grid.Row="1" Grid.Column="1" Content="Man" FontSize="30" Height="70" Width="150" Margin="0,-5,0,-5"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
|
</Border>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|||||||
@@ -13,23 +13,22 @@ using System.Windows.Media.Imaging;
|
|||||||
using System.Windows.Navigation;
|
using System.Windows.Navigation;
|
||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
namespace HMIToolkit
|
namespace HMIToolkit;
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Interaktionslogik für BinaryValveControl.xaml
|
|
||||||
/// </summary>
|
|
||||||
public partial class BinaryValveControl : UserControl
|
|
||||||
{
|
|
||||||
public BinaryValveControl()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
// Unloaded += OnUnloaded;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnUnloaded(object? sender, EventArgs e)
|
/// <summary>
|
||||||
{
|
/// Interaktionslogik für BinaryValveControl.xaml
|
||||||
var disposable = DataContext as IDisposable;
|
/// </summary>
|
||||||
disposable?.Dispose();
|
public partial class BinaryValveControl : UserControl
|
||||||
}
|
{
|
||||||
}
|
public BinaryValveControl()
|
||||||
}
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
// Unloaded += OnUnloaded;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnUnloaded(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var disposable = DataContext as IDisposable;
|
||||||
|
disposable?.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,67 +4,66 @@ using Heisig.HMI.AdsManager;
|
|||||||
|
|
||||||
// {Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.OpenButton}
|
// {Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.OpenButton}
|
||||||
|
|
||||||
namespace HMIToolkit
|
namespace HMIToolkit;
|
||||||
|
|
||||||
|
public sealed partial class BinaryValveControlVM : ObservableObject, IDisposable
|
||||||
{
|
{
|
||||||
public sealed partial class BinaryValveControlVM : ObservableObject, IDisposable
|
[ObservableProperty]
|
||||||
{
|
private string sName = "No Name";
|
||||||
[ObservableProperty]
|
|
||||||
private string sName = "No Name";
|
|
||||||
|
|
||||||
public HMIControlButtonVM? AutomaticButton { get; private set; }
|
public HMIControlButtonVM? AutomaticButton { get; private set; }
|
||||||
public HMIControlButtonVM? ManualButton { get; private set; }
|
public HMIControlButtonVM? ManualButton { get; private set; }
|
||||||
public HMIControlButtonVM OpenButton { get; private set; }
|
public HMIControlButtonVM OpenButton { get; private set; }
|
||||||
public HMIControlButtonVM CloseButton { get; private set; }
|
public HMIControlButtonVM CloseButton { get; private set; }
|
||||||
public IntlkControlVM? Interlocks { get; private set; }
|
public IntlkControlVM? Interlocks { get; private set; }
|
||||||
|
|
||||||
private readonly string? _variableName;
|
private readonly string? _variableName;
|
||||||
|
|
||||||
private IAdsManager? _adsManager;
|
private IAdsManager? _adsManager;
|
||||||
|
|
||||||
public BinaryValveControlVM()
|
public BinaryValveControlVM()
|
||||||
{
|
{
|
||||||
AutomaticButton = new HMIControlButtonVM();
|
AutomaticButton = new HMIControlButtonVM();
|
||||||
ManualButton = new HMIControlButtonVM();
|
ManualButton = new HMIControlButtonVM();
|
||||||
OpenButton = new HMIControlButtonVM();
|
OpenButton = new HMIControlButtonVM();
|
||||||
CloseButton = new HMIControlButtonVM();
|
CloseButton = new HMIControlButtonVM();
|
||||||
Interlocks = new IntlkControlVM();
|
Interlocks = new IntlkControlVM();
|
||||||
}
|
}
|
||||||
|
|
||||||
public BinaryValveControlVM(IAdsManager adsManager, string variableName)
|
public BinaryValveControlVM(IAdsManager adsManager, string variableName)
|
||||||
{
|
{
|
||||||
_adsManager = adsManager;
|
_adsManager = adsManager;
|
||||||
_variableName = variableName;
|
_variableName = variableName;
|
||||||
AutomaticButton = new HMIControlButtonVM(_adsManager, _variableName + ".stAutomaticButton");
|
AutomaticButton = new HMIControlButtonVM(_adsManager, _variableName + ".stAutomaticButton");
|
||||||
ManualButton = new HMIControlButtonVM(_adsManager, _variableName + ".stManualButton");
|
ManualButton = new HMIControlButtonVM(_adsManager, _variableName + ".stManualButton");
|
||||||
OpenButton = new HMIControlButtonVM(_adsManager, _variableName + ".stOpenButton");
|
OpenButton = new HMIControlButtonVM(_adsManager, _variableName + ".stOpenButton");
|
||||||
CloseButton = new HMIControlButtonVM(_adsManager, _variableName + ".stCloseButton");
|
CloseButton = new HMIControlButtonVM(_adsManager, _variableName + ".stCloseButton");
|
||||||
Interlocks = new IntlkControlVM(_adsManager, _variableName + ".stInterlock");
|
Interlocks = new IntlkControlVM(_adsManager, _variableName + ".stInterlock");
|
||||||
|
|
||||||
_adsManager.Register(_variableName + ".sName", NameChanged);
|
_adsManager.Register(_variableName + ".sName", NameChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_adsManager?.Deregister(_variableName + ".sName", NameChanged);
|
_adsManager?.Deregister(_variableName + ".sName", NameChanged);
|
||||||
_adsManager = null;
|
_adsManager = null;
|
||||||
|
|
||||||
AutomaticButton?.Dispose();
|
AutomaticButton?.Dispose();
|
||||||
AutomaticButton = null;
|
AutomaticButton = null;
|
||||||
|
|
||||||
ManualButton?.Dispose();
|
ManualButton?.Dispose();
|
||||||
ManualButton = null;
|
ManualButton = null;
|
||||||
|
|
||||||
OpenButton?.Dispose();
|
OpenButton?.Dispose();
|
||||||
|
|
||||||
CloseButton?.Dispose();
|
CloseButton?.Dispose();
|
||||||
|
|
||||||
Interlocks?.Dispose();
|
Interlocks?.Dispose();
|
||||||
Interlocks = null;
|
Interlocks = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void NameChanged(object? sender, ValueChangedEventArgs e)
|
private void NameChanged(object? sender, ValueChangedEventArgs e)
|
||||||
{
|
{
|
||||||
SName = (string)e.Value;
|
SName = (string)e.Value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@@ -3,23 +3,22 @@ using System.Windows;
|
|||||||
using System.Windows.Data;
|
using System.Windows.Data;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
|
|
||||||
namespace HMIToolkit
|
namespace HMIToolkit;
|
||||||
|
|
||||||
|
public class BoolToBrushConverter : IValueConverter
|
||||||
{
|
{
|
||||||
public class BoolToBrushConverter : IValueConverter
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
if (targetType != typeof(Brush))
|
||||||
{
|
throw new InvalidOperationException("The target must be a brush");
|
||||||
if (targetType != typeof(Brush))
|
|
||||||
throw new InvalidOperationException("The target must be a brush");
|
|
||||||
|
|
||||||
bool temp = bool.Parse(value.ToString()!);
|
bool temp = bool.Parse(value.ToString()!);
|
||||||
|
|
||||||
return (temp ? Brushes.DarkGreen : Brushes.DarkRed);
|
return (temp ? Brushes.DarkGreen : Brushes.DarkRed);
|
||||||
}
|
}
|
||||||
|
|
||||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
return DependencyProperty.UnsetValue;
|
return DependencyProperty.UnsetValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
using System.Globalization;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
|
namespace HMIToolkit;
|
||||||
|
|
||||||
|
public class BoolToVisibilityConverter<T> : IValueConverter
|
||||||
|
{
|
||||||
|
public BoolToVisibilityConverter(T trueValue, T falseValue)
|
||||||
|
{
|
||||||
|
True = trueValue;
|
||||||
|
False = falseValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public T True { get; set; }
|
||||||
|
public T False { get; set; }
|
||||||
|
|
||||||
|
public virtual object? Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
return value is bool && ((bool)value) ? True : False;
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
return DependencyProperty.UnsetValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public sealed class BoolToVisibilityConverter : BoolToVisibilityConverter<Visibility>
|
||||||
|
{
|
||||||
|
public BoolToVisibilityConverter() :
|
||||||
|
base(Visibility.Visible, Visibility.Hidden)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
|
||||||
@@ -3,72 +3,71 @@ using CommunityToolkit.Mvvm.Input;
|
|||||||
using TwinCAT.TypeSystem;
|
using TwinCAT.TypeSystem;
|
||||||
using Heisig.HMI.AdsManager;
|
using Heisig.HMI.AdsManager;
|
||||||
|
|
||||||
namespace HMIToolkit
|
namespace HMIToolkit;
|
||||||
|
|
||||||
|
public sealed partial class HMIControlButtonVM : ObservableObject, IDisposable
|
||||||
{
|
{
|
||||||
public sealed partial class HMIControlButtonVM : ObservableObject, IDisposable
|
private IAdsManager? _adsManager;
|
||||||
{
|
private readonly string _variableName;
|
||||||
private IAdsManager? _adsManager;
|
|
||||||
private readonly string _variableName;
|
|
||||||
|
|
||||||
// Action triggered when the button is about to be clicked
|
// Action triggered when the button is about to be clicked
|
||||||
public event EventHandler? ButtonClickedStarted;
|
public event EventHandler? ButtonClickedStarted;
|
||||||
|
|
||||||
// Action triggered when the button is done being clicked
|
// Action triggered when the button is done being clicked
|
||||||
public event EventHandler? ButtonClickedEnded;
|
public event EventHandler? ButtonClickedEnded;
|
||||||
|
|
||||||
// Event when button feedback changed
|
// Event when button feedback changed
|
||||||
public event EventHandler? FeedbackChanged;
|
public event EventHandler? FeedbackChanged;
|
||||||
|
|
||||||
// Event when release changed
|
// Event when release changed
|
||||||
public event EventHandler? ReleaseChanged;
|
public event EventHandler? ReleaseChanged;
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
private bool xRelease;
|
private bool xRelease;
|
||||||
|
|
||||||
// 0 = none, 1 = active, 2 = pending, 3 = waring, 4 = error
|
// 0 = none, 1 = active, 2 = pending, 3 = waring, 4 = error
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
private short iFeedback;
|
private short iFeedback;
|
||||||
|
|
||||||
public HMIControlButtonVM()
|
public HMIControlButtonVM()
|
||||||
{
|
{
|
||||||
_variableName = string.Empty;
|
_variableName = string.Empty;
|
||||||
XRelease = false;
|
XRelease = false;
|
||||||
IFeedback = 4;
|
IFeedback = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HMIControlButtonVM(IAdsManager adsManager, string variableName)
|
public HMIControlButtonVM(IAdsManager adsManager, string variableName)
|
||||||
{
|
{
|
||||||
_adsManager = adsManager;
|
_adsManager = adsManager;
|
||||||
_variableName = variableName;
|
_variableName = variableName;
|
||||||
|
|
||||||
_adsManager.Register(_variableName + ".xRelease", XReleaseCahnged);
|
_adsManager.Register(_variableName + ".xRelease", XReleaseCahnged);
|
||||||
_adsManager.Register(_variableName + ".iFeedback", IFeedbackChanged);
|
_adsManager.Register(_variableName + ".iFeedback", IFeedbackChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_adsManager?.Deregister(_variableName + ".xRelease", XReleaseCahnged);
|
_adsManager?.Deregister(_variableName + ".xRelease", XReleaseCahnged);
|
||||||
_adsManager?.Deregister(_variableName + ".iFeedback", IFeedbackChanged);
|
_adsManager?.Deregister(_variableName + ".iFeedback", IFeedbackChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
[RelayCommand]
|
[RelayCommand]
|
||||||
private void ButtonClicked()
|
private void ButtonClicked()
|
||||||
{
|
{
|
||||||
ButtonClickedStarted?.Invoke(this, EventArgs.Empty);
|
ButtonClickedStarted?.Invoke(this, EventArgs.Empty);
|
||||||
_adsManager?.WriteValue(_variableName + ".xRequest", true);
|
_adsManager?.WriteValue(_variableName + ".xRequest", true);
|
||||||
ButtonClickedEnded?.Invoke(this, EventArgs.Empty);
|
ButtonClickedEnded?.Invoke(this, EventArgs.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void XReleaseCahnged(object? sender, ValueChangedEventArgs e)
|
private void XReleaseCahnged(object? sender, ValueChangedEventArgs e)
|
||||||
{
|
{
|
||||||
XRelease = (bool)e.Value;
|
XRelease = (bool)e.Value;
|
||||||
ReleaseChanged?.Invoke(this, EventArgs.Empty);
|
ReleaseChanged?.Invoke(this, EventArgs.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void IFeedbackChanged(object? sender, ValueChangedEventArgs e)
|
private void IFeedbackChanged(object? sender, ValueChangedEventArgs e)
|
||||||
{
|
{
|
||||||
IFeedback = (short)e.Value;
|
IFeedback = (short)e.Value;
|
||||||
FeedbackChanged?.Invoke(this, EventArgs.Empty);
|
FeedbackChanged?.Invoke(this, EventArgs.Empty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@@ -16,15 +16,15 @@
|
|||||||
<ColumnDefinition Width="*" />
|
<ColumnDefinition Width="*" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
<Button Grid.Column="0" Padding="0" Command="{Binding ShowProcessIntlksCommand}">
|
<Button Grid.Column="0" FontSize="35" Height="60" Width="150" Padding="0" Command="{Binding ShowProcessIntlksCommand}">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<Label>Process</Label>
|
<Label FontSize="30">Process</Label>
|
||||||
<Rectangle Width="10" Height="10" Fill="{Binding Path=XProcessIntlkOk, Converter={StaticResource myBoolConverter}}" RadiusX="2" RadiusY="2" Margin="0,2,0,0"/>
|
<Rectangle Width="10" Height="10" Fill="{Binding Path=XProcessIntlkOk, Converter={StaticResource myBoolConverter}}" RadiusX="2" RadiusY="2" Margin="0,2,0,0"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Button>
|
</Button>
|
||||||
<Button Grid.Column="1" Padding="0" Margin="5,0,0,0" Command="{Binding ShowSafetyIntlksCommand}">
|
<Button Grid.Column="1" Padding="0" FontSize="35" Height="60" Width="150" Margin="5,0,0,0" Command="{Binding ShowSafetyIntlksCommand}">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<Label>Safety</Label>
|
<Label FontSize="30">Safety</Label>
|
||||||
<Rectangle Width="10" Height="10" Fill="{Binding Path=XSafetyIntlkOk, Converter={StaticResource myBoolConverter}}" RadiusX="2" RadiusY="2" Margin="0,2,0,0"/>
|
<Rectangle Width="10" Height="10" Fill="{Binding Path=XSafetyIntlkOk, Converter={StaticResource myBoolConverter}}" RadiusX="2" RadiusY="2" Margin="0,2,0,0"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -13,23 +13,22 @@ using System.Windows.Media.Imaging;
|
|||||||
using System.Windows.Navigation;
|
using System.Windows.Navigation;
|
||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
namespace HMIToolkit
|
namespace HMIToolkit;
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Interaktionslogik für ProcessIntlkButtonControl.xaml
|
|
||||||
/// </summary>
|
|
||||||
public partial class IntlkButtonControl : UserControl
|
|
||||||
{
|
|
||||||
public IntlkButtonControl()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
// Unloaded += OnUnloaded;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnUnloaded(object? sender, EventArgs e)
|
/// <summary>
|
||||||
{
|
/// Interaktionslogik für ProcessIntlkButtonControl.xaml
|
||||||
var disposable = DataContext as IDisposable;
|
/// </summary>
|
||||||
disposable?.Dispose();
|
public partial class IntlkButtonControl : UserControl
|
||||||
}
|
{
|
||||||
}
|
public IntlkButtonControl()
|
||||||
}
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
// Unloaded += OnUnloaded;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnUnloaded(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var disposable = DataContext as IDisposable;
|
||||||
|
disposable?.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -13,23 +13,22 @@ using System.Windows.Media.Imaging;
|
|||||||
using System.Windows.Navigation;
|
using System.Windows.Navigation;
|
||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
namespace HMIToolkit
|
namespace HMIToolkit;
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Interaktionslogik für IntlkDetails.xaml
|
|
||||||
/// </summary>
|
|
||||||
public partial class IntlkDetails : UserControl
|
|
||||||
{
|
|
||||||
public IntlkDetails()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
// Unloaded += OnUnloaded;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnUnloaded(object? sender, EventArgs e)
|
/// <summary>
|
||||||
{
|
/// Interaktionslogik für IntlkDetails.xaml
|
||||||
var disposable = DataContext as IDisposable;
|
/// </summary>
|
||||||
disposable?.Dispose();
|
public partial class IntlkDetails : UserControl
|
||||||
}
|
{
|
||||||
}
|
public IntlkDetails()
|
||||||
}
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
// Unloaded += OnUnloaded;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnUnloaded(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var disposable = DataContext as IDisposable;
|
||||||
|
disposable?.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,147 +5,146 @@ using System.Windows.Controls;
|
|||||||
using TwinCAT.TypeSystem;
|
using TwinCAT.TypeSystem;
|
||||||
using Heisig.HMI.AdsManager;
|
using Heisig.HMI.AdsManager;
|
||||||
|
|
||||||
namespace HMIToolkit
|
namespace HMIToolkit;
|
||||||
|
|
||||||
|
public sealed partial class IntlkDetailsVM : ObservableObject, IDisposable
|
||||||
{
|
{
|
||||||
public sealed partial class IntlkDetailsVM : ObservableObject, IDisposable
|
[ObservableProperty]
|
||||||
{
|
private string interlockName;
|
||||||
[ObservableProperty]
|
|
||||||
private string interlockName;
|
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
private BitArray interlockStatus;
|
private BitArray interlockStatus;
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
private string[] interlockNames;
|
private string[] interlockNames;
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
private ListBoxItem[] listBoxItemsLeft;
|
private ListBoxItem[] listBoxItemsLeft;
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
private ListBoxItem[] listBoxItemsRight;
|
private ListBoxItem[] listBoxItemsRight;
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
private Visibility isVisible;
|
private Visibility isVisible;
|
||||||
|
|
||||||
private readonly BoolToBrushConverter boolToBrushConverter = new();
|
private readonly BoolToBrushConverter boolToBrushConverter = new();
|
||||||
|
|
||||||
private readonly int numIntlksLeftSide;
|
private readonly int numIntlksLeftSide;
|
||||||
private readonly int numIntlksRightSide;
|
private readonly int numIntlksRightSide;
|
||||||
|
|
||||||
private readonly string _variableNameStatus;
|
private readonly string _variableNameStatus;
|
||||||
private readonly string _variableNameNames;
|
private readonly string _variableNameNames;
|
||||||
|
|
||||||
private IAdsManager? _adsManager;
|
private IAdsManager? _adsManager;
|
||||||
|
|
||||||
public IntlkDetailsVM()
|
public IntlkDetailsVM()
|
||||||
{
|
{
|
||||||
interlockName = "Interlocks";
|
interlockName = "Interlocks";
|
||||||
interlockStatus = new BitArray(HMIConstants.NumInterlocks);
|
interlockStatus = new BitArray(HMIConstants.NumInterlocks);
|
||||||
interlockNames = new string[HMIConstants.NumInterlocks];
|
interlockNames = new string[HMIConstants.NumInterlocks];
|
||||||
Array.Fill(interlockNames, "Not used");
|
Array.Fill(interlockNames, "Not used");
|
||||||
|
|
||||||
// Split all interlocks into two parts
|
// Split all interlocks into two parts
|
||||||
numIntlksLeftSide = (int)Math.Ceiling(HMIConstants.NumInterlocks * 0.5);
|
numIntlksLeftSide = (int)Math.Ceiling(HMIConstants.NumInterlocks * 0.5);
|
||||||
numIntlksRightSide = HMIConstants.NumInterlocks - numIntlksLeftSide;
|
numIntlksRightSide = HMIConstants.NumInterlocks - numIntlksLeftSide;
|
||||||
|
|
||||||
listBoxItemsLeft = new ListBoxItem[numIntlksLeftSide];
|
listBoxItemsLeft = new ListBoxItem[numIntlksLeftSide];
|
||||||
listBoxItemsRight = new ListBoxItem[numIntlksRightSide];
|
listBoxItemsRight = new ListBoxItem[numIntlksRightSide];
|
||||||
|
|
||||||
_variableNameStatus = System.String.Empty;
|
_variableNameStatus = System.String.Empty;
|
||||||
_variableNameNames = System.String.Empty;
|
_variableNameNames = System.String.Empty;
|
||||||
|
|
||||||
// CreateContent();
|
// CreateContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IntlkDetailsVM(IAdsManager adsManager, string variableNameStatus, string variableNameNames, string intlkName) : this()
|
public IntlkDetailsVM(IAdsManager adsManager, string variableNameStatus, string variableNameNames, string intlkName) : this()
|
||||||
{
|
{
|
||||||
interlockName = intlkName;
|
interlockName = intlkName;
|
||||||
_variableNameStatus = variableNameStatus;
|
_variableNameStatus = variableNameStatus;
|
||||||
_variableNameNames = variableNameNames;
|
_variableNameNames = variableNameNames;
|
||||||
_adsManager = adsManager;
|
_adsManager = adsManager;
|
||||||
|
|
||||||
interlockStatus = new BitArray(HMIConstants.NumInterlocks);
|
interlockStatus = new BitArray(HMIConstants.NumInterlocks);
|
||||||
interlockNames = new string[HMIConstants.NumInterlocks];
|
interlockNames = new string[HMIConstants.NumInterlocks];
|
||||||
|
|
||||||
_adsManager.Register(_variableNameStatus, InterlockStatusChanged);
|
_adsManager.Register(_variableNameStatus, InterlockStatusChanged);
|
||||||
_adsManager.Register(_variableNameNames, InterlockNamesChanged);
|
_adsManager.Register(_variableNameNames, InterlockNamesChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_adsManager?.Deregister(_variableNameStatus, InterlockStatusChanged);
|
_adsManager?.Deregister(_variableNameStatus, InterlockStatusChanged);
|
||||||
_adsManager?.Deregister(_variableNameNames, InterlockNamesChanged);
|
_adsManager?.Deregister(_variableNameNames, InterlockNamesChanged);
|
||||||
|
|
||||||
_adsManager = null;
|
_adsManager = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*private void CreateContent()
|
/*private void CreateContent()
|
||||||
{
|
{
|
||||||
// Create left side
|
// Create left side
|
||||||
for (int i = 0; i < HMIConstants.NumInterlocks; i++)
|
for (int i = 0; i < HMIConstants.NumInterlocks; i++)
|
||||||
{
|
{
|
||||||
// Create the stack panel
|
// Create the stack panel
|
||||||
StackPanel stackPanel = new StackPanel
|
StackPanel stackPanel = new StackPanel
|
||||||
{
|
{
|
||||||
Orientation = Orientation.Horizontal
|
Orientation = Orientation.Horizontal
|
||||||
};
|
};
|
||||||
|
|
||||||
// Create the box
|
// Create the box
|
||||||
// <Rectangle Width="10" Height="10" Fill="{Binding Path=InterlockStatus[10], Converter={StaticResource myBoolConverter}}" RadiusX="2" RadiusY="2" Margin="0,2,0,0"/>
|
// <Rectangle Width="10" Height="10" Fill="{Binding Path=InterlockStatus[10], Converter={StaticResource myBoolConverter}}" RadiusX="2" RadiusY="2" Margin="0,2,0,0"/>
|
||||||
Rectangle rectangle = new Rectangle
|
Rectangle rectangle = new Rectangle
|
||||||
{
|
{
|
||||||
Width = 10,
|
Width = 10,
|
||||||
Height = 10,
|
Height = 10,
|
||||||
RadiusX = 2,
|
RadiusX = 2,
|
||||||
RadiusY = 2
|
RadiusY = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
// Create binding
|
// Create binding
|
||||||
Binding binding = new()
|
Binding binding = new()
|
||||||
{
|
{
|
||||||
Source = this,
|
Source = this,
|
||||||
Path = new PropertyPath("InterlockStatus[" + i + "]"),
|
Path = new PropertyPath("InterlockStatus[" + i + "]"),
|
||||||
Converter = boolToBrushConverter,
|
Converter = boolToBrushConverter,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Set binding
|
// Set binding
|
||||||
rectangle.SetBinding(Rectangle.FillProperty, binding);
|
rectangle.SetBinding(Rectangle.FillProperty, binding);
|
||||||
|
|
||||||
// Create label
|
// Create label
|
||||||
Label label = new();
|
Label label = new();
|
||||||
binding = new()
|
binding = new()
|
||||||
{
|
{
|
||||||
Source = this,
|
Source = this,
|
||||||
Path = new PropertyPath("InterlockNames[" + i + "]")
|
Path = new PropertyPath("InterlockNames[" + i + "]")
|
||||||
};
|
};
|
||||||
label.SetBinding(Label.ContentProperty, binding);
|
label.SetBinding(Label.ContentProperty, binding);
|
||||||
|
|
||||||
// Add items to stack panel
|
// Add items to stack panel
|
||||||
stackPanel.Children.Add(rectangle);
|
stackPanel.Children.Add(rectangle);
|
||||||
stackPanel.Children.Add(label);
|
stackPanel.Children.Add(label);
|
||||||
|
|
||||||
// Add stack panel to listbox items
|
// Add stack panel to listbox items
|
||||||
ListBoxItem tempListBoxItem = new()
|
ListBoxItem tempListBoxItem = new()
|
||||||
{
|
{
|
||||||
Content = stackPanel
|
Content = stackPanel
|
||||||
};
|
};
|
||||||
if (i < numIntlksLeftSide)
|
if (i < numIntlksLeftSide)
|
||||||
ListBoxItemsLeft[i] = tempListBoxItem;
|
ListBoxItemsLeft[i] = tempListBoxItem;
|
||||||
else
|
else
|
||||||
ListBoxItemsRight[i - numIntlksLeftSide] = tempListBoxItem;
|
ListBoxItemsRight[i - numIntlksLeftSide] = tempListBoxItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
private void InterlockStatusChanged(object? sender, ValueChangedEventArgs e)
|
private void InterlockStatusChanged(object? sender, ValueChangedEventArgs e)
|
||||||
{
|
{
|
||||||
ushort temp = (ushort)e.Value;
|
ushort temp = (ushort)e.Value;
|
||||||
InterlockStatus = new BitArray(BitConverter.GetBytes(temp));
|
InterlockStatus = new BitArray(BitConverter.GetBytes(temp));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InterlockNamesChanged(object? sender, ValueChangedEventArgs e)
|
private void InterlockNamesChanged(object? sender, ValueChangedEventArgs e)
|
||||||
{
|
{
|
||||||
InterlockNames = (string[])e.Value;
|
InterlockNames = (string[])e.Value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@@ -12,16 +12,15 @@ using System.Windows.Media;
|
|||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
namespace HMIToolkit
|
namespace HMIToolkit;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Interaktionslogik für IntlkDetailsWindow.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class IntlkDetailsWindow : Window
|
||||||
{
|
{
|
||||||
/// <summary>
|
public IntlkDetailsWindow()
|
||||||
/// Interaktionslogik für IntlkDetailsWindow.xaml
|
{
|
||||||
/// </summary>
|
InitializeComponent();
|
||||||
public partial class IntlkDetailsWindow : Window
|
}
|
||||||
{
|
}
|
||||||
public IntlkDetailsWindow()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,218 +1,216 @@
|
|||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace HMIToolkit
|
namespace HMIToolkit;
|
||||||
{
|
// PLC - C#
|
||||||
// PLC - C#
|
// --------
|
||||||
// --------
|
// int - short
|
||||||
// int - short
|
// word - ushort
|
||||||
// word - ushort
|
|
||||||
|
|
||||||
// Constants for interaction with data
|
// Constants for interaction with data
|
||||||
public static class HMIConstants
|
public static class HMIConstants
|
||||||
{
|
{
|
||||||
public const int StringLength = 81;
|
public const int StringLength = 81;
|
||||||
public const int NumInterlocks = 16;
|
public const int NumInterlocks = 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential, Pack = 0)]
|
[StructLayout(LayoutKind.Sequential, Pack = 0)]
|
||||||
public struct HMIAnalogValue
|
public struct HMIAnalogValue
|
||||||
{
|
{
|
||||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = HMIConstants.StringLength)]
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = HMIConstants.StringLength)]
|
||||||
public string sName;
|
public string sName;
|
||||||
|
|
||||||
// 1 = Ok, 2 = Error
|
// 1 = Ok, 2 = Error
|
||||||
public short iStatus;
|
public short iStatus;
|
||||||
|
|
||||||
public float rValue;
|
public float rValue;
|
||||||
|
|
||||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = HMIConstants.StringLength)]
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = HMIConstants.StringLength)]
|
||||||
public string sUnit;
|
public string sUnit;
|
||||||
|
|
||||||
[MarshalAs(UnmanagedType.I1)]
|
[MarshalAs(UnmanagedType.I1)]
|
||||||
public bool xUsed;
|
public bool xUsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TwinCAT2 Pack = 1, TwinCAT 3 Pack = 0
|
// TwinCAT2 Pack = 1, TwinCAT 3 Pack = 0
|
||||||
[StructLayout(LayoutKind.Sequential, Pack = 0)]
|
[StructLayout(LayoutKind.Sequential, Pack = 0)]
|
||||||
public struct HMIControlButton
|
public struct HMIControlButton
|
||||||
{
|
{
|
||||||
[MarshalAs(UnmanagedType.I1)]
|
[MarshalAs(UnmanagedType.I1)]
|
||||||
public bool xRequest;
|
public bool xRequest;
|
||||||
|
|
||||||
[MarshalAs(UnmanagedType.I1)]
|
[MarshalAs(UnmanagedType.I1)]
|
||||||
public bool xRelease;
|
public bool xRelease;
|
||||||
|
|
||||||
public short iFeedback;
|
public short iFeedback;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TwinCAT2 Pack = 1, TwinCAT 3 Pack = 0
|
// TwinCAT2 Pack = 1, TwinCAT 3 Pack = 0
|
||||||
[StructLayout(LayoutKind.Sequential, Pack = 0)]
|
[StructLayout(LayoutKind.Sequential, Pack = 0)]
|
||||||
public struct HMIInterlock
|
public struct HMIInterlock
|
||||||
{
|
{
|
||||||
public ushort wProcessINTLKStatus;
|
public ushort wProcessINTLKStatus;
|
||||||
|
|
||||||
public ushort wSafeyINTLKStatus;
|
public ushort wSafeyINTLKStatus;
|
||||||
|
|
||||||
public ushort wProcessINTLKUsed;
|
public ushort wProcessINTLKUsed;
|
||||||
|
|
||||||
public ushort wSafeyINTLKUsed;
|
public ushort wSafeyINTLKUsed;
|
||||||
|
|
||||||
// 16 * String(80) = 81 bytes a 16 indexes
|
// 16 * String(80) = 81 bytes a 16 indexes
|
||||||
// combined in one string because reading a two dimensional array is not possible
|
// combined in one string because reading a two dimensional array is not possible
|
||||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = HMIConstants.StringLength * HMIConstants.NumInterlocks)]
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = HMIConstants.StringLength * HMIConstants.NumInterlocks)]
|
||||||
public byte[] asProcessINTLKName;
|
public byte[] asProcessINTLKName;
|
||||||
|
|
||||||
// 16 * String(80) = 81 bytes a 16 indexes
|
// 16 * String(80) = 81 bytes a 16 indexes
|
||||||
// combined in one string because reading a two dimensional array is not possible
|
// combined in one string because reading a two dimensional array is not possible
|
||||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = HMIConstants.StringLength * HMIConstants.NumInterlocks)]
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = HMIConstants.StringLength * HMIConstants.NumInterlocks)]
|
||||||
public byte[] asSafetyINTLKName;
|
public byte[] asSafetyINTLKName;
|
||||||
|
|
||||||
[MarshalAs(UnmanagedType.I1)]
|
[MarshalAs(UnmanagedType.I1)]
|
||||||
public bool xProcessINTLKOk;
|
public bool xProcessINTLKOk;
|
||||||
|
|
||||||
[MarshalAs(UnmanagedType.I1)]
|
[MarshalAs(UnmanagedType.I1)]
|
||||||
public bool xSafetyINTLKOk;
|
public bool xSafetyINTLKOk;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TwinCAT2 Pack = 1, TwinCAT 3 Pack = 0
|
// TwinCAT2 Pack = 1, TwinCAT 3 Pack = 0
|
||||||
[StructLayout(LayoutKind.Sequential, Pack = 0)]
|
[StructLayout(LayoutKind.Sequential, Pack = 0)]
|
||||||
public struct HMIValveData
|
public struct HMIValveData
|
||||||
{
|
{
|
||||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = HMIConstants.StringLength)]
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = HMIConstants.StringLength)]
|
||||||
public string sName;
|
public string sName;
|
||||||
|
|
||||||
public HMIControlButton stAutomaticButton;
|
public HMIControlButton stAutomaticButton;
|
||||||
|
|
||||||
public HMIControlButton stManualButton;
|
public HMIControlButton stManualButton;
|
||||||
|
|
||||||
public HMIControlButton stOpenButton;
|
public HMIControlButton stOpenButton;
|
||||||
|
|
||||||
public HMIControlButton stCloseButton;
|
public HMIControlButton stCloseButton;
|
||||||
|
|
||||||
// 1 = Opened, 2 = Opening/Closing, 3 = Closed, 4 = Error
|
// 1 = Opened, 2 = Opening/Closing, 3 = Closed, 4 = Error
|
||||||
public short iStatus;
|
public short iStatus;
|
||||||
|
|
||||||
// 1 = Automatic mode, 2 = Manual mode
|
// 1 = Automatic mode, 2 = Manual mode
|
||||||
public short iCurrentMode;
|
public short iCurrentMode;
|
||||||
|
|
||||||
public HMIInterlock stInterlock;
|
public HMIInterlock stInterlock;
|
||||||
|
|
||||||
[MarshalAs(UnmanagedType.I1)]
|
[MarshalAs(UnmanagedType.I1)]
|
||||||
public bool xUsed;
|
public bool xUsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential, Pack = 0)]
|
[StructLayout(LayoutKind.Sequential, Pack = 0)]
|
||||||
public struct HMIAnalogValveData
|
public struct HMIAnalogValveData
|
||||||
{
|
{
|
||||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = HMIConstants.StringLength)]
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = HMIConstants.StringLength)]
|
||||||
public string sName;
|
public string sName;
|
||||||
|
|
||||||
public HMIControlButton stAutomaticButton;
|
public HMIControlButton stAutomaticButton;
|
||||||
|
|
||||||
public HMIControlButton stManualButton;
|
public HMIControlButton stManualButton;
|
||||||
|
|
||||||
public HMIControlButton stOpenButton;
|
public HMIControlButton stOpenButton;
|
||||||
|
|
||||||
public HMIControlButton stCloseButton;
|
public HMIControlButton stCloseButton;
|
||||||
|
|
||||||
// 1 = Opened, 2 = Opening/Closing, 3 = Closed, 4 = Error
|
// 1 = Opened, 2 = Opening/Closing, 3 = Closed, 4 = Error
|
||||||
public short iStatus;
|
public short iStatus;
|
||||||
|
|
||||||
// 1 = Automatic mode, 2 = Manual mode
|
// 1 = Automatic mode, 2 = Manual mode
|
||||||
public short iCurrentMode;
|
public short iCurrentMode;
|
||||||
|
|
||||||
public HMIInterlock stInterlock;
|
public HMIInterlock stInterlock;
|
||||||
|
|
||||||
HMIAnalogValue stSetpoint;
|
HMIAnalogValue stSetpoint;
|
||||||
|
|
||||||
HMIAnalogValue stProcessValue;
|
HMIAnalogValue stProcessValue;
|
||||||
|
|
||||||
[MarshalAs(UnmanagedType.I1)]
|
[MarshalAs(UnmanagedType.I1)]
|
||||||
public bool xUsed;
|
public bool xUsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TwinCAT2 Pack = 1, TwinCAT 3 Pack = 0
|
// TwinCAT2 Pack = 1, TwinCAT 3 Pack = 0
|
||||||
[StructLayout(LayoutKind.Sequential, Pack = 0)]
|
[StructLayout(LayoutKind.Sequential, Pack = 0)]
|
||||||
public struct HMIAnalogMotorData
|
public struct HMIAnalogMotorData
|
||||||
{
|
{
|
||||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = HMIConstants.StringLength)]
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = HMIConstants.StringLength)]
|
||||||
public string sName;
|
public string sName;
|
||||||
|
|
||||||
public HMIControlButton stAutomaticButton;
|
public HMIControlButton stAutomaticButton;
|
||||||
|
|
||||||
public HMIControlButton stManualButton;
|
public HMIControlButton stManualButton;
|
||||||
|
|
||||||
public HMIControlButton stStartButton;
|
public HMIControlButton stStartButton;
|
||||||
|
|
||||||
public HMIControlButton stStopButton;
|
public HMIControlButton stStopButton;
|
||||||
|
|
||||||
// 1 = Opened, 2 = Opening/Closing, 3 = Closed, 4 = Error
|
// 1 = Opened, 2 = Opening/Closing, 3 = Closed, 4 = Error
|
||||||
public short iStatus;
|
public short iStatus;
|
||||||
|
|
||||||
// 1 = Automatic mode, 2 = Manual mode
|
// 1 = Automatic mode, 2 = Manual mode
|
||||||
public short iCurrentMode;
|
public short iCurrentMode;
|
||||||
|
|
||||||
public HMIAnalogValue stSetpoint;
|
public HMIAnalogValue stSetpoint;
|
||||||
|
|
||||||
public HMIAnalogValue stProcessValue;
|
public HMIAnalogValue stProcessValue;
|
||||||
|
|
||||||
public HMIInterlock stInterlock;
|
public HMIInterlock stInterlock;
|
||||||
|
|
||||||
[MarshalAs(UnmanagedType.I1)]
|
[MarshalAs(UnmanagedType.I1)]
|
||||||
public bool xUsed;
|
public bool xUsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TwinCAT2 Pack = 1, TwinCAT 3 Pack = 0
|
// TwinCAT2 Pack = 1, TwinCAT 3 Pack = 0
|
||||||
[StructLayout(LayoutKind.Sequential, Pack = 0)]
|
[StructLayout(LayoutKind.Sequential, Pack = 0)]
|
||||||
public struct HMIOrpSensorData
|
public struct HMIOrpSensorData
|
||||||
{
|
{
|
||||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = HMIConstants.StringLength)]
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = HMIConstants.StringLength)]
|
||||||
public string sName;
|
public string sName;
|
||||||
|
|
||||||
// 1 = Ok, 2 = Error
|
// 1 = Ok, 2 = Error
|
||||||
public short iStatus;
|
public short iStatus;
|
||||||
|
|
||||||
public float rValuePH;
|
public float rValuePH;
|
||||||
|
|
||||||
public float rValueTemp;
|
public float rValueTemp;
|
||||||
|
|
||||||
public float rValueORP;
|
public float rValueORP;
|
||||||
|
|
||||||
public float rValueDLI;
|
public float rValueDLI;
|
||||||
|
|
||||||
[MarshalAs(UnmanagedType.I1)]
|
[MarshalAs(UnmanagedType.I1)]
|
||||||
public bool xUsed;
|
public bool xUsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
static class HMIUtilities
|
static class HMIUtilities
|
||||||
{
|
{
|
||||||
// Converts the interlock byte array into a string array
|
// Converts the interlock byte array into a string array
|
||||||
public static string[] GetInterlockStringArray(byte[] byteArray)
|
public static string[] GetInterlockStringArray(byte[] byteArray)
|
||||||
{
|
{
|
||||||
string[] temp = new string[HMIConstants.NumInterlocks];
|
string[] temp = new string[HMIConstants.NumInterlocks];
|
||||||
int size;
|
int size;
|
||||||
|
|
||||||
// Check if byteArray is of correct size
|
// Check if byteArray is of correct size
|
||||||
if (byteArray.Length != (HMIConstants.StringLength * HMIConstants.NumInterlocks))
|
if (byteArray.Length != (HMIConstants.StringLength * HMIConstants.NumInterlocks))
|
||||||
return temp;
|
return temp;
|
||||||
|
|
||||||
for (int i = 0; i < HMIConstants.NumInterlocks; i++)
|
for (int i = 0; i < HMIConstants.NumInterlocks; i++)
|
||||||
{
|
{
|
||||||
// Calculate length of string by finding the 0 terminator so the unused bytes get truncated
|
// Calculate length of string by finding the 0 terminator so the unused bytes get truncated
|
||||||
size = Array.IndexOf(byteArray, (byte)0, i * HMIConstants.StringLength) - (i * HMIConstants.StringLength);
|
size = Array.IndexOf(byteArray, (byte)0, i * HMIConstants.StringLength) - (i * HMIConstants.StringLength);
|
||||||
|
|
||||||
// Check if we found a valid 0 terminator
|
// Check if we found a valid 0 terminator
|
||||||
if (size >= 0)
|
if (size >= 0)
|
||||||
// Build string from byteArray with calculated size
|
// Build string from byteArray with calculated size
|
||||||
temp[i] = Encoding.ASCII.GetString(byteArray, i * HMIConstants.StringLength, size);
|
temp[i] = Encoding.ASCII.GetString(byteArray, i * HMIConstants.StringLength, size);
|
||||||
else
|
else
|
||||||
// No valid 0 string terminator was found so return an empty string
|
// No valid 0 string terminator was found so return an empty string
|
||||||
temp[i] = "";
|
temp[i] = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -2,16 +2,25 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<TargetFramework>net8.0-windows</TargetFramework>
|
<TargetFramework>net8.0-windows8.0</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<UseWPF>true</UseWPF>
|
<UseWPF>true</UseWPF>
|
||||||
<AssemblyVersion>0.1.0</AssemblyVersion>
|
<AssemblyVersion>0.1.0</AssemblyVersion>
|
||||||
<FileVersion>0.1</FileVersion>
|
<FileVersion>0.1</FileVersion>
|
||||||
|
<Platforms>AnyCPU;x64</Platforms>
|
||||||
|
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="AdsManager" Version="1.0.0.6" />
|
<None Remove="Anlagenuebersicht.png" />
|
||||||
|
<None Remove="Resources\Application.png" />
|
||||||
|
<None Remove="Resources\Check.png" />
|
||||||
|
<None Remove="Resources\user.png" />
|
||||||
|
<None Remove="Resources\X.png" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
<PackageReference Include="Beckhoff.TwinCAT.Ads" Version="6.1.197" />
|
<PackageReference Include="Beckhoff.TwinCAT.Ads" Version="6.1.197" />
|
||||||
<PackageReference Include="Beckhoff.TwinCAT.TcEventLoggerAdsProxy.Net" Version="2.7.11" />
|
<PackageReference Include="Beckhoff.TwinCAT.TcEventLoggerAdsProxy.Net" Version="2.7.11" />
|
||||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
|
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
|
||||||
@@ -21,6 +30,34 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Reference Include="AdsManager">
|
||||||
|
<HintPath>bin\x64\Debug\net8.0-windows8.0\AdsManager.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Resource Include="Anlagenuebersicht.png">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Resource>
|
||||||
|
<Resource Include="Resources\Application.png" />
|
||||||
|
<Resource Include="Resources\Check.png" />
|
||||||
|
<Resource Include="Resources\user.png" />
|
||||||
|
<Resource Include="Resources\X.png" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Update="Common\MediaContainer.xaml.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Update="Common\ParamControlIntRange.xaml.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Update="Common\ParamControlInt.xaml.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Update="Common\ParamControlFloat.xaml.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
<Compile Update="HMIToolkit\HMIObjects\AnalogMotorControl\AnalogMotorControl.xaml.cs">
|
<Compile Update="HMIToolkit\HMIObjects\AnalogMotorControl\AnalogMotorControl.xaml.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -1,85 +1,212 @@
|
|||||||
<Window x:Class="UniperHMI.MainWindow"
|
<Window x:Class="InfineonHMI.MainWindow"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:mah="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
|
xmlns:system="clr-namespace:System;assembly=System.Runtime"
|
||||||
xmlns:local="clr-namespace:UniperHMI" xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
xmlns:infineonHmi="clr-namespace:InfineonHMI"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
x:Name="MainControlWindow"
|
x:Name="MainControlWindow"
|
||||||
d:DataContext="{d:DesignInstance Type=local:MainWindowVM, IsDesignTimeCreatable=False}"
|
d:DataContext="{d:DesignInstance Type=infineonHmi:MainWindowVM}"
|
||||||
WindowStartupLocation="CenterScreen"
|
WindowStartupLocation="CenterScreen"
|
||||||
Title="Uniper HMI" Height="800" Width="1024" ResizeMode="NoResize">
|
|
||||||
|
Title="Infineon HMI"
|
||||||
|
Icon="Resources/Application.png"
|
||||||
|
Height="Auto"
|
||||||
|
Width="Auto"
|
||||||
|
ResizeMode="CanResizeWithGrip"
|
||||||
|
WindowState="Maximized"
|
||||||
|
WindowStyle="SingleBorderWindow">
|
||||||
|
|
||||||
|
<Viewbox Stretch="Fill">
|
||||||
|
<Grid Width="3840" Height="2100">
|
||||||
|
|
||||||
<Grid HorizontalAlignment="Stretch">
|
<Grid.RowDefinitions>
|
||||||
<Grid.RowDefinitions>
|
<RowDefinition Height="0.08*"/>
|
||||||
<RowDefinition Height="Auto"></RowDefinition>
|
<RowDefinition Height="0.04*"/>
|
||||||
<RowDefinition Height="Auto"></RowDefinition>
|
<RowDefinition Height="Auto"/>
|
||||||
<RowDefinition Height="*"></RowDefinition>
|
<RowDefinition Height="0.74*"/>
|
||||||
<RowDefinition Height="Auto"></RowDefinition>
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
|
|
||||||
<!-- Latest event line -->
|
<RowDefinition Height="Auto"/>
|
||||||
<Grid Grid.Row="0">
|
<RowDefinition Height="190"/>
|
||||||
<Border BorderThickness="0px 0px 0px 2px" BorderBrush="White" Background="Black">
|
</Grid.RowDefinitions>
|
||||||
<Label Content="{Binding EventsPageVM.CurrentEvent.Message}" FontSize="20" Height="45" VerticalAlignment="Center" HorizontalAlignment="Left" Visibility="{Binding StatusBarVisible}"/>
|
|
||||||
|
<!-- Header line -->
|
||||||
|
<Grid Grid.Row="0" Margin="10">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<Grid Grid.Column="0">
|
||||||
|
<Grid.Resources>
|
||||||
|
<!--Set x: share to get the latest every time-->
|
||||||
|
<system:DateTime x:Key="DateTime"
|
||||||
|
x:Shared="False" />
|
||||||
|
<Storyboard x:Key="Storyboard">
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="DataContext"
|
||||||
|
Duration="0:0:1"
|
||||||
|
RepeatBehavior="Forever"
|
||||||
|
AutoReverse="False">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="50%"
|
||||||
|
Value="{StaticResource DateTime}" />
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
</Storyboard>
|
||||||
|
</Grid.Resources>
|
||||||
|
|
||||||
|
<TextBlock Text="{Binding RelativeSource={RelativeSource Self},Path=DataContext.Now,StringFormat={}{0:dd.MM.yyyy}}"
|
||||||
|
DataContext="{StaticResource DateTime}"
|
||||||
|
FontSize="48"
|
||||||
|
Foreground="White">
|
||||||
|
<TextBlock.Triggers>
|
||||||
|
<EventTrigger RoutedEvent="Loaded">
|
||||||
|
<BeginStoryboard Storyboard="{StaticResource Storyboard}" />
|
||||||
|
</EventTrigger>
|
||||||
|
</TextBlock.Triggers>
|
||||||
|
</TextBlock>
|
||||||
|
|
||||||
|
<TextBlock Text="{Binding RelativeSource={RelativeSource Self},Path=DataContext.Now,StringFormat={}{0:hh:mm:ss}}"
|
||||||
|
DataContext="{StaticResource DateTime}"
|
||||||
|
FontSize="48"
|
||||||
|
Margin="0,50,0,0"
|
||||||
|
Foreground="White">
|
||||||
|
|
||||||
|
<TextBlock.Triggers>
|
||||||
|
<EventTrigger RoutedEvent="Loaded">
|
||||||
|
<BeginStoryboard Storyboard="{StaticResource Storyboard}" />
|
||||||
|
</EventTrigger>
|
||||||
|
</TextBlock.Triggers>
|
||||||
|
</TextBlock>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<Button Grid.Column="9"
|
||||||
|
Grid.ColumnSpan="2"
|
||||||
|
Margin="10"
|
||||||
|
FontSize="44"
|
||||||
|
Content="{Binding ActualUser}"
|
||||||
|
Command="{Binding ChangeUserClickedCommand}"/>
|
||||||
|
|
||||||
|
<Grid Grid.Column="11" Grid.ColumnSpan="3"
|
||||||
|
Margin="10"
|
||||||
|
>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition/>
|
||||||
|
<RowDefinition/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Border Grid.RowSpan="2" BorderBrush="White" BorderThickness="1"/>
|
||||||
|
<Label Grid.Row="0" Content="{Binding SCurrentPackMLState}" FontSize="44"/>
|
||||||
|
<Label Grid.Row="1" Content="{Binding SCurrentPackMLMode}" FontSize="44"/>
|
||||||
|
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
<Label Grid.Column="1"
|
||||||
|
Grid.ColumnSpan="3"
|
||||||
|
Content="BiPolar Randätzer"
|
||||||
|
FontSize="60"
|
||||||
|
VerticalAlignment="Top"/>
|
||||||
|
|
||||||
|
<Label Grid.Column="1"
|
||||||
|
Grid.ColumnSpan="3"
|
||||||
|
Content="V 01.00"
|
||||||
|
FontSize="40"
|
||||||
|
VerticalAlignment="Bottom"/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<!-- Latest event line -->
|
||||||
|
<Border Grid.Row="1" BorderBrush="White" BorderThickness="0,0,0,3" Margin="10 0 10 0">
|
||||||
|
<Label Content="{Binding EventsPageVM.CurrentEvent.Message}"
|
||||||
|
FontSize="28"
|
||||||
|
VerticalAlignment="Center"/>
|
||||||
</Border>
|
</Border>
|
||||||
</Grid>
|
|
||||||
|
|
||||||
<!-- Breadcrumb line -->
|
<!-- Breadcrumb line -->
|
||||||
<Label Grid.Row="1" Content="{Binding Breadcrumb}"/>
|
<!-- Currently no used -->
|
||||||
|
<!--<Label Grid.Row="2"
|
||||||
|
Content="{Binding Breadcrumb}"
|
||||||
|
FontSize="28"/>-->
|
||||||
|
|
||||||
<!-- Page frame -->
|
<!-- Page frame -->
|
||||||
<Frame x:Name="MainFrame" NavigationUIVisibility="Hidden" Content="{Binding CurrentPage}" Grid.Row="2" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" />
|
<Frame x:Name="MainFrame"
|
||||||
|
Grid.Row="3"
|
||||||
|
NavigationUIVisibility="Hidden"
|
||||||
|
Margin="20 20 10 20"
|
||||||
|
Content="{Binding CurrentPage}"/>
|
||||||
|
|
||||||
<!-- Softkey grid -->
|
<Border Grid.Row="4"
|
||||||
<Grid Grid.Row="3" Margin="5,5,3,5" Width="Auto">
|
Margin="10 0 10 0"
|
||||||
<Grid.ColumnDefinitions>
|
BorderBrush="White"
|
||||||
<ColumnDefinition Width="*"/>
|
BorderThickness="0,3,0,0"/>
|
||||||
<ColumnDefinition Width="*"/>
|
|
||||||
<ColumnDefinition Width="*"/>
|
|
||||||
<ColumnDefinition Width="*"/>
|
|
||||||
<ColumnDefinition Width="*"/>
|
|
||||||
<ColumnDefinition Width="*"/>
|
|
||||||
<ColumnDefinition Width="*"/>
|
|
||||||
<ColumnDefinition Width="*"/>
|
|
||||||
<ColumnDefinition Width="*"/>
|
|
||||||
<ColumnDefinition Width="*"/>
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
|
|
||||||
<!-- Softkey 1 -->
|
<!-- Softkey grid -->
|
||||||
<Button Grid.Column="0" MinWidth="80" MinHeight="{Binding RelativeSource={RelativeSource Self}, Path=ActualWidth}" Margin="0,0,2,0" Content="Automatic" Command="{Binding AutomaticModeClickedCommand}"/>
|
<Grid Grid.Row="5" Margin="15 10 20 15">
|
||||||
<!-- Command="{Binding AutomaticModeCommand}" -->
|
<Grid >
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<!-- Softkey 1 -->
|
||||||
|
<Button IsEnabled="{Binding CanUserChangePageProductionWindow}"
|
||||||
|
Grid.Column="1" Content="Stationen" FontSize="38" Margin="10"
|
||||||
|
Width="440"
|
||||||
|
Command="{Binding ProductionWindowClickedCommand}"/>
|
||||||
|
<!-- Command="{Binding ManualModeCommand}" -->
|
||||||
|
|
||||||
|
<!-- Softkey 3 -->
|
||||||
|
<Button Grid.Column="2" Content="Protokoll" FontSize="38" Margin="10"
|
||||||
|
Command="{Binding ProtocolWindowClickedCommand}" Visibility="Collapsed"/>
|
||||||
|
|
||||||
|
<!-- Softkey 4 -->
|
||||||
|
<Button IsEnabled="{Binding CanUserChangePageReceipeWindow}"
|
||||||
|
Grid.Column="3" Content="Rezepte" FontSize="38" Margin="10"
|
||||||
|
Width="440"
|
||||||
|
Command="{Binding ReceipesWindowClickedCommand}" />
|
||||||
|
<!-- Command="{Binding SettingsWindowCommand}" -->
|
||||||
|
|
||||||
|
<!-- Softkey 5 -->
|
||||||
|
<Button Grid.Column="7" Content="Trend" FontSize="38" Margin="10"
|
||||||
|
Command="{Binding TrendWindowClickedCommand}" Visibility="Collapsed"/>
|
||||||
|
|
||||||
<!-- Softkey 2 -->
|
<!-- Softkey 6 -->
|
||||||
<Button Grid.Column="1" MinWidth="80" MinHeight="80" Margin="0,0,2,0" Content="Manual" Command="{Binding ManualModeClickedCommand}" />
|
<Button Grid.Column="8" Content="Komponenten" FontSize="38" Margin="10"
|
||||||
<!-- Command="{Binding ManualModeCommand}" -->
|
Command="{Binding ComponentsWindowClickedCommand}" Visibility="Collapsed"/>
|
||||||
|
|
||||||
<!-- Softkey 3 -->
|
<!-- Softkey 7 -->
|
||||||
<Button Grid.Column="2" MinWidth="80" MinHeight="80" Margin="0,0,2,0" Content="Settings" Command="{Binding SettingsWindowCommand}" />
|
|
||||||
<!-- Command="{Binding SettingsWindowCommand}" -->
|
|
||||||
|
|
||||||
<!-- Softkey 4 -->
|
<!-- Softkey 8 -->
|
||||||
<Button Grid.Column="3" MinWidth="80" MinHeight="80" Margin="0,0,2,0" Content="Events" Command="{Binding EventsListClickedCommand}"/>
|
<Button Grid.Column="6" Content="Einstellungen" FontSize="38" Margin="10"
|
||||||
|
Command="{Binding SettingsWindowClickedCommand}" Visibility="Collapsed"/>
|
||||||
|
<Button Grid.Column="7" Content="Meldungen" FontSize="38" Margin="10"
|
||||||
|
Width="450"
|
||||||
|
Command="{Binding EventsListClickedCommand}"/>
|
||||||
|
<!-- Softkey 9 -->
|
||||||
|
<Button Grid.Column="8"
|
||||||
|
Width="450"
|
||||||
|
Content="Alarm quittieren" FontSize="38" Margin="10"
|
||||||
|
Command="{Binding AckAlarmsCommand}"/>
|
||||||
|
|
||||||
<!-- Softkey 5 -->
|
</Grid>
|
||||||
<Button Grid.Column="4" MinWidth="80" MinHeight="80" Margin="0,0,2,0" />
|
</Grid>
|
||||||
|
|
||||||
<!-- Softkey 6 -->
|
|
||||||
<Button Grid.Column="5" MinWidth="80" MinHeight="80" Margin="0,0,2,0" />
|
|
||||||
|
|
||||||
<!-- Softkey 7 -->
|
|
||||||
<Button Grid.Column="6" MinWidth="80" MinHeight="80" Margin="0,0,2,0" />
|
|
||||||
|
|
||||||
<!-- Softkey 8 -->
|
|
||||||
<Button Grid.Column="7" Content="Ack Alarms" Command="{Binding AckAlarmsCommand}" MinWidth="80" MinHeight="80" Margin="0,0,2,0" />
|
|
||||||
|
|
||||||
<!-- Softkey 9 -->
|
|
||||||
<Button Grid.Column="8" MinWidth="80" MinHeight="80" Margin="0,0,2,0" />
|
|
||||||
|
|
||||||
<!-- Softkey 10 -->
|
|
||||||
<Button Grid.Column="9" Content="Back" Command="{Binding NavigateBackCommand}" IsEnabled="{Binding CanNavigateBack}" MinWidth="80" MinHeight="80" Margin="0,0,2,0" />
|
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Viewbox>
|
||||||
</Window>
|
</Window>
|
||||||
|
|||||||
@@ -1,26 +1,34 @@
|
|||||||
using HMIToolkit;
|
using HMIToolkit;
|
||||||
using MahApps.Metro.Controls;
|
using MahApps.Metro.Controls;
|
||||||
|
|
||||||
namespace UniperHMI
|
namespace InfineonHMI;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for MainWindow.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class MainWindow
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Interaction logic for MainWindow.xaml
|
|
||||||
/// </summary>
|
|
||||||
public partial class MainWindow
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
public MainWindow(MainWindowVM mainWindowVM)
|
public MainWindow(MainWindowVM mainWindowVM)
|
||||||
{
|
{
|
||||||
this.DataContext = mainWindowVM;
|
DataContext = mainWindowVM;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
Closed += OnClosedEvent;
|
Loaded += MainWindowLoaded;
|
||||||
}
|
Closed += OnClosedEvent;
|
||||||
|
}
|
||||||
|
|
||||||
private void OnClosedEvent(object? sender, EventArgs e)
|
private void MainWindowLoaded(object sender, System.Windows.RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (DataContext is IDisposable dataContext)
|
var model = (MainWindowVM)DataContext;
|
||||||
dataContext.Dispose();
|
model.ChangeUserClicked();
|
||||||
}
|
model.ShowOverview();
|
||||||
}
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnClosedEvent(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (DataContext is IDisposable dataContext)
|
||||||
|
dataContext.Dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,112 +1,312 @@
|
|||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
using Common;
|
||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
using CommunityToolkit.Mvvm.Input;
|
using CommunityToolkit.Mvvm.Input;
|
||||||
using CommunityToolkit.Mvvm.Messaging;
|
using CommunityToolkit.Mvvm.Messaging;
|
||||||
using Heisig.HMI.AdsManager;
|
using Heisig.HMI.AdsManager;
|
||||||
|
using InfineonHMI.Pages.Views;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
using InfineonHMI.Common;
|
||||||
using TcEventLoggerAdsProxyLib;
|
using TcEventLoggerAdsProxyLib;
|
||||||
|
using TwinCAT.TypeSystem;
|
||||||
|
|
||||||
namespace UniperHMI;
|
namespace InfineonHMI;
|
||||||
|
|
||||||
public sealed partial class MainWindowVM : ObservableObject, IRecipient<NavigateMessage>, IDisposable
|
public sealed partial class MainWindowVM : ObservableObject, IRecipient<NavigateMessage>, IDisposable
|
||||||
{
|
{
|
||||||
|
private const string _actualUserPrefix = "Aktueller Benutzer: \n";
|
||||||
|
|
||||||
[ObservableProperty]
|
private readonly IAdsManager _adsManager;
|
||||||
private StringControlButtonVM dummyStringVM;
|
private readonly IConfiguration _config;
|
||||||
|
private readonly TcEventLogger _eventlogger;
|
||||||
|
private User currentUser;
|
||||||
|
// Last active event
|
||||||
|
[ObservableProperty] private string currentActiveEvent = "";
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty] private Page currentPage;
|
||||||
private Page currentPage;
|
|
||||||
|
[ObservableProperty] private Visibility statusBarVisible;
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty] private string breadcrumb;
|
||||||
private bool canNavigateBack;
|
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty] private string actualUser;
|
||||||
private Visibility statusBarVisible;
|
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty] private string sCurrentPackMLMode;
|
||||||
private string breadcrumb;
|
|
||||||
|
[ObservableProperty] private string sCurrentPackMLState;
|
||||||
|
|
||||||
|
[ObservableProperty] private bool canUserChangePageProductionWindow;
|
||||||
|
|
||||||
|
[ObservableProperty] private bool canUserChangePageReceipeWindow;
|
||||||
|
|
||||||
|
public User CurrentUser
|
||||||
|
{
|
||||||
|
get { return currentUser; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref currentUser, value);
|
||||||
|
ActualUser = _actualUserPrefix + currentUser.UserName + " lvl: " + currentUser.UserLevel;
|
||||||
|
Users.setCurrentUser(value);
|
||||||
|
|
||||||
|
CanUserChangePageProductionWindow = value.UserLevel == 100;
|
||||||
|
CanUserChangePageReceipeWindow = value.UserLevel == 100;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//private readonly object _lock = new();
|
||||||
|
|
||||||
|
// Empty page
|
||||||
|
private readonly Page _emptyPage;
|
||||||
|
|
||||||
|
// Last navigate message
|
||||||
|
private readonly Stack<NavigateMessage> _messageStack = new();
|
||||||
|
NavigateMessage? _currentMessage;
|
||||||
|
|
||||||
|
// Events page view model
|
||||||
|
[ObservableProperty] EventsPageVM _eventsPageVM;
|
||||||
|
|
||||||
|
// Settings page viem model
|
||||||
|
SettingsPageVM? _settingsPageVM;
|
||||||
|
|
||||||
|
private PackMLControlVM stMachinePackMLVM;
|
||||||
|
|
||||||
|
ProductionOverviewPageVM? _productionOverviewPageVM;
|
||||||
|
|
||||||
|
// Hot Coolplate page view model
|
||||||
|
HotCoolPlatePageVM? _hotCoolplatePageVM;
|
||||||
|
|
||||||
|
// Kuka Robot page view model
|
||||||
|
ReceipePageVM? _receipePageVM;
|
||||||
|
|
||||||
|
public MainWindowVM(IAdsManager adsManager, IConfiguration config, TcEventLogger eventLogger)
|
||||||
|
{
|
||||||
|
_adsManager = adsManager;
|
||||||
|
_config = config;
|
||||||
|
|
||||||
|
SCurrentPackMLMode = "Aktueller Modus: ";
|
||||||
|
SCurrentPackMLState = "Aktueller Status: ";
|
||||||
|
ActualUser = _actualUserPrefix + "---------";
|
||||||
|
|
||||||
|
// Create empty page
|
||||||
|
_emptyPage = new();
|
||||||
|
|
||||||
|
// Create events page viewmodel
|
||||||
|
_eventlogger = eventLogger;
|
||||||
|
_eventsPageVM = new(_eventlogger);
|
||||||
|
|
||||||
|
CurrentPage = _emptyPage;
|
||||||
|
_currentMessage = new NavigateMessage("", typeof(Page));
|
||||||
|
_messageStack.Push(_currentMessage);
|
||||||
|
|
||||||
|
stMachinePackMLVM = new(_adsManager, "GVL_SCADA.stMachine.stMachineCmds");
|
||||||
|
|
||||||
|
WeakReferenceMessenger.Default.Register<NavigateMessage>(this);
|
||||||
|
|
||||||
|
breadcrumb = "";
|
||||||
|
|
||||||
|
_adsManager.Register("GVL_SCADA.stMachine.stMachineCmds.eCurrentState", StateChanged);
|
||||||
|
_adsManager.Register("GVL_SCADA.stMachine.stMachineCmds.eCurrentMode", ModeChanged);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MainWindowVM()
|
||||||
|
{
|
||||||
|
// Only used for design time
|
||||||
|
SCurrentPackMLMode = "Aktueller Modus: ";
|
||||||
|
SCurrentPackMLState = "Aktueller Status: ";
|
||||||
|
}
|
||||||
|
|
||||||
|
public void NavigateFromOuterPage(NavigateMessage message, NavigateMessage nextMessage)
|
||||||
|
{
|
||||||
|
_currentMessage = message;
|
||||||
|
|
||||||
|
Navigate(message, nextMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private readonly IAdsManager _adsManager;
|
private void StateChanged(object? sender, ValueChangedEventArgs e)
|
||||||
private readonly IConfiguration _config;
|
{
|
||||||
private readonly TcEventLogger _eventlogger;
|
var state = (int)e.Value;
|
||||||
|
var curState = "Aktueller Status: ";
|
||||||
|
switch (state)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
curState += "Undefined";
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
curState += "Clearing";
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
curState += "Stopped";
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
curState += "Starting";
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
curState += "Idle";
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
curState += "Suspended";
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
curState += "Execute";
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
curState += "Stopping";
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
curState += "Aborting";
|
||||||
|
break;
|
||||||
|
case 9:
|
||||||
|
curState += "Aborted";
|
||||||
|
break;
|
||||||
|
case 10:
|
||||||
|
curState += "Holding";
|
||||||
|
break;
|
||||||
|
case 11:
|
||||||
|
curState += "Held";
|
||||||
|
break;
|
||||||
|
case 12:
|
||||||
|
curState += "Unholding";
|
||||||
|
break;
|
||||||
|
case 13:
|
||||||
|
curState += "Suspending";
|
||||||
|
break;
|
||||||
|
case 14:
|
||||||
|
curState += "Unsuspending";
|
||||||
|
break;
|
||||||
|
case 15:
|
||||||
|
curState += "Resetting";
|
||||||
|
break;
|
||||||
|
case 16:
|
||||||
|
curState += "Completing";
|
||||||
|
break;
|
||||||
|
case 17:
|
||||||
|
curState += "Completed";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
curState += "Undefined";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
SCurrentPackMLState = curState;
|
||||||
|
}
|
||||||
|
|
||||||
// Last active event
|
private void ModeChanged(object? sender, ValueChangedEventArgs e)
|
||||||
[ObservableProperty]
|
{
|
||||||
private string currentActiveEvent = "";
|
var curMode = "Aktueller Modus: ";
|
||||||
|
var mode = (int)e.Value;
|
||||||
|
|
||||||
private readonly object _lock = new();
|
switch (mode)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
curMode += "Invalid";
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
curMode += "Production";
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
curMode += "Maintenance";
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
curMode += "Manual";
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
curMode += "change_over";
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
curMode += "clean";
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
curMode += "set up";
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
curMode += "empty out";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
curMode += "Invalid";
|
||||||
|
break;
|
||||||
|
|
||||||
// Empty page
|
}
|
||||||
private readonly Page _emptyPage;
|
|
||||||
|
|
||||||
// Last navigate message
|
SCurrentPackMLMode = curMode;
|
||||||
private readonly Stack<NavigateMessage> _messageStack = new();
|
|
||||||
NavigateMessage? _currentMessage;
|
|
||||||
|
|
||||||
// Events page view model
|
}
|
||||||
[ObservableProperty]
|
|
||||||
EventsPageVM _eventsPageVM;
|
|
||||||
|
|
||||||
// Settings page viem model
|
public void ShowOverview()
|
||||||
SettingsPageVM? _settingsPageVM;
|
{
|
||||||
|
NavigateMessage message = new("", typeof(ProductionOverviewPage));
|
||||||
|
NavigateMessage nextMessage = new("", typeof(OverviewPage));
|
||||||
|
Navigate(message, nextMessage);
|
||||||
|
}
|
||||||
|
|
||||||
public MainWindowVM(IAdsManager adsManager, IConfiguration config, TcEventLogger eventLogger)
|
[RelayCommand]
|
||||||
{
|
private void SettingsWindow()
|
||||||
_adsManager = adsManager;
|
{
|
||||||
_config = config;
|
StatusBarVisible = Visibility.Visible;
|
||||||
|
_messageStack.Clear();
|
||||||
|
NavigateMessage message = new("", typeof(SettingsPage));
|
||||||
|
Receive(message);
|
||||||
|
}
|
||||||
|
|
||||||
// Create dummy string
|
[RelayCommand]
|
||||||
DummyStringVM = new StringControlButtonVM();
|
public void ChangeUserClicked()
|
||||||
|
{
|
||||||
|
var userWindowVm = new UserManagementWindowVm(currentUser);
|
||||||
|
CurrentUser = userWindowVm.GetCurrentUserLevel();
|
||||||
|
ProductionWindowClicked();
|
||||||
|
}
|
||||||
|
|
||||||
// Create empty page
|
[RelayCommand]
|
||||||
_emptyPage = new();
|
private void ProductionWindowClicked()
|
||||||
|
{
|
||||||
|
StatusBarVisible = Visibility.Visible;
|
||||||
|
_messageStack.Clear();
|
||||||
|
_currentMessage = new NavigateMessage("", typeof(Page));
|
||||||
|
NavigateMessage message = new(_config[""]!, typeof(ProductionOverviewPage));
|
||||||
|
Receive(message);
|
||||||
|
}
|
||||||
|
|
||||||
// Create events page viewmodel
|
[RelayCommand]
|
||||||
_eventlogger = eventLogger;
|
private void ProtocolWindowClicked()
|
||||||
_eventsPageVM = new(_eventlogger);
|
{
|
||||||
|
}
|
||||||
|
|
||||||
CurrentPage = _emptyPage;
|
[RelayCommand]
|
||||||
_currentMessage = new NavigateMessage("", typeof(Page));
|
private void ReceipesWindowClicked()
|
||||||
_messageStack.Push(_currentMessage);
|
{
|
||||||
|
StatusBarVisible = Visibility.Visible;
|
||||||
|
_messageStack.Clear();
|
||||||
|
_currentMessage = new NavigateMessage("", typeof(Page));
|
||||||
|
NavigateMessage message = new(_config[""]!, typeof(ReceipePage));
|
||||||
|
Receive(message);
|
||||||
|
}
|
||||||
|
|
||||||
WeakReferenceMessenger.Default.Register<NavigateMessage>(this);
|
[RelayCommand]
|
||||||
|
private void TrendWindowClicked()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
breadcrumb = "";
|
[RelayCommand]
|
||||||
}
|
private void ComponentsWindowClicked()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
[RelayCommand]
|
[RelayCommand]
|
||||||
private void SettingsWindow()
|
private void SettingsWindowClicked()
|
||||||
{
|
{
|
||||||
StatusBarVisible = Visibility.Visible;
|
_messageStack.Clear();
|
||||||
_messageStack.Clear();
|
NavigateMessage message = new("", typeof(SettingsPage));
|
||||||
NavigateMessage message = new("", typeof(SettingsPage));
|
Receive(message);
|
||||||
Receive(message);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
[RelayCommand]
|
|
||||||
public void AutomaticModeClicked()
|
|
||||||
{
|
|
||||||
StatusBarVisible = Visibility.Visible;
|
|
||||||
_messageStack.Clear();
|
|
||||||
_currentMessage = new NavigateMessage("", typeof(Page));
|
|
||||||
NavigateMessage message = new(_config["AutomaticModeVarName"]!, typeof(AutomaticModePage));
|
|
||||||
Receive(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
[RelayCommand]
|
|
||||||
public void ManualModeClicked()
|
|
||||||
{
|
|
||||||
StatusBarVisible = Visibility.Visible;
|
|
||||||
_messageStack.Clear();
|
|
||||||
_currentMessage = new NavigateMessage("", typeof(Page));
|
|
||||||
NavigateMessage message = new("", typeof(BatteryOverviewPage));
|
|
||||||
Receive(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
[RelayCommand]
|
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
public void EventsListClicked()
|
public void EventsListClicked()
|
||||||
{
|
{
|
||||||
StatusBarVisible = Visibility.Collapsed;
|
StatusBarVisible = Visibility.Collapsed;
|
||||||
@@ -115,47 +315,15 @@ public sealed partial class MainWindowVM : ObservableObject, IRecipient<Navigate
|
|||||||
NavigateMessage message = new("", typeof(EventsPage));
|
NavigateMessage message = new("", typeof(EventsPage));
|
||||||
Receive(message);
|
Receive(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
[RelayCommand]
|
|
||||||
public void NavigateBack()
|
|
||||||
{
|
|
||||||
if (_messageStack.Count == 0)
|
|
||||||
{
|
|
||||||
CanNavigateBack = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_currentMessage = _messageStack.Pop();
|
|
||||||
|
|
||||||
// Update if we can use the navigate back button
|
|
||||||
if (_messageStack.Count > 0)
|
|
||||||
CanNavigateBack = true;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
StatusBarVisible = Visibility.Visible;
|
|
||||||
CanNavigateBack = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Remove last two entrys from Breadcrumbs
|
|
||||||
int index = -1;
|
|
||||||
for (int i = 0; i < 2; i++)
|
|
||||||
{
|
|
||||||
index = Breadcrumb.LastIndexOf('>');
|
|
||||||
if (index != -1)
|
|
||||||
Breadcrumb = Breadcrumb[..index];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Navigate to page
|
|
||||||
Navigate(_currentMessage);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Only use for forward traversal!
|
// Only use for forward traversal!
|
||||||
public void Receive(NavigateMessage message)
|
public void Receive(NavigateMessage message)
|
||||||
{
|
{
|
||||||
// Only change page if its a new page type
|
// Only change page if its a new page type
|
||||||
if (CurrentPage.GetType() == message.type)
|
if (CurrentPage.GetType() == message.type)
|
||||||
return;
|
//return;
|
||||||
|
|
||||||
// Push current message
|
// Push current message
|
||||||
if (_currentMessage != null)
|
if (_currentMessage != null)
|
||||||
@@ -164,13 +332,11 @@ public sealed partial class MainWindowVM : ObservableObject, IRecipient<Navigate
|
|||||||
// Save current message for later push
|
// Save current message for later push
|
||||||
_currentMessage = message;
|
_currentMessage = message;
|
||||||
|
|
||||||
// Set can navigate back
|
|
||||||
CanNavigateBack = true;
|
|
||||||
|
|
||||||
Navigate(message);
|
Navigate(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Navigate(NavigateMessage message)
|
private void Navigate(NavigateMessage message, NavigateMessage? nextMessage = null)
|
||||||
{
|
{
|
||||||
// Dispose current pages viewmodel
|
// Dispose current pages viewmodel
|
||||||
if (CurrentPage.DataContext is IDisposable viewModel)
|
if (CurrentPage.DataContext is IDisposable viewModel)
|
||||||
@@ -182,44 +348,13 @@ public sealed partial class MainWindowVM : ObservableObject, IRecipient<Navigate
|
|||||||
// Create new page
|
// Create new page
|
||||||
switch (message.type.Name)
|
switch (message.type.Name)
|
||||||
{
|
{
|
||||||
case nameof(AutomaticModePage):
|
case nameof(ProductionOverviewPage):
|
||||||
var automaticModeViewModel = (AutomaticModePageVM)ActivatorUtilities.CreateInstance(App.AppHost!.Services, typeof(AutomaticModePageVM), message.VariableName); //App.AppHost!.Services.GetRequiredService<AutomaticModePageVM>();
|
|
||||||
AutomaticModePage automaticModePage = new() { DataContext = automaticModeViewModel };
|
|
||||||
CurrentPage = automaticModePage;
|
|
||||||
Breadcrumb = "> Automatic";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case nameof(BatteryOverviewPage):
|
if (_productionOverviewPageVM == null || nextMessage != null)
|
||||||
var batteryOverviewPageVM = App.AppHost!.Services.GetRequiredService<BatteryOverviewPageVM>();
|
_productionOverviewPageVM = new ProductionOverviewPageVM(_adsManager, _config, _eventlogger, nextMessage);
|
||||||
BatteryOverviewPage batteryOverviewPage = new() { DataContext = batteryOverviewPageVM };
|
ProductionOverviewPage productionOverviewPage = new() { DataContext = _productionOverviewPageVM };
|
||||||
CurrentPage = batteryOverviewPage;
|
CurrentPage = productionOverviewPage;
|
||||||
Breadcrumb = "> Manual";
|
break;
|
||||||
break;
|
|
||||||
|
|
||||||
case nameof(StringOverviewPage):
|
|
||||||
var stringOverviewVM = (StringOverviewPageVM)ActivatorUtilities.CreateInstance(App.AppHost!.Services, typeof(StringOverviewPageVM), message.VariableName);
|
|
||||||
StringOverviewPage stringPage = new() { DataContext = stringOverviewVM };
|
|
||||||
CurrentPage = stringPage;
|
|
||||||
if (message.Header.Length > 0)
|
|
||||||
AppendBreadcrumb(message.Header);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case nameof(ModuleOverviewPage):
|
|
||||||
var moduleOverviewVM = (ModuleOverviewPageVM)ActivatorUtilities.CreateInstance(App.AppHost!.Services, typeof(ModuleOverviewPageVM), message.VariableName);
|
|
||||||
ModuleOverviewPage modulePage = new() { DataContext = moduleOverviewVM };
|
|
||||||
CurrentPage = modulePage;
|
|
||||||
if (message.Header.Length > 0)
|
|
||||||
AppendBreadcrumb(message.Header);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case nameof(UnitOverviewPage):
|
|
||||||
var unitOverviewVM = (UnitOverviewPageVM)ActivatorUtilities.CreateInstance(App.AppHost!.Services, typeof(UnitOverviewPageVM), message.VariableName);
|
|
||||||
unitOverviewVM.UnitName = message.Header;
|
|
||||||
UnitOverviewPage unitPage = new() { DataContext = unitOverviewVM };
|
|
||||||
CurrentPage = unitPage;
|
|
||||||
if (message.Header.Length > 0)
|
|
||||||
AppendBreadcrumb(message.Header);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case nameof(EventsPage):
|
case nameof(EventsPage):
|
||||||
#pragma warning disable MVVMTK0034 // Direct field reference to [ObservableProperty] backing field
|
#pragma warning disable MVVMTK0034 // Direct field reference to [ObservableProperty] backing field
|
||||||
@@ -239,6 +374,24 @@ public sealed partial class MainWindowVM : ObservableObject, IRecipient<Navigate
|
|||||||
Breadcrumb = " > Settings";
|
Breadcrumb = " > Settings";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case nameof(ReceipePage):
|
||||||
|
if (_receipePageVM == null)
|
||||||
|
_receipePageVM = new();
|
||||||
|
|
||||||
|
ReceipePage receipePage = new() { DataContext = _receipePageVM };
|
||||||
|
CurrentPage = receipePage;
|
||||||
|
Breadcrumb = " > Kuka Roboter";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case nameof(HotCoolPlatePage):
|
||||||
|
if (_hotCoolplatePageVM == null)
|
||||||
|
_hotCoolplatePageVM = new(_adsManager, "directlySetInViewModel");
|
||||||
|
|
||||||
|
HotCoolPlatePage hotCoolPlatePage = new() {DataContext = _hotCoolplatePageVM };
|
||||||
|
CurrentPage = hotCoolPlatePage;
|
||||||
|
Breadcrumb = " > Heiz- /Kühlplatte";
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
CurrentPage = new Page();
|
CurrentPage = new Page();
|
||||||
break;
|
break;
|
||||||
@@ -256,8 +409,8 @@ public sealed partial class MainWindowVM : ObservableObject, IRecipient<Navigate
|
|||||||
[RelayCommand]
|
[RelayCommand]
|
||||||
private void AckAlarms()
|
private void AckAlarms()
|
||||||
{
|
{
|
||||||
_adsManager.WriteValue("GVL_SCADA.stAckAlarmsButton.xRequest", true);
|
_adsManager.WriteValue("GVL_SCADA.stMachine.stConfirmAlarmsBtn.xRequest", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
@@ -268,6 +421,5 @@ public sealed partial class MainWindowVM : ObservableObject, IRecipient<Navigate
|
|||||||
viewModel.Dispose();
|
viewModel.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
DummyStringVM.Dispose();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
159
uniper_hmi/UniperHMI/Model/Models.cs
Normal file
159
uniper_hmi/UniperHMI/Model/Models.cs
Normal file
@@ -0,0 +1,159 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
|
||||||
|
namespace InfineonHMI.Model;
|
||||||
|
|
||||||
|
public enum E_BMS_CONTROL_MODE : short
|
||||||
|
{
|
||||||
|
AUTO_REMOTE = 1,
|
||||||
|
AUTO_LOCAL = 2,
|
||||||
|
SAFETY_CHECK = 3,
|
||||||
|
CAPACITY_TEST = 4,
|
||||||
|
MANUAL = 5
|
||||||
|
}
|
||||||
|
|
||||||
|
public class BMSControlModeEntry(E_BMS_CONTROL_MODE mode, string name)
|
||||||
|
{
|
||||||
|
public E_BMS_CONTROL_MODE eMode = mode;
|
||||||
|
public string Name = name;
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return Name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum PLCJobenum : short
|
||||||
|
{
|
||||||
|
NONE = 0,
|
||||||
|
SCAN_QR_CODE = 10,
|
||||||
|
VACUUM_ON_ALIGNER = 15,
|
||||||
|
VACUUM_OFF_ALIGNER = 16,
|
||||||
|
VACUUM_ON_ETCHER_1 = 20,
|
||||||
|
VACUUM_ON_ETCHER_2 = 21,
|
||||||
|
VACUUM_OFF_ETCHER_1 = 22,
|
||||||
|
VACUUM_OFF_ETCHER_2 = 23,
|
||||||
|
CHUCK_OPEN_ETCHER_1 = 60,
|
||||||
|
CHUCK_OPEN_ETCHER_2 = 61,
|
||||||
|
CHUCK_CLOSE_ETCHER_1 = 62,
|
||||||
|
CHUCK_CLOSE_ETCHER_2 = 63,
|
||||||
|
}
|
||||||
|
public enum RobotJobenum : short
|
||||||
|
{
|
||||||
|
NONE = 0,
|
||||||
|
PICK_TRAYFEEDER = 10,
|
||||||
|
PLACE_TRAYFEEDER = 11,
|
||||||
|
PUT_ALIGNMENT = 15,
|
||||||
|
PICK_ALIGNMENT = 16,
|
||||||
|
PUT_ETCHER_1 = 20,
|
||||||
|
PUT_ETCHER_2 = 21,
|
||||||
|
PICK_ETCHER_1 = 22,
|
||||||
|
PICK_ETCHER_2 = 23,
|
||||||
|
SWITCH_ETCHER_1 = 24,
|
||||||
|
SWITCH_ETCHER_2 = 25,
|
||||||
|
PUT_HVTEST_HOT = 30,
|
||||||
|
PUT_HVTEST_COLD = 31,
|
||||||
|
PICK_HVTEST_HOT = 32,
|
||||||
|
PICK_HVTEST_COLD = 33,
|
||||||
|
PUT_HOTPLATE = 40,
|
||||||
|
PICK_HOTPLATE = 41,
|
||||||
|
PUT_COOLPLATE = 42,
|
||||||
|
PICK_COOLPLATE = 43,
|
||||||
|
PICK_GRIPPER = 50,
|
||||||
|
PICK_CHUCK_ETCHER_1 = 60,
|
||||||
|
PICK_CHUCK_ETCHER_2 = 61,
|
||||||
|
PUT_CHUCK_ETCHER_1 = 62,
|
||||||
|
PUT_CHUCK_ETCHER_2 = 63,
|
||||||
|
PUT_CHUCK_MAGAZIN = 64,
|
||||||
|
PICK_CHUCK_MAGAZIN = 65,
|
||||||
|
PUT_NIO_STATION = 70,
|
||||||
|
PICK_NIO_STATION = 71,
|
||||||
|
WARMUP = 80
|
||||||
|
}
|
||||||
|
public class PLCJobentry(PLCJobenum job, string name)
|
||||||
|
{
|
||||||
|
public PLCJobenum eJob = job;
|
||||||
|
public string Name = name;
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return Name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class RobotJobentry(RobotJobenum job, string name)
|
||||||
|
{
|
||||||
|
public RobotJobenum eJob = job;
|
||||||
|
public string Name = name;
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return Name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum Stationenum : uint
|
||||||
|
{
|
||||||
|
EINGABE = 1,
|
||||||
|
QRCODE = 2,
|
||||||
|
AUSRICHTEN = 4,
|
||||||
|
AETZEN = 8,
|
||||||
|
HEIZPLATTE = 16,
|
||||||
|
KUEHLPLATTE = 32,
|
||||||
|
HOCHVOLTHEISS = 64,
|
||||||
|
HOCHVOLTKALT = 128,
|
||||||
|
AUSGABE = 256,
|
||||||
|
NIOSTATION = 512
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public class StationEntry
|
||||||
|
{
|
||||||
|
private Stationenum eStation;
|
||||||
|
public Stationenum EStation
|
||||||
|
{
|
||||||
|
get { return eStation; }
|
||||||
|
set { eStation = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private string sName;
|
||||||
|
|
||||||
|
public string SName
|
||||||
|
{
|
||||||
|
get { return sName; }
|
||||||
|
set { sName = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public StationEntry(Stationenum station, string name)
|
||||||
|
{
|
||||||
|
EStation = station;
|
||||||
|
SName = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public StationEntry()
|
||||||
|
{
|
||||||
|
EStation = Stationenum.EINGABE;
|
||||||
|
SName = "Eingabetray";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return SName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class FlowReceipeEntry()
|
||||||
|
{
|
||||||
|
public int NodeId { get; set; }
|
||||||
|
public UInt16 Priority { get; set; }
|
||||||
|
public required StationEntry Station { get; set; }
|
||||||
|
public UInt16 MaxRetries { get; set; }
|
||||||
|
public int NextNodeSuccess { get; set; }
|
||||||
|
public int NextNodeRetry { get; set; }
|
||||||
|
public int NextNodeFail { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
222
uniper_hmi/UniperHMI/Model/ReceipeDto.cs
Normal file
222
uniper_hmi/UniperHMI/Model/ReceipeDto.cs
Normal file
@@ -0,0 +1,222 @@
|
|||||||
|
using System.IO;
|
||||||
|
using System.Reflection.PortableExecutable;
|
||||||
|
using System.Xml;
|
||||||
|
using System.Xml.Serialization;
|
||||||
|
using InfineonHMI.Common;
|
||||||
|
|
||||||
|
namespace InfineonHMI.Model;
|
||||||
|
|
||||||
|
public class ReceipeDto
|
||||||
|
{
|
||||||
|
|
||||||
|
public ReceipeDto()
|
||||||
|
{
|
||||||
|
ReceipeObject = new ReceipeObject();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ReceipeObject ReceipeObject { get; set; }
|
||||||
|
public void Write(string filename)
|
||||||
|
{
|
||||||
|
L4ItXmlSerializer.SerializeObject(ReceipeObject, filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Read(string filename)
|
||||||
|
{
|
||||||
|
ReceipeObject = L4ItXmlSerializer.DeSerializeObject<ReceipeObject>(filename);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ReceipeObject
|
||||||
|
{
|
||||||
|
public MachineParameters MachineParameters { get; set; }
|
||||||
|
public ProductParameters ProductParameters { get; set; }
|
||||||
|
public ReceipeHotplate ReceipeHotplate { get; set; }
|
||||||
|
public ReceipeCoolplate ReceipeCoolplate { get; set; }
|
||||||
|
public ReceipeEtcher ReceipeEtcher { get; set; }
|
||||||
|
public ReceipeHighvoltageTester ReceipeHvTester { get; set; }
|
||||||
|
public FlowReceipeModel FlowreceipeModel { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public ReceipeObject()
|
||||||
|
{
|
||||||
|
MachineParameters = new MachineParameters();
|
||||||
|
ProductParameters = new ProductParameters();
|
||||||
|
ReceipeHotplate = new ReceipeHotplate();
|
||||||
|
ReceipeCoolplate = new ReceipeCoolplate();
|
||||||
|
ReceipeEtcher = new ReceipeEtcher();
|
||||||
|
ReceipeHvTester = new ReceipeHighvoltageTester();
|
||||||
|
FlowreceipeModel = new FlowReceipeModel();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public class MachineParameters
|
||||||
|
{
|
||||||
|
public List<TrayPosition> TrayPositions { get; set; }
|
||||||
|
|
||||||
|
public int CameraPrograms { get; set; }
|
||||||
|
|
||||||
|
public int Chucks { get; set; }
|
||||||
|
|
||||||
|
public int Gripper { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Erlaubten Strahlparameter Abweichungen
|
||||||
|
/// </summary>
|
||||||
|
public float PermissibleBeamParameterDeviations { get; set; }
|
||||||
|
|
||||||
|
public MachineParameters()
|
||||||
|
{
|
||||||
|
TrayPositions = new List<TrayPosition>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ProductParameters
|
||||||
|
{
|
||||||
|
public float Diameter { get; set; }
|
||||||
|
|
||||||
|
public float Thickness { get; set; }
|
||||||
|
|
||||||
|
public float TimeIntervallBeamCheck { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ReceipeHotplate
|
||||||
|
{
|
||||||
|
public float RestingTime { get; set; }
|
||||||
|
public float TargetTemperature { get; set; }
|
||||||
|
}
|
||||||
|
public class ReceipeCoolplate
|
||||||
|
{
|
||||||
|
public float RestingTime { get; set; }
|
||||||
|
public float TargetTemperature { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ReceipeHighvoltageTester
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Test voltage in V
|
||||||
|
/// </summary>
|
||||||
|
public float TestVoltage { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Maximum test Current
|
||||||
|
/// </summary>
|
||||||
|
public float MaximumTestCurrent { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Ramp Time in milliseconds
|
||||||
|
/// </summary>
|
||||||
|
public float RampTime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Testfrequency in HZ
|
||||||
|
/// </summary>
|
||||||
|
public float TestFrequency { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Polarity 1=Positive, 2=Negative
|
||||||
|
/// </summary>
|
||||||
|
public UInt16 Polarity { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Overpressure N2 in mbar
|
||||||
|
/// </summary>
|
||||||
|
public float TestpressureN2 { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// N2 pre purging time in seconds
|
||||||
|
/// </summary>
|
||||||
|
public float N2PrePurgetime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test retries
|
||||||
|
/// </summary>
|
||||||
|
public UInt16 NumRetries { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Temperature for testing (only used in heated HV station)
|
||||||
|
/// </summary>
|
||||||
|
public float TestTemperature { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test OK Voltage
|
||||||
|
/// </summary>
|
||||||
|
public float TestOkVoltage { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test OK Current
|
||||||
|
/// </summary>
|
||||||
|
public float TestOkCurrent { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ReceipeEtcher
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Number of Robot positions
|
||||||
|
/// </summary>
|
||||||
|
public UInt16 NumberRobotPos { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Roboter position and setting data
|
||||||
|
/// </summary>
|
||||||
|
public List<EtcherRobotStepData> RobotStepData { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public ReceipeEtcher()
|
||||||
|
{
|
||||||
|
RobotStepData = new List<EtcherRobotStepData>();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class EtcherRobotStepData
|
||||||
|
{
|
||||||
|
public float PosX { get; set; }
|
||||||
|
public float PosY { get; set; }
|
||||||
|
public float PosZ { get; set; }
|
||||||
|
public float AngleAlpha { get; set; }
|
||||||
|
public float AngleGamma { get; set; }
|
||||||
|
public float RadialposUnderwater { get; set; }
|
||||||
|
public float ChuckRpm { get; set; }
|
||||||
|
public float MoveSpeed { get; set; }
|
||||||
|
public float Delay { get; set; }
|
||||||
|
public UInt16 Medium { get; set; }
|
||||||
|
public bool WaterFromBelow { get; set; }
|
||||||
|
public bool WaterFromAbove { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class FlowReceipeModel
|
||||||
|
{
|
||||||
|
public int NodeCount { get; set; }
|
||||||
|
public List<FlowReceipeNode> Nodes { get; set; }
|
||||||
|
|
||||||
|
public FlowReceipeModel()
|
||||||
|
{
|
||||||
|
Nodes = new List<FlowReceipeNode>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class FlowReceipeNode
|
||||||
|
{
|
||||||
|
public UInt16 Priority { get; set; }
|
||||||
|
public UInt32 StationType { get; set; }
|
||||||
|
|
||||||
|
public UInt16 MaxRetries { get; set; }
|
||||||
|
public int NextNodeSuccess { get; set; }
|
||||||
|
public int NextNodeRetry { get; set; }
|
||||||
|
public int NextNodeFail { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class TrayPosition
|
||||||
|
{
|
||||||
|
public int PosId { get; set; }
|
||||||
|
public float PosX { get; set; }
|
||||||
|
public float PosY { get; set; }
|
||||||
|
}
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
namespace UniperHMI;
|
namespace InfineonHMI;
|
||||||
|
|
||||||
public record class NavigateMessage(string VariableName, Type type, string Header = "");
|
public record class NavigateMessage(string VariableName, Type type, string Header = "");
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
using CommunityToolkit.Mvvm.Input;
|
|
||||||
using CommunityToolkit.Mvvm.Messaging;
|
|
||||||
using Heisig.HMI.AdsManager;
|
|
||||||
|
|
||||||
namespace UniperHMI;
|
|
||||||
|
|
||||||
public sealed partial class ModuleControlButtonVM : SMUBaseVM, IDisposable
|
|
||||||
{
|
|
||||||
public ModuleControlButtonVM() : base() { }
|
|
||||||
|
|
||||||
public ModuleControlButtonVM(IAdsManager adsManager, string variableName) : base(adsManager, variableName) { }
|
|
||||||
|
|
||||||
[RelayCommand]
|
|
||||||
private void Clicked()
|
|
||||||
{
|
|
||||||
WeakReferenceMessenger.Default.Send(new NavigateMessage(_variableName, typeof(ModuleOverviewPage)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
using Heisig.HMI.AdsManager;
|
using Heisig.HMI.AdsManager;
|
||||||
using TwinCAT.TypeSystem;
|
using TwinCAT.TypeSystem;
|
||||||
|
|
||||||
namespace UniperHMI;
|
namespace InfineonHMI;
|
||||||
|
|
||||||
public enum E_COMPONENT_STATUS : short
|
public enum E_COMPONENT_STATUS : short
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using Heisig.HMI.AdsManager;
|
using Heisig.HMI.AdsManager;
|
||||||
|
|
||||||
namespace UniperHMI;
|
namespace InfineonHMI;
|
||||||
|
|
||||||
public sealed partial class StringControlButtonVM : SMUBaseVM, IDisposable
|
public sealed partial class StringControlButtonVM : SMUBaseVM, IDisposable
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,18 +2,17 @@
|
|||||||
using CommunityToolkit.Mvvm.Messaging;
|
using CommunityToolkit.Mvvm.Messaging;
|
||||||
using Heisig.HMI.AdsManager;
|
using Heisig.HMI.AdsManager;
|
||||||
|
|
||||||
namespace UniperHMI.OwnControls
|
namespace InfineonHMI.OwnControls;
|
||||||
|
|
||||||
|
public sealed partial class UnitControlButtonVM : SMUBaseVM
|
||||||
{
|
{
|
||||||
public sealed partial class UnitControlButtonVM : SMUBaseVM
|
public UnitControlButtonVM() : base() { }
|
||||||
{
|
|
||||||
public UnitControlButtonVM() : base() { }
|
|
||||||
|
|
||||||
public UnitControlButtonVM(IAdsManager adsManager, string variableName) : base(adsManager, variableName) { }
|
public UnitControlButtonVM(IAdsManager adsManager, string variableName) : base(adsManager, variableName) { }
|
||||||
|
|
||||||
[RelayCommand]
|
[RelayCommand]
|
||||||
private void Clicked()
|
private void Clicked()
|
||||||
{
|
{
|
||||||
WeakReferenceMessenger.Default.Send(new NavigateMessage(_variableName, typeof(UnitDetailsControl)));
|
WeakReferenceMessenger.Default.Send(new NavigateMessage(_variableName, typeof(UnitDetailsControl)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@@ -4,491 +4,490 @@ using HMIToolkit;
|
|||||||
using TwinCAT.TypeSystem;
|
using TwinCAT.TypeSystem;
|
||||||
using Heisig.HMI.AdsManager;
|
using Heisig.HMI.AdsManager;
|
||||||
|
|
||||||
namespace UniperHMI
|
namespace InfineonHMI;
|
||||||
|
|
||||||
|
public sealed partial class UnitDetailsControlVM : ObservableObject, IDisposable
|
||||||
{
|
{
|
||||||
public sealed partial class UnitDetailsControlVM : ObservableObject, IDisposable
|
[ObservableProperty]
|
||||||
{
|
private float rVoltage;
|
||||||
[ObservableProperty]
|
|
||||||
private float rVoltage;
|
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
private E_COMPONENT_STATUS status;
|
private E_COMPONENT_STATUS status;
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
private AnalogValueVM pressureNegolytSegmentInVM;
|
private AnalogValueVM pressureNegolytSegmentInVM;
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
private AnalogValueVM pressureNegolytTankInVM;
|
private AnalogValueVM pressureNegolytTankInVM;
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
private AnalogValueVM temperatureNegolytTankInVM;
|
private AnalogValueVM temperatureNegolytTankInVM;
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
private AnalogValueVM pressurePosolytSegmentInVM;
|
private AnalogValueVM pressurePosolytSegmentInVM;
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
private AnalogValueVM pressurePosolytTankInVM;
|
private AnalogValueVM pressurePosolytTankInVM;
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
private AnalogValueVM temperaturePosolytTankInVM;
|
private AnalogValueVM temperaturePosolytTankInVM;
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
private bool canOpenBothValves;
|
private bool canOpenBothValves;
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
private bool canCloseBothValves;
|
private bool canCloseBothValves;
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
private short feedbackOpenValves;
|
private short feedbackOpenValves;
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
private short feedbackCloseValves;
|
private short feedbackCloseValves;
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
private bool canStartBothPumps;
|
private bool canStartBothPumps;
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
private bool canStopBothPumps;
|
private bool canStopBothPumps;
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
private short feedbackStartPumps;
|
private short feedbackStartPumps;
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
private short feedbackStopPumps;
|
private short feedbackStopPumps;
|
||||||
|
|
||||||
private float _posolytPumpOnSpeed;
|
private float _posolytPumpOnSpeed;
|
||||||
private float _negolytPumpOnSpeed;
|
private float _negolytPumpOnSpeed;
|
||||||
|
|
||||||
private float valveWindowHorizontalPosition;
|
private float valveWindowHorizontalPosition;
|
||||||
|
|
||||||
private readonly BinaryValveControlVM _valveNegolytVM;
|
private readonly BinaryValveControlVM _valveNegolytVM;
|
||||||
private readonly BinaryValveControlVM _valvePosolytVM;
|
private readonly BinaryValveControlVM _valvePosolytVM;
|
||||||
private readonly AnalogMotorControlVM _pumpNegolytVM;
|
private readonly AnalogMotorControlVM _pumpNegolytVM;
|
||||||
private readonly AnalogMotorControlVM _pumpPosolytVM;
|
private readonly AnalogMotorControlVM _pumpPosolytVM;
|
||||||
|
|
||||||
private BinaryValveWindow? _windowValveNegolyt;
|
private BinaryValveWindow? _windowValveNegolyt;
|
||||||
private BinaryValveWindow? _windowValvePosolyt;
|
private BinaryValveWindow? _windowValvePosolyt;
|
||||||
|
|
||||||
private AnalogMotorWindow? _windowPumpNegolyt;
|
private AnalogMotorWindow? _windowPumpNegolyt;
|
||||||
private AnalogMotorWindow? _windowPumpPosolyt;
|
private AnalogMotorWindow? _windowPumpPosolyt;
|
||||||
|
|
||||||
private readonly IAdsManager? _adsManager;
|
private readonly IAdsManager? _adsManager;
|
||||||
private readonly string _variableName;
|
private readonly string _variableName;
|
||||||
|
|
||||||
public UnitDetailsControlVM()
|
public UnitDetailsControlVM()
|
||||||
{
|
{
|
||||||
Status = E_COMPONENT_STATUS.OFF;
|
Status = E_COMPONENT_STATUS.OFF;
|
||||||
rVoltage = 0.0f;
|
rVoltage = 0.0f;
|
||||||
_variableName = "";
|
_variableName = "";
|
||||||
|
|
||||||
// Negolyt
|
// Negolyt
|
||||||
PressureNegolytSegmentInVM = new AnalogValueVM();
|
PressureNegolytSegmentInVM = new AnalogValueVM();
|
||||||
PressureNegolytTankInVM = new AnalogValueVM();
|
PressureNegolytTankInVM = new AnalogValueVM();
|
||||||
TemperatureNegolytTankInVM = new AnalogValueVM();
|
TemperatureNegolytTankInVM = new AnalogValueVM();
|
||||||
_valveNegolytVM = new BinaryValveControlVM();
|
_valveNegolytVM = new BinaryValveControlVM();
|
||||||
_pumpNegolytVM = new AnalogMotorControlVM();
|
_pumpNegolytVM = new AnalogMotorControlVM();
|
||||||
|
|
||||||
_windowValveNegolyt = null;
|
_windowValveNegolyt = null;
|
||||||
|
|
||||||
// Posolyt
|
// Posolyt
|
||||||
PressurePosolytSegmentInVM = new AnalogValueVM();
|
PressurePosolytSegmentInVM = new AnalogValueVM();
|
||||||
PressurePosolytTankInVM = new AnalogValueVM();
|
PressurePosolytTankInVM = new AnalogValueVM();
|
||||||
TemperaturePosolytTankInVM = new AnalogValueVM();
|
TemperaturePosolytTankInVM = new AnalogValueVM();
|
||||||
_valvePosolytVM = new BinaryValveControlVM();
|
_valvePosolytVM = new BinaryValveControlVM();
|
||||||
_pumpPosolytVM = new AnalogMotorControlVM();
|
_pumpPosolytVM = new AnalogMotorControlVM();
|
||||||
|
|
||||||
_windowValvePosolyt = null;
|
_windowValvePosolyt = null;
|
||||||
|
|
||||||
valveWindowHorizontalPosition = 10;
|
valveWindowHorizontalPosition = 10;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public UnitDetailsControlVM(IAdsManager adsManager, string variableName)
|
public UnitDetailsControlVM(IAdsManager adsManager, string variableName)
|
||||||
{
|
{
|
||||||
_adsManager = adsManager;
|
_adsManager = adsManager;
|
||||||
_variableName = variableName;
|
_variableName = variableName;
|
||||||
|
|
||||||
|
|
||||||
Status = E_COMPONENT_STATUS.OFF;
|
Status = E_COMPONENT_STATUS.OFF;
|
||||||
rVoltage = 0.0f;
|
rVoltage = 0.0f;
|
||||||
|
|
||||||
|
|
||||||
// Negolyt
|
// Negolyt
|
||||||
PressureNegolytSegmentInVM = new AnalogValueVM(_adsManager, _variableName + ".stP21", true);
|
PressureNegolytSegmentInVM = new AnalogValueVM(_adsManager, _variableName + ".stP21", true);
|
||||||
PressureNegolytTankInVM = new AnalogValueVM(_adsManager, _variableName + ".stP22", true);
|
PressureNegolytTankInVM = new AnalogValueVM(_adsManager, _variableName + ".stP22", true);
|
||||||
TemperatureNegolytTankInVM = new AnalogValueVM(_adsManager, _variableName + ".stT21", true);
|
TemperatureNegolytTankInVM = new AnalogValueVM(_adsManager, _variableName + ".stT21", true);
|
||||||
_valveNegolytVM = new BinaryValveControlVM(_adsManager, _variableName + ".stNS22");
|
_valveNegolytVM = new BinaryValveControlVM(_adsManager, _variableName + ".stNS22");
|
||||||
_valveNegolytVM.OpenButton.FeedbackChanged += OnValveNegolytOpenFeedbackChanged;
|
_valveNegolytVM.OpenButton.FeedbackChanged += OnValveNegolytOpenFeedbackChanged;
|
||||||
_valveNegolytVM.CloseButton.FeedbackChanged += OnValveNegolytCloseFeedbackChanged;
|
_valveNegolytVM.CloseButton.FeedbackChanged += OnValveNegolytCloseFeedbackChanged;
|
||||||
_valveNegolytVM.OpenButton.ReleaseChanged += OnValveNegolytOpenReleaseChanged;
|
_valveNegolytVM.OpenButton.ReleaseChanged += OnValveNegolytOpenReleaseChanged;
|
||||||
_valveNegolytVM.CloseButton.ReleaseChanged += OnValveNegolytCloseReleaseChanged;
|
_valveNegolytVM.CloseButton.ReleaseChanged += OnValveNegolytCloseReleaseChanged;
|
||||||
_pumpNegolytVM = new AnalogMotorControlVM(_adsManager, _variableName + ".stNS21");
|
_pumpNegolytVM = new AnalogMotorControlVM(_adsManager, _variableName + ".stNS21");
|
||||||
_pumpNegolytVM.StartButton.FeedbackChanged += OnPumpNegolytStartFeedbackChanged;
|
_pumpNegolytVM.StartButton.FeedbackChanged += OnPumpNegolytStartFeedbackChanged;
|
||||||
_pumpNegolytVM.StopButton.FeedbackChanged += OnPumpNegolytStopFeedbackChanged;
|
_pumpNegolytVM.StopButton.FeedbackChanged += OnPumpNegolytStopFeedbackChanged;
|
||||||
_pumpNegolytVM.StartButton.ReleaseChanged += OnPumpNegolytStartReleaseChanged;
|
_pumpNegolytVM.StartButton.ReleaseChanged += OnPumpNegolytStartReleaseChanged;
|
||||||
_pumpNegolytVM.StopButton.ReleaseChanged += OnPumpNegolytStopReleaseChanged;
|
_pumpNegolytVM.StopButton.ReleaseChanged += OnPumpNegolytStopReleaseChanged;
|
||||||
|
|
||||||
|
|
||||||
// Posolyt
|
// Posolyt
|
||||||
PressurePosolytSegmentInVM = new AnalogValueVM(_adsManager, _variableName + ".stP11", true);
|
PressurePosolytSegmentInVM = new AnalogValueVM(_adsManager, _variableName + ".stP11", true);
|
||||||
PressurePosolytTankInVM = new AnalogValueVM(_adsManager, _variableName + ".stP12", true);
|
PressurePosolytTankInVM = new AnalogValueVM(_adsManager, _variableName + ".stP12", true);
|
||||||
TemperaturePosolytTankInVM = new AnalogValueVM(_adsManager, _variableName + ".stT11", true);
|
TemperaturePosolytTankInVM = new AnalogValueVM(_adsManager, _variableName + ".stT11", true);
|
||||||
_valvePosolytVM = new BinaryValveControlVM(_adsManager, _variableName + ".stNS12");
|
_valvePosolytVM = new BinaryValveControlVM(_adsManager, _variableName + ".stNS12");
|
||||||
_valvePosolytVM.OpenButton.FeedbackChanged += OnValvePosolytOpenFeedbackChanged;
|
_valvePosolytVM.OpenButton.FeedbackChanged += OnValvePosolytOpenFeedbackChanged;
|
||||||
_valvePosolytVM.CloseButton.FeedbackChanged += OnValvePosolytCloseFeedbackChanged;
|
_valvePosolytVM.CloseButton.FeedbackChanged += OnValvePosolytCloseFeedbackChanged;
|
||||||
_valvePosolytVM.OpenButton.ReleaseChanged += OnValvePosolytOpenReleaseChanged;
|
_valvePosolytVM.OpenButton.ReleaseChanged += OnValvePosolytOpenReleaseChanged;
|
||||||
_valvePosolytVM.CloseButton.ReleaseChanged += OnValvePosolytCloseReleaseChanged;
|
_valvePosolytVM.CloseButton.ReleaseChanged += OnValvePosolytCloseReleaseChanged;
|
||||||
_pumpPosolytVM = new AnalogMotorControlVM(_adsManager, _variableName + ".stNS11");
|
_pumpPosolytVM = new AnalogMotorControlVM(_adsManager, _variableName + ".stNS11");
|
||||||
_pumpPosolytVM.StartButton.FeedbackChanged += OnPumpPosolytStartFeedbackChanged;
|
_pumpPosolytVM.StartButton.FeedbackChanged += OnPumpPosolytStartFeedbackChanged;
|
||||||
_pumpPosolytVM.StopButton.FeedbackChanged += OnPumpPosolytStopFeedbackChanged;
|
_pumpPosolytVM.StopButton.FeedbackChanged += OnPumpPosolytStopFeedbackChanged;
|
||||||
_pumpPosolytVM.StartButton.ReleaseChanged += OnPumpPosolytStartReleaseChanged;
|
_pumpPosolytVM.StartButton.ReleaseChanged += OnPumpPosolytStartReleaseChanged;
|
||||||
_pumpPosolytVM.StopButton.ReleaseChanged += OnPumpPosolytStopReleaseChanged;
|
_pumpPosolytVM.StopButton.ReleaseChanged += OnPumpPosolytStopReleaseChanged;
|
||||||
|
|
||||||
|
|
||||||
// Current status
|
// Current status
|
||||||
_adsManager.Register(_variableName + ".eStatus", StatusChanged);
|
_adsManager.Register(_variableName + ".eStatus", StatusChanged);
|
||||||
_adsManager.Register(_variableName + ".rVoltage", VoltageChanged);
|
_adsManager.Register(_variableName + ".rVoltage", VoltageChanged);
|
||||||
|
|
||||||
|
|
||||||
// Configured pump speed for on
|
// Configured pump speed for on
|
||||||
_adsManager.Register("GVL_CONFIG.rPumpNegolytOnPower", NegolytPumpOnSpeedChanged);
|
_adsManager.Register("GVL_CONFIG.rPumpNegolytOnPower", NegolytPumpOnSpeedChanged);
|
||||||
_adsManager.Register("GVL_CONFIG.rPumpPosolytOnPower", PosolytPumpOnSpeedChanged);
|
_adsManager.Register("GVL_CONFIG.rPumpPosolytOnPower", PosolytPumpOnSpeedChanged);
|
||||||
|
|
||||||
valveWindowHorizontalPosition = 10;
|
valveWindowHorizontalPosition = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void NegolytPumpOnSpeedChanged(object? sender, ValueChangedEventArgs e)
|
private void NegolytPumpOnSpeedChanged(object? sender, ValueChangedEventArgs e)
|
||||||
{
|
{
|
||||||
_negolytPumpOnSpeed = (float)e.Value;
|
_negolytPumpOnSpeed = (float)e.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PosolytPumpOnSpeedChanged(object? sender, ValueChangedEventArgs e)
|
private void PosolytPumpOnSpeedChanged(object? sender, ValueChangedEventArgs e)
|
||||||
{
|
{
|
||||||
_posolytPumpOnSpeed = (float)e.Value;
|
_posolytPumpOnSpeed = (float)e.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void VoltageChanged(object? sender, ValueChangedEventArgs e)
|
private void VoltageChanged(object? sender, ValueChangedEventArgs e)
|
||||||
{
|
{
|
||||||
RVoltage = (float)e.Value;
|
RVoltage = (float)e.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
// Dispose all necessary view models
|
// Dispose all necessary view models
|
||||||
// Negolyt
|
// Negolyt
|
||||||
PressureNegolytSegmentInVM.Dispose();
|
PressureNegolytSegmentInVM.Dispose();
|
||||||
PressureNegolytTankInVM.Dispose();
|
PressureNegolytTankInVM.Dispose();
|
||||||
TemperatureNegolytTankInVM.Dispose();
|
TemperatureNegolytTankInVM.Dispose();
|
||||||
_valveNegolytVM.OpenButton.FeedbackChanged -= OnValveNegolytOpenFeedbackChanged;
|
_valveNegolytVM.OpenButton.FeedbackChanged -= OnValveNegolytOpenFeedbackChanged;
|
||||||
_valveNegolytVM.CloseButton.FeedbackChanged -= OnValveNegolytCloseFeedbackChanged;
|
_valveNegolytVM.CloseButton.FeedbackChanged -= OnValveNegolytCloseFeedbackChanged;
|
||||||
_valveNegolytVM.OpenButton.ReleaseChanged -= OnValveNegolytOpenReleaseChanged;
|
_valveNegolytVM.OpenButton.ReleaseChanged -= OnValveNegolytOpenReleaseChanged;
|
||||||
_valveNegolytVM.CloseButton.ReleaseChanged -= OnValveNegolytCloseReleaseChanged;
|
_valveNegolytVM.CloseButton.ReleaseChanged -= OnValveNegolytCloseReleaseChanged;
|
||||||
_valveNegolytVM.Dispose();
|
_valveNegolytVM.Dispose();
|
||||||
_pumpNegolytVM.Dispose();
|
_pumpNegolytVM.Dispose();
|
||||||
|
|
||||||
// Posolyt
|
// Posolyt
|
||||||
PressurePosolytSegmentInVM.Dispose();
|
PressurePosolytSegmentInVM.Dispose();
|
||||||
PressurePosolytTankInVM.Dispose();
|
PressurePosolytTankInVM.Dispose();
|
||||||
TemperaturePosolytTankInVM.Dispose();
|
TemperaturePosolytTankInVM.Dispose();
|
||||||
_valvePosolytVM.OpenButton.FeedbackChanged -= OnValvePosolytOpenFeedbackChanged;
|
_valvePosolytVM.OpenButton.FeedbackChanged -= OnValvePosolytOpenFeedbackChanged;
|
||||||
_valvePosolytVM.CloseButton.FeedbackChanged -= OnValvePosolytCloseFeedbackChanged;
|
_valvePosolytVM.CloseButton.FeedbackChanged -= OnValvePosolytCloseFeedbackChanged;
|
||||||
_valvePosolytVM.OpenButton.ReleaseChanged -= OnValvePosolytOpenReleaseChanged;
|
_valvePosolytVM.OpenButton.ReleaseChanged -= OnValvePosolytOpenReleaseChanged;
|
||||||
_valvePosolytVM.CloseButton.ReleaseChanged -= OnValvePosolytCloseReleaseChanged;
|
_valvePosolytVM.CloseButton.ReleaseChanged -= OnValvePosolytCloseReleaseChanged;
|
||||||
_valvePosolytVM.Dispose();
|
_valvePosolytVM.Dispose();
|
||||||
_pumpPosolytVM.Dispose();
|
_pumpPosolytVM.Dispose();
|
||||||
|
|
||||||
// Deregister variables
|
// Deregister variables
|
||||||
_adsManager?.Deregister(_variableName + ".eStatus", StatusChanged);
|
_adsManager?.Deregister(_variableName + ".eStatus", StatusChanged);
|
||||||
_adsManager?.Deregister(_variableName + ".rVoltage", VoltageChanged);
|
_adsManager?.Deregister(_variableName + ".rVoltage", VoltageChanged);
|
||||||
_adsManager?.Deregister("GVL_CONFIG.rPumpNegolytOnPower", NegolytPumpOnSpeedChanged);
|
_adsManager?.Deregister("GVL_CONFIG.rPumpNegolytOnPower", NegolytPumpOnSpeedChanged);
|
||||||
_adsManager?.Deregister("GVL_CONFIG.rPumpPosolytOnPower", PosolytPumpOnSpeedChanged);
|
_adsManager?.Deregister("GVL_CONFIG.rPumpPosolytOnPower", PosolytPumpOnSpeedChanged);
|
||||||
|
|
||||||
// Destroy windows
|
// Destroy windows
|
||||||
_windowValveNegolyt?.Close();
|
_windowValveNegolyt?.Close();
|
||||||
_windowValvePosolyt?.Close();
|
_windowValvePosolyt?.Close();
|
||||||
_windowPumpNegolyt?.Close();
|
_windowPumpNegolyt?.Close();
|
||||||
_windowPumpPosolyt?.Close();
|
_windowPumpPosolyt?.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void StatusChanged(object? sender, ValueChangedEventArgs e)
|
private void StatusChanged(object? sender, ValueChangedEventArgs e)
|
||||||
{
|
{
|
||||||
Status = (E_COMPONENT_STATUS)((short)e.Value);
|
Status = (E_COMPONENT_STATUS)((short)e.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
[RelayCommand]
|
[RelayCommand]
|
||||||
private void ShowValveNegolyt()
|
private void ShowValveNegolyt()
|
||||||
{
|
{
|
||||||
if (_adsManager != null && _windowValveNegolyt == null)
|
if (_adsManager != null && _windowValveNegolyt == null)
|
||||||
{
|
{
|
||||||
_windowValveNegolyt = new() { DataContext = _valveNegolytVM };
|
_windowValveNegolyt = new() { DataContext = _valveNegolytVM };
|
||||||
_windowValveNegolyt.Closed += WindowValveNegolyt_Closed;
|
_windowValveNegolyt.Closed += WindowValveNegolyt_Closed;
|
||||||
_windowValveNegolyt.Show();
|
_windowValveNegolyt.Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void WindowValveNegolyt_Closed(object? sender, EventArgs e)
|
private void WindowValveNegolyt_Closed(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
_windowValveNegolyt!.Close();
|
_windowValveNegolyt!.Close();
|
||||||
_windowValveNegolyt = null;
|
_windowValveNegolyt = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
[RelayCommand]
|
[RelayCommand]
|
||||||
private void ShowValvePosolyt()
|
private void ShowValvePosolyt()
|
||||||
{
|
{
|
||||||
if (_adsManager != null && _windowValvePosolyt == null)
|
if (_adsManager != null && _windowValvePosolyt == null)
|
||||||
{
|
{
|
||||||
_windowValvePosolyt = new() { DataContext = _valvePosolytVM };
|
_windowValvePosolyt = new() { DataContext = _valvePosolytVM };
|
||||||
_windowValvePosolyt.Closed += WindowValvePosolyt_Closed;
|
_windowValvePosolyt.Closed += WindowValvePosolyt_Closed;
|
||||||
_windowValvePosolyt.Show();
|
_windowValvePosolyt.Show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void WindowValvePosolyt_Closed(object? sender, EventArgs e)
|
private void WindowValvePosolyt_Closed(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
_windowValvePosolyt!.Close();
|
_windowValvePosolyt!.Close();
|
||||||
_windowValvePosolyt = null;
|
_windowValvePosolyt = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[RelayCommand]
|
[RelayCommand]
|
||||||
public void ShowPumpNegolyt()
|
public void ShowPumpNegolyt()
|
||||||
{
|
{
|
||||||
if (_adsManager != null && _windowPumpNegolyt == null)
|
if (_adsManager != null && _windowPumpNegolyt == null)
|
||||||
{
|
{
|
||||||
_windowPumpNegolyt = new() { DataContext = _pumpNegolytVM };
|
_windowPumpNegolyt = new() { DataContext = _pumpNegolytVM };
|
||||||
_windowPumpNegolyt.Closed += WindowPumpNegolyt_Closed;
|
_windowPumpNegolyt.Closed += WindowPumpNegolyt_Closed;
|
||||||
_windowPumpNegolyt.Show();
|
_windowPumpNegolyt.Show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void WindowPumpNegolyt_Closed(object? sender, EventArgs e)
|
private void WindowPumpNegolyt_Closed(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
_windowPumpNegolyt!.Close();
|
_windowPumpNegolyt!.Close();
|
||||||
_windowPumpNegolyt = null;
|
_windowPumpNegolyt = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
[RelayCommand]
|
[RelayCommand]
|
||||||
public void ShowPumpPosolyt()
|
public void ShowPumpPosolyt()
|
||||||
{
|
{
|
||||||
if (_adsManager != null && _windowPumpPosolyt == null)
|
if (_adsManager != null && _windowPumpPosolyt == null)
|
||||||
{
|
{
|
||||||
_windowPumpPosolyt = new() { DataContext = _pumpPosolytVM };
|
_windowPumpPosolyt = new() { DataContext = _pumpPosolytVM };
|
||||||
_windowPumpPosolyt.Closed += WindowPumpPosolyt_Closed;
|
_windowPumpPosolyt.Closed += WindowPumpPosolyt_Closed;
|
||||||
_windowPumpPosolyt.Show();
|
_windowPumpPosolyt.Show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[RelayCommand]
|
[RelayCommand]
|
||||||
private void OpenBothValves()
|
private void OpenBothValves()
|
||||||
{
|
{
|
||||||
_valveNegolytVM.OpenButton?.ButtonClickedCommand.Execute(null);
|
_valveNegolytVM.OpenButton?.ButtonClickedCommand.Execute(null);
|
||||||
_valvePosolytVM.OpenButton?.ButtonClickedCommand.Execute(null);
|
_valvePosolytVM.OpenButton?.ButtonClickedCommand.Execute(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
[RelayCommand]
|
[RelayCommand]
|
||||||
private void CloseBothValves()
|
private void CloseBothValves()
|
||||||
{
|
{
|
||||||
_valveNegolytVM.CloseButton?.ButtonClickedCommand.Execute(null);
|
_valveNegolytVM.CloseButton?.ButtonClickedCommand.Execute(null);
|
||||||
_valvePosolytVM.CloseButton?.ButtonClickedCommand.Execute(null);
|
_valvePosolytVM.CloseButton?.ButtonClickedCommand.Execute(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnValveNegolytOpenFeedbackChanged(object? sender, EventArgs e)
|
private void OnValveNegolytOpenFeedbackChanged(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
CalculateOpenFeedback();
|
CalculateOpenFeedback();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnValvePosolytOpenFeedbackChanged(object? sender, EventArgs e)
|
private void OnValvePosolytOpenFeedbackChanged(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
CalculateOpenFeedback();
|
CalculateOpenFeedback();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CalculateOpenFeedback()
|
private void CalculateOpenFeedback()
|
||||||
{
|
{
|
||||||
if (_valveNegolytVM?.OpenButton.IFeedback == 1 && _valvePosolytVM?.OpenButton.IFeedback == 1)
|
if (_valveNegolytVM?.OpenButton.IFeedback == 1 && _valvePosolytVM?.OpenButton.IFeedback == 1)
|
||||||
FeedbackOpenValves = 1;
|
FeedbackOpenValves = 1;
|
||||||
else if (_valveNegolytVM?.OpenButton.IFeedback == 0 && _valvePosolytVM?.OpenButton.IFeedback == 0)
|
else if (_valveNegolytVM?.OpenButton.IFeedback == 0 && _valvePosolytVM?.OpenButton.IFeedback == 0)
|
||||||
FeedbackOpenValves = 0;
|
FeedbackOpenValves = 0;
|
||||||
else
|
else
|
||||||
FeedbackOpenValves = 2;
|
FeedbackOpenValves = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnValveNegolytCloseFeedbackChanged(object? sender, EventArgs e)
|
private void OnValveNegolytCloseFeedbackChanged(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
CalculateCloseFeedback();
|
CalculateCloseFeedback();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnValvePosolytCloseFeedbackChanged(object? sender, EventArgs e)
|
private void OnValvePosolytCloseFeedbackChanged(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
CalculateCloseFeedback();
|
CalculateCloseFeedback();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CalculateCloseFeedback()
|
private void CalculateCloseFeedback()
|
||||||
{
|
{
|
||||||
if (_valveNegolytVM?.CloseButton.IFeedback == 1 && _valvePosolytVM?.CloseButton.IFeedback == 1)
|
if (_valveNegolytVM?.CloseButton.IFeedback == 1 && _valvePosolytVM?.CloseButton.IFeedback == 1)
|
||||||
FeedbackCloseValves = 1;
|
FeedbackCloseValves = 1;
|
||||||
else if (_valveNegolytVM?.CloseButton.IFeedback == 0 && _valvePosolytVM?.CloseButton.IFeedback == 0)
|
else if (_valveNegolytVM?.CloseButton.IFeedback == 0 && _valvePosolytVM?.CloseButton.IFeedback == 0)
|
||||||
FeedbackCloseValves = 0;
|
FeedbackCloseValves = 0;
|
||||||
else
|
else
|
||||||
FeedbackCloseValves = 2;
|
FeedbackCloseValves = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnValveNegolytOpenReleaseChanged(object? sender, EventArgs e)
|
private void OnValveNegolytOpenReleaseChanged(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
CalculateOpenRelease();
|
CalculateOpenRelease();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnValvePosolytOpenReleaseChanged(object? sender, EventArgs e)
|
private void OnValvePosolytOpenReleaseChanged(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
CalculateOpenRelease();
|
CalculateOpenRelease();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CalculateOpenRelease()
|
private void CalculateOpenRelease()
|
||||||
{
|
{
|
||||||
if (_valvePosolytVM == null || _valveNegolytVM == null)
|
if (_valvePosolytVM == null || _valveNegolytVM == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (_valveNegolytVM.OpenButton.XRelease && _valvePosolytVM.OpenButton.XRelease)
|
if (_valveNegolytVM.OpenButton.XRelease && _valvePosolytVM.OpenButton.XRelease)
|
||||||
CanOpenBothValves = true;
|
CanOpenBothValves = true;
|
||||||
else
|
else
|
||||||
CanOpenBothValves = false;
|
CanOpenBothValves = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnValveNegolytCloseReleaseChanged(object? sender, EventArgs e)
|
private void OnValveNegolytCloseReleaseChanged(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
CalculateCloseRelease();
|
CalculateCloseRelease();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnValvePosolytCloseReleaseChanged(object? sender, EventArgs e)
|
private void OnValvePosolytCloseReleaseChanged(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
CalculateCloseRelease();
|
CalculateCloseRelease();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CalculateCloseRelease()
|
private void CalculateCloseRelease()
|
||||||
{
|
{
|
||||||
if (_valvePosolytVM == null || _valveNegolytVM == null)
|
if (_valvePosolytVM == null || _valveNegolytVM == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (_valveNegolytVM.CloseButton.XRelease && _valvePosolytVM.CloseButton.XRelease)
|
if (_valveNegolytVM.CloseButton.XRelease && _valvePosolytVM.CloseButton.XRelease)
|
||||||
CanCloseBothValves = true;
|
CanCloseBothValves = true;
|
||||||
else
|
else
|
||||||
CanCloseBothValves = false;
|
CanCloseBothValves = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
[RelayCommand]
|
[RelayCommand]
|
||||||
private void StartBothPumps()
|
private void StartBothPumps()
|
||||||
{
|
{
|
||||||
if (_adsManager == null || _pumpNegolytVM == null || _pumpPosolytVM == null)
|
if (_adsManager == null || _pumpNegolytVM == null || _pumpPosolytVM == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_pumpNegolytVM.Setpoint.RValue = _negolytPumpOnSpeed;
|
_pumpNegolytVM.Setpoint.RValue = _negolytPumpOnSpeed;
|
||||||
_pumpPosolytVM.Setpoint.RValue = _posolytPumpOnSpeed;
|
_pumpPosolytVM.Setpoint.RValue = _posolytPumpOnSpeed;
|
||||||
|
|
||||||
_pumpNegolytVM.StartButton?.ButtonClickedCommand.Execute(null);
|
_pumpNegolytVM.StartButton?.ButtonClickedCommand.Execute(null);
|
||||||
_pumpPosolytVM.StartButton?.ButtonClickedCommand.Execute(null);
|
_pumpPosolytVM.StartButton?.ButtonClickedCommand.Execute(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
[RelayCommand]
|
[RelayCommand]
|
||||||
private void StopBothPumps()
|
private void StopBothPumps()
|
||||||
{
|
{
|
||||||
_pumpNegolytVM.StopButton?.ButtonClickedCommand.Execute(null);
|
_pumpNegolytVM.StopButton?.ButtonClickedCommand.Execute(null);
|
||||||
_pumpPosolytVM.StopButton?.ButtonClickedCommand.Execute(null);
|
_pumpPosolytVM.StopButton?.ButtonClickedCommand.Execute(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CalculateStartRelease()
|
private void CalculateStartRelease()
|
||||||
{
|
{
|
||||||
if (_pumpNegolytVM == null || _pumpPosolytVM == null)
|
if (_pumpNegolytVM == null || _pumpPosolytVM == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (_pumpNegolytVM.StartButton.XRelease && _pumpPosolytVM.StartButton.XRelease)
|
if (_pumpNegolytVM.StartButton.XRelease && _pumpPosolytVM.StartButton.XRelease)
|
||||||
CanStartBothPumps = true;
|
CanStartBothPumps = true;
|
||||||
else
|
else
|
||||||
CanStartBothPumps = false;
|
CanStartBothPumps = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CalculatStopRelease()
|
private void CalculatStopRelease()
|
||||||
{
|
{
|
||||||
if (_pumpNegolytVM == null || _pumpPosolytVM == null)
|
if (_pumpNegolytVM == null || _pumpPosolytVM == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (_pumpNegolytVM.StopButton.XRelease && _pumpPosolytVM.StopButton.XRelease)
|
if (_pumpNegolytVM.StopButton.XRelease && _pumpPosolytVM.StopButton.XRelease)
|
||||||
CanStopBothPumps = true;
|
CanStopBothPumps = true;
|
||||||
else
|
else
|
||||||
CanStopBothPumps = false;
|
CanStopBothPumps = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CalculateStartFeedback()
|
private void CalculateStartFeedback()
|
||||||
{
|
{
|
||||||
if (_pumpNegolytVM == null || _pumpPosolytVM == null)
|
if (_pumpNegolytVM == null || _pumpPosolytVM == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (_pumpNegolytVM.StartButton.IFeedback == 1 && _pumpPosolytVM.StartButton.IFeedback == 1)
|
if (_pumpNegolytVM.StartButton.IFeedback == 1 && _pumpPosolytVM.StartButton.IFeedback == 1)
|
||||||
FeedbackStartPumps = 1;
|
FeedbackStartPumps = 1;
|
||||||
else if (_pumpNegolytVM.StartButton.IFeedback == 0 && _pumpPosolytVM.StartButton.IFeedback == 0)
|
else if (_pumpNegolytVM.StartButton.IFeedback == 0 && _pumpPosolytVM.StartButton.IFeedback == 0)
|
||||||
FeedbackStartPumps = 0;
|
FeedbackStartPumps = 0;
|
||||||
else
|
else
|
||||||
FeedbackStartPumps = 2;
|
FeedbackStartPumps = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CalculateStopFeedback()
|
private void CalculateStopFeedback()
|
||||||
{
|
{
|
||||||
if (_pumpNegolytVM == null || _pumpPosolytVM == null)
|
if (_pumpNegolytVM == null || _pumpPosolytVM == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (_pumpNegolytVM.StopButton.IFeedback == 1 && _pumpPosolytVM.StopButton.IFeedback == 1)
|
if (_pumpNegolytVM.StopButton.IFeedback == 1 && _pumpPosolytVM.StopButton.IFeedback == 1)
|
||||||
FeedbackStopPumps = 1;
|
FeedbackStopPumps = 1;
|
||||||
else if (_pumpNegolytVM.StopButton.IFeedback == 0 && _pumpPosolytVM.StopButton.IFeedback == 0)
|
else if (_pumpNegolytVM.StopButton.IFeedback == 0 && _pumpPosolytVM.StopButton.IFeedback == 0)
|
||||||
FeedbackStopPumps = 0;
|
FeedbackStopPumps = 0;
|
||||||
else
|
else
|
||||||
FeedbackStopPumps = 2;
|
FeedbackStopPumps = 2;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnPumpPosolytStopReleaseChanged(object? sender, EventArgs e)
|
private void OnPumpPosolytStopReleaseChanged(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
CalculatStopRelease();
|
CalculatStopRelease();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnPumpPosolytStartReleaseChanged(object? sender, EventArgs e)
|
private void OnPumpPosolytStartReleaseChanged(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
CalculateStartRelease();
|
CalculateStartRelease();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnPumpPosolytStopFeedbackChanged(object? sender, EventArgs e)
|
private void OnPumpPosolytStopFeedbackChanged(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
CalculateStopFeedback();
|
CalculateStopFeedback();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnPumpPosolytStartFeedbackChanged(object? sender, EventArgs e)
|
private void OnPumpPosolytStartFeedbackChanged(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
CalculateStartFeedback();
|
CalculateStartFeedback();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnPumpNegolytStopReleaseChanged(object? sender, EventArgs e)
|
private void OnPumpNegolytStopReleaseChanged(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
CalculatStopRelease();
|
CalculatStopRelease();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnPumpNegolytStartReleaseChanged(object? sender, EventArgs e)
|
private void OnPumpNegolytStartReleaseChanged(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
CalculateStartRelease();
|
CalculateStartRelease();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnPumpNegolytStopFeedbackChanged(object? sender, EventArgs e)
|
private void OnPumpNegolytStopFeedbackChanged(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
CalculateStopFeedback();
|
CalculateStopFeedback();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnPumpNegolytStartFeedbackChanged(object? sender, EventArgs e)
|
private void OnPumpNegolytStartFeedbackChanged(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
CalculateStartFeedback();
|
CalculateStartFeedback();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void WindowPumpPosolyt_Closed(object? sender, EventArgs e)
|
private void WindowPumpPosolyt_Closed(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
_windowPumpPosolyt!.Close();
|
_windowPumpPosolyt!.Close();
|
||||||
_windowPumpPosolyt = null;
|
_windowPumpPosolyt = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
<Button x:Class="UniperHMI.SMUControlButton"
|
<Button x:Class="InfineonHMI.SMUControlButton"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:local="clr-namespace:UniperHMI"
|
xmlns:local="clr-namespace:InfineonHMI"
|
||||||
d:DataContext="{d:DesignInstance Type=local:StringControlButtonVM, IsDesignTimeCreatable=True}"
|
d:DataContext="{d:DesignInstance Type=local:StringControlButtonVM, IsDesignTimeCreatable=True}"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Style="{StaticResource MahApps.Styles.Button}"
|
Style="{StaticResource MahApps.Styles.Button}"
|
||||||
|
|||||||
@@ -1,23 +1,22 @@
|
|||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
|
||||||
namespace UniperHMI
|
namespace InfineonHMI;
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Interaktionslogik für StringControlButton.xaml
|
|
||||||
/// </summary>
|
|
||||||
public partial class SMUControlButton : Button
|
|
||||||
{
|
|
||||||
public static readonly DependencyProperty SMUNameProperty = DependencyProperty.Register("SMUName", typeof(string), typeof(SMUControlButton));
|
|
||||||
public String SMUName
|
|
||||||
{
|
|
||||||
get { return (string)GetValue(SMUNameProperty); }
|
|
||||||
set { SetValue(SMUNameProperty, value); }
|
|
||||||
}
|
|
||||||
|
|
||||||
public SMUControlButton()
|
/// <summary>
|
||||||
{
|
/// Interaktionslogik für StringControlButton.xaml
|
||||||
InitializeComponent();
|
/// </summary>
|
||||||
}
|
public partial class SMUControlButton : Button
|
||||||
}
|
{
|
||||||
}
|
public static readonly DependencyProperty SMUNameProperty = DependencyProperty.Register("SMUName", typeof(string), typeof(SMUControlButton));
|
||||||
|
public String SMUName
|
||||||
|
{
|
||||||
|
get { return (string)GetValue(SMUNameProperty); }
|
||||||
|
set { SetValue(SMUNameProperty, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public SMUControlButton()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
<UserControl xmlns:HMIToolkit="clr-namespace:HMIToolkit" x:Class="UniperHMI.UnitDetailsControl"
|
<UserControl xmlns:HMIToolkit="clr-namespace:HMIToolkit" x:Class="InfineonHMI.UnitDetailsControl"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:local="clr-namespace:UniperHMI"
|
xmlns:local="clr-namespace:InfineonHMI"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DataContext="{d:DesignInstance Type=local:UnitDetailsControlVM, IsDesignTimeCreatable=True}"
|
d:DataContext="{d:DesignInstance Type=local:UnitDetailsControlVM, IsDesignTimeCreatable=True}"
|
||||||
HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" Width="Auto" Height="Auto"
|
HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" Width="Auto" Height="Auto"
|
||||||
|
|||||||
@@ -1,22 +1,21 @@
|
|||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
|
||||||
namespace UniperHMI
|
namespace InfineonHMI;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Interaktionslogik für UnitControl.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class UnitDetailsControl : UserControl
|
||||||
{
|
{
|
||||||
/// <summary>
|
public static readonly DependencyProperty UnitNameProperty = DependencyProperty.Register("UnitName", typeof(string), typeof(UnitDetailsControl));
|
||||||
/// Interaktionslogik für UnitControl.xaml
|
public String UnitName
|
||||||
/// </summary>
|
{
|
||||||
public partial class UnitDetailsControl : UserControl
|
get { return (string)GetValue(UnitNameProperty); }
|
||||||
{
|
set { SetValue(UnitNameProperty, value); }
|
||||||
public static readonly DependencyProperty UnitNameProperty = DependencyProperty.Register("UnitName", typeof(string), typeof(UnitDetailsControl));
|
}
|
||||||
public String UnitName
|
public UnitDetailsControl()
|
||||||
{
|
{
|
||||||
get { return (string)GetValue(UnitNameProperty); }
|
InitializeComponent();
|
||||||
set { SetValue(UnitNameProperty, value); }
|
}
|
||||||
}
|
}
|
||||||
public UnitDetailsControl()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using HMIToolkit;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using Heisig.HMI.AdsManager;
|
||||||
|
using CommunityToolkit.Mvvm.Input;
|
||||||
|
using TwinCAT.TypeSystem;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using Common;
|
||||||
|
using InfineonHMI.Model;
|
||||||
|
namespace InfineonHMI;
|
||||||
|
|
||||||
|
public sealed partial class AlignmentStationPageVM : ObservableValidator, IDisposable
|
||||||
|
{
|
||||||
|
private readonly string? _variableName;
|
||||||
|
|
||||||
|
private readonly IAdsManager? _adsManager;
|
||||||
|
|
||||||
|
[ObservableProperty] private PackMLControlVM? alignmentPackMLControlVm;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private BinaryValveControlVM vacuumValveControlVm;
|
||||||
|
|
||||||
|
public AlignmentStationPageVM()
|
||||||
|
{
|
||||||
|
VacuumValveControlVm = new BinaryValveControlVM();
|
||||||
|
AlignmentPackMLControlVm = new();
|
||||||
|
AlignmentPackMLControlVm.STitle = "Ausrichtstation";
|
||||||
|
}
|
||||||
|
|
||||||
|
public AlignmentStationPageVM(IAdsManager adsManager, string variableName)
|
||||||
|
{
|
||||||
|
_adsManager = adsManager;
|
||||||
|
_variableName = variableName;
|
||||||
|
|
||||||
|
VacuumValveControlVm = new BinaryValveControlVM(_adsManager, _variableName + ".stVacuumValve");
|
||||||
|
AlignmentPackMLControlVm = new(_adsManager, _variableName + ".stStationCmds");
|
||||||
|
AlignmentPackMLControlVm.STitle = "Ausrichtstation";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,151 +0,0 @@
|
|||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
|
||||||
using HMIToolkit;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
using Heisig.HMI.AdsManager;
|
|
||||||
using CommunityToolkit.Mvvm.Input;
|
|
||||||
using TwinCAT.TypeSystem;
|
|
||||||
using System.Collections.ObjectModel;
|
|
||||||
|
|
||||||
namespace UniperHMI
|
|
||||||
{
|
|
||||||
|
|
||||||
public enum E_BMS_CONTROL_MODE : short
|
|
||||||
{
|
|
||||||
AUTO_REMOTE = 1,
|
|
||||||
AUTO_LOCAL = 2,
|
|
||||||
SAFETY_CHECK = 3,
|
|
||||||
CAPACITY_TEST = 4,
|
|
||||||
MANUAL = 5
|
|
||||||
}
|
|
||||||
|
|
||||||
public class BMSControlModeEntry(E_BMS_CONTROL_MODE mode, string name)
|
|
||||||
{
|
|
||||||
public E_BMS_CONTROL_MODE eMode = mode;
|
|
||||||
public string Name = name;
|
|
||||||
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
return Name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public sealed partial class AutomaticModePageVM : ObservableValidator, IDisposable
|
|
||||||
{
|
|
||||||
private int _setpoint;
|
|
||||||
|
|
||||||
[Range(-40000, 40000)]
|
|
||||||
public int Setpoint
|
|
||||||
{
|
|
||||||
get => this._setpoint;
|
|
||||||
set => SetProperty(ref this._setpoint, value, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
[ObservableProperty]
|
|
||||||
private int processValue;
|
|
||||||
|
|
||||||
[ObservableProperty]
|
|
||||||
public HMIControlButtonVM? startButton;
|
|
||||||
|
|
||||||
[ObservableProperty]
|
|
||||||
public HMIControlButtonVM? stopButton;
|
|
||||||
|
|
||||||
[ObservableProperty]
|
|
||||||
private E_BMS_CONTROL_MODE bmsControlMode;
|
|
||||||
|
|
||||||
[ObservableProperty]
|
|
||||||
public ObservableCollection<BMSControlModeEntry> reqBMSControlModes =
|
|
||||||
[
|
|
||||||
new BMSControlModeEntry(E_BMS_CONTROL_MODE.AUTO_REMOTE, "Auto Remote"),
|
|
||||||
new BMSControlModeEntry(E_BMS_CONTROL_MODE.AUTO_LOCAL, "Auto Local"),
|
|
||||||
new BMSControlModeEntry(E_BMS_CONTROL_MODE.SAFETY_CHECK, "Safety Check"),
|
|
||||||
new BMSControlModeEntry(E_BMS_CONTROL_MODE.CAPACITY_TEST, "Capacity Test"),
|
|
||||||
new BMSControlModeEntry(E_BMS_CONTROL_MODE.MANUAL, "Manual")
|
|
||||||
];
|
|
||||||
|
|
||||||
[ObservableProperty]
|
|
||||||
private BMSControlModeEntry selectedControlMode;
|
|
||||||
|
|
||||||
[ObservableProperty]
|
|
||||||
private bool canChangeControlMode;
|
|
||||||
|
|
||||||
private readonly string? _variableName;
|
|
||||||
|
|
||||||
private readonly IAdsManager? _adsManager;
|
|
||||||
|
|
||||||
public AutomaticModePageVM()
|
|
||||||
{
|
|
||||||
StartButton = new HMIControlButtonVM();
|
|
||||||
StopButton = new HMIControlButtonVM();
|
|
||||||
SelectedControlMode = ReqBMSControlModes[1];
|
|
||||||
canChangeControlMode = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public AutomaticModePageVM(IAdsManager adsManager, string variableName)
|
|
||||||
{
|
|
||||||
_adsManager = adsManager;
|
|
||||||
_variableName = variableName;
|
|
||||||
|
|
||||||
//StartButton = new HMIControlButtonVM(_adsManager, _variableName + ".stStartAutoButton");
|
|
||||||
//StopButton = new HMIControlButtonVM(_adsManager, _variableName + ".stStopAutoButton");
|
|
||||||
|
|
||||||
SelectedControlMode = ReqBMSControlModes[1];
|
|
||||||
|
|
||||||
_adsManager.Register("GVL_SCADA.eCurrentControlMode", CurrentControlModeChanged);
|
|
||||||
_adsManager.Register("GVL_SCADA.xCanChangeControlMode", CCCMChanged);
|
|
||||||
|
|
||||||
_adsManager.Register(_variableName + ".diSetpointAutomatic", SetpointChanged);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SetpointChanged(object? sender, ValueChangedEventArgs e)
|
|
||||||
{
|
|
||||||
Setpoint = (int)e.Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void CCCMChanged(object? sender, ValueChangedEventArgs e)
|
|
||||||
{
|
|
||||||
CanChangeControlMode = (bool)e.Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void CurrentControlModeChanged(object? sender, ValueChangedEventArgs e)
|
|
||||||
{
|
|
||||||
BmsControlMode = (E_BMS_CONTROL_MODE)e.Value;
|
|
||||||
SelectedControlMode.eMode = BmsControlMode;
|
|
||||||
SelectedControlMode.Name = "Test";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
StartButton?.Dispose();
|
|
||||||
StartButton = null;
|
|
||||||
StopButton?.Dispose();
|
|
||||||
StopButton = null;
|
|
||||||
|
|
||||||
_adsManager?.Deregister("GVL_SCADA.eCurrentControlMode", CurrentControlModeChanged);
|
|
||||||
_adsManager?.Deregister("GVL_SCADA.xCanChangeControlMode", CCCMChanged);
|
|
||||||
|
|
||||||
_adsManager?.Deregister(_variableName + ".diSetpointAutomatic", SetpointChanged);
|
|
||||||
}
|
|
||||||
|
|
||||||
[RelayCommand]
|
|
||||||
private void StartAutomatic()
|
|
||||||
{
|
|
||||||
_adsManager?.WriteValue(_variableName + ".diSetpointAutomatic", Setpoint);
|
|
||||||
}
|
|
||||||
|
|
||||||
[RelayCommand]
|
|
||||||
private void StopAutomatic()
|
|
||||||
{
|
|
||||||
_adsManager?.WriteValue(_variableName + ".diSetpointAutomatic", 0);
|
|
||||||
Setpoint = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ValidationResult ValidatePower(int power, ValidationContext context)
|
|
||||||
{
|
|
||||||
if (power < -40000 || power > 40000)
|
|
||||||
return new("Must be between -40.000 and +40.000");
|
|
||||||
else
|
|
||||||
return ValidationResult.Success!;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
|
||||||
using CommunityToolkit.Mvvm.Input;
|
|
||||||
using CommunityToolkit.Mvvm.Messaging;
|
|
||||||
using Heisig.HMI.AdsManager;
|
|
||||||
|
|
||||||
namespace UniperHMI
|
|
||||||
{
|
|
||||||
public sealed partial class BatteryOverviewPageVM : ObservableObject, IDisposable
|
|
||||||
{
|
|
||||||
[ObservableProperty]
|
|
||||||
private StringControlButtonVM? string1VM;
|
|
||||||
|
|
||||||
[ObservableProperty]
|
|
||||||
private StringControlButtonVM? string2VM;
|
|
||||||
|
|
||||||
[ObservableProperty]
|
|
||||||
private StringControlButtonVM? dummyStringVM;
|
|
||||||
|
|
||||||
private readonly IAdsManager? _adsManager;
|
|
||||||
|
|
||||||
public BatteryOverviewPageVM()
|
|
||||||
{
|
|
||||||
string1VM = new StringControlButtonVM();
|
|
||||||
string2VM = new StringControlButtonVM();
|
|
||||||
}
|
|
||||||
|
|
||||||
public BatteryOverviewPageVM(IAdsManager adsManager)
|
|
||||||
{
|
|
||||||
_adsManager = adsManager;
|
|
||||||
string1VM = new StringControlButtonVM(adsManager, "GVL_SCADA.stHMIInterface[0]");
|
|
||||||
string2VM = new StringControlButtonVM(adsManager, "GVL_SCADA.stHMIInterface[1]");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
String1VM?.Dispose();
|
|
||||||
String1VM = null;
|
|
||||||
|
|
||||||
String2VM?.Dispose();
|
|
||||||
String2VM = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
[RelayCommand]
|
|
||||||
private void String1Clicked()
|
|
||||||
{
|
|
||||||
WeakReferenceMessenger.Default.Send(new NavigateMessage("GVL_SCADA.stHMIInterface[0]", typeof(StringOverviewPage), "String 1"));
|
|
||||||
}
|
|
||||||
|
|
||||||
[RelayCommand]
|
|
||||||
private void String2Clicked()
|
|
||||||
{
|
|
||||||
WeakReferenceMessenger.Default.Send(new NavigateMessage("GVL_SCADA.stHMIInterface[1]", typeof(StringOverviewPage), "String 2"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,98 @@
|
|||||||
|
using Common;
|
||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using CommunityToolkit.Mvvm.Input;
|
||||||
|
using Heisig.HMI.AdsManager;
|
||||||
|
using HMIToolkit;
|
||||||
|
using InfineonHMI.Model;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using TwinCAT.TypeSystem;
|
||||||
|
namespace InfineonHMI;
|
||||||
|
|
||||||
|
public sealed partial class EtchingStation1PageVM : ObservableValidator, IDisposable
|
||||||
|
{
|
||||||
|
|
||||||
|
[ObservableProperty] private BinaryValveControlVM vacuumValveControlEtching1Vm;
|
||||||
|
|
||||||
|
[ObservableProperty] private BinaryValveControlVM doorValveControlEtching1Vm;
|
||||||
|
|
||||||
|
[ObservableProperty] private BinaryValveControlVM chuckUnlockValveLeftEtching1Vm;
|
||||||
|
|
||||||
|
[ObservableProperty] private BinaryValveControlVM chuckUnlockValveRightEtching1Vm;
|
||||||
|
|
||||||
|
[ObservableProperty] private BinaryValveControlVM chuckEjectValveFrontEtching1Vm;
|
||||||
|
|
||||||
|
[ObservableProperty] private BinaryValveControlVM chuckEjectValveBackEtching1Vm;
|
||||||
|
|
||||||
|
[ObservableProperty] private HMIControlButtonVM? chuckUnlockCmdButtonEtching1Vm;
|
||||||
|
|
||||||
|
[ObservableProperty] private HMIControlButtonVM? chuckLockCmdButtonEtching1Vm;
|
||||||
|
|
||||||
|
[ObservableProperty] private HMIControlButtonVM? chuckEjectCmdButtonEtching1Vm;
|
||||||
|
|
||||||
|
[ObservableProperty] private PackMLControlVM? etching1PackMLControlVm;
|
||||||
|
|
||||||
|
private readonly string? _variableName;
|
||||||
|
|
||||||
|
private readonly IAdsManager? _adsManager;
|
||||||
|
|
||||||
|
public EtchingStation1PageVM()
|
||||||
|
{
|
||||||
|
VacuumValveControlEtching1Vm = new BinaryValveControlVM();
|
||||||
|
DoorValveControlEtching1Vm = new BinaryValveControlVM();
|
||||||
|
ChuckUnlockValveLeftEtching1Vm = new BinaryValveControlVM();
|
||||||
|
ChuckUnlockValveRightEtching1Vm = new BinaryValveControlVM();
|
||||||
|
ChuckEjectValveFrontEtching1Vm = new BinaryValveControlVM();
|
||||||
|
ChuckEjectValveBackEtching1Vm = new BinaryValveControlVM();
|
||||||
|
|
||||||
|
ChuckUnlockCmdButtonEtching1Vm = new HMIControlButtonVM();
|
||||||
|
ChuckLockCmdButtonEtching1Vm = new HMIControlButtonVM();
|
||||||
|
ChuckEjectCmdButtonEtching1Vm = new HMIControlButtonVM();
|
||||||
|
|
||||||
|
Etching1PackMLControlVm = new();
|
||||||
|
Etching1PackMLControlVm.STitle = "Ätzer 1";
|
||||||
|
}
|
||||||
|
|
||||||
|
public EtchingStation1PageVM(IAdsManager adsManager, string variableName)
|
||||||
|
{
|
||||||
|
_adsManager = adsManager;
|
||||||
|
_variableName = variableName;
|
||||||
|
|
||||||
|
VacuumValveControlEtching1Vm = new BinaryValveControlVM(_adsManager, _variableName + ".stVacuumValve");
|
||||||
|
DoorValveControlEtching1Vm = new BinaryValveControlVM(_adsManager, _variableName + ".stDoorValve");
|
||||||
|
ChuckUnlockValveLeftEtching1Vm = new BinaryValveControlVM(_adsManager, _variableName + ".stChuckUnlockLeft");
|
||||||
|
ChuckUnlockValveRightEtching1Vm = new BinaryValveControlVM(_adsManager, _variableName + ".stChuckUnlockRight");
|
||||||
|
ChuckEjectValveFrontEtching1Vm = new BinaryValveControlVM(_adsManager, _variableName + ".stChuckEjectFront");
|
||||||
|
ChuckEjectValveBackEtching1Vm = new BinaryValveControlVM(_adsManager, _variableName + ".stChuckEjectBack");
|
||||||
|
|
||||||
|
ChuckUnlockCmdButtonEtching1Vm = new HMIControlButtonVM(_adsManager, _variableName + ".stChuckUnlockCmd");
|
||||||
|
ChuckLockCmdButtonEtching1Vm = new HMIControlButtonVM(_adsManager, _variableName + ".stChuckLockCmd");
|
||||||
|
ChuckEjectCmdButtonEtching1Vm = new HMIControlButtonVM(_adsManager, _variableName + ".stChuckEjectCmd");
|
||||||
|
|
||||||
|
Etching1PackMLControlVm = new(_adsManager, _variableName + ".stStationCmds");
|
||||||
|
Etching1PackMLControlVm.STitle = "Ätzer 1";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
VacuumValveControlEtching1Vm.Dispose();
|
||||||
|
DoorValveControlEtching1Vm.Dispose();
|
||||||
|
ChuckUnlockValveLeftEtching1Vm.Dispose();
|
||||||
|
ChuckUnlockValveRightEtching1Vm.Dispose();
|
||||||
|
ChuckEjectValveFrontEtching1Vm.Dispose();
|
||||||
|
ChuckEjectValveBackEtching1Vm.Dispose();
|
||||||
|
ChuckUnlockCmdButtonEtching1Vm?.Dispose();
|
||||||
|
ChuckUnlockCmdButtonEtching1Vm = null;
|
||||||
|
ChuckLockCmdButtonEtching1Vm?.Dispose();
|
||||||
|
ChuckLockCmdButtonEtching1Vm = null;
|
||||||
|
ChuckLockCmdButtonEtching1Vm?.Dispose();
|
||||||
|
ChuckEjectCmdButtonEtching1Vm = null;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,98 @@
|
|||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using HMIToolkit;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using Heisig.HMI.AdsManager;
|
||||||
|
using CommunityToolkit.Mvvm.Input;
|
||||||
|
using TwinCAT.TypeSystem;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using Common;
|
||||||
|
using InfineonHMI.Model;
|
||||||
|
namespace InfineonHMI;
|
||||||
|
|
||||||
|
public sealed partial class EtchingStation2PageVM : ObservableValidator, IDisposable
|
||||||
|
{
|
||||||
|
|
||||||
|
[ObservableProperty] private BinaryValveControlVM vacuumValveControlEtching2Vm;
|
||||||
|
|
||||||
|
[ObservableProperty] private BinaryValveControlVM doorValveControlEtching2Vm;
|
||||||
|
|
||||||
|
[ObservableProperty] private BinaryValveControlVM chuckUnlockValveLeftEtching2Vm;
|
||||||
|
|
||||||
|
[ObservableProperty] private BinaryValveControlVM chuckUnlockValveRightEtching2Vm;
|
||||||
|
|
||||||
|
[ObservableProperty] private BinaryValveControlVM chuckEjectValveFrontEtching2Vm;
|
||||||
|
|
||||||
|
[ObservableProperty] private BinaryValveControlVM chuckEjectValveBackEtching2Vm;
|
||||||
|
|
||||||
|
[ObservableProperty] private HMIControlButtonVM? chuckUnlockCmdButtonEtching2Vm;
|
||||||
|
|
||||||
|
[ObservableProperty] private HMIControlButtonVM? chuckLockCmdButtonEtching2Vm;
|
||||||
|
|
||||||
|
[ObservableProperty] private HMIControlButtonVM? chuckEjectCmdButtonEtching2Vm;
|
||||||
|
|
||||||
|
[ObservableProperty] private PackMLControlVM? etching2PackMLControlVm;
|
||||||
|
|
||||||
|
private readonly string? _variableName;
|
||||||
|
|
||||||
|
private readonly IAdsManager? _adsManager;
|
||||||
|
|
||||||
|
public EtchingStation2PageVM()
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
VacuumValveControlEtching2Vm = new BinaryValveControlVM();
|
||||||
|
DoorValveControlEtching2Vm = new BinaryValveControlVM();
|
||||||
|
ChuckUnlockValveLeftEtching2Vm = new BinaryValveControlVM();
|
||||||
|
ChuckUnlockValveRightEtching2Vm = new BinaryValveControlVM();
|
||||||
|
ChuckEjectValveFrontEtching2Vm = new BinaryValveControlVM();
|
||||||
|
ChuckEjectValveBackEtching2Vm = new BinaryValveControlVM();
|
||||||
|
|
||||||
|
ChuckUnlockCmdButtonEtching2Vm = new HMIControlButtonVM();
|
||||||
|
ChuckLockCmdButtonEtching2Vm = new HMIControlButtonVM();
|
||||||
|
ChuckEjectCmdButtonEtching2Vm = new HMIControlButtonVM();
|
||||||
|
|
||||||
|
Etching2PackMLControlVm = new();
|
||||||
|
Etching2PackMLControlVm.STitle = "Ätzer 2";
|
||||||
|
}
|
||||||
|
|
||||||
|
public EtchingStation2PageVM(IAdsManager adsManager, string variableName)
|
||||||
|
{
|
||||||
|
_adsManager = adsManager;
|
||||||
|
_variableName = variableName;
|
||||||
|
|
||||||
|
|
||||||
|
VacuumValveControlEtching2Vm = new BinaryValveControlVM(_adsManager, _variableName + ".stVacuumValve");
|
||||||
|
DoorValveControlEtching2Vm = new BinaryValveControlVM(_adsManager, _variableName + ".stDoorValve");
|
||||||
|
ChuckUnlockValveLeftEtching2Vm = new BinaryValveControlVM(_adsManager, _variableName + ".stChuckUnlockLeft");
|
||||||
|
ChuckUnlockValveRightEtching2Vm = new BinaryValveControlVM(_adsManager, _variableName + ".stChuckUnlockRight");
|
||||||
|
ChuckEjectValveFrontEtching2Vm = new BinaryValveControlVM(_adsManager, _variableName + ".stChuckEjectFront");
|
||||||
|
ChuckEjectValveBackEtching2Vm = new BinaryValveControlVM(_adsManager, _variableName + ".stChuckEjectBack");
|
||||||
|
|
||||||
|
ChuckUnlockCmdButtonEtching2Vm = new HMIControlButtonVM(_adsManager, _variableName + ".stChuckUnlockCmd");
|
||||||
|
ChuckLockCmdButtonEtching2Vm = new HMIControlButtonVM(_adsManager, _variableName + ".stChuckLockCmd");
|
||||||
|
ChuckEjectCmdButtonEtching2Vm = new HMIControlButtonVM(_adsManager, _variableName + ".stChuckEjectCmd");
|
||||||
|
|
||||||
|
Etching2PackMLControlVm = new(_adsManager, _variableName + ".stStationCmds");
|
||||||
|
Etching2PackMLControlVm.STitle = "Ätzer 2";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
VacuumValveControlEtching2Vm.Dispose();
|
||||||
|
DoorValveControlEtching2Vm.Dispose();
|
||||||
|
ChuckUnlockValveLeftEtching2Vm.Dispose();
|
||||||
|
ChuckUnlockValveRightEtching2Vm.Dispose();
|
||||||
|
ChuckEjectValveFrontEtching2Vm.Dispose();
|
||||||
|
ChuckEjectValveBackEtching2Vm.Dispose();
|
||||||
|
ChuckUnlockCmdButtonEtching2Vm?.Dispose();
|
||||||
|
ChuckUnlockCmdButtonEtching2Vm = null;
|
||||||
|
ChuckLockCmdButtonEtching2Vm?.Dispose();
|
||||||
|
ChuckLockCmdButtonEtching2Vm = null;
|
||||||
|
ChuckLockCmdButtonEtching2Vm?.Dispose();
|
||||||
|
ChuckEjectCmdButtonEtching2Vm = null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -3,107 +3,111 @@ using System.Collections.ObjectModel;
|
|||||||
using System.Windows;
|
using System.Windows;
|
||||||
using TcEventLoggerAdsProxyLib;
|
using TcEventLoggerAdsProxyLib;
|
||||||
|
|
||||||
namespace UniperHMI
|
namespace InfineonHMI;
|
||||||
|
|
||||||
|
public partial class EventData : ObservableObject
|
||||||
{
|
{
|
||||||
public partial class EventData : ObservableObject
|
[ObservableProperty]
|
||||||
{
|
public uint id;
|
||||||
[ObservableProperty]
|
|
||||||
public uint id;
|
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
public string? message;
|
public string? message;
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
public DateTime raised;
|
public DateTime raised;
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
public DateTime cleared;
|
public DateTime cleared;
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
public DateTime confirmed;
|
public DateTime confirmed;
|
||||||
};
|
};
|
||||||
|
|
||||||
public sealed partial class EventsPageVM : ObservableObject
|
public sealed partial class EventsPageVM : ObservableObject
|
||||||
{
|
{
|
||||||
public ObservableCollection<EventData> CurrentEvents { get; private set; } = [];
|
public ObservableCollection<EventData> CurrentEvents { get; private set; } = [];
|
||||||
private readonly object _lock = new();
|
private readonly object _lock = new();
|
||||||
|
|
||||||
private readonly TcEventLogger _logger;
|
private readonly TcEventLogger _logger;
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
private EventData? currentEvent;
|
private EventData? currentEvent;
|
||||||
|
|
||||||
// 599264352000000000 ticks is a date used by beckhoff for events that didnt happen up to this point
|
// 599264352000000000 ticks is a date used by beckhoff for events that didnt happen up to this point
|
||||||
private const long NoTime = 599264352000000000;
|
private const long NoTime = 599264352000000000;
|
||||||
|
|
||||||
|
|
||||||
public EventsPageVM(TcEventLogger logger)
|
public EventsPageVM(TcEventLogger logger)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
|
|
||||||
_logger.AlarmRaised += SimpleAlarmRaisedEvent;
|
_logger.AlarmRaised += SimpleAlarmRaisedEvent;
|
||||||
_logger.AlarmCleared += SimpleAlarmClearedEvent;
|
_logger.AlarmCleared += SimpleAlarmClearedEvent;
|
||||||
_logger.AlarmConfirmed += SimpleConfirmedAlarmEvent;
|
_logger.AlarmConfirmed += SimpleConfirmedAlarmEvent;
|
||||||
|
|
||||||
_logger.Connect("10.103.32.50.1.1");
|
#if DEBUG
|
||||||
|
|
||||||
GetAllActiveEvents();
|
#else
|
||||||
}
|
|
||||||
|
|
||||||
private void RebuildCurrentEventsList()
|
_logger.Connect("5.127.104.206.1.1");
|
||||||
{
|
#endif
|
||||||
lock (_lock)
|
|
||||||
{
|
|
||||||
CurrentEvents.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
GetAllActiveEvents();
|
GetAllActiveEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SimpleConfirmedAlarmEvent(TcAlarm alarm, bool remove)
|
private void RebuildCurrentEventsList()
|
||||||
{
|
{
|
||||||
Application.Current.Dispatcher.BeginInvoke(RebuildCurrentEventsList);
|
lock (_lock)
|
||||||
}
|
{
|
||||||
|
CurrentEvents.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
private void SimpleAlarmClearedEvent(TcAlarm alarm, bool remove)
|
GetAllActiveEvents();
|
||||||
{
|
}
|
||||||
Application.Current.Dispatcher.BeginInvoke(RebuildCurrentEventsList);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SimpleAlarmRaisedEvent(TcAlarm alarm)
|
private void SimpleConfirmedAlarmEvent(TcAlarm alarm, bool remove)
|
||||||
{
|
{
|
||||||
Application.Current.Dispatcher.BeginInvoke(RebuildCurrentEventsList);
|
Application.Current.Dispatcher.BeginInvoke(RebuildCurrentEventsList);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GetAllActiveEvents()
|
private void SimpleAlarmClearedEvent(TcAlarm alarm, bool remove)
|
||||||
{
|
{
|
||||||
EventData eventData;
|
Application.Current.Dispatcher.BeginInvoke(RebuildCurrentEventsList);
|
||||||
List<EventData> tempEventList = [];
|
}
|
||||||
|
|
||||||
lock (_lock)
|
private void SimpleAlarmRaisedEvent(TcAlarm alarm)
|
||||||
{
|
{
|
||||||
foreach (var alarm in _logger.ActiveAlarms)
|
Application.Current.Dispatcher.BeginInvoke(RebuildCurrentEventsList);
|
||||||
{
|
}
|
||||||
eventData = new()
|
|
||||||
{
|
|
||||||
Id = alarm.EventId,
|
|
||||||
Message = alarm.GetText(1033),
|
|
||||||
Raised = alarm.TimeRaised,
|
|
||||||
Cleared = alarm.TimeCleared,
|
|
||||||
Confirmed = alarm.TimeConfirmed
|
|
||||||
};
|
|
||||||
|
|
||||||
tempEventList.Add(eventData);
|
private void GetAllActiveEvents()
|
||||||
}
|
{
|
||||||
|
EventData eventData;
|
||||||
|
List<EventData> tempEventList = [];
|
||||||
|
|
||||||
IEnumerable<EventData> _eventQuery =
|
lock (_lock)
|
||||||
from data in tempEventList
|
{
|
||||||
orderby data.Raised descending
|
foreach (var alarm in _logger.ActiveAlarms)
|
||||||
select data;
|
{
|
||||||
|
eventData = new()
|
||||||
|
{
|
||||||
|
Id = alarm.EventId,
|
||||||
|
Message = alarm.GetText(1033),
|
||||||
|
Raised = alarm.TimeRaised,
|
||||||
|
Cleared = alarm.TimeCleared,
|
||||||
|
Confirmed = alarm.TimeConfirmed
|
||||||
|
};
|
||||||
|
|
||||||
CurrentEvent = _eventQuery.FirstOrDefault();
|
tempEventList.Add(eventData);
|
||||||
CurrentEvents = new ObservableCollection<EventData>(_eventQuery);
|
}
|
||||||
}
|
|
||||||
}
|
IEnumerable<EventData> _eventQuery =
|
||||||
}
|
from data in tempEventList
|
||||||
}
|
orderby data.Raised descending
|
||||||
|
select data;
|
||||||
|
|
||||||
|
CurrentEvent = _eventQuery.FirstOrDefault();
|
||||||
|
CurrentEvents = new ObservableCollection<EventData>(_eventQuery);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using HMIToolkit;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using Heisig.HMI.AdsManager;
|
||||||
|
using CommunityToolkit.Mvvm.Input;
|
||||||
|
using TwinCAT.TypeSystem;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using Common;
|
||||||
|
using InfineonHMI.Model;
|
||||||
|
namespace InfineonHMI;
|
||||||
|
|
||||||
|
public sealed partial class HighVoltageStationPageVM : ObservableValidator, IDisposable
|
||||||
|
{
|
||||||
|
private readonly string? _variableName;
|
||||||
|
|
||||||
|
private readonly IAdsManager? _adsManager;
|
||||||
|
|
||||||
|
[ObservableProperty] private PackMLControlVM highVoltageHotPackMLControlVm;
|
||||||
|
[ObservableProperty] private PackMLControlVM highVoltageColdPackMLControlVm;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private BinaryValveControlVM doorValveHotControlVm;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private BinaryValveControlVM testChamberHotValveVm;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private AnalogValueVM tempSPHotVm;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private BinaryValveControlVM doorValveColdControlVm;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private BinaryValveControlVM testChamberColdValveVm;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private AnalogValueVM tempSPColdVm;
|
||||||
|
|
||||||
|
public HighVoltageStationPageVM()
|
||||||
|
{
|
||||||
|
DoorValveHotControlVm = new BinaryValveControlVM();
|
||||||
|
TestChamberHotValveVm = new BinaryValveControlVM();
|
||||||
|
TempSPHotVm = new AnalogValueVM();
|
||||||
|
|
||||||
|
DoorValveColdControlVm = new BinaryValveControlVM();
|
||||||
|
TestChamberColdValveVm = new BinaryValveControlVM();
|
||||||
|
TempSPColdVm = new AnalogValueVM();
|
||||||
|
|
||||||
|
HighVoltageColdPackMLControlVm = new();
|
||||||
|
HighVoltageHotPackMLControlVm = new();
|
||||||
|
|
||||||
|
HighVoltageColdPackMLControlVm.STitle = "Hochvoltstation\nKalt";
|
||||||
|
|
||||||
|
HighVoltageHotPackMLControlVm.STitle = "Hochvoltstation\nHeiß";
|
||||||
|
}
|
||||||
|
|
||||||
|
public HighVoltageStationPageVM(IAdsManager adsManager, string variableName)
|
||||||
|
{
|
||||||
|
_adsManager = adsManager;
|
||||||
|
_variableName = variableName;
|
||||||
|
|
||||||
|
DoorValveHotControlVm = new BinaryValveControlVM(_adsManager, _variableName + ".stHVTesterHot.stDoorValve");
|
||||||
|
TestChamberHotValveVm = new BinaryValveControlVM(_adsManager, _variableName + ".stHVTesterHot.stTestChamberValve");
|
||||||
|
TempSPHotVm = new AnalogValueVM(_adsManager, _variableName + ".stHVTesterHot.stTempSP", false);
|
||||||
|
|
||||||
|
DoorValveColdControlVm = new BinaryValveControlVM(_adsManager, _variableName + ".stHVTesterCold.stDoorValve");
|
||||||
|
TestChamberColdValveVm = new BinaryValveControlVM(_adsManager, _variableName + ".stHVTesterCold.stTestChamberValve");
|
||||||
|
TempSPColdVm = new AnalogValueVM(_adsManager, _variableName + ".stHVTesterCold.stTempSP", false);
|
||||||
|
|
||||||
|
HighVoltageColdPackMLControlVm = new(_adsManager, _variableName + ".stHVTesterCold.stStationCmds");
|
||||||
|
HighVoltageHotPackMLControlVm = new(_adsManager, _variableName + ".stHVTesterHot.stStationCmds");
|
||||||
|
|
||||||
|
HighVoltageColdPackMLControlVm.STitle = "Hochvoltstation\nKalt";
|
||||||
|
|
||||||
|
HighVoltageHotPackMLControlVm.STitle = "Hochvoltstation\nHeiß";
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
DoorValveHotControlVm.Dispose();
|
||||||
|
TestChamberHotValveVm.Dispose();
|
||||||
|
TempSPHotVm.Dispose();
|
||||||
|
DoorValveColdControlVm.Dispose();
|
||||||
|
TestChamberColdValveVm.Dispose();
|
||||||
|
TempSPColdVm.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
424
uniper_hmi/UniperHMI/Pages/ViewModels/HotCoolPlatePageVM.cs
Normal file
424
uniper_hmi/UniperHMI/Pages/ViewModels/HotCoolPlatePageVM.cs
Normal file
@@ -0,0 +1,424 @@
|
|||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using HMIToolkit;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using Heisig.HMI.AdsManager;
|
||||||
|
using CommunityToolkit.Mvvm.Input;
|
||||||
|
using TwinCAT.TypeSystem;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
|
||||||
|
using InfineonHMI.Model;
|
||||||
|
using System.Windows;
|
||||||
|
using Common;
|
||||||
|
|
||||||
|
namespace InfineonHMI;
|
||||||
|
|
||||||
|
public sealed partial class HotCoolPlatePageVM : ObservableValidator, IDisposable
|
||||||
|
{
|
||||||
|
|
||||||
|
private const string sPieceOnHotplate1 = ".stHotplate.stPiece1";
|
||||||
|
private const string sPieceOnHotplate2 = ".stHotplate.stPiece2";
|
||||||
|
private const string sPieceOnHotplate3 = ".stHotplate.stPiece3";
|
||||||
|
private const string sPieceOnHotplate4 = ".stHotplate.stPiece4";
|
||||||
|
private const string sPieceOnHotplate5 = ".stHotplate.stPiece5";
|
||||||
|
private const string sPieceOnHotplate6 = ".stHotplate.stPiece6";
|
||||||
|
private const string sPieceOnHotplate7 = ".stHotplate.stPiece7";
|
||||||
|
private const string sPieceOnHotplate8 = ".stHotplate.stPiece8";
|
||||||
|
private const string sPieceOnHotplate9 = ".stHotplate.stPiece9";
|
||||||
|
|
||||||
|
private const string sPieceOnCoolplate1 = ".stCoolplate.stPiece1";
|
||||||
|
private const string sPieceOnCoolplate2 = ".stCoolplate.stPiece2";
|
||||||
|
private const string sPieceOnCoolplate3 = ".stCoolplate.stPiece3";
|
||||||
|
private const string sPieceOnCoolplate4 = ".stCoolplate.stPiece4";
|
||||||
|
private const string sPieceOnCoolplate5 = ".stCoolplate.stPiece5";
|
||||||
|
private const string sPieceOnCoolplate6 = ".stCoolplate.stPiece6";
|
||||||
|
private const string sPieceOnCoolplate7 = ".stCoolplate.stPiece7";
|
||||||
|
private const string sPieceOnCoolplate8 = ".stCoolplate.stPiece8";
|
||||||
|
private const string sPieceOnCoolplate9 = ".stCoolplate.stPiece9";
|
||||||
|
|
||||||
|
private readonly IAdsManager? _adsManager;
|
||||||
|
|
||||||
|
private readonly string? _variableName;
|
||||||
|
|
||||||
|
[ObservableProperty] private PackMLControlVM? hotplatePackMLControlVm;
|
||||||
|
[ObservableProperty] private PackMLControlVM? coolplatePackMLControlVm;
|
||||||
|
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private AnalogValueVM hotPlateTargetTemperature;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private AnalogValueVM hotPlateActualTemperature;
|
||||||
|
|
||||||
|
[ObservableProperty] private HMIControlButtonVM? enableHotPlateButtonVm;
|
||||||
|
|
||||||
|
[ObservableProperty] private HMIControlButtonVM? disableHotPlateButtonVm;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private AnalogValueVM coolPlateTargetTemperature;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private AnalogValueVM coolPlateActualTemperature;
|
||||||
|
|
||||||
|
[ObservableProperty] private HMIControlButtonVM? enableCoolPlateButtonVm;
|
||||||
|
|
||||||
|
[ObservableProperty] private HMIControlButtonVM? disableCoolPlateButtonVm;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private Visibility hotPlateVisibility1;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private Visibility hotPlateVisibility2;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private Visibility hotPlateVisibility3;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private Visibility hotPlateVisibility4;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private Visibility hotPlateVisibility5;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private Visibility hotPlateVisibility6;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private Visibility hotPlateVisibility7;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private Visibility hotPlateVisibility8;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private Visibility hotPlateVisibility9;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private Visibility coolPlateVisibility1;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private Visibility coolPlateVisibility2;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private Visibility coolPlateVisibility3;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private Visibility coolPlateVisibility4;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private Visibility coolPlateVisibility5;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private Visibility coolPlateVisibility6;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private Visibility coolPlateVisibility7;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private Visibility coolPlateVisibility8;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private Visibility coolPlateVisibility9;
|
||||||
|
|
||||||
|
public HotCoolPlatePageVM()
|
||||||
|
{
|
||||||
|
EnableHotPlateButtonVm = new HMIControlButtonVM();
|
||||||
|
DisableHotPlateButtonVm = new HMIControlButtonVM();
|
||||||
|
|
||||||
|
EnableCoolPlateButtonVm = new HMIControlButtonVM();
|
||||||
|
DisableCoolPlateButtonVm = new HMIControlButtonVM();
|
||||||
|
|
||||||
|
HotPlateActualTemperature = new AnalogValueVM();
|
||||||
|
HotPlateTargetTemperature = new AnalogValueVM();
|
||||||
|
|
||||||
|
CoolPlateActualTemperature = new AnalogValueVM();
|
||||||
|
CoolPlateTargetTemperature = new AnalogValueVM();
|
||||||
|
|
||||||
|
HotplatePackMLControlVm = new();
|
||||||
|
CoolplatePackMLControlVm = new();
|
||||||
|
|
||||||
|
HotplatePackMLControlVm.STitle = "Heizplatte";
|
||||||
|
CoolplatePackMLControlVm.STitle = "Kühlplatte";
|
||||||
|
|
||||||
|
}
|
||||||
|
public HotCoolPlatePageVM(IAdsManager adsManager, string variableName)
|
||||||
|
{
|
||||||
|
_adsManager = adsManager;
|
||||||
|
_variableName = variableName;
|
||||||
|
|
||||||
|
EnableHotPlateButtonVm = new HMIControlButtonVM(_adsManager, _variableName + ".stHotplate.stEnableBtn");
|
||||||
|
DisableHotPlateButtonVm = new HMIControlButtonVM(_adsManager, _variableName + ".stHotplate.stDisableBtn");
|
||||||
|
|
||||||
|
EnableCoolPlateButtonVm = new HMIControlButtonVM(_adsManager, _variableName + ".stCoolplate.stEnableBtn");
|
||||||
|
DisableCoolPlateButtonVm = new HMIControlButtonVM(_adsManager, _variableName + ".stCoolplate.stDisableBtn");
|
||||||
|
|
||||||
|
HotPlateActualTemperature = new AnalogValueVM(_adsManager, _variableName + ".stHotplate.stPV", true);
|
||||||
|
CoolPlateActualTemperature = new AnalogValueVM(_adsManager, _variableName + ".stCoolplate.stPV", true);
|
||||||
|
|
||||||
|
HotPlateTargetTemperature = new AnalogValueVM(_adsManager, _variableName + ".stHotplate.stSetpoint", false);
|
||||||
|
CoolPlateTargetTemperature = new AnalogValueVM(_adsManager, _variableName + ".stCoolplate.stSetpoint", false);
|
||||||
|
|
||||||
|
HotplatePackMLControlVm = new(_adsManager, _variableName + ".stHotplate.stStationCmds");
|
||||||
|
CoolplatePackMLControlVm = new(_adsManager, _variableName + ".stCoolplate.stStationCmds");
|
||||||
|
|
||||||
|
HotplatePackMLControlVm.STitle = "Heizplatte";
|
||||||
|
CoolplatePackMLControlVm.STitle = "Kühlplatte";
|
||||||
|
|
||||||
|
_adsManager.Register(sPieceOnHotplate1, HotplatePiece1Changed);
|
||||||
|
_adsManager.Register(sPieceOnHotplate2, HotplatePiece2Changed);
|
||||||
|
_adsManager.Register(sPieceOnHotplate3, HotplatePiece3Changed);
|
||||||
|
_adsManager.Register(sPieceOnHotplate4, HotplatePiece4Changed);
|
||||||
|
_adsManager.Register(sPieceOnHotplate5, HotplatePiece5Changed);
|
||||||
|
_adsManager.Register(sPieceOnHotplate6, HotplatePiece6Changed);
|
||||||
|
_adsManager.Register(sPieceOnHotplate7, HotplatePiece7Changed);
|
||||||
|
_adsManager.Register(sPieceOnHotplate8, HotplatePiece8Changed);
|
||||||
|
_adsManager.Register(sPieceOnHotplate9, HotplatePiece9Changed);
|
||||||
|
|
||||||
|
_adsManager.Register(sPieceOnCoolplate1, CoolplatePiece1Changed);
|
||||||
|
_adsManager.Register(sPieceOnCoolplate2, CoolplatePiece2Changed);
|
||||||
|
_adsManager.Register(sPieceOnCoolplate3, CoolplatePiece3Changed);
|
||||||
|
_adsManager.Register(sPieceOnCoolplate4, CoolplatePiece4Changed);
|
||||||
|
_adsManager.Register(sPieceOnCoolplate5, CoolplatePiece5Changed);
|
||||||
|
_adsManager.Register(sPieceOnCoolplate6, CoolplatePiece6Changed);
|
||||||
|
_adsManager.Register(sPieceOnCoolplate7, CoolplatePiece7Changed);
|
||||||
|
_adsManager.Register(sPieceOnCoolplate8, CoolplatePiece8Changed);
|
||||||
|
_adsManager.Register(sPieceOnCoolplate9, CoolplatePiece9Changed);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void HotplatePiece1Changed(object? sender, ValueChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if ((bool)e.Value)
|
||||||
|
{
|
||||||
|
HotPlateVisibility1 = Visibility.Visible;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
HotPlateVisibility1 = Visibility.Hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void HotplatePiece2Changed(object? sender, ValueChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if ((bool)e.Value)
|
||||||
|
{
|
||||||
|
HotPlateVisibility2 = Visibility.Visible;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
HotPlateVisibility2 = Visibility.Hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void HotplatePiece3Changed(object? sender, ValueChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if ((bool)e.Value)
|
||||||
|
{
|
||||||
|
HotPlateVisibility3 = Visibility.Visible;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
HotPlateVisibility3 = Visibility.Hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void HotplatePiece4Changed(object? sender, ValueChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if ((bool)e.Value)
|
||||||
|
{
|
||||||
|
HotPlateVisibility4 = Visibility.Visible;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
HotPlateVisibility4 = Visibility.Hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void HotplatePiece5Changed(object? sender, ValueChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if ((bool)e.Value)
|
||||||
|
{
|
||||||
|
HotPlateVisibility5 = Visibility.Visible;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
HotPlateVisibility5 = Visibility.Hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void HotplatePiece6Changed(object? sender, ValueChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if ((bool)e.Value)
|
||||||
|
{
|
||||||
|
HotPlateVisibility6 = Visibility.Visible;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
HotPlateVisibility6 = Visibility.Hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void HotplatePiece7Changed(object? sender, ValueChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if ((bool)e.Value)
|
||||||
|
{
|
||||||
|
HotPlateVisibility7 = Visibility.Visible;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
HotPlateVisibility7 = Visibility.Hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void HotplatePiece8Changed(object? sender, ValueChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if ((bool)e.Value)
|
||||||
|
{
|
||||||
|
HotPlateVisibility8 = Visibility.Visible;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
HotPlateVisibility8 = Visibility.Hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void HotplatePiece9Changed(object? sender, ValueChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if ((bool)e.Value)
|
||||||
|
{
|
||||||
|
HotPlateVisibility9 = Visibility.Visible;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
HotPlateVisibility9 = Visibility.Hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CoolplatePiece1Changed(object? sender, ValueChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if ((bool)e.Value)
|
||||||
|
{
|
||||||
|
CoolPlateVisibility1 = Visibility.Visible;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CoolPlateVisibility1 = Visibility.Hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void CoolplatePiece2Changed(object? sender, ValueChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if ((bool)e.Value)
|
||||||
|
{
|
||||||
|
CoolPlateVisibility2 = Visibility.Visible;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CoolPlateVisibility2 = Visibility.Hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void CoolplatePiece3Changed(object? sender, ValueChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if ((bool)e.Value)
|
||||||
|
{
|
||||||
|
CoolPlateVisibility3 = Visibility.Visible;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CoolPlateVisibility3 = Visibility.Hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void CoolplatePiece4Changed(object? sender, ValueChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if ((bool)e.Value)
|
||||||
|
{
|
||||||
|
CoolPlateVisibility4 = Visibility.Visible;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CoolPlateVisibility4 = Visibility.Hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void CoolplatePiece5Changed(object? sender, ValueChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if ((bool)e.Value)
|
||||||
|
{
|
||||||
|
CoolPlateVisibility5 = Visibility.Visible;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CoolPlateVisibility5 = Visibility.Hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void CoolplatePiece6Changed(object? sender, ValueChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if ((bool)e.Value)
|
||||||
|
{
|
||||||
|
CoolPlateVisibility6 = Visibility.Visible;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CoolPlateVisibility6 = Visibility.Hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void CoolplatePiece7Changed(object? sender, ValueChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if ((bool)e.Value)
|
||||||
|
{
|
||||||
|
CoolPlateVisibility7 = Visibility.Visible;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CoolPlateVisibility7 = Visibility.Hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void CoolplatePiece8Changed(object? sender, ValueChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if ((bool)e.Value)
|
||||||
|
{
|
||||||
|
CoolPlateVisibility8 = Visibility.Visible;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CoolPlateVisibility8 = Visibility.Hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void CoolplatePiece9Changed(object? sender, ValueChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if ((bool)e.Value)
|
||||||
|
{
|
||||||
|
CoolPlateVisibility9 = Visibility.Visible;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CoolPlateVisibility9 = Visibility.Hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
HotPlateActualTemperature.Dispose();
|
||||||
|
HotPlateTargetTemperature.Dispose();
|
||||||
|
CoolPlateActualTemperature.Dispose();
|
||||||
|
CoolPlateTargetTemperature.Dispose();
|
||||||
|
|
||||||
|
EnableCoolPlateButtonVm?.Dispose();
|
||||||
|
EnableCoolPlateButtonVm = null;
|
||||||
|
EnableHotPlateButtonVm?.Dispose();
|
||||||
|
EnableHotPlateButtonVm = null;
|
||||||
|
DisableCoolPlateButtonVm?.Dispose();
|
||||||
|
DisableCoolPlateButtonVm = null;
|
||||||
|
DisableHotPlateButtonVm?.Dispose();
|
||||||
|
DisableHotPlateButtonVm = null;
|
||||||
|
_adsManager?.Deregister(sPieceOnHotplate1, HotplatePiece1Changed);
|
||||||
|
_adsManager?.Deregister(sPieceOnHotplate2, HotplatePiece2Changed);
|
||||||
|
_adsManager?.Deregister(sPieceOnHotplate3, HotplatePiece3Changed);
|
||||||
|
_adsManager?.Deregister(sPieceOnHotplate4, HotplatePiece4Changed);
|
||||||
|
_adsManager?.Deregister(sPieceOnHotplate5, HotplatePiece5Changed);
|
||||||
|
_adsManager?.Deregister(sPieceOnHotplate6, HotplatePiece6Changed);
|
||||||
|
_adsManager?.Deregister(sPieceOnHotplate7, HotplatePiece7Changed);
|
||||||
|
_adsManager?.Deregister(sPieceOnHotplate8, HotplatePiece8Changed);
|
||||||
|
_adsManager?.Deregister(sPieceOnHotplate9, HotplatePiece9Changed);
|
||||||
|
|
||||||
|
_adsManager?.Deregister(sPieceOnCoolplate1, CoolplatePiece1Changed);
|
||||||
|
_adsManager?.Deregister(sPieceOnCoolplate2, CoolplatePiece2Changed);
|
||||||
|
_adsManager?.Deregister(sPieceOnCoolplate3, CoolplatePiece3Changed);
|
||||||
|
_adsManager?.Deregister(sPieceOnCoolplate4, CoolplatePiece4Changed);
|
||||||
|
_adsManager?.Deregister(sPieceOnCoolplate5, CoolplatePiece5Changed);
|
||||||
|
_adsManager?.Deregister(sPieceOnCoolplate6, CoolplatePiece6Changed);
|
||||||
|
_adsManager?.Deregister(sPieceOnCoolplate7, CoolplatePiece7Changed);
|
||||||
|
_adsManager?.Deregister(sPieceOnCoolplate8, CoolplatePiece8Changed);
|
||||||
|
_adsManager?.Deregister(sPieceOnCoolplate9, CoolplatePiece9Changed);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
682
uniper_hmi/UniperHMI/Pages/ViewModels/KukaRobotPageVM.cs
Normal file
682
uniper_hmi/UniperHMI/Pages/ViewModels/KukaRobotPageVM.cs
Normal file
@@ -0,0 +1,682 @@
|
|||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using HMIToolkit;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using Heisig.HMI.AdsManager;
|
||||||
|
using CommunityToolkit.Mvvm.Input;
|
||||||
|
using TwinCAT.TypeSystem;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Security.Policy;
|
||||||
|
using System.Printing;
|
||||||
|
using System.Windows;
|
||||||
|
using Common;
|
||||||
|
using InfineonHMI.Model;
|
||||||
|
|
||||||
|
namespace InfineonHMI;
|
||||||
|
|
||||||
|
public sealed partial class KukaRobotPageVM : ObservableValidator, IDisposable
|
||||||
|
{
|
||||||
|
|
||||||
|
private const string sStartRobotJob = "_adsVariable_kukaStartRobotJob";
|
||||||
|
private const string sAbortRobotJob = "_adsVariable_kukaAbortRobotJob";
|
||||||
|
private const string sResetState = "_adsVariable_kukaResetState";
|
||||||
|
private const string sClearState = "_adsVariable_kukaClearState";
|
||||||
|
private const string sAcknPLCJob = "_adsVariable_kukaAcknPLCJob";
|
||||||
|
private const string sCoolplateIndex = "GVL_SCADA.stMachine.stKukaRobot.stJobParams.byPlaceOnCoolPlate";
|
||||||
|
private const string sHotplateIndex = "GVL_SCADA.stMachine.stKukaRobot.stJobParams.byPlaceOnHotPlate";
|
||||||
|
private const string sPieceThickness = "_adsVariable_kukaPieceThickness";
|
||||||
|
private const string sJobGrippSide = "GVL_SCADA.stMachine.stKukaRobot.stJobParams.byGripperSide";
|
||||||
|
private const string sJobGrippType = "GVL_SCADA.stMachine.stKukaRobot.stJobParams.byGripperNumber";
|
||||||
|
private const string sChuckMagazinPlace = "GVL_SCADA.stMachine.stKukaRobot.stJobParams.byChuckNumber";
|
||||||
|
private const string sSelectedRobotJob = "GVL_SCADA.stMachine.stKukaRobot.stJobParams.eJob";
|
||||||
|
private const string sActiveRobotJob = "_adsVariable_kukaActiveRobotJob";
|
||||||
|
private const string sFinishedRobotJob = "_adsVariable_kukaFinishedRobotJob";
|
||||||
|
private const string sSelectedPLCJob = "_adsVariable_kukaPLCJob";
|
||||||
|
private const string sOffsetPick_X = "GVL_SCADA.stMachine.stKukaRobot.stJobParams.rPosX";
|
||||||
|
private const string sOffsetPick_Y = "GVL_SCADA.stMachine.stKukaRobot.stJobParams.rPosY";
|
||||||
|
private const string sOffsetPlace_X = "GVL_SCADA.stMachine.stKukaRobot.stJobParams.rPosX";
|
||||||
|
private const string sOffsetPlace_Y = "GVL_SCADA.stMachine.stKukaRobot.stJobParams.rPosY";
|
||||||
|
private const string sOffsetNIOPick_X = "GVL_SCADA.stMachine.stKukaRobot.stJobParams.rPosX";
|
||||||
|
private const string sOffsetNIOPick_Y = "GVL_SCADA.stMachine.stKukaRobot.stJobParams.rPosY";
|
||||||
|
private const string sOffsetNIOPlace_X = "GVL_SCADA.stMachine.stKukaRobot.stJobParams.rPosX";
|
||||||
|
private const string sOffsetNIOPlace_Y = "GVL_SCADA.stMachine.stKukaRobot.stJobParams.rPosY";
|
||||||
|
|
||||||
|
|
||||||
|
private BMSControlModeEntry currentControlMode;
|
||||||
|
public BMSControlModeEntry CurrentControlMode
|
||||||
|
{
|
||||||
|
get { return currentControlMode; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
currentControlMode = value;
|
||||||
|
ccmChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private E_BMS_CONTROL_MODE bmsControlMode;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private bool canChangeRobotJob;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private RobotJobentry robotJobActiveValue;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private RobotJobentry robotJobFinishedValue;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private bool canStartRobotJob;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private HMIControlButtonVM? startButton;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private bool canAbortRobotJob;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private HMIControlButtonVM? abortButton;
|
||||||
|
|
||||||
|
private const string sChuckOnPlace1 = "_adsVariable_MagazinPlace1";
|
||||||
|
private const string sChuckOnPlace2 = "_adsVariable_MagazinPlace2";
|
||||||
|
private const string sChuckOnPlace3 = "_adsVariable_MagazinPlace3";
|
||||||
|
private const string sChuckOnPlace4 = "_adsVariable_MagazinPlace4";
|
||||||
|
private const string sChuckOnPlace5 = "_adsVariable_MagazinPlace5";
|
||||||
|
private const string sChuckOnPlace6 = "_adsVariable_MagazinPlace6";
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private Visibility magazinPlace1;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private Visibility magazinPlace2;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private Visibility magazinPlace3;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private Visibility magazinPlace4;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private Visibility magazinPlace5;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private Visibility magazinPlace6;
|
||||||
|
|
||||||
|
private int jobGrippSide;
|
||||||
|
public int JobGrippSide
|
||||||
|
{
|
||||||
|
get { return jobGrippSide; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref jobGrippSide, value);
|
||||||
|
_adsManager?.WriteValue(sJobGrippSide, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private bool canChangeJobGrippSide;
|
||||||
|
|
||||||
|
|
||||||
|
private int jobGrippType;
|
||||||
|
public int JobGrippType
|
||||||
|
{
|
||||||
|
get { return jobGrippType; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref jobGrippType, value);
|
||||||
|
_adsManager?.WriteValue(sJobGrippType, value);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private bool canChangeJobGrippType;
|
||||||
|
|
||||||
|
|
||||||
|
private int chuckMagazinPlace;
|
||||||
|
public int ChuckMagazinPlace
|
||||||
|
{
|
||||||
|
get { return chuckMagazinPlace; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref chuckMagazinPlace, value);
|
||||||
|
_adsManager?.WriteValue(sChuckMagazinPlace, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private bool canChangeChuckMagazinPlace;
|
||||||
|
|
||||||
|
|
||||||
|
private double pieceThickness;
|
||||||
|
public double PieceThickness
|
||||||
|
{
|
||||||
|
get { return pieceThickness; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref pieceThickness, value);
|
||||||
|
_adsManager?.WriteValue(sPieceThickness, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private bool canChangePieceThickness;
|
||||||
|
|
||||||
|
|
||||||
|
private double offsetPick_X;
|
||||||
|
public double OffsetPick_X
|
||||||
|
{
|
||||||
|
get { return offsetPick_X; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref offsetPick_X, value);
|
||||||
|
_adsManager?.WriteValue(sOffsetPick_X, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private double offsetPick_Y;
|
||||||
|
public double OffsetPick_Y
|
||||||
|
{
|
||||||
|
get { return offsetPick_Y; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref offsetPick_Y, value);
|
||||||
|
_adsManager?.WriteValue(sOffsetPick_Y, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[ObservableProperty]
|
||||||
|
private bool canChangeOffsetPick;
|
||||||
|
|
||||||
|
|
||||||
|
private double offsetPlace_X;
|
||||||
|
public double OffsetPlace_X
|
||||||
|
{
|
||||||
|
get { return offsetPlace_X; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref offsetPlace_X, value);
|
||||||
|
_adsManager?.WriteValue(sOffsetPlace_X, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private double offsetPlace_Y;
|
||||||
|
public double OffsetPlace_Y
|
||||||
|
{
|
||||||
|
get { return offsetPlace_Y; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref offsetPlace_Y, value);
|
||||||
|
_adsManager?.WriteValue(sOffsetPlace_Y, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private bool canChangeOffsetPlace;
|
||||||
|
|
||||||
|
|
||||||
|
private double offsetNIOPick_X;
|
||||||
|
public double OffsetNIOPick_X
|
||||||
|
{
|
||||||
|
get { return offsetNIOPick_X; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref offsetNIOPick_X, value);
|
||||||
|
_adsManager?.WriteValue(sOffsetNIOPick_X, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private double offsetNIOPick_Y;
|
||||||
|
public double OffsetNIOPick_Y
|
||||||
|
{
|
||||||
|
get { return offsetNIOPick_Y; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref offsetNIOPick_Y, value);
|
||||||
|
_adsManager?.WriteValue(sOffsetNIOPick_Y, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[ObservableProperty]
|
||||||
|
private bool canChangeOffsetNIOPick;
|
||||||
|
|
||||||
|
|
||||||
|
private double offsetNIOPlace_X;
|
||||||
|
public double OffsetNIOPlace_X
|
||||||
|
{
|
||||||
|
get { return offsetNIOPlace_X; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref offsetNIOPlace_X, value);
|
||||||
|
_adsManager?.WriteValue(sOffsetNIOPlace_X, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private double offsetNIOPlace_Y;
|
||||||
|
public double OffsetNIOPlace_Y
|
||||||
|
{
|
||||||
|
get { return offsetNIOPlace_Y; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref offsetNIOPlace_Y, value);
|
||||||
|
_adsManager?.WriteValue(sOffsetNIOPlace_Y, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[ObservableProperty]
|
||||||
|
private bool canChangeOffsetNIOPlace;
|
||||||
|
|
||||||
|
|
||||||
|
private int hotplateIndex;
|
||||||
|
public int HotplateIndex
|
||||||
|
{
|
||||||
|
get { return hotplateIndex; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref hotplateIndex, value);
|
||||||
|
_adsManager?.WriteValue(sHotplateIndex, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
[ObservableProperty]
|
||||||
|
private bool canChangeHotPlateIndex;
|
||||||
|
|
||||||
|
|
||||||
|
private int coolplateIndex;
|
||||||
|
public int CoolplateIndex
|
||||||
|
{
|
||||||
|
get { return coolplateIndex; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref coolplateIndex, value);
|
||||||
|
_adsManager?.WriteValue(sCoolplateIndex, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[ObservableProperty] private PackMLControlVM kukaRobotPackMLControlVm;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private bool canChangeCoolPlateIndex;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private RobotJobenum robotJob;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private ObservableCollection<RobotJobentry> robotJobs =
|
||||||
|
[
|
||||||
|
new RobotJobentry(RobotJobenum.NONE, " ------- "),
|
||||||
|
new RobotJobentry(RobotJobenum.PICK_TRAYFEEDER, "10 - Hole Teil von Trayfeeder 'Eingabe' "),
|
||||||
|
new RobotJobentry(RobotJobenum.PLACE_TRAYFEEDER, "11 - Lege Teil in Trayfeeder 'Ausgabe' "),
|
||||||
|
new RobotJobentry(RobotJobenum.PUT_ALIGNMENT, "15 - Lege Teil auf Ausrichtstation"),
|
||||||
|
new RobotJobentry(RobotJobenum.PICK_ALIGNMENT, "16 - Hole Teil von Ausrichtstation"),
|
||||||
|
new RobotJobentry(RobotJobenum.PUT_ETCHER_1, "20 - Lege Teil in Ätzer 1"),
|
||||||
|
new RobotJobentry(RobotJobenum.PUT_ETCHER_2, "21 - Lege Teil in Ätzer 2"),
|
||||||
|
new RobotJobentry(RobotJobenum.PICK_ETCHER_1, "22 - Hole Teil aus Ätzer 1"),
|
||||||
|
new RobotJobentry(RobotJobenum.PICK_ETCHER_2, "23 - Hole Teil aus Ätzer 2"),
|
||||||
|
new RobotJobentry(RobotJobenum.SWITCH_ETCHER_1, "24 - Tausche Teile in Ätzer 1"),
|
||||||
|
new RobotJobentry(RobotJobenum.SWITCH_ETCHER_2, "25 - Tausche Teile in Ätzer 2"),
|
||||||
|
new RobotJobentry(RobotJobenum.PUT_HVTEST_HOT, "30 - Lege Teil in HV-Teststation Warm"),
|
||||||
|
new RobotJobentry(RobotJobenum.PUT_HVTEST_COLD, "31 - Lege Teil in HV-Teststation Kalt"),
|
||||||
|
new RobotJobentry(RobotJobenum.PICK_HVTEST_HOT, "32 - Hole Teil aus HV-Teststation Warm"),
|
||||||
|
new RobotJobentry(RobotJobenum.PICK_HVTEST_COLD, "33 - Hole Teil aus HV-Teststation Kalt"),
|
||||||
|
new RobotJobentry(RobotJobenum.PUT_HOTPLATE, "40 - Lege Teil auf Heizplatte"),
|
||||||
|
new RobotJobentry(RobotJobenum.PICK_HOTPLATE, "41 - Hole Teil von Heizplatte"),
|
||||||
|
new RobotJobentry(RobotJobenum.PUT_COOLPLATE, "42 - Lege Teil auf Kühlplatte"),
|
||||||
|
new RobotJobentry(RobotJobenum.PICK_COOLPLATE, "43 - Hole Teil von Kühlplatte"),
|
||||||
|
new RobotJobentry(RobotJobenum.PICK_GRIPPER, "50 - Hole anderen Greifertyp"),
|
||||||
|
new RobotJobentry(RobotJobenum.PICK_CHUCK_ETCHER_1, "60 - Hole Drehteller aus Ätzer 1"),
|
||||||
|
new RobotJobentry(RobotJobenum.PICK_CHUCK_ETCHER_2, "61 - Hole Drehteller aus Ätzer 2"),
|
||||||
|
new RobotJobentry(RobotJobenum.PUT_CHUCK_ETCHER_1, "62 - Lege Drehteller in Ätzer 1"),
|
||||||
|
new RobotJobentry(RobotJobenum.PUT_CHUCK_ETCHER_2, "63 - Lege Drehteller in Ätzer 2"),
|
||||||
|
new RobotJobentry(RobotJobenum.PUT_CHUCK_MAGAZIN, "64 - Lege Drehteller in Magazin"),
|
||||||
|
new RobotJobentry(RobotJobenum.PICK_CHUCK_MAGAZIN, "65 - Hole Drehteller von Magazin"),
|
||||||
|
new RobotJobentry(RobotJobenum.PUT_NIO_STATION, "70 - Lege Teil auf NIO-TRAY"),
|
||||||
|
new RobotJobentry(RobotJobenum.PICK_NIO_STATION, "71 - Hole Teil von NIO-TRAY"),
|
||||||
|
new RobotJobentry(RobotJobenum.WARMUP, "80 - Aufwärmprogramm")
|
||||||
|
];
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private ObservableCollection<PLCJobentry> pLCJobs =
|
||||||
|
[
|
||||||
|
new PLCJobentry(PLCJobenum.NONE, " ------- "),
|
||||||
|
new PLCJobentry(PLCJobenum.SCAN_QR_CODE, "10 - QR Code Scannen"),
|
||||||
|
new PLCJobentry(PLCJobenum.VACUUM_ON_ALIGNER, "15 - Vakuum Ausrichtstation einschalten"),
|
||||||
|
new PLCJobentry(PLCJobenum.VACUUM_OFF_ALIGNER, "16 - Vakuum Ausrichtstation ausschalten"),
|
||||||
|
new PLCJobentry(PLCJobenum.VACUUM_ON_ETCHER_1, "20 - Vakuum Ätzer 1 einschalten"),
|
||||||
|
new PLCJobentry(PLCJobenum.VACUUM_ON_ETCHER_2, "21 - Vakuum Ätzer 2 einschalten"),
|
||||||
|
new PLCJobentry(PLCJobenum.VACUUM_OFF_ETCHER_1, "22 - Vakuum Ätzer 1 ausschalten"),
|
||||||
|
new PLCJobentry(PLCJobenum.VACUUM_OFF_ETCHER_2, "23 - Vakuum Ätzer 2 ausschalten"),
|
||||||
|
new PLCJobentry(PLCJobenum.CHUCK_OPEN_ETCHER_1, "60 - Drehteller Ätzer 1 entriegeln"),
|
||||||
|
new PLCJobentry(PLCJobenum.CHUCK_OPEN_ETCHER_2, "61 - Drehteller Ätzer 2 entriegeln"),
|
||||||
|
new PLCJobentry(PLCJobenum.CHUCK_CLOSE_ETCHER_1, "62 - Drehteller Ätzer 1 verriegeln"),
|
||||||
|
new PLCJobentry(PLCJobenum.CHUCK_CLOSE_ETCHER_2, "63 - Drehteller Ätzer 2 verriegeln"),
|
||||||
|
];
|
||||||
|
|
||||||
|
private RobotJobentry selectedRobotJob;
|
||||||
|
public RobotJobentry SelectedRobotJob
|
||||||
|
{
|
||||||
|
get { return selectedRobotJob; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref selectedRobotJob, value);
|
||||||
|
CanChangeChuckMagazinPlace = (value == RobotJobs.First(i => i.eJob == RobotJobenum.PICK_CHUCK_MAGAZIN))
|
||||||
|
|| (value == RobotJobs.First(i => i.eJob == RobotJobenum.PUT_CHUCK_MAGAZIN));
|
||||||
|
CanChangeJobGrippType = value == RobotJobs.First(i => i.eJob == RobotJobenum.PICK_GRIPPER);
|
||||||
|
|
||||||
|
_adsManager?.WriteValue(sSelectedRobotJob, SelectedRobotJob.eJob);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private PLCJobentry selectedPLCJob;
|
||||||
|
|
||||||
|
|
||||||
|
private readonly IAdsManager? _adsManager;
|
||||||
|
|
||||||
|
public KukaRobotPageVM()
|
||||||
|
{
|
||||||
|
StartButton = new HMIControlButtonVM();
|
||||||
|
AbortButton = new HMIControlButtonVM();
|
||||||
|
selectedRobotJob = RobotJobs.First(i => i.eJob == RobotJobenum.WARMUP);
|
||||||
|
robotJobActiveValue = RobotJobs.First(i => i.eJob == RobotJobenum.PUT_HVTEST_COLD);
|
||||||
|
robotJobFinishedValue = RobotJobs.First(i => i.eJob == RobotJobenum.PICK_HOTPLATE);
|
||||||
|
selectedPLCJob = PLCJobs.First(i => i.eJob == PLCJobenum.NONE);
|
||||||
|
|
||||||
|
canChangeRobotJob = true;currentControlMode = new BMSControlModeEntry(E_BMS_CONTROL_MODE.MANUAL, "Manual");
|
||||||
|
KukaRobotPackMLControlVm = new PackMLControlVM();
|
||||||
|
|
||||||
|
KukaRobotPackMLControlVm.STitle = "Kuka Roboter";
|
||||||
|
}
|
||||||
|
|
||||||
|
public KukaRobotPageVM(IAdsManager adsManager)
|
||||||
|
{
|
||||||
|
_adsManager = adsManager;
|
||||||
|
|
||||||
|
StartButton = new HMIControlButtonVM(_adsManager, sStartRobotJob);
|
||||||
|
AbortButton = new HMIControlButtonVM(_adsManager, sAbortRobotJob);
|
||||||
|
currentControlMode = new BMSControlModeEntry(E_BMS_CONTROL_MODE.MANUAL, "Manual");
|
||||||
|
CurrentControlMode = new BMSControlModeEntry(E_BMS_CONTROL_MODE.MANUAL, "Manual");
|
||||||
|
|
||||||
|
selectedRobotJob = RobotJobs.First(i => i.eJob == RobotJobenum.NONE);
|
||||||
|
robotJobActiveValue = RobotJobs.First(i => i.eJob == RobotJobenum.NONE);
|
||||||
|
robotJobFinishedValue = RobotJobs.First(i => i.eJob == RobotJobenum.NONE);
|
||||||
|
selectedPLCJob = PLCJobs.First(i => i.eJob == PLCJobenum.NONE);
|
||||||
|
|
||||||
|
|
||||||
|
KukaRobotPackMLControlVm = new PackMLControlVM(_adsManager, "GVL_SCADA.stMachine.stKukaRobot.stStationCmds");
|
||||||
|
|
||||||
|
KukaRobotPackMLControlVm.STitle = "Kuka Roboter";
|
||||||
|
|
||||||
|
_adsManager.Register(sJobGrippSide, OnJobGrippSideValueChanged);
|
||||||
|
_adsManager.Register(sJobGrippType, OnJobGrippTypeValueChanged);
|
||||||
|
_adsManager.Register(sChuckMagazinPlace, OnChuckMagazinPlaceValueChanged);
|
||||||
|
_adsManager.Register(sPieceThickness, OnPieceThicknessValueChanged);
|
||||||
|
_adsManager.Register(sSelectedPLCJob, OnSelectedPLCJobValueChanged);
|
||||||
|
_adsManager.Register(sSelectedRobotJob, OnSelectedRobotJobValueChanged);
|
||||||
|
_adsManager.Register(sActiveRobotJob, OnActiveRobotJobValueChanged);
|
||||||
|
_adsManager.Register(sFinishedRobotJob, OnFinishedRobotJobValueChanged);
|
||||||
|
_adsManager.Register(sOffsetPick_X, OnOffsetPickXValueChanged);
|
||||||
|
_adsManager.Register(sOffsetPick_Y, OnOffsetPickYValueChanged);
|
||||||
|
_adsManager.Register(sCoolplateIndex, OnCoolPlateIndexValueChanged);
|
||||||
|
_adsManager.Register(sHotplateIndex, OnHotPlateIndexValueChanged);
|
||||||
|
_adsManager.Register(sOffsetNIOPlace_Y, OnOffsetNIOPlaceYValueChanged);
|
||||||
|
_adsManager.Register(sOffsetNIOPlace_X, OnOffsetNIOPlaceXValueChanged);
|
||||||
|
_adsManager.Register(sOffsetNIOPick_Y, OnOffsetNIOPickYValueChanged);
|
||||||
|
_adsManager.Register(sOffsetNIOPick_X, OnOffsetNIOPickXValueChanged);
|
||||||
|
_adsManager.Register(sOffsetPlace_Y, OnOffsetPlaceYValueChanged);
|
||||||
|
_adsManager.Register(sOffsetPlace_X, OnOffsetPlaceXValueChanged);
|
||||||
|
|
||||||
|
_adsManager.Register(sChuckOnPlace1, ChuckOnPlace1Changed);
|
||||||
|
_adsManager.Register(sChuckOnPlace2, ChuckOnPlace2Changed);
|
||||||
|
_adsManager.Register(sChuckOnPlace3, ChuckOnPlace3Changed);
|
||||||
|
_adsManager.Register(sChuckOnPlace4, ChuckOnPlace4Changed);
|
||||||
|
_adsManager.Register(sChuckOnPlace5, ChuckOnPlace5Changed);
|
||||||
|
_adsManager.Register(sChuckOnPlace6, ChuckOnPlace6Changed);
|
||||||
|
|
||||||
|
canChangeRobotJob = true;
|
||||||
|
canChangeJobGrippType = false;
|
||||||
|
|
||||||
|
canChangeChuckMagazinPlace = false;
|
||||||
|
canChangeJobGrippType = false;
|
||||||
|
|
||||||
|
_adsManager.Register("GVL_SCADA.eCurrentControlMode", CurrentControlModeChanged);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnJobGrippSideValueChanged(object sender, ValueChangedEventArgs e)
|
||||||
|
{
|
||||||
|
JobGrippSide = (byte)e.Value;
|
||||||
|
}
|
||||||
|
private void OnJobGrippTypeValueChanged(object sender, ValueChangedEventArgs e)
|
||||||
|
{
|
||||||
|
JobGrippType = (byte)e.Value;
|
||||||
|
}
|
||||||
|
private void OnChuckMagazinPlaceValueChanged(object sender, ValueChangedEventArgs e)
|
||||||
|
{
|
||||||
|
ChuckMagazinPlace = (byte)e.Value;
|
||||||
|
}
|
||||||
|
private void OnPieceThicknessValueChanged(object sender, ValueChangedEventArgs e)
|
||||||
|
{
|
||||||
|
PieceThickness = (int)e.Value;
|
||||||
|
}
|
||||||
|
private void OnSelectedPLCJobValueChanged(object sender, ValueChangedEventArgs e)
|
||||||
|
{
|
||||||
|
SelectedPLCJob = PLCJobs.First(i => (ushort)i.eJob == (ushort)e.Value);
|
||||||
|
}
|
||||||
|
private void OnSelectedRobotJobValueChanged(object sender, ValueChangedEventArgs e)
|
||||||
|
{
|
||||||
|
SelectedRobotJob = RobotJobs.First(i => (ushort)i.eJob == (ushort)e.Value);
|
||||||
|
}
|
||||||
|
private void OnActiveRobotJobValueChanged(object sender, ValueChangedEventArgs e)
|
||||||
|
{
|
||||||
|
RobotJobActiveValue = RobotJobs.First(i => (ushort)i.eJob == (ushort)e.Value);
|
||||||
|
}
|
||||||
|
private void OnFinishedRobotJobValueChanged(object sender, ValueChangedEventArgs e)
|
||||||
|
{
|
||||||
|
RobotJobFinishedValue = RobotJobs.First(i => (ushort)i.eJob == (ushort)e.Value);
|
||||||
|
}
|
||||||
|
private void OnHotPlateIndexValueChanged(object sender, ValueChangedEventArgs e)
|
||||||
|
{
|
||||||
|
HotplateIndex = (byte)e.Value;
|
||||||
|
}
|
||||||
|
private void OnCoolPlateIndexValueChanged(object sender, ValueChangedEventArgs e)
|
||||||
|
{
|
||||||
|
CoolplateIndex = (byte)e.Value;
|
||||||
|
}
|
||||||
|
private void OnOffsetPickXValueChanged(object sender, ValueChangedEventArgs e)
|
||||||
|
{
|
||||||
|
OffsetPick_X = (float)e.Value;
|
||||||
|
}
|
||||||
|
private void OnOffsetPickYValueChanged(object sender, ValueChangedEventArgs e)
|
||||||
|
{
|
||||||
|
OffsetPick_Y = (float)e.Value;
|
||||||
|
}
|
||||||
|
private void OnOffsetPlaceXValueChanged(object sender, ValueChangedEventArgs e)
|
||||||
|
{
|
||||||
|
OffsetPlace_X = (float)e.Value;
|
||||||
|
}
|
||||||
|
private void OnOffsetPlaceYValueChanged(object sender, ValueChangedEventArgs e)
|
||||||
|
{
|
||||||
|
OffsetPlace_Y = (float)e.Value;
|
||||||
|
}
|
||||||
|
private void OnOffsetNIOPickXValueChanged(object sender, ValueChangedEventArgs e)
|
||||||
|
{
|
||||||
|
OffsetNIOPick_X = (float)e.Value;
|
||||||
|
}
|
||||||
|
private void OnOffsetNIOPickYValueChanged(object sender, ValueChangedEventArgs e)
|
||||||
|
{
|
||||||
|
OffsetNIOPick_Y = (float)e.Value;
|
||||||
|
}
|
||||||
|
private void OnOffsetNIOPlaceXValueChanged(object sender, ValueChangedEventArgs e)
|
||||||
|
{
|
||||||
|
OffsetNIOPlace_X = (float)e.Value;
|
||||||
|
}
|
||||||
|
private void OnOffsetNIOPlaceYValueChanged(object sender, ValueChangedEventArgs e)
|
||||||
|
{
|
||||||
|
OffsetNIOPlace_Y = (float)e.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ChuckOnPlace1Changed(object? sender, ValueChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if ((bool)e.Value)
|
||||||
|
{
|
||||||
|
MagazinPlace1 = Visibility.Visible;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MagazinPlace1 = Visibility.Hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void ChuckOnPlace2Changed(object? sender, ValueChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if ((bool)e.Value)
|
||||||
|
{
|
||||||
|
MagazinPlace2 = Visibility.Visible;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MagazinPlace2 = Visibility.Hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void ChuckOnPlace3Changed(object? sender, ValueChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if ((bool)e.Value)
|
||||||
|
{
|
||||||
|
MagazinPlace3 = Visibility.Visible;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MagazinPlace3 = Visibility.Hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void ChuckOnPlace4Changed(object? sender, ValueChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if ((bool)e.Value)
|
||||||
|
{
|
||||||
|
MagazinPlace4 = Visibility.Visible;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MagazinPlace4 = Visibility.Hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void ChuckOnPlace5Changed(object? sender, ValueChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if ((bool)e.Value)
|
||||||
|
{
|
||||||
|
MagazinPlace5 = Visibility.Visible;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MagazinPlace5 = Visibility.Hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void ChuckOnPlace6Changed(object? sender, ValueChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if ((bool)e.Value)
|
||||||
|
{
|
||||||
|
MagazinPlace6 = Visibility.Visible;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MagazinPlace6 = Visibility.Hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
StartButton?.Dispose();
|
||||||
|
StartButton = null;
|
||||||
|
AbortButton?.Dispose();
|
||||||
|
AbortButton = null;
|
||||||
|
|
||||||
|
_adsManager?.Deregister(sJobGrippSide, OnJobGrippSideValueChanged);
|
||||||
|
_adsManager?.Deregister(sJobGrippType, OnJobGrippTypeValueChanged);
|
||||||
|
_adsManager?.Deregister(sChuckMagazinPlace, OnChuckMagazinPlaceValueChanged);
|
||||||
|
_adsManager?.Deregister(sPieceThickness, OnPieceThicknessValueChanged);
|
||||||
|
_adsManager?.Deregister(sSelectedPLCJob, OnSelectedPLCJobValueChanged);
|
||||||
|
_adsManager?.Deregister(sSelectedRobotJob, OnSelectedRobotJobValueChanged);
|
||||||
|
_adsManager?.Deregister(sActiveRobotJob, OnActiveRobotJobValueChanged);
|
||||||
|
_adsManager?.Deregister(sFinishedRobotJob, OnFinishedRobotJobValueChanged);
|
||||||
|
_adsManager?.Deregister(sOffsetPick_X, OnOffsetPickXValueChanged);
|
||||||
|
_adsManager?.Deregister(sOffsetPick_Y, OnOffsetPickYValueChanged);
|
||||||
|
_adsManager?.Deregister(sCoolplateIndex, OnCoolPlateIndexValueChanged);
|
||||||
|
_adsManager?.Deregister(sHotplateIndex, OnHotPlateIndexValueChanged);
|
||||||
|
_adsManager?.Deregister(sOffsetNIOPlace_Y, OnOffsetNIOPlaceYValueChanged);
|
||||||
|
_adsManager?.Deregister(sOffsetNIOPlace_X, OnOffsetNIOPlaceXValueChanged);
|
||||||
|
_adsManager?.Deregister(sOffsetNIOPick_Y, OnOffsetNIOPickYValueChanged);
|
||||||
|
_adsManager?.Deregister(sOffsetNIOPick_X, OnOffsetNIOPickXValueChanged);
|
||||||
|
_adsManager?.Deregister(sOffsetPlace_Y, OnOffsetPlaceYValueChanged);
|
||||||
|
_adsManager?.Deregister(sOffsetPlace_X, OnOffsetPlaceXValueChanged);
|
||||||
|
|
||||||
|
_adsManager?.Deregister(sChuckOnPlace1, ChuckOnPlace1Changed);
|
||||||
|
_adsManager?.Deregister(sChuckOnPlace2, ChuckOnPlace2Changed);
|
||||||
|
_adsManager?.Deregister(sChuckOnPlace3, ChuckOnPlace3Changed);
|
||||||
|
_adsManager?.Deregister(sChuckOnPlace4, ChuckOnPlace4Changed);
|
||||||
|
_adsManager?.Deregister(sChuckOnPlace5, ChuckOnPlace5Changed);
|
||||||
|
_adsManager?.Deregister(sChuckOnPlace6, ChuckOnPlace6Changed);
|
||||||
|
|
||||||
|
_adsManager?.Deregister("GVL_SCADA.eCurrentControlMode", CurrentControlModeChanged);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CurrentControlModeChanged(object? sender, ValueChangedEventArgs e)
|
||||||
|
{
|
||||||
|
bmsControlMode = (E_BMS_CONTROL_MODE)e.Value;
|
||||||
|
currentControlMode.eMode = bmsControlMode;
|
||||||
|
currentControlMode.Name = "Test";
|
||||||
|
ccmChanged();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ccmChanged()
|
||||||
|
{
|
||||||
|
if (currentControlMode.eMode == E_BMS_CONTROL_MODE.MANUAL)
|
||||||
|
{
|
||||||
|
CanChangeCoolPlateIndex = true;
|
||||||
|
CanChangeHotPlateIndex = true;
|
||||||
|
CanChangeOffsetNIOPick = true;
|
||||||
|
CanChangeOffsetNIOPlace = true;
|
||||||
|
CanChangeOffsetPick = true;
|
||||||
|
CanChangeOffsetPlace = true;
|
||||||
|
CanChangePieceThickness = true;
|
||||||
|
CanChangeRobotJob = true;
|
||||||
|
CanChangeJobGrippSide = true;
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CanChangeCoolPlateIndex = false;
|
||||||
|
CanChangeHotPlateIndex = false;
|
||||||
|
CanChangeOffsetNIOPick = false;
|
||||||
|
CanChangeOffsetNIOPlace = false;
|
||||||
|
CanChangeOffsetPick = false;
|
||||||
|
CanChangeOffsetPlace = false;
|
||||||
|
CanChangePieceThickness = false;
|
||||||
|
CanChangeRobotJob = false;
|
||||||
|
CanChangeJobGrippSide = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private void ClearState()
|
||||||
|
{
|
||||||
|
_adsManager?.WriteValue(sClearState, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private void ResetState()
|
||||||
|
{
|
||||||
|
_adsManager?.WriteValue(sResetState, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private void StartRobotJob()
|
||||||
|
{
|
||||||
|
_adsManager?.WriteValue(sStartRobotJob, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private void AbortRobotJob()
|
||||||
|
{
|
||||||
|
_adsManager?.WriteValue(sAbortRobotJob, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
93
uniper_hmi/UniperHMI/Pages/ViewModels/MediaCabinetPageVM.cs
Normal file
93
uniper_hmi/UniperHMI/Pages/ViewModels/MediaCabinetPageVM.cs
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using Heisig.HMI.AdsManager;
|
||||||
|
using Common;
|
||||||
|
|
||||||
|
namespace InfineonHMI;
|
||||||
|
|
||||||
|
public sealed partial class MediaCabinetPageVM : ObservableValidator, IDisposable
|
||||||
|
{
|
||||||
|
|
||||||
|
private IAdsManager _adsManager;
|
||||||
|
private string? _variableName;
|
||||||
|
|
||||||
|
[ObservableProperty] private MediaContainerVm container1Vm;
|
||||||
|
[ObservableProperty] private MediaContainerVm container2Vm;
|
||||||
|
[ObservableProperty] private MediaContainerVm container3Vm;
|
||||||
|
[ObservableProperty] private MediaContainerVm container4Vm;
|
||||||
|
[ObservableProperty] private MediaContainerVm container5Vm;
|
||||||
|
[ObservableProperty] private MediaContainerVm container6Vm;
|
||||||
|
[ObservableProperty] private MediaContainerVm container7Vm;
|
||||||
|
[ObservableProperty] private MediaContainerVm container8Vm;
|
||||||
|
[ObservableProperty] private MediaContainerVm container9Vm;
|
||||||
|
|
||||||
|
|
||||||
|
public MediaCabinetPageVM(IAdsManager adsManager, string variableName)
|
||||||
|
{
|
||||||
|
_adsManager = adsManager;
|
||||||
|
_variableName = variableName;
|
||||||
|
|
||||||
|
Container1Vm = new MediaContainerVm(adsManager, variableName + ".stTankAceticAcidHigh");
|
||||||
|
Container2Vm = new MediaContainerVm(adsManager, variableName + ".stTankSulfuricAcid");
|
||||||
|
Container3Vm = new MediaContainerVm(adsManager, variableName + ".stTankNitricAcid");
|
||||||
|
Container4Vm = new MediaContainerVm(adsManager, variableName + ".stTankAceticAcidLow");
|
||||||
|
Container5Vm = new MediaContainerVm(adsManager, variableName + ".stTankHydrofluoricAcid");
|
||||||
|
Container6Vm = new MediaContainerVm(adsManager, variableName + ".stTankSulfuricAcidMixing");
|
||||||
|
Container7Vm = new MediaContainerVm(adsManager, variableName + ".stTankHydrofluoricAcidMixing");
|
||||||
|
Container8Vm = new MediaContainerVm(adsManager, variableName + ".stTankSEF");
|
||||||
|
Container9Vm = new MediaContainerVm(adsManager, variableName + ".stTankFilmetch");
|
||||||
|
|
||||||
|
|
||||||
|
Container1Vm.SName = "(1) Acetic acid 99%";
|
||||||
|
Container2Vm.SName = "(2) Sulfuric acid";
|
||||||
|
Container3Vm.SName = "(3) Nitric acid";
|
||||||
|
Container4Vm.SName = "(4) Acetic acid 10%";
|
||||||
|
Container5Vm.SName = "(5) Hydrofluoric acid";
|
||||||
|
Container6Vm.SName = "(6) Sulfuric acid";
|
||||||
|
Container7Vm.SName = "(7) Hydrofluoric acid";
|
||||||
|
Container8Vm.SName = "(8) SEF";
|
||||||
|
Container9Vm.SName = "(9) Filmetch";
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public MediaCabinetPageVM()
|
||||||
|
{
|
||||||
|
Container1Vm = new MediaContainerVm();
|
||||||
|
Container2Vm = new MediaContainerVm();
|
||||||
|
Container3Vm = new MediaContainerVm();
|
||||||
|
Container4Vm = new MediaContainerVm();
|
||||||
|
Container5Vm = new MediaContainerVm();
|
||||||
|
Container6Vm = new MediaContainerVm();
|
||||||
|
Container7Vm = new MediaContainerVm();
|
||||||
|
Container8Vm = new MediaContainerVm();
|
||||||
|
Container9Vm = new MediaContainerVm();
|
||||||
|
|
||||||
|
|
||||||
|
Container1Vm.SName = "(1) Acetic acid 99%";
|
||||||
|
Container2Vm.SName = "(2) Sulfuric acid";
|
||||||
|
Container3Vm.SName = "(3) Nitric acid";
|
||||||
|
Container4Vm.SName = "(4) Acetic acid 10%";
|
||||||
|
Container5Vm.SName = "(5) Hydrofluoric acid";
|
||||||
|
Container6Vm.SName = "(6) Sulfuric acid";
|
||||||
|
Container7Vm.SName = "(7) Hydrofluoric acid";
|
||||||
|
Container8Vm.SName = "(8) SEF";
|
||||||
|
Container9Vm.SName = "(9) Filmetch";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
|
||||||
|
Container1Vm.Dispose();
|
||||||
|
Container2Vm.Dispose();
|
||||||
|
Container3Vm.Dispose();
|
||||||
|
Container4Vm.Dispose();
|
||||||
|
Container5Vm.Dispose();
|
||||||
|
Container6Vm.Dispose();
|
||||||
|
Container7Vm.Dispose();
|
||||||
|
Container8Vm.Dispose();
|
||||||
|
Container9Vm.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,69 +0,0 @@
|
|||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
|
||||||
using CommunityToolkit.Mvvm.Input;
|
|
||||||
using CommunityToolkit.Mvvm.Messaging;
|
|
||||||
using Heisig.HMI.AdsManager;
|
|
||||||
using UniperHMI.OwnControls;
|
|
||||||
|
|
||||||
namespace UniperHMI
|
|
||||||
{
|
|
||||||
public sealed partial class ModuleOverviewPageVM : ObservableObject, IDisposable
|
|
||||||
{
|
|
||||||
[ObservableProperty]
|
|
||||||
private UnitControlButtonVM unit1;
|
|
||||||
|
|
||||||
[ObservableProperty]
|
|
||||||
private UnitControlButtonVM unit2;
|
|
||||||
|
|
||||||
[ObservableProperty]
|
|
||||||
private UnitControlButtonVM unit3;
|
|
||||||
|
|
||||||
[ObservableProperty]
|
|
||||||
private UnitControlButtonVM unit4;
|
|
||||||
|
|
||||||
private readonly IAdsManager? _adsManager;
|
|
||||||
private readonly string? _variableName;
|
|
||||||
|
|
||||||
public ModuleOverviewPageVM(IAdsManager adsManager, string variableName)
|
|
||||||
{
|
|
||||||
_adsManager = adsManager;
|
|
||||||
_variableName = variableName;
|
|
||||||
|
|
||||||
unit1 = new(_adsManager, _variableName + ".stHMIInterfaceUnit1");
|
|
||||||
unit2 = new(_adsManager, _variableName + ".stHMIInterfaceUnit2");
|
|
||||||
unit3 = new(_adsManager, _variableName + ".stHMIInterfaceUnit3");
|
|
||||||
unit4 = new(_adsManager, _variableName + ".stHMIInterfaceUnit4");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
Unit1?.Dispose();
|
|
||||||
Unit2?.Dispose();
|
|
||||||
Unit3?.Dispose();
|
|
||||||
Unit4?.Dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
[RelayCommand]
|
|
||||||
public void Unit1Clicked()
|
|
||||||
{
|
|
||||||
WeakReferenceMessenger.Default.Send(new NavigateMessage(_variableName + ".stHMIInterfaceUnit1", typeof(UnitOverviewPage), "Unit 1"));
|
|
||||||
}
|
|
||||||
|
|
||||||
[RelayCommand]
|
|
||||||
public void Unit2Clicked()
|
|
||||||
{
|
|
||||||
WeakReferenceMessenger.Default.Send(new NavigateMessage(_variableName + ".stHMIInterfaceUnit2", typeof(UnitOverviewPage), "Unit 2"));
|
|
||||||
}
|
|
||||||
|
|
||||||
[RelayCommand]
|
|
||||||
public void Unit3Clicked()
|
|
||||||
{
|
|
||||||
WeakReferenceMessenger.Default.Send(new NavigateMessage(_variableName + ".stHMIInterfaceUnit3", typeof(UnitOverviewPage), "Unit 3"));
|
|
||||||
}
|
|
||||||
|
|
||||||
[RelayCommand]
|
|
||||||
public void Unit4Clicked()
|
|
||||||
{
|
|
||||||
WeakReferenceMessenger.Default.Send(new NavigateMessage(_variableName + ".stHMIInterfaceUnit4", typeof(UnitOverviewPage), "Unit 4"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
66
uniper_hmi/UniperHMI/Pages/ViewModels/NIOStationPageVM.cs
Normal file
66
uniper_hmi/UniperHMI/Pages/ViewModels/NIOStationPageVM.cs
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using HMIToolkit;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using Heisig.HMI.AdsManager;
|
||||||
|
using CommunityToolkit.Mvvm.Input;
|
||||||
|
using TwinCAT.TypeSystem;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using Common;
|
||||||
|
using InfineonHMI.Model;
|
||||||
|
namespace InfineonHMI;
|
||||||
|
|
||||||
|
public sealed partial class NIOStationPageVM : ObservableValidator, IDisposable
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
private readonly string? _variableName;
|
||||||
|
|
||||||
|
private readonly IAdsManager? _adsManager;
|
||||||
|
|
||||||
|
[ObservableProperty] private BinaryValveControlVM clampDiagValveVm;
|
||||||
|
|
||||||
|
[ObservableProperty] private BinaryValveControlVM clampAcrossValveVm;
|
||||||
|
|
||||||
|
[ObservableProperty] private HMIControlButtonVM clampCmdButtonVm;
|
||||||
|
|
||||||
|
[ObservableProperty] private HMIControlButtonVM unclampCmdButtonVm;
|
||||||
|
|
||||||
|
[ObservableProperty] private PackMLControlVM? nIOStationPackMLControlVm;
|
||||||
|
|
||||||
|
|
||||||
|
public NIOStationPageVM()
|
||||||
|
{
|
||||||
|
ClampDiagValveVm = new BinaryValveControlVM();
|
||||||
|
ClampAcrossValveVm = new BinaryValveControlVM();
|
||||||
|
ClampCmdButtonVm = new HMIControlButtonVM();
|
||||||
|
UnclampCmdButtonVm = new HMIControlButtonVM();
|
||||||
|
NIOStationPackMLControlVm = new();
|
||||||
|
NIOStationPackMLControlVm.STitle = "NIO Station";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public NIOStationPageVM(IAdsManager adsManager, string variableName)
|
||||||
|
{
|
||||||
|
_adsManager = adsManager;
|
||||||
|
_variableName = variableName;
|
||||||
|
|
||||||
|
ClampDiagValveVm = new BinaryValveControlVM(_adsManager, _variableName + ".stClampDiagValve");
|
||||||
|
ClampAcrossValveVm = new BinaryValveControlVM(_adsManager, _variableName + ".stClampAcrossValve");
|
||||||
|
ClampCmdButtonVm = new HMIControlButtonVM(_adsManager, _variableName + ".stClampCmd");
|
||||||
|
UnclampCmdButtonVm = new HMIControlButtonVM(_adsManager, _variableName + "stUnclampCmd");
|
||||||
|
|
||||||
|
NIOStationPackMLControlVm = new(_adsManager, _variableName + ".stStationCmds");
|
||||||
|
NIOStationPackMLControlVm.STitle = "NIO Station";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
ClampDiagValveVm.Dispose();
|
||||||
|
ClampAcrossValveVm.Dispose();
|
||||||
|
ClampCmdButtonVm.Dispose();
|
||||||
|
UnclampCmdButtonVm.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
177
uniper_hmi/UniperHMI/Pages/ViewModels/OverviewPageVM.cs
Normal file
177
uniper_hmi/UniperHMI/Pages/ViewModels/OverviewPageVM.cs
Normal file
@@ -0,0 +1,177 @@
|
|||||||
|
using Common;
|
||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using CommunityToolkit.Mvvm.Input;
|
||||||
|
using Heisig.HMI.AdsManager;
|
||||||
|
using InfineonHMI.Common;
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
namespace InfineonHMI;
|
||||||
|
|
||||||
|
public sealed partial class OverviewPageVM : ObservableValidator, IDisposable
|
||||||
|
{
|
||||||
|
[ObservableProperty] private PackMLControlVM machinePackMLControlVM;
|
||||||
|
|
||||||
|
private User currentUser;
|
||||||
|
private MainWindowVM _mainVm;
|
||||||
|
private readonly IAdsManager _adsManager;
|
||||||
|
private readonly IConfiguration _config;
|
||||||
|
|
||||||
|
public bool CanUserChangePageAlignment
|
||||||
|
{
|
||||||
|
get { return currentUser.UserLevel > 50; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CanUserChangePageEtching1
|
||||||
|
{
|
||||||
|
get { return currentUser.UserLevel > 50; }
|
||||||
|
}
|
||||||
|
public bool CanUserChangePageEtching2
|
||||||
|
{
|
||||||
|
get { return currentUser.UserLevel > 50; }
|
||||||
|
}
|
||||||
|
public bool CanUserChangePageHighVoltage
|
||||||
|
{
|
||||||
|
get { return currentUser.UserLevel > 50; }
|
||||||
|
}
|
||||||
|
public bool CanUserChangePageHotCoolplate
|
||||||
|
{
|
||||||
|
get { return currentUser.UserLevel > 50; }
|
||||||
|
}
|
||||||
|
public bool CanUserChangePageKukaRobot
|
||||||
|
{
|
||||||
|
get { return currentUser.UserLevel > 50; }
|
||||||
|
}
|
||||||
|
public bool CanUserChangePageMediaCabinet
|
||||||
|
{
|
||||||
|
get { return currentUser.UserLevel > 50; }
|
||||||
|
}
|
||||||
|
public bool CanUserChangePageNIOStation
|
||||||
|
{
|
||||||
|
get { return currentUser.UserLevel > 50; }
|
||||||
|
}
|
||||||
|
public bool CanUserChangePageProductionOverview
|
||||||
|
{
|
||||||
|
get { return currentUser.UserLevel > 50; }
|
||||||
|
}
|
||||||
|
public bool CanUserChangePageReceipe
|
||||||
|
{
|
||||||
|
get { return currentUser.UserLevel == 100; }
|
||||||
|
}
|
||||||
|
public bool CanUserChangePageTrayFeeder
|
||||||
|
{
|
||||||
|
get { return currentUser.UserLevel > 50; }
|
||||||
|
}
|
||||||
|
public bool CanUserChangeMachineState
|
||||||
|
{
|
||||||
|
get { return currentUser.UserLevel > 50; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public OverviewPageVM()
|
||||||
|
{
|
||||||
|
// default ctor
|
||||||
|
MachinePackMLControlVM = new();
|
||||||
|
MachinePackMLControlVM.STitle = "Betriebszustand\n Gesamtanlage";
|
||||||
|
|
||||||
|
currentUser = Users.getCurrentUser();
|
||||||
|
}
|
||||||
|
|
||||||
|
public OverviewPageVM(IAdsManager adsManager, string variableName)
|
||||||
|
{
|
||||||
|
_adsManager = adsManager;
|
||||||
|
currentUser = Users.getCurrentUser();
|
||||||
|
MachinePackMLControlVM = new(_adsManager, "GVL_SCADA.stMachine.stMachineCmds");
|
||||||
|
|
||||||
|
MachinePackMLControlVM.STitle = "Betriebszustand\n Gesamtanlage";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
public void TrayfeederPageClicked()
|
||||||
|
{
|
||||||
|
|
||||||
|
NavigateMessage message = new("", typeof(ProductionOverviewPage));
|
||||||
|
NavigateMessage nextMessage = new("", typeof(TrayFeederPage));
|
||||||
|
this.Dispose();
|
||||||
|
_mainVm?.NavigateFromOuterPage(message, nextMessage);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
public void AlignerPageClicked()
|
||||||
|
{
|
||||||
|
NavigateMessage message = new("", typeof(ProductionOverviewPage));
|
||||||
|
NavigateMessage nextMessage = new("", typeof(AlignmentStationPage));
|
||||||
|
this.Dispose();
|
||||||
|
_mainVm?.NavigateFromOuterPage(message, nextMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
public void Etching1PageClicked()
|
||||||
|
{
|
||||||
|
NavigateMessage message = new("", typeof(ProductionOverviewPage));
|
||||||
|
NavigateMessage nextMessage = new("", typeof(EtchingStation1Page));
|
||||||
|
this.Dispose();
|
||||||
|
_mainVm?.NavigateFromOuterPage(message, nextMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
public void Etching2PageClicked()
|
||||||
|
{
|
||||||
|
NavigateMessage message = new("", typeof(ProductionOverviewPage));
|
||||||
|
NavigateMessage nextMessage = new("", typeof(EtchingStation2Page));
|
||||||
|
this.Dispose();
|
||||||
|
_mainVm?.NavigateFromOuterPage(message, nextMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
public void HVTestPageClicked()
|
||||||
|
{
|
||||||
|
NavigateMessage message = new("", typeof(ProductionOverviewPage));
|
||||||
|
NavigateMessage nextMessage = new("", typeof(HighVoltageStationPage));
|
||||||
|
this.Dispose();
|
||||||
|
_mainVm?.NavigateFromOuterPage(message, nextMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
public void HotCoolplatePageClicked()
|
||||||
|
{
|
||||||
|
NavigateMessage message = new("", typeof(ProductionOverviewPage));
|
||||||
|
NavigateMessage nextMessage = new("", typeof(HotCoolPlatePage));
|
||||||
|
this.Dispose();
|
||||||
|
_mainVm?.NavigateFromOuterPage(message, nextMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
public void NIOStationPageClicked()
|
||||||
|
{
|
||||||
|
NavigateMessage message = new("", typeof(ProductionOverviewPage));
|
||||||
|
NavigateMessage nextMessage = new("", typeof(NIOStationPage));
|
||||||
|
this.Dispose();
|
||||||
|
_mainVm?.NavigateFromOuterPage(message, nextMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
public void KukaPageClicked()
|
||||||
|
{
|
||||||
|
NavigateMessage message = new("", typeof(ProductionOverviewPage));
|
||||||
|
NavigateMessage nextMessage = new("", typeof(KukaRobotPage));
|
||||||
|
this.Dispose();
|
||||||
|
_mainVm?.NavigateFromOuterPage(message, nextMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
public void MediaCabinetPageClicked()
|
||||||
|
{
|
||||||
|
NavigateMessage message = new("", typeof(ProductionOverviewPage));
|
||||||
|
NavigateMessage nextMessage = new("", typeof(MediaCabinetPage));
|
||||||
|
this.Dispose();
|
||||||
|
_mainVm?.NavigateFromOuterPage(message, nextMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,410 @@
|
|||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using CommunityToolkit.Mvvm.Input;
|
||||||
|
using CommunityToolkit.Mvvm.Messaging;
|
||||||
|
using Heisig.HMI.AdsManager;
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using InfineonHMI.Common;
|
||||||
|
using TcEventLoggerAdsProxyLib;
|
||||||
|
using System.ComponentModel;
|
||||||
|
|
||||||
|
namespace InfineonHMI;
|
||||||
|
|
||||||
|
public sealed partial class ProductionOverviewPageVM : ObservableObject, IRecipient<NavigateMessage>, IDisposable, INotifyPropertyChanged
|
||||||
|
{
|
||||||
|
|
||||||
|
[ObservableProperty] private StringControlButtonVM dummyStringVM;
|
||||||
|
|
||||||
|
[ObservableProperty] private Page currentDetailPage;
|
||||||
|
|
||||||
|
[ObservableProperty] private bool canNavigateBack;
|
||||||
|
|
||||||
|
private readonly IAdsManager _adsManager;
|
||||||
|
private readonly IConfiguration _config;
|
||||||
|
private readonly TcEventLogger _eventlogger;
|
||||||
|
|
||||||
|
private User currentUser;
|
||||||
|
|
||||||
|
// Last active event
|
||||||
|
[ObservableProperty] private string currentActiveEvent = "";
|
||||||
|
|
||||||
|
private readonly object _lock = new();
|
||||||
|
|
||||||
|
// Empty page
|
||||||
|
private readonly Page _emptyPage;
|
||||||
|
|
||||||
|
// Last navigate message
|
||||||
|
private readonly Stack<NavigateMessage> _messageStack = new();
|
||||||
|
NavigateMessage? _currentMessage;
|
||||||
|
|
||||||
|
// Hot Coolplate page view model
|
||||||
|
HotCoolPlatePageVM? _hotCoolplatePageVM;
|
||||||
|
|
||||||
|
AlignmentStationPageVM? _alignmentStationPageVM;
|
||||||
|
|
||||||
|
EtchingStation1PageVM? _etchingStation1PageVm;
|
||||||
|
|
||||||
|
EtchingStation2PageVM? _etchingStation2PageVm;
|
||||||
|
|
||||||
|
HighVoltageStationPageVM? _highVoltageStationPageVm;
|
||||||
|
|
||||||
|
MediaCabinetPageVM? _mediaCabinetPageVM;
|
||||||
|
|
||||||
|
NIOStationPageVM? _nioStationPageVm;
|
||||||
|
|
||||||
|
TrayFeederPageVM? _trayFeederPageVm;
|
||||||
|
|
||||||
|
OverviewPageVM? _overviewPageVM;
|
||||||
|
|
||||||
|
public bool IsOverview
|
||||||
|
{
|
||||||
|
get => (OverviewPage)currentDetailPage != null;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value)
|
||||||
|
OverviewPageClicked();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsTrayFeeder
|
||||||
|
{
|
||||||
|
get => (TrayFeederPage)currentDetailPage != null;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if(value)
|
||||||
|
TrayfeederPageClicked();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsAligner
|
||||||
|
{
|
||||||
|
get => (AlignmentStationPage)currentDetailPage != null;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value)
|
||||||
|
AlignerPageClicked();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsHVTest
|
||||||
|
{
|
||||||
|
get => (HighVoltageStationPage)currentDetailPage != null;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value)
|
||||||
|
HVTestPageClicked();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsEtchingStation1
|
||||||
|
{
|
||||||
|
get => (EtchingStation1Page)currentDetailPage != null;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value)
|
||||||
|
Etching1PageClicked();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsEtchingStation2
|
||||||
|
{
|
||||||
|
get => (EtchingStation2Page)currentDetailPage != null;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value)
|
||||||
|
Etching2PageClicked();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsHotCoolPlate
|
||||||
|
{
|
||||||
|
get => (HotCoolPlatePage)currentDetailPage != null;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value)
|
||||||
|
HotCoolplatePageClicked();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsKukaRobot
|
||||||
|
{
|
||||||
|
get => (KukaRobotPage)currentDetailPage != null;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value)
|
||||||
|
KukaPageClicked();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsNioStation
|
||||||
|
{
|
||||||
|
get => (NIOStationPage)currentDetailPage != null;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value)
|
||||||
|
NIOStationPageClicked();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public bool IsMediaCabinet
|
||||||
|
{
|
||||||
|
get => (MediaCabinetPage)currentDetailPage != null;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value)
|
||||||
|
MediaCabinetPageClicked();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Kuka Robot page view model
|
||||||
|
KukaRobotPageVM? _kukaRobotPageVM;
|
||||||
|
private bool isTrayFeeder;
|
||||||
|
|
||||||
|
public ProductionOverviewPageVM()
|
||||||
|
{
|
||||||
|
// default ctor
|
||||||
|
currentUser = Users.getCurrentUser();
|
||||||
|
}
|
||||||
|
public ProductionOverviewPageVM(IAdsManager adsManager, IConfiguration config, TcEventLogger eventLogger, NavigateMessage? message = null)
|
||||||
|
{
|
||||||
|
_adsManager = adsManager;
|
||||||
|
_config = config;
|
||||||
|
// Create dummy string
|
||||||
|
DummyStringVM = new StringControlButtonVM();
|
||||||
|
currentUser = Users.getCurrentUser();
|
||||||
|
// Create empty page
|
||||||
|
_emptyPage = new();
|
||||||
|
|
||||||
|
CurrentDetailPage = _emptyPage;
|
||||||
|
_currentMessage = new NavigateMessage("", typeof(Page));
|
||||||
|
_messageStack.Push(_currentMessage);
|
||||||
|
|
||||||
|
if (message != null)
|
||||||
|
{
|
||||||
|
Receive(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
WeakReferenceMessenger.Default.Register<NavigateMessage>(this);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
public void TrayfeederPageClicked()
|
||||||
|
{
|
||||||
|
_messageStack.Clear();
|
||||||
|
_currentMessage = new NavigateMessage("", typeof(Page));
|
||||||
|
NavigateMessage message = new(_config["TrayFeederVarName"]!, typeof(TrayFeederPage));
|
||||||
|
Receive(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
public void AlignerPageClicked()
|
||||||
|
{
|
||||||
|
_messageStack.Clear();
|
||||||
|
_currentMessage = new NavigateMessage("", typeof(Page));
|
||||||
|
NavigateMessage message = new(_config["AlignerVarName"]!, typeof(AlignmentStationPage));
|
||||||
|
Receive(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
public void Etching1PageClicked()
|
||||||
|
{
|
||||||
|
_messageStack.Clear();
|
||||||
|
_currentMessage = new NavigateMessage("", typeof(Page));
|
||||||
|
NavigateMessage message = new(_config["Etching1VarName"]!, typeof(EtchingStation1Page));
|
||||||
|
Receive(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
public void Etching2PageClicked()
|
||||||
|
{
|
||||||
|
_messageStack.Clear();
|
||||||
|
_currentMessage = new NavigateMessage("", typeof(Page));
|
||||||
|
NavigateMessage message = new(_config["Etching2VarName"]!, typeof(EtchingStation2Page));
|
||||||
|
Receive(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
public void HVTestPageClicked()
|
||||||
|
{
|
||||||
|
_messageStack.Clear();
|
||||||
|
_currentMessage = new NavigateMessage("", typeof(Page));
|
||||||
|
NavigateMessage message = new(_config["HVTestVarName"]!, typeof(HighVoltageStationPage));
|
||||||
|
Receive(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
public void HotCoolplatePageClicked()
|
||||||
|
{
|
||||||
|
_messageStack.Clear();
|
||||||
|
_currentMessage = new NavigateMessage("", typeof(Page));
|
||||||
|
NavigateMessage message = new(_config["HotCoolplateVarName"]!, typeof(HotCoolPlatePage));
|
||||||
|
Receive(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
public void NIOStationPageClicked()
|
||||||
|
{
|
||||||
|
_messageStack.Clear();
|
||||||
|
_currentMessage = new NavigateMessage("", typeof(Page));
|
||||||
|
NavigateMessage message = new(_config["NIOStationVarName"]!, typeof(NIOStationPage));
|
||||||
|
Receive(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
public void OverviewPageClicked()
|
||||||
|
{
|
||||||
|
_messageStack.Clear();
|
||||||
|
_currentMessage = new NavigateMessage("", typeof(Page));
|
||||||
|
NavigateMessage message = new(_config["OverviewVarName"]!, typeof(OverviewPage));
|
||||||
|
Receive(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
public void KukaPageClicked()
|
||||||
|
{
|
||||||
|
_messageStack.Clear();
|
||||||
|
_currentMessage = new NavigateMessage("", typeof(Page));
|
||||||
|
NavigateMessage message = new(_config["KukaRobotVarName"]!, typeof(KukaRobotPage));
|
||||||
|
Receive(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
public void MediaCabinetPageClicked()
|
||||||
|
{
|
||||||
|
_messageStack.Clear();
|
||||||
|
_currentMessage = new NavigateMessage("", typeof(Page));
|
||||||
|
NavigateMessage message = new(_config["MediaCabinetVarName"]!, typeof(MediaCabinetPage));
|
||||||
|
Receive(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only use for forward traversal!
|
||||||
|
public void Receive(NavigateMessage message)
|
||||||
|
{
|
||||||
|
// Only change page if its a new page type
|
||||||
|
if (CurrentDetailPage.GetType() == message.type)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Push current message
|
||||||
|
if (_currentMessage != null)
|
||||||
|
_messageStack.Push(_currentMessage);
|
||||||
|
|
||||||
|
// Save current message for later push
|
||||||
|
_currentMessage = message;
|
||||||
|
|
||||||
|
// Set can navigate back
|
||||||
|
CanNavigateBack = true;
|
||||||
|
|
||||||
|
Navigate(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void NavigateFromOuterPage(NavigateMessage message)
|
||||||
|
{
|
||||||
|
_currentMessage = message;
|
||||||
|
|
||||||
|
CanNavigateBack = true;
|
||||||
|
Navigate(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Navigate(NavigateMessage message)
|
||||||
|
{
|
||||||
|
// Dispose current pages viewmodel
|
||||||
|
if (CurrentDetailPage.DataContext is IDisposable viewModel)
|
||||||
|
{
|
||||||
|
CurrentDetailPage.DataContext = null;
|
||||||
|
viewModel.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create new page
|
||||||
|
switch (message.type.Name)
|
||||||
|
{
|
||||||
|
case nameof(OverviewPage):
|
||||||
|
_overviewPageVM ??= OverviewPage.CreateModel(_adsManager);
|
||||||
|
CurrentDetailPage = OverviewPage.CreateView(_overviewPageVM);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case nameof(TrayFeederPage):
|
||||||
|
_trayFeederPageVm ??= TrayFeederPage.CreateModel(_adsManager);
|
||||||
|
CurrentDetailPage = TrayFeederPage.CreateView(_trayFeederPageVm);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case nameof(AlignmentStationPage):
|
||||||
|
// Create seetings page view model only once
|
||||||
|
|
||||||
|
_alignmentStationPageVM ??= AlignmentStationPage.CreateModel(_adsManager);
|
||||||
|
CurrentDetailPage = AlignmentStationPage.CreateView(_alignmentStationPageVM);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case nameof(EtchingStation1Page):
|
||||||
|
|
||||||
|
_etchingStation1PageVm ??= EtchingStation1Page.CreateModel(_adsManager);
|
||||||
|
CurrentDetailPage = EtchingStation1Page.CreateView(_etchingStation1PageVm);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case nameof(EtchingStation2Page):
|
||||||
|
|
||||||
|
_etchingStation2PageVm ??= EtchingStation2Page.CreateModel(_adsManager);
|
||||||
|
CurrentDetailPage = EtchingStation2Page.CreateView(_etchingStation2PageVm);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case nameof(HighVoltageStationPage):
|
||||||
|
|
||||||
|
_highVoltageStationPageVm ??= HighVoltageStationPage.CreateModel(_adsManager);
|
||||||
|
CurrentDetailPage = HighVoltageStationPage.CreateView(_highVoltageStationPageVm);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case nameof(HotCoolPlatePage):
|
||||||
|
|
||||||
|
_hotCoolplatePageVM ??= HotCoolPlatePage.CreateModel(_adsManager);
|
||||||
|
CurrentDetailPage = HotCoolPlatePage.CreateView(_hotCoolplatePageVM);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case nameof(NIOStationPage):
|
||||||
|
|
||||||
|
_nioStationPageVm ??= NIOStationPage.CreateModel(_adsManager);
|
||||||
|
CurrentDetailPage = NIOStationPage.CreateView(_nioStationPageVm);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case nameof(KukaRobotPage):
|
||||||
|
|
||||||
|
// Create page view model only once
|
||||||
|
_kukaRobotPageVM??= KukaRobotPage.CreateModel(_adsManager);
|
||||||
|
CurrentDetailPage = KukaRobotPage.CreateView(_kukaRobotPageVM);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case nameof(MediaCabinetPage)://TODO not Implemented on PLC yet
|
||||||
|
|
||||||
|
_mediaCabinetPageVM ??= MediaCabinetPage.CreateModel(_adsManager);
|
||||||
|
CurrentDetailPage = MediaCabinetPage.CreateView(_mediaCabinetPageVM);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
OnPropertyChanged(nameof(IsTrayFeeder));
|
||||||
|
OnPropertyChanged(nameof(IsHVTest));
|
||||||
|
OnPropertyChanged(nameof(IsAligner));
|
||||||
|
OnPropertyChanged(nameof(IsEtchingStation1));
|
||||||
|
OnPropertyChanged(nameof(IsEtchingStation2));
|
||||||
|
OnPropertyChanged(nameof(IsHotCoolPlate));
|
||||||
|
OnPropertyChanged(nameof(IsMediaCabinet));
|
||||||
|
OnPropertyChanged(nameof(IsKukaRobot));
|
||||||
|
OnPropertyChanged(nameof(IsNioStation));
|
||||||
|
OnPropertyChanged(nameof(IsOverview));
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private void AckAlarms()
|
||||||
|
{
|
||||||
|
_adsManager.WriteValue("GVL_SCADA.stConfirmAlarmsBtn.xRequest", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
// Dispose current pages viewmodel
|
||||||
|
if (CurrentDetailPage.DataContext is IDisposable viewModel)
|
||||||
|
{
|
||||||
|
CurrentDetailPage.DataContext = null;
|
||||||
|
viewModel.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
DummyStringVM.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
1113
uniper_hmi/UniperHMI/Pages/ViewModels/ReceipePageVM.cs
Normal file
1113
uniper_hmi/UniperHMI/Pages/ViewModels/ReceipePageVM.cs
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,56 +0,0 @@
|
|||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
|
||||||
using CommunityToolkit.Mvvm.Input;
|
|
||||||
using CommunityToolkit.Mvvm.Messaging;
|
|
||||||
using Heisig.HMI.AdsManager;
|
|
||||||
|
|
||||||
namespace UniperHMI;
|
|
||||||
|
|
||||||
public sealed partial class StringOverviewPageVM : ObservableObject, IDisposable
|
|
||||||
{
|
|
||||||
[ObservableProperty]
|
|
||||||
private ModuleControlButtonVM module1;
|
|
||||||
|
|
||||||
[ObservableProperty]
|
|
||||||
private ModuleControlButtonVM module2;
|
|
||||||
|
|
||||||
[ObservableProperty]
|
|
||||||
private ModuleControlButtonVM module3;
|
|
||||||
|
|
||||||
private readonly IAdsManager? _adsManager;
|
|
||||||
private readonly string? _variableName;
|
|
||||||
|
|
||||||
public StringOverviewPageVM(IAdsManager adsManager, string variableName)
|
|
||||||
{
|
|
||||||
_adsManager = adsManager;
|
|
||||||
_variableName = variableName;
|
|
||||||
|
|
||||||
module1 = new(_adsManager, _variableName + ".stHMIInterfaceModule1");
|
|
||||||
module2 = new(_adsManager, _variableName + ".stHMIInterfaceModule2");
|
|
||||||
module3 = new(_adsManager, _variableName + ".stHMIInterfaceModule3");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
Module1?.Dispose();
|
|
||||||
Module2?.Dispose();
|
|
||||||
Module3?.Dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
[RelayCommand]
|
|
||||||
private void Module1Clicked()
|
|
||||||
{
|
|
||||||
WeakReferenceMessenger.Default.Send(new NavigateMessage(_variableName + ".stHMIInterfaceModule1", typeof(ModuleOverviewPage), "Module 1"));
|
|
||||||
}
|
|
||||||
|
|
||||||
[RelayCommand]
|
|
||||||
private void Module2Clicked()
|
|
||||||
{
|
|
||||||
WeakReferenceMessenger.Default.Send(new NavigateMessage(_variableName + ".stHMIInterfaceModule2", typeof(ModuleOverviewPage), "Module 2"));
|
|
||||||
}
|
|
||||||
|
|
||||||
[RelayCommand]
|
|
||||||
private void Module3Clicked()
|
|
||||||
{
|
|
||||||
WeakReferenceMessenger.Default.Send(new NavigateMessage(_variableName + ".stHMIInterfaceModule3", typeof(ModuleOverviewPage), "Module 3"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
52
uniper_hmi/UniperHMI/Pages/ViewModels/TrayFeederPageVM.cs
Normal file
52
uniper_hmi/UniperHMI/Pages/ViewModels/TrayFeederPageVM.cs
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using HMIToolkit;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using Heisig.HMI.AdsManager;
|
||||||
|
using CommunityToolkit.Mvvm.Input;
|
||||||
|
using TwinCAT.TypeSystem;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using Common;
|
||||||
|
using InfineonHMI.Model;
|
||||||
|
namespace InfineonHMI;
|
||||||
|
|
||||||
|
public sealed partial class TrayFeederPageVM : ObservableValidator, IDisposable
|
||||||
|
{
|
||||||
|
private readonly string? _variableName;
|
||||||
|
|
||||||
|
private readonly IAdsManager? _adsManager;
|
||||||
|
|
||||||
|
[ObservableProperty] private PackMLControlVM? trayfeederOutPackMLControlVm;
|
||||||
|
[ObservableProperty] private PackMLControlVM? trayfeederInPackMLControlVm;
|
||||||
|
|
||||||
|
public TrayFeederPageVM()
|
||||||
|
{
|
||||||
|
TrayfeederInPackMLControlVm = new();
|
||||||
|
TrayfeederOutPackMLControlVm = new();
|
||||||
|
TrayfeederInPackMLControlVm.STitle = "Trayfeeder IN";
|
||||||
|
TrayfeederOutPackMLControlVm.STitle = "Trayfeeder OUT";
|
||||||
|
}
|
||||||
|
|
||||||
|
public TrayFeederPageVM(IAdsManager adsManager, string variableName)
|
||||||
|
{
|
||||||
|
_adsManager = adsManager;
|
||||||
|
_variableName = variableName;
|
||||||
|
|
||||||
|
|
||||||
|
TrayfeederInPackMLControlVm = new(_adsManager, "GVL_SCADA.stMachine.stTrayFeederIn.stStationCmds");
|
||||||
|
TrayfeederOutPackMLControlVm = new(_adsManager, "GVL_SCADA.stMachine.stTrayFeederOut.stStationCmds");
|
||||||
|
|
||||||
|
TrayfeederInPackMLControlVm.STitle = "Trayfeeder IN";
|
||||||
|
TrayfeederOutPackMLControlVm.STitle = "Trayfeeder OUT";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
|
||||||
using Heisig.HMI.AdsManager;
|
|
||||||
|
|
||||||
namespace UniperHMI;
|
|
||||||
|
|
||||||
public sealed partial class UnitOverviewPageVM : ObservableObject, IDisposable
|
|
||||||
{
|
|
||||||
[ObservableProperty]
|
|
||||||
private string unitName;
|
|
||||||
|
|
||||||
[ObservableProperty]
|
|
||||||
private UnitDetailsControlVM unitControlVM;
|
|
||||||
|
|
||||||
private readonly IAdsManager? _adsManager;
|
|
||||||
private readonly string? _variableName;
|
|
||||||
|
|
||||||
public UnitOverviewPageVM(IAdsManager adsManager, string variableName)
|
|
||||||
{
|
|
||||||
_adsManager = adsManager;
|
|
||||||
_variableName = variableName;
|
|
||||||
|
|
||||||
unitControlVM = new(_adsManager, _variableName);
|
|
||||||
|
|
||||||
unitName = "Unit X";
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
UnitControlVM?.Dispose();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
44
uniper_hmi/UniperHMI/Pages/Views/AlignmentStationPage.xaml
Normal file
44
uniper_hmi/UniperHMI/Pages/Views/AlignmentStationPage.xaml
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
<Page
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:local="clr-namespace:InfineonHMI"
|
||||||
|
xmlns:HMIToolkit="clr-namespace:HMIToolkit"
|
||||||
|
xmlns:common="clr-namespace:Common"
|
||||||
|
x:Class="InfineonHMI.AlignmentStationPage"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DataContext="{d:DesignInstance IsDesignTimeCreatable=True, Type={x:Type local:AlignmentStationPageVM}}"
|
||||||
|
d:DesignHeight="1554" d:DesignWidth="3390"
|
||||||
|
Title="AlignmentStationPage" FontSize="40">
|
||||||
|
|
||||||
|
<Grid Margin="20">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<!--<Label Grid.Row="0" Grid.Column="0" Content="Ausrichtstation" VerticalAlignment="Top" HorizontalAlignment="Left" />-->
|
||||||
|
|
||||||
|
<HMIToolkit:BinaryValveControl Grid.Column="0" Grid.Row="0" Grid.RowSpan="4" HorizontalAlignment="Center" VerticalAlignment="Center" DataContext="{Binding Path=VacuumValveControlVm}"/>
|
||||||
|
|
||||||
|
<common:PackMLControl Grid.Row="0" Grid.Column="2" Grid.ColumnSpan="2" HorizontalAlignment="Right" Grid.RowSpan="6" Width="Auto" Margin="20" DataContext="{Binding AlignmentPackMLControlVm}"/>
|
||||||
|
</Grid>
|
||||||
|
</Page>
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
using Heisig.HMI.AdsManager;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
|
||||||
|
namespace InfineonHMI;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Interaktionslogik für AutomaticModePage.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class AlignmentStationPage : Page
|
||||||
|
{
|
||||||
|
public static string AdsVariableName = "GVL_SCADA.stMachine.stAligner";
|
||||||
|
|
||||||
|
public static AlignmentStationPageVM CreateModel(IAdsManager adsManager)
|
||||||
|
{
|
||||||
|
return new(adsManager, AdsVariableName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static AlignmentStationPage CreateView(AlignmentStationPageVM model)
|
||||||
|
{
|
||||||
|
return new AlignmentStationPage { DataContext = model };
|
||||||
|
}
|
||||||
|
|
||||||
|
public AlignmentStationPage()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnUnloaded(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var disposable = DataContext as IDisposable;
|
||||||
|
disposable?.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
<Page x:Class="UniperHMI.AutomaticModePage"
|
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
||||||
xmlns:local="clr-namespace:UniperHMI"
|
|
||||||
mc:Ignorable="d"
|
|
||||||
d:DataContext="{d:DesignInstance Type=local:AutomaticModePageVM, IsDesignTimeCreatable=True}"
|
|
||||||
d:DesignHeight="450" d:DesignWidth="800"
|
|
||||||
Title="AutomaticModePage">
|
|
||||||
|
|
||||||
<Grid>
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition />
|
|
||||||
<ColumnDefinition Width="Auto"/>
|
|
||||||
<ColumnDefinition Width="Auto"/>
|
|
||||||
<ColumnDefinition />
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition />
|
|
||||||
<RowDefinition Height="Auto"/>
|
|
||||||
<RowDefinition Height="Auto"/>
|
|
||||||
<RowDefinition Height="Auto"/>
|
|
||||||
<RowDefinition Height="Auto"/>
|
|
||||||
<RowDefinition Height="Auto"/>
|
|
||||||
<RowDefinition Height="Auto"/>
|
|
||||||
<RowDefinition Height="Auto"/>
|
|
||||||
<RowDefinition />
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
<Label Grid.Row="1" Grid.Column="1" Content="Requested Control Mode:" VerticalAlignment="Center" HorizontalAlignment="Left" />
|
|
||||||
<ComboBox Grid.Row="1" Grid.Column="2" IsEnabled="{Binding CanChangeControlMode}" ItemsSource="{Binding ReqBMSControlModes}" SelectedItem="{Binding SelectedControlMode}"/>
|
|
||||||
|
|
||||||
<Label Grid.Row="2" Grid.Column="1" Content="Current Control Mode:" VerticalAlignment="Center" HorizontalAlignment="Left" />
|
|
||||||
<TextBox Grid.Row="2" Grid.Column="2" Text="{Binding BmsControlMode}" MaxLines="1" IsReadOnly="True" TextAlignment="Right"/>
|
|
||||||
|
|
||||||
<Label Grid.Row="3" Grid.Column="1" Content="Status:" VerticalAlignment="Center" HorizontalAlignment="Left" />
|
|
||||||
<TextBox Grid.Row="3" Width="125" Grid.Column="2" Text="Charging" MaxLines="1" IsReadOnly="True" TextAlignment="Right"/>
|
|
||||||
|
|
||||||
<Label Grid.Row="4" Grid.Column="1" Content="Target Power (W):" Margin="0,5,0,0" VerticalAlignment="Center" HorizontalAlignment="Left"/>
|
|
||||||
<TextBox Grid.Row="4" Width="125" Grid.Column="2" Text="{Binding Setpoint}" MaxLines="1" Margin="0,5,0,0" TextAlignment="Right" />
|
|
||||||
|
|
||||||
<Label Grid.Row="5" Grid.Column="1" Content="Actual Power (W):" Margin="0,5,0,0" VerticalAlignment="Center" HorizontalAlignment="Left" />
|
|
||||||
<TextBox Grid.Row="5" Width="125" Grid.Column="2" Text="{Binding ProcessValue}" MaxLines="1" Margin="0,5,0,0" IsReadOnly="True" TextAlignment="Right" />
|
|
||||||
|
|
||||||
<Button Grid.Row="6" Grid.Column="1" Command="{Binding StartAutomaticCommand}" Content="Start" Margin="0,5,5,0" />
|
|
||||||
<Button Grid.Row="6" Grid.Column="2" Command="{Binding StopAutomaticCommand}" Content="Stop" Margin="5,5,0,0" />
|
|
||||||
|
|
||||||
</Grid>
|
|
||||||
</Page>
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
using System.Windows.Controls;
|
|
||||||
|
|
||||||
namespace UniperHMI
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Interaktionslogik für AutomaticModePage.xaml
|
|
||||||
/// </summary>
|
|
||||||
public partial class AutomaticModePage : Page
|
|
||||||
{
|
|
||||||
public AutomaticModePage()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
// Unloaded += OnUnloaded;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnUnloaded(object? sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var disposable = DataContext as IDisposable;
|
|
||||||
disposable?.Dispose();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
<Page x:Class="UniperHMI.BatteryOverviewPage"
|
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
||||||
xmlns:local="clr-namespace:UniperHMI"
|
|
||||||
xmlns:mah="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
|
|
||||||
mc:Ignorable="d"
|
|
||||||
x:Name="root"
|
|
||||||
d:DataContext="{d:DesignInstance Type=local:BatteryOverviewPageVM, IsDesignTimeCreatable=False}"
|
|
||||||
Title="ManualModePage" Height="Auto" Width="Auto" VerticalAlignment="Center" HorizontalAlignment="Center">
|
|
||||||
|
|
||||||
<Grid Margin="10" Width="Auto" Height="Auto">
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition />
|
|
||||||
<ColumnDefinition />
|
|
||||||
<ColumnDefinition />
|
|
||||||
<ColumnDefinition />
|
|
||||||
<ColumnDefinition />
|
|
||||||
<ColumnDefinition />
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition Height="Auto"/>
|
|
||||||
<RowDefinition Height="Auto"/>
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
<local:SMUControlButton Grid.Row="0" Grid.Column="0" DataContext="{Binding String1VM}" Command="{Binding ElementName=root, Path=DataContext.String1ClickedCommand}" SMUName="String 1" Margin="0,0,5,0" />
|
|
||||||
<local:SMUControlButton Grid.Row="0" Grid.Column="1" DataContext="{Binding String2VM}" Command="{Binding ElementName=root, Path=DataContext.String2ClickedCommand}" SMUName="String 2" Margin="0,0,5,0" />
|
|
||||||
<local:SMUControlButton Grid.Row="0" Grid.Column="2" DataContext="{Binding DummyStringVM}" SMUName="String 3" Margin="0,0,5,0" IsEnabled="False"/>
|
|
||||||
<local:SMUControlButton Grid.Row="0" Grid.Column="3" DataContext="{Binding DummyStringVM}" SMUName="String 4" Margin="0,0,5,0" IsEnabled="False"/>
|
|
||||||
<local:SMUControlButton Grid.Row="0" Grid.Column="4" DataContext="{Binding DummyStringVM}" SMUName="String 5" Margin="0,0,5,0" IsEnabled="False"/>
|
|
||||||
<local:SMUControlButton Grid.Row="0" Grid.Column="5" DataContext="{Binding DummyStringVM}" SMUName="String 6" IsEnabled="False"/>
|
|
||||||
<local:SMUControlButton Grid.Row="1" Grid.Column="0" DataContext="{Binding DummyStringVM}" SMUName="String 7" Margin="0,5,5,0" IsEnabled="False"/>
|
|
||||||
<local:SMUControlButton Grid.Row="1" Grid.Column="1" DataContext="{Binding DummyStringVM}" SMUName="String 8" Margin="0,5,5,0" IsEnabled="False"/>
|
|
||||||
<local:SMUControlButton Grid.Row="1" Grid.Column="2" DataContext="{Binding DummyStringVM}" SMUName="String 9" Margin="0,5,5,0" IsEnabled="False"/>
|
|
||||||
<local:SMUControlButton Grid.Row="1" Grid.Column="3" DataContext="{Binding DummyStringVM}" SMUName="String 10" Margin="0,5,5,0" IsEnabled="False"/>
|
|
||||||
<local:SMUControlButton Grid.Row="1" Grid.Column="4" DataContext="{Binding DummyStringVM}" SMUName="String 11" Margin="0,5,5,0" IsEnabled="False"/>
|
|
||||||
<local:SMUControlButton Grid.Row="1" Grid.Column="5" DataContext="{Binding DummyStringVM}" SMUName="String 12" Margin="0,5,0,0" IsEnabled="False"/>
|
|
||||||
</Grid>
|
|
||||||
</Page>
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
using System.Windows.Controls;
|
|
||||||
|
|
||||||
namespace UniperHMI
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Interaktionslogik für ManualModePage.xaml
|
|
||||||
/// </summary>
|
|
||||||
public partial class BatteryOverviewPage : Page
|
|
||||||
{
|
|
||||||
public BatteryOverviewPage()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
//Unloaded += OnUnloaded;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnUnloaded(object? sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var disposable = DataContext as IDisposable;
|
|
||||||
disposable?.Dispose();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
53
uniper_hmi/UniperHMI/Pages/Views/EtchingStation1Page.xaml
Normal file
53
uniper_hmi/UniperHMI/Pages/Views/EtchingStation1Page.xaml
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
<Page x:Class="InfineonHMI.EtchingStation1Page"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:local="clr-namespace:InfineonHMI"
|
||||||
|
xmlns:hmiToolkit="clr-namespace:HMIToolkit"
|
||||||
|
xmlns:common="clr-namespace:Common"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DataContext="{d:DesignInstance Type=local:EtchingStation1PageVM, IsDesignTimeCreatable=True}"
|
||||||
|
d:DesignHeight="1554" d:DesignWidth="3390"
|
||||||
|
Title="EtchingStationPage">
|
||||||
|
<Page.Resources>
|
||||||
|
<hmiToolkit:FeedbackToColorConverter x:Key="feedbackConverter"/>
|
||||||
|
</Page.Resources>
|
||||||
|
<Grid Margin="20">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<!--<Label Grid.Row="0" Grid.Column="0" Content="Ätzstation 1" VerticalAlignment="Top" HorizontalAlignment="Left" FontSize="40" />-->
|
||||||
|
<hmiToolkit:BinaryValveControl Grid.Column="0" Grid.Row="0" Grid.RowSpan="4" HorizontalAlignment="Center" VerticalAlignment="Center" DataContext="{Binding VacuumValveControlEtching1Vm}"/>
|
||||||
|
<hmiToolkit:BinaryValveControl Grid.Column="1" Grid.Row="0" Grid.RowSpan="4" HorizontalAlignment="Center" VerticalAlignment="Center" DataContext="{Binding DoorValveControlEtching1Vm}"/>
|
||||||
|
<hmiToolkit:BinaryValveControl Grid.Column="2" Grid.Row="0" Grid.RowSpan="4" HorizontalAlignment="Center" VerticalAlignment="Center" DataContext="{Binding ChuckUnlockValveLeftEtching1Vm}"/>
|
||||||
|
<hmiToolkit:BinaryValveControl Grid.Column="0" Grid.Row="4" Grid.RowSpan="4" HorizontalAlignment="Center" VerticalAlignment="Center" DataContext="{Binding ChuckUnlockValveRightEtching1Vm}"/>
|
||||||
|
<hmiToolkit:BinaryValveControl Grid.Column="1" Grid.Row="4" Grid.RowSpan="4" HorizontalAlignment="Center" VerticalAlignment="Center" DataContext="{Binding ChuckEjectValveFrontEtching1Vm}"/>
|
||||||
|
<hmiToolkit:BinaryValveControl Grid.Column="2" Grid.Row="4" Grid.RowSpan="4" HorizontalAlignment="Center" VerticalAlignment="Center" DataContext="{Binding ChuckEjectValveBackEtching1Vm}"/>
|
||||||
|
|
||||||
|
<Button Grid.Row="1" Grid.Column="3" Content="Teller Entriegeln" DataContext="{Binding ChuckUnlockCmdButtonEtching1Vm}" Command="{Binding ButtonClickedCommand}" IsEnabled="{Binding XRelease}" Background="{Binding IFeedback, Converter={StaticResource feedbackConverter}}" HorizontalAlignment="Center" Width="320" Height="140" FontSize="30" />
|
||||||
|
<Button Grid.Row="2" Grid.Column="3" Content="Teller Verriegeln" DataContext="{Binding ChuckLockCmdButtonEtching1Vm}" Command="{Binding ButtonClickedCommand}" IsEnabled="{Binding XRelease}" Background="{Binding IFeedback, Converter={StaticResource feedbackConverter}}" HorizontalAlignment="Center" Width="320" Height="140" FontSize="30"/>
|
||||||
|
<Button Grid.Row="3" Grid.Column="3" Content="Teller Auswerfen" DataContext="{Binding ChuckEjectCmdButtonEtching1Vm}" Command="{Binding ButtonClickedCommand}" IsEnabled="{Binding XRelease}" Background="{Binding IFeedback, Converter={StaticResource feedbackConverter}}" HorizontalAlignment="Center" Width="320" Height="140" FontSize="30"/>
|
||||||
|
|
||||||
|
<common:PackMLControl Grid.Row="0" Grid.Column="6" Grid.ColumnSpan="2" HorizontalAlignment="Right" Grid.RowSpan="6" Width="Auto" Margin="20" DataContext="{Binding Etching1PackMLControlVm}"/>
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
</Page>
|
||||||
32
uniper_hmi/UniperHMI/Pages/Views/EtchingStation1Page.xaml.cs
Normal file
32
uniper_hmi/UniperHMI/Pages/Views/EtchingStation1Page.xaml.cs
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
using Heisig.HMI.AdsManager;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
|
||||||
|
namespace InfineonHMI;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Interaktionslogik für AutomaticModePage.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class EtchingStation1Page : Page
|
||||||
|
{
|
||||||
|
public static string AdsVariableName = "GVL_SCADA.stMachine.stEtcher1";
|
||||||
|
|
||||||
|
public static EtchingStation1PageVM CreateModel(IAdsManager adsManager)
|
||||||
|
{
|
||||||
|
return new(adsManager, AdsVariableName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static EtchingStation1Page CreateView(EtchingStation1PageVM model)
|
||||||
|
{
|
||||||
|
return new EtchingStation1Page { DataContext = model };
|
||||||
|
}
|
||||||
|
|
||||||
|
public EtchingStation1Page()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
private void OnUnloaded(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var disposable = DataContext as IDisposable;
|
||||||
|
disposable?.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
53
uniper_hmi/UniperHMI/Pages/Views/EtchingStation2Page.xaml
Normal file
53
uniper_hmi/UniperHMI/Pages/Views/EtchingStation2Page.xaml
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
<Page x:Class="InfineonHMI.EtchingStation2Page"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:local="clr-namespace:InfineonHMI"
|
||||||
|
xmlns:hmiToolkit="clr-namespace:HMIToolkit"
|
||||||
|
xmlns:common="clr-namespace:Common"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DataContext="{d:DesignInstance Type=local:EtchingStation2PageVM, IsDesignTimeCreatable=True}"
|
||||||
|
d:DesignHeight="1554" d:DesignWidth="3390"
|
||||||
|
Title="EtchingStationPage">
|
||||||
|
<Page.Resources>
|
||||||
|
<hmiToolkit:FeedbackToColorConverter x:Key="feedbackConverter"/>
|
||||||
|
</Page.Resources>
|
||||||
|
|
||||||
|
<Grid Margin="20">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<!--<Label Grid.Row="0" Grid.Column="0" Content="Ätzstation 2" VerticalAlignment="Top" HorizontalAlignment="Left" FontSize="40" />-->
|
||||||
|
|
||||||
|
<hmiToolkit:BinaryValveControl Grid.Column="0" Grid.Row="0" Grid.RowSpan="4" HorizontalAlignment="Center" VerticalAlignment="Center" DataContext="{Binding VacuumValveControlEtching2Vm}"/>
|
||||||
|
<hmiToolkit:BinaryValveControl Grid.Column="1" Grid.Row="0" Grid.RowSpan="4" HorizontalAlignment="Center" VerticalAlignment="Center" DataContext="{Binding DoorValveControlEtching2Vm}"/>
|
||||||
|
<hmiToolkit:BinaryValveControl Grid.Column="2" Grid.Row="0" Grid.RowSpan="4" HorizontalAlignment="Center" VerticalAlignment="Center" DataContext="{Binding ChuckUnlockValveLeftEtching2Vm}"/>
|
||||||
|
<hmiToolkit:BinaryValveControl Grid.Column="0" Grid.Row="4" Grid.RowSpan="4" HorizontalAlignment="Center" VerticalAlignment="Center" DataContext="{Binding ChuckUnlockValveRightEtching2Vm}"/>
|
||||||
|
<hmiToolkit:BinaryValveControl Grid.Column="1" Grid.Row="4" Grid.RowSpan="4" HorizontalAlignment="Center" VerticalAlignment="Center" DataContext="{Binding ChuckEjectValveFrontEtching2Vm}"/>
|
||||||
|
<hmiToolkit:BinaryValveControl Grid.Column="2" Grid.Row="4" Grid.RowSpan="4" HorizontalAlignment="Center" VerticalAlignment="Center" DataContext="{Binding ChuckEjectValveBackEtching2Vm}"/>
|
||||||
|
|
||||||
|
<Button Grid.Row="1" Grid.Column="3" Content="Teller Entriegeln" DataContext="{Binding ChuckUnlockCmdButtonEtching2Vm}" Command="{Binding ButtonClickedCommand}" IsEnabled="{Binding XRelease}" Background="{Binding IFeedback, Converter={StaticResource feedbackConverter}}" HorizontalAlignment="Center" Width="320" Height="140" FontSize="30"/>
|
||||||
|
<Button Grid.Row="2" Grid.Column="3" Content="Teller Verriegeln" DataContext="{Binding ChuckLockCmdButtonEtching2Vm}" Command="{Binding ButtonClickedCommand}" IsEnabled="{Binding XRelease}" Background="{Binding IFeedback, Converter={StaticResource feedbackConverter}}" HorizontalAlignment="Center" Width="320" Height="140" FontSize="30"/>
|
||||||
|
<Button Grid.Row="3" Grid.Column="3" Content="Teller Auswerfen" DataContext="{Binding ChuckEjectCmdButtonEtching2Vm}" Command="{Binding ButtonClickedCommand}" IsEnabled="{Binding XRelease}" Background="{Binding IFeedback, Converter={StaticResource feedbackConverter}}" HorizontalAlignment="Center" Width="320" Height="140" FontSize="30"/>
|
||||||
|
<common:PackMLControl Grid.Row="0" Grid.Column="6" Grid.ColumnSpan="2" HorizontalAlignment="Right" Grid.RowSpan="6" Width="Auto" Margin="20" DataContext="{Binding Etching2PackMLControlVm}"/>
|
||||||
|
</Grid>
|
||||||
|
</Page>
|
||||||
32
uniper_hmi/UniperHMI/Pages/Views/EtchingStation2Page.xaml.cs
Normal file
32
uniper_hmi/UniperHMI/Pages/Views/EtchingStation2Page.xaml.cs
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
using Heisig.HMI.AdsManager;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
|
||||||
|
namespace InfineonHMI;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Interaktionslogik für AutomaticModePage.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class EtchingStation2Page : Page
|
||||||
|
{
|
||||||
|
public static string AdsVariableName = "GVL_SCADA.stMachine.stEtcher2";
|
||||||
|
|
||||||
|
public static EtchingStation2PageVM CreateModel(IAdsManager adsManager)
|
||||||
|
{
|
||||||
|
return new(adsManager, AdsVariableName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static EtchingStation2Page CreateView(EtchingStation2PageVM model)
|
||||||
|
{
|
||||||
|
return new EtchingStation2Page { DataContext = model };
|
||||||
|
}
|
||||||
|
|
||||||
|
public EtchingStation2Page()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
private void OnUnloaded(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var disposable = DataContext as IDisposable;
|
||||||
|
disposable?.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
<Page x:Class="UniperHMI.EventsPage"
|
<Page x:Class="InfineonHMI.EventsPage"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:local="clr-namespace:UniperHMI"
|
xmlns:local="clr-namespace:InfineonHMI"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DataContext="{d:DesignInstance Type=local:EventsPageVM, IsDesignTimeCreatable=False}"
|
d:DataContext="{d:DesignInstance Type=local:EventsPageVM, IsDesignTimeCreatable=False}"
|
||||||
d:DesignHeight="450" d:DesignWidth="800"
|
d:DesignHeight="450" d:DesignWidth="800"
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
</Page.Resources>
|
</Page.Resources>
|
||||||
|
|
||||||
<Grid>
|
<Grid>
|
||||||
<DataGrid ItemsSource="{Binding CurrentEvents}" AutoGenerateColumns="False" IsReadOnly="True">
|
<DataGrid ItemsSource="{Binding CurrentEvents}" FontSize="30" AutoGenerateColumns="False" IsReadOnly="True">
|
||||||
<DataGrid.Columns>
|
<DataGrid.Columns>
|
||||||
<DataGridTextColumn Header="Message" Binding="{Binding Message}" Width="400"/>
|
<DataGridTextColumn Header="Message" Binding="{Binding Message}" Width="400"/>
|
||||||
<DataGridTextColumn Header="Raised" Binding="{Binding Raised, Converter={StaticResource dtConverter}}" Width="*" SortDirection="Descending"/>
|
<DataGridTextColumn Header="Raised" Binding="{Binding Raised, Converter={StaticResource dtConverter}}" Width="*" SortDirection="Descending"/>
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user