From 330002911a64ea58d6834b64228870228eb75391 Mon Sep 17 00:00:00 2001 From: qin <a@163.com> Date: 星期四, 20 三月 2025 16:12:33 +0800 Subject: [PATCH] Merge branch 'master' of http://47.103.154.90:83/r/HStation/XHS.V1.0 --- WinFrmUI/IBox.WinFrmUI/Form/IBoxFormDataFilter.cs | 140 +++++++++++++++++++++++++++------------------- 1 files changed, 82 insertions(+), 58 deletions(-) diff --git a/WinFrmUI/IBox.WinFrmUI/Form/IBoxFormDataFilter.cs b/WinFrmUI/IBox.WinFrmUI/Form/IBoxFormDataFilter.cs index 7c5a354..b634d6e 100644 --- a/WinFrmUI/IBox.WinFrmUI/Form/IBoxFormDataFilter.cs +++ b/WinFrmUI/IBox.WinFrmUI/Form/IBoxFormDataFilter.cs @@ -1,5 +1,6 @@ 锘縰sing DevExpress.XtraCharts; using DevExpress.XtraEditors; +using DevExpress.XtraLayout; using System.IO; using System.Text; using Yw; @@ -9,11 +10,6 @@ { public partial class IBoxFormDataFilter : DocumentPage { - private string startCode = "[&start&]"; - private string endCode = "[&end&]"; - private string paramCode = "[¶m&]"; - private string getfilterCode = "getfilter"; - private string savefilterCode = "savefilter"; public IBoxFormDataFilter() { InitializeComponent(); @@ -21,35 +17,64 @@ InitChart(); } - - private void SetOrder(string order) + public void HideButton() { - var smsg = order.Split(new string[] { paramCode }, StringSplitOptions.RemoveEmptyEntries); - if (smsg.Length < 2) - { - return; - } - - switch (smsg[0].Trim()) - { - case "datadownload": - //WaitFrmHelper.HideWaitForm(); - break; - } + //simpleButton1.Visible = simpleButton2.Visible = simpleButton3.Visible = simpleButton4.Visible = false; + layoutControlItem7.Visibility = layoutControlItem9.Visibility = layoutControlItem8.Visibility = layoutControlItem3.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; } private void EboxFormDataFilter_Load(object sender, EventArgs e) { - SendText(startCode + getfilterCode + paramCode + endCode); + SendText(IBoxHelper.startCode + IBoxHelper.getfilterCode + IBoxHelper.paramCode + IBoxHelper.endCode); } public event EventHandler<string> SendData; + private void SendText(string content) { - //BluetoothHelper.GetInstance().SendData(content); - SendData?.Invoke(null, content); + if (SendData != null) + { + SendData?.Invoke(null, content); + } + else + { + if (IBoxHelper.Ping()) + { + var smsg = content.Split(new string[] { IBoxHelper.paramCode, IBoxHelper.startCode }, StringSplitOptions.RemoveEmptyEntries); + if (smsg.Length < 2) + { + return; + } + switch (smsg[0].Trim()) + { + case IBoxHelper.getfilterCode: + { + var order = IBoxHelper.HttpGet(content); + var result = IBoxHelper.GetContent(order); + if (!string.IsNullOrEmpty(result)) + { + var model = JsonHelper.Json2Object<IBoxFilterViewModel>(result); + BindData(model, false); + } + break; + } + default: + IBoxHelper.HttpGet(content); + break; + } + } + else + { + MessageBoxHelper.ShowWarning("缃戠粶杩炴帴澶辫触锛岃妫�鏌ョ綉缁�"); + } + } } + /// <summary> + /// 缁戝畾鏁版嵁 + /// </summary> + /// <param name="model"></param> + /// <param name="isBlue"></param> public void BindData(IBoxFilterViewModel model, bool isBlue) { this.model = model; @@ -57,10 +82,11 @@ checkEditIsPress.Checked = model.IsPressFilter; imageComboBoxEdit1_SelectedIndexChanged(null, null); } + private Series _seriesOld, _seriesNew; - List<TimeValue> timeValuesOld_csv = new List<TimeValue>(); - List<TimeValue> timeValuesNew_csv = new List<TimeValue>(); - FilterKalman filterKalman = null; + private List<TimeValue> timeValuesOld_csv = new List<TimeValue>(); + private List<TimeValue> timeValuesNew_csv = new List<TimeValue>(); + private FilterKalman filterKalman = null; private void InitChart() { @@ -81,10 +107,9 @@ diag.ZoomingOptions.ZoomInMouseAction.ModifierKeys = ChartModifierKeys.None; diag.EnableAxisXZooming = true; diag.EnableAxisXScrolling = true; - } - private void ClearChart() + public void ClearChart() { this.chartControl1.BeginInit(); @@ -131,14 +156,22 @@ }; } } + private void simpleButton2_Click_1(object sender, EventArgs e) + { + ReSet(); + } + + /// <summary> + /// 淇j + /// </summary> + public void ReSet() { var isControlInput = checkEditIsControlInput.Checked; var RValue = double.Parse(textEditRValue.Text); var QValue = double.Parse(textEditQValue.Text); var AValue = double.Parse(textEditAValue.Text); var HValue = double.Parse(textEditHValue.Text); - SetValue(); @@ -162,40 +195,20 @@ //_seriesNew.BindToData(timeValuesNew_csv, "Time", "Value"); this.chartControl1.EndInit(); } - IBoxFilterViewModel model = new IBoxFilterViewModel(); + + private IBoxFilterViewModel model = new IBoxFilterViewModel(); + private void simpleButton4_Click(object sender, EventArgs e) { + Save(); + } + public void Save() + { model.IsFlowFilter = checkEditIsFlow.Checked; model.IsPressFilter = checkEditIsPress.Checked; SetValue(); - //var uv= imageComboBoxEdit1.EditValue.ToString(); - //if (model.IsFlowFilter) - //{ - // model.FlowFilterConfig = new EboxFilterConfigViewModel() - // { - // IsControlInput = checkEditIsControlInput.Checked, - // RValue = double.Parse(textEditRValue.Text), - // QValue = double.Parse(textEditQValue.Text), - // AValue = double.Parse(textEditAValue.Text), - // HValue = double.Parse(textEditHValue.Text), - // ControlInputValue = double.Parse(textEditControlInputValue.Text) - // }; - //} - //if (model.IsPressFilter) - //{ - // model.PressFilterConfig = new EboxFilterConfigViewModel() - // { - // IsControlInput = checkEditIsControlInput.Checked, - // RValue = double.Parse(textEditRValue.Text), - // QValue = double.Parse(textEditQValue.Text), - // AValue = double.Parse(textEditAValue.Text), - // HValue = double.Parse(textEditHValue.Text), - // ControlInputValue = double.Parse(textEditControlInputValue.Text) - // }; - //} - - SendText(startCode + savefilterCode + paramCode + JsonHelper.Object2Json(model) + endCode); + SendText(IBoxHelper.startCode + IBoxHelper.savefilterCode + IBoxHelper.paramCode + JsonHelper.Object2Json(model) + IBoxHelper.endCode); MessageBoxHelper.ShowInfo("淇濆瓨鎴愬姛"); } @@ -217,6 +230,7 @@ checkEditIsControlInput.Checked = model.FlowFilterConfig.IsControlInput; } break; + case "Press": if (model.PressFilterConfig != null) { @@ -234,7 +248,16 @@ private void simpleButton1_Click(object sender, EventArgs e) { + Import(); + } + + /// <summary> + /// 瀵煎叆 + /// </summary> + public void Import() + { #region Load + ClearChart(); var dlg = new OpenFileDialog(); @@ -270,11 +293,11 @@ continue; var timeValue = new TimeValue(time, value); timeValuesOld_csv.Add(timeValue); - } } } break; + default: { WaitFormHelper.HideWaitForm(); @@ -284,7 +307,8 @@ break; } WaitFormHelper.HideWaitForm(); - #endregion + + #endregion Load if (timeValuesOld_csv.Count < 1) { -- Gitblit v1.9.3