From 771a0e7b6b1276087515bbe94de28358cb92963b Mon Sep 17 00:00:00 2001
From: alielie <alielie@git.com>
Date: 星期四, 04 六月 2026 10:32:27 +0800
Subject: [PATCH] 优化老化;
---
Plugin.TestResult/InfoWindow.xaml.cs | 121 ++++++++++++++++++++++++++--------------
1 files changed, 78 insertions(+), 43 deletions(-)
diff --git a/Plugin.TestResult/InfoWindow.xaml.cs b/Plugin.TestResult/InfoWindow.xaml.cs
index 58b265e..1cb75b9 100644
--- a/Plugin.TestResult/InfoWindow.xaml.cs
+++ b/Plugin.TestResult/InfoWindow.xaml.cs
@@ -1,14 +1,9 @@
-锘縰sing HMI.Core.Api;
-using HMI.Core.Entity;
-using HMI.Core.Manager;
-using HMI.Core.Util;
+锘縰sing HMI.Core.Util;
using HMI.UI.Util;
using Panuon.WPF.UI;
using Plugin.TestResult_WPF.Model;
using System;
-using System.Collections.Generic;
using System.Collections.ObjectModel;
-using System.Linq;
using System.Windows;
using System.Windows.Controls;
@@ -34,41 +29,72 @@
get => _dataSource == null ? new ObservableCollection<Info>() : _dataSource;
set => Set(ref _dataSource, value);
}
- private Chart electricChart;
- public InfoWindow(string title, ObservableCollection<Info> infos, Chart electricChart, int probeCount)
+ private LiveChart waterChart;
+ private LiveChart electricChart;
+ private LiveChart vChart;
+
+ //public InfoWindow(string title, ObservableCollection<Info> infos, Chart waterChart, Chart electricChart, Chart vChart, int probeCount, int probeWarn)
+ //{
+ // this.title = title;
+ // this.dataSource = infos;
+ // DataContext = this;
+ // Topmost = false;
+ // this.ProbeWarn = probeWarn;
+ // InitializeComponent();
+
+
+ // UpdateProbeCount(probeCount,probeWarn);
+
+ // if (waterChart != null)
+ // {
+ // this.waterChart = waterChart;
+ // mainGrid.Children.Add(waterChart);
+ // Grid.SetRow(waterChart, 1);
+ // }
+
+ // this.electricChart = electricChart;
+ // mainGrid.Children.Add(electricChart);
+ // Grid.SetRow(electricChart, 2);
+
+
+ // this.vChart = vChart;
+ // mainGrid.Children.Add(vChart);
+ // Grid.SetRow(vChart, 3);
+ //}
+
+ public InfoWindow(string title, ObservableCollection<Info> infos, LiveChart[] charts, int probeCount, int probeWarn)
{
this.title = title;
this.dataSource = infos;
DataContext = this;
Topmost = false;
+ this.ProbeWarn = probeWarn;
InitializeComponent();
- if (AlarmProbeCount < 0)
- {
- alarmLabel.Visibility = Visibility.Collapsed;
- alarmValue.Visibility = Visibility.Collapsed;
- }
- UpdateProbeCount(probeCount);
- this.electricChart = electricChart;
- mainGrid.Children.Add(electricChart);
- Grid.SetRow(electricChart, 1);
- }
+ UpdateProbeCount(probeCount, probeWarn);
+ int row = 1;
+ foreach (var chart in charts)
+ {
+ if (chart == null) return;
+ mainGrid.Children.Add(chart);
+ Grid.SetRow(chart, row++);
+ }
- private static int AlarmProbeCount;
- static InfoWindow()
- {
- int probeWarn = -1;
- try
- {
- probeWarn = Convert.ToInt32(ParameterManager.GetCommonParameter<List<ParameterData>>()
- .FirstOrDefault(x => x.Name == "ProbeWarn")?.Value);
- }
- catch (Exception ex)
- {
- probeWarn = -1;
- }
- AlarmProbeCount = probeWarn;
+ //if (waterChart != null)
+ //{
+ // this.waterChart = waterChart;
+ // mainGrid.Children.Add(waterChart);
+ // Grid.SetRow(waterChart, 1);
+ //}
+
+ //this.electricChart = electricChart;
+ //mainGrid.Children.Add(electricChart);
+ //Grid.SetRow(electricChart, 2);
+
+ //this.vChart = vChart;
+ //mainGrid.Children.Add(vChart);
+ //Grid.SetRow(vChart, 3);
}
public event EventHandler ClearProbeCountEvent;
@@ -85,21 +111,28 @@
public int ProbeWarn
{
- get => AlarmProbeCount;
- set { }
+ get;
+ set;
}
- public void UpdateProbeCount(int count)
+
+ public void UpdateProbeCount(int count, int warn)
{
Dispatcher.Invoke(() =>
{
ProbeCount = count;
- if (AlarmProbeCount >= 0)
+ ProbeWarn = warn;
+
+ if (ProbeWarn < 0)
{
- probeCountAlarm.Visibility = (ProbeCount >= AlarmProbeCount) ? Visibility.Visible : Visibility.Collapsed;
+ alarmLabel.Visibility = Visibility.Collapsed;
+ alarmValue.Visibility = Visibility.Collapsed;
+ }
+ else
+ {
+ probeCountAlarm.Visibility = (ProbeCount >= ProbeWarn) ? Visibility.Visible : Visibility.Collapsed;
}
});
}
-
public void UpdateSource(ObservableCollection<Info> infos)
{
@@ -118,22 +151,24 @@
protected override void OnClosed(EventArgs e)
{
+ waterChart = null;
electricChart = null;
+ vChart = null;
mainGrid.Children.Clear();
base.OnClosed(e);
}
private void Window_SizeChanged(object sender, SizeChangedEventArgs e)
{
- if (electricChart != null)
- {
- electricChart.Height = this.ActualHeight * 0.3;
- }
+ //if (electricChart != null)
+ //{
+ // electricChart.Height = this.ActualHeight * 0.3;
+ //}
}
private void Button_Click(object sender, RoutedEventArgs e)
{
- if (MsgBoxHelper.WarnMessage(this, "纭畾瑕佹竻绌烘帰閽堜娇鐢ㄦ鏁板悧锛�") == MessageBoxResult.OK)
+ if (MsgBoxHelper.WarnMessage(this, this.lang("Ts.MakeSureToClearProbeCount")) == MessageBoxResult.OK)
{
ClearProbeCountEvent?.Invoke(this, null);
}
--
Gitblit v1.9.1