Push Changes from Techcrafters Repo
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user