Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c9e3b22f8d | |||
| d2ba4baa1d | |||
| 0779c768dd | |||
| 40bc57f265 | |||
| 46eaea558d | |||
| b1be14153f | |||
| a753f1c7a7 | |||
| ff9add4081 | |||
| c7306e8217 | |||
| ffde99f83d | |||
| 2782bc17be | |||
| 9636ff0457 | |||
| d2665d17fa | |||
| a0ef457995 | |||
| f8174d752c |
@@ -4,15 +4,16 @@
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
||||
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
|
||||
<Title>Ads Manager</Title>
|
||||
<Authors>M.Heisig</Authors>
|
||||
<Company>Heisig GmbH</Company>
|
||||
<Description>Wrapper für den Ads Client von Beckhoff um automatische reconnects und onlinechanges zu behandeln.</Description>
|
||||
<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>
|
||||
<Version>1.0.0.7</Version>
|
||||
<Platforms>x64</Platforms>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.8.34525.116
|
||||
# Visual Studio Version 18
|
||||
VisualStudioVersion = 18.2.11415.280 d18.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AdsManager", "AdsManager.csproj", "{4B80F068-4E6D-4D2D-831B-8150970600C7}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Debug|x64 = Debug|x64
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{4B80F068-4E6D-4D2D-831B-8150970600C7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4B80F068-4E6D-4D2D-831B-8150970600C7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4B80F068-4E6D-4D2D-831B-8150970600C7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4B80F068-4E6D-4D2D-831B-8150970600C7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{4B80F068-4E6D-4D2D-831B-8150970600C7}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{4B80F068-4E6D-4D2D-831B-8150970600C7}.Debug|x64.Build.0 = Debug|x64
|
||||
{4B80F068-4E6D-4D2D-831B-8150970600C7}.Release|x64.ActiveCfg = Release|x64
|
||||
{4B80F068-4E6D-4D2D-831B-8150970600C7}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
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:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:UniperHMI">
|
||||
xmlns:local="clr-namespace:InfineonHMI">
|
||||
<Application.Resources>
|
||||
<!-- MahApps Metro style themes -->
|
||||
<ResourceDictionary>
|
||||
|
||||
@@ -4,7 +4,7 @@ using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using TcEventLoggerAdsProxyLib;
|
||||
|
||||
namespace UniperHMI;
|
||||
namespace InfineonHMI;
|
||||
|
||||
public partial class App : Application
|
||||
{
|
||||
@@ -18,10 +18,6 @@ public partial class App : Application
|
||||
services.AddSingleton<MainWindow>();
|
||||
services.AddSingleton<MainWindowVM>();
|
||||
services.AddSingleton<IAdsManager, AdsManager>();
|
||||
services.AddTransient<AutomaticModePageVM>();
|
||||
services.AddTransient<BatteryOverviewPageVM>();
|
||||
services.AddTransient<StringOverviewPageVM>();
|
||||
services.AddTransient<ModuleOverviewPageVM>();
|
||||
services.AddSingleton<TcEventLogger>();
|
||||
})
|
||||
.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;
|
||||
}
|
||||
}
|
||||
101
uniper_hmi/UniperHMI/Common/MediaContainer.xaml
Normal file
101
uniper_hmi/UniperHMI/Common/MediaContainer.xaml
Normal file
@@ -0,0 +1,101 @@
|
||||
<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="300" />
|
||||
</Style>
|
||||
</d:DesignerProperties.DesignStyle>
|
||||
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="25*"/>
|
||||
<ColumnDefinition Width="25*"/>
|
||||
<ColumnDefinition Width="50*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="70"/>
|
||||
<RowDefinition Height="100"/>
|
||||
<RowDefinition Height="100"/>
|
||||
<RowDefinition Height="180"/>
|
||||
</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" Width="200" 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"/>
|
||||
|
||||
<Grid Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<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>
|
||||
</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);
|
||||
}
|
||||
}
|
||||
76
uniper_hmi/UniperHMI/Common/MediaContainerVm.cs
Normal file
76
uniper_hmi/UniperHMI/Common/MediaContainerVm.cs
Normal file
@@ -0,0 +1,76 @@
|
||||
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 HMIControlButtonVM? emptyButton;
|
||||
|
||||
[ObservableProperty] private HMIControlButtonVM? fillButton;
|
||||
|
||||
|
||||
|
||||
public MediaContainerVm()
|
||||
{
|
||||
sName = "No Name";
|
||||
EmptyButton = new HMIControlButtonVM();
|
||||
FillButton = new HMIControlButtonVM();
|
||||
|
||||
}
|
||||
|
||||
public MediaContainerVm(IAdsManager adsManager, string variableName)
|
||||
{
|
||||
_adsManager = adsManager;
|
||||
_variableName = variableName;
|
||||
|
||||
sName = "No Name";
|
||||
|
||||
EmptyButton = new HMIControlButtonVM(_adsManager, _variableName + ".stEmptyButton");
|
||||
FillButton = new HMIControlButtonVM(_adsManager, _variableName + ".stFillButton");
|
||||
_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()
|
||||
{
|
||||
EmptyButton?.Dispose();
|
||||
EmptyButton = null;
|
||||
FillButton?.Dispose();
|
||||
FillButton = 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.Shapes;
|
||||
|
||||
namespace UniperHMI
|
||||
namespace Common;
|
||||
|
||||
/// <summary>
|
||||
/// Interaktionslogik für WorkingModeSelectionControl.xaml
|
||||
/// </summary>
|
||||
public partial class PackMLControl : UserControl
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für ModuleOverviewPage.xaml
|
||||
/// </summary>
|
||||
public partial class ModuleOverviewPage : Page
|
||||
{
|
||||
public ModuleOverviewPage()
|
||||
public PackMLControl()
|
||||
{
|
||||
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,10 +2,10 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace UniperHMI
|
||||
namespace InfineonHMI;
|
||||
|
||||
public class DateTimeToEventTimeConverter : IValueConverter
|
||||
{
|
||||
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)
|
||||
@@ -29,5 +29,4 @@ namespace UniperHMI
|
||||
{
|
||||
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: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:local="clr-namespace:UniperHMI"
|
||||
xmlns:local="clr-namespace:HMIToolkit"
|
||||
mc:Ignorable="d"
|
||||
Title="BinaryValveWindow" SizeToContent="WidthAndHeight" ResizeMode="NoResize">
|
||||
<Grid>
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
using System.Windows;
|
||||
|
||||
namespace UniperHMI
|
||||
namespace InfineonHMI;
|
||||
|
||||
/// <summary>
|
||||
/// Interaktionslogik für BinaryValveWindow.xaml
|
||||
/// </summary>
|
||||
public partial class BinaryValveWindow : Window
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für BinaryValveWindow.xaml
|
||||
/// </summary>
|
||||
public partial class BinaryValveWindow : Window
|
||||
{
|
||||
public BinaryValveWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,13 @@
|
||||
using System.Windows.Controls;
|
||||
|
||||
|
||||
namespace HMIToolkit
|
||||
namespace HMIToolkit;
|
||||
|
||||
/// <summary>
|
||||
/// Interaktionslogik für AnalogMotorControl.xaml
|
||||
/// </summary>
|
||||
public partial class AnalogMotorControl : UserControl
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für AnalogMotorControl.xaml
|
||||
/// </summary>
|
||||
public partial class AnalogMotorControl : UserControl
|
||||
{
|
||||
public AnalogMotorControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
@@ -19,5 +19,4 @@ namespace HMIToolkit
|
||||
var disposable = DataContext as IDisposable;
|
||||
disposable?.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
using TwinCAT.TypeSystem;
|
||||
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";
|
||||
|
||||
@@ -79,5 +79,4 @@ namespace HMIToolkit
|
||||
{
|
||||
SName = (string)e.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
using System.Globalization;
|
||||
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 Max { get; set; }
|
||||
@@ -29,5 +29,4 @@ namespace HMIToolkit
|
||||
|
||||
return ValidationResult.ValidResult;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,8 +26,8 @@
|
||||
|
||||
<!-- <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}" />
|
||||
<Label Grid.Column="1" Content="{Binding SUnit}" VerticalAlignment="Center" HorizontalAlignment="Left"/>
|
||||
<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" FontSize="35" HorizontalAlignment="Left"/>
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace HMIToolkit
|
||||
namespace HMIToolkit;
|
||||
|
||||
/// <summary>
|
||||
/// Interaktionslogik für AnalogValue.xaml
|
||||
/// </summary>
|
||||
public partial class AnalogValue : UserControl
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für AnalogValue.xaml
|
||||
/// </summary>
|
||||
public partial class AnalogValue : UserControl
|
||||
{
|
||||
public bool IsReadonly { get; set; }
|
||||
|
||||
public AnalogValue()
|
||||
@@ -28,5 +28,4 @@ namespace HMIToolkit
|
||||
Regex regex = new("^[-+]?[0-9]*,?[0-9]+$");
|
||||
e.Handled = regex.IsMatch(e.Text);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,13 +13,13 @@ using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace HMIToolkit
|
||||
namespace HMIToolkit;
|
||||
|
||||
/// <summary>
|
||||
/// Interaktionslogik für AnalogValveControl.xaml
|
||||
/// </summary>
|
||||
public partial class AnalogValveControl : UserControl
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für AnalogValveControl.xaml
|
||||
/// </summary>
|
||||
public partial class AnalogValveControl : UserControl
|
||||
{
|
||||
public AnalogValveControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
@@ -31,5 +31,4 @@ namespace HMIToolkit
|
||||
var disposable = DataContext as IDisposable;
|
||||
disposable?.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
using TwinCAT.TypeSystem;
|
||||
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";
|
||||
|
||||
@@ -79,5 +79,4 @@ namespace HMIToolkit
|
||||
{
|
||||
SName = (string)e.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,31 +8,33 @@
|
||||
mc:Ignorable="d"
|
||||
Height="Auto"
|
||||
Width="Auto">
|
||||
|
||||
<UserControl.Resources>
|
||||
<local:FeedbackToColorConverter x:Key="feedbackConverter" />
|
||||
</UserControl.Resources>
|
||||
<!-- Style to see things in the designer-->
|
||||
<d:DesignerProperties.DesignStyle>
|
||||
<Style TargetType="UserControl">
|
||||
<!-- Property="Background" Value="White" /> -->
|
||||
<!--Property="Background" Value="White" />-->
|
||||
<Setter Property="Height" Value="Auto" />
|
||||
<Setter Property="Width" Value="Auto" />
|
||||
</Style>
|
||||
</d:DesignerProperties.DesignStyle>
|
||||
|
||||
<Grid Margin="5" ShowGridLines="True">
|
||||
<Border BorderThickness="2" BorderBrush="White">
|
||||
<Grid Margin="5">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="55" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
|
||||
</Grid.RowDefinitions>
|
||||
<!-- 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 -->
|
||||
<Label Grid.Row="1" Content="Interlocks:" Margin="0,0,0,-3"/>
|
||||
<Label Grid.Row="1" Content="Interlocks:" FontSize="30"/>
|
||||
|
||||
<!-- Row 2 -->
|
||||
<Grid Grid.Row="2">
|
||||
@@ -49,9 +51,9 @@
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Label Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Content="Control:" Margin="0,0,0,-3" />
|
||||
<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="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"/>
|
||||
<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" FontSize="40" Height="100" Width="180" 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" FontSize="40" Height="100" Width="180" Margin="0,-5,0,0"/>
|
||||
</Grid>
|
||||
|
||||
<!-- Row 4 -->
|
||||
@@ -65,10 +67,11 @@
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Label Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Content="Mode:" Margin="0,0,0,-3" />
|
||||
<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="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"/>
|
||||
<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" FontSize="35" Height="100" Width="180" 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" FontSize="35" Height="100" Width="180" Margin="0,-5,0,-5"/>
|
||||
</Grid>
|
||||
|
||||
</Grid>
|
||||
</Border>
|
||||
</UserControl>
|
||||
|
||||
@@ -13,13 +13,13 @@ using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace HMIToolkit
|
||||
namespace HMIToolkit;
|
||||
|
||||
/// <summary>
|
||||
/// Interaktionslogik für BinaryValveControl.xaml
|
||||
/// </summary>
|
||||
public partial class BinaryValveControl : UserControl
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für BinaryValveControl.xaml
|
||||
/// </summary>
|
||||
public partial class BinaryValveControl : UserControl
|
||||
{
|
||||
public BinaryValveControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
@@ -31,5 +31,4 @@ namespace HMIToolkit
|
||||
var disposable = DataContext as IDisposable;
|
||||
disposable?.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,10 +4,10 @@ using Heisig.HMI.AdsManager;
|
||||
|
||||
// {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";
|
||||
|
||||
@@ -66,5 +66,4 @@ namespace HMIToolkit
|
||||
{
|
||||
SName = (string)e.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,10 +3,10 @@ using System.Windows;
|
||||
using System.Windows.Data;
|
||||
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)
|
||||
{
|
||||
if (targetType != typeof(Brush))
|
||||
@@ -21,5 +21,4 @@ namespace HMIToolkit
|
||||
{
|
||||
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,10 +3,10 @@ using CommunityToolkit.Mvvm.Input;
|
||||
using TwinCAT.TypeSystem;
|
||||
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;
|
||||
|
||||
@@ -42,13 +42,13 @@ namespace HMIToolkit
|
||||
_variableName = variableName;
|
||||
|
||||
_adsManager.Register(_variableName + ".xRelease", XReleaseCahnged);
|
||||
_adsManager.Register(_variableName + ".iFeedback", IFeedbackChanged);
|
||||
_adsManager.Register(_variableName + ".eFeedback", IFeedbackChanged);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_adsManager?.Deregister(_variableName + ".xRelease", XReleaseCahnged);
|
||||
_adsManager?.Deregister(_variableName + ".iFeedback", IFeedbackChanged);
|
||||
_adsManager?.Deregister(_variableName + ".eFeedback", IFeedbackChanged);
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
@@ -70,5 +70,4 @@ namespace HMIToolkit
|
||||
IFeedback = (short)e.Value;
|
||||
FeedbackChanged?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,13 +16,13 @@
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Button Grid.Column="0" Padding="0" Command="{Binding ShowProcessIntlksCommand}">
|
||||
<Button Grid.Column="0" FontSize="35" Height="80" Width="180" Padding="0" Command="{Binding ShowProcessIntlksCommand}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Label>Process</Label>
|
||||
<Rectangle Width="10" Height="10" Fill="{Binding Path=XProcessIntlkOk, Converter={StaticResource myBoolConverter}}" RadiusX="2" RadiusY="2" Margin="0,2,0,0"/>
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<Button Grid.Column="1" Padding="0" Margin="5,0,0,0" Command="{Binding ShowSafetyIntlksCommand}">
|
||||
<Button Grid.Column="1" Padding="0" FontSize="35" Height="80" Width="180" Margin="5,0,0,0" Command="{Binding ShowSafetyIntlksCommand}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Label>Safety</Label>
|
||||
<Rectangle Width="10" Height="10" Fill="{Binding Path=XSafetyIntlkOk, Converter={StaticResource myBoolConverter}}" RadiusX="2" RadiusY="2" Margin="0,2,0,0"/>
|
||||
|
||||
@@ -13,13 +13,13 @@ using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace HMIToolkit
|
||||
namespace HMIToolkit;
|
||||
|
||||
/// <summary>
|
||||
/// Interaktionslogik für ProcessIntlkButtonControl.xaml
|
||||
/// </summary>
|
||||
public partial class IntlkButtonControl : UserControl
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für ProcessIntlkButtonControl.xaml
|
||||
/// </summary>
|
||||
public partial class IntlkButtonControl : UserControl
|
||||
{
|
||||
public IntlkButtonControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
@@ -31,5 +31,4 @@ namespace HMIToolkit
|
||||
var disposable = DataContext as IDisposable;
|
||||
disposable?.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,13 +13,13 @@ using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace HMIToolkit
|
||||
namespace HMIToolkit;
|
||||
|
||||
/// <summary>
|
||||
/// Interaktionslogik für IntlkDetails.xaml
|
||||
/// </summary>
|
||||
public partial class IntlkDetails : UserControl
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für IntlkDetails.xaml
|
||||
/// </summary>
|
||||
public partial class IntlkDetails : UserControl
|
||||
{
|
||||
public IntlkDetails()
|
||||
{
|
||||
InitializeComponent();
|
||||
@@ -31,5 +31,4 @@ namespace HMIToolkit
|
||||
var disposable = DataContext as IDisposable;
|
||||
disposable?.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,10 +5,10 @@ using System.Windows.Controls;
|
||||
using TwinCAT.TypeSystem;
|
||||
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;
|
||||
|
||||
@@ -147,5 +147,4 @@ namespace HMIToolkit
|
||||
{
|
||||
InterlockNames = (string[])e.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,16 +12,15 @@ using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace HMIToolkit
|
||||
namespace HMIToolkit;
|
||||
|
||||
/// <summary>
|
||||
/// Interaktionslogik für IntlkDetailsWindow.xaml
|
||||
/// </summary>
|
||||
public partial class IntlkDetailsWindow : Window
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für IntlkDetailsWindow.xaml
|
||||
/// </summary>
|
||||
public partial class IntlkDetailsWindow : Window
|
||||
{
|
||||
public IntlkDetailsWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,24 +1,23 @@
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace HMIToolkit
|
||||
{
|
||||
// PLC - C#
|
||||
// --------
|
||||
// int - short
|
||||
// word - ushort
|
||||
namespace HMIToolkit;
|
||||
// PLC - C#
|
||||
// --------
|
||||
// int - short
|
||||
// word - ushort
|
||||
|
||||
// Constants for interaction with data
|
||||
public static class HMIConstants
|
||||
{
|
||||
// Constants for interaction with data
|
||||
public static class HMIConstants
|
||||
{
|
||||
public const int StringLength = 81;
|
||||
public const int NumInterlocks = 16;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 0)]
|
||||
public struct HMIAnalogValue
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 0)]
|
||||
public struct HMIAnalogValue
|
||||
{
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = HMIConstants.StringLength)]
|
||||
public string sName;
|
||||
|
||||
@@ -32,12 +31,12 @@ namespace HMIToolkit
|
||||
|
||||
[MarshalAs(UnmanagedType.I1)]
|
||||
public bool xUsed;
|
||||
}
|
||||
}
|
||||
|
||||
// TwinCAT2 Pack = 1, TwinCAT 3 Pack = 0
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 0)]
|
||||
public struct HMIControlButton
|
||||
{
|
||||
// TwinCAT2 Pack = 1, TwinCAT 3 Pack = 0
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 0)]
|
||||
public struct HMIControlButton
|
||||
{
|
||||
[MarshalAs(UnmanagedType.I1)]
|
||||
public bool xRequest;
|
||||
|
||||
@@ -45,12 +44,12 @@ namespace HMIToolkit
|
||||
public bool xRelease;
|
||||
|
||||
public short iFeedback;
|
||||
}
|
||||
}
|
||||
|
||||
// TwinCAT2 Pack = 1, TwinCAT 3 Pack = 0
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 0)]
|
||||
public struct HMIInterlock
|
||||
{
|
||||
// TwinCAT2 Pack = 1, TwinCAT 3 Pack = 0
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 0)]
|
||||
public struct HMIInterlock
|
||||
{
|
||||
public ushort wProcessINTLKStatus;
|
||||
|
||||
public ushort wSafeyINTLKStatus;
|
||||
@@ -74,12 +73,12 @@ namespace HMIToolkit
|
||||
|
||||
[MarshalAs(UnmanagedType.I1)]
|
||||
public bool xSafetyINTLKOk;
|
||||
}
|
||||
}
|
||||
|
||||
// TwinCAT2 Pack = 1, TwinCAT 3 Pack = 0
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 0)]
|
||||
public struct HMIValveData
|
||||
{
|
||||
// TwinCAT2 Pack = 1, TwinCAT 3 Pack = 0
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 0)]
|
||||
public struct HMIValveData
|
||||
{
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = HMIConstants.StringLength)]
|
||||
public string sName;
|
||||
|
||||
@@ -101,11 +100,11 @@ namespace HMIToolkit
|
||||
|
||||
[MarshalAs(UnmanagedType.I1)]
|
||||
public bool xUsed;
|
||||
}
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 0)]
|
||||
public struct HMIAnalogValveData
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 0)]
|
||||
public struct HMIAnalogValveData
|
||||
{
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = HMIConstants.StringLength)]
|
||||
public string sName;
|
||||
|
||||
@@ -131,12 +130,12 @@ namespace HMIToolkit
|
||||
|
||||
[MarshalAs(UnmanagedType.I1)]
|
||||
public bool xUsed;
|
||||
}
|
||||
}
|
||||
|
||||
// TwinCAT2 Pack = 1, TwinCAT 3 Pack = 0
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 0)]
|
||||
public struct HMIAnalogMotorData
|
||||
{
|
||||
// TwinCAT2 Pack = 1, TwinCAT 3 Pack = 0
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 0)]
|
||||
public struct HMIAnalogMotorData
|
||||
{
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = HMIConstants.StringLength)]
|
||||
public string sName;
|
||||
|
||||
@@ -162,12 +161,12 @@ namespace HMIToolkit
|
||||
|
||||
[MarshalAs(UnmanagedType.I1)]
|
||||
public bool xUsed;
|
||||
}
|
||||
}
|
||||
|
||||
// TwinCAT2 Pack = 1, TwinCAT 3 Pack = 0
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 0)]
|
||||
public struct HMIOrpSensorData
|
||||
{
|
||||
// TwinCAT2 Pack = 1, TwinCAT 3 Pack = 0
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 0)]
|
||||
public struct HMIOrpSensorData
|
||||
{
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = HMIConstants.StringLength)]
|
||||
public string sName;
|
||||
|
||||
@@ -184,10 +183,10 @@ namespace HMIToolkit
|
||||
|
||||
[MarshalAs(UnmanagedType.I1)]
|
||||
public bool xUsed;
|
||||
}
|
||||
}
|
||||
|
||||
static class HMIUtilities
|
||||
{
|
||||
static class HMIUtilities
|
||||
{
|
||||
// Converts the interlock byte array into a string array
|
||||
public static string[] GetInterlockStringArray(byte[] byteArray)
|
||||
{
|
||||
@@ -214,5 +213,4 @@ namespace HMIToolkit
|
||||
|
||||
return temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,16 +2,25 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net8.0-windows</TargetFramework>
|
||||
<TargetFramework>net8.0-windows8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<UseWPF>true</UseWPF>
|
||||
<AssemblyVersion>0.1.0</AssemblyVersion>
|
||||
<FileVersion>0.1</FileVersion>
|
||||
<Platforms>AnyCPU;x64</Platforms>
|
||||
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
|
||||
</PropertyGroup>
|
||||
|
||||
<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.TcEventLoggerAdsProxy.Net" Version="2.7.11" />
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
|
||||
@@ -21,6 +30,34 @@
|
||||
</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">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
@@ -1,39 +1,38 @@
|
||||
<Window x:Class="UniperHMI.MainWindow"
|
||||
<Window x:Class="InfineonHMI.MainWindow"
|
||||
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:mah="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
|
||||
xmlns:local="clr-namespace:UniperHMI" xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||
xmlns:system="clr-namespace:System;assembly=System.Runtime"
|
||||
xmlns:infineonHmi="clr-namespace:InfineonHMI"
|
||||
mc:Ignorable="d"
|
||||
x:Name="MainControlWindow"
|
||||
d:DataContext="{d:DesignInstance Type=local:MainWindowVM, IsDesignTimeCreatable=False}"
|
||||
d:DataContext="{d:DesignInstance Type=infineonHmi:MainWindowVM}"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
Title="Uniper HMI" Height="800" Width="1024" ResizeMode="NoResize">
|
||||
|
||||
<Grid HorizontalAlignment="Stretch">
|
||||
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.RowDefinitions>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
<RowDefinition Height="*"></RowDefinition>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
<RowDefinition Height="0.08*"/>
|
||||
<RowDefinition Height="0.04*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="0.74*"/>
|
||||
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="190"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Latest event line -->
|
||||
<Grid Grid.Row="0">
|
||||
<Border BorderThickness="0px 0px 0px 2px" BorderBrush="White" Background="Black">
|
||||
<Label Content="{Binding EventsPageVM.CurrentEvent.Message}" FontSize="20" Height="45" VerticalAlignment="Center" HorizontalAlignment="Left" Visibility="{Binding StatusBarVisible}"/>
|
||||
</Border>
|
||||
</Grid>
|
||||
|
||||
<!-- Breadcrumb line -->
|
||||
<Label Grid.Row="1" Content="{Binding Breadcrumb}"/>
|
||||
|
||||
<!-- Page frame -->
|
||||
<Frame x:Name="MainFrame" NavigationUIVisibility="Hidden" Content="{Binding CurrentPage}" Grid.Row="2" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" />
|
||||
|
||||
<!-- Softkey grid -->
|
||||
<Grid Grid.Row="3" Margin="5,5,3,5" Width="Auto">
|
||||
<!-- Header line -->
|
||||
<Grid Grid.Row="0" Margin="10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
@@ -45,41 +44,169 @@
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- Softkey 1 -->
|
||||
<Button Grid.Column="0" MinWidth="80" MinHeight="{Binding RelativeSource={RelativeSource Self}, Path=ActualWidth}" Margin="0,0,2,0" Content="Automatic" Command="{Binding AutomaticModeClickedCommand}"/>
|
||||
<!-- Command="{Binding AutomaticModeCommand}" -->
|
||||
<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>
|
||||
|
||||
<!-- Softkey 2 -->
|
||||
<Button Grid.Column="1" MinWidth="80" MinHeight="80" Margin="0,0,2,0" Content="Manual" Command="{Binding ManualModeClickedCommand}" />
|
||||
<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>
|
||||
|
||||
<!-- Breadcrumb line -->
|
||||
<!-- Currently no used -->
|
||||
<!--<Label Grid.Row="2"
|
||||
Content="{Binding Breadcrumb}"
|
||||
FontSize="28"/>-->
|
||||
|
||||
<!-- Page frame -->
|
||||
<Frame x:Name="MainFrame"
|
||||
Grid.Row="3"
|
||||
NavigationUIVisibility="Hidden"
|
||||
Margin="20 20 10 20"
|
||||
Content="{Binding CurrentPage}"/>
|
||||
|
||||
<Border Grid.Row="4"
|
||||
Margin="10 0 10 0"
|
||||
BorderBrush="White"
|
||||
BorderThickness="0,3,0,0"/>
|
||||
|
||||
<!-- Softkey grid -->
|
||||
<Grid Grid.Row="5" Margin="15 10 20 15">
|
||||
<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" MinWidth="80" MinHeight="80" Margin="0,0,2,0" Content="Settings" Command="{Binding SettingsWindowCommand}" />
|
||||
<!-- Command="{Binding SettingsWindowCommand}" -->
|
||||
<Button Grid.Column="2" Content="Protokoll" FontSize="38" Margin="10"
|
||||
Command="{Binding ProtocolWindowClickedCommand}" Visibility="Collapsed"/>
|
||||
|
||||
<!-- Softkey 4 -->
|
||||
<Button Grid.Column="3" MinWidth="80" MinHeight="80" Margin="0,0,2,0" Content="Events" Command="{Binding EventsListClickedCommand}"/>
|
||||
<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="4" MinWidth="80" MinHeight="80" Margin="0,0,2,0" />
|
||||
<Button Grid.Column="7" Content="Trend" FontSize="38" Margin="10"
|
||||
Command="{Binding TrendWindowClickedCommand}" Visibility="Collapsed"/>
|
||||
|
||||
<!-- Softkey 6 -->
|
||||
<Button Grid.Column="5" MinWidth="80" MinHeight="80" Margin="0,0,2,0" />
|
||||
<Button Grid.Column="8" Content="Komponenten" FontSize="38" Margin="10"
|
||||
Command="{Binding ComponentsWindowClickedCommand}" Visibility="Collapsed"/>
|
||||
|
||||
<!-- 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" />
|
||||
|
||||
<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" 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" />
|
||||
<Button Grid.Column="8"
|
||||
Width="450"
|
||||
Content="Alarm quittieren" FontSize="38" Margin="10"
|
||||
Command="{Binding AckAlarmsCommand}"/>
|
||||
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
</Grid>
|
||||
</Viewbox>
|
||||
</Window>
|
||||
|
||||
@@ -1,26 +1,34 @@
|
||||
using HMIToolkit;
|
||||
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)
|
||||
{
|
||||
this.DataContext = mainWindowVM;
|
||||
DataContext = mainWindowVM;
|
||||
InitializeComponent();
|
||||
Loaded += MainWindowLoaded;
|
||||
Closed += OnClosedEvent;
|
||||
}
|
||||
|
||||
private void MainWindowLoaded(object sender, System.Windows.RoutedEventArgs e)
|
||||
{
|
||||
var model = (MainWindowVM)DataContext;
|
||||
model.ChangeUserClicked();
|
||||
model.ShowOverview();
|
||||
|
||||
}
|
||||
|
||||
private void OnClosedEvent(object? sender, EventArgs e)
|
||||
{
|
||||
if (DataContext is IDisposable dataContext)
|
||||
dataContext.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,43 +1,62 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using Common;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
using Heisig.HMI.AdsManager;
|
||||
using InfineonHMI.Pages.Views;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using InfineonHMI.Common;
|
||||
using TcEventLoggerAdsProxyLib;
|
||||
using TwinCAT.TypeSystem;
|
||||
|
||||
namespace UniperHMI;
|
||||
namespace InfineonHMI;
|
||||
|
||||
public sealed partial class MainWindowVM : ObservableObject, IRecipient<NavigateMessage>, IDisposable
|
||||
{
|
||||
|
||||
[ObservableProperty]
|
||||
private StringControlButtonVM dummyStringVM;
|
||||
|
||||
[ObservableProperty]
|
||||
private Page currentPage;
|
||||
|
||||
[ObservableProperty]
|
||||
private bool canNavigateBack;
|
||||
|
||||
[ObservableProperty]
|
||||
private Visibility statusBarVisible;
|
||||
|
||||
[ObservableProperty]
|
||||
private string breadcrumb;
|
||||
|
||||
private const string _actualUserPrefix = "Aktueller Benutzer: \n";
|
||||
|
||||
private readonly IAdsManager _adsManager;
|
||||
private readonly IConfiguration _config;
|
||||
private readonly TcEventLogger _eventlogger;
|
||||
|
||||
private User currentUser;
|
||||
// Last active event
|
||||
[ObservableProperty]
|
||||
private string currentActiveEvent = "";
|
||||
[ObservableProperty] private string currentActiveEvent = "";
|
||||
|
||||
private readonly object _lock = new();
|
||||
[ObservableProperty] private Page currentPage;
|
||||
|
||||
[ObservableProperty] private Visibility statusBarVisible;
|
||||
|
||||
[ObservableProperty] private string breadcrumb;
|
||||
|
||||
[ObservableProperty] private string actualUser;
|
||||
|
||||
[ObservableProperty] private string sCurrentPackMLMode;
|
||||
|
||||
[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;
|
||||
@@ -47,19 +66,29 @@ public sealed partial class MainWindowVM : ObservableObject, IRecipient<Navigate
|
||||
NavigateMessage? _currentMessage;
|
||||
|
||||
// Events page view model
|
||||
[ObservableProperty]
|
||||
EventsPageVM _eventsPageVM;
|
||||
[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;
|
||||
|
||||
// Create dummy string
|
||||
DummyStringVM = new StringControlButtonVM();
|
||||
SCurrentPackMLMode = "Aktueller Modus: ";
|
||||
SCurrentPackMLState = "Aktueller Status: ";
|
||||
ActualUser = _actualUserPrefix + "---------";
|
||||
|
||||
// Create empty page
|
||||
_emptyPage = new();
|
||||
@@ -72,9 +101,144 @@ public sealed partial class MainWindowVM : ObservableObject, IRecipient<Navigate
|
||||
_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 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;
|
||||
}
|
||||
SCurrentPackMLState = 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;
|
||||
|
||||
}
|
||||
|
||||
SCurrentPackMLMode = curMode;
|
||||
|
||||
}
|
||||
|
||||
public void ShowOverview()
|
||||
{
|
||||
NavigateMessage message = new("", typeof(ProductionOverviewPage));
|
||||
NavigateMessage nextMessage = new("", typeof(OverviewPage));
|
||||
Navigate(message, nextMessage);
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
@@ -87,25 +251,61 @@ public sealed partial class MainWindowVM : ObservableObject, IRecipient<Navigate
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
public void AutomaticModeClicked()
|
||||
public void ChangeUserClicked()
|
||||
{
|
||||
var userWindowVm = new UserManagementWindowVm(currentUser);
|
||||
CurrentUser = userWindowVm.GetCurrentUserLevel();
|
||||
ProductionWindowClicked();
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void ProductionWindowClicked()
|
||||
{
|
||||
StatusBarVisible = Visibility.Visible;
|
||||
_messageStack.Clear();
|
||||
_currentMessage = new NavigateMessage("", typeof(Page));
|
||||
NavigateMessage message = new(_config["AutomaticModeVarName"]!, typeof(AutomaticModePage));
|
||||
NavigateMessage message = new(_config[""]!, typeof(ProductionOverviewPage));
|
||||
Receive(message);
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
public void ManualModeClicked()
|
||||
private void ProtocolWindowClicked()
|
||||
{
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void ReceipesWindowClicked()
|
||||
{
|
||||
StatusBarVisible = Visibility.Visible;
|
||||
_messageStack.Clear();
|
||||
_currentMessage = new NavigateMessage("", typeof(Page));
|
||||
NavigateMessage message = new("", typeof(BatteryOverviewPage));
|
||||
NavigateMessage message = new(_config[""]!, typeof(ReceipePage));
|
||||
Receive(message);
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void TrendWindowClicked()
|
||||
{
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void ComponentsWindowClicked()
|
||||
{
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void SettingsWindowClicked()
|
||||
{
|
||||
_messageStack.Clear();
|
||||
NavigateMessage message = new("", typeof(SettingsPage));
|
||||
Receive(message);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[RelayCommand]
|
||||
public void EventsListClicked()
|
||||
{
|
||||
@@ -116,46 +316,14 @@ public sealed partial class MainWindowVM : ObservableObject, IRecipient<Navigate
|
||||
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!
|
||||
public void Receive(NavigateMessage message)
|
||||
{
|
||||
// Only change page if its a new page type
|
||||
if (CurrentPage.GetType() == message.type)
|
||||
return;
|
||||
//return;
|
||||
|
||||
// Push current message
|
||||
if (_currentMessage != null)
|
||||
@@ -164,13 +332,11 @@ public sealed partial class MainWindowVM : ObservableObject, IRecipient<Navigate
|
||||
// Save current message for later push
|
||||
_currentMessage = message;
|
||||
|
||||
// Set can navigate back
|
||||
CanNavigateBack = true;
|
||||
|
||||
Navigate(message);
|
||||
}
|
||||
|
||||
private void Navigate(NavigateMessage message)
|
||||
private void Navigate(NavigateMessage message, NavigateMessage? nextMessage = null)
|
||||
{
|
||||
// Dispose current pages viewmodel
|
||||
if (CurrentPage.DataContext is IDisposable viewModel)
|
||||
@@ -182,43 +348,12 @@ public sealed partial class MainWindowVM : ObservableObject, IRecipient<Navigate
|
||||
// Create new page
|
||||
switch (message.type.Name)
|
||||
{
|
||||
case nameof(AutomaticModePage):
|
||||
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(ProductionOverviewPage):
|
||||
|
||||
case nameof(BatteryOverviewPage):
|
||||
var batteryOverviewPageVM = App.AppHost!.Services.GetRequiredService<BatteryOverviewPageVM>();
|
||||
BatteryOverviewPage batteryOverviewPage = new() { DataContext = batteryOverviewPageVM };
|
||||
CurrentPage = batteryOverviewPage;
|
||||
Breadcrumb = "> Manual";
|
||||
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);
|
||||
if (_productionOverviewPageVM == null || nextMessage != null)
|
||||
_productionOverviewPageVM = new ProductionOverviewPageVM(_adsManager, _config, _eventlogger, nextMessage);
|
||||
ProductionOverviewPage productionOverviewPage = new() { DataContext = _productionOverviewPageVM };
|
||||
CurrentPage = productionOverviewPage;
|
||||
break;
|
||||
|
||||
case nameof(EventsPage):
|
||||
@@ -239,6 +374,24 @@ public sealed partial class MainWindowVM : ObservableObject, IRecipient<Navigate
|
||||
Breadcrumb = " > Settings";
|
||||
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:
|
||||
CurrentPage = new Page();
|
||||
break;
|
||||
@@ -256,7 +409,7 @@ public sealed partial class MainWindowVM : ObservableObject, IRecipient<Navigate
|
||||
[RelayCommand]
|
||||
private void AckAlarms()
|
||||
{
|
||||
_adsManager.WriteValue("GVL_SCADA.stAckAlarmsButton.xRequest", true);
|
||||
_adsManager.WriteValue("GVL_SCADA.stMachine.stConfirmAlarmsBtn.xRequest", true);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
@@ -268,6 +421,5 @@ public sealed partial class MainWindowVM : ObservableObject, IRecipient<Navigate
|
||||
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 = "");
|
||||
|
||||
@@ -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 TwinCAT.TypeSystem;
|
||||
|
||||
namespace UniperHMI;
|
||||
namespace InfineonHMI;
|
||||
|
||||
public enum E_COMPONENT_STATUS : short
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Heisig.HMI.AdsManager;
|
||||
|
||||
namespace UniperHMI;
|
||||
namespace InfineonHMI;
|
||||
|
||||
public sealed partial class StringControlButtonVM : SMUBaseVM, IDisposable
|
||||
{
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
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(IAdsManager adsManager, string variableName) : base(adsManager, variableName) { }
|
||||
@@ -15,5 +15,4 @@ namespace UniperHMI.OwnControls
|
||||
{
|
||||
WeakReferenceMessenger.Default.Send(new NavigateMessage(_variableName, typeof(UnitDetailsControl)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,10 +4,10 @@ using HMIToolkit;
|
||||
using TwinCAT.TypeSystem;
|
||||
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;
|
||||
|
||||
@@ -490,5 +490,4 @@ namespace UniperHMI
|
||||
_windowPumpPosolyt!.Close();
|
||||
_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: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:local="clr-namespace:InfineonHMI"
|
||||
d:DataContext="{d:DesignInstance Type=local:StringControlButtonVM, IsDesignTimeCreatable=True}"
|
||||
mc:Ignorable="d"
|
||||
Style="{StaticResource MahApps.Styles.Button}"
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace UniperHMI
|
||||
namespace InfineonHMI;
|
||||
|
||||
/// <summary>
|
||||
/// Interaktionslogik für StringControlButton.xaml
|
||||
/// </summary>
|
||||
public partial class SMUControlButton : Button
|
||||
{
|
||||
/// <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
|
||||
{
|
||||
@@ -19,5 +19,4 @@ namespace UniperHMI
|
||||
{
|
||||
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: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:local="clr-namespace:InfineonHMI"
|
||||
mc:Ignorable="d"
|
||||
d:DataContext="{d:DesignInstance Type=local:UnitDetailsControlVM, IsDesignTimeCreatable=True}"
|
||||
HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" Width="Auto" Height="Auto"
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace UniperHMI
|
||||
namespace InfineonHMI;
|
||||
|
||||
/// <summary>
|
||||
/// Interaktionslogik für UnitControl.xaml
|
||||
/// </summary>
|
||||
public partial class UnitDetailsControl : UserControl
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für UnitControl.xaml
|
||||
/// </summary>
|
||||
public partial class UnitDetailsControl : UserControl
|
||||
{
|
||||
public static readonly DependencyProperty UnitNameProperty = DependencyProperty.Register("UnitName", typeof(string), typeof(UnitDetailsControl));
|
||||
public String UnitName
|
||||
{
|
||||
@@ -18,5 +18,4 @@ namespace UniperHMI
|
||||
{
|
||||
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,10 +3,10 @@ using System.Collections.ObjectModel;
|
||||
using System.Windows;
|
||||
using TcEventLoggerAdsProxyLib;
|
||||
|
||||
namespace UniperHMI
|
||||
namespace InfineonHMI;
|
||||
|
||||
public partial class EventData : ObservableObject
|
||||
{
|
||||
public partial class EventData : ObservableObject
|
||||
{
|
||||
[ObservableProperty]
|
||||
public uint id;
|
||||
|
||||
@@ -21,10 +21,10 @@ namespace UniperHMI
|
||||
|
||||
[ObservableProperty]
|
||||
public DateTime confirmed;
|
||||
};
|
||||
};
|
||||
|
||||
public sealed partial class EventsPageVM : ObservableObject
|
||||
{
|
||||
public sealed partial class EventsPageVM : ObservableObject
|
||||
{
|
||||
public ObservableCollection<EventData> CurrentEvents { get; private set; } = [];
|
||||
private readonly object _lock = new();
|
||||
|
||||
@@ -45,7 +45,12 @@ namespace UniperHMI
|
||||
_logger.AlarmCleared += SimpleAlarmClearedEvent;
|
||||
_logger.AlarmConfirmed += SimpleConfirmedAlarmEvent;
|
||||
|
||||
_logger.Connect("10.103.32.50.1.1");
|
||||
#if DEBUG
|
||||
|
||||
#else
|
||||
|
||||
_logger.Connect("5.127.104.206.1.1");
|
||||
#endif
|
||||
|
||||
GetAllActiveEvents();
|
||||
}
|
||||
@@ -105,5 +110,4 @@ namespace UniperHMI
|
||||
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: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:local="clr-namespace:InfineonHMI"
|
||||
mc:Ignorable="d"
|
||||
d:DataContext="{d:DesignInstance Type=local:EventsPageVM, IsDesignTimeCreatable=False}"
|
||||
d:DesignHeight="450" d:DesignWidth="800"
|
||||
@@ -13,7 +13,7 @@
|
||||
</Page.Resources>
|
||||
|
||||
<Grid>
|
||||
<DataGrid ItemsSource="{Binding CurrentEvents}" AutoGenerateColumns="False" IsReadOnly="True">
|
||||
<DataGrid ItemsSource="{Binding CurrentEvents}" FontSize="30" AutoGenerateColumns="False" IsReadOnly="True">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="Message" Binding="{Binding Message}" Width="400"/>
|
||||
<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