Add PlantSchemeWindow
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using PamhagenSysCtrl.Helpers;
|
||||
using PamhagenSysCtrl.Windows;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
@@ -51,10 +52,13 @@ namespace PamhagenSysCtrl {
|
||||
var str = $"Beim Aufbauen einer Verbindung zur SPS ist ein Fehler aufgetreten:\n\n{exc.GetType().Name}: {exc.Message}";
|
||||
if (exc.InnerException != null) str += $"\n\n{exc.InnerException.GetType().Name}: {exc.InnerException.Message}";
|
||||
MessageBox.Show(str, "SPS-Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
return;
|
||||
}
|
||||
var w = new PlantSchemeWindow();
|
||||
w.Show();
|
||||
}
|
||||
|
||||
public void OnUpdate(object? sender, EventArgs evt) {
|
||||
public void OnUpdate(object? sender, PlantEventArgs evt) {
|
||||
if (sender is not PamhagenPlant plant) return;
|
||||
|
||||
for (int i = 1; i <= 60; i++) {
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
<Window x:Class="PamhagenSysCtrl.Windows.PlantSchemeWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:PamhagenSysCtrl.Windows"
|
||||
Title="Schema - Anlagensteuerung Pamhagen" Height="450" Width="800">
|
||||
<Grid>
|
||||
<Canvas x:Name="SchemeCanvas">
|
||||
</Canvas>
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -0,0 +1,49 @@
|
||||
using PamhagenSysCtrl.Helpers;
|
||||
using PamhagenSysCtrl.Helpers.Pipeline;
|
||||
using System.Drawing;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace PamhagenSysCtrl.Windows {
|
||||
public partial class PlantSchemeWindow : Window {
|
||||
|
||||
public PlantSchemeWindow() {
|
||||
InitializeComponent();
|
||||
App.Plant?.Update += OnUpdate;
|
||||
|
||||
var graph = new Graph();
|
||||
|
||||
var mw1 = new Trough("MW1", 200, 50, () => App.Plant?.FillLevelA1 != FillState.Empty);
|
||||
var mw2 = new Trough("MW2", 50, 50, () => App.Plant?.FillLevelA1 != FillState.Empty);
|
||||
var mp1 = new Pump("MP1", 200, 80);
|
||||
var mp2 = new Pump("MP2", 50, 80);
|
||||
|
||||
var x1 = new PipeJoin(200, 100);
|
||||
var x2 = new PipeJoin(50, 100);
|
||||
|
||||
var v1 = new Valve("V1", 200, 150, () => App.Plant?.IsValveOpen(1) ?? false, () => App.Plant?.WantValveOpen(1) ?? false);
|
||||
var v2 = new Valve("V2", 50, 150, () => App.Plant?.IsValveOpen(2) ?? false, () => App.Plant?.WantValveOpen(2) ?? false);
|
||||
var v3 = new Valve("V3", 80, 150, () => App.Plant?.IsValveOpen(3) ?? false, () => App.Plant?.WantValveOpen(3) ?? false);
|
||||
var v4 = new Valve("V4", 170, 150, () => App.Plant?.IsValveOpen(4) ?? false, () => App.Plant?.WantValveOpen(4) ?? false);
|
||||
|
||||
graph.CreatePipe(mw1, mp1);
|
||||
graph.CreatePipe(mw2, mp2);
|
||||
graph.CreatePipe(mp1, x1);
|
||||
graph.CreatePipe(mp2, x2);
|
||||
graph.CreatePipe(x1, v1);
|
||||
graph.CreatePipe(x1, v4);
|
||||
graph.CreatePipe(x2, v2);
|
||||
graph.CreatePipe(x2, v3);
|
||||
|
||||
graph.Draw(SchemeCanvas);
|
||||
}
|
||||
|
||||
public void OnUpdate(object? sender, PlantEventArgs evt) {
|
||||
if (sender is not PamhagenPlant plant) return;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user