Push Changes from Techcrafters Repo

This commit is contained in:
2026-03-05 14:37:43 +01:00
parent d2665d17fa
commit 9636ff0457
215 changed files with 5052 additions and 14150 deletions

View 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>

View File

@@ -1,127 +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
namespace InfineonHMI.Common;
public static class L4ItXmlSerializer
{
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)
{
/// <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>
if (string.IsNullOrEmpty(fileName))
return;
public static void SerializeObject<T>(T serializableObject, string fileName, bool encrypt = false, string rootElementName = null)
if (serializableObject == null)
return;
XmlSerializer serializer;
if (rootElementName != null)
{
if (string.IsNullOrEmpty(fileName))
return;
var xmlRoot = new XmlRootAttribute(rootElementName);
serializer = new XmlSerializer(serializableObject.GetType(), xmlRoot);
}
else
{
serializer = new XmlSerializer(serializableObject.GetType());
}
if (serializableObject == null)
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 xmlRoot = new XmlRootAttribute(rootElementName);
serializer = new XmlSerializer(serializableObject.GetType(), xmlRoot);
var root = new XmlRootAttribute(rootElementName);
serializer = new XmlSerializer(outType, root);
}
else
{
serializer = new XmlSerializer(serializableObject.GetType());
serializer = new XmlSerializer(outType);
}
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);
}
using XmlReader reader = new XmlTextReader(read);
objectOut = (T)serializer.Deserialize(reader)!;
}
/// <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)
catch (Exception ex)
{
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;
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;
}
}

View File

@@ -6,11 +6,9 @@
xmlns:common="clr-namespace:Common"
xmlns:HMIToolkit="clr-namespace:HMIToolkit"
d:DataContext="{d:DesignInstance Type=common:MediaContainerVm, IsDesignTimeCreatable=True}"
mc:Ignorable="d"
Width="Auto"
Height="Auto"
MinWidth="200">
<UserControl.Resources>
mc:Ignorable="d">
<UserControl.Resources>
<HMIToolkit:FeedbackToColorConverter x:Key="feedbackConverter" />
</UserControl.Resources>
<!-- :DataContext="{d:DesignInstance Type=local:AnalogValueVM, IsDesignTimeCreatable=True}" -->
@@ -19,65 +17,85 @@
<Style TargetType="UserControl">
<!-- Property="Background" Value="White" /> -->
<Setter Property="Height" Value="300" />
<Setter Property="Width" Value="100" />
</Style>
</d:DesignerProperties.DesignStyle>
<Grid Height="Auto">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition Width="25*"/>
<ColumnDefinition Width="25*"/>
<ColumnDefinition Width="50*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="10*"/>
<RowDefinition Height="30*"/>
<RowDefinition Height="30*"/>
<RowDefinition Height="30*"/>
<RowDefinition Height="70"/>
<RowDefinition Height="100"/>
<RowDefinition Height="100"/>
<RowDefinition Height="180"/>
</Grid.RowDefinitions>
<Border Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="2" BorderBrush="White" BorderThickness="2"/>
<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="2" Content="{Binding SName, Mode=OneWay }" HorizontalAlignment="Center" FontSize="24"/>
<Label Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3" HorizontalContentAlignment="Center" Content="{Binding SName, Mode=OneWay }" FontSize="35"/>
<Grid Grid.Row="1">
<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" HorizontalAlignment="Center" FontSize="16"/>
<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"/>
</Grid>
<Grid Grid.Column="0" Grid.Row="2">
<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="16"/>
<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"/>
</Grid>
<Grid Grid.Row="3">
<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="16"/>
<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"/>
</Grid>
<Border Grid.Column="1" Grid.Row="1" Grid.RowSpan="3" BorderBrush="White" BorderThickness="1"></Border>
<Grid Grid.Column="1" Grid.Row="1" Grid.RowSpan="3">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Button x:Name="btnFill" DataContext="{Binding FillButton}" Command="{Binding ButtonClickedCommand}" IsEnabled="{Binding XRelease}" Background="{Binding IFeedback, Converter={StaticResource feedbackConverter}}" Grid.Row="0" Grid.Column="0" Content="Füllen" Margin="5" />
<Button x:Name="btnOpen" DataContext="{Binding EmptyButton}" Command="{Binding ButtonClickedCommand}" IsEnabled="{Binding XRelease}" Background="{Binding IFeedback, Converter={StaticResource feedbackConverter}}" Grid.Row="1" Grid.Column="0" Content="Leeren" Margin="5" />
</Grid>
<Border Grid.Column="1" Grid.Row="1" BorderBrush="White" BorderThickness="1"/>
</Grid>
<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>

View File

@@ -2,31 +2,30 @@
using System.Windows.Controls;
using System.Windows.Input;
namespace Common
namespace Common;
/// <summary>
/// Interaktionslogik für AnalogValue.xaml
/// </summary>
public partial class MediaContainer : UserControl
{
/// <summary>
/// Interaktionslogik für AnalogValue.xaml
/// </summary>
public partial class MediaContainer : UserControl
{
public bool IsReadonly { get; set; }
public bool IsReadonly { get; set; }
public MediaContainer()
{
InitializeComponent();
// Unloaded += OnUnloaded;
}
public MediaContainer()
{
InitializeComponent();
// Unloaded += OnUnloaded;
}
private void OnUnloaded(object? sender, EventArgs e)
{
var disposable = DataContext as IDisposable;
disposable?.Dispose();
}
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);
}
}
private void NumberValidation(object sender, TextCompositionEventArgs e)
{
Regex regex = new("^[-+]?[0-9]*,?[0-9]+$");
e.Handled = regex.IsMatch(e.Text);
}
}

View File

@@ -0,0 +1,68 @@
<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="15*"/>
<RowDefinition Height="15*"/>
<RowDefinition Height="15*"/>
<RowDefinition Height="15*"/>
</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="9" 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="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="5" Grid.Column="1" Content="Reset" Margin="5" DataContext="{Binding ResetButtonVm}" Command="{Binding ButtonClickedCommand}" IsEnabled="{Binding XRelease}" Background="{Binding IFeedback, Converter={StaticResource feedbackConverter}}" FontSize="32" />
<Button Visibility="Visible" Grid.Row="6" Grid.Column="0" 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="6" Grid.Column="1" 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="7" 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="7" Grid.Column="1" 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="8" Grid.Column="0" 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="8" Grid.Column="1" Content="Unsuspend" Margin="5" DataContext="{Binding UnsuspendButtonVm}" Command="{Binding ButtonClickedCommand}" IsEnabled="{Binding XRelease}" Background="{Binding IFeedback, Converter={StaticResource feedbackConverter}}" FontSize="32" />
</Grid>
</UserControl>

View File

@@ -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()
{
InitializeComponent();
}
}
public PackMLControl()
{
InitializeComponent();
}
}

View File

@@ -0,0 +1,201 @@
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 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();
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");
_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()
{
}
}

View File

@@ -6,27 +6,20 @@
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">
<!-- :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="40" />
<Setter Property="Width" Value="280" />
</Style>
</d:DesignerProperties.DesignStyle>
<Grid Height="Auto">
<Grid Height="70">
<Grid.ColumnDefinitions>
<!-- <ColumnDefinition Width="Auto" /> -->
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="400" />
<ColumnDefinition Width="200" />
</Grid.ColumnDefinitions>
<!-- <Label Grid.Column="0" Content="{Binding SName}" VerticalAlignment="Center" HorizontalAlignment="Left"/> -->
<Label x:Name="tbName" Grid.Column="0" Content="{Binding SName, Mode=OneWay }" Width="200"/>
<TextBox x:Name="tbValue" Text="{Binding Value, Mode=TwoWay, StringFormat=N2}" Grid.Column="1" MaxLines="1" Width="80" HorizontalContentAlignment="Right" VerticalContentAlignment="Center" IsReadOnly="{Binding Readonly}" />
<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}" Margin="10" Width="Auto" FontSize="30" Grid.Column="1" MaxLines="1" HorizontalContentAlignment="Right" VerticalContentAlignment="Center" IsReadOnly="{Binding Readonly}" />
</Grid>

View File

@@ -2,31 +2,30 @@
using System.Windows.Controls;
using System.Windows.Input;
namespace Common
namespace Common;
/// <summary>
/// Interaktionslogik für AnalogValue.xaml
/// </summary>
public partial class ParamControlFloat : UserControl
{
/// <summary>
/// Interaktionslogik für AnalogValue.xaml
/// </summary>
public partial class ParamControlFloat : UserControl
{
public bool IsReadonly { get; set; }
public bool IsReadonly { get; set; }
public ParamControlFloat()
{
InitializeComponent();
// Unloaded += OnUnloaded;
}
public ParamControlFloat()
{
InitializeComponent();
// Unloaded += OnUnloaded;
}
private void OnUnloaded(object? sender, EventArgs e)
{
var disposable = DataContext as IDisposable;
disposable?.Dispose();
}
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);
}
}
private void NumberValidation(object sender, TextCompositionEventArgs e)
{
Regex regex = new("^[-+]?[0-9]*,?[0-9]+$");
e.Handled = regex.IsMatch(e.Text);
}
}

View File

@@ -6,28 +6,21 @@
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">
<!-- :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="40" />
<Setter Property="Width" Value="280" />
</Style>
</d:DesignerProperties.DesignStyle>
<Grid Height="Auto">
<Grid Height="70">
<Grid.ColumnDefinitions>
<!-- <ColumnDefinition Width="Auto" /> -->
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="400" />
<ColumnDefinition Width="200" />
</Grid.ColumnDefinitions>
<!-- <Label Grid.Column="0" Content="{Binding SName}" VerticalAlignment="Center" HorizontalAlignment="Left"/> -->
<Label x:Name="tbName" Grid.Column="0" Content="{Binding SName, Mode=OneWay }" Width="200"/>
<TextBox x:Name="tbValue" Text="{Binding Value, Mode=TwoWay}" Grid.Column="1" MaxLines="1" Width="80" HorizontalContentAlignment="Right" VerticalContentAlignment="Center" IsReadOnly="{Binding Readonly}" />
<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}" Margin="10" Width="Auto" FontSize="30" Grid.Column="1" MaxLines="1" HorizontalContentAlignment="Right" VerticalContentAlignment="Center" IsReadOnly="{Binding Readonly}" />
</Grid>
</Grid>
</UserControl>

View File

@@ -2,31 +2,30 @@
using System.Windows.Controls;
using System.Windows.Input;
namespace Common
namespace Common;
/// <summary>
/// Interaktionslogik für AnalogValue.xaml
/// </summary>
public partial class ParamControlInt : UserControl
{
/// <summary>
/// Interaktionslogik für AnalogValue.xaml
/// </summary>
public partial class ParamControlInt : UserControl
{
public bool IsReadonly { get; set; }
public bool IsReadonly { get; set; }
public ParamControlInt()
{
InitializeComponent();
// Unloaded += OnUnloaded;
}
public ParamControlInt()
{
InitializeComponent();
// Unloaded += OnUnloaded;
}
private void OnUnloaded(object? sender, EventArgs e)
{
var disposable = DataContext as IDisposable;
disposable?.Dispose();
}
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);
}
}
private void NumberValidation(object sender, TextCompositionEventArgs e)
{
Regex regex = new("^[-+]?[0-9]*,?[0-9]+$");
e.Handled = regex.IsMatch(e.Text);
}
}

View 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;
}
}

View 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>

View 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;
}
}

View File

@@ -0,0 +1,213 @@
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
{
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;
}
}

View 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;
}
}

View File

@@ -2,32 +2,31 @@
using System.Windows;
using System.Windows.Data;
namespace InfineonHMI
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)
{
if (value is DateTime dt)
{
// 599264352000000000 ticks is a date used by beckhoff for events that didnt happen up to this point
public const long NoTime = 599264352000000000;
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is DateTime dt)
{
if (dt.Ticks == NoTime)
return "";
else
{
CultureInfo cultureInfo = CultureInfo.CurrentCulture;
return dt.ToString("G", cultureInfo);
}
}
else
throw new InvalidOperationException("Target must be of type DateTime");
}
if (dt.Ticks == NoTime)
return "";
else
{
CultureInfo cultureInfo = CultureInfo.CurrentCulture;
return dt.ToString("G", cultureInfo);
}
}
else
throw new InvalidOperationException("Target must be of type DateTime");
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return DependencyProperty.UnsetValue;
}
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return DependencyProperty.UnsetValue;
}
}

View File

@@ -1,15 +1,14 @@
using System.Windows;
namespace InfineonHMI
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();
}
}
public BinaryValveWindow()
{
InitializeComponent();
}
}

View File

@@ -1,23 +1,22 @@
using System.Windows.Controls;
namespace HMIToolkit
{
/// <summary>
/// Interaktionslogik für AnalogMotorControl.xaml
/// </summary>
public partial class AnalogMotorControl : UserControl
{
public AnalogMotorControl()
{
InitializeComponent();
// Unloaded += OnUnloaded;
}
namespace HMIToolkit;
private void OnUnloaded(object? sender, EventArgs e)
{
var disposable = DataContext as IDisposable;
disposable?.Dispose();
}
}
/// <summary>
/// Interaktionslogik für AnalogMotorControl.xaml
/// </summary>
public partial class AnalogMotorControl : UserControl
{
public AnalogMotorControl()
{
InitializeComponent();
// Unloaded += OnUnloaded;
}
private void OnUnloaded(object? sender, EventArgs e)
{
var disposable = DataContext as IDisposable;
disposable?.Dispose();
}
}

View File

@@ -2,82 +2,81 @@
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";
[ObservableProperty]
private string sName = "No Name";
public HMIControlButtonVM? AutomaticButton { get; private set; }
public HMIControlButtonVM? ManualButton { get; private set; }
public HMIControlButtonVM StartButton { get; private set; }
public HMIControlButtonVM StopButton { get; private set; }
public IntlkControlVM? Interlocks { get; private set; }
public AnalogValueVM? Setpoint { get; private set; }
public AnalogValueVM? ProcessValue { get; private set; }
public HMIControlButtonVM? AutomaticButton { get; private set; }
public HMIControlButtonVM? ManualButton { get; private set; }
public HMIControlButtonVM StartButton { get; private set; }
public HMIControlButtonVM StopButton { get; private set; }
public IntlkControlVM? Interlocks { get; private set; }
public AnalogValueVM? Setpoint { get; private set; }
public AnalogValueVM? ProcessValue { get; private set; }
private readonly string? _variableName;
private readonly string? _variableName;
private IAdsManager? _adsManager;
private IAdsManager? _adsManager;
public AnalogMotorControlVM()
{
AutomaticButton = new HMIControlButtonVM();
ManualButton = new HMIControlButtonVM();
StartButton = new HMIControlButtonVM();
StopButton = new HMIControlButtonVM();
Interlocks = new IntlkControlVM();
Setpoint = new AnalogValueVM();
ProcessValue = new AnalogValueVM();
}
public AnalogMotorControlVM()
{
AutomaticButton = new HMIControlButtonVM();
ManualButton = new HMIControlButtonVM();
StartButton = new HMIControlButtonVM();
StopButton = new HMIControlButtonVM();
Interlocks = new IntlkControlVM();
Setpoint = new AnalogValueVM();
ProcessValue = new AnalogValueVM();
}
public AnalogMotorControlVM(IAdsManager adsManager, string variableName)
{
_adsManager = adsManager;
_variableName = variableName;
AutomaticButton = new HMIControlButtonVM(_adsManager, _variableName + ".stAutomaticButton");
ManualButton = new HMIControlButtonVM(_adsManager, _variableName + ".stManualButton");
StartButton = new HMIControlButtonVM(_adsManager, _variableName + ".stStartButton");
StopButton = new HMIControlButtonVM(_adsManager, _variableName + ".stStopButton");
Interlocks = new IntlkControlVM(_adsManager, _variableName + ".stInterlock");
Setpoint = new AnalogValueVM(_adsManager, _variableName + ".stSetpoint", false);
ProcessValue = new AnalogValueVM(_adsManager, _variableName + ".stProcessValue", true);
public AnalogMotorControlVM(IAdsManager adsManager, string variableName)
{
_adsManager = adsManager;
_variableName = variableName;
AutomaticButton = new HMIControlButtonVM(_adsManager, _variableName + ".stAutomaticButton");
ManualButton = new HMIControlButtonVM(_adsManager, _variableName + ".stManualButton");
StartButton = new HMIControlButtonVM(_adsManager, _variableName + ".stStartButton");
StopButton = new HMIControlButtonVM(_adsManager, _variableName + ".stStopButton");
Interlocks = new IntlkControlVM(_adsManager, _variableName + ".stInterlock");
Setpoint = new AnalogValueVM(_adsManager, _variableName + ".stSetpoint", false);
ProcessValue = new AnalogValueVM(_adsManager, _variableName + ".stProcessValue", true);
_adsManager.Register(_variableName + ".sName", NameChanged);
}
_adsManager.Register(_variableName + ".sName", NameChanged);
}
public void Dispose()
{
_adsManager?.Deregister(_variableName + ".sName", NameChanged);
_adsManager = null;
public void Dispose()
{
_adsManager?.Deregister(_variableName + ".sName", NameChanged);
_adsManager = null;
AutomaticButton?.Dispose();
AutomaticButton = null;
AutomaticButton?.Dispose();
AutomaticButton = null;
ManualButton?.Dispose();
ManualButton = null;
ManualButton?.Dispose();
ManualButton = null;
StartButton?.Dispose();
StartButton = null;
StartButton?.Dispose();
StartButton = null;
StopButton?.Dispose();
StopButton = null;
StopButton?.Dispose();
StopButton = null;
Interlocks?.Dispose();
Interlocks = null;
Interlocks?.Dispose();
Interlocks = null;
Setpoint?.Dispose();
Setpoint = null;
Setpoint?.Dispose();
Setpoint = null;
ProcessValue?.Dispose();
ProcessValue = null;
}
ProcessValue?.Dispose();
ProcessValue = null;
}
private void NameChanged(object? sender, ValueChangedEventArgs e)
{
SName = (string)e.Value;
}
}
private void NameChanged(object? sender, ValueChangedEventArgs e)
{
SName = (string)e.Value;
}
}

View File

@@ -2,32 +2,31 @@
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 Min { get; set; }
public float Max { get; set; }
public float Max { get; set; }
public override ValidationResult Validate(object value, CultureInfo cultureInfo)
{
float analogValue = 0;
public override ValidationResult Validate(object value, CultureInfo cultureInfo)
{
float analogValue = 0;
try
{
if (((string)value).Length > 0)
analogValue = float.Parse((string)value);
}
catch (Exception e)
{
return new ValidationResult(false, $"Illegal characters or {e.Message}");
}
try
{
if (((string)value).Length > 0)
analogValue = float.Parse((string)value);
}
catch (Exception e)
{
return new ValidationResult(false, $"Illegal characters or {e.Message}");
}
if ((analogValue < Min) || (analogValue > Max))
return new ValidationResult(false, $"Please enter a value in the range: {Min}-{Max}.");
if ((analogValue < Min) || (analogValue > Max))
return new ValidationResult(false, $"Please enter a value in the range: {Min}-{Max}.");
return ValidationResult.ValidResult;
}
}
return ValidationResult.ValidResult;
}
}

View File

@@ -2,31 +2,30 @@
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 bool IsReadonly { get; set; }
public AnalogValue()
{
InitializeComponent();
// Unloaded += OnUnloaded;
}
public AnalogValue()
{
InitializeComponent();
// Unloaded += OnUnloaded;
}
private void OnUnloaded(object? sender, EventArgs e)
{
var disposable = DataContext as IDisposable;
disposable?.Dispose();
}
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);
}
}
private void NumberValidation(object sender, TextCompositionEventArgs e)
{
Regex regex = new("^[-+]?[0-9]*,?[0-9]+$");
e.Handled = regex.IsMatch(e.Text);
}
}

View File

@@ -13,23 +13,22 @@ using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace HMIToolkit
{
/// <summary>
/// Interaktionslogik für AnalogValveControl.xaml
/// </summary>
public partial class AnalogValveControl : UserControl
{
public AnalogValveControl()
{
InitializeComponent();
// Unloaded += OnUnloaded;
}
namespace HMIToolkit;
private void OnUnloaded(object? sender, EventArgs e)
{
var disposable = DataContext as IDisposable;
disposable?.Dispose();
}
}
/// <summary>
/// Interaktionslogik für AnalogValveControl.xaml
/// </summary>
public partial class AnalogValveControl : UserControl
{
public AnalogValveControl()
{
InitializeComponent();
// Unloaded += OnUnloaded;
}
private void OnUnloaded(object? sender, EventArgs e)
{
var disposable = DataContext as IDisposable;
disposable?.Dispose();
}
}

View File

@@ -2,82 +2,81 @@
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";
[ObservableProperty]
private string sName = "No Name";
public HMIControlButtonVM? AutomaticButton { get; private set; }
public HMIControlButtonVM? ManualButton { get; private set; }
public HMIControlButtonVM? OpenButton { get; private set; }
public HMIControlButtonVM? CloseButton { get; private set; }
public IntlkControlVM? Interlocks { get; private set; }
public AnalogValueVM? Setpoint { get; private set; }
public AnalogValueVM? ProcessValue { get; private set; }
public HMIControlButtonVM? AutomaticButton { get; private set; }
public HMIControlButtonVM? ManualButton { get; private set; }
public HMIControlButtonVM? OpenButton { get; private set; }
public HMIControlButtonVM? CloseButton { get; private set; }
public IntlkControlVM? Interlocks { get; private set; }
public AnalogValueVM? Setpoint { get; private set; }
public AnalogValueVM? ProcessValue { get; private set; }
private readonly string? _variableName;
private readonly string? _variableName;
private IAdsManager? _adsManager;
private IAdsManager? _adsManager;
public AnalogValveControlVM()
{
AutomaticButton = new HMIControlButtonVM();
ManualButton = new HMIControlButtonVM();
OpenButton = new HMIControlButtonVM();
CloseButton = new HMIControlButtonVM();
Interlocks = new IntlkControlVM();
Setpoint = new AnalogValueVM();
ProcessValue = new AnalogValueVM();
}
public AnalogValveControlVM()
{
AutomaticButton = new HMIControlButtonVM();
ManualButton = new HMIControlButtonVM();
OpenButton = new HMIControlButtonVM();
CloseButton = new HMIControlButtonVM();
Interlocks = new IntlkControlVM();
Setpoint = new AnalogValueVM();
ProcessValue = new AnalogValueVM();
}
public AnalogValveControlVM(IAdsManager adsManager, string variableName)
{
_adsManager = adsManager;
_variableName = variableName;
AutomaticButton = new HMIControlButtonVM(_adsManager, _variableName + ".stAutomaticButton");
ManualButton = new HMIControlButtonVM(_adsManager, _variableName + ".stManualButton");
OpenButton = new HMIControlButtonVM(_adsManager, _variableName + ".stOpenButton");
CloseButton = new HMIControlButtonVM(_adsManager, _variableName + ".stCloseButton");
Interlocks = new IntlkControlVM(_adsManager, _variableName + ".stInterlock");
Setpoint = new AnalogValueVM(_adsManager, _variableName + ".stSetpoint", false);
ProcessValue = new AnalogValueVM(_adsManager, _variableName + ".stProcessValue", true);
public AnalogValveControlVM(IAdsManager adsManager, string variableName)
{
_adsManager = adsManager;
_variableName = variableName;
AutomaticButton = new HMIControlButtonVM(_adsManager, _variableName + ".stAutomaticButton");
ManualButton = new HMIControlButtonVM(_adsManager, _variableName + ".stManualButton");
OpenButton = new HMIControlButtonVM(_adsManager, _variableName + ".stOpenButton");
CloseButton = new HMIControlButtonVM(_adsManager, _variableName + ".stCloseButton");
Interlocks = new IntlkControlVM(_adsManager, _variableName + ".stInterlock");
Setpoint = new AnalogValueVM(_adsManager, _variableName + ".stSetpoint", false);
ProcessValue = new AnalogValueVM(_adsManager, _variableName + ".stProcessValue", true);
_adsManager.Register(_variableName + ".sName", NameChanged);
}
_adsManager.Register(_variableName + ".sName", NameChanged);
}
public void Dispose()
{
_adsManager?.Deregister(_variableName + ".sName", NameChanged);
_adsManager = null;
public void Dispose()
{
_adsManager?.Deregister(_variableName + ".sName", NameChanged);
_adsManager = null;
AutomaticButton?.Dispose();
AutomaticButton = null;
AutomaticButton?.Dispose();
AutomaticButton = null;
ManualButton?.Dispose();
ManualButton = null;
ManualButton?.Dispose();
ManualButton = null;
OpenButton?.Dispose();
OpenButton = null;
OpenButton?.Dispose();
OpenButton = null;
CloseButton?.Dispose();
CloseButton = null;
CloseButton?.Dispose();
CloseButton = null;
Interlocks?.Dispose();
Interlocks = null;
Interlocks?.Dispose();
Interlocks = null;
Setpoint?.Dispose();
Setpoint = null;
Setpoint?.Dispose();
Setpoint = null;
ProcessValue?.Dispose();
ProcessValue = null;
}
ProcessValue?.Dispose();
ProcessValue = null;
}
private void NameChanged(object? sender, ValueChangedEventArgs e)
{
SName = (string)e.Value;
}
}
private void NameChanged(object? sender, ValueChangedEventArgs e)
{
SName = (string)e.Value;
}
}

View File

@@ -20,9 +20,9 @@
<Setter Property="Width" Value="Auto" />
</Style>
</d:DesignerProperties.DesignStyle>
<Border BorderThickness="2" BorderBrush="White">
<Grid Margin="5">
<Grid.RowDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="55" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
@@ -72,5 +72,6 @@
<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>
</Grid>
</Border>
</UserControl>

View File

@@ -13,23 +13,22 @@ using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace HMIToolkit
{
/// <summary>
/// Interaktionslogik für BinaryValveControl.xaml
/// </summary>
public partial class BinaryValveControl : UserControl
{
public BinaryValveControl()
{
InitializeComponent();
// Unloaded += OnUnloaded;
}
namespace HMIToolkit;
private void OnUnloaded(object? sender, EventArgs e)
{
var disposable = DataContext as IDisposable;
disposable?.Dispose();
}
}
/// <summary>
/// Interaktionslogik für BinaryValveControl.xaml
/// </summary>
public partial class BinaryValveControl : UserControl
{
public BinaryValveControl()
{
InitializeComponent();
// Unloaded += OnUnloaded;
}
private void OnUnloaded(object? sender, EventArgs e)
{
var disposable = DataContext as IDisposable;
disposable?.Dispose();
}
}

View File

@@ -4,67 +4,66 @@ 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";
[ObservableProperty]
private string sName = "No Name";
public HMIControlButtonVM? AutomaticButton { get; private set; }
public HMIControlButtonVM? ManualButton { get; private set; }
public HMIControlButtonVM OpenButton { get; private set; }
public HMIControlButtonVM CloseButton { get; private set; }
public IntlkControlVM? Interlocks { get; private set; }
public HMIControlButtonVM? AutomaticButton { get; private set; }
public HMIControlButtonVM? ManualButton { get; private set; }
public HMIControlButtonVM OpenButton { get; private set; }
public HMIControlButtonVM CloseButton { get; private set; }
public IntlkControlVM? Interlocks { get; private set; }
private readonly string? _variableName;
private readonly string? _variableName;
private IAdsManager? _adsManager;
private IAdsManager? _adsManager;
public BinaryValveControlVM()
{
AutomaticButton = new HMIControlButtonVM();
ManualButton = new HMIControlButtonVM();
OpenButton = new HMIControlButtonVM();
CloseButton = new HMIControlButtonVM();
Interlocks = new IntlkControlVM();
}
public BinaryValveControlVM()
{
AutomaticButton = new HMIControlButtonVM();
ManualButton = new HMIControlButtonVM();
OpenButton = new HMIControlButtonVM();
CloseButton = new HMIControlButtonVM();
Interlocks = new IntlkControlVM();
}
public BinaryValveControlVM(IAdsManager adsManager, string variableName)
{
_adsManager = adsManager;
_variableName = variableName;
AutomaticButton = new HMIControlButtonVM(_adsManager, _variableName + ".stAutomaticButton");
ManualButton = new HMIControlButtonVM(_adsManager, _variableName + ".stManualButton");
OpenButton = new HMIControlButtonVM(_adsManager, _variableName + ".stOpenButton");
CloseButton = new HMIControlButtonVM(_adsManager, _variableName + ".stCloseButton");
Interlocks = new IntlkControlVM(_adsManager, _variableName + ".stInterlock");
public BinaryValveControlVM(IAdsManager adsManager, string variableName)
{
_adsManager = adsManager;
_variableName = variableName;
AutomaticButton = new HMIControlButtonVM(_adsManager, _variableName + ".stAutomaticButton");
ManualButton = new HMIControlButtonVM(_adsManager, _variableName + ".stManualButton");
OpenButton = new HMIControlButtonVM(_adsManager, _variableName + ".stOpenButton");
CloseButton = new HMIControlButtonVM(_adsManager, _variableName + ".stCloseButton");
Interlocks = new IntlkControlVM(_adsManager, _variableName + ".stInterlock");
_adsManager.Register(_variableName + ".sName", NameChanged);
}
_adsManager.Register(_variableName + ".sName", NameChanged);
}
public void Dispose()
{
_adsManager?.Deregister(_variableName + ".sName", NameChanged);
_adsManager = null;
public void Dispose()
{
_adsManager?.Deregister(_variableName + ".sName", NameChanged);
_adsManager = null;
AutomaticButton?.Dispose();
AutomaticButton = null;
AutomaticButton?.Dispose();
AutomaticButton = null;
ManualButton?.Dispose();
ManualButton = null;
ManualButton?.Dispose();
ManualButton = null;
OpenButton?.Dispose();
OpenButton?.Dispose();
CloseButton?.Dispose();
CloseButton?.Dispose();
Interlocks?.Dispose();
Interlocks = null;
}
Interlocks?.Dispose();
Interlocks = null;
}
private void NameChanged(object? sender, ValueChangedEventArgs e)
{
SName = (string)e.Value;
}
}
private void NameChanged(object? sender, ValueChangedEventArgs e)
{
SName = (string)e.Value;
}
}

View File

@@ -3,23 +3,22 @@ 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))
throw new InvalidOperationException("The target must be a brush");
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (targetType != typeof(Brush))
throw new InvalidOperationException("The target must be a brush");
bool temp = bool.Parse(value.ToString()!);
bool temp = bool.Parse(value.ToString()!);
return (temp ? Brushes.DarkGreen : Brushes.DarkRed);
}
return (temp ? Brushes.DarkGreen : Brushes.DarkRed);
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return DependencyProperty.UnsetValue;
}
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return DependencyProperty.UnsetValue;
}
}

View File

@@ -3,72 +3,71 @@ 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;
private IAdsManager? _adsManager;
private readonly string _variableName;
// Action triggered when the button is about to be clicked
public event EventHandler? ButtonClickedStarted;
// Action triggered when the button is about to be clicked
public event EventHandler? ButtonClickedStarted;
// Action triggered when the button is done being clicked
public event EventHandler? ButtonClickedEnded;
// Action triggered when the button is done being clicked
public event EventHandler? ButtonClickedEnded;
// Event when button feedback changed
public event EventHandler? FeedbackChanged;
// Event when button feedback changed
public event EventHandler? FeedbackChanged;
// Event when release changed
public event EventHandler? ReleaseChanged;
// Event when release changed
public event EventHandler? ReleaseChanged;
[ObservableProperty]
private bool xRelease;
[ObservableProperty]
private bool xRelease;
// 0 = none, 1 = active, 2 = pending, 3 = waring, 4 = error
[ObservableProperty]
private short iFeedback;
// 0 = none, 1 = active, 2 = pending, 3 = waring, 4 = error
[ObservableProperty]
private short iFeedback;
public HMIControlButtonVM()
{
_variableName = string.Empty;
XRelease = false;
IFeedback = 4;
}
public HMIControlButtonVM()
{
_variableName = string.Empty;
XRelease = false;
IFeedback = 4;
}
public HMIControlButtonVM(IAdsManager adsManager, string variableName)
{
_adsManager = adsManager;
_variableName = variableName;
public HMIControlButtonVM(IAdsManager adsManager, string variableName)
{
_adsManager = adsManager;
_variableName = variableName;
_adsManager.Register(_variableName + ".xRelease", XReleaseCahnged);
_adsManager.Register(_variableName + ".iFeedback", IFeedbackChanged);
}
_adsManager.Register(_variableName + ".xRelease", XReleaseCahnged);
_adsManager.Register(_variableName + ".iFeedback", IFeedbackChanged);
}
public void Dispose()
{
_adsManager?.Deregister(_variableName + ".xRelease", XReleaseCahnged);
_adsManager?.Deregister(_variableName + ".iFeedback", IFeedbackChanged);
}
public void Dispose()
{
_adsManager?.Deregister(_variableName + ".xRelease", XReleaseCahnged);
_adsManager?.Deregister(_variableName + ".iFeedback", IFeedbackChanged);
}
[RelayCommand]
private void ButtonClicked()
{
ButtonClickedStarted?.Invoke(this, EventArgs.Empty);
_adsManager?.WriteValue(_variableName + ".xRequest", true);
ButtonClickedEnded?.Invoke(this, EventArgs.Empty);
}
[RelayCommand]
private void ButtonClicked()
{
ButtonClickedStarted?.Invoke(this, EventArgs.Empty);
_adsManager?.WriteValue(_variableName + ".xRequest", true);
ButtonClickedEnded?.Invoke(this, EventArgs.Empty);
}
private void XReleaseCahnged(object? sender, ValueChangedEventArgs e)
{
XRelease = (bool)e.Value;
ReleaseChanged?.Invoke(this, EventArgs.Empty);
}
private void XReleaseCahnged(object? sender, ValueChangedEventArgs e)
{
XRelease = (bool)e.Value;
ReleaseChanged?.Invoke(this, EventArgs.Empty);
}
private void IFeedbackChanged(object? sender, ValueChangedEventArgs e)
{
IFeedback = (short)e.Value;
FeedbackChanged?.Invoke(this, EventArgs.Empty);
}
}
private void IFeedbackChanged(object? sender, ValueChangedEventArgs e)
{
IFeedback = (short)e.Value;
FeedbackChanged?.Invoke(this, EventArgs.Empty);
}
}

View File

@@ -13,23 +13,22 @@ using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace HMIToolkit
{
/// <summary>
/// Interaktionslogik für ProcessIntlkButtonControl.xaml
/// </summary>
public partial class IntlkButtonControl : UserControl
{
public IntlkButtonControl()
{
InitializeComponent();
// Unloaded += OnUnloaded;
}
namespace HMIToolkit;
private void OnUnloaded(object? sender, EventArgs e)
{
var disposable = DataContext as IDisposable;
disposable?.Dispose();
}
}
/// <summary>
/// Interaktionslogik für ProcessIntlkButtonControl.xaml
/// </summary>
public partial class IntlkButtonControl : UserControl
{
public IntlkButtonControl()
{
InitializeComponent();
// Unloaded += OnUnloaded;
}
private void OnUnloaded(object? sender, EventArgs e)
{
var disposable = DataContext as IDisposable;
disposable?.Dispose();
}
}

View File

@@ -13,23 +13,22 @@ using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace HMIToolkit
{
/// <summary>
/// Interaktionslogik für IntlkDetails.xaml
/// </summary>
public partial class IntlkDetails : UserControl
{
public IntlkDetails()
{
InitializeComponent();
// Unloaded += OnUnloaded;
}
namespace HMIToolkit;
private void OnUnloaded(object? sender, EventArgs e)
{
var disposable = DataContext as IDisposable;
disposable?.Dispose();
}
}
/// <summary>
/// Interaktionslogik für IntlkDetails.xaml
/// </summary>
public partial class IntlkDetails : UserControl
{
public IntlkDetails()
{
InitializeComponent();
// Unloaded += OnUnloaded;
}
private void OnUnloaded(object? sender, EventArgs e)
{
var disposable = DataContext as IDisposable;
disposable?.Dispose();
}
}

View File

@@ -5,147 +5,146 @@ 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;
[ObservableProperty]
private string interlockName;
[ObservableProperty]
private BitArray interlockStatus;
[ObservableProperty]
private BitArray interlockStatus;
[ObservableProperty]
private string[] interlockNames;
[ObservableProperty]
private string[] interlockNames;
[ObservableProperty]
private ListBoxItem[] listBoxItemsLeft;
[ObservableProperty]
private ListBoxItem[] listBoxItemsLeft;
[ObservableProperty]
private ListBoxItem[] listBoxItemsRight;
[ObservableProperty]
private ListBoxItem[] listBoxItemsRight;
[ObservableProperty]
private Visibility isVisible;
[ObservableProperty]
private Visibility isVisible;
private readonly BoolToBrushConverter boolToBrushConverter = new();
private readonly BoolToBrushConverter boolToBrushConverter = new();
private readonly int numIntlksLeftSide;
private readonly int numIntlksRightSide;
private readonly int numIntlksLeftSide;
private readonly int numIntlksRightSide;
private readonly string _variableNameStatus;
private readonly string _variableNameNames;
private readonly string _variableNameStatus;
private readonly string _variableNameNames;
private IAdsManager? _adsManager;
private IAdsManager? _adsManager;
public IntlkDetailsVM()
{
interlockName = "Interlocks";
interlockStatus = new BitArray(HMIConstants.NumInterlocks);
interlockNames = new string[HMIConstants.NumInterlocks];
Array.Fill(interlockNames, "Not used");
public IntlkDetailsVM()
{
interlockName = "Interlocks";
interlockStatus = new BitArray(HMIConstants.NumInterlocks);
interlockNames = new string[HMIConstants.NumInterlocks];
Array.Fill(interlockNames, "Not used");
// Split all interlocks into two parts
numIntlksLeftSide = (int)Math.Ceiling(HMIConstants.NumInterlocks * 0.5);
numIntlksRightSide = HMIConstants.NumInterlocks - numIntlksLeftSide;
// Split all interlocks into two parts
numIntlksLeftSide = (int)Math.Ceiling(HMIConstants.NumInterlocks * 0.5);
numIntlksRightSide = HMIConstants.NumInterlocks - numIntlksLeftSide;
listBoxItemsLeft = new ListBoxItem[numIntlksLeftSide];
listBoxItemsRight = new ListBoxItem[numIntlksRightSide];
listBoxItemsLeft = new ListBoxItem[numIntlksLeftSide];
listBoxItemsRight = new ListBoxItem[numIntlksRightSide];
_variableNameStatus = System.String.Empty;
_variableNameNames = System.String.Empty;
_variableNameStatus = System.String.Empty;
_variableNameNames = System.String.Empty;
// CreateContent();
}
// CreateContent();
}
public IntlkDetailsVM(IAdsManager adsManager, string variableNameStatus, string variableNameNames, string intlkName) : this()
{
interlockName = intlkName;
_variableNameStatus = variableNameStatus;
_variableNameNames = variableNameNames;
_adsManager = adsManager;
public IntlkDetailsVM(IAdsManager adsManager, string variableNameStatus, string variableNameNames, string intlkName) : this()
{
interlockName = intlkName;
_variableNameStatus = variableNameStatus;
_variableNameNames = variableNameNames;
_adsManager = adsManager;
interlockStatus = new BitArray(HMIConstants.NumInterlocks);
interlockNames = new string[HMIConstants.NumInterlocks];
interlockStatus = new BitArray(HMIConstants.NumInterlocks);
interlockNames = new string[HMIConstants.NumInterlocks];
_adsManager.Register(_variableNameStatus, InterlockStatusChanged);
_adsManager.Register(_variableNameNames, InterlockNamesChanged);
}
_adsManager.Register(_variableNameStatus, InterlockStatusChanged);
_adsManager.Register(_variableNameNames, InterlockNamesChanged);
}
public void Dispose()
{
_adsManager?.Deregister(_variableNameStatus, InterlockStatusChanged);
_adsManager?.Deregister(_variableNameNames, InterlockNamesChanged);
public void Dispose()
{
_adsManager?.Deregister(_variableNameStatus, InterlockStatusChanged);
_adsManager?.Deregister(_variableNameNames, InterlockNamesChanged);
_adsManager = null;
}
_adsManager = null;
}
/*private void CreateContent()
{
// Create left side
for (int i = 0; i < HMIConstants.NumInterlocks; i++)
{
// Create the stack panel
StackPanel stackPanel = new StackPanel
{
Orientation = Orientation.Horizontal
};
/*private void CreateContent()
{
// Create left side
for (int i = 0; i < HMIConstants.NumInterlocks; i++)
{
// Create the stack panel
StackPanel stackPanel = new StackPanel
{
Orientation = Orientation.Horizontal
};
// Create the box
// <Rectangle Width="10" Height="10" Fill="{Binding Path=InterlockStatus[10], Converter={StaticResource myBoolConverter}}" RadiusX="2" RadiusY="2" Margin="0,2,0,0"/>
Rectangle rectangle = new Rectangle
{
Width = 10,
Height = 10,
RadiusX = 2,
RadiusY = 2
};
// Create the box
// <Rectangle Width="10" Height="10" Fill="{Binding Path=InterlockStatus[10], Converter={StaticResource myBoolConverter}}" RadiusX="2" RadiusY="2" Margin="0,2,0,0"/>
Rectangle rectangle = new Rectangle
{
Width = 10,
Height = 10,
RadiusX = 2,
RadiusY = 2
};
// Create binding
Binding binding = new()
{
Source = this,
Path = new PropertyPath("InterlockStatus[" + i + "]"),
Converter = boolToBrushConverter,
};
// Create binding
Binding binding = new()
{
Source = this,
Path = new PropertyPath("InterlockStatus[" + i + "]"),
Converter = boolToBrushConverter,
};
// Set binding
rectangle.SetBinding(Rectangle.FillProperty, binding);
// Set binding
rectangle.SetBinding(Rectangle.FillProperty, binding);
// Create label
Label label = new();
binding = new()
{
Source = this,
Path = new PropertyPath("InterlockNames[" + i + "]")
};
label.SetBinding(Label.ContentProperty, binding);
// Create label
Label label = new();
binding = new()
{
Source = this,
Path = new PropertyPath("InterlockNames[" + i + "]")
};
label.SetBinding(Label.ContentProperty, binding);
// Add items to stack panel
stackPanel.Children.Add(rectangle);
stackPanel.Children.Add(label);
// Add items to stack panel
stackPanel.Children.Add(rectangle);
stackPanel.Children.Add(label);
// Add stack panel to listbox items
ListBoxItem tempListBoxItem = new()
{
Content = stackPanel
};
if (i < numIntlksLeftSide)
ListBoxItemsLeft[i] = tempListBoxItem;
else
ListBoxItemsRight[i - numIntlksLeftSide] = tempListBoxItem;
}
// Add stack panel to listbox items
ListBoxItem tempListBoxItem = new()
{
Content = stackPanel
};
if (i < numIntlksLeftSide)
ListBoxItemsLeft[i] = tempListBoxItem;
else
ListBoxItemsRight[i - numIntlksLeftSide] = tempListBoxItem;
}
}*/
}*/
private void InterlockStatusChanged(object? sender, ValueChangedEventArgs e)
{
ushort temp = (ushort)e.Value;
InterlockStatus = new BitArray(BitConverter.GetBytes(temp));
}
private void InterlockStatusChanged(object? sender, ValueChangedEventArgs e)
{
ushort temp = (ushort)e.Value;
InterlockStatus = new BitArray(BitConverter.GetBytes(temp));
}
private void InterlockNamesChanged(object? sender, ValueChangedEventArgs e)
{
InterlockNames = (string[])e.Value;
}
}
private void InterlockNamesChanged(object? sender, ValueChangedEventArgs e)
{
InterlockNames = (string[])e.Value;
}
}

View File

@@ -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();
}
}
public IntlkDetailsWindow()
{
InitializeComponent();
}
}

View File

@@ -1,218 +1,216 @@
using System.Runtime.InteropServices;
using System.Text;
namespace HMIToolkit
namespace HMIToolkit;
// PLC - C#
// --------
// int - short
// word - ushort
// Constants for interaction with data
public static class HMIConstants
{
// PLC - C#
// --------
// int - short
// word - ushort
// 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
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = HMIConstants.StringLength)]
public string sName;
// 1 = Ok, 2 = Error
public short iStatus;
public float rValue;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = HMIConstants.StringLength)]
public string sUnit;
[MarshalAs(UnmanagedType.I1)]
public bool xUsed;
}
// TwinCAT2 Pack = 1, TwinCAT 3 Pack = 0
[StructLayout(LayoutKind.Sequential, Pack = 0)]
public struct HMIControlButton
{
[MarshalAs(UnmanagedType.I1)]
public bool xRequest;
[MarshalAs(UnmanagedType.I1)]
public bool xRelease;
public short iFeedback;
}
// TwinCAT2 Pack = 1, TwinCAT 3 Pack = 0
[StructLayout(LayoutKind.Sequential, Pack = 0)]
public struct HMIInterlock
{
public ushort wProcessINTLKStatus;
public ushort wSafeyINTLKStatus;
public ushort wProcessINTLKUsed;
public ushort wSafeyINTLKUsed;
// 16 * String(80) = 81 bytes a 16 indexes
// combined in one string because reading a two dimensional array is not possible
[MarshalAs(UnmanagedType.ByValArray, SizeConst = HMIConstants.StringLength * HMIConstants.NumInterlocks)]
public byte[] asProcessINTLKName;
// 16 * String(80) = 81 bytes a 16 indexes
// combined in one string because reading a two dimensional array is not possible
[MarshalAs(UnmanagedType.ByValArray, SizeConst = HMIConstants.StringLength * HMIConstants.NumInterlocks)]
public byte[] asSafetyINTLKName;
[MarshalAs(UnmanagedType.I1)]
public bool xProcessINTLKOk;
[MarshalAs(UnmanagedType.I1)]
public bool xSafetyINTLKOk;
}
// TwinCAT2 Pack = 1, TwinCAT 3 Pack = 0
[StructLayout(LayoutKind.Sequential, Pack = 0)]
public struct HMIValveData
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = HMIConstants.StringLength)]
public string sName;
public HMIControlButton stAutomaticButton;
public HMIControlButton stManualButton;
public HMIControlButton stOpenButton;
public HMIControlButton stCloseButton;
// 1 = Opened, 2 = Opening/Closing, 3 = Closed, 4 = Error
public short iStatus;
// 1 = Automatic mode, 2 = Manual mode
public short iCurrentMode;
public HMIInterlock stInterlock;
[MarshalAs(UnmanagedType.I1)]
public bool xUsed;
}
[StructLayout(LayoutKind.Sequential, Pack = 0)]
public struct HMIAnalogValveData
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = HMIConstants.StringLength)]
public string sName;
public HMIControlButton stAutomaticButton;
public HMIControlButton stManualButton;
public HMIControlButton stOpenButton;
public HMIControlButton stCloseButton;
// 1 = Opened, 2 = Opening/Closing, 3 = Closed, 4 = Error
public short iStatus;
// 1 = Automatic mode, 2 = Manual mode
public short iCurrentMode;
public HMIInterlock stInterlock;
HMIAnalogValue stSetpoint;
HMIAnalogValue stProcessValue;
[MarshalAs(UnmanagedType.I1)]
public bool xUsed;
}
// TwinCAT2 Pack = 1, TwinCAT 3 Pack = 0
[StructLayout(LayoutKind.Sequential, Pack = 0)]
public struct HMIAnalogMotorData
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = HMIConstants.StringLength)]
public string sName;
public HMIControlButton stAutomaticButton;
public HMIControlButton stManualButton;
public HMIControlButton stStartButton;
public HMIControlButton stStopButton;
// 1 = Opened, 2 = Opening/Closing, 3 = Closed, 4 = Error
public short iStatus;
// 1 = Automatic mode, 2 = Manual mode
public short iCurrentMode;
public HMIAnalogValue stSetpoint;
public HMIAnalogValue stProcessValue;
public HMIInterlock stInterlock;
[MarshalAs(UnmanagedType.I1)]
public bool xUsed;
}
// TwinCAT2 Pack = 1, TwinCAT 3 Pack = 0
[StructLayout(LayoutKind.Sequential, Pack = 0)]
public struct HMIOrpSensorData
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = HMIConstants.StringLength)]
public string sName;
// 1 = Ok, 2 = Error
public short iStatus;
public float rValuePH;
public float rValueTemp;
public float rValueORP;
public float rValueDLI;
[MarshalAs(UnmanagedType.I1)]
public bool xUsed;
}
static class HMIUtilities
{
// Converts the interlock byte array into a string array
public static string[] GetInterlockStringArray(byte[] byteArray)
{
string[] temp = new string[HMIConstants.NumInterlocks];
int size;
// Check if byteArray is of correct size
if (byteArray.Length != (HMIConstants.StringLength * HMIConstants.NumInterlocks))
return temp;
for (int i = 0; i < HMIConstants.NumInterlocks; i++)
{
// Calculate length of string by finding the 0 terminator so the unused bytes get truncated
size = Array.IndexOf(byteArray, (byte)0, i * HMIConstants.StringLength) - (i * HMIConstants.StringLength);
// Check if we found a valid 0 terminator
if (size >= 0)
// Build string from byteArray with calculated size
temp[i] = Encoding.ASCII.GetString(byteArray, i * HMIConstants.StringLength, size);
else
// No valid 0 string terminator was found so return an empty string
temp[i] = "";
}
return temp;
}
}
public const int StringLength = 81;
public const int NumInterlocks = 16;
}
[StructLayout(LayoutKind.Sequential, Pack = 0)]
public struct HMIAnalogValue
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = HMIConstants.StringLength)]
public string sName;
// 1 = Ok, 2 = Error
public short iStatus;
public float rValue;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = HMIConstants.StringLength)]
public string sUnit;
[MarshalAs(UnmanagedType.I1)]
public bool xUsed;
}
// TwinCAT2 Pack = 1, TwinCAT 3 Pack = 0
[StructLayout(LayoutKind.Sequential, Pack = 0)]
public struct HMIControlButton
{
[MarshalAs(UnmanagedType.I1)]
public bool xRequest;
[MarshalAs(UnmanagedType.I1)]
public bool xRelease;
public short iFeedback;
}
// TwinCAT2 Pack = 1, TwinCAT 3 Pack = 0
[StructLayout(LayoutKind.Sequential, Pack = 0)]
public struct HMIInterlock
{
public ushort wProcessINTLKStatus;
public ushort wSafeyINTLKStatus;
public ushort wProcessINTLKUsed;
public ushort wSafeyINTLKUsed;
// 16 * String(80) = 81 bytes a 16 indexes
// combined in one string because reading a two dimensional array is not possible
[MarshalAs(UnmanagedType.ByValArray, SizeConst = HMIConstants.StringLength * HMIConstants.NumInterlocks)]
public byte[] asProcessINTLKName;
// 16 * String(80) = 81 bytes a 16 indexes
// combined in one string because reading a two dimensional array is not possible
[MarshalAs(UnmanagedType.ByValArray, SizeConst = HMIConstants.StringLength * HMIConstants.NumInterlocks)]
public byte[] asSafetyINTLKName;
[MarshalAs(UnmanagedType.I1)]
public bool xProcessINTLKOk;
[MarshalAs(UnmanagedType.I1)]
public bool xSafetyINTLKOk;
}
// TwinCAT2 Pack = 1, TwinCAT 3 Pack = 0
[StructLayout(LayoutKind.Sequential, Pack = 0)]
public struct HMIValveData
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = HMIConstants.StringLength)]
public string sName;
public HMIControlButton stAutomaticButton;
public HMIControlButton stManualButton;
public HMIControlButton stOpenButton;
public HMIControlButton stCloseButton;
// 1 = Opened, 2 = Opening/Closing, 3 = Closed, 4 = Error
public short iStatus;
// 1 = Automatic mode, 2 = Manual mode
public short iCurrentMode;
public HMIInterlock stInterlock;
[MarshalAs(UnmanagedType.I1)]
public bool xUsed;
}
[StructLayout(LayoutKind.Sequential, Pack = 0)]
public struct HMIAnalogValveData
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = HMIConstants.StringLength)]
public string sName;
public HMIControlButton stAutomaticButton;
public HMIControlButton stManualButton;
public HMIControlButton stOpenButton;
public HMIControlButton stCloseButton;
// 1 = Opened, 2 = Opening/Closing, 3 = Closed, 4 = Error
public short iStatus;
// 1 = Automatic mode, 2 = Manual mode
public short iCurrentMode;
public HMIInterlock stInterlock;
HMIAnalogValue stSetpoint;
HMIAnalogValue stProcessValue;
[MarshalAs(UnmanagedType.I1)]
public bool xUsed;
}
// TwinCAT2 Pack = 1, TwinCAT 3 Pack = 0
[StructLayout(LayoutKind.Sequential, Pack = 0)]
public struct HMIAnalogMotorData
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = HMIConstants.StringLength)]
public string sName;
public HMIControlButton stAutomaticButton;
public HMIControlButton stManualButton;
public HMIControlButton stStartButton;
public HMIControlButton stStopButton;
// 1 = Opened, 2 = Opening/Closing, 3 = Closed, 4 = Error
public short iStatus;
// 1 = Automatic mode, 2 = Manual mode
public short iCurrentMode;
public HMIAnalogValue stSetpoint;
public HMIAnalogValue stProcessValue;
public HMIInterlock stInterlock;
[MarshalAs(UnmanagedType.I1)]
public bool xUsed;
}
// TwinCAT2 Pack = 1, TwinCAT 3 Pack = 0
[StructLayout(LayoutKind.Sequential, Pack = 0)]
public struct HMIOrpSensorData
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = HMIConstants.StringLength)]
public string sName;
// 1 = Ok, 2 = Error
public short iStatus;
public float rValuePH;
public float rValueTemp;
public float rValueORP;
public float rValueDLI;
[MarshalAs(UnmanagedType.I1)]
public bool xUsed;
}
static class HMIUtilities
{
// Converts the interlock byte array into a string array
public static string[] GetInterlockStringArray(byte[] byteArray)
{
string[] temp = new string[HMIConstants.NumInterlocks];
int size;
// Check if byteArray is of correct size
if (byteArray.Length != (HMIConstants.StringLength * HMIConstants.NumInterlocks))
return temp;
for (int i = 0; i < HMIConstants.NumInterlocks; i++)
{
// Calculate length of string by finding the 0 terminator so the unused bytes get truncated
size = Array.IndexOf(byteArray, (byte)0, i * HMIConstants.StringLength) - (i * HMIConstants.StringLength);
// Check if we found a valid 0 terminator
if (size >= 0)
// Build string from byteArray with calculated size
temp[i] = Encoding.ASCII.GetString(byteArray, i * HMIConstants.StringLength, size);
else
// No valid 0 string terminator was found so return an empty string
temp[i] = "";
}
return temp;
}
}

View File

@@ -14,6 +14,8 @@
<ItemGroup>
<None Remove="Anlagenuebersicht.png" />
<None Remove="Resources\Application.png" />
<None Remove="Resources\user.png" />
</ItemGroup>
<ItemGroup>
@@ -35,6 +37,8 @@
<Resource Include="Anlagenuebersicht.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
<Resource Include="Resources\Application.png" />
<Resource Include="Resources\user.png" />
</ItemGroup>
<ItemGroup>

View File

@@ -4,12 +4,19 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:system="clr-namespace:System;assembly=System.Runtime"
xmlns:uniperHmi="clr-namespace:InfineonHMI"
xmlns:infineonHmi="clr-namespace:InfineonHMI"
mc:Ignorable="d"
x:Name="MainControlWindow"
d:DataContext="{d:DesignInstance Type=uniperHmi:MainWindowVM}"
d:DataContext="{d:DesignInstance Type=infineonHmi:MainWindowVM}"
WindowStartupLocation="CenterScreen"
Title="Infineon BiPolar" Height="2100" Width="3820" ResizeMode="NoResize">
Title="Infineon HMI"
Icon="Resources/Application.png"
Height="Auto"
Width="Auto"
ResizeMode="CanResizeWithGrip"
WindowState="Maximized"
WindowStyle="SingleBorderWindow">
<Viewbox Stretch="Fill">
<Grid Width="3840" Height="2100">
@@ -17,9 +24,11 @@
<Grid.RowDefinitions>
<RowDefinition Height="0.08*"/>
<RowDefinition Height="0.04*"/>
<RowDefinition Height="0.04*"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="0.74*"/>
<RowDefinition Height="0.10*"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="190"/>
</Grid.RowDefinitions>
<!-- Header line -->
@@ -82,21 +91,27 @@
</TextBlock>
</Grid>
<Button Grid.Column="10"
<Button Grid.Column="9"
Grid.ColumnSpan="2"
Margin="10"
FontSize="44"
Content="{Binding ActualUser}"
Command="{Binding ChangeUserClickedCommand}"/>
<Button Grid.Column="12"
Grid.ColumnSpan="2"
<Grid Grid.Column="11" Grid.ColumnSpan="3"
Margin="10"
FontSize="44"
Content="Auswahl&#xD;&#xA;Betriebsart"
Command="{Binding WorkingModeSelectionClickedCommand}"/>
>
<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"/>
<Label Grid.Column="1"
</Grid>
<Label Grid.Column="1"
Grid.ColumnSpan="3"
Content="BiPolar Randätzer"
FontSize="60"
@@ -110,76 +125,90 @@
</Grid>
<!-- Latest event line -->
<Border Grid.Row="1" BorderBrush="White" BorderThickness="0,0,0,2">
<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 -->
<Label Grid.Row="2"
<!-- Currently no used -->
<!--<Label Grid.Row="2"
Content="{Binding Breadcrumb}"
FontSize="28"/>
FontSize="28"/>-->
<!-- Page frame -->
<Frame x:Name="MainFrame"
Grid.Row="3"
NavigationUIVisibility="Hidden"
Margin="20 20 10 20"
Content="{Binding CurrentPage}"/>
<!-- Softkey grid -->
<Grid Grid.Row="4" Margin="20">
<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/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<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>
<UniformGrid Columns="7" Grid.ColumnSpan="7">
<!-- Softkey 1 -->
<Button Grid.Column="0" Content="Übersicht" FontSize="38" Margin="10"
Command="{Binding OverviewWindowClickedCommand}" />
<Button Grid.Column="0"
Width="440"
Content="Übersicht" FontSize="38" Margin="10"
Command="{Binding OverviewWindowClickedCommand}" />
<!-- Command="{Binding AutomaticModeCommand}" -->
<!-- Softkey 2 -->
<Button Grid.Column="0" Content="Stationen" FontSize="38" Margin="10"
Command="{Binding ProductionWindowClickedCommand}"/>
<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="0" Content="Protokoll" FontSize="38" Margin="10"
<Button Grid.Column="2" Content="Protokoll" FontSize="38" Margin="10"
Command="{Binding ProtocolWindowClickedCommand}" Visibility="Collapsed"/>
<!-- Softkey 4 -->
<Button Grid.Column="0" Content="Rezepte" FontSize="38" Margin="10"
Command="{Binding ReceipesWindowClickedCommand}" />
<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="0" Content="Trend" FontSize="38" Margin="10"
<Button Grid.Column="7" Content="Trend" FontSize="38" Margin="10"
Command="{Binding TrendWindowClickedCommand}" Visibility="Collapsed"/>
<!-- Softkey 6 -->
<Button Grid.Column="0" Content="Komponenten" FontSize="38" Margin="10"
<Button Grid.Column="8" Content="Komponenten" FontSize="38" Margin="10"
Command="{Binding ComponentsWindowClickedCommand}" Visibility="Collapsed"/>
<!-- Softkey 7 -->
<!-- Softkey 8 -->
<Button Content="Einstellungen" FontSize="38" Margin="10"
<Button Grid.Column="6" Content="Einstellungen" FontSize="38" Margin="10"
Command="{Binding SettingsWindowClickedCommand}" Visibility="Collapsed"/>
</UniformGrid>
<Button Grid.Column="7" Content="Meldungen" FontSize="38" Margin="10"
Width="450"
Command="{Binding EventsListClickedCommand}"/>
<!-- Softkey 9 -->
<Button Grid.Column="8" Content="Ack Alarms" FontSize="38" Margin="10"
<Button Grid.Column="8"
Width="450"
Content="Alarm quitieren" FontSize="38" Margin="10"
Command="{Binding AckAlarmsCommand}"/>
</Grid>

View File

@@ -1,26 +1,32 @@
using HMIToolkit;
using MahApps.Metro.Controls;
namespace InfineonHMI
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;
InitializeComponent();
Closed += OnClosedEvent;
}
public MainWindow(MainWindowVM mainWindowVM)
{
DataContext = mainWindowVM;
InitializeComponent();
Loaded += MainWindowLoaded;
Closed += OnClosedEvent;
}
private void OnClosedEvent(object? sender, EventArgs e)
{
if (DataContext is IDisposable dataContext)
dataContext.Dispose();
}
}
private void MainWindowLoaded(object sender, System.Windows.RoutedEventArgs e)
{
var model = (MainWindowVM)DataContext;
model.ChangeUserClicked();
}
private void OnClosedEvent(object? sender, EventArgs e)
{
if (DataContext is IDisposable dataContext)
dataContext.Dispose();
}
}

View File

@@ -1,21 +1,22 @@
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 InfineonHMI.Pages.Views;
using TwinCAT.TypeSystem;
namespace InfineonHMI;
public sealed partial class MainWindowVM : ObservableObject, IRecipient<NavigateMessage>, IDisposable
{
[ObservableProperty] private StringControlButtonVM dummyStringVM;
[ObservableProperty] private Page currentPage;
[ObservableProperty] private Visibility statusBarVisible;
@@ -24,12 +25,35 @@ public sealed partial class MainWindowVM : ObservableObject, IRecipient<Navigate
[ObservableProperty] private string actualUser;
[ObservableProperty] private string sCurrentPackMLMode;
[ObservableProperty] private string sCurrentPackMLState;
[ObservableProperty] private bool canUserChangePageProductionWindow;
[ObservableProperty] private bool canUserChangePageReceipeWindow;
private const string _actualUserPrefix = "Aktueller Benutzer: \n";
private readonly IAdsManager _adsManager;
private readonly IConfiguration _config;
private readonly TcEventLogger _eventlogger;
private User currentUser;
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;
}
}
// Last active event
[ObservableProperty] private string currentActiveEvent = "";
@@ -48,6 +72,8 @@ public sealed partial class MainWindowVM : ObservableObject, IRecipient<Navigate
// Settings page viem model
SettingsPageVM? _settingsPageVM;
private PackMLControlVM stMachinePackMLVM;
ProductionOverviewPageVM? _productionOverviewPageVM;
private MachineOverviewPageVM? _machineOverviewPageVM;
@@ -64,9 +90,9 @@ public sealed partial class MainWindowVM : ObservableObject, IRecipient<Navigate
_adsManager = adsManager;
_config = config;
SCurrentPackMLMode = "Aktueller Modus: ";
SCurrentPackMLState = "Aktueller Status: ";
ActualUser = _actualUserPrefix + "---------";
// Create dummy string
DummyStringVM = new StringControlButtonVM();
// Create empty page
_emptyPage = new();
@@ -79,9 +105,21 @@ 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)
@@ -92,6 +130,115 @@ public sealed partial class MainWindowVM : ObservableObject, IRecipient<Navigate
}
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;
}
[RelayCommand]
private void SettingsWindow()
{
@@ -102,15 +249,11 @@ public sealed partial class MainWindowVM : ObservableObject, IRecipient<Navigate
}
[RelayCommand]
private void ChangeUserClicked()
public void ChangeUserClicked()
{
}
[RelayCommand]
private void WorkingModeSelectionClicked()
{
var userWindowVm = new UserManagementWindowVm(currentUser);
CurrentUser = userWindowVm.GetCurrentUserLevel();
OverviewWindowClicked();
}
[RelayCommand]
@@ -166,6 +309,10 @@ public sealed partial class MainWindowVM : ObservableObject, IRecipient<Navigate
}
[RelayCommand]
public void EventsListClicked()
{
@@ -183,7 +330,7 @@ public sealed partial class MainWindowVM : ObservableObject, IRecipient<Navigate
{
// Only change page if its a new page type
if (CurrentPage.GetType() == message.type)
return;
//return;
// Push current message
if (_currentMessage != null)
@@ -255,7 +402,7 @@ public sealed partial class MainWindowVM : ObservableObject, IRecipient<Navigate
case nameof(HotCoolPlatePage):
if (_hotCoolplatePageVM == null)
_hotCoolplatePageVM = new(_adsManager, "GVL_Config.stHotCoolplateConfig");
_hotCoolplatePageVM = new(_adsManager, "directlySetInViewModel");
HotCoolPlatePage hotCoolPlatePage = new() {DataContext = _hotCoolplatePageVM };
CurrentPage = hotCoolPlatePage;
@@ -293,6 +440,5 @@ public sealed partial class MainWindowVM : ObservableObject, IRecipient<Navigate
viewModel.Dispose();
}
DummyStringVM.Dispose();
}
}

View File

@@ -4,135 +4,133 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace InfineonHMI.Model
namespace InfineonHMI.Model;
public enum E_BMS_CONTROL_MODE : short
{
public enum E_BMS_CONTROL_MODE : short
{
AUTO_REMOTE = 1,
AUTO_LOCAL = 2,
SAFETY_CHECK = 3,
CAPACITY_TEST = 4,
MANUAL = 5
}
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 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(Stationenum station, string name)
{
public Stationenum eStation = station;
public string sName = name;
public override string ToString()
{
return sName;
}
}
public class FlowReceipeEntry()
public override string ToString()
{
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; }
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(Stationenum station, string name)
{
public Stationenum eStation = station;
public string sName = name;
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; }
}

View File

@@ -2,18 +2,17 @@
using CommunityToolkit.Mvvm.Messaging;
using Heisig.HMI.AdsManager;
namespace InfineonHMI.OwnControls
namespace InfineonHMI.OwnControls;
public sealed partial class UnitControlButtonVM : SMUBaseVM
{
public sealed partial class UnitControlButtonVM : SMUBaseVM
{
public UnitControlButtonVM() : base() { }
public UnitControlButtonVM() : base() { }
public UnitControlButtonVM(IAdsManager adsManager, string variableName) : base(adsManager, variableName) { }
public UnitControlButtonVM(IAdsManager adsManager, string variableName) : base(adsManager, variableName) { }
[RelayCommand]
private void Clicked()
{
WeakReferenceMessenger.Default.Send(new NavigateMessage(_variableName, typeof(UnitDetailsControl)));
}
}
[RelayCommand]
private void Clicked()
{
WeakReferenceMessenger.Default.Send(new NavigateMessage(_variableName, typeof(UnitDetailsControl)));
}
}

View File

@@ -4,491 +4,490 @@ using HMIToolkit;
using TwinCAT.TypeSystem;
using Heisig.HMI.AdsManager;
namespace InfineonHMI
namespace InfineonHMI;
public sealed partial class UnitDetailsControlVM : ObservableObject, IDisposable
{
public sealed partial class UnitDetailsControlVM : ObservableObject, IDisposable
{
[ObservableProperty]
private float rVoltage;
[ObservableProperty]
private float rVoltage;
[ObservableProperty]
private E_COMPONENT_STATUS status;
[ObservableProperty]
private E_COMPONENT_STATUS status;
[ObservableProperty]
private AnalogValueVM pressureNegolytSegmentInVM;
[ObservableProperty]
private AnalogValueVM pressureNegolytSegmentInVM;
[ObservableProperty]
private AnalogValueVM pressureNegolytTankInVM;
[ObservableProperty]
private AnalogValueVM pressureNegolytTankInVM;
[ObservableProperty]
private AnalogValueVM temperatureNegolytTankInVM;
[ObservableProperty]
private AnalogValueVM temperatureNegolytTankInVM;
[ObservableProperty]
private AnalogValueVM pressurePosolytSegmentInVM;
[ObservableProperty]
private AnalogValueVM pressurePosolytSegmentInVM;
[ObservableProperty]
private AnalogValueVM pressurePosolytTankInVM;
[ObservableProperty]
private AnalogValueVM pressurePosolytTankInVM;
[ObservableProperty]
private AnalogValueVM temperaturePosolytTankInVM;
[ObservableProperty]
private AnalogValueVM temperaturePosolytTankInVM;
[ObservableProperty]
private bool canOpenBothValves;
[ObservableProperty]
private bool canOpenBothValves;
[ObservableProperty]
private bool canCloseBothValves;
[ObservableProperty]
private bool canCloseBothValves;
[ObservableProperty]
private short feedbackOpenValves;
[ObservableProperty]
private short feedbackOpenValves;
[ObservableProperty]
private short feedbackCloseValves;
[ObservableProperty]
private short feedbackCloseValves;
[ObservableProperty]
private bool canStartBothPumps;
[ObservableProperty]
private bool canStartBothPumps;
[ObservableProperty]
private bool canStopBothPumps;
[ObservableProperty]
private bool canStopBothPumps;
[ObservableProperty]
private short feedbackStartPumps;
[ObservableProperty]
private short feedbackStartPumps;
[ObservableProperty]
private short feedbackStopPumps;
[ObservableProperty]
private short feedbackStopPumps;
private float _posolytPumpOnSpeed;
private float _negolytPumpOnSpeed;
private float _posolytPumpOnSpeed;
private float _negolytPumpOnSpeed;
private float valveWindowHorizontalPosition;
private float valveWindowHorizontalPosition;
private readonly BinaryValveControlVM _valveNegolytVM;
private readonly BinaryValveControlVM _valvePosolytVM;
private readonly AnalogMotorControlVM _pumpNegolytVM;
private readonly AnalogMotorControlVM _pumpPosolytVM;
private readonly BinaryValveControlVM _valveNegolytVM;
private readonly BinaryValveControlVM _valvePosolytVM;
private readonly AnalogMotorControlVM _pumpNegolytVM;
private readonly AnalogMotorControlVM _pumpPosolytVM;
private BinaryValveWindow? _windowValveNegolyt;
private BinaryValveWindow? _windowValvePosolyt;
private BinaryValveWindow? _windowValveNegolyt;
private BinaryValveWindow? _windowValvePosolyt;
private AnalogMotorWindow? _windowPumpNegolyt;
private AnalogMotorWindow? _windowPumpPosolyt;
private AnalogMotorWindow? _windowPumpNegolyt;
private AnalogMotorWindow? _windowPumpPosolyt;
private readonly IAdsManager? _adsManager;
private readonly string _variableName;
private readonly IAdsManager? _adsManager;
private readonly string _variableName;
public UnitDetailsControlVM()
{
Status = E_COMPONENT_STATUS.OFF;
rVoltage = 0.0f;
_variableName = "";
public UnitDetailsControlVM()
{
Status = E_COMPONENT_STATUS.OFF;
rVoltage = 0.0f;
_variableName = "";
// Negolyt
PressureNegolytSegmentInVM = new AnalogValueVM();
PressureNegolytTankInVM = new AnalogValueVM();
TemperatureNegolytTankInVM = new AnalogValueVM();
_valveNegolytVM = new BinaryValveControlVM();
_pumpNegolytVM = new AnalogMotorControlVM();
// Negolyt
PressureNegolytSegmentInVM = new AnalogValueVM();
PressureNegolytTankInVM = new AnalogValueVM();
TemperatureNegolytTankInVM = new AnalogValueVM();
_valveNegolytVM = new BinaryValveControlVM();
_pumpNegolytVM = new AnalogMotorControlVM();
_windowValveNegolyt = null;
// Posolyt
PressurePosolytSegmentInVM = new AnalogValueVM();
PressurePosolytTankInVM = new AnalogValueVM();
TemperaturePosolytTankInVM = new AnalogValueVM();
_valvePosolytVM = new BinaryValveControlVM();
_pumpPosolytVM = new AnalogMotorControlVM();
_windowValvePosolyt = null;
valveWindowHorizontalPosition = 10;
}
public UnitDetailsControlVM(IAdsManager adsManager, string variableName)
{
_adsManager = adsManager;
_variableName = variableName;
Status = E_COMPONENT_STATUS.OFF;
rVoltage = 0.0f;
// Negolyt
PressureNegolytSegmentInVM = new AnalogValueVM(_adsManager, _variableName + ".stP21", true);
PressureNegolytTankInVM = new AnalogValueVM(_adsManager, _variableName + ".stP22", true);
TemperatureNegolytTankInVM = new AnalogValueVM(_adsManager, _variableName + ".stT21", true);
_valveNegolytVM = new BinaryValveControlVM(_adsManager, _variableName + ".stNS22");
_valveNegolytVM.OpenButton.FeedbackChanged += OnValveNegolytOpenFeedbackChanged;
_valveNegolytVM.CloseButton.FeedbackChanged += OnValveNegolytCloseFeedbackChanged;
_valveNegolytVM.OpenButton.ReleaseChanged += OnValveNegolytOpenReleaseChanged;
_valveNegolytVM.CloseButton.ReleaseChanged += OnValveNegolytCloseReleaseChanged;
_pumpNegolytVM = new AnalogMotorControlVM(_adsManager, _variableName + ".stNS21");
_pumpNegolytVM.StartButton.FeedbackChanged += OnPumpNegolytStartFeedbackChanged;
_pumpNegolytVM.StopButton.FeedbackChanged += OnPumpNegolytStopFeedbackChanged;
_pumpNegolytVM.StartButton.ReleaseChanged += OnPumpNegolytStartReleaseChanged;
_pumpNegolytVM.StopButton.ReleaseChanged += OnPumpNegolytStopReleaseChanged;
// Posolyt
PressurePosolytSegmentInVM = new AnalogValueVM(_adsManager, _variableName + ".stP11", true);
PressurePosolytTankInVM = new AnalogValueVM(_adsManager, _variableName + ".stP12", true);
TemperaturePosolytTankInVM = new AnalogValueVM(_adsManager, _variableName + ".stT11", true);
_valvePosolytVM = new BinaryValveControlVM(_adsManager, _variableName + ".stNS12");
_valvePosolytVM.OpenButton.FeedbackChanged += OnValvePosolytOpenFeedbackChanged;
_valvePosolytVM.CloseButton.FeedbackChanged += OnValvePosolytCloseFeedbackChanged;
_valvePosolytVM.OpenButton.ReleaseChanged += OnValvePosolytOpenReleaseChanged;
_valvePosolytVM.CloseButton.ReleaseChanged += OnValvePosolytCloseReleaseChanged;
_pumpPosolytVM = new AnalogMotorControlVM(_adsManager, _variableName + ".stNS11");
_pumpPosolytVM.StartButton.FeedbackChanged += OnPumpPosolytStartFeedbackChanged;
_pumpPosolytVM.StopButton.FeedbackChanged += OnPumpPosolytStopFeedbackChanged;
_pumpPosolytVM.StartButton.ReleaseChanged += OnPumpPosolytStartReleaseChanged;
_pumpPosolytVM.StopButton.ReleaseChanged += OnPumpPosolytStopReleaseChanged;
// Current status
_adsManager.Register(_variableName + ".eStatus", StatusChanged);
_adsManager.Register(_variableName + ".rVoltage", VoltageChanged);
// Configured pump speed for on
_adsManager.Register("GVL_CONFIG.rPumpNegolytOnPower", NegolytPumpOnSpeedChanged);
_adsManager.Register("GVL_CONFIG.rPumpPosolytOnPower", PosolytPumpOnSpeedChanged);
valveWindowHorizontalPosition = 10;
}
private void NegolytPumpOnSpeedChanged(object? sender, ValueChangedEventArgs e)
{
_negolytPumpOnSpeed = (float)e.Value;
}
private void PosolytPumpOnSpeedChanged(object? sender, ValueChangedEventArgs e)
{
_posolytPumpOnSpeed = (float)e.Value;
}
private void VoltageChanged(object? sender, ValueChangedEventArgs e)
{
RVoltage = (float)e.Value;
}
public void Dispose()
{
// Dispose all necessary view models
// Negolyt
PressureNegolytSegmentInVM.Dispose();
PressureNegolytTankInVM.Dispose();
TemperatureNegolytTankInVM.Dispose();
_valveNegolytVM.OpenButton.FeedbackChanged -= OnValveNegolytOpenFeedbackChanged;
_valveNegolytVM.CloseButton.FeedbackChanged -= OnValveNegolytCloseFeedbackChanged;
_valveNegolytVM.OpenButton.ReleaseChanged -= OnValveNegolytOpenReleaseChanged;
_valveNegolytVM.CloseButton.ReleaseChanged -= OnValveNegolytCloseReleaseChanged;
_valveNegolytVM.Dispose();
_pumpNegolytVM.Dispose();
// Posolyt
PressurePosolytSegmentInVM.Dispose();
PressurePosolytTankInVM.Dispose();
TemperaturePosolytTankInVM.Dispose();
_valvePosolytVM.OpenButton.FeedbackChanged -= OnValvePosolytOpenFeedbackChanged;
_valvePosolytVM.CloseButton.FeedbackChanged -= OnValvePosolytCloseFeedbackChanged;
_valvePosolytVM.OpenButton.ReleaseChanged -= OnValvePosolytOpenReleaseChanged;
_valvePosolytVM.CloseButton.ReleaseChanged -= OnValvePosolytCloseReleaseChanged;
_valvePosolytVM.Dispose();
_pumpPosolytVM.Dispose();
// Deregister variables
_adsManager?.Deregister(_variableName + ".eStatus", StatusChanged);
_adsManager?.Deregister(_variableName + ".rVoltage", VoltageChanged);
_adsManager?.Deregister("GVL_CONFIG.rPumpNegolytOnPower", NegolytPumpOnSpeedChanged);
_adsManager?.Deregister("GVL_CONFIG.rPumpPosolytOnPower", PosolytPumpOnSpeedChanged);
// Destroy windows
_windowValveNegolyt?.Close();
_windowValvePosolyt?.Close();
_windowPumpNegolyt?.Close();
_windowPumpPosolyt?.Close();
}
private void StatusChanged(object? sender, ValueChangedEventArgs e)
{
Status = (E_COMPONENT_STATUS)((short)e.Value);
}
[RelayCommand]
private void ShowValveNegolyt()
{
if (_adsManager != null && _windowValveNegolyt == null)
{
_windowValveNegolyt = new() { DataContext = _valveNegolytVM };
_windowValveNegolyt.Closed += WindowValveNegolyt_Closed;
_windowValveNegolyt.Show();
}
}
private void WindowValveNegolyt_Closed(object? sender, EventArgs e)
{
_windowValveNegolyt!.Close();
_windowValveNegolyt = null;
}
[RelayCommand]
private void ShowValvePosolyt()
{
if (_adsManager != null && _windowValvePosolyt == null)
{
_windowValvePosolyt = new() { DataContext = _valvePosolytVM };
_windowValvePosolyt.Closed += WindowValvePosolyt_Closed;
_windowValvePosolyt.Show();
}
}
private void WindowValvePosolyt_Closed(object? sender, EventArgs e)
{
_windowValvePosolyt!.Close();
_windowValvePosolyt = null;
}
[RelayCommand]
public void ShowPumpNegolyt()
{
if (_adsManager != null && _windowPumpNegolyt == null)
{
_windowPumpNegolyt = new() { DataContext = _pumpNegolytVM };
_windowPumpNegolyt.Closed += WindowPumpNegolyt_Closed;
_windowPumpNegolyt.Show();
}
}
private void WindowPumpNegolyt_Closed(object? sender, EventArgs e)
{
_windowPumpNegolyt!.Close();
_windowPumpNegolyt = null;
}
[RelayCommand]
public void ShowPumpPosolyt()
{
if (_adsManager != null && _windowPumpPosolyt == null)
{
_windowPumpPosolyt = new() { DataContext = _pumpPosolytVM };
_windowPumpPosolyt.Closed += WindowPumpPosolyt_Closed;
_windowPumpPosolyt.Show();
}
}
[RelayCommand]
private void OpenBothValves()
{
_valveNegolytVM.OpenButton?.ButtonClickedCommand.Execute(null);
_valvePosolytVM.OpenButton?.ButtonClickedCommand.Execute(null);
}
[RelayCommand]
private void CloseBothValves()
{
_valveNegolytVM.CloseButton?.ButtonClickedCommand.Execute(null);
_valvePosolytVM.CloseButton?.ButtonClickedCommand.Execute(null);
}
private void OnValveNegolytOpenFeedbackChanged(object? sender, EventArgs e)
{
CalculateOpenFeedback();
}
private void OnValvePosolytOpenFeedbackChanged(object? sender, EventArgs e)
{
CalculateOpenFeedback();
}
private void CalculateOpenFeedback()
{
if (_valveNegolytVM?.OpenButton.IFeedback == 1 && _valvePosolytVM?.OpenButton.IFeedback == 1)
FeedbackOpenValves = 1;
else if (_valveNegolytVM?.OpenButton.IFeedback == 0 && _valvePosolytVM?.OpenButton.IFeedback == 0)
FeedbackOpenValves = 0;
else
FeedbackOpenValves = 2;
}
private void OnValveNegolytCloseFeedbackChanged(object? sender, EventArgs e)
{
CalculateCloseFeedback();
}
private void OnValvePosolytCloseFeedbackChanged(object? sender, EventArgs e)
{
CalculateCloseFeedback();
}
private void CalculateCloseFeedback()
{
if (_valveNegolytVM?.CloseButton.IFeedback == 1 && _valvePosolytVM?.CloseButton.IFeedback == 1)
FeedbackCloseValves = 1;
else if (_valveNegolytVM?.CloseButton.IFeedback == 0 && _valvePosolytVM?.CloseButton.IFeedback == 0)
FeedbackCloseValves = 0;
else
FeedbackCloseValves = 2;
}
private void OnValveNegolytOpenReleaseChanged(object? sender, EventArgs e)
{
CalculateOpenRelease();
}
private void OnValvePosolytOpenReleaseChanged(object? sender, EventArgs e)
{
CalculateOpenRelease();
}
private void CalculateOpenRelease()
{
if (_valvePosolytVM == null || _valveNegolytVM == null)
return;
if (_valveNegolytVM.OpenButton.XRelease && _valvePosolytVM.OpenButton.XRelease)
CanOpenBothValves = true;
else
CanOpenBothValves = false;
}
private void OnValveNegolytCloseReleaseChanged(object? sender, EventArgs e)
{
CalculateCloseRelease();
}
private void OnValvePosolytCloseReleaseChanged(object? sender, EventArgs e)
{
CalculateCloseRelease();
}
private void CalculateCloseRelease()
{
if (_valvePosolytVM == null || _valveNegolytVM == null)
return;
if (_valveNegolytVM.CloseButton.XRelease && _valvePosolytVM.CloseButton.XRelease)
CanCloseBothValves = true;
else
CanCloseBothValves = false;
}
[RelayCommand]
private void StartBothPumps()
{
if (_adsManager == null || _pumpNegolytVM == null || _pumpPosolytVM == null)
return;
_pumpNegolytVM.Setpoint.RValue = _negolytPumpOnSpeed;
_pumpPosolytVM.Setpoint.RValue = _posolytPumpOnSpeed;
_pumpNegolytVM.StartButton?.ButtonClickedCommand.Execute(null);
_pumpPosolytVM.StartButton?.ButtonClickedCommand.Execute(null);
}
[RelayCommand]
private void StopBothPumps()
{
_pumpNegolytVM.StopButton?.ButtonClickedCommand.Execute(null);
_pumpPosolytVM.StopButton?.ButtonClickedCommand.Execute(null);
}
private void CalculateStartRelease()
{
if (_pumpNegolytVM == null || _pumpPosolytVM == null)
return;
if (_pumpNegolytVM.StartButton.XRelease && _pumpPosolytVM.StartButton.XRelease)
CanStartBothPumps = true;
else
CanStartBothPumps = false;
}
private void CalculatStopRelease()
{
if (_pumpNegolytVM == null || _pumpPosolytVM == null)
return;
if (_pumpNegolytVM.StopButton.XRelease && _pumpPosolytVM.StopButton.XRelease)
CanStopBothPumps = true;
else
CanStopBothPumps = false;
}
private void CalculateStartFeedback()
{
if (_pumpNegolytVM == null || _pumpPosolytVM == null)
return;
if (_pumpNegolytVM.StartButton.IFeedback == 1 && _pumpPosolytVM.StartButton.IFeedback == 1)
FeedbackStartPumps = 1;
else if (_pumpNegolytVM.StartButton.IFeedback == 0 && _pumpPosolytVM.StartButton.IFeedback == 0)
FeedbackStartPumps = 0;
else
FeedbackStartPumps = 2;
}
private void CalculateStopFeedback()
{
if (_pumpNegolytVM == null || _pumpPosolytVM == null)
return;
if (_pumpNegolytVM.StopButton.IFeedback == 1 && _pumpPosolytVM.StopButton.IFeedback == 1)
FeedbackStopPumps = 1;
else if (_pumpNegolytVM.StopButton.IFeedback == 0 && _pumpPosolytVM.StopButton.IFeedback == 0)
FeedbackStopPumps = 0;
else
FeedbackStopPumps = 2;
}
private void OnPumpPosolytStopReleaseChanged(object? sender, EventArgs e)
{
CalculatStopRelease();
}
private void OnPumpPosolytStartReleaseChanged(object? sender, EventArgs e)
{
CalculateStartRelease();
}
private void OnPumpPosolytStopFeedbackChanged(object? sender, EventArgs e)
{
CalculateStopFeedback();
}
private void OnPumpPosolytStartFeedbackChanged(object? sender, EventArgs e)
{
CalculateStartFeedback();
}
private void OnPumpNegolytStopReleaseChanged(object? sender, EventArgs e)
{
CalculatStopRelease();
}
private void OnPumpNegolytStartReleaseChanged(object? sender, EventArgs e)
{
CalculateStartRelease();
}
private void OnPumpNegolytStopFeedbackChanged(object? sender, EventArgs e)
{
CalculateStopFeedback();
}
private void OnPumpNegolytStartFeedbackChanged(object? sender, EventArgs e)
{
CalculateStartFeedback();
}
private void WindowPumpPosolyt_Closed(object? sender, EventArgs e)
{
_windowPumpPosolyt!.Close();
_windowPumpPosolyt = null;
}
}
_windowValveNegolyt = null;
// Posolyt
PressurePosolytSegmentInVM = new AnalogValueVM();
PressurePosolytTankInVM = new AnalogValueVM();
TemperaturePosolytTankInVM = new AnalogValueVM();
_valvePosolytVM = new BinaryValveControlVM();
_pumpPosolytVM = new AnalogMotorControlVM();
_windowValvePosolyt = null;
valveWindowHorizontalPosition = 10;
}
public UnitDetailsControlVM(IAdsManager adsManager, string variableName)
{
_adsManager = adsManager;
_variableName = variableName;
Status = E_COMPONENT_STATUS.OFF;
rVoltage = 0.0f;
// Negolyt
PressureNegolytSegmentInVM = new AnalogValueVM(_adsManager, _variableName + ".stP21", true);
PressureNegolytTankInVM = new AnalogValueVM(_adsManager, _variableName + ".stP22", true);
TemperatureNegolytTankInVM = new AnalogValueVM(_adsManager, _variableName + ".stT21", true);
_valveNegolytVM = new BinaryValveControlVM(_adsManager, _variableName + ".stNS22");
_valveNegolytVM.OpenButton.FeedbackChanged += OnValveNegolytOpenFeedbackChanged;
_valveNegolytVM.CloseButton.FeedbackChanged += OnValveNegolytCloseFeedbackChanged;
_valveNegolytVM.OpenButton.ReleaseChanged += OnValveNegolytOpenReleaseChanged;
_valveNegolytVM.CloseButton.ReleaseChanged += OnValveNegolytCloseReleaseChanged;
_pumpNegolytVM = new AnalogMotorControlVM(_adsManager, _variableName + ".stNS21");
_pumpNegolytVM.StartButton.FeedbackChanged += OnPumpNegolytStartFeedbackChanged;
_pumpNegolytVM.StopButton.FeedbackChanged += OnPumpNegolytStopFeedbackChanged;
_pumpNegolytVM.StartButton.ReleaseChanged += OnPumpNegolytStartReleaseChanged;
_pumpNegolytVM.StopButton.ReleaseChanged += OnPumpNegolytStopReleaseChanged;
// Posolyt
PressurePosolytSegmentInVM = new AnalogValueVM(_adsManager, _variableName + ".stP11", true);
PressurePosolytTankInVM = new AnalogValueVM(_adsManager, _variableName + ".stP12", true);
TemperaturePosolytTankInVM = new AnalogValueVM(_adsManager, _variableName + ".stT11", true);
_valvePosolytVM = new BinaryValveControlVM(_adsManager, _variableName + ".stNS12");
_valvePosolytVM.OpenButton.FeedbackChanged += OnValvePosolytOpenFeedbackChanged;
_valvePosolytVM.CloseButton.FeedbackChanged += OnValvePosolytCloseFeedbackChanged;
_valvePosolytVM.OpenButton.ReleaseChanged += OnValvePosolytOpenReleaseChanged;
_valvePosolytVM.CloseButton.ReleaseChanged += OnValvePosolytCloseReleaseChanged;
_pumpPosolytVM = new AnalogMotorControlVM(_adsManager, _variableName + ".stNS11");
_pumpPosolytVM.StartButton.FeedbackChanged += OnPumpPosolytStartFeedbackChanged;
_pumpPosolytVM.StopButton.FeedbackChanged += OnPumpPosolytStopFeedbackChanged;
_pumpPosolytVM.StartButton.ReleaseChanged += OnPumpPosolytStartReleaseChanged;
_pumpPosolytVM.StopButton.ReleaseChanged += OnPumpPosolytStopReleaseChanged;
// Current status
_adsManager.Register(_variableName + ".eStatus", StatusChanged);
_adsManager.Register(_variableName + ".rVoltage", VoltageChanged);
// Configured pump speed for on
_adsManager.Register("GVL_CONFIG.rPumpNegolytOnPower", NegolytPumpOnSpeedChanged);
_adsManager.Register("GVL_CONFIG.rPumpPosolytOnPower", PosolytPumpOnSpeedChanged);
valveWindowHorizontalPosition = 10;
}
private void NegolytPumpOnSpeedChanged(object? sender, ValueChangedEventArgs e)
{
_negolytPumpOnSpeed = (float)e.Value;
}
private void PosolytPumpOnSpeedChanged(object? sender, ValueChangedEventArgs e)
{
_posolytPumpOnSpeed = (float)e.Value;
}
private void VoltageChanged(object? sender, ValueChangedEventArgs e)
{
RVoltage = (float)e.Value;
}
public void Dispose()
{
// Dispose all necessary view models
// Negolyt
PressureNegolytSegmentInVM.Dispose();
PressureNegolytTankInVM.Dispose();
TemperatureNegolytTankInVM.Dispose();
_valveNegolytVM.OpenButton.FeedbackChanged -= OnValveNegolytOpenFeedbackChanged;
_valveNegolytVM.CloseButton.FeedbackChanged -= OnValveNegolytCloseFeedbackChanged;
_valveNegolytVM.OpenButton.ReleaseChanged -= OnValveNegolytOpenReleaseChanged;
_valveNegolytVM.CloseButton.ReleaseChanged -= OnValveNegolytCloseReleaseChanged;
_valveNegolytVM.Dispose();
_pumpNegolytVM.Dispose();
// Posolyt
PressurePosolytSegmentInVM.Dispose();
PressurePosolytTankInVM.Dispose();
TemperaturePosolytTankInVM.Dispose();
_valvePosolytVM.OpenButton.FeedbackChanged -= OnValvePosolytOpenFeedbackChanged;
_valvePosolytVM.CloseButton.FeedbackChanged -= OnValvePosolytCloseFeedbackChanged;
_valvePosolytVM.OpenButton.ReleaseChanged -= OnValvePosolytOpenReleaseChanged;
_valvePosolytVM.CloseButton.ReleaseChanged -= OnValvePosolytCloseReleaseChanged;
_valvePosolytVM.Dispose();
_pumpPosolytVM.Dispose();
// Deregister variables
_adsManager?.Deregister(_variableName + ".eStatus", StatusChanged);
_adsManager?.Deregister(_variableName + ".rVoltage", VoltageChanged);
_adsManager?.Deregister("GVL_CONFIG.rPumpNegolytOnPower", NegolytPumpOnSpeedChanged);
_adsManager?.Deregister("GVL_CONFIG.rPumpPosolytOnPower", PosolytPumpOnSpeedChanged);
// Destroy windows
_windowValveNegolyt?.Close();
_windowValvePosolyt?.Close();
_windowPumpNegolyt?.Close();
_windowPumpPosolyt?.Close();
}
private void StatusChanged(object? sender, ValueChangedEventArgs e)
{
Status = (E_COMPONENT_STATUS)((short)e.Value);
}
[RelayCommand]
private void ShowValveNegolyt()
{
if (_adsManager != null && _windowValveNegolyt == null)
{
_windowValveNegolyt = new() { DataContext = _valveNegolytVM };
_windowValveNegolyt.Closed += WindowValveNegolyt_Closed;
_windowValveNegolyt.Show();
}
}
private void WindowValveNegolyt_Closed(object? sender, EventArgs e)
{
_windowValveNegolyt!.Close();
_windowValveNegolyt = null;
}
[RelayCommand]
private void ShowValvePosolyt()
{
if (_adsManager != null && _windowValvePosolyt == null)
{
_windowValvePosolyt = new() { DataContext = _valvePosolytVM };
_windowValvePosolyt.Closed += WindowValvePosolyt_Closed;
_windowValvePosolyt.Show();
}
}
private void WindowValvePosolyt_Closed(object? sender, EventArgs e)
{
_windowValvePosolyt!.Close();
_windowValvePosolyt = null;
}
[RelayCommand]
public void ShowPumpNegolyt()
{
if (_adsManager != null && _windowPumpNegolyt == null)
{
_windowPumpNegolyt = new() { DataContext = _pumpNegolytVM };
_windowPumpNegolyt.Closed += WindowPumpNegolyt_Closed;
_windowPumpNegolyt.Show();
}
}
private void WindowPumpNegolyt_Closed(object? sender, EventArgs e)
{
_windowPumpNegolyt!.Close();
_windowPumpNegolyt = null;
}
[RelayCommand]
public void ShowPumpPosolyt()
{
if (_adsManager != null && _windowPumpPosolyt == null)
{
_windowPumpPosolyt = new() { DataContext = _pumpPosolytVM };
_windowPumpPosolyt.Closed += WindowPumpPosolyt_Closed;
_windowPumpPosolyt.Show();
}
}
[RelayCommand]
private void OpenBothValves()
{
_valveNegolytVM.OpenButton?.ButtonClickedCommand.Execute(null);
_valvePosolytVM.OpenButton?.ButtonClickedCommand.Execute(null);
}
[RelayCommand]
private void CloseBothValves()
{
_valveNegolytVM.CloseButton?.ButtonClickedCommand.Execute(null);
_valvePosolytVM.CloseButton?.ButtonClickedCommand.Execute(null);
}
private void OnValveNegolytOpenFeedbackChanged(object? sender, EventArgs e)
{
CalculateOpenFeedback();
}
private void OnValvePosolytOpenFeedbackChanged(object? sender, EventArgs e)
{
CalculateOpenFeedback();
}
private void CalculateOpenFeedback()
{
if (_valveNegolytVM?.OpenButton.IFeedback == 1 && _valvePosolytVM?.OpenButton.IFeedback == 1)
FeedbackOpenValves = 1;
else if (_valveNegolytVM?.OpenButton.IFeedback == 0 && _valvePosolytVM?.OpenButton.IFeedback == 0)
FeedbackOpenValves = 0;
else
FeedbackOpenValves = 2;
}
private void OnValveNegolytCloseFeedbackChanged(object? sender, EventArgs e)
{
CalculateCloseFeedback();
}
private void OnValvePosolytCloseFeedbackChanged(object? sender, EventArgs e)
{
CalculateCloseFeedback();
}
private void CalculateCloseFeedback()
{
if (_valveNegolytVM?.CloseButton.IFeedback == 1 && _valvePosolytVM?.CloseButton.IFeedback == 1)
FeedbackCloseValves = 1;
else if (_valveNegolytVM?.CloseButton.IFeedback == 0 && _valvePosolytVM?.CloseButton.IFeedback == 0)
FeedbackCloseValves = 0;
else
FeedbackCloseValves = 2;
}
private void OnValveNegolytOpenReleaseChanged(object? sender, EventArgs e)
{
CalculateOpenRelease();
}
private void OnValvePosolytOpenReleaseChanged(object? sender, EventArgs e)
{
CalculateOpenRelease();
}
private void CalculateOpenRelease()
{
if (_valvePosolytVM == null || _valveNegolytVM == null)
return;
if (_valveNegolytVM.OpenButton.XRelease && _valvePosolytVM.OpenButton.XRelease)
CanOpenBothValves = true;
else
CanOpenBothValves = false;
}
private void OnValveNegolytCloseReleaseChanged(object? sender, EventArgs e)
{
CalculateCloseRelease();
}
private void OnValvePosolytCloseReleaseChanged(object? sender, EventArgs e)
{
CalculateCloseRelease();
}
private void CalculateCloseRelease()
{
if (_valvePosolytVM == null || _valveNegolytVM == null)
return;
if (_valveNegolytVM.CloseButton.XRelease && _valvePosolytVM.CloseButton.XRelease)
CanCloseBothValves = true;
else
CanCloseBothValves = false;
}
[RelayCommand]
private void StartBothPumps()
{
if (_adsManager == null || _pumpNegolytVM == null || _pumpPosolytVM == null)
return;
_pumpNegolytVM.Setpoint.RValue = _negolytPumpOnSpeed;
_pumpPosolytVM.Setpoint.RValue = _posolytPumpOnSpeed;
_pumpNegolytVM.StartButton?.ButtonClickedCommand.Execute(null);
_pumpPosolytVM.StartButton?.ButtonClickedCommand.Execute(null);
}
[RelayCommand]
private void StopBothPumps()
{
_pumpNegolytVM.StopButton?.ButtonClickedCommand.Execute(null);
_pumpPosolytVM.StopButton?.ButtonClickedCommand.Execute(null);
}
private void CalculateStartRelease()
{
if (_pumpNegolytVM == null || _pumpPosolytVM == null)
return;
if (_pumpNegolytVM.StartButton.XRelease && _pumpPosolytVM.StartButton.XRelease)
CanStartBothPumps = true;
else
CanStartBothPumps = false;
}
private void CalculatStopRelease()
{
if (_pumpNegolytVM == null || _pumpPosolytVM == null)
return;
if (_pumpNegolytVM.StopButton.XRelease && _pumpPosolytVM.StopButton.XRelease)
CanStopBothPumps = true;
else
CanStopBothPumps = false;
}
private void CalculateStartFeedback()
{
if (_pumpNegolytVM == null || _pumpPosolytVM == null)
return;
if (_pumpNegolytVM.StartButton.IFeedback == 1 && _pumpPosolytVM.StartButton.IFeedback == 1)
FeedbackStartPumps = 1;
else if (_pumpNegolytVM.StartButton.IFeedback == 0 && _pumpPosolytVM.StartButton.IFeedback == 0)
FeedbackStartPumps = 0;
else
FeedbackStartPumps = 2;
}
private void CalculateStopFeedback()
{
if (_pumpNegolytVM == null || _pumpPosolytVM == null)
return;
if (_pumpNegolytVM.StopButton.IFeedback == 1 && _pumpPosolytVM.StopButton.IFeedback == 1)
FeedbackStopPumps = 1;
else if (_pumpNegolytVM.StopButton.IFeedback == 0 && _pumpPosolytVM.StopButton.IFeedback == 0)
FeedbackStopPumps = 0;
else
FeedbackStopPumps = 2;
}
private void OnPumpPosolytStopReleaseChanged(object? sender, EventArgs e)
{
CalculatStopRelease();
}
private void OnPumpPosolytStartReleaseChanged(object? sender, EventArgs e)
{
CalculateStartRelease();
}
private void OnPumpPosolytStopFeedbackChanged(object? sender, EventArgs e)
{
CalculateStopFeedback();
}
private void OnPumpPosolytStartFeedbackChanged(object? sender, EventArgs e)
{
CalculateStartFeedback();
}
private void OnPumpNegolytStopReleaseChanged(object? sender, EventArgs e)
{
CalculatStopRelease();
}
private void OnPumpNegolytStartReleaseChanged(object? sender, EventArgs e)
{
CalculateStartRelease();
}
private void OnPumpNegolytStopFeedbackChanged(object? sender, EventArgs e)
{
CalculateStopFeedback();
}
private void OnPumpNegolytStartFeedbackChanged(object? sender, EventArgs e)
{
CalculateStartFeedback();
}
private void WindowPumpPosolyt_Closed(object? sender, EventArgs e)
{
_windowPumpPosolyt!.Close();
_windowPumpPosolyt = null;
}
}

View File

@@ -1,23 +1,22 @@
using System.Windows;
using System.Windows.Controls;
namespace InfineonHMI
{
/// <summary>
/// Interaktionslogik für StringControlButton.xaml
/// </summary>
public partial class SMUControlButton : Button
{
public static readonly DependencyProperty SMUNameProperty = DependencyProperty.Register("SMUName", typeof(string), typeof(SMUControlButton));
public String SMUName
{
get { return (string)GetValue(SMUNameProperty); }
set { SetValue(SMUNameProperty, value); }
}
namespace InfineonHMI;
public SMUControlButton()
{
InitializeComponent();
}
}
/// <summary>
/// Interaktionslogik für StringControlButton.xaml
/// </summary>
public partial class SMUControlButton : Button
{
public static readonly DependencyProperty SMUNameProperty = DependencyProperty.Register("SMUName", typeof(string), typeof(SMUControlButton));
public String SMUName
{
get { return (string)GetValue(SMUNameProperty); }
set { SetValue(SMUNameProperty, value); }
}
public SMUControlButton()
{
InitializeComponent();
}
}

View File

@@ -1,22 +1,21 @@
using System.Windows;
using System.Windows.Controls;
namespace InfineonHMI
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
{
get { return (string)GetValue(UnitNameProperty); }
set { SetValue(UnitNameProperty, value); }
}
public UnitDetailsControl()
{
InitializeComponent();
}
}
public static readonly DependencyProperty UnitNameProperty = DependencyProperty.Register("UnitName", typeof(string), typeof(UnitDetailsControl));
public String UnitName
{
get { return (string)GetValue(UnitNameProperty); }
set { SetValue(UnitNameProperty, value); }
}
public UnitDetailsControl()
{
InitializeComponent();
}
}

View File

@@ -5,39 +5,44 @@ using Heisig.HMI.AdsManager;
using CommunityToolkit.Mvvm.Input;
using TwinCAT.TypeSystem;
using System.Collections.ObjectModel;
using Common;
using InfineonHMI.Model;
namespace InfineonHMI
namespace InfineonHMI;
public sealed partial class AlignmentStationPageVM : ObservableValidator, IDisposable
{
public sealed partial class AlignmentStationPageVM : ObservableValidator, IDisposable
{
private readonly string? _variableName;
private readonly string? _variableName;
private readonly IAdsManager? _adsManager;
private readonly IAdsManager? _adsManager;
[ObservableProperty]
private BinaryValveControlVM vacuumValveControlVm;
[ObservableProperty] private PackMLControlVM? alignmentPackMLControlVm;
public AlignmentStationPageVM()
{
VacuumValveControlVm = new BinaryValveControlVM();
}
[ObservableProperty]
private BinaryValveControlVM vacuumValveControlVm;
public AlignmentStationPageVM(IAdsManager adsManager, string variableName)
{
_adsManager = adsManager;
_variableName = variableName;
public AlignmentStationPageVM()
{
VacuumValveControlVm = new BinaryValveControlVM();
AlignmentPackMLControlVm = new();
AlignmentPackMLControlVm.STitle = "Ausrichtstation";
}
VacuumValveControlVm = new BinaryValveControlVM(_adsManager, _variableName + ".stVacuumValve");
}
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()
{
public void Dispose()
{
}
}
}
}

View File

@@ -1,94 +1,98 @@
using CommunityToolkit.Mvvm.ComponentModel;
using HMIToolkit;
using System.ComponentModel.DataAnnotations;
using Heisig.HMI.AdsManager;
using Common;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using TwinCAT.TypeSystem;
using System.Collections.ObjectModel;
using Heisig.HMI.AdsManager;
using HMIToolkit;
using InfineonHMI.Model;
namespace InfineonHMI
using System.Collections.ObjectModel;
using System.ComponentModel.DataAnnotations;
using System.Diagnostics;
using TwinCAT.TypeSystem;
namespace InfineonHMI;
public sealed partial class EtchingStation1PageVM : ObservableValidator, IDisposable
{
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();
[ObservableProperty] private BinaryValveControlVM vacuumValveControlEtching1Vm;
ChuckUnlockCmdButtonEtching1Vm = new HMIControlButtonVM();
ChuckLockCmdButtonEtching1Vm = new HMIControlButtonVM();
ChuckEjectCmdButtonEtching1Vm = new HMIControlButtonVM();
[ObservableProperty] private BinaryValveControlVM doorValveControlEtching1Vm;
Etching1PackMLControlVm = new();
Etching1PackMLControlVm.STitle = "Ätzer 1";
}
[ObservableProperty] private BinaryValveControlVM chuckUnlockValveLeftEtching1Vm;
public EtchingStation1PageVM(IAdsManager adsManager, string variableName)
{
_adsManager = adsManager;
_variableName = variableName;
[ObservableProperty] private BinaryValveControlVM chuckUnlockValveRightEtching1Vm;
VacuumValveControlEtching1Vm = new BinaryValveControlVM(_adsManager, _variableName + ".stEtcher1.stVacuumValve");
DoorValveControlEtching1Vm = new BinaryValveControlVM(_adsManager, _variableName + ".stEtcher1.stDoorValve");
ChuckUnlockValveLeftEtching1Vm = new BinaryValveControlVM(_adsManager, _variableName + ".stEtcher1.stChuckUnlockLeft");
ChuckUnlockValveRightEtching1Vm = new BinaryValveControlVM(_adsManager, _variableName + ".stEtcher1.stChuckUnlockRight");
ChuckEjectValveFrontEtching1Vm = new BinaryValveControlVM(_adsManager, _variableName + ".stEtcher1.stChuckEjectFront");
ChuckEjectValveBackEtching1Vm = new BinaryValveControlVM(_adsManager, _variableName + ".stEtcher1.stChuckEjectBack");
[ObservableProperty] private BinaryValveControlVM chuckEjectValveFrontEtching1Vm;
ChuckUnlockCmdButtonEtching1Vm = new HMIControlButtonVM(_adsManager, _variableName + ".stEtcher1.stChuckUnlockCmd");
ChuckLockCmdButtonEtching1Vm = new HMIControlButtonVM(_adsManager, _variableName + ".stEtcher1.stChuckLockCmd");
ChuckEjectCmdButtonEtching1Vm = new HMIControlButtonVM(_adsManager, _variableName + ".stEtcher1.stChuckEjectCmd");
[ObservableProperty] private BinaryValveControlVM chuckEjectValveBackEtching1Vm;
[ObservableProperty] private HMIControlButtonVM? chuckUnlockCmdButtonEtching1Vm;
[ObservableProperty] private HMIControlButtonVM? chuckLockCmdButtonEtching1Vm;
[ObservableProperty] private HMIControlButtonVM? chuckEjectCmdButtonEtching1Vm;
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();
}
public EtchingStation1PageVM(IAdsManager adsManager, string variableName)
{
_adsManager = adsManager;
_variableName = variableName;
VacuumValveControlEtching1Vm = new BinaryValveControlVM(_adsManager, "GVL_SCADA.stMachine.stEtcher1.stVacuumValve");
DoorValveControlEtching1Vm = new BinaryValveControlVM(_adsManager, "GVL_SCADA.stMachine.stEtcher1.stDoorValve");
ChuckUnlockValveLeftEtching1Vm = new BinaryValveControlVM(_adsManager, "GVL_SCADA.stMachine.stEtcher1.stChuckUnlockLeft");
ChuckUnlockValveRightEtching1Vm = new BinaryValveControlVM(_adsManager, "GVL_SCADA.stMachine.stEtcher1.stChuckUnlockRight");
ChuckEjectValveFrontEtching1Vm = new BinaryValveControlVM(_adsManager, "GVL_SCADA.stMachine.stEtcher1.stChuckEjectFront");
ChuckEjectValveBackEtching1Vm = new BinaryValveControlVM(_adsManager, "GVL_SCADA.stMachine.stEtcher1.stChuckEjectBack");
ChuckUnlockCmdButtonEtching1Vm = new HMIControlButtonVM(_adsManager, "GVL_SCADA.stMachine.stEtcher1.stChuckUnlockCmd");
ChuckLockCmdButtonEtching1Vm = new HMIControlButtonVM(_adsManager, "GVL_SCADA.stMachine.stEtcher1.stChuckLockCmd");
ChuckEjectCmdButtonEtching1Vm = new HMIControlButtonVM(_adsManager, "GVL_SCADA.stMachine.stEtcher1.stChuckEjectCmd");
}
Etching1PackMLControlVm = new(_adsManager, _variableName + ".stEtcher1.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;
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;
}
}
}
}

View File

@@ -5,88 +5,94 @@ using Heisig.HMI.AdsManager;
using CommunityToolkit.Mvvm.Input;
using TwinCAT.TypeSystem;
using System.Collections.ObjectModel;
using Common;
using InfineonHMI.Model;
namespace InfineonHMI
namespace InfineonHMI;
public sealed partial class EtchingStation2PageVM : ObservableValidator, IDisposable
{
public sealed partial class EtchingStation2PageVM : ObservableValidator, IDisposable
{
[ObservableProperty] private BinaryValveControlVM vacuumValveControlEtching2Vm;
[ObservableProperty] private BinaryValveControlVM vacuumValveControlEtching2Vm;
[ObservableProperty] private BinaryValveControlVM doorValveControlEtching2Vm;
[ObservableProperty] private BinaryValveControlVM doorValveControlEtching2Vm;
[ObservableProperty] private BinaryValveControlVM chuckUnlockValveLeftEtching2Vm;
[ObservableProperty] private BinaryValveControlVM chuckUnlockValveLeftEtching2Vm;
[ObservableProperty] private BinaryValveControlVM chuckUnlockValveRightEtching2Vm;
[ObservableProperty] private BinaryValveControlVM chuckUnlockValveRightEtching2Vm;
[ObservableProperty] private BinaryValveControlVM chuckEjectValveFrontEtching2Vm;
[ObservableProperty] private BinaryValveControlVM chuckEjectValveFrontEtching2Vm;
[ObservableProperty] private BinaryValveControlVM chuckEjectValveBackEtching2Vm;
[ObservableProperty] private BinaryValveControlVM chuckEjectValveBackEtching2Vm;
[ObservableProperty] private HMIControlButtonVM? chuckUnlockCmdButtonEtching2Vm;
[ObservableProperty] private HMIControlButtonVM? chuckUnlockCmdButtonEtching2Vm;
[ObservableProperty] private HMIControlButtonVM? chuckLockCmdButtonEtching2Vm;
[ObservableProperty] private HMIControlButtonVM? chuckLockCmdButtonEtching2Vm;
[ObservableProperty] private HMIControlButtonVM? chuckEjectCmdButtonEtching2Vm;
[ObservableProperty] private HMIControlButtonVM? chuckEjectCmdButtonEtching2Vm;
[ObservableProperty] private PackMLControlVM? etching2PackMLControlVm;
private readonly string? _variableName;
private readonly string? _variableName;
private readonly IAdsManager? _adsManager;
private readonly IAdsManager? _adsManager;
public EtchingStation2PageVM()
{
public EtchingStation2PageVM()
{
VacuumValveControlEtching2Vm = new BinaryValveControlVM();
DoorValveControlEtching2Vm = new BinaryValveControlVM();
ChuckUnlockValveLeftEtching2Vm = new BinaryValveControlVM();
ChuckUnlockValveRightEtching2Vm = new BinaryValveControlVM();
ChuckEjectValveFrontEtching2Vm = new BinaryValveControlVM();
ChuckEjectValveBackEtching2Vm = new BinaryValveControlVM();
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();
}
ChuckUnlockCmdButtonEtching2Vm = new HMIControlButtonVM();
ChuckLockCmdButtonEtching2Vm = new HMIControlButtonVM();
ChuckEjectCmdButtonEtching2Vm = new HMIControlButtonVM();
public EtchingStation2PageVM(IAdsManager adsManager, string variableName)
{
_adsManager = adsManager;
_variableName = variableName;
Etching2PackMLControlVm = new();
Etching2PackMLControlVm.STitle = "Ätzer 2";
}
public EtchingStation2PageVM(IAdsManager adsManager, string variableName)
{
_adsManager = adsManager;
_variableName = variableName;
VacuumValveControlEtching2Vm = new BinaryValveControlVM(_adsManager, "GVL_SCADA.stMachine.stEtcher2.stVacuumValve");
DoorValveControlEtching2Vm = new BinaryValveControlVM(_adsManager, "GVL_SCADA.stMachine.stEtcher2.stDoorValve");
ChuckUnlockValveLeftEtching2Vm = new BinaryValveControlVM(_adsManager, "GVL_SCADA.stMachine.stEtcher2.stChuckUnlockLeft");
ChuckUnlockValveRightEtching2Vm = new BinaryValveControlVM(_adsManager, "GVL_SCADA.stMachine.stEtcher2.stChuckUnlockRight");
ChuckEjectValveFrontEtching2Vm = new BinaryValveControlVM(_adsManager, "GVL_SCADA.stMachine.stEtcher2.stChuckEjectFront");
ChuckEjectValveBackEtching2Vm = new BinaryValveControlVM(_adsManager, "GVL_SCADA.stMachine.stEtcher2.stChuckEjectBack");
VacuumValveControlEtching2Vm = new BinaryValveControlVM(_adsManager, _variableName + ".stEtcher2.stVacuumValve");
DoorValveControlEtching2Vm = new BinaryValveControlVM(_adsManager, _variableName + ".stEtcher2.stDoorValve");
ChuckUnlockValveLeftEtching2Vm = new BinaryValveControlVM(_adsManager, _variableName + ".stEtcher2.stChuckUnlockLeft");
ChuckUnlockValveRightEtching2Vm = new BinaryValveControlVM(_adsManager, _variableName + ".stEtcher2.stChuckUnlockRight");
ChuckEjectValveFrontEtching2Vm = new BinaryValveControlVM(_adsManager, _variableName + ".stEtcher2.stChuckEjectFront");
ChuckEjectValveBackEtching2Vm = new BinaryValveControlVM(_adsManager, _variableName + ".stEtcher2.stChuckEjectBack");
ChuckUnlockCmdButtonEtching2Vm = new HMIControlButtonVM(_adsManager, "GVL_SCADA.stMachine.stEtcher2.stChuckUnlockCmd");
ChuckLockCmdButtonEtching2Vm = new HMIControlButtonVM(_adsManager, "GVL_SCADA.stMachine.stEtcher2.stChuckLockCmd");
ChuckEjectCmdButtonEtching2Vm = new HMIControlButtonVM(_adsManager, "GVL_SCADA.stMachine.stEtcher2.stChuckEjectCmd");
ChuckUnlockCmdButtonEtching2Vm = new HMIControlButtonVM(_adsManager, _variableName + ".stEtcher2.stChuckUnlockCmd");
ChuckLockCmdButtonEtching2Vm = new HMIControlButtonVM(_adsManager, _variableName + ".stEtcher2.stChuckLockCmd");
ChuckEjectCmdButtonEtching2Vm = new HMIControlButtonVM(_adsManager, _variableName + ".stEtcher2.stChuckEjectCmd");
}
Etching2PackMLControlVm = new(_adsManager, _variableName + ".stEtcher2.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;
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;
}
}
}
}

View File

@@ -3,47 +3,47 @@ using System.Collections.ObjectModel;
using System.Windows;
using TcEventLoggerAdsProxyLib;
namespace InfineonHMI
namespace InfineonHMI;
public partial class EventData : ObservableObject
{
public partial class EventData : ObservableObject
{
[ObservableProperty]
public uint id;
[ObservableProperty]
public uint id;
[ObservableProperty]
public string? message;
[ObservableProperty]
public string? message;
[ObservableProperty]
public DateTime raised;
[ObservableProperty]
public DateTime raised;
[ObservableProperty]
public DateTime cleared;
[ObservableProperty]
public DateTime cleared;
[ObservableProperty]
public DateTime confirmed;
};
[ObservableProperty]
public DateTime confirmed;
};
public sealed partial class EventsPageVM : ObservableObject
{
public ObservableCollection<EventData> CurrentEvents { get; private set; } = [];
private readonly object _lock = new();
public sealed partial class EventsPageVM : ObservableObject
{
public ObservableCollection<EventData> CurrentEvents { get; private set; } = [];
private readonly object _lock = new();
private readonly TcEventLogger _logger;
private readonly TcEventLogger _logger;
[ObservableProperty]
private EventData? currentEvent;
[ObservableProperty]
private EventData? currentEvent;
// 599264352000000000 ticks is a date used by beckhoff for events that didnt happen up to this point
private const long NoTime = 599264352000000000;
// 599264352000000000 ticks is a date used by beckhoff for events that didnt happen up to this point
private const long NoTime = 599264352000000000;
public EventsPageVM(TcEventLogger logger)
{
_logger = logger;
public EventsPageVM(TcEventLogger logger)
{
_logger = logger;
_logger.AlarmRaised += SimpleAlarmRaisedEvent;
_logger.AlarmCleared += SimpleAlarmClearedEvent;
_logger.AlarmConfirmed += SimpleConfirmedAlarmEvent;
_logger.AlarmRaised += SimpleAlarmRaisedEvent;
_logger.AlarmCleared += SimpleAlarmClearedEvent;
_logger.AlarmConfirmed += SimpleConfirmedAlarmEvent;
#if DEBUG
@@ -52,63 +52,62 @@ namespace InfineonHMI
_logger.Connect("10.103.32.50.1.1");
#endif
GetAllActiveEvents();
}
GetAllActiveEvents();
}
private void RebuildCurrentEventsList()
{
lock (_lock)
{
CurrentEvents.Clear();
}
private void RebuildCurrentEventsList()
{
lock (_lock)
{
CurrentEvents.Clear();
}
GetAllActiveEvents();
}
GetAllActiveEvents();
}
private void SimpleConfirmedAlarmEvent(TcAlarm alarm, bool remove)
{
Application.Current.Dispatcher.BeginInvoke(RebuildCurrentEventsList);
}
private void SimpleConfirmedAlarmEvent(TcAlarm alarm, bool remove)
{
Application.Current.Dispatcher.BeginInvoke(RebuildCurrentEventsList);
}
private void SimpleAlarmClearedEvent(TcAlarm alarm, bool remove)
{
Application.Current.Dispatcher.BeginInvoke(RebuildCurrentEventsList);
}
private void SimpleAlarmClearedEvent(TcAlarm alarm, bool remove)
{
Application.Current.Dispatcher.BeginInvoke(RebuildCurrentEventsList);
}
private void SimpleAlarmRaisedEvent(TcAlarm alarm)
{
Application.Current.Dispatcher.BeginInvoke(RebuildCurrentEventsList);
}
private void SimpleAlarmRaisedEvent(TcAlarm alarm)
{
Application.Current.Dispatcher.BeginInvoke(RebuildCurrentEventsList);
}
private void GetAllActiveEvents()
{
EventData eventData;
List<EventData> tempEventList = [];
private void GetAllActiveEvents()
{
EventData eventData;
List<EventData> tempEventList = [];
lock (_lock)
{
foreach (var alarm in _logger.ActiveAlarms)
{
eventData = new()
{
Id = alarm.EventId,
Message = alarm.GetText(1033),
Raised = alarm.TimeRaised,
Cleared = alarm.TimeCleared,
Confirmed = alarm.TimeConfirmed
};
lock (_lock)
{
foreach (var alarm in _logger.ActiveAlarms)
{
eventData = new()
{
Id = alarm.EventId,
Message = alarm.GetText(1033),
Raised = alarm.TimeRaised,
Cleared = alarm.TimeCleared,
Confirmed = alarm.TimeConfirmed
};
tempEventList.Add(eventData);
}
tempEventList.Add(eventData);
}
IEnumerable<EventData> _eventQuery =
from data in tempEventList
orderby data.Raised descending
select data;
IEnumerable<EventData> _eventQuery =
from data in tempEventList
orderby data.Raised descending
select data;
CurrentEvent = _eventQuery.FirstOrDefault();
CurrentEvents = new ObservableCollection<EventData>(_eventQuery);
}
}
}
CurrentEvent = _eventQuery.FirstOrDefault();
CurrentEvents = new ObservableCollection<EventData>(_eventQuery);
}
}
}

View File

@@ -5,68 +5,83 @@ using Heisig.HMI.AdsManager;
using CommunityToolkit.Mvvm.Input;
using TwinCAT.TypeSystem;
using System.Collections.ObjectModel;
using Common;
using InfineonHMI.Model;
namespace InfineonHMI
namespace InfineonHMI;
public sealed partial class HighVoltageStationPageVM : ObservableValidator, IDisposable
{
public sealed partial class HighVoltageStationPageVM : ObservableValidator, IDisposable
{
private readonly string? _variableName;
private readonly string? _variableName;
private readonly IAdsManager? _adsManager;
private readonly IAdsManager? _adsManager;
[ObservableProperty]
private BinaryValveControlVM doorValveHotControlVm;
[ObservableProperty] private PackMLControlVM highVoltageHotPackMLControlVm;
[ObservableProperty] private PackMLControlVM highVoltageColdPackMLControlVm;
[ObservableProperty]
private BinaryValveControlVM testChamberHotValveVm;
[ObservableProperty]
private BinaryValveControlVM doorValveHotControlVm;
[ObservableProperty]
private AnalogValueVM tempSPHotVm;
[ObservableProperty]
private BinaryValveControlVM testChamberHotValveVm;
[ObservableProperty]
private BinaryValveControlVM doorValveColdControlVm;
[ObservableProperty]
private AnalogValueVM tempSPHotVm;
[ObservableProperty]
private BinaryValveControlVM testChamberColdValveVm;
[ObservableProperty]
private BinaryValveControlVM doorValveColdControlVm;
[ObservableProperty]
private AnalogValueVM tempSPColdVm;
[ObservableProperty]
private BinaryValveControlVM testChamberColdValveVm;
public HighVoltageStationPageVM()
{
DoorValveHotControlVm = new BinaryValveControlVM();
TestChamberHotValveVm = new BinaryValveControlVM();
TempSPHotVm = new AnalogValueVM();
[ObservableProperty]
private AnalogValueVM tempSPColdVm;
DoorValveColdControlVm = new BinaryValveControlVM();
TestChamberColdValveVm = new BinaryValveControlVM();
TempSPColdVm = new AnalogValueVM();
}
public HighVoltageStationPageVM()
{
DoorValveHotControlVm = new BinaryValveControlVM();
TestChamberHotValveVm = new BinaryValveControlVM();
TempSPHotVm = new AnalogValueVM();
public HighVoltageStationPageVM(IAdsManager adsManager, string variableName)
{
_adsManager = adsManager;
_variableName = variableName;
DoorValveColdControlVm = new BinaryValveControlVM();
TestChamberColdValveVm = new BinaryValveControlVM();
TempSPColdVm = new AnalogValueVM();
DoorValveHotControlVm = new BinaryValveControlVM(_adsManager, "GVL_SCADA.stMachine.stHVTesterHot.stDoorValve");
TestChamberHotValveVm = new BinaryValveControlVM(_adsManager, "GVL_SCADA.stMachine.stHVTesterHot.stTestChamberValve");
TempSPHotVm = new AnalogValueVM(_adsManager, "GVL_SCADA.stMachine.stHVTesterHot.stTempSP", false);
HighVoltageColdPackMLControlVm = new();
HighVoltageHotPackMLControlVm = new();
DoorValveColdControlVm = new BinaryValveControlVM(_adsManager, "GVL_SCADA.stMachine.stHVTesterCold.stDoorValve");
TestChamberColdValveVm = new BinaryValveControlVM(_adsManager, "GVL_SCADA.stMachine.stHVTesterCold.stTestChamberValve");
TempSPColdVm = new AnalogValueVM(_adsManager, "GVL_SCADA.stMachine.stHVTesterCold.stTempSP", false);
HighVoltageColdPackMLControlVm.STitle = "Hochvoltstation\nKalt";
}
HighVoltageHotPackMLControlVm.STitle = "Hochvoltstation\nHeiß";
}
public void Dispose()
{
DoorValveHotControlVm.Dispose();
TestChamberHotValveVm.Dispose();
TempSPHotVm.Dispose();
DoorValveColdControlVm.Dispose();
TestChamberColdValveVm.Dispose();
TempSPColdVm.Dispose();
}
}
public HighVoltageStationPageVM(IAdsManager adsManager, string variableName)
{
_adsManager = adsManager;
_variableName = variableName;
DoorValveHotControlVm = new BinaryValveControlVM(_adsManager, _variableName + "Hot.stDoorValve");
TestChamberHotValveVm = new BinaryValveControlVM(_adsManager, _variableName + "Hot.stTestChamberValve");
TempSPHotVm = new AnalogValueVM(_adsManager, _variableName + "Hot.stTempSP", false);
DoorValveColdControlVm = new BinaryValveControlVM(_adsManager, _variableName + "Cold.stDoorValve");
TestChamberColdValveVm = new BinaryValveControlVM(_adsManager, _variableName + "Cold.stTestChamberValve");
TempSPColdVm = new AnalogValueVM(_adsManager, _variableName + "Cold.stTempSP", false);
HighVoltageColdPackMLControlVm = new(_adsManager, _variableName + "Cold.stStationCmds");
HighVoltageHotPackMLControlVm = new(_adsManager, _variableName + "Hot.stStationCmds");
HighVoltageColdPackMLControlVm.STitle = "Hochvoltstation\nKalt";
HighVoltageHotPackMLControlVm.STitle = "Hochvoltstation\nHeiß";
}
public void Dispose()
{
DoorValveHotControlVm.Dispose();
TestChamberHotValveVm.Dispose();
TempSPHotVm.Dispose();
DoorValveColdControlVm.Dispose();
TestChamberColdValveVm.Dispose();
TempSPColdVm.Dispose();
}
}

View File

@@ -8,401 +8,417 @@ using System.Collections.ObjectModel;
using InfineonHMI.Model;
using System.Windows;
namespace InfineonHMI
using Common;
namespace InfineonHMI;
public sealed partial class HotCoolPlatePageVM : ObservableValidator, IDisposable
{
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 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 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 IAdsManager? _adsManager;
private readonly string? _variableName;
private readonly string? _variableName;
[ObservableProperty]
private AnalogValueVM hotPlateTargetTemperature;
[ObservableProperty] private PackMLControlVM? hotplatePackMLControlVm;
[ObservableProperty] private PackMLControlVM? coolplatePackMLControlVm;
[ObservableProperty]
private AnalogValueVM hotPlateActualTemperature;
[ObservableProperty] private HMIControlButtonVM? enableHotPlateButtonVm;
[ObservableProperty]
private AnalogValueVM hotPlateTargetTemperature;
[ObservableProperty] private HMIControlButtonVM? disableHotPlateButtonVm;
[ObservableProperty]
private AnalogValueVM hotPlateActualTemperature;
[ObservableProperty]
private AnalogValueVM coolPlateTargetTemperature;
[ObservableProperty] private HMIControlButtonVM? enableHotPlateButtonVm;
[ObservableProperty]
private AnalogValueVM coolPlateActualTemperature;
[ObservableProperty] private HMIControlButtonVM? disableHotPlateButtonVm;
[ObservableProperty] private HMIControlButtonVM? enableCoolPlateButtonVm;
[ObservableProperty]
private AnalogValueVM coolPlateTargetTemperature;
[ObservableProperty] private HMIControlButtonVM? disableCoolPlateButtonVm;
[ObservableProperty]
private AnalogValueVM coolPlateActualTemperature;
[ObservableProperty]
private Visibility hotPlateVisibility1;
[ObservableProperty] private HMIControlButtonVM? enableCoolPlateButtonVm;
[ObservableProperty]
private Visibility hotPlateVisibility2;
[ObservableProperty] private HMIControlButtonVM? disableCoolPlateButtonVm;
[ObservableProperty]
private Visibility hotPlateVisibility3;
[ObservableProperty]
private Visibility hotPlateVisibility1;
[ObservableProperty]
private Visibility hotPlateVisibility4;
[ObservableProperty]
private Visibility hotPlateVisibility2;
[ObservableProperty]
private Visibility hotPlateVisibility5;
[ObservableProperty]
private Visibility hotPlateVisibility3;
[ObservableProperty]
private Visibility hotPlateVisibility6;
[ObservableProperty]
private Visibility hotPlateVisibility4;
[ObservableProperty]
private Visibility hotPlateVisibility7;
[ObservableProperty]
private Visibility hotPlateVisibility5;
[ObservableProperty]
private Visibility hotPlateVisibility8;
[ObservableProperty]
private Visibility hotPlateVisibility6;
[ObservableProperty]
private Visibility hotPlateVisibility9;
[ObservableProperty]
private Visibility hotPlateVisibility7;
[ObservableProperty]
private Visibility coolPlateVisibility1;
[ObservableProperty]
private Visibility hotPlateVisibility8;
[ObservableProperty]
private Visibility coolPlateVisibility2;
[ObservableProperty]
private Visibility hotPlateVisibility9;
[ObservableProperty]
private Visibility coolPlateVisibility3;
[ObservableProperty]
private Visibility coolPlateVisibility1;
[ObservableProperty]
private Visibility coolPlateVisibility4;
[ObservableProperty]
private Visibility coolPlateVisibility2;
[ObservableProperty]
private Visibility coolPlateVisibility5;
[ObservableProperty]
private Visibility coolPlateVisibility3;
[ObservableProperty]
private Visibility coolPlateVisibility6;
[ObservableProperty]
private Visibility coolPlateVisibility4;
[ObservableProperty]
private Visibility coolPlateVisibility7;
[ObservableProperty]
private Visibility coolPlateVisibility5;
[ObservableProperty]
private Visibility coolPlateVisibility8;
[ObservableProperty]
private Visibility coolPlateVisibility6;
[ObservableProperty]
private Visibility coolPlateVisibility9;
[ObservableProperty]
private Visibility coolPlateVisibility7;
public HotCoolPlatePageVM()
[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();
CoolplatePackMLControlVm = new();
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)
{
EnableHotPlateButtonVm = new HMIControlButtonVM();
DisableHotPlateButtonVm = new HMIControlButtonVM();
EnableCoolPlateButtonVm = new HMIControlButtonVM();
DisableCoolPlateButtonVm = new HMIControlButtonVM();
HotPlateActualTemperature = new AnalogValueVM();
HotPlateTargetTemperature = new AnalogValueVM();
CoolPlateActualTemperature = new AnalogValueVM();
CoolPlateTargetTemperature = new AnalogValueVM();
HotPlateVisibility1 = Visibility.Visible;
}
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, "GVL_SCADA.stMachine.stHotplate.stPV", true);
CoolPlateActualTemperature = new AnalogValueVM(_adsManager, "GVL_SCADA.stMachine.stCoolplate.stPV", true);
HotPlateTargetTemperature = new AnalogValueVM(_adsManager, "GVL_SCADA.stMachine.stHotplate.stSetpoint", false);
CoolPlateTargetTemperature = new AnalogValueVM(_adsManager, "GVL_SCADA.stMachine.stCoolplate.stSetpoint", false);
_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)
else
{
if ((bool)e.Value)
{
HotPlateVisibility1 = Visibility.Visible;
}
else
{
HotPlateVisibility1 = Visibility.Hidden;
}
HotPlateVisibility1 = Visibility.Hidden;
}
private void HotplatePiece2Changed(object? sender, ValueChangedEventArgs e)
}
private void HotplatePiece2Changed(object? sender, ValueChangedEventArgs e)
{
if ((bool)e.Value)
{
if ((bool)e.Value)
{
HotPlateVisibility2 = Visibility.Visible;
}
else
{
HotPlateVisibility2 = Visibility.Hidden;
}
HotPlateVisibility2 = Visibility.Visible;
}
private void HotplatePiece3Changed(object? sender, ValueChangedEventArgs e)
else
{
if ((bool)e.Value)
{
HotPlateVisibility3 = Visibility.Visible;
}
else
{
HotPlateVisibility3 = Visibility.Hidden;
}
HotPlateVisibility2 = Visibility.Hidden;
}
private void HotplatePiece4Changed(object? sender, ValueChangedEventArgs e)
}
private void HotplatePiece3Changed(object? sender, ValueChangedEventArgs e)
{
if ((bool)e.Value)
{
if ((bool)e.Value)
{
HotPlateVisibility4 = Visibility.Visible;
}
else
{
HotPlateVisibility4 = Visibility.Hidden;
}
HotPlateVisibility3 = Visibility.Visible;
}
private void HotplatePiece5Changed(object? sender, ValueChangedEventArgs e)
else
{
if ((bool)e.Value)
{
HotPlateVisibility5 = Visibility.Visible;
}
else
{
HotPlateVisibility5 = Visibility.Hidden;
}
HotPlateVisibility3 = Visibility.Hidden;
}
private void HotplatePiece6Changed(object? sender, ValueChangedEventArgs e)
}
private void HotplatePiece4Changed(object? sender, ValueChangedEventArgs e)
{
if ((bool)e.Value)
{
if ((bool)e.Value)
{
HotPlateVisibility6 = Visibility.Visible;
}
else
{
HotPlateVisibility6 = Visibility.Hidden;
}
HotPlateVisibility4 = Visibility.Visible;
}
private void HotplatePiece7Changed(object? sender, ValueChangedEventArgs e)
else
{
if ((bool)e.Value)
{
HotPlateVisibility7 = Visibility.Visible;
}
else
{
HotPlateVisibility7 = Visibility.Hidden;
}
HotPlateVisibility4 = Visibility.Hidden;
}
private void HotplatePiece8Changed(object? sender, ValueChangedEventArgs e)
}
private void HotplatePiece5Changed(object? sender, ValueChangedEventArgs e)
{
if ((bool)e.Value)
{
if ((bool)e.Value)
{
HotPlateVisibility8 = Visibility.Visible;
}
else
{
HotPlateVisibility8 = Visibility.Hidden;
}
HotPlateVisibility5 = Visibility.Visible;
}
private void HotplatePiece9Changed(object? sender, ValueChangedEventArgs e)
else
{
if ((bool)e.Value)
{
HotPlateVisibility9 = Visibility.Visible;
}
else
{
HotPlateVisibility9 = Visibility.Hidden;
}
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)
private void CoolplatePiece1Changed(object? sender, ValueChangedEventArgs e)
{
if ((bool)e.Value)
{
if ((bool)e.Value)
{
CoolPlateVisibility1 = Visibility.Visible;
}
else
{
CoolPlateVisibility1 = Visibility.Hidden;
}
CoolPlateVisibility1 = Visibility.Visible;
}
private void CoolplatePiece2Changed(object? sender, ValueChangedEventArgs e)
else
{
if ((bool)e.Value)
{
CoolPlateVisibility2 = Visibility.Visible;
}
else
{
CoolPlateVisibility2 = Visibility.Hidden;
}
CoolPlateVisibility1 = Visibility.Hidden;
}
private void CoolplatePiece3Changed(object? sender, ValueChangedEventArgs e)
}
private void CoolplatePiece2Changed(object? sender, ValueChangedEventArgs e)
{
if ((bool)e.Value)
{
if ((bool)e.Value)
{
CoolPlateVisibility3 = Visibility.Visible;
}
else
{
CoolPlateVisibility3 = Visibility.Hidden;
}
CoolPlateVisibility2 = Visibility.Visible;
}
private void CoolplatePiece4Changed(object? sender, ValueChangedEventArgs e)
else
{
if ((bool)e.Value)
{
CoolPlateVisibility4 = Visibility.Visible;
}
else
{
CoolPlateVisibility4 = Visibility.Hidden;
}
CoolPlateVisibility2 = Visibility.Hidden;
}
private void CoolplatePiece5Changed(object? sender, ValueChangedEventArgs e)
}
private void CoolplatePiece3Changed(object? sender, ValueChangedEventArgs e)
{
if ((bool)e.Value)
{
if ((bool)e.Value)
{
CoolPlateVisibility5 = Visibility.Visible;
}
else
{
CoolPlateVisibility5 = Visibility.Hidden;
}
CoolPlateVisibility3 = Visibility.Visible;
}
private void CoolplatePiece6Changed(object? sender, ValueChangedEventArgs e)
else
{
if ((bool)e.Value)
{
CoolPlateVisibility6 = Visibility.Visible;
}
else
{
CoolPlateVisibility6 = Visibility.Hidden;
}
CoolPlateVisibility3 = Visibility.Hidden;
}
private void CoolplatePiece7Changed(object? sender, ValueChangedEventArgs e)
}
private void CoolplatePiece4Changed(object? sender, ValueChangedEventArgs e)
{
if ((bool)e.Value)
{
if ((bool)e.Value)
{
CoolPlateVisibility7 = Visibility.Visible;
}
else
{
CoolPlateVisibility7 = Visibility.Hidden;
}
CoolPlateVisibility4 = Visibility.Visible;
}
private void CoolplatePiece8Changed(object? sender, ValueChangedEventArgs e)
else
{
if ((bool)e.Value)
{
CoolPlateVisibility8 = Visibility.Visible;
}
else
{
CoolPlateVisibility8 = Visibility.Hidden;
}
CoolPlateVisibility4 = Visibility.Hidden;
}
private void CoolplatePiece9Changed(object? sender, ValueChangedEventArgs e)
}
private void CoolplatePiece5Changed(object? sender, ValueChangedEventArgs e)
{
if ((bool)e.Value)
{
if ((bool)e.Value)
{
CoolPlateVisibility9 = Visibility.Visible;
}
else
{
CoolPlateVisibility9 = Visibility.Hidden;
}
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();
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);
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);
_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);
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -6,6 +6,8 @@ using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using System.Windows;
using System.Windows.Controls;
using Common;
using InfineonHMI.Common;
using TcEventLoggerAdsProxyLib;
namespace InfineonHMI;
@@ -17,12 +19,63 @@ public sealed partial class MachineOverviewPageVM : ObservableObject, IRecipient
[ObservableProperty] private Page currentDetailPage;
[ObservableProperty] private PackMLControlVM machinePackMLControlVM;
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; }
}
private readonly IAdsManager _adsManager;
private readonly IConfiguration _config;
private User currentUser;
// Last active event
[ObservableProperty] private string currentActiveEvent = "";
@@ -60,6 +113,10 @@ public sealed partial class MachineOverviewPageVM : ObservableObject, IRecipient
public MachineOverviewPageVM()
{
// default ctor
MachinePackMLControlVM = new();
MachinePackMLControlVM.STitle = "Betriebszustand\n Gesamtanlage";
currentUser = Users.getCurrentUser();
}
public MachineOverviewPageVM(IAdsManager adsManager, IConfiguration config,MainWindowVM mainVm, ProductionOverviewPageVM prodVm, TcEventLogger eventLogger)
{
@@ -70,6 +127,10 @@ public sealed partial class MachineOverviewPageVM : ObservableObject, IRecipient
// Create dummy string
DummyStringVM = new StringControlButtonVM();
currentUser = Users.getCurrentUser();
MachinePackMLControlVM = new(_adsManager, "GVL_SCADA.stMachine.stMachineCmds");
MachinePackMLControlVM.STitle = "Betriebszustand\n Gesamtanlage";
// Create empty page
_emptyPage = new();
@@ -79,6 +140,22 @@ public sealed partial class MachineOverviewPageVM : ObservableObject, IRecipient
WeakReferenceMessenger.Default.Register<NavigateMessage>(this);
//CanUserChangePageAlignment = currentUser.UserLevel > 50;
//CanUserChangePageEtching1 = currentUser.UserLevel > 50;
//CanUserChangePageEtching2 = currentUser.UserLevel > 50;
//CanUserChangePageHighVoltage = currentUser.UserLevel > 50;
//CanUserChangePageHotCoolplate = currentUser.UserLevel > 50;
//CanUserChangePageKukaRobot = currentUser.UserLevel > 50;
//CanUserChangePageMediaCabinet = currentUser.UserLevel > 50;
//CanUserChangePageNIOStation = currentUser.UserLevel > 50;
//CanUserChangePageProductionOverview = currentUser.UserLevel > 50;
//CanUserChangePageReceipe = currentUser.UserLevel == 100;
//CanUserChangePageTrayFeeder = currentUser.UserLevel > 50;
//CanUserChangeMachineState = currentUser.UserLevel > 50;
}
@@ -202,56 +279,56 @@ public sealed partial class MachineOverviewPageVM : ObservableObject, IRecipient
{
case nameof(TrayFeederPage):
if (_trayFeederPageVm == null)
_trayFeederPageVm = new(_adsManager, "GVL_CONFIG.stMachine");
_trayFeederPageVm = new(_adsManager, "GVL_SCADA.stMachine.TrayFeeder"); //In and Out ist set directly in ViewModel
TrayFeederPage trayFeederPage = new() { DataContext = _trayFeederPageVm };
TrayFeederPage trayFeederPage = new() { DataContext = _trayFeederPageVm };
CurrentDetailPage = trayFeederPage;
break;
case nameof(AlignmentStationPage):
// Create seetings page view model only once
if (_alignmentStationPageVM == null)
_alignmentStationPageVM = new(_adsManager, "GVL_CONFIG.stMachine.stAligner");
_alignmentStationPageVM = new(_adsManager, "GVL_SCADA.stMachine.stAligner");
AlignmentStationPage settingsPage = new() { DataContext = _alignmentStationPageVM };
AlignmentStationPage settingsPage = new() { DataContext = _alignmentStationPageVM };
CurrentDetailPage = settingsPage;
break;
case nameof(EtchingStation1Page):
if (_etchingStation1PageVm == null)
_etchingStation1PageVm = new(_adsManager, "GVL_CONFIG.stMachine.stEtcher1");
_etchingStation1PageVm = new(_adsManager, "GVL_SCADA.stMachine.stEtcher1");
EtchingStation1Page etchingStation1Page = new() { DataContext = _etchingStation1PageVm };
EtchingStation1Page etchingStation1Page = new() { DataContext = _etchingStation1PageVm };
CurrentDetailPage = etchingStation1Page;
break;
case nameof(EtchingStation2Page):
if (_etchingStation2PageVm == null)
_etchingStation2PageVm = new(_adsManager, "GVL_CONFIG.stMachine.stEtcher2");
_etchingStation2PageVm = new(_adsManager, "GVL_SCADA.stMachine.stEtcher2");
EtchingStation2Page etchingStation2Page = new() { DataContext = _etchingStation2PageVm };
EtchingStation2Page etchingStation2Page = new() { DataContext = _etchingStation2PageVm };
CurrentDetailPage = etchingStation2Page;
break;
case nameof(HighVoltageStationPage):
if (_highVoltageStationPageVm == null)
_highVoltageStationPageVm = new(_adsManager, "GVL_CONFIG.stMachine");
_highVoltageStationPageVm = new(_adsManager, "GVL_SCADA.stMachine.stHVTester"); // Hot/Cold is Set directly in VM
HighVoltageStationPage highVoltageStationPage = new() { DataContext = _highVoltageStationPageVm };
HighVoltageStationPage highVoltageStationPage = new() { DataContext = _highVoltageStationPageVm };
CurrentDetailPage = highVoltageStationPage;
break;
case nameof(HotCoolPlatePage):
if (_hotCoolplatePageVM == null)
_hotCoolplatePageVM = new(_adsManager, "GVL_Config.stMachine");
_hotCoolplatePageVM = new(_adsManager, "GVL_SCADA.stMachine"); //".stHotplate /.stCoolplate is set directly in VM
HotCoolPlatePage hotCoolPlatePage = new() {DataContext = _hotCoolplatePageVM };
HotCoolPlatePage hotCoolPlatePage = new() {DataContext = _hotCoolplatePageVM };
CurrentDetailPage = hotCoolPlatePage;
break;
case nameof(NIOStationPage):
if (_nioStationPageVm == null)
_nioStationPageVm = new(_adsManager, "GVL_Config.stMachine.stNOK");
_nioStationPageVm = new(_adsManager, "GVL_SCADA.stMachine.stNOK");
NIOStationPage nIOStationPage = new() { DataContext = _nioStationPageVm };
CurrentDetailPage = nIOStationPage;
@@ -260,17 +337,17 @@ public sealed partial class MachineOverviewPageVM : ObservableObject, IRecipient
case nameof(KukaRobotPage):
// Create page view model only once
if (_kukaRobotPageVM == null)
_kukaRobotPageVM = new(_adsManager, "GVL_CONFIG.stMachine.stKukaRobot");
_kukaRobotPageVM = new(_adsManager); // Variablenames are set directly in Viewmodel
KukaRobotPage kukaRobotPage = new() { DataContext = _kukaRobotPageVM };
KukaRobotPage kukaRobotPage = new() { DataContext = _kukaRobotPageVM };
CurrentDetailPage = kukaRobotPage;
break;
case nameof(MediaCabinetPage):
if (_mediaCabinetPageVM == null)
_mediaCabinetPageVM = new(_adsManager, "GVL_Config.stMachine");
_mediaCabinetPageVM = new(_adsManager, "GVL_SCADA.stMachine.stMediaCabinet"); //TODO not Implemented on PLC yet
MediaCabinetPage mediaCabinetPage = new() { DataContext= _mediaCabinetPageVM };
MediaCabinetPage mediaCabinetPage = new() { DataContext= _mediaCabinetPageVM };
CurrentDetailPage = mediaCabinetPage;
break;

View File

@@ -8,74 +8,90 @@ using System.Collections.ObjectModel;
using Common;
using InfineonHMI.Model;
namespace InfineonHMI
namespace InfineonHMI;
public sealed partial class MediaCabinetPageVM : ObservableValidator, IDisposable
{
public sealed partial class MediaCabinetPageVM : ObservableValidator, IDisposable
{
private IAdsManager _adsManager;
private string? _variableName;
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;
[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;
[ObservableProperty] private MediaContainerVm container10Vm;
[ObservableProperty] private MediaContainerVm container11Vm;
[ObservableProperty] private MediaContainerVm container12Vm;
public MediaCabinetPageVM(IAdsManager adsManager, string variableName)
{
_adsManager = adsManager;
_variableName = variableName;
public MediaCabinetPageVM(IAdsManager adsManager, string variableName)
{
_adsManager = adsManager;
_variableName = variableName;
Container1Vm = new MediaContainerVm(adsManager, variableName + ".stContainer1");
Container2Vm = new MediaContainerVm(adsManager, variableName + ".stContainer2");
Container3Vm = new MediaContainerVm(adsManager, variableName + ".stContainer3");
Container4Vm = new MediaContainerVm(adsManager, variableName + ".stContainer4");
Container5Vm = new MediaContainerVm(adsManager, variableName + ".stContainer5");
Container6Vm = new MediaContainerVm(adsManager, variableName + ".stContainer6");
Container7Vm = new MediaContainerVm(adsManager, variableName + ".stContainer7");
Container8Vm = new MediaContainerVm(adsManager, variableName + ".stContainer8");
Container9Vm = new MediaContainerVm(adsManager, variableName + ".stContainer9");
Container1Vm = new MediaContainerVm(adsManager, variableName + ".stContainer1");
Container2Vm = new MediaContainerVm(adsManager, variableName + ".stContainer2");
Container3Vm = new MediaContainerVm(adsManager, variableName + ".stContainer3");
Container4Vm = new MediaContainerVm(adsManager, variableName + ".stContainer4");
Container5Vm = new MediaContainerVm(adsManager, variableName + ".stContainer5");
Container6Vm = new MediaContainerVm(adsManager, variableName + ".stContainer6");
Container7Vm = new MediaContainerVm(adsManager, variableName + ".stContainer7");
Container8Vm = new MediaContainerVm(adsManager, variableName + ".stContainer8");
Container9Vm = new MediaContainerVm(adsManager, variableName + ".stContainer9");
Container10Vm = new MediaContainerVm(adsManager, variableName + ".stContainer10");
Container11Vm = new MediaContainerVm(adsManager, variableName + ".stContainer11");
Container12Vm = new MediaContainerVm(adsManager, variableName + ".stContainer12");
Container1Vm.SName = "Container1";
Container2Vm.SName = "Container2";
Container3Vm.SName = "Container3";
Container4Vm.SName = "Container4";
Container5Vm.SName = "Container5";
Container6Vm.SName = "Container6";
Container7Vm.SName = "Container7";
Container8Vm.SName = "Container8";
Container9Vm.SName = "Container9";
}
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 = "Container1";
Container2Vm.SName = "Container2";
Container3Vm.SName = "Container3";
Container4Vm.SName = "Container4";
Container5Vm.SName = "Container5";
Container6Vm.SName = "Container6";
Container7Vm.SName = "Container7";
Container8Vm.SName = "Container8";
Container9Vm.SName = "Container9";
Container10Vm.SName = "Container10";
Container11Vm.SName = "Container11";
Container12Vm.SName = "Container12";
Container1Vm.SName = "Container1";
Container2Vm.SName = "Container2";
Container3Vm.SName = "Container3";
Container4Vm.SName = "Container4";
Container5Vm.SName = "Container5";
Container6Vm.SName = "Container6";
Container7Vm.SName = "Container7";
Container8Vm.SName = "Container8";
Container9Vm.SName = "Container9";
}
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();
Container10Vm = new MediaContainerVm();
Container11Vm = new MediaContainerVm();
Container12Vm = new MediaContainerVm();
Container1Vm.SName = "Container1";
Container2Vm.SName = "Container2";
Container3Vm.SName = "Container3";
Container4Vm.SName = "Container4";
Container5Vm.SName = "Container5";
Container6Vm.SName = "Container6";
Container7Vm.SName = "Container7";
Container8Vm.SName = "Container8";
Container9Vm.SName = "Container9";
Container10Vm.SName = "Container10";
Container11Vm.SName = "Container11";
Container12Vm.SName = "Container12";
@@ -85,24 +101,26 @@ namespace InfineonHMI
}
}
public void Dispose()
{
public void Dispose()
{
Container1Vm.Dispose();
Container2Vm.Dispose();
Container3Vm.Dispose();
Container4Vm.Dispose();
Container5Vm.Dispose();
Container6Vm.Dispose();
Container7Vm.Dispose();
Container8Vm.Dispose();
Container9Vm.Dispose();
Container1Vm.Dispose();
Container2Vm.Dispose();
Container3Vm.Dispose();
Container4Vm.Dispose();
Container5Vm.Dispose();
Container6Vm.Dispose();
Container7Vm.Dispose();
Container8Vm.Dispose();
Container9Vm.Dispose();
Container10Vm.Dispose();
Container11Vm.Dispose();
Container12Vm.Dispose();
}
}
}
}

View File

@@ -5,55 +5,62 @@ using Heisig.HMI.AdsManager;
using CommunityToolkit.Mvvm.Input;
using TwinCAT.TypeSystem;
using System.Collections.ObjectModel;
using Common;
using InfineonHMI.Model;
namespace InfineonHMI
namespace InfineonHMI;
public sealed partial class NIOStationPageVM : ObservableValidator, IDisposable
{
public sealed partial class NIOStationPageVM : ObservableValidator, IDisposable
{
private readonly string? _variableName;
private readonly string? _variableName;
private readonly IAdsManager? _adsManager;
private readonly IAdsManager? _adsManager;
[ObservableProperty] private BinaryValveControlVM clampDiagValveVm;
[ObservableProperty] private BinaryValveControlVM clampDiagValveVm;
[ObservableProperty] private BinaryValveControlVM clampAcrossValveVm;
[ObservableProperty] private BinaryValveControlVM clampAcrossValveVm;
[ObservableProperty] private HMIControlButtonVM clampCmdButtonVm;
[ObservableProperty] private HMIControlButtonVM clampCmdButtonVm;
[ObservableProperty] private HMIControlButtonVM unclampCmdButtonVm;
[ObservableProperty] private HMIControlButtonVM unclampCmdButtonVm;
public NIOStationPageVM()
{
ClampDiagValveVm = new BinaryValveControlVM();
ClampAcrossValveVm = new BinaryValveControlVM();
ClampCmdButtonVm = new HMIControlButtonVM();
UnclampCmdButtonVm = new HMIControlButtonVM();
}
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");
[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 void Dispose()
{
ClampDiagValveVm.Dispose();
ClampAcrossValveVm.Dispose();
ClampCmdButtonVm.Dispose();
UnclampCmdButtonVm.Dispose();
}
}
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();
}
}
}

View File

@@ -6,6 +6,7 @@ using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using System.Windows;
using System.Windows.Controls;
using InfineonHMI.Common;
using TcEventLoggerAdsProxyLib;
namespace InfineonHMI;
@@ -23,6 +24,7 @@ public sealed partial class ProductionOverviewPageVM : ObservableObject, IRecipi
private readonly IConfiguration _config;
private readonly TcEventLogger _eventlogger;
private User currentUser;
// Last active event
[ObservableProperty] private string currentActiveEvent = "";
@@ -60,6 +62,7 @@ public sealed partial class ProductionOverviewPageVM : ObservableObject, IRecipi
public ProductionOverviewPageVM()
{
// default ctor
currentUser = Users.getCurrentUser();
}
public ProductionOverviewPageVM(IAdsManager adsManager, IConfiguration config, TcEventLogger eventLogger, NavigateMessage? message = null)
{
@@ -67,7 +70,7 @@ public sealed partial class ProductionOverviewPageVM : ObservableObject, IRecipi
_config = config;
// Create dummy string
DummyStringVM = new StringControlButtonVM();
currentUser = Users.getCurrentUser();
// Create empty page
_emptyPage = new();
@@ -209,7 +212,7 @@ public sealed partial class ProductionOverviewPageVM : ObservableObject, IRecipi
{
case nameof(TrayFeederPage):
if (_trayFeederPageVm == null)
_trayFeederPageVm = new(_adsManager, "GVL_CONFIG.stMachine");
_trayFeederPageVm = new(_adsManager, "GVL_SCADA.stMachine.TrayFeeder"); //In and Out ist set directly in ViewModel
TrayFeederPage trayFeederPage = new() { DataContext = _trayFeederPageVm };
CurrentDetailPage = trayFeederPage;
@@ -218,7 +221,7 @@ public sealed partial class ProductionOverviewPageVM : ObservableObject, IRecipi
case nameof(AlignmentStationPage):
// Create seetings page view model only once
if (_alignmentStationPageVM == null)
_alignmentStationPageVM = new(_adsManager, "GVL_CONFIG.stMachine.stAligner");
_alignmentStationPageVM = new(_adsManager, "GVL_SCADA.stMachine.stAligner");
AlignmentStationPage settingsPage = new() { DataContext = _alignmentStationPageVM };
CurrentDetailPage = settingsPage;
@@ -226,7 +229,7 @@ public sealed partial class ProductionOverviewPageVM : ObservableObject, IRecipi
case nameof(EtchingStation1Page):
if (_etchingStation1PageVm == null)
_etchingStation1PageVm = new(_adsManager, "GVL_CONFIG.stMachine.stEtcher1");
_etchingStation1PageVm = new(_adsManager, "GVL_SCADA.stMachine.stEtcher1");
EtchingStation1Page etchingStation1Page = new() { DataContext = _etchingStation1PageVm };
CurrentDetailPage = etchingStation1Page;
@@ -234,7 +237,7 @@ public sealed partial class ProductionOverviewPageVM : ObservableObject, IRecipi
case nameof(EtchingStation2Page):
if (_etchingStation2PageVm == null)
_etchingStation2PageVm = new(_adsManager, "GVL_CONFIG.stMachine.stEtcher2");
_etchingStation2PageVm = new(_adsManager, "GVL_SCADA.stMachine.stEtcher2");
EtchingStation2Page etchingStation2Page = new() { DataContext = _etchingStation2PageVm };
CurrentDetailPage = etchingStation2Page;
@@ -242,7 +245,7 @@ public sealed partial class ProductionOverviewPageVM : ObservableObject, IRecipi
case nameof(HighVoltageStationPage):
if (_highVoltageStationPageVm == null)
_highVoltageStationPageVm = new(_adsManager, "GVL_CONFIG.stMachine");
_highVoltageStationPageVm = new(_adsManager, "GVL_SCADA.stMachine.stHVTester"); // Hot/Cold is Set directly in VM
HighVoltageStationPage highVoltageStationPage = new() { DataContext = _highVoltageStationPageVm };
CurrentDetailPage = highVoltageStationPage;
@@ -250,7 +253,7 @@ public sealed partial class ProductionOverviewPageVM : ObservableObject, IRecipi
case nameof(HotCoolPlatePage):
if (_hotCoolplatePageVM == null)
_hotCoolplatePageVM = new(_adsManager, "GVL_Config.stMachine");
_hotCoolplatePageVM = new(_adsManager, "GVL_SCADA.stMachine"); //".stHotplate /.stCoolplate is set directly in VM
HotCoolPlatePage hotCoolPlatePage = new() {DataContext = _hotCoolplatePageVM };
CurrentDetailPage = hotCoolPlatePage;
@@ -258,7 +261,7 @@ public sealed partial class ProductionOverviewPageVM : ObservableObject, IRecipi
case nameof(NIOStationPage):
if (_nioStationPageVm == null)
_nioStationPageVm = new(_adsManager, "GVL_Config.stMachine.stNOK");
_nioStationPageVm = new(_adsManager, "GVL_SCADA.stMachine.stNOK");
NIOStationPage nIOStationPage = new() { DataContext = _nioStationPageVm };
CurrentDetailPage = nIOStationPage;
@@ -267,7 +270,7 @@ public sealed partial class ProductionOverviewPageVM : ObservableObject, IRecipi
case nameof(KukaRobotPage):
// Create page view model only once
if (_kukaRobotPageVM == null)
_kukaRobotPageVM = new(_adsManager, "GVL_CONFIG.stMachine.stKukaRobot");
_kukaRobotPageVM = new(_adsManager); // Variablenames are set directly in Viewmodel
KukaRobotPage kukaRobotPage = new() { DataContext = _kukaRobotPageVM };
CurrentDetailPage = kukaRobotPage;
@@ -275,7 +278,7 @@ public sealed partial class ProductionOverviewPageVM : ObservableObject, IRecipi
case nameof(MediaCabinetPage):
if (_mediaCabinetPageVM == null)
_mediaCabinetPageVM = new(_adsManager, "GVL_Config.stMachine");
_mediaCabinetPageVM = new(_adsManager, "GVL_SCADA.stMachine.stMediaCabinet"); //TODO not Implemented on PLC yet
MediaCabinetPage mediaCabinetPage = new() { DataContext= _mediaCabinetPageVM };
CurrentDetailPage = mediaCabinetPage;

View File

@@ -413,6 +413,13 @@ public sealed partial class ReceipePageVM : ObservableValidator, IDisposable
SendDataToPLC();
}
[RelayCommand]
public void LoadFromPlc()
{
//ReadDataFromPLC();
}
[RelayCommand]
public void ReadReceipeFile()
{
@@ -710,21 +717,21 @@ public sealed partial class ReceipePageVM : ObservableValidator, IDisposable
_adsManager.WriteValue("GVL_SCADA.stMachine", CameraProgramsVm.Value);
_adsManager.WriteValue("GVL_SCADA.stMachine", ChucksVm.Value);
_adsManager.WriteValue("GVL_SCADA.stMachine", GripperVm.Value);
_adsManager.WriteValue("GVL_SCADA.stMachine", PermissibleBeamParamDeviationsVm.Value);
_adsManager.WriteValue("GVL_SCADA.stMachine", DiameterVm.Value);
_adsManager.WriteValue("GVL_SCADA.stMachine", ThicknessVm.Value);
_adsManager.WriteValue("GVL_SCADA.stMachine", TimeIntervallBeamCheckVm.Value);
_adsManager.WriteValue("GVL_SCADA.stMachine.iCameraprograms", CameraProgramsVm.Value);
_adsManager.WriteValue("GVL_SCADA.stMachine.iChucks", ChucksVm.Value);
_adsManager.WriteValue("GVL_SCADA.stMachine.iGripper", GripperVm.Value);
_adsManager.WriteValue("GVL_SCADA.stMachine.rBeamDeviation", PermissibleBeamParamDeviationsVm.Value);
_adsManager.WriteValue("GVL_SCADA.stMachine.rDiameter", DiameterVm.Value);
_adsManager.WriteValue("GVL_SCADA.stMachine.rThickness", ThicknessVm.Value);
_adsManager.WriteValue("GVL_SCADA.stMachine.rTimeIntervalBeamCheck", TimeIntervallBeamCheckVm.Value);
_adsManager.WriteValue("GVL_SCADA.stMachine.stMasterRecipeHotplate.rRestingTime", RestingTimeHotplateVm.Value);
_adsManager.WriteValue("GVL_SCADA.stMachine.stMasterRecipeHotplate.rTemp", TargetTemperatureHotplateVm.Value);
_adsManager.WriteValue("GVL_SCADA.stMachine.stMasterRecipeCoolplate.rRestingTime", RestingTimeCoolplateVm.Value);
_adsManager.WriteValue("GVL_SCADA.stMachine.stMasterRecipeCoolplate.rTemp", TargetTemperatureCoolplateVm.Value);
_adsManager.WriteValue("GVL_SCADA.stMachine.stRecipeEtcher.uiNumRobotPos", NumberRobotPositionsVm.Value);
_adsManager.WriteValue("GVL_SCADA.stMachine.stRecipeEtcher.rRadialPosLowerWaterJet", RadialPosLowerWaterJetVm.Value);
_adsManager.WriteValue("GVL_SCADA.stMachine.stRecipeEtcher.rChuckRPM", ChuckRpmVm.Value);
_adsManager.WriteValue("GVL_SCADA.stMachine.stMasterRecipeEtcher.uiNumRobotPos", NumberRobotPositionsVm.Value);
_adsManager.WriteValue("GVL_SCADA.stMachine.stMasterRecipeEtcher.rRadialPosLowerWaterJet", RadialPosLowerWaterJetVm.Value);
_adsManager.WriteValue("GVL_SCADA.stMachine.stMasterRecipeEtcher.rChuckRPM", ChuckRpmVm.Value);
_adsManager.WriteValue("GVL_SCADA.stMachine.stMasterRecipeHVTest.rTestVoltage", HvtestVoltageVm.Value);
_adsManager.WriteValue("GVL_SCADA.stMachine.stMasterRecipeHVTest.rMaxTestCurrent", HvmaxTestCurrentVm.Value);
_adsManager.WriteValue("GVL_SCADA.stMachine.stMasterRecipeHVTest.rRampTime", HvrampTimeVm.Value);
@@ -739,6 +746,123 @@ public sealed partial class ReceipePageVM : ObservableValidator, IDisposable
}
//private void ReadDataFromPLC()
//{
// var val = _adsManager.ReadValue("GVL_Scheduler.MAX_RECIPE_NODES");
// maxFlowNodes = (val == null) ? 10 : (int)val; ;
// val = _adsManager.ReadValue("GVL_ETCHER.MAX_ROBOT_POS");
// maxEtcherRobotPositions = (val == null) ? 10 : (int)val;
// val = _adsManager.ReadValue("GVL_ETCHER.MAX_ROBOT_POS");
// maxTrayPositions = (val == null) ? 20 : (int)val;
// for (var i = 0; i < maxTrayPositions && i < TrayPositions.Count; i++)
// {
// TrayPositions[i].PosX = GetFloat(_adsManager.ReadValue("GVL_SCADA.stMachine.stTray.arPosX[" + i + "]"));
// TrayPositions[i].PosY = GetFloat(_adsManager.ReadValue("GVL_SCADA.stMachine.stTray.arPosY[" + i + "]"));
// }
// var trayPosCountToPlc = TrayPositions.Count < maxTrayPositions ? TrayPositions.Count : maxTrayPositions;
// _adsManager.WriteValue("GVL_SCADA.stMachine.stTray.iPosCnt", trayPosCountToPlc);
// for (var i = 0; i < maxEtcherRobotPositions && i < EtcherRobotSteps.Count; i++)
// {
// EtcherRobotSteps[i].PosX= GetFloat(_adsManager.ReadValue("GVL_SCADA.stRecipeEtcher.stRobotStepData[" + i + "].rPosX"));
// EtcherRobotSteps[i].PosY= GetFloat(_adsManager.ReadValue("GVL_SCADA.stRecipeEtcher.stRobotStepData[" + i + "].rPosY"));
// EtcherRobotSteps[i].PosZ= GetFloat(_adsManager.ReadValue("GVL_SCADA.stRecipeEtcher.stRobotStepData[" + i + "].rPosZ"));
// EtcherRobotSteps[i].AngleAlpha= GetFloat(_adsManager.ReadValue("GVL_SCADA.stRecipeEtcher.stRobotStepData[" + i + "].rAngleAlpha"));
// EtcherRobotSteps[i].MoveSpeed= GetFloat(_adsManager.ReadValue("GVL_SCADA.stRecipeEtcher.stRobotStepData[" + i + "].rMoveSpeed"));
// EtcherRobotSteps[i].Delay = GetFloat(_adsManager.ReadValue("GVL_SCADA.stRecipeEtcher.stRobotStepData[" + i + "].rDelay"));
// EtcherRobotSteps[i].Medium = GetUShort(_adsManager.ReadValue("GVL_SCADA.stRecipeEtcher.stRobotStepData[" + i + "].uiMedium"));
// EtcherRobotSteps[i].WaterFromBelow= GetShort(_adsManager.ReadValue("GVL_SCADA.stRecipeEtcher.stRobotStepData[" + i + "].xWaterFromBelow"));
// EtcherRobotSteps[i].WaterFromAbove = GetShort(_adsManager.ReadValue("GVL_SCADA.stRecipeEtcher.stRobotStepData[" + i + "].xWaterFromAbove"));
// GetFloat(_adsManager.ReadValue("GVL_SCADA.stRecipeEtcher.stRobotStepData[" + i + "].rPosX"));
// GetFloat(_adsManager.ReadValue("GVL_SCADA.stRecipeEtcher.stRobotStepData[" + i + "].rPosY"));
// GetFloat(_adsManager.ReadValue("GVL_SCADA.stRecipeEtcher.stRobotStepData[" + i + "].rPosZ"));
// GetFloat(_adsManager.ReadValue("GVL_SCADA.stRecipeEtcher.stRobotStepData[" + i + "].rAngleAlpha"));
// GetFloat(_adsManager.ReadValue("GVL_SCADA.stRecipeEtcher.stRobotStepData[" + i + "].rMoveSpeed"));
// GetFloat(_adsManager.ReadValue("GVL_SCADA.stRecipeEtcher.stRobotStepData[" + i + "].rDelay"));
// _adsManager.ReadValue("GVL_SCADA.stRecipeEtcher.stRobotStepData[" + i + "].uiMedium"));
// _adsManager.ReadValue("GVL_SCADA.stRecipeEtcher.stRobotStepData[" + i + "].xWaterFromBelow"));
// _adsManager.ReadValue("GVL_SCADA.stRecipeEtcher.stRobotStepData[" + i + "].xWaterFromAbove"));
// }
// for (var i = 0; (i < maxFlowNodes && i < FlowReceipeEntries.Count); i++)
// {
// _adsManager.WriteValue("GVL_SCADA.stMachine.stMasterFlowRecipe.astNodes[" + i + "].uiPriority", FlowReceipeEntries[i].Priority);
// _adsManager.WriteValue("GVL_SCADA.stMachine.stMasterFlowRecipe.astNodes[" + i + "].uiPriority", FlowReceipeEntries[i].Station.eStation);
// _adsManager.WriteValue("GVL_SCADA.stMachine.stMasterFlowRecipe.astNodes[" + i + "].uiPriority", FlowReceipeEntries[i].MaxRetries);
// _adsManager.WriteValue("GVL_SCADA.stMachine.stMasterFlowRecipe.astNodes[" + i + "].uiPriority", FlowReceipeEntries[i].NextNodeSuccess);
// _adsManager.WriteValue("GVL_SCADA.stMachine.stMasterFlowRecipe.astNodes[" + i + "].uiPriority", FlowReceipeEntries[i].NextNodeRetry);
// _adsManager.WriteValue("GVL_SCADA.stMachine.stMasterFlowRecipe.astNodes[" + i + "].uiPriority", FlowReceipeEntries[i].NextNodeFail);
// }
// _adsManager.WriteValue("GVL_SCADA.stMachine.stMasterFlowRecipe.uiNodeCnt", FlowNodeCountVm.Value);
// _adsManager.WriteValue("GVL_SCADA.stMachine", CameraProgramsVm.Value);
// _adsManager.WriteValue("GVL_SCADA.stMachine", ChucksVm.Value);
// _adsManager.WriteValue("GVL_SCADA.stMachine", GripperVm.Value);
// _adsManager.WriteValue("GVL_SCADA.stMachine", PermissibleBeamParamDeviationsVm.Value);
// _adsManager.WriteValue("GVL_SCADA.stMachine", DiameterVm.Value);
// _adsManager.WriteValue("GVL_SCADA.stMachine", ThicknessVm.Value);
// _adsManager.WriteValue("GVL_SCADA.stMachine", TimeIntervallBeamCheckVm.Value);
// _adsManager.WriteValue("GVL_SCADA.stMachine.stMasterRecipeHotplate.rRestingTime", RestingTimeHotplateVm.Value);
// _adsManager.WriteValue("GVL_SCADA.stMachine.stMasterRecipeHotplate.rTemp", TargetTemperatureHotplateVm.Value);
// _adsManager.WriteValue("GVL_SCADA.stMachine.stMasterRecipeCoolplate.rRestingTime", RestingTimeCoolplateVm.Value);
// _adsManager.WriteValue("GVL_SCADA.stMachine.stMasterRecipeCoolplate.rTemp", TargetTemperatureCoolplateVm.Value);
// _adsManager.WriteValue("GVL_SCADA.stMachine.stMasterRecipeEtcher.uiNumRobotPos", NumberRobotPositionsVm.Value);
// _adsManager.WriteValue("GVL_SCADA.stMachine.stMasterRecipeEtcher.rRadialPosLowerWaterJet", RadialPosLowerWaterJetVm.Value);
// _adsManager.WriteValue("GVL_SCADA.stMachine.stMasterRecipeEtcher.rChuckRPM", ChuckRpmVm.Value);
// _adsManager.WriteValue("GVL_SCADA.stMachine.stMasterRecipeHVTest.rTestVoltage", HvtestVoltageVm.Value);
// _adsManager.WriteValue("GVL_SCADA.stMachine.stMasterRecipeHVTest.rMaxTestCurrent", HvmaxTestCurrentVm.Value);
// _adsManager.WriteValue("GVL_SCADA.stMachine.stMasterRecipeHVTest.rRampTime", HvrampTimeVm.Value);
// _adsManager.WriteValue("GVL_SCADA.stMachine.stMasterRecipeHVTest.rTestFrequency", HvtestFrequencyVm.Value);
// _adsManager.WriteValue("GVL_SCADA.stMachine.stMasterRecipeHVTest.uiPolarity", HvpolarityVm.Value);
// _adsManager.WriteValue("GVL_SCADA.stMachine.stMasterRecipeHVTest.rTestPresN2", HvtestPressureN2Vm.Value);
// _adsManager.WriteValue("GVL_SCADA.stMachine.stMasterRecipeHVTest.rN2PrePurgeTime", Hvn2PrePurgeTimeVm.Value);
// _adsManager.WriteValue("GVL_SCADA.stMachine.stMasterRecipeHVTest.uiNumRetries", HvnumRetriesVm.Value);
// _adsManager.WriteValue("GVL_SCADA.stMachine.stMasterRecipeHVTest.rTestTemp", HvtestTemperatureVm.Value);
// _adsManager.WriteValue("GVL_SCADA.stMachine.stMasterRecipeHVTest.rTestOkVoltage", HvTestOkVoltageVm.Value);
// _adsManager.WriteValue("GVL_SCADA.stMachine.stMasterRecipeHVTest.rTestOkCurrent", HvTestOkCurrentVm.Value);
//}
//private short GetShort(object? value)
//{
// if (value != null)
// return (short)value;
// return -1;
//}
//private UInt16 GetUShort(object? value)
//{
// if (value != null)
// return (UInt16)value;
// return 0;
//}
private bool GetBool(object? value)
{
if (value != null)
return (bool)value;
return false;
}
private float GetFloat(object? value)
{
if (value != null)
return (float)value;
return -1;
}
public void Dispose()
{

View File

@@ -5,38 +5,48 @@ using Heisig.HMI.AdsManager;
using CommunityToolkit.Mvvm.Input;
using TwinCAT.TypeSystem;
using System.Collections.ObjectModel;
using Common;
using InfineonHMI.Model;
namespace InfineonHMI
namespace InfineonHMI;
public sealed partial class TrayFeederPageVM : ObservableValidator, IDisposable
{
public sealed partial class TrayFeederPageVM : ObservableValidator, IDisposable
{
private readonly string? _variableName;
private readonly string? _variableName;
private readonly IAdsManager? _adsManager;
private readonly IAdsManager? _adsManager;
public TrayFeederPageVM()
{
[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;
public TrayFeederPageVM(IAdsManager adsManager, string variableName)
{
_adsManager = adsManager;
_variableName = variableName;
}
TrayfeederInPackMLControlVm = new(_adsManager, _variableName + "In.stStationCmds");
TrayfeederOutPackMLControlVm = new(_adsManager, _variableName + "Out.stStationCmds");
TrayfeederInPackMLControlVm.STitle = "Trayfeeder IN";
TrayfeederOutPackMLControlVm.STitle = "Trayfeeder OUT";
}
public void Dispose()
{
public void Dispose()
{
}
}
}
}

View File

@@ -4,33 +4,41 @@
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" x:Class="InfineonHMI.AlignmentStationPage"
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="800" d:DesignWidth="1850"
d:DesignHeight="1554" d:DesignWidth="3390"
Title="AlignmentStationPage" FontSize="40">
<Grid>
<Grid Margin="20">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</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="Alignment Station" VerticalAlignment="Top" HorizontalAlignment="Left" />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<HMIToolkit:BinaryValveControl Grid.Column="0" Grid.Row="0" Grid.RowSpan="4" HorizontalAlignment="center" VerticalAlignment="Center" DataContext="{Binding Path=VacuumValveControlVm}"/>
<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>

View File

@@ -1,22 +1,21 @@
using System.Windows.Controls;
namespace InfineonHMI
{
/// <summary>
/// Interaktionslogik für AutomaticModePage.xaml
/// </summary>
public partial class AlignmentStationPage : Page
{
public AlignmentStationPage()
{
InitializeComponent();
// Unloaded += OnUnloaded;
}
namespace InfineonHMI;
private void OnUnloaded(object? sender, EventArgs e)
{
var disposable = DataContext as IDisposable;
disposable?.Dispose();
}
}
/// <summary>
/// Interaktionslogik für AutomaticModePage.xaml
/// </summary>
public partial class AlignmentStationPage : Page
{
public AlignmentStationPage()
{
InitializeComponent();
// Unloaded += OnUnloaded;
}
private void OnUnloaded(object? sender, EventArgs e)
{
var disposable = DataContext as IDisposable;
disposable?.Dispose();
}
}

View File

@@ -5,12 +5,13 @@
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="800" d:DesignWidth="1850"
d:DesignHeight="1554" d:DesignWidth="3390"
Title="EtchingStationPage">
<Grid>
<Grid Margin="20">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
@@ -32,18 +33,19 @@
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Label Grid.Row="0" Grid.Column="0" Content="Etching Station 1" VerticalAlignment="Top" HorizontalAlignment="Left" FontSize="35" />
<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="3" Grid.RowSpan="4" HorizontalAlignment="Center" VerticalAlignment="Center" DataContext="{Binding ChuckUnlockValveRightEtching1Vm}"/>
<hmiToolkit:BinaryValveControl Grid.Column="1" Grid.Row="3" Grid.RowSpan="4" HorizontalAlignment="Center" VerticalAlignment="Center" DataContext="{Binding ChuckEjectValveFrontEtching1Vm}"/>
<hmiToolkit:BinaryValveControl Grid.Column="2" Grid.Row="3" Grid.RowSpan="4" HorizontalAlignment="Center" VerticalAlignment="Center" DataContext="{Binding ChuckEjectValveBackEtching1Vm}"/>
<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}" HorizontalAlignment="Center" Width="320" Height="140" FontSize="30" />
<Button Grid.Row="2" Grid.Column="3" Content="Teller Verriegeln" DataContext="{Binding ChuckLockCmdButtonEtching1Vm}" HorizontalAlignment="Center" Width="320" Height="140" FontSize="30"/>
<Button Grid.Row="3" Grid.Column="3" Content="Teller Auswerfen" DataContext="{Binding ChuckEjectCmdButtonEtching1Vm}" 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>

View File

@@ -1,22 +1,21 @@
using System.Windows.Controls;
namespace InfineonHMI
{
/// <summary>
/// Interaktionslogik für AutomaticModePage.xaml
/// </summary>
public partial class EtchingStation1Page : Page
{
public EtchingStation1Page()
{
InitializeComponent();
// Unloaded += OnUnloaded;
}
namespace InfineonHMI;
private void OnUnloaded(object? sender, EventArgs e)
{
var disposable = DataContext as IDisposable;
disposable?.Dispose();
}
}
/// <summary>
/// Interaktionslogik für AutomaticModePage.xaml
/// </summary>
public partial class EtchingStation1Page : Page
{
public EtchingStation1Page()
{
InitializeComponent();
// Unloaded += OnUnloaded;
}
private void OnUnloaded(object? sender, EventArgs e)
{
var disposable = DataContext as IDisposable;
disposable?.Dispose();
}
}

View File

@@ -5,12 +5,13 @@
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="800" d:DesignWidth="1850"
d:DesignHeight="1554" d:DesignWidth="3390"
Title="EtchingStationPage">
<Grid>
<Grid Margin="20">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
@@ -32,17 +33,18 @@
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Label Grid.Row="0" Grid.Column="0" Content="Etching Station 2" VerticalAlignment="Top" HorizontalAlignment="Left" FontSize="35" />
<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="3" Grid.RowSpan="4" HorizontalAlignment="Center" VerticalAlignment="Center" DataContext="{Binding ChuckUnlockValveRightEtching2Vm}"/>
<hmiToolkit:BinaryValveControl Grid.Column="1" Grid.Row="3" Grid.RowSpan="4" HorizontalAlignment="Center" VerticalAlignment="Center" DataContext="{Binding ChuckEjectValveFrontEtching2Vm}"/>
<hmiToolkit:BinaryValveControl Grid.Column="2" Grid.Row="3" Grid.RowSpan="4" HorizontalAlignment="Center" VerticalAlignment="Center" DataContext="{Binding ChuckEjectValveBackEtching2Vm}"/>
<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}" HorizontalAlignment="Center" Width="320" Height="140" FontSize="30"/>
<Button Grid.Row="2" Grid.Column="3" Content="Teller Verriegeln" DataContext="{Binding ChuckLockCmdButtonEtching2Vm}" HorizontalAlignment="Center" Width="320" Height="140" FontSize="30"/>
<Button Grid.Row="3" Grid.Column="3" Content="Teller Auswerfen" DataContext="{Binding ChuckEjectCmdButtonEtching2Vm}" 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>

View File

@@ -1,22 +1,21 @@
using System.Windows.Controls;
namespace InfineonHMI
{
/// <summary>
/// Interaktionslogik für AutomaticModePage.xaml
/// </summary>
public partial class EtchingStation2Page : Page
{
public EtchingStation2Page()
{
InitializeComponent();
// Unloaded += OnUnloaded;
}
namespace InfineonHMI;
private void OnUnloaded(object? sender, EventArgs e)
{
var disposable = DataContext as IDisposable;
disposable?.Dispose();
}
}
/// <summary>
/// Interaktionslogik für AutomaticModePage.xaml
/// </summary>
public partial class EtchingStation2Page : Page
{
public EtchingStation2Page()
{
InitializeComponent();
// Unloaded += OnUnloaded;
}
private void OnUnloaded(object? sender, EventArgs e)
{
var disposable = DataContext as IDisposable;
disposable?.Dispose();
}
}

View File

@@ -5,24 +5,28 @@
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:HighVoltageStationPageVM, IsDesignTimeCreatable=True}"
d:DesignHeight="800" d:DesignWidth="1850"
d:DesignHeight="1554" d:DesignWidth="3390"
Title="High Voltage Test Station">
<Grid>
<Grid Margin="20">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition Width="Auto"/>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
@@ -30,23 +34,26 @@
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Label Grid.Row="0" Grid.Column="0" Content="Hochvolt Test Station Heiß" VerticalAlignment="Center" HorizontalAlignment="Left" FontSize="35"/>
<Label Grid.Row="0" Grid.Column="3" Content="Hochvolt Test Station Kalt" VerticalAlignment="Center" HorizontalAlignment="Left" FontSize="35"/>
<Border Grid.Row="0" Grid.Column="2" Grid.RowSpan="9" BorderBrush="White" BorderThickness="0,0,1,0"></Border>
<Border Grid.Row="0" Grid.Column="3" Grid.RowSpan="9" BorderBrush="White" BorderThickness="1,0,0,0"></Border>
<Label Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Content="Hochvolt Test Stationen" VerticalAlignment="Top" HorizontalAlignment="Left" FontSize="40" />
<hmiToolkit:BinaryValveControl Grid.Column="0" Grid.Row="1" Grid.RowSpan="4" HorizontalAlignment="Center" VerticalAlignment="Center" DataContext="{Binding DoorValveHotControlVm }"/>
<hmiToolkit:BinaryValveControl Grid.Column="3" Grid.Row="1" Grid.RowSpan="4" HorizontalAlignment="Center" VerticalAlignment="Center" DataContext="{Binding DoorValveColdControlVm }"/>
<hmiToolkit:BinaryValveControl Grid.Column="1" Grid.Row="1" Grid.RowSpan="4" HorizontalAlignment="Center" VerticalAlignment="Center" DataContext="{Binding TestChamberHotValveVm }"/>
<hmiToolkit:BinaryValveControl Grid.Column="4" Grid.Row="1" Grid.RowSpan="4" HorizontalAlignment="Center" VerticalAlignment="Center" DataContext="{Binding TestChamberColdValveVm }"/>
<Label Grid.Row="0" Grid.Column="0" Content="Hochvolt Test Station Heiß" VerticalAlignment="Center" HorizontalAlignment="Left" FontSize="30"/>
<Label Grid.Row="0" Grid.Column="5" Content="Hochvolt Test Station Kalt" VerticalAlignment="Center" HorizontalAlignment="Left" FontSize="30"/>
<Border Grid.Row="0" Grid.Column="4" Grid.RowSpan="9" BorderBrush="White" BorderThickness="2,0,0,0" Margin="20 0 20 0 "/> <!--<Border Grid.Row="0" Grid.Column="4" Grid.RowSpan="9" BorderBrush="White" BorderThickness="1,0,0,0"></Border>-->
<hmiToolkit:BinaryValveControl Grid.Column="0" Grid.Row="2" Margin="10" Grid.RowSpan="4" VerticalAlignment="Center" DataContext="{Binding DoorValveHotControlVm }"/>
<hmiToolkit:BinaryValveControl Grid.Column="1" Grid.Row="2" Margin="10" Grid.RowSpan="4" VerticalAlignment="Center" DataContext="{Binding TestChamberHotValveVm }"/>
<hmiToolkit:BinaryValveControl Grid.Column="5" Grid.Row="2" Margin="10" Grid.RowSpan="4" VerticalAlignment="Center" DataContext="{Binding DoorValveColdControlVm }"/>
<hmiToolkit:BinaryValveControl Grid.Column="6" Grid.Row="2" Margin="10" Grid.RowSpan="4" VerticalAlignment="Center" DataContext="{Binding TestChamberColdValveVm }"/>
<Label Grid.Column="0" Grid.Row="1" FontSize="40" Content="Solltemperatur" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="5"/>
<hmiToolkit:AnalogValue Grid.Column="1" Grid.Row="1" Height="60" Width="260" HorizontalAlignment="Left" Margin="5" VerticalAlignment="Center" DataContext="{Binding TempSPHotVm}"/>
<Label Grid.Column="5" Grid.Row="1" FontSize="40" Content="Solltemperatur" VerticalAlignment="Center" Margin="5"/>
<hmiToolkit:AnalogValue Grid.Column="6" Grid.Row="1" Height="60" Width="260" Margin="5" HorizontalAlignment="Left" VerticalAlignment="Center" DataContext="{Binding TempSPColdVm}"/>
<Label Grid.Column="2" Grid.Row="1" FontSize="40" Content="Solltemperatur" HorizontalAlignment="left" Margin="5"/>
<hmiToolkit:AnalogValue Grid.Column="2" Grid.Row="1" Height="60" Width="260" HorizontalAlignment="Left" Margin="60" VerticalAlignment="Center" DataContext="{Binding TempSPHotVm}"/>
<Label Grid.Column="5" Grid.Row="1" FontSize="40" Content="Solltemperatur" Margin="5"/>
<hmiToolkit:AnalogValue Grid.Column="5" Grid.Row="1" Height="60" Width="260" Margin="60" HorizontalAlignment="Left" VerticalAlignment="Center" DataContext="{Binding TempSPColdVm}"/>
<common:PackMLControl Grid.Row="0" Grid.Column="2" Grid.ColumnSpan="2" HorizontalAlignment="Right" Grid.RowSpan="6" Width="Auto" Margin="20" DataContext="{Binding HighVoltageHotPackMLControlVm}"/>
<common:PackMLControl Grid.Row="0" Grid.Column="7" Grid.ColumnSpan="2" HorizontalAlignment="Right" Grid.RowSpan="6" Width="Auto" Margin="20" DataContext="{Binding HighVoltageColdPackMLControlVm}"/>
</Grid>
</Grid>
</Page>

View File

@@ -1,22 +1,21 @@
using System.Windows.Controls;
namespace InfineonHMI
{
/// <summary>
/// Interaktionslogik für AutomaticModePage.xaml
/// </summary>
public partial class HighVoltageStationPage : Page
{
public HighVoltageStationPage()
{
InitializeComponent();
// Unloaded += OnUnloaded;
}
namespace InfineonHMI;
private void OnUnloaded(object? sender, EventArgs e)
{
var disposable = DataContext as IDisposable;
disposable?.Dispose();
}
}
/// <summary>
/// Interaktionslogik für AutomaticModePage.xaml
/// </summary>
public partial class HighVoltageStationPage : Page
{
public HighVoltageStationPage()
{
InitializeComponent();
// Unloaded += OnUnloaded;
}
private void OnUnloaded(object? sender, EventArgs e)
{
var disposable = DataContext as IDisposable;
disposable?.Dispose();
}
}

View File

@@ -4,18 +4,22 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:InfineonHMI"
xmlns:common="clr-namespace:Common"
mc:Ignorable="d"
d:DataContext="{d:DesignInstance Type=local:HotCoolPlatePageVM, IsDesignTimeCreatable=True}"
d:DesignHeight="800" d:DesignWidth="1850"
d:DesignHeight="1554" d:DesignWidth="3390"
Title="HotCoolPlatePage">
<Grid>
<Grid Margin="20">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
@@ -31,31 +35,33 @@
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Border Grid.Row="0" Grid.RowSpan="9" Grid.Column="4" BorderBrush="WhiteSmoke" BorderThickness="2,0,0,0" />
<Border Grid.Row="0" Grid.RowSpan="9" Grid.Column="3" BorderBrush="WhiteSmoke" BorderThickness="0,0,2,0" />
<Label Grid.Row="0" Grid.Column="0" FontSize="35" Content="Heizplatte" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10"/>
<Label Grid.Row="0" Grid.Column="4" FontSize="35" Content="Kühlplatte" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10"/>
<Border Grid.Row="0" Grid.RowSpan="9" Grid.Column="5" BorderBrush="WhiteSmoke" BorderThickness="2,0,0,0" />
<Label Grid.Row="0" Grid.Column="0" FontSize="35" Content="Heizplatte" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10"/>
<Label Grid.Row="0" Grid.Column="6" FontSize="35" Content="Kühlplatte" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10"/>
<Button Grid.Row="0" Grid.Column="1" Content="Einschalten" DataContext="{Binding EnableHotPlateButtonVm}" HorizontalAlignment="Center" Width="280" Height="100" FontSize="35" />
<Button Grid.Row="0" Grid.Column="2" Content="Ausschalten" DataContext="{Binding DisableHotPlateButtonVm}" HorizontalAlignment="Center" Width="280" Height="100" FontSize="35" />
<Button Grid.Row="0" Grid.Column="5" Content="Einschalten" DataContext="{Binding EnableCoolPlateButtonVm}" HorizontalAlignment="Center" Width="280" Height="100" FontSize="35" />
<Button Grid.Row="0" Grid.Column="6" Content="Ausschalten" DataContext="{Binding DisableCoolPlateButtonVm}" HorizontalAlignment="Center" Width="280" Height="100" FontSize="35" />
<Button Grid.Row="0" Grid.Column="7" Content="Einschalten" DataContext="{Binding EnableCoolPlateButtonVm}" HorizontalAlignment="Center" Width="280" Height="100" FontSize="35" />
<Button Grid.Row="0" Grid.Column="8" Content="Ausschalten" DataContext="{Binding DisableCoolPlateButtonVm}" HorizontalAlignment="Center" Width="280" Height="100" FontSize="35" />
<common:PackMLControl Grid.Row="0" Grid.Column="3" Grid.ColumnSpan="2" HorizontalAlignment="Right" Grid.RowSpan="6" Width="Auto" Margin="20" DataContext="{Binding HotplatePackMLControlVm}"/>
<common:PackMLControl Grid.Row="0" Grid.Column="9" Grid.ColumnSpan="2" HorizontalAlignment="Right" Grid.RowSpan="6" Width="Auto" Margin="20" DataContext="{Binding CoolplatePackMLControlVm}"/>
<Label Grid.Row="2" Grid.Column="0" FontSize="35" Content="Belegung:" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10" />
<Label Grid.Row="2" Grid.Column="4" FontSize="35" Content="Belegung:" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10" />
<Label Grid.Row="2" Grid.Column="0" FontSize="35" Content="Belegung:" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10" />
<Label Grid.Row="2" Grid.Column="6" FontSize="35" Content="Belegung:" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10" />
<Label Grid.Row="1" Grid.Column="1" FontSize="40" Content="Temperatur Soll" VerticalAlignment="Top" HorizontalAlignment="Center"/>
<Label Grid.Row="1" Grid.Column="1" Content="Temperatur Soll" VerticalAlignment="Top" HorizontalAlignment="Center" FontSize="35"/>
<HMIToolkit:AnalogValue Grid.Column="1" Grid.Row="1" Height="80" Width="160" HorizontalAlignment="Center" VerticalAlignment="Center" DataContext="{Binding HotPlateTargetTemperature}"/>
<Label Grid.Row="1" Grid.Column="2" Content="Temperatur Ist" VerticalAlignment="Top" HorizontalAlignment="Center" FontSize="40" />
<Label Grid.Row="1" Grid.Column="2" Content="Temperatur Ist" VerticalAlignment="Top" HorizontalAlignment="Center" FontSize="35" />
<HMIToolkit:AnalogValue Grid.Column="2" Grid.Row="1" Height="80" Width="160" HorizontalAlignment="Center" VerticalAlignment="Center" DataContext="{Binding HotPlateActualTemperature}"/>
<Label Grid.Row="1" Grid.Column="5" Content="Temperatur Soll" VerticalAlignment="Top" HorizontalAlignment="Center" FontSize="40"/>
<HMIToolkit:AnalogValue Grid.Column="5" Grid.Row="1" Height="80" Width="160" HorizontalAlignment="Center" VerticalAlignment="Center" DataContext="{Binding CoolPlateTargetTemperature}"/>
<Label Grid.Row="1" Grid.Column="6" Content="Temperatur Ist" VerticalAlignment="Top" HorizontalAlignment="Center" FontSize="40"/>
<HMIToolkit:AnalogValue Grid.Column="6" Grid.Row="1" Height="80" Width="160" HorizontalAlignment="Center" VerticalAlignment="Center" DataContext="{Binding CoolPlateActualTemperature}"/>
<Label Grid.Row="1" Grid.Column="7" Content="Temperatur Soll" VerticalAlignment="Top" HorizontalAlignment="Center" FontSize="35"/>
<HMIToolkit:AnalogValue Grid.Column="7" Grid.Row="1" Height="80" Width="160" HorizontalAlignment="Center" VerticalAlignment="Center" DataContext="{Binding CoolPlateTargetTemperature}"/>
<Label Grid.Row="1" Grid.Column="8" Content="Temperatur Ist" VerticalAlignment="Top" HorizontalAlignment="Center" FontSize="35"/>
<HMIToolkit:AnalogValue Grid.Column="8" Grid.Row="1" Height="80" Width="160" HorizontalAlignment="Center" VerticalAlignment="Center" DataContext="{Binding CoolPlateActualTemperature}"/>
<Ellipse Grid.Column="0" Grid.Row="2" Grid.RowSpan="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Height="150" Margin="10" Stroke="WhiteSmoke" Fill="WhiteSmoke" VerticalAlignment="Center" Width="150"/>
<Ellipse Grid.Column="1" Grid.Row="2" Grid.RowSpan="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Height="150" Margin="10" Stroke="WhiteSmoke" Fill="WhiteSmoke" VerticalAlignment="Center" Width="150"/>
<Ellipse Grid.Column="2" Grid.Row="2" Grid.RowSpan="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Height="150" Margin="10" Stroke="WhiteSmoke" Fill="WhiteSmoke" VerticalAlignment="Center" Width="150"/>
@@ -75,24 +81,24 @@
<Ellipse Grid.Column="1" Grid.Row="6" Grid.RowSpan="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Height="120" Margin="10" Stroke="WhiteSmoke" Fill="Gray" Visibility="{Binding HotPlateVisibility8}" VerticalAlignment="Center" Width="120"/>
<Ellipse Grid.Column="2" Grid.Row="6" Grid.RowSpan="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Height="120" Margin="10" Stroke="WhiteSmoke" Fill="Gray" Visibility="{Binding HotPlateVisibility9}" VerticalAlignment="Center" Width="120"/>
<Ellipse Grid.Column="4" Grid.Row="2" Grid.RowSpan="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Height="150" Margin="10" Stroke="WhiteSmoke" Fill="WhiteSmoke" VerticalAlignment="Center" Width="150"/>
<Ellipse Grid.Column="5" Grid.Row="2" Grid.RowSpan="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Height="150" Margin="10" Stroke="WhiteSmoke" Fill="WhiteSmoke" VerticalAlignment="Center" Width="150"/>
<Ellipse Grid.Column="6" Grid.Row="2" Grid.RowSpan="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Height="150" Margin="10" Stroke="WhiteSmoke" Fill="WhiteSmoke" VerticalAlignment="Center" Width="150"/>
<Ellipse Grid.Column="4" Grid.Row="4" Grid.RowSpan="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Height="150" Margin="10" Stroke="WhiteSmoke" Fill="WhiteSmoke" VerticalAlignment="Center" Width="150"/>
<Ellipse Grid.Column="5" Grid.Row="4" Grid.RowSpan="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Height="150" Margin="10" Stroke="WhiteSmoke" Fill="WhiteSmoke" VerticalAlignment="Center" Width="150"/>
<Ellipse Grid.Column="7" Grid.Row="2" Grid.RowSpan="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Height="150" Margin="10" Stroke="WhiteSmoke" Fill="WhiteSmoke" VerticalAlignment="Center" Width="150"/>
<Ellipse Grid.Column="8" Grid.Row="2" Grid.RowSpan="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Height="150" Margin="10" Stroke="WhiteSmoke" Fill="WhiteSmoke" VerticalAlignment="Center" Width="150"/>
<Ellipse Grid.Column="6" Grid.Row="4" Grid.RowSpan="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Height="150" Margin="10" Stroke="WhiteSmoke" Fill="WhiteSmoke" VerticalAlignment="Center" Width="150"/>
<Ellipse Grid.Column="4" Grid.Row="6" Grid.RowSpan="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Height="150" Margin="10" Stroke="WhiteSmoke" Fill="WhiteSmoke" VerticalAlignment="Center" Width="150"/>
<Ellipse Grid.Column="5" Grid.Row="6" Grid.RowSpan="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Height="150" Margin="10" Stroke="WhiteSmoke" Fill="WhiteSmoke" VerticalAlignment="Center" Width="150"/>
<Ellipse Grid.Column="7" Grid.Row="4" Grid.RowSpan="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Height="150" Margin="10" Stroke="WhiteSmoke" Fill="WhiteSmoke" VerticalAlignment="Center" Width="150"/>
<Ellipse Grid.Column="8" Grid.Row="4" Grid.RowSpan="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Height="150" Margin="10" Stroke="WhiteSmoke" Fill="WhiteSmoke" VerticalAlignment="Center" Width="150"/>
<Ellipse Grid.Column="6" Grid.Row="6" Grid.RowSpan="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Height="150" Margin="10" Stroke="WhiteSmoke" Fill="WhiteSmoke" VerticalAlignment="Center" Width="150"/>
<Ellipse Grid.Column="4" Grid.Row="2" Grid.RowSpan="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Height="120" Margin="10" Stroke="WhiteSmoke" Fill="Gray" Visibility="{Binding CoolPlateVisibility1}" VerticalAlignment="Center" Width="120"/>
<Ellipse Grid.Column="5" Grid.Row="2" Grid.RowSpan="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Height="120" Margin="10" Stroke="WhiteSmoke" Fill="Gray" Visibility="{Binding CoolPlateVisibility2}" VerticalAlignment="Center" Width="120"/>
<Ellipse Grid.Column="6" Grid.Row="2" Grid.RowSpan="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Height="120" Margin="10" Stroke="WhiteSmoke" Fill="Gray" Visibility="{Binding CoolPlateVisibility3}" VerticalAlignment="Center" Width="120"/>
<Ellipse Grid.Column="4" Grid.Row="4" Grid.RowSpan="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Height="120" Margin="10" Stroke="WhiteSmoke" Fill="Gray" Visibility="{Binding CoolPlateVisibility4}" VerticalAlignment="Center" Width="120"/>
<Ellipse Grid.Column="5" Grid.Row="4" Grid.RowSpan="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Height="120" Margin="10" Stroke="WhiteSmoke" Fill="Gray" Visibility="{Binding CoolPlateVisibility5}" VerticalAlignment="Center" Width="120"/>
<Ellipse Grid.Column="6" Grid.Row="4" Grid.RowSpan="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Height="120" Margin="10" Stroke="WhiteSmoke" Fill="Gray" Visibility="{Binding CoolPlateVisibility6}" VerticalAlignment="Center" Width="120"/>
<Ellipse Grid.Column="4" Grid.Row="6" Grid.RowSpan="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Height="120" Margin="10" Stroke="WhiteSmoke" Fill="Gray" Visibility="{Binding CoolPlateVisibility7}" VerticalAlignment="Center" Width="120"/>
<Ellipse Grid.Column="5" Grid.Row="6" Grid.RowSpan="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Height="120" Margin="10" Stroke="WhiteSmoke" Fill="Gray" Visibility="{Binding CoolPlateVisibility8}" VerticalAlignment="Center" Width="120"/>
<Ellipse Grid.Column="6" Grid.Row="6" Grid.RowSpan="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Height="120" Margin="10" Stroke="WhiteSmoke" Fill="Gray" Visibility="{Binding CoolPlateVisibility9}" VerticalAlignment="Center" Width="120"/>
<Ellipse Grid.Column="7" Grid.Row="6" Grid.RowSpan="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Height="150" Margin="10" Stroke="WhiteSmoke" Fill="WhiteSmoke" VerticalAlignment="Center" Width="150"/>
<Ellipse Grid.Column="8" Grid.Row="6" Grid.RowSpan="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Height="150" Margin="10" Stroke="WhiteSmoke" Fill="WhiteSmoke" VerticalAlignment="Center" Width="150"/>
<Ellipse Grid.Column="6" Grid.Row="2" Grid.RowSpan="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Height="120" Margin="10" Stroke="WhiteSmoke" Fill="Gray" Visibility="{Binding CoolPlateVisibility1}" VerticalAlignment="Center" Width="120"/>
<Ellipse Grid.Column="7" Grid.Row="2" Grid.RowSpan="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Height="120" Margin="10" Stroke="WhiteSmoke" Fill="Gray" Visibility="{Binding CoolPlateVisibility2}" VerticalAlignment="Center" Width="120"/>
<Ellipse Grid.Column="8" Grid.Row="2" Grid.RowSpan="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Height="120" Margin="10" Stroke="WhiteSmoke" Fill="Gray" Visibility="{Binding CoolPlateVisibility3}" VerticalAlignment="Center" Width="120"/>
<Ellipse Grid.Column="6" Grid.Row="4" Grid.RowSpan="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Height="120" Margin="10" Stroke="WhiteSmoke" Fill="Gray" Visibility="{Binding CoolPlateVisibility4}" VerticalAlignment="Center" Width="120"/>
<Ellipse Grid.Column="7" Grid.Row="4" Grid.RowSpan="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Height="120" Margin="10" Stroke="WhiteSmoke" Fill="Gray" Visibility="{Binding CoolPlateVisibility5}" VerticalAlignment="Center" Width="120"/>
<Ellipse Grid.Column="8" Grid.Row="4" Grid.RowSpan="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Height="120" Margin="10" Stroke="WhiteSmoke" Fill="Gray" Visibility="{Binding CoolPlateVisibility6}" VerticalAlignment="Center" Width="120"/>
<Ellipse Grid.Column="6" Grid.Row="6" Grid.RowSpan="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Height="120" Margin="10" Stroke="WhiteSmoke" Fill="Gray" Visibility="{Binding CoolPlateVisibility7}" VerticalAlignment="Center" Width="120"/>
<Ellipse Grid.Column="7" Grid.Row="6" Grid.RowSpan="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Height="120" Margin="10" Stroke="WhiteSmoke" Fill="Gray" Visibility="{Binding CoolPlateVisibility8}" VerticalAlignment="Center" Width="120"/>
<Ellipse Grid.Column="8" Grid.Row="6" Grid.RowSpan="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Height="120" Margin="10" Stroke="WhiteSmoke" Fill="Gray" Visibility="{Binding CoolPlateVisibility9}" VerticalAlignment="Center" Width="120"/>

View File

@@ -1,22 +1,21 @@
using System.Windows.Controls;
namespace InfineonHMI
{
/// <summary>
/// Interaktionslogik für AutomaticModePage.xaml
/// </summary>
public partial class HotCoolPlatePage : Page
{
public HotCoolPlatePage()
{
InitializeComponent();
// Unloaded += OnUnloaded;
}
namespace InfineonHMI;
private void OnUnloaded(object? sender, EventArgs e)
{
var disposable = DataContext as IDisposable;
disposable?.Dispose();
}
}
/// <summary>
/// Interaktionslogik für AutomaticModePage.xaml
/// </summary>
public partial class HotCoolPlatePage : Page
{
public HotCoolPlatePage()
{
InitializeComponent();
// Unloaded += OnUnloaded;
}
private void OnUnloaded(object? sender, EventArgs e)
{
var disposable = DataContext as IDisposable;
disposable?.Dispose();
}
}

View File

@@ -4,166 +4,202 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:InfineonHMI"
xmlns:common="clr-namespace:Common"
mc:Ignorable="d"
d:DataContext="{d:DesignInstance Type=local:KukaRobotPageVM, IsDesignTimeCreatable=True}"
d:DesignHeight="800" d:DesignWidth="1850"
d:DesignHeight="1600" d:DesignWidth="3800"
Title="KukaRobotPage">
<Page.Resources>
<Style x:Name="RobotLabelStyle" x:Key="RobotLabelStyle" TargetType="Label">
<Setter Property="FontSize" Value="40"/>
<Setter Property="Margin" Value="5"/>
</Style>
<Style x:Key="RobotComboStyle" TargetType="ComboBox" BasedOn="{StaticResource MahApps.Styles.ComboBox}">
<Setter Property="FontSize" Value="40"/>
<Setter Property="Margin" Value="10"/>
<Setter Property="Height" Value="120"/>
</Style>
<Style x:Key="RobotTextBoxStyle" TargetType="TextBox" BasedOn="{StaticResource MahApps.Styles.TextBox}">
<Setter Property="FontSize" Value="40"/>
<Setter Property="Margin" Value="10"/>
<Setter Property="Height" Value="120"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="TextAlignment" Value="Right"/>
<Setter Property="MaxLines" Value="1"/>
</Style>
</Page.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition Width="750"/>
<ColumnDefinition Width="40" />
<ColumnDefinition Width="500"/>
<ColumnDefinition Width="40"/>
<ColumnDefinition Width="500"/>
<ColumnDefinition Width="40"/>
<ColumnDefinition Width="400"/>
<ColumnDefinition Width="360"/>
<ColumnDefinition Width="320"/>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition Height="250"/>
<RowDefinition Height="250"/>
<RowDefinition Height="250"/>
<RowDefinition Height="250"/>
<RowDefinition Height="250"/>
<RowDefinition Height="250"/>
<RowDefinition Height="50"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Border Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" BorderBrush="WhiteSmoke" BorderThickness="4,4,1,4" Margin="5,5,0,5"/>
<Border Grid.Row="0" Grid.Column="2" Grid.ColumnSpan="2" BorderBrush="WhiteSmoke" BorderThickness="1,4,1,4" Margin="0,5,0,5"/>
<Border Grid.Row="0" Grid.Column="4" Grid.ColumnSpan="2" BorderBrush="WhiteSmoke" BorderThickness="1,4,1,4" Margin="0,5,0,5"/>
<Border Grid.Row="0" Grid.Column="6" Grid.ColumnSpan="2" BorderBrush="WhiteSmoke" BorderThickness="1,4,4,4" Margin="0,5,5,5"/>
<StackPanel Grid.Row="0" Grid.Column="0">
<Label Content="Roboter Jobnummer" Style="{StaticResource RobotLabelStyle}"/>
<ComboBox IsEnabled="{Binding CanChangeRobotJob}" ItemsSource="{Binding RobotJobs}" SelectedItem="{Binding SelectedRobotJob}" Style="{StaticResource RobotComboStyle}"/>
</StackPanel>
<Label Grid.Row="0" Grid.Column="0" Content="Roboter Jobnummer" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10,0,0,0" />
<ComboBox Grid.Row="0" Grid.Column="1" Margin="10,15" IsEnabled="{Binding CanChangeRobotJob}" ItemsSource="{Binding RobotJobs}" SelectedItem="{Binding SelectedRobotJob}"/>
<Label Grid.Row="0" Grid.Column="2" Content="Roboter aktiver Job " VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10,0,0,0" />
<ComboBox Grid.Row="0" Grid.Column="3" Margin="10,15" ItemsSource="{Binding RobotJobs}" SelectedItem="{Binding RobotJobActiveValue}" IsReadOnly="True" IsEnabled="False" />
<ComboBox Grid.Row="0" Grid.Column="5" Margin="10,15" ItemsSource="{Binding RobotJobs}" SelectedItem="{Binding RobotJobFinishedValue}" IsReadOnly="True" IsEnabled="False"/>
<Label Grid.Row="0" Grid.Column="4" Content="Roboter Job fertig " VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10,0,0,0" />
<StackPanel Grid.Row="0" Grid.Column="2">
<Label Content="Roboter aktiver Job " Style="{StaticResource RobotLabelStyle}"/>
<ComboBox ItemsSource="{Binding RobotJobs}" SelectedItem="{Binding RobotJobActiveValue}" IsReadOnly="True" IsEnabled="False" Style="{StaticResource RobotComboStyle}"/>
</StackPanel>
<Button Grid.Row="0" Grid.Column="6" Command="{Binding StartRobotJobCommand}" Content="Start" Margin="10,15,10,15" />
<Button Grid.Row="0" Grid.Column="7" Command="{Binding AbortRobotJobCommand}" Content="Abbruch" Margin="10,15,15,15" />
<StackPanel Grid.Row="0" Grid.Column="4">
<Label Content="Roboter Job fertig " Style="{StaticResource RobotLabelStyle}"/>
<ComboBox ItemsSource="{Binding RobotJobs}" SelectedItem="{Binding RobotJobFinishedValue}" IsReadOnly="True" IsEnabled="False" Style="{StaticResource RobotComboStyle}"/>
</StackPanel>
<StackPanel Grid.Row="0" Grid.Column="6" Grid.RowSpan="2">
<Label Content="Roboter Job" Style="{StaticResource RobotLabelStyle}"/>
<Button Height="120" Command="{Binding StartRobotJobCommand}" Content="Start" Margin="10" FontSize="30"/>
<Button Height="120" Command="{Binding AbortRobotJobCommand}" Content="Abbruch" Margin="10" FontSize="30" />
</StackPanel>
<StackPanel Grid.Row="1" Grid.Column="0">
<Label Content="Greiferseite für Job:" Style="{StaticResource RobotLabelStyle}"/>
<TextBox IsEnabled="{Binding CanChangeJobGrippSide}" Text="{Binding JobGrippSide}" Style="{StaticResource RobotTextBoxStyle}"/>
</StackPanel>
<StackPanel Grid.Row="1" Grid.Column="2">
<Label FontSize="40" Content="Greifertyp:" Style="{StaticResource RobotLabelStyle}"/>
<TextBox IsEnabled="{Binding CanChangeJobGrippType}" Text="{Binding JobGrippType}" Style="{StaticResource RobotTextBoxStyle}"/>
</StackPanel>
<StackPanel Grid.Row="1" Grid.Column="4">
<Label Content="Drehteller Magazinplatz:" Style="{StaticResource RobotLabelStyle}"/>
<TextBox IsEnabled="{Binding CanChangeChuckMagazinPlace}" Text="{Binding ChuckMagazinPlace}" Style="{StaticResource RobotTextBoxStyle}"/>
</StackPanel>
<StackPanel Grid.Row="2" Grid.Column="0">
<Label Content="Teiledicke in mm: " Style="{StaticResource RobotLabelStyle}"/>
<TextBox IsEnabled="{Binding CanChangePieceThickness}" Text="{Binding PieceThickness}" Style="{StaticResource RobotTextBoxStyle}"/>
</StackPanel>
<StackPanel Grid.Row="3" Grid.Column="0">
<Label Content="Angefragter Sps Job :" Style="{StaticResource RobotLabelStyle}"/>
<ComboBox ItemsSource="{Binding PLCJobs}" SelectedItem="{Binding SelectedPLCJob}" IsReadOnly="True" IsEnabled="False" Style="{StaticResource RobotComboStyle}"/>
</StackPanel>
<StackPanel Grid.Row="2" Grid.Column="2">
<Label Content="Offset Abholen in mm (X):" Style="{StaticResource RobotLabelStyle}"/>
<TextBox IsEnabled="{Binding CanChangeOffsetPick}" Text="{Binding OffsetPick_X}" Style="{StaticResource RobotTextBoxStyle}"/>
</StackPanel>
<StackPanel Grid.Row="2" Grid.Column="4">
<Label Content="Offset Abholen in mm (Y):" Style="{StaticResource RobotLabelStyle}"/>
<TextBox IsEnabled="{Binding CanChangeOffsetPick}" Text="{Binding OffsetPick_Y}" Style="{StaticResource RobotTextBoxStyle}"/>
</StackPanel>
<StackPanel Grid.Row="3" Grid.Column="2">
<Label Content="Offset Ablegen in mm (X):" Style="{StaticResource RobotLabelStyle}"/>
<TextBox IsEnabled="{Binding CanChangeOffsetPlace}" Text="{Binding OffsetPlace_X}" Style="{StaticResource RobotTextBoxStyle}"/>
</StackPanel>
<StackPanel Grid.Row="3" Grid.Column="4">
<Label Content="Offset Ablegen in mm (Y):" Style="{StaticResource RobotLabelStyle}"/>
<TextBox IsEnabled="{Binding CanChangeOffsetPlace}" Text="{Binding OffsetPlace_Y}" Style="{StaticResource RobotTextBoxStyle}" />
</StackPanel>
<StackPanel Grid.Row="4" Grid.Column="2">
<Label Content="Offset NIO Abholen in mm (X):" Style="{StaticResource RobotLabelStyle}"/>
<TextBox IsEnabled="{Binding CanChangeOffsetNIOPick}" Text="{Binding OffsetNIOPick_X}" Style="{StaticResource RobotTextBoxStyle}"/>
</StackPanel>
<StackPanel Grid.Row="4" Grid.Column="4">
<Label Content="Offset NIO Abholen in mm (Y):" Style="{StaticResource RobotLabelStyle}"/>
<TextBox IsEnabled="{Binding CanChangeOffsetNIOPick}" Text="{Binding OffsetNIOPick_Y}" Style="{StaticResource RobotTextBoxStyle}"/>
</StackPanel>
<StackPanel Grid.Row="5" Grid.Column="2">
<Label Content="Offset NIO Ablegen in mm (X):" Style="{StaticResource RobotLabelStyle}"/>
<TextBox IsEnabled="{Binding CanChangeOffsetNIOPlace}" Text="{Binding OffsetNIOPlace_X}" Style="{StaticResource RobotTextBoxStyle}"/>
</StackPanel>
<Border Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" BorderBrush="WhiteSmoke" BorderThickness="4" Margin="5" />
<Label Grid.Row="1" Grid.Column="0" Content="Greiferseite für Job:" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10,0,0,0"/>
<TextBox Grid.Row="1" Grid.Column="1" IsEnabled="{Binding CanChangeJobGrippSide}" Text="{Binding JobGrippSide}" MaxLines="1" Margin="10,15,15,15" TextAlignment="Right"/>
<StackPanel Grid.Row="5" Grid.Column="4">
<Label Content="Offset NIO Ablegen in mm (Y):" Style="{StaticResource RobotLabelStyle}"/>
<TextBox IsEnabled="{Binding CanChangeOffsetNIOPlace}" Text="{Binding OffsetNIOPlace_Y}" Style="{StaticResource RobotTextBoxStyle}"/>
</StackPanel>
<StackPanel Grid.Row="4" Grid.Column="0">
<Label Content="Platz Heizplatte (1-9)" Style="{StaticResource RobotLabelStyle}" />
<TextBox IsEnabled="{Binding CanChangeHotPlateIndex}" Text="{Binding HotplateIndex}" Style="{StaticResource RobotTextBoxStyle}"/>
</StackPanel>
<StackPanel Grid.Row="5" Grid.Column="0">
<Label Content="Platz Kühlplatte (1-9)" Style="{StaticResource RobotLabelStyle}"/>
<TextBox IsEnabled="{Binding CanChangeCoolPlateIndex}" Text="{Binding CoolplateIndex}" Style="{StaticResource RobotTextBoxStyle}"/>
</StackPanel>
<common:PackMLControl Grid.Row="0" Grid.Column="7" Grid.ColumnSpan="2" HorizontalAlignment="Right" Grid.RowSpan="4" Width="Auto" Margin="20 20 0 20" DataContext="{Binding KukaRobotPackMLControlVm}"/>
<Label Grid.Row="3" Grid.Column="6" Grid.ColumnSpan="2" Content="Magazinbelegung:" Style="{StaticResource RobotLabelStyle}" VerticalAlignment="Bottom" />
<Border Grid.Column="6" Grid.Row="4" Grid.RowSpan="3" Grid.ColumnSpan="3" BorderBrush="White" BorderThickness="4">
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="10"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="10"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="80"/>
<RowDefinition Height="180"/>
<RowDefinition Height="10"/>
<RowDefinition Height="80"/>
<RowDefinition Height="180"/>
</Grid.RowDefinitions>
<Border Grid.Row="1" Grid.Column="2" Grid.ColumnSpan="2" BorderBrush="WhiteSmoke" BorderThickness="4" Margin="5" />
<Label Grid.Row="1" Grid.Column="2" Content="Greifertyp:" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10,0,0,0"/>
<TextBox Grid.Row="1" Grid.Column="3" IsEnabled="{Binding CanChangeJobGrippType}" Text="{Binding JobGrippType}" MaxLines="1" Margin="10,15,15,15" TextAlignment="Right"/>
<Label Grid.Row="0" Grid.Column="0" Content="Tellerplatz 1" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="35" />
<Ellipse Grid.Column="0" Grid.Row="1" HorizontalAlignment="Center" Height="150" Width="150" Stroke="WhiteSmoke" Fill="WhiteSmoke" VerticalAlignment="Center"/>
<Ellipse Grid.Column="0" Grid.Row="1" HorizontalAlignment="Center" Height="150" Width="150" Stroke="WhiteSmoke" Fill="DarkCyan" Visibility="{Binding MagazinPlace1}" VerticalAlignment="Center"/>
<Label Grid.Row="0" Grid.Column="2" Content="Tellerplatz 2" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="35" />
<Ellipse Grid.Column="2" Grid.Row="1" HorizontalAlignment="Center" Height="150" Width="150" Stroke="WhiteSmoke" Fill="WhiteSmoke" VerticalAlignment="Center"/>
<Ellipse Grid.Column="2" Grid.Row="1" HorizontalAlignment="Center" Height="150" Width="150" Stroke="WhiteSmoke" Fill="DarkCyan" Visibility="{Binding MagazinPlace2}" VerticalAlignment="Center" />
<Border Grid.Row="1" Grid.Column="4" Grid.ColumnSpan="2" BorderBrush="WhiteSmoke" BorderThickness="4" Margin="5" />
<Label Grid.Row="1" Grid.Column="4" Content="Drehteller Magazinplatz:" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10,0,0,0"/>
<TextBox Grid.Row="1" Grid.Column="5" IsEnabled="{Binding CanChangeChuckMagazinPlace}" Text="{Binding ChuckMagazinPlace}" MaxLines="1" Margin="10,15,15,15" TextAlignment="Right"/>
<Label Grid.Row="0" Grid.Column="4" Content="Tellerplatz 3" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="35" />
<Ellipse Grid.Column="4" Grid.Row="1" HorizontalAlignment="Center" Height="150" Width="150" Stroke="WhiteSmoke" Fill="WhiteSmoke" VerticalAlignment="Center"/>
<Ellipse Grid.Column="4" Grid.Row="1" HorizontalAlignment="Center" Height="150" Width="150" Stroke="WhiteSmoke" Fill="DarkCyan" Visibility="{Binding MagazinPlace3}" VerticalAlignment="Center" />
<Label Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" Content="Tellerplatz 4" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="35" />
<Ellipse Grid.Column="0" Grid.Row="4" HorizontalAlignment="Center" Height="150" Width="150" Stroke="WhiteSmoke" Fill="WhiteSmoke" VerticalAlignment="Center"/>
<Ellipse Grid.Column="0" Grid.Row="4" HorizontalAlignment="Center" Height="150" Width="150" Stroke="WhiteSmoke" Fill="DarkCyan" Visibility="{Binding MagazinPlace4}" VerticalAlignment="Center" />
<Border Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" BorderBrush="WhiteSmoke" BorderThickness="4,4,4,4" Margin="5,5,5,5"/>
<Label Grid.Row="2" Grid.Column="0" Content="Teiledicke in mm: " VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10,0,0,0"/>
<TextBox Grid.Row="2" Grid.Column="1" IsEnabled="{Binding CanChangePieceThickness}" Text="{Binding PieceThickness}" MaxLines="1" Margin="10,15,15,15" TextAlignment="Right"/>
<Label Grid.Row="3" Grid.Column="2" Content="Tellerplatz 5" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="35" />
<Ellipse Grid.Column="2" Grid.Row="4" HorizontalAlignment="Center" Height="150" Width="150" Stroke="WhiteSmoke" Fill="WhiteSmoke" VerticalAlignment="Center"/>
<Ellipse Grid.Column="2" Grid.Row="4" HorizontalAlignment="Center" Height="150" Width="150" Stroke="WhiteSmoke" Fill="DarkCyan" Visibility="{Binding MagazinPlace5}" VerticalAlignment="Center" />
<Border Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" BorderBrush="WhiteSmoke" BorderThickness="4,4,4,4" Margin="5,5,5,5"/>
<Label Grid.Row="3" Grid.Column="0" Content="Angefragter Sps Job :" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5,0,0,0" />
<ComboBox Grid.Row="3" Grid.Column="1" Margin="10,15,15,15" ItemsSource="{Binding PLCJobs}" SelectedItem="{Binding SelectedPLCJob}" IsReadOnly="True" IsEnabled="False"/>
<Border Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="2" Grid.RowSpan="2" BorderBrush="WhiteSmoke" BorderThickness="4,4,4,4" Margin="5,5,5,5"/>
<Label Grid.Row="4" Grid.Column="0" Content="Aktueller Status der Statemachine" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5,0,0,0" />
<ComboBox Grid.Row="4" Grid.Column="1" Margin="10,15,15,10" ItemsSource="{Binding StatemachineStates}" SelectedItem="{Binding ActiveState}" IsReadOnly="True" />
<Button Grid.Row="5" Grid.Column="0" Command="{Binding ClearStateCommand}" Content="Clear" Margin="15,15,10,15" />
<Button Grid.Row="5" Grid.Column="1" Command="{Binding ResetStateCommand}" Content="Reset" Margin="10,15,15,15" />
<Border Grid.Row="2" Grid.Column="2" Grid.ColumnSpan="2" BorderBrush="WhiteSmoke" BorderThickness="4,4,1,1" Margin="5,5,0,0"/>
<Border Grid.Row="2" Grid.Column="4" Grid.ColumnSpan="2" BorderBrush="WhiteSmoke" BorderThickness="1,4,4,1" Margin="0,5,5,0"/>
<Label Grid.Row="2" Grid.Column="2" Content="Offset Abholen in mm (X):" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10,0,0,0"/>
<Label Grid.Row="2" Grid.Column="4" Content="Offset Abholen in mm (Y):" VerticalAlignment="Center" HorizontalAlignment="Left"/>
<TextBox Grid.Row="2" Grid.Column="5" IsEnabled="{Binding CanChangeOffsetPick}" Text="{Binding OffsetPick_Y}" MaxLines="1" Margin="10,15,15,10" TextAlignment="Right" />
<TextBox Grid.Row="2" Grid.Column="3" IsEnabled="{Binding CanChangeOffsetPick}" Text="{Binding OffsetPick_X}" MaxLines="1" Margin="10,15,15,10" TextAlignment="Right" />
<Border Grid.Row="3" Grid.Column="2" Grid.ColumnSpan="2" BorderBrush="WhiteSmoke" BorderThickness="4,1,1,1" Margin="5,0,0,0"/>
<Border Grid.Row="3" Grid.Column="4" Grid.ColumnSpan="2" BorderBrush="WhiteSmoke" BorderThickness="1,1,4,1" Margin="0,0,5,0"/>
<Label Grid.Row="3" Grid.Column="2" Content="Offset Ablegen in mm (X):" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10,0,0,0"/>
<Label Grid.Row="3" Grid.Column="4" Content="Offset Ablegen in mm (Y):" VerticalAlignment="Center" HorizontalAlignment="Left"/>
<TextBox Grid.Row="3" Grid.Column="5" IsEnabled="{Binding CanChangeOffsetPlace}" Text="{Binding OffsetPlace_Y}" MaxLines="1" Margin="10,10,15,10" TextAlignment="Right" />
<TextBox Grid.Row="3" Grid.Column="3" IsEnabled="{Binding CanChangeOffsetPlace}" Text="{Binding OffsetPlace_X}" MaxLines="1" Margin="10,10,15,10" TextAlignment="Right" />
<Border Grid.Row="4" Grid.Column="2" Grid.ColumnSpan="2" BorderBrush="WhiteSmoke" BorderThickness="4,1,1,1" Margin="5,0,0,0"/>
<Border Grid.Row="4" Grid.Column="4" Grid.ColumnSpan="2" BorderBrush="WhiteSmoke" BorderThickness="1,1,4,1" Margin="0,0,5,0"/>
<Label Grid.Row="4" Grid.Column="2" Content="Offset NIO Abholen in mm (X):" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10,0,0,0"/>
<Label Grid.Row="4" Grid.Column="4" Content="Offset NIO Abholen in mm (Y):" VerticalAlignment="Center" HorizontalAlignment="Left"/>
<TextBox Grid.Row="4" Grid.Column="5" IsEnabled="{Binding CanChangeOffsetNIOPick}" Text="{Binding OffsetNIOPick_Y}" MaxLines="1" Margin="10,10,15,10" TextAlignment="Right" />
<TextBox Grid.Row="4" Grid.Column="3" IsEnabled="{Binding CanChangeOffsetNIOPick}" Text="{Binding OffsetNIOPick_X}" MaxLines="1" Margin="10,10,15,10" TextAlignment="Right" />
<Border Grid.Row="5" Grid.Column="2" Grid.ColumnSpan="2" BorderBrush="WhiteSmoke" BorderThickness="4,1,1,4" Margin="5,0,0,5"/>
<Border Grid.Row="5" Grid.Column="4" Grid.ColumnSpan="2" BorderBrush="WhiteSmoke" BorderThickness="1,1,4,4" Margin="0,0,5,5"/>
<Label Grid.Row="5" Grid.Column="2" Content="Offset NIO Ablegen in mm (X):" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10,0,0,0"/>
<Label Grid.Row="5" Grid.Column="4" Content="Offset NIO Ablegen in mm (Y):" VerticalAlignment="Center" HorizontalAlignment="Left"/>
<TextBox Grid.Row="5" Grid.Column="5" IsEnabled="{Binding CanChangeOffsetNIOPlace}" Text="{Binding OffsetNIOPlace_Y}" MaxLines="1" Margin="10,10,15,15" TextAlignment="Right" />
<TextBox Grid.Row="5" Grid.Column="3" IsEnabled="{Binding CanChangeOffsetNIOPlace}" Text="{Binding OffsetNIOPlace_X}" MaxLines="1" Margin="10,10,15,15" TextAlignment="Right" />
<Border Grid.Row="6" Grid.Column="0" Grid.ColumnSpan="2" BorderBrush="WhiteSmoke" BorderThickness="4,4,4,1" Margin="5,5,5,0"/>
<Border Grid.Row="7" Grid.Column="0" Grid.ColumnSpan="2" BorderBrush="WhiteSmoke" BorderThickness="4,1,4,4" Margin="5,0,5,5"/>
<Label Grid.Row="6" Grid.Column="0" Content="Platz Heizplatte (1-9)" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10,5,0,0" />
<Label Grid.Row="7" Grid.Column="0" Content="Platz Kühlplatte (1-9)" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10,0,0,5"/>
<TextBox Grid.Row="6" Grid.Column="1" IsEnabled="{Binding CanChangeHotPlateIndex}" Text="{Binding HotplateIndex}" MaxLines="1" Margin="10,15,15,10" TextAlignment="Right" />
<TextBox Grid.Row="7" Grid.Column="1" IsEnabled="{Binding CanChangeCoolPlateIndex}" Text="{Binding CoolplateIndex}" MaxLines="1" Margin="10,10,15,15" TextAlignment="Right" />
<Label Grid.Row="6" Grid.Column="3" Content="Magazinbelegung: " VerticalAlignment="Center" HorizontalAlignment="Center" />
<Grid Grid.Column ="4" Grid.Row="6" Grid.RowSpan="3" Grid.ColumnSpan="4" >
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Label Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Content="Tellerplatz 1" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="10" />
<Label Grid.Row="0" Grid.Column="3" Grid.ColumnSpan="2" Content="Tellerplatz 2" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="10" />
<Label Grid.Row="0" Grid.Column="6" Grid.ColumnSpan="2" Content="Tellerplatz 3" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="10" />
<Label Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" Content="Tellerplatz 4" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="10" />
<Label Grid.Row="3" Grid.Column="3" Grid.ColumnSpan="2" Content="Tellerplatz 5" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="10" />
<Label Grid.Row="3" Grid.Column="6" Grid.ColumnSpan="2" Content="Tellerplatz 6" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="10" />
<Ellipse Grid.Column="0" Grid.Row="1" Grid.RowSpan="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Height="85" Margin="0" Stroke="WhiteSmoke" Fill="WhiteSmoke" VerticalAlignment="Center" Width="85"/>
<Ellipse Grid.Column="3" Grid.Row="1" Grid.RowSpan="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Height="85" Margin="0" Stroke="WhiteSmoke" Fill="WhiteSmoke" VerticalAlignment="Center" Width="85"/>
<Ellipse Grid.Column="6" Grid.Row="1" Grid.RowSpan="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Height="85" Margin="0" Stroke="WhiteSmoke" Fill="WhiteSmoke" VerticalAlignment="Center" Width="85"/>
<Ellipse Grid.Column="0" Grid.Row="4" Grid.RowSpan="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Height="85" Margin="0" Stroke="WhiteSmoke" Fill="WhiteSmoke" VerticalAlignment="Center" Width="85"/>
<Ellipse Grid.Column="3" Grid.Row="4" Grid.RowSpan="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Height="85" Margin="0" Stroke="WhiteSmoke" Fill="WhiteSmoke" VerticalAlignment="Center" Width="85"/>
<Ellipse Grid.Column="6" Grid.Row="4" Grid.RowSpan="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Height="85" Margin="0" Stroke="WhiteSmoke" Fill="WhiteSmoke" VerticalAlignment="Center" Width="85"/>
<Ellipse Grid.Column="0" Grid.Row="1" Grid.RowSpan="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Height="80" Margin="0" Stroke="WhiteSmoke" Fill="DarkCyan" Visibility="{Binding MagazinPlace1}" VerticalAlignment="Center" Width="80"/>
<Ellipse Grid.Column="3" Grid.Row="1" Grid.RowSpan="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Height="80" Margin="0" Stroke="WhiteSmoke" Fill="DarkCyan" Visibility="{Binding MagazinPlace2}" VerticalAlignment="Center" Width="80"/>
<Ellipse Grid.Column="6" Grid.Row="1" Grid.RowSpan="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Height="80" Margin="0" Stroke="WhiteSmoke" Fill="DarkCyan" Visibility="{Binding MagazinPlace3}" VerticalAlignment="Center" Width="80"/>
<Ellipse Grid.Column="0" Grid.Row="4" Grid.RowSpan="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Height="80" Margin="0" Stroke="WhiteSmoke" Fill="DarkCyan" Visibility="{Binding MagazinPlace4}" VerticalAlignment="Center" Width="80"/>
<Ellipse Grid.Column="3" Grid.Row="4" Grid.RowSpan="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Height="80" Margin="0" Stroke="WhiteSmoke" Fill="DarkCyan" Visibility="{Binding MagazinPlace5}" VerticalAlignment="Center" Width="80"/>
<Ellipse Grid.Column="6" Grid.Row="4" Grid.RowSpan="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Height="80" Margin="0" Stroke="WhiteSmoke" Fill="DarkCyan" Visibility="{Binding MagazinPlace6}" VerticalAlignment="Center" Width="80"/>
</Grid>
</Grid>
<Label Grid.Row="3" Grid.Column="4" Content="Tellerplatz 6" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="35" />
<Ellipse Grid.Column="4" Grid.Row="4" HorizontalAlignment="Center" Height="150" Width="150" Stroke="WhiteSmoke" Fill="WhiteSmoke" VerticalAlignment="Center"/>
<Ellipse Grid.Column="4" Grid.Row="4" HorizontalAlignment="Center" Height="150" Width="150" Stroke="WhiteSmoke" Fill="DarkCyan" Visibility="{Binding MagazinPlace6}" VerticalAlignment="Center"/>
</Grid>
</Border>
</Grid>
</Page>

View File

@@ -1,22 +1,21 @@
using System.Windows.Controls;
namespace InfineonHMI
{
/// <summary>
/// Interaktionslogik für AutomaticModePage.xaml
/// </summary>
public partial class KukaRobotPage : Page
{
public KukaRobotPage()
{
InitializeComponent();
// Unloaded += OnUnloaded;
}
namespace InfineonHMI;
private void OnUnloaded(object? sender, EventArgs e)
{
var disposable = DataContext as IDisposable;
disposable?.Dispose();
}
}
/// <summary>
/// Interaktionslogik für AutomaticModePage.xaml
/// </summary>
public partial class KukaRobotPage : Page
{
public KukaRobotPage()
{
InitializeComponent();
// Unloaded += OnUnloaded;
}
private void OnUnloaded(object? sender, EventArgs e)
{
var disposable = DataContext as IDisposable;
disposable?.Dispose();
}
}

View File

@@ -4,103 +4,125 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:uniperHmi="clr-namespace:InfineonHMI"
xmlns:common="clr-namespace:Common"
mc:Ignorable="d"
d:DataContext="{d:DesignInstance Type=uniperHmi:MachineOverviewPageVM, IsDesignTimeCreatable=True}"
Title="Production Overview">
<Viewbox Stretch="none">
<Grid Width="3840" Height="1650">
<Grid Width="3840" Height="1554">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.12*"/>
<ColumnDefinition Width="0.93*"/>
<ColumnDefinition Width="450"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid Grid.Column="0" Margin="25 0 0 0">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Image Grid.Column="1" Source="/Anlagenuebersicht.png" Stretch="Fill" Height="1504" Width="1936"/>
<Button Grid.Row="0"
Margin="5"
FontSize="36"
FontFamily="Arial"
Content="Trayfeeder&#xD;&#xA;Ein-/Ausgabe"
Command="{Binding TrayfeederPageClickedCommand}"/>
<Button Grid.Row="1"
Margin="5"
FontSize="39"
Content="Ausrichtstation"
Command="{Binding AlignerPageClickedCommand}"/>
<Button Grid.Row="2"
Margin="5"
FontSize="36"
Content="Ätzer 1"
Command="{Binding Etching1PageClickedCommand}"/>
<Button Grid.Row="3"
Margin="5"
FontSize="36"
Content="Ätzer 2"
Command="{Binding Etching2PageClickedCommand}"/>
<Button Grid.Row="4"
Margin="5"
FontSize="36"
Content="HV Test"
Command="{Binding HVTestPageClickedCommand}"/>
<Button Grid.Row="5"
Margin="5"
FontSize="36"
Content="Heiz-&#xD;&#xA;/Kühlplatte"
Command="{Binding HotCoolplatePageClickedCommand}"/>
<Button Grid.Row="6"
Margin="5"
FontSize="36"
Content="NOK Station"
Command="{Binding NIOStationPageClickedCommand}"/>
<Border Grid.Row="7"
BorderBrush="White"
BorderThickness="0,5,0,0"/>
<Button Grid.Row="7"
Margin="5,15,5,5"
FontSize="36" Content="Kuka Roboter"
Command="{Binding KukaPageClickedCommand}"/>
<Button Grid.Row="8"
Margin="5"
FontSize="36"
FontFamily="Arial"
Content="Medienschrank"
Command="{Binding MediaCabinetPageClickedCommand}"/>
</Grid>
<!-- DETAIL PAGE -->
<Frame x:Name="DetailFrame"
Grid.Column="1"
NavigationUIVisibility="Hidden"
Content="{Binding CurrentDetailPage}"/>
<Image Grid.Column="1" Source="/Anlagenuebersicht.png" Stretch="Fill" Height="1504" Width="1936"/>
<Button Command="{Binding TrayfeederPageClickedCommand}" Background="Transparent" Grid.Column="1" Margin="2203,572,820,780"/>
<Button Command="{Binding KukaPageClickedCommand}" Background="Transparent" Grid.Column="1" Margin="1822,610,1380,780"/>
<Button Command="{Binding Etching1PageClickedCommand}" Background="Transparent" Grid.Column="1" Margin="1480,819,1749,644" RenderTransformOrigin="0.5,0.5">
<Grid Grid.Column="0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Button IsEnabled="{Binding CanUserChangePageTrayFeeder}" Grid.Row="0"
Height="160"
Margin="5"
FontSize="36"
FontFamily="Arial"
Content="Trayfeeder&#xA;Ein-/Ausgabe"
Command="{Binding TrayfeederPageClickedCommand}"/>
<Button IsEnabled="{Binding CanUserChangePageAlignment}"
Grid.Row="1"
Height="160"
Margin="5"
FontSize="39"
Content="Ausrichtstation"
Command="{Binding AlignerPageClickedCommand}"/>
<Button IsEnabled="{Binding CanUserChangePageEtching1}"
Grid.Row="2"
Height="160"
Margin="5"
FontSize="36"
Content="Ätzer 1"
Command="{Binding Etching1PageClickedCommand}"/>
<Button IsEnabled="{Binding CanUserChangePageEtching2}"
Grid.Row="3"
Height="160"
Margin="5"
FontSize="36"
Content="Ätzer 2"
Command="{Binding Etching2PageClickedCommand}"/>
<Button IsEnabled="{Binding CanUserChangePageHighVoltage}"
Grid.Row="4"
Height="160"
Margin="5"
FontSize="36"
Content="HV Test"
Command="{Binding HVTestPageClickedCommand}"/>
<Button IsEnabled="{Binding CanUserChangePageHotCoolplate}"
Grid.Row="5"
Height="160"
Margin="5"
FontSize="36"
Content="Heiz-&#xA;/Kühlplatte"
Command="{Binding HotCoolplatePageClickedCommand}"/>
<Button IsEnabled="{Binding CanUserChangePageNIOStation}"
Grid.Row="6"
Height="160"
Margin="5"
FontSize="36"
Content="NOK Station"
Command="{Binding NIOStationPageClickedCommand}"/>
<Border Grid.Row="7"
Margin="5"
BorderBrush="White"
BorderThickness="0,5,0,0"/>
<Button IsEnabled="{Binding CanUserChangePageKukaRobot}"
Grid.Row="8"
Height="160"
Margin="5"
FontSize="36" Content="Kuka Roboter"
Command="{Binding KukaPageClickedCommand}"/>
<Button IsEnabled="{Binding CanUserChangePageMediaCabinet}"
Grid.Row="9"
Height="160"
Margin="5"
FontSize="36"
FontFamily="Arial"
Content="Medienschrank"
Command="{Binding MediaCabinetPageClickedCommand}"/>
</Grid>
<Button IsEnabled="{Binding CanUserChangePageTrayFeeder}"
Command="{Binding TrayfeederPageClickedCommand}" Background="Transparent" Grid.Column="1" Margin="2203,572,820,780"/>
<Button IsEnabled="{Binding CanUserChangePageKukaRobot}"
Command="{Binding KukaPageClickedCommand}" Background="Transparent" Grid.Column="1" Margin="1822,610,1380,780"/>
<Button IsEnabled="{Binding CanUserChangePageEtching1}"
Command="{Binding Etching1PageClickedCommand}" Background="Transparent" Grid.Column="1" Margin="1480,819,1749,644" RenderTransformOrigin="0.5,0.5">
<Button.RenderTransform>
<TransformGroup>
<ScaleTransform/>
@@ -109,7 +131,8 @@
</TransformGroup>
</Button.RenderTransform>
</Button>
<Button Command="{Binding Etching2PageClickedCommand}" Background="Transparent" Grid.Column="1" Margin="1431,473,1770,971" RenderTransformOrigin="0.5,0.5">
<Button IsEnabled="{Binding CanUserChangePageEtching2}"
Command="{Binding Etching2PageClickedCommand}" Background="Transparent" Grid.Column="1" Margin="1431,473,1770,971" RenderTransformOrigin="0.5,0.5">
<Button.RenderTransform>
<TransformGroup>
<ScaleTransform/>
@@ -118,7 +141,8 @@
</TransformGroup>
</Button.RenderTransform>
</Button>
<Button Command="{Binding HVTestPageClickedCommand}" Background="Transparent" Grid.Column="1" Margin="1706,183,1472,1202" RenderTransformOrigin="0.5,0.5">
<Button IsEnabled="{Binding CanUserChangePageHighVoltage}"
Command="{Binding HVTestPageClickedCommand}" Background="Transparent" Grid.Column="1" Margin="1706,183,1472,1202" RenderTransformOrigin="0.5,0.5">
<Button.RenderTransform>
<TransformGroup>
<ScaleTransform/>
@@ -127,7 +151,8 @@
</TransformGroup>
</Button.RenderTransform>
</Button>
<Button Command="{Binding HotCoolplatePageClickedCommand}" Background="Transparent" Grid.Column="1" Margin="2039,316,1175,1106" RenderTransformOrigin="0.5,0.5">
<Button IsEnabled="{Binding CanUserChangePageHotCoolplate}"
Command="{Binding HotCoolplatePageClickedCommand}" Background="Transparent" Grid.Column="1" Margin="2039,316,1175,1106" RenderTransformOrigin="0.5,0.5">
<Button.RenderTransform>
<TransformGroup>
<ScaleTransform/>
@@ -136,9 +161,11 @@
</TransformGroup>
</Button.RenderTransform>
</Button>
<Button Command="{Binding MediaCabinetPageClickedCommand}" Background="Transparent" Grid.Column="1" Margin="878,565,2350,641"/>
<Button IsEnabled="{Binding CanUserChangePageMediaCabinet}"
Command="{Binding MediaCabinetPageClickedCommand}" Background="Transparent" Grid.Column="1" Margin="878,565,2350,641"/>
<Button Command="{Binding AlignerPageClickedCommand}" Background="Transparent" Grid.Column="1" Margin="1633,1048,1594,474" RenderTransformOrigin="0.5,0.5">
<Button IsEnabled="{Binding CanUserChangePageAlignment}"
Command="{Binding AlignerPageClickedCommand}" Background="Transparent" Grid.Column="1" Margin="1633,1048,1594,474" RenderTransformOrigin="0.5,0.5">
<Button.RenderTransform>
<TransformGroup>
<ScaleTransform/>
@@ -148,7 +175,8 @@
</TransformGroup>
</Button.RenderTransform>
</Button>
<Button Command="{Binding NIOStationPageClickedCommand}" Background="Transparent" Grid.Column="1" Margin="1707,932,1543,601" RenderTransformOrigin="0.5,0.5">
<Button IsEnabled="{Binding CanUserChangePageNIOStation}"
Command="{Binding NIOStationPageClickedCommand}" Background="Transparent" Grid.Column="1" Margin="1707,932,1543,601" RenderTransformOrigin="0.5,0.5">
<Button.RenderTransform>
<TransformGroup>
<ScaleTransform/>
@@ -158,6 +186,11 @@
</TransformGroup>
</Button.RenderTransform>
</Button>
<common:PackMLControl Margin="20 7 10 5"
IsEnabled="{Binding CanUserInteract}"
Grid.Column="1"
DataContext="{Binding MachinePackMLControlVM}" HorizontalAlignment="Left" VerticalAlignment="Top" />
</Grid>
</Viewbox>
</Page>

View File

@@ -1,22 +1,22 @@
using System.Windows.Controls;
namespace InfineonHMI
{
/// <summary>
/// Interaktionslogik für AutomaticModePage.xaml
/// </summary>
public partial class MachineOverviewPage : Page
{
public MachineOverviewPage()
{
InitializeComponent();
// Unloaded += OnUnloaded;
}
namespace InfineonHMI;
/// <summary>
/// Interaktionslogik für AutomaticModePage.xaml
/// </summary>
public partial class MachineOverviewPage : Page
{
public MachineOverviewPage()
{
InitializeComponent();
// Unloaded += OnUnloaded;
}
private void OnUnloaded(object? sender, EventArgs e)
{
var disposable = DataContext as IDisposable;
disposable?.Dispose();
}
private void OnUnloaded(object? sender, EventArgs e)
{
var disposable = DataContext as IDisposable;
disposable?.Dispose();
}
}
}

View File

@@ -20,19 +20,20 @@
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="2*"/>
<RowDefinition Height="33*" />
<RowDefinition Height="33*" />
<RowDefinition Height="4*"/>
<RowDefinition Height="30*" />
<RowDefinition Height="30*" />
<RowDefinition Height="33*" />
</Grid.RowDefinitions>
<Label Grid.Row="0" Grid.Column="0" Content="Mediacabinet Page" VerticalAlignment="Center" HorizontalAlignment="Left" />
<Label Grid.Row="0" Grid.Column="0" Content="Mediacabinet Page" VerticalAlignment="Center" HorizontalAlignment="Left" FontSize="35" />
<common:MediaContainer Grid.Row="1" Grid.Column="0" Height="400" Width="300" Margin="10" HorizontalAlignment="Center" DataContext="{Binding Container1Vm}"/>
<common:MediaContainer Grid.Row="2" Grid.Column="0" Height="400" Width="300" Margin="10" HorizontalAlignment="Center" DataContext="{Binding Container2Vm}"/>
<common:MediaContainer Grid.Row="3" Grid.Column="0" Height="400" Width="300" Margin="10" HorizontalAlignment="Center" DataContext="{Binding Container3Vm}"/>
<common:MediaContainer Grid.Row="1" Grid.Column="1" Height="400" Width="300" Margin="10" HorizontalAlignment="Center" DataContext="{Binding Container4Vm}"/>
<common:MediaContainer Grid.Row="1" Grid.Column="1" Height="400" Width="300" Margin="10" HorizontalAlignment="Center" DataContext="{Binding Container4Vm}"/>
<common:MediaContainer Grid.Row="2" Grid.Column="1" Height="400" Width="300" Margin="10" HorizontalAlignment="Center" DataContext="{Binding Container5Vm}"/>
<common:MediaContainer Grid.Row="3" Grid.Column="1" Height="400" Width="300" Margin="10" HorizontalAlignment="Center" DataContext="{Binding Container6Vm}"/>
@@ -41,5 +42,9 @@
<common:MediaContainer Grid.Row="2" Grid.Column="2" Height="400" Width="300" Margin="10" HorizontalAlignment="Center" DataContext="{Binding Container8Vm}"/>
<common:MediaContainer Grid.Row="3" Grid.Column="2" Height="400" Width="300" Margin="10" HorizontalAlignment="Center" DataContext="{Binding Container9Vm}"/>
<common:MediaContainer Grid.Row="1" Grid.Column="3" Height="400" Width="300" Margin="10" HorizontalAlignment="Center" DataContext="{Binding Container10Vm}"/>
<common:MediaContainer Grid.Row="2" Grid.Column="3" Height="400" Width="300" Margin="10" HorizontalAlignment="Center" DataContext="{Binding Container11Vm}"/>
<common:MediaContainer Grid.Row="3" Grid.Column="3" Height="400" Width="300" Margin="10" HorizontalAlignment="Center" DataContext="{Binding Container12Vm}"/>
</Grid>
</Page>

View File

@@ -1,22 +1,21 @@
using System.Windows.Controls;
namespace InfineonHMI
{
/// <summary>
/// Interaktionslogik für AutomaticModePage.xaml
/// </summary>
public partial class MediaCabinetPage : Page
{
public MediaCabinetPage()
{
InitializeComponent();
// Unloaded += OnUnloaded;
}
namespace InfineonHMI;
private void OnUnloaded(object? sender, EventArgs e)
{
var disposable = DataContext as IDisposable;
disposable?.Dispose();
}
}
/// <summary>
/// Interaktionslogik für AutomaticModePage.xaml
/// </summary>
public partial class MediaCabinetPage : Page
{
public MediaCabinetPage()
{
InitializeComponent();
// Unloaded += OnUnloaded;
}
private void OnUnloaded(object? sender, EventArgs e)
{
var disposable = DataContext as IDisposable;
disposable?.Dispose();
}
}

View File

@@ -4,13 +4,15 @@
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" x:Class="InfineonHMI.NIOStationPage"
xmlns:HMIToolkit="clr-namespace:HMIToolkit"
xmlns:common="clr-namespace:Common"
x:Class="InfineonHMI.NIOStationPage"
mc:Ignorable="d"
d:DataContext="{d:DesignInstance IsDesignTimeCreatable=True, Type={x:Type local:NIOStationPageVM}}"
d:DesignHeight="800" d:DesignWidth="1850"
d:DesignHeight="1554" d:DesignWidth="3390"
Title="NIOStationPage">
<Grid>
<Grid Margin="20">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
@@ -31,16 +33,16 @@
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Label Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Content="NOK Station" VerticalAlignment="Top" HorizontalAlignment="Left" FontSize="40" />
<Label Grid.Row="0" Grid.Column="0" Content="NIO Station" HorizontalAlignment="Left" VerticalAlignment="Center"/>
<HMIToolkit:BinaryValveControl DataContext="{Binding ClampDiagValveVm}" Grid.Column="0" HorizontalAlignment="Center" Grid.Row="1" Grid.RowSpan="4" VerticalAlignment="Top" />
<HMIToolkit:BinaryValveControl DataContext="{Binding ClampAcrossValveVm}" Grid.Column="1" HorizontalAlignment="Center" Grid.Row="1" Grid.RowSpan="4" VerticalAlignment="Top" />
<Button Grid.Row="1" Grid.Column="2" Content="Tray Fixieren" DataContext="{Binding ClampCmdButtonVm}" HorizontalAlignment="Center" Width="180" Height="60" />
<Button Grid.Row="2" Grid.Column="2" Content="Tray Lösen" DataContext="{Binding UnclampCmdButtonVm}" HorizontalAlignment="Center" Width="180" Height="60" />
<Button Grid.Row="1" Grid.Column="2" Content="Tray Fixieren" DataContext="{Binding ClampCmdButtonVm}" HorizontalAlignment="Center" Width="320" Height="140" FontSize="30" />
<Button Grid.Row="2" Grid.Column="2" Content="Tray Lösen" DataContext="{Binding UnclampCmdButtonVm}" 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 NIOStationPackMLControlVm}"/>
</Grid>
</Page>

View File

@@ -1,22 +1,21 @@
using System.Windows.Controls;
namespace InfineonHMI
{
/// <summary>
/// Interaktionslogik für AutomaticModePage.xaml
/// </summary>
public partial class NIOStationPage : Page
{
public NIOStationPage()
{
InitializeComponent();
// Unloaded += OnUnloaded;
}
namespace InfineonHMI;
private void OnUnloaded(object? sender, EventArgs e)
{
var disposable = DataContext as IDisposable;
disposable?.Dispose();
}
}
/// <summary>
/// Interaktionslogik für AutomaticModePage.xaml
/// </summary>
public partial class NIOStationPage : Page
{
public NIOStationPage()
{
InitializeComponent();
// Unloaded += OnUnloaded;
}
private void OnUnloaded(object? sender, EventArgs e)
{
var disposable = DataContext as IDisposable;
disposable?.Dispose();
}
}

View File

@@ -8,80 +8,91 @@
d:DataContext="{d:DesignInstance Type=uniperHmi:ProductionOverviewPageVM, IsDesignTimeCreatable=True}"
Title="Production Overview">
<Viewbox Stretch="none">
<Grid Width="3840" Height="1650">
<Grid Width="3840" Height="1554">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.12*"/>
<ColumnDefinition Width="0.93*"/>
<ColumnDefinition Width="450"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid Grid.Column="0" Margin="25 0 0 0">
<Grid Grid.Column="0" >
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Button Grid.Row="0"
Margin="5"
<Button Grid.Row="0"
Height="160"
Margin="5"
FontSize="36"
FontFamily="Arial"
Content="Trayfeeder&#xD;&#xA;Ein-/Ausgabe"
Command="{Binding TrayfeederPageClickedCommand}"/>
<Button Grid.Row="1"
<Button Grid.Row="1"
Height="160"
Margin="5"
FontSize="39"
Content="Ausrichtstation"
Command="{Binding AlignerPageClickedCommand}"/>
<Button Grid.Row="2"
<Button Grid.Row="2"
Height="160"
Margin="5"
FontSize="36"
Content="Ätzer 1"
Command="{Binding Etching1PageClickedCommand}"/>
<Button Grid.Row="3"
<Button Grid.Row="3"
Height="160"
Margin="5"
FontSize="36"
Content="Ätzer 2"
Command="{Binding Etching2PageClickedCommand}"/>
<Button Grid.Row="4"
<Button Grid.Row="4"
Height="160"
Margin="5"
FontSize="36"
Content="HV Test"
Command="{Binding HVTestPageClickedCommand}"/>
<Button Grid.Row="5"
<Button Grid.Row="5"
Height="160"
Margin="5"
FontSize="36"
Content="Heiz-&#xD;&#xA;/Kühlplatte"
Command="{Binding HotCoolplatePageClickedCommand}"/>
<Button Grid.Row="6"
<Button Grid.Row="6"
Height="160"
Margin="5"
FontSize="36"
Content="NOK Station"
Command="{Binding NIOStationPageClickedCommand}"/>
<Border Grid.Row="7"
BorderBrush="White"
BorderThickness="0,5,0,0"/>
<Border Grid.Row="7"
Margin="5"
BorderBrush="White"
BorderThickness="0,5,0,0"/>
<Button Grid.Row="7"
Margin="5,15,5,5"
<Button Grid.Row="8"
Height="160"
Margin="5"
FontSize="36" Content="Kuka Roboter"
Command="{Binding KukaPageClickedCommand}"/>
<Button Grid.Row="8"
<Button Grid.Row="9"
Height="160"
Margin="5"
FontSize="36"
FontFamily="Arial"
@@ -96,5 +107,4 @@
Content="{Binding CurrentDetailPage}"/>
</Grid>
</Viewbox>
</Page>

View File

@@ -1,22 +1,21 @@
using System.Windows.Controls;
namespace InfineonHMI
{
/// <summary>
/// Interaktionslogik für AutomaticModePage.xaml
/// </summary>
public partial class ProductionOverviewPage : Page
{
public ProductionOverviewPage()
{
InitializeComponent();
// Unloaded += OnUnloaded;
}
namespace InfineonHMI;
private void OnUnloaded(object? sender, EventArgs e)
{
var disposable = DataContext as IDisposable;
disposable?.Dispose();
}
}
/// <summary>
/// Interaktionslogik für AutomaticModePage.xaml
/// </summary>
public partial class ProductionOverviewPage : Page
{
public ProductionOverviewPage()
{
InitializeComponent();
// Unloaded += OnUnloaded;
}
private void OnUnloaded(object? sender, EventArgs e)
{
var disposable = DataContext as IDisposable;
disposable?.Dispose();
}
}

View File

@@ -7,17 +7,19 @@
xmlns:common="clr-namespace:Common"
d:DataContext="{d:DesignInstance Type=uniperHmi:ReceipePageVM, IsDesignTimeCreatable=True}"
mc:Ignorable="d"
d:DesignHeight="1900" d:DesignWidth="3800">
d:DesignHeight="1554" d:DesignWidth="3840">
<Page.Resources>
<CollectionViewSource x:Key="FlowStations" Source="{Binding FlowStationsVm}"></CollectionViewSource>
<CollectionViewSource x:Key="FlowStations" Source="{Binding FlowStationsVm}"/>
<Style x:Key="Foo" TargetType="DataGridCell">
<Setter Property="FontSize" Value="30"/>
</Style>
</Page.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="33*"/>
<ColumnDefinition Width="33*"/>
<ColumnDefinition Width="17*"/>
<ColumnDefinition Width="17*"/>
<ColumnDefinition Width="0.25*"/>
<ColumnDefinition Width="0.25*"/>
<ColumnDefinition Width="0.5*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
@@ -40,34 +42,40 @@
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal">
<StackPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3" Orientation="Horizontal">
<Button Grid.Row="0" x:Name="BtnReadReceipeFile"
Content="Rezept aus Datei Laden"
Width="120"
Width="450" Height="140" FontSize="30"
Command="{Binding ReadReceipeFileCommand}"
HorizontalAlignment="Left"
Margin="10"/>
<Button Grid.Row="0" x:Name="BtnWriteReceipeFile"
Content="Rezept speichern"
Width="120"
Width="450" Height="140" FontSize="30"
Command="{Binding WriteReceipeFileCommand}"
HorizontalAlignment="Left"
Margin="10"/>
<Button Grid.Row="0" x:Name="BtnWriteToPlc"
Content="Sende Daten an SPS"
Width="120"
Command="{Binding WriteToPlcCommand}"
HorizontalAlignment="Left"
Margin="10"/>
<Button Grid.Row="0" x:Name="BtnWriteToPlc"
Content="Sende Daten an SPS"
Width="450" Height="140" FontSize="30"
Command="{Binding WriteToPlcCommand}"
HorizontalAlignment="Left"
Margin="10"/>
<Button Grid.Row="0" x:Name="BtnReadToPlc"
Content="Lese Daten von SPS"
Width="450" Height="140" FontSize="30"
Command="{Binding ReadFromPlcCommand}"
HorizontalAlignment="Left"
Margin="10"
Visibility ="Collapsed"
/>
</StackPanel>
<Label Grid.Column="0" Grid.Row="1" Content="Allgemein: " VerticalAlignment="Center" FontSize="24"></Label>
<common:ParamControlFloat Grid.Column="0" Grid.Row="2" Margin="5" HorizontalAlignment="Left" VerticalAlignment="Center" DataContext="{Binding CameraProgramsVm}"/>
<common:ParamControlFloat Grid.Column="0" Grid.Row="3" Margin="5" HorizontalAlignment="Left" VerticalAlignment="Center" DataContext="{Binding ChucksVm}"/>
<common:ParamControlFloat Grid.Column="0" Grid.Row="4" Margin="5" HorizontalAlignment="Left" VerticalAlignment="Center" DataContext="{Binding GripperVm}"/>
<common:ParamControlInt Grid.Column="0" Grid.Row="2" Margin="5" HorizontalAlignment="Left" VerticalAlignment="Center" DataContext="{Binding CameraProgramsVm}"/>
<common:ParamControlInt Grid.Column="0" Grid.Row="3" Margin="5" HorizontalAlignment="Left" VerticalAlignment="Center" DataContext="{Binding ChucksVm}"/>
<common:ParamControlInt Grid.Column="0" Grid.Row="4" Margin="5" HorizontalAlignment="Left" VerticalAlignment="Center" DataContext="{Binding GripperVm}"/>
<common:ParamControlFloat Grid.Column="0" Grid.Row="6" Margin="5" HorizontalAlignment="Left" VerticalAlignment="Center" DataContext="{Binding DiameterVm}"/>
<common:ParamControlFloat Grid.Column="0" Grid.Row="7" Margin="5" HorizontalAlignment="Left" VerticalAlignment="Center" DataContext="{Binding ThicknessVm}"/>
@@ -88,8 +96,8 @@
<Label Grid.Column="1" Grid.Row="1" Content="Hochvolt Parameter: " VerticalAlignment="Center" FontSize="24"></Label>
<common:ParamControlFloat Grid.Column="1" Grid.Row="2" Margin="5" HorizontalAlignment="Left" VerticalAlignment="Center" DataContext="{Binding HvmaxTestCurrentVm}"/>
<common:ParamControlFloat Grid.Column="1" Grid.Row="3" Margin="5" HorizontalAlignment="Left" VerticalAlignment="Center" DataContext="{Binding Hvn2PrePurgeTimeVm}"/>
<common:ParamControlFloat Grid.Column="1" Grid.Row="4" Margin="5" HorizontalAlignment="Left" VerticalAlignment="Center" DataContext="{Binding HvnumRetriesVm}"/>
<common:ParamControlFloat Grid.Column="1" Grid.Row="5" Margin="5" HorizontalAlignment="Left" VerticalAlignment="Center" DataContext="{Binding HvpolarityVm}"/>
<common:ParamControlInt Grid.Column="1" Grid.Row="4" Margin="5" HorizontalAlignment="Left" VerticalAlignment="Center" DataContext="{Binding HvnumRetriesVm}"/>
<common:ParamControlInt Grid.Column="1" Grid.Row="5" Margin="5" HorizontalAlignment="Left" VerticalAlignment="Center" DataContext="{Binding HvpolarityVm}"/>
<common:ParamControlFloat Grid.Column="1" Grid.Row="6" Margin="5" HorizontalAlignment="Left" VerticalAlignment="Center" DataContext="{Binding HvrampTimeVm}"/>
<common:ParamControlFloat Grid.Column="1" Grid.Row="7" Margin="5" HorizontalAlignment="Left" VerticalAlignment="Center" DataContext="{Binding HvtestFrequencyVm}"/>
<common:ParamControlFloat Grid.Column="1" Grid.Row="8" Margin="5" HorizontalAlignment="Left" VerticalAlignment="Center" DataContext="{Binding HvTestOkCurrentVm}"/>
@@ -98,21 +106,58 @@
<common:ParamControlFloat Grid.Column="1" Grid.Row="11" Margin="5" HorizontalAlignment="Left" VerticalAlignment="Center" DataContext="{Binding HvtestVoltageVm}"/>
<common:ParamControlFloat Grid.Column="1" Grid.Row="12" Margin="5" HorizontalAlignment="Left" VerticalAlignment="Center" DataContext="{Binding HvtestPressureN2Vm}"/>
<Label Grid.Column="1" Grid.Row="14" Content="Durchlaufrezept Tabelle"></Label>
<Grid Grid.Column="1" Grid.Row="15" Grid.RowSpan="6">
<Label Grid.Column="1" Grid.Row="14" Content="Traypositionen" FontSize="35"></Label>
<Grid Grid.Column="1" Grid.Row="15" Grid.RowSpan="5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.8*"/>
<ColumnDefinition Width="0.2*"/>
</Grid.ColumnDefinitions>
<DataGrid Grid.Column="0" ItemsSource="{Binding TrayPositions}"
SelectedItem="{Binding SelectedTrayPosition}"
AutoGenerateColumns="False" CanUserAddRows="False" FontSize="30" >
<DataGrid.Columns>
<DataGridTextColumn Header="Pos Nr." Binding="{Binding PosId}"/>
<DataGridTextColumn Header="Pos X" Binding="{Binding PosX}" Width="170"/>
<DataGridTextColumn Header="Pos Y" Binding="{Binding PosY}" Width="170"/>
</DataGrid.Columns>
</DataGrid>
<StackPanel Grid.Column="1" Orientation="Vertical">
<Button Content="+" FontSize="24" Width="60" Height="60" HorizontalAlignment="Left" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Margin="10" Command="{Binding AddTrayPositionCommand}" IsEnabled="{Binding CanAddTrayPosition}"/>
<Button Content="-" FontSize="24" Width="60" Height="60" HorizontalAlignment="Left" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Margin="10" Command="{Binding RemoveTrayPositionCommand}" IsEnabled="{Binding CanRemoveTrayPosition}"/>
<Button Content="↑" FontSize="24" Width="60" Height="60" HorizontalAlignment="Left" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Margin="10" Command="{Binding TrayPositionUpCommand}"/>
<Button Content="↓" FontSize="24" Width="60" Height="60" HorizontalAlignment="Left" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Margin="10" Command="{Binding TrayPositionDownCommand}"/>
</StackPanel>
</Grid>
<Label Grid.Column="2" Grid.Row="1" Content="Durchlaufrezept Tabelle" FontSize="30"/>
<Grid Grid.Column="2" Grid.Row="2" Grid.RowSpan="6">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="90*"/>
<ColumnDefinition Width="10*"/>
</Grid.ColumnDefinitions>
<DataGrid Grid.Column="0" ItemsSource="{Binding FlowReceipeEntries}"
SelectedItem="{Binding SelectedFlowReceipeEntry, UpdateSourceTrigger=PropertyChanged}"
AutoGenerateColumns="False" CanUserAddRows="False">
AutoGenerateColumns="False" CanUserAddRows="False" FontSize="30">
<DataGrid.Columns>
<DataGridTextColumn Header="NodeID" Binding="{Binding NodeId}"/>
<DataGridTextColumn Header="Priorität" Binding="{Binding Priority}"/>
<DataGridTextColumn Header="Prio" Binding="{Binding Priority}"/>
<DataGridComboBoxColumn Header="Station"
ItemsSource="{Binding Source={StaticResource FlowStations}}"
SelectedValueBinding="{Binding Station, NotifyOnTargetUpdated=True, NotifyOnSourceUpdated=True}"/>
SelectedValueBinding="{Binding Station, NotifyOnTargetUpdated=True, NotifyOnSourceUpdated=True}">
<DataGridComboBoxColumn.ElementStyle>
<Style TargetType="ComboBox">
<Setter Property="FontSize" Value="30"/>
<Setter Property="IsHitTestVisible" Value="False"/>
<Setter Property="Focusable" Value="False"/>
</Style>
</DataGridComboBoxColumn.ElementStyle>
<DataGridComboBoxColumn.EditingElementStyle>
<Style TargetType="ComboBox">
<Setter Property="FontSize" Value="30"/>
</Style>
</DataGridComboBoxColumn.EditingElementStyle>
</DataGridComboBoxColumn>
<DataGridTextColumn Header="Max. Wdh." Binding="{Binding MaxRetries}"/>
<DataGridTextColumn Header="Nächste Node" Binding="{Binding NextNodeSuccess}"/>
<DataGridTextColumn Header="Nächste Node bei Wdh." Binding="{Binding NextNodeRetry}"/>
@@ -130,38 +175,15 @@
<Label Grid.Column="2" Grid.Row="1" Content="Traypositionen" FontSize="24"></Label>
<Grid Grid.Column="2" Grid.Row="1" Grid.RowSpan="6">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="80*"/>
<ColumnDefinition Width="20*"/>
</Grid.ColumnDefinitions>
<DataGrid Grid.Column="0" ItemsSource="{Binding TrayPositions}"
SelectedItem="{Binding SelectedTrayPosition}"
AutoGenerateColumns="False" CanUserAddRows="False">
<DataGrid.Columns>
<DataGridTextColumn Header="Pos Nr." Binding="{Binding PosId}"/>
<DataGridTextColumn Header="Pos X" Binding="{Binding PosX}"/>
<DataGridTextColumn Header="Pos Y" Binding="{Binding PosY}"></DataGridTextColumn>
</DataGrid.Columns>
</DataGrid>
<StackPanel Grid.Column="1" Orientation="Vertical">
<Button Content="+" FontSize="24" Width="60" Height="60" HorizontalAlignment="Left" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Margin="10" Command="{Binding AddTrayPositionCommand}" IsEnabled="{Binding CanAddTrayPosition}"></Button>
<Button Content="-" FontSize="24" Width="60" Height="60" HorizontalAlignment="Left" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Margin="10" Command="{Binding RemoveTrayPositionCommand}" IsEnabled="{Binding CanRemoveTrayPosition}"></Button>
<Button Content="↑" FontSize="24" Width="60" Height="60" HorizontalAlignment="Left" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Margin="10" Command="{Binding TrayPositionUpCommand}"></Button>
<Button Content="↓" FontSize="24" Width="60" Height="60" HorizontalAlignment="Left" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Margin="10" Command="{Binding TrayPositionDownCommand}"></Button>
</StackPanel>
</Grid>
<Label Grid.Column="2" Grid.Row="9" Content="Ätzschritte Mecademic Roboter"></Label>
<Grid Grid.Column="2" Grid.ColumnSpan="2" Grid.Row="10" Grid.RowSpan="7">
<Label Grid.Column="2" Grid.Row="9" Content="Ätzschritte Mecademic Roboter" FontSize="30"></Label>
<Grid Grid.Column="2" Grid.ColumnSpan="1" Grid.Row="10" Grid.RowSpan="7">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="90*"/>
<ColumnDefinition Width="10*"/>
</Grid.ColumnDefinitions>
<DataGrid Grid.Column="0" ItemsSource="{Binding EtcherRobotSteps}"
SelectedItem="{Binding SelectedEtchRobotStep, UpdateSourceTrigger=PropertyChanged}"
AutoGenerateColumns="False" CanUserAddRows="False">
AutoGenerateColumns="False" CanUserAddRows="False" FontSize="30">
<DataGrid.Columns>
<DataGridTextColumn Header="Pos X" Binding="{Binding PosX}"/>
<DataGridTextColumn Header="Pos Y" Binding="{Binding PosY}"/>

View File

@@ -1,15 +1,14 @@
using System.Windows.Controls;
namespace InfineonHMI.Pages.Views
namespace InfineonHMI.Pages.Views;
/// <summary>
/// Receipes Overview Page
/// </summary>
public partial class ReceipePage : Page
{
/// <summary>
/// Receipes Overview Page
/// </summary>
public partial class ReceipePage : Page
public ReceipePage()
{
public ReceipePage()
{
InitializeComponent();
}
InitializeComponent();
}
}

View File

@@ -4,17 +4,22 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:InfineonHMI"
xmlns:common="clr-namespace:Common"
mc:Ignorable="d"
d:DataContext="{d:DesignInstance Type=local:TrayFeederPageVM, IsDesignTimeCreatable=True}"
d:DesignHeight="800" d:DesignWidth="1850"
d:DesignHeight="1554" d:DesignWidth="3390"
Title="Trayfeeder">
<Grid>
<Grid Margin="20">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
@@ -27,7 +32,10 @@
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Label Grid.Row="0" Grid.Column="0" Content="TrayFeederPage" VerticalAlignment="Center" HorizontalAlignment="Left" />
<Label Grid.Row="0" Grid.Column="0" Content="TrayFeederPage" VerticalAlignment="Top" HorizontalAlignment="Left" FontSize="40"/>
<common:PackMLControl Grid.Row="0" Grid.Column="2" Grid.ColumnSpan="2" HorizontalAlignment="Right" Grid.RowSpan="6" Width="Auto" Margin="20" DataContext="{Binding TrayfeederInPackMLControlVm}"/>
<common:PackMLControl Grid.Row="0" Grid.Column="6" Grid.ColumnSpan="2" HorizontalAlignment="Right" Grid.RowSpan="6" Width="Auto" Margin="20" DataContext="{Binding TrayfeederOutPackMLControlVm}"/>
</Grid>
</Page>

View File

@@ -1,16 +1,15 @@
using System.Windows.Controls;
namespace InfineonHMI
{
/// <summary>
/// Interaktionslogik für AutomaticModePage.xaml
/// </summary>
public partial class TrayFeederPage : Page
{
public TrayFeederPage()
{
InitializeComponent();
}
namespace InfineonHMI;
/// <summary>
/// Interaktionslogik für AutomaticModePage.xaml
/// </summary>
public partial class TrayFeederPage : Page
{
public TrayFeederPage()
{
InitializeComponent();
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

View File

@@ -3,7 +3,6 @@
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:mah="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
xmlns:local="clr-namespace:InfineonHMI"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"

View File

@@ -1,22 +1,21 @@
using System.Windows.Controls;
namespace InfineonHMI
{
/// <summary>
/// Interaktionslogik für SettingsPageView.xaml
/// </summary>
public partial class SettingsPage : Page
{
public SettingsPage()
{
InitializeComponent();
Unloaded += OnUnloaded;
}
namespace InfineonHMI;
private void OnUnloaded(object? sender, EventArgs e)
{
var disposable = DataContext as IDisposable;
disposable?.Dispose();
}
}
/// <summary>
/// Interaktionslogik für SettingsPageView.xaml
/// </summary>
public partial class SettingsPage : Page
{
public SettingsPage()
{
InitializeComponent();
Unloaded += OnUnloaded;
}
private void OnUnloaded(object? sender, EventArgs e)
{
var disposable = DataContext as IDisposable;
disposable?.Dispose();
}
}

View File

@@ -7,119 +7,118 @@ using TwinCAT.Ads.TypeSystem;
using TwinCAT.TypeSystem;
using Heisig.HMI.AdsManager;
namespace InfineonHMI
namespace InfineonHMI;
public partial class SettingsEntry : ObservableObject
{
public partial class SettingsEntry : ObservableObject
{
[ObservableProperty]
private string name = "";
[ObservableProperty]
private string name = "";
[ObservableProperty]
private string instancePath = "";
[ObservableProperty]
private string instancePath = "";
[ObservableProperty]
private string? dataType;
[ObservableProperty]
private string? dataType;
[ObservableProperty]
private Object? value;
[ObservableProperty]
private Object? value;
public ObservableCollection<SettingsEntry> SubEntries { get; set; } = [];
public ObservableCollection<SettingsEntry> SubEntries { get; set; } = [];
[ObservableProperty]
private Visibility visibility = Visibility.Collapsed;
[ObservableProperty]
private Visibility visibility = Visibility.Collapsed;
private readonly IAdsManager _adsManager;
private readonly IAdsManager _adsManager;
public SettingsEntry(IAdsManager adsManager)
{
_adsManager = adsManager;
}
public SettingsEntry(IAdsManager adsManager)
{
_adsManager = adsManager;
}
partial void OnValueChanging(object? oldValue, object? newValue)
{
if (newValue == null)
{
newValue = oldValue;
return;
}
partial void OnValueChanging(object? oldValue, object? newValue)
{
if (newValue == null)
{
newValue = oldValue;
return;
}
try
{
_adsManager.WriteValue(InstancePath, newValue);
}
catch (Exception)
{
newValue = oldValue;
Debug.WriteLine("Value {0} could not be written to {1}", newValue, InstancePath);
}
}
}
public partial class SettingsPageVM : ObservableObject, IDisposable
{
public ObservableCollection<SettingsEntry> RootItem { get; private set; } = [];
private readonly IAdsManager _adsManager;
private readonly string _variableName;
public SettingsPageVM(IAdsManager adsManager, string variableName)
{
_adsManager = adsManager;
_variableName = variableName;
_adsManager.Register(_variableName, ConfigChangedEvent);
}
private void ConfigChangedEvent(object? sender, ValueChangedEventArgs e)
{
App.Current.Invoke(CreateSettingsTree);
}
private void CreateSettingsTree()
{
ISymbolLoader? symbolLoader = _adsManager.GetSymbolLoader();
if (symbolLoader == null)
return;
Symbol configSymbol = (Symbol)symbolLoader.Symbols[_variableName];
SettingsEntry entry = GetSymbol(configSymbol);
RootItem.Add(entry);
}
private SettingsEntry GetSymbol(Symbol symbol)
{
// Create Symbol
SettingsEntry entry = new(_adsManager)
{
Name = symbol.InstanceName,
InstancePath = symbol.InstancePath,
DataType = symbol.DataType?.Name
};
// Check if symbol has sub symbols
if (!symbol.IsPrimitiveType)
{
foreach (Symbol subSymbol in symbol.SubSymbols.Cast<Symbol>())
{
entry.SubEntries.Add(GetSymbol(subSymbol));
}
}
else
{
entry.Visibility = Visibility.Visible;
entry.Value = symbol.ReadValue();
}
return entry;
}
public void Dispose()
{
_adsManager?.Deregister(_variableName, ConfigChangedEvent);
}
}
try
{
_adsManager.WriteValue(InstancePath, newValue);
}
catch (Exception)
{
newValue = oldValue;
Debug.WriteLine("Value {0} could not be written to {1}", newValue, InstancePath);
}
}
}
public partial class SettingsPageVM : ObservableObject, IDisposable
{
public ObservableCollection<SettingsEntry> RootItem { get; private set; } = [];
private readonly IAdsManager _adsManager;
private readonly string _variableName;
public SettingsPageVM(IAdsManager adsManager, string variableName)
{
_adsManager = adsManager;
_variableName = variableName;
_adsManager.Register(_variableName, ConfigChangedEvent);
}
private void ConfigChangedEvent(object? sender, ValueChangedEventArgs e)
{
App.Current.Invoke(CreateSettingsTree);
}
private void CreateSettingsTree()
{
ISymbolLoader? symbolLoader = _adsManager.GetSymbolLoader();
if (symbolLoader == null)
return;
Symbol configSymbol = (Symbol)symbolLoader.Symbols[_variableName];
SettingsEntry entry = GetSymbol(configSymbol);
RootItem.Add(entry);
}
private SettingsEntry GetSymbol(Symbol symbol)
{
// Create Symbol
SettingsEntry entry = new(_adsManager)
{
Name = symbol.InstanceName,
InstancePath = symbol.InstancePath,
DataType = symbol.DataType?.Name
};
// Check if symbol has sub symbols
if (!symbol.IsPrimitiveType)
{
foreach (Symbol subSymbol in symbol.SubSymbols.Cast<Symbol>())
{
entry.SubEntries.Add(GetSymbol(subSymbol));
}
}
else
{
entry.Visibility = Visibility.Visible;
entry.Value = symbol.ReadValue();
}
return entry;
}
public void Dispose()
{
_adsManager?.Deregister(_variableName, ConfigChangedEvent);
}
}

View File

@@ -1,63 +0,0 @@
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto
###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp
###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary
###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary
###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain

View File

@@ -1,367 +0,0 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Testproject folders
AdsSessionTest/
HMI_Export/
# Mono auto generated files
mono_crash.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Oo]ut/
[Ll]og/
[Ll]ogs/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
# ASP.NET Scaffolding
ScaffoldingReadMe.txt
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Coverlet is a free, cross platform Code Coverage Tool
coverage*.json
coverage*.xml
coverage*.info
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# BeatPulse healthcheck temp database
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
# Fody - auto-generated XML schema
FodyWeavers.xsd

View File

@@ -1 +0,0 @@
{"AdsAdress":"10.103.32.50.1.1","AdsPort":851,"ReconnectIntervalMS":1000,"OnlineChangeCntVar":"TWinCAT_SystemInfoVarList._AppInfo.OnlineChangeCnt"}

View File

@@ -1,25 +0,0 @@
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

View File

@@ -1,98 +0,0 @@
# Uniper
Uniper maintenance hmi project.
# Gitflow
1. A develop branch is created from main
2. A release branch is created from develop
3. Feature branches are created from develop
4. When a feature is complete it is merged into the develop branch
5. When the release branch is done it is merged into develop and main
6. If an issue in main is detected a hotfix branch is created from main
7. Once the hotfix is complete it is merged to both develop and main
## Start new feature
```
git flow feature start feature_branch
```
oder
```
git checkout develop
git checkout -b feature_branch
```
## Finish a feature
```
git flow feature finish feature_branch
```
oder
```
git checkout develop
git merge feature_branch
```
## Making a release
```
git flow release start 0.1.0
```
oder
```
git checkout develop
git checkout -b release/0.1.0
```
## Finishing a release
```
git flow release finish '0.1.0'
```
oder
```
git checkout main
git merge release/0.1.0
```
## Starting a Hotfix
```
git flow hotfix start hotfix_branch
```
oder
```
git checkout main
git checkout -b hotfix_branch
```
## Finishing a Hotfix
```
git flow hotfix finish hotfix_branch
```
oder
```
git checkout main
git merge hotfix_branch
git checkout develop
git merge hotfix_branch
git branch -D hotfix_branch
```
## Workflow example
```
git checkout main
git checkout -b develop
git checkout -b feature_branch
# work happens on feature branch
git checkout develop
git merge feature_branch
git checkout main
git merge develop
git branch -d feature_branch
```
## Hotfix example
```
git checkout main
git checkout -b hotfix_branch
# work is done commits are added to the hotfix_branch
git checkout develop
git merge hotfix_branch
git checkout main
git merge hotfix_branch
```

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 123 KiB

View File

@@ -1,17 +0,0 @@
<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:InfineonHMI">
<Application.Resources>
<!-- MahApps Metro style themes -->
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<!-- MahApps.Metro resource dictionaries. Make sure that all file names are Case Sensitive! -->
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
<!-- Theme setting -->
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Themes/Dark.Blue.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>

View File

@@ -1,42 +0,0 @@
using System.Windows;
using Heisig.HMI.AdsManager;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using TcEventLoggerAdsProxyLib;
namespace InfineonHMI;
public partial class App : Application
{
public static IHost? AppHost { get; private set; }
public App()
{
AppHost = Host.CreateDefaultBuilder()
.ConfigureServices((hostContext, services) =>
{
services.AddSingleton<MainWindow>();
services.AddSingleton<MainWindowVM>();
services.AddSingleton<IAdsManager, AdsManager>();
services.AddSingleton<TcEventLogger>();
})
.Build();
}
protected override async void OnStartup(StartupEventArgs e)
{
await AppHost!.StartAsync();
var startupForm = AppHost.Services.GetRequiredService<MainWindow>();
startupForm.Show();
base.OnStartup(e);
}
protected override async void OnExit(ExitEventArgs e)
{
await AppHost!.StopAsync();
base.OnExit(e);
}
}

View File

@@ -1,10 +0,0 @@
using System.Windows;
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]

View File

@@ -1,127 +0,0 @@
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;
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;
}
}
}

View File

@@ -1,83 +0,0 @@
<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"
Width="Auto"
Height="Auto"
MinWidth="200">
<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" />
<Setter Property="Width" Value="100" />
</Style>
</d:DesignerProperties.DesignStyle>
<Grid Height="Auto">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="10*"/>
<RowDefinition Height="30*"/>
<RowDefinition Height="30*"/>
<RowDefinition Height="30*"/>
</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 SName, Mode=OneWay }" HorizontalAlignment="Center" FontSize="24"/>
<Grid 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="Übervoll" HorizontalAlignment="Center" FontSize="16"/>
<RadioButton Margin="5" Grid.Row="1" IsChecked="{Binding Overload}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Grid>
<Grid Grid.Column="0" Grid.Row="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="Voll" HorizontalAlignment="Center" FontSize="16"/>
<RadioButton Grid.Row="1" Margin="5" IsChecked="{Binding Full}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Grid>
<Grid Grid.Row="3">
<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="16"/>
<RadioButton Grid.Row="1" Margin="5" IsChecked="{Binding Empty}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Grid>
<Border Grid.Column="1" Grid.Row="1" Grid.RowSpan="3" BorderBrush="White" BorderThickness="1"></Border>
<Grid Grid.Column="1" Grid.Row="1" Grid.RowSpan="3">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Button x:Name="btnFill" DataContext="{Binding FillButton}" Command="{Binding ButtonClickedCommand}" IsEnabled="{Binding XRelease}" Background="{Binding IFeedback, Converter={StaticResource feedbackConverter}}" Grid.Row="0" Grid.Column="0" Content="Füllen" Margin="5" />
<Button x:Name="btnOpen" DataContext="{Binding EmptyButton}" Command="{Binding ButtonClickedCommand}" IsEnabled="{Binding XRelease}" Background="{Binding IFeedback, Converter={StaticResource feedbackConverter}}" Grid.Row="1" Grid.Column="0" Content="Leeren" Margin="5" />
</Grid>
</Grid>
</UserControl>

View File

@@ -1,32 +0,0 @@
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);
}
}
}

View File

@@ -1,76 +0,0 @@
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);
}
}

View File

@@ -1,33 +0,0 @@
<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"
Width="Auto"
Height="Auto">
<!-- :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="40" />
<Setter Property="Width" Value="280" />
</Style>
</d:DesignerProperties.DesignStyle>
<Grid Height="Auto">
<Grid.ColumnDefinitions>
<!-- <ColumnDefinition Width="Auto" /> -->
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<!-- <Label Grid.Column="0" Content="{Binding SName}" VerticalAlignment="Center" HorizontalAlignment="Left"/> -->
<Label x:Name="tbName" Grid.Column="0" Content="{Binding SName, Mode=OneWay }" Width="200"/>
<TextBox x:Name="tbValue" Text="{Binding Value, Mode=TwoWay, StringFormat=N2}" Grid.Column="1" MaxLines="1" Width="80" HorizontalContentAlignment="Right" VerticalContentAlignment="Center" IsReadOnly="{Binding Readonly}" />
</Grid>
</UserControl>

Some files were not shown because too many files have changed in this diff Show More