WinFrmUI/HStation.WinFrmUI.Assets.Core/20-exchanger/04-curveql/AssetsExchangerCurveQLMgrPage.cs
@@ -24,8 +24,6 @@ this.phartDiagramRelationListCtrl1.SelectedChangedEvent += PhartDiagramRelationListCtrl1_SelectedChangedEvent; } private AssetsExchangerMainVmo _vmo = null; private List<PhartDiagramRelationVmo> _allBindingList = null; private PhartDiagramRelationVmo _relation = null; @@ -51,19 +49,27 @@ //excel private void Excel() { if (_vmo == null) { return; } var dlg = new ImportAssetsExchangerCurveQLByExcelDlg(); dlg.ReloadDataEvent += (rhs) => { _allBindingList.Add(rhs); this.phartDiagramRelationListCtrl1.SetBindingData(_allBindingList); }; dlg.SetBindingData(); dlg.SetBindingData(_vmo); dlg.ShowDialog(); } //图片 private void Picture() { if (_vmo == null) { return; } var vm = GetCurrentViewModel(); if (vm == null) { @@ -75,7 +81,7 @@ _allBindingList.Add(rhs); this.phartDiagramRelationListCtrl1.SetBindingData(_allBindingList); }; dlg.SetBindingData(); dlg.SetBindingData(_vmo); dlg.ShowDialog(); } WinFrmUI/HStation.WinFrmUI.Assets.Core/20-exchanger/04-curveql/EditAssetsExchangerCurveQLDlg.Designer.cs
@@ -34,9 +34,11 @@ Root = new DevExpress.XtraLayout.LayoutControlGroup(); layoutControlItem1 = new DevExpress.XtraLayout.LayoutControlItem(); layoutControlItem2 = new DevExpress.XtraLayout.LayoutControlItem(); universalChartEditCtrl1 = new UniversalChartEditCtrl(); ((ISupportInitialize)layoutControl1).BeginInit(); layoutControl1.SuspendLayout(); ((ISupportInitialize)panelControl1).BeginInit(); panelControl1.SuspendLayout(); ((ISupportInitialize)Root).BeginInit(); ((ISupportInitialize)layoutControlItem1).BeginInit(); ((ISupportInitialize)layoutControlItem2).BeginInit(); @@ -67,6 +69,7 @@ // // panelControl1 // panelControl1.Controls.Add(universalChartEditCtrl1); panelControl1.Location = new Point(12, 12); panelControl1.Name = "panelControl1"; panelControl1.Size = new Size(874, 498); @@ -99,6 +102,15 @@ layoutControlItem2.TextSize = new Size(0, 0); layoutControlItem2.TextVisible = false; // // universalChartEditCtrl1 // universalChartEditCtrl1.Dock = DockStyle.Fill; universalChartEditCtrl1.Location = new Point(2, 2); universalChartEditCtrl1.Margin = new Padding(2, 2, 2, 2); universalChartEditCtrl1.Name = "universalChartEditCtrl1"; universalChartEditCtrl1.Size = new Size(870, 494); universalChartEditCtrl1.TabIndex = 0; // // EditAssetsExchangerCurveQLDlg // AutoScaleDimensions = new SizeF(7F, 14F); @@ -111,6 +123,7 @@ ((ISupportInitialize)layoutControl1).EndInit(); layoutControl1.ResumeLayout(false); ((ISupportInitialize)panelControl1).EndInit(); panelControl1.ResumeLayout(false); ((ISupportInitialize)Root).EndInit(); ((ISupportInitialize)layoutControlItem1).EndInit(); ((ISupportInitialize)layoutControlItem2).EndInit(); @@ -125,5 +138,6 @@ private DevExpress.XtraLayout.LayoutControlGroup Root; private DevExpress.XtraLayout.LayoutControlItem layoutControlItem1; private DevExpress.XtraLayout.LayoutControlItem layoutControlItem2; private UniversalChartEditCtrl universalChartEditCtrl1; } } WinFrmUI/HStation.WinFrmUI.Assets.Core/20-exchanger/04-curveql/EditAssetsExchangerCurveQLDlg.cs
@@ -41,17 +41,25 @@ return; } _vmo = vmo; this.universalChartEditCtrl1.SetBindingData(vmo); } //确定 private void GeneralOkAndCancelCtrl1_OkEvent() private async void GeneralOkAndCancelCtrl1_OkEvent() { if (_vmo == null) { return; } this.ReloadDataEvent?.Invoke(_vmo); var diagram = this.universalChartEditCtrl1.Get(); var bol = await BLLFactory<Yw.BLL.PhartDiagramExtensions>.Instance.Update(diagram); if (!bol) { TipFormHelper.ShowError("更新失败!"); return; } var vmo = await BLLFactory<Yw.BLL.PhartDiagramExtensions>.Instance.GetByID(diagram.ID); this.ReloadDataEvent?.Invoke(vmo); this.DialogResult = DialogResult.OK; this.Close(); } WinFrmUI/HStation.WinFrmUI.Assets.Core/20-exchanger/04-curveql/ImportAssetsExchangerCurveQLByExcelDlg.Designer.cs
@@ -28,13 +28,15 @@ /// </summary> private void InitializeComponent() { components = new Container(); layoutControl1 = new DevExpress.XtraLayout.LayoutControl(); btnTemplate = new DevExpress.XtraEditors.SimpleButton(); textEdit2 = new DevExpress.XtraEditors.TextEdit(); textEdit1 = new DevExpress.XtraEditors.TextEdit(); txtImportance = new DevExpress.XtraEditors.TextEdit(); txtName = new DevExpress.XtraEditors.TextEdit(); btnEditExcel = new DevExpress.XtraEditors.ButtonEdit(); generalOkAndCancelCtrl1 = new GeneralOkAndCancelCtrl(); panelControl1 = new DevExpress.XtraEditors.PanelControl(); universalChartExcelImportCtrl1 = new UniversalChartExcelImportCtrl(); Root = new DevExpress.XtraLayout.LayoutControlGroup(); layoutControlItem1 = new DevExpress.XtraLayout.LayoutControlItem(); layoutControlItem2 = new DevExpress.XtraLayout.LayoutControlItem(); @@ -43,12 +45,14 @@ layoutControlItem5 = new DevExpress.XtraLayout.LayoutControlItem(); emptySpaceItem1 = new DevExpress.XtraLayout.EmptySpaceItem(); layoutControlItem6 = new DevExpress.XtraLayout.LayoutControlItem(); dxErrorProvider1 = new DevExpress.XtraEditors.DXErrorProvider.DXErrorProvider(components); ((ISupportInitialize)layoutControl1).BeginInit(); layoutControl1.SuspendLayout(); ((ISupportInitialize)textEdit2.Properties).BeginInit(); ((ISupportInitialize)textEdit1.Properties).BeginInit(); ((ISupportInitialize)txtImportance.Properties).BeginInit(); ((ISupportInitialize)txtName.Properties).BeginInit(); ((ISupportInitialize)btnEditExcel.Properties).BeginInit(); ((ISupportInitialize)panelControl1).BeginInit(); panelControl1.SuspendLayout(); ((ISupportInitialize)Root).BeginInit(); ((ISupportInitialize)layoutControlItem1).BeginInit(); ((ISupportInitialize)layoutControlItem2).BeginInit(); @@ -57,13 +61,14 @@ ((ISupportInitialize)layoutControlItem5).BeginInit(); ((ISupportInitialize)emptySpaceItem1).BeginInit(); ((ISupportInitialize)layoutControlItem6).BeginInit(); ((ISupportInitialize)dxErrorProvider1).BeginInit(); SuspendLayout(); // // layoutControl1 // layoutControl1.Controls.Add(btnTemplate); layoutControl1.Controls.Add(textEdit2); layoutControl1.Controls.Add(textEdit1); layoutControl1.Controls.Add(txtImportance); layoutControl1.Controls.Add(txtName); layoutControl1.Controls.Add(btnEditExcel); layoutControl1.Controls.Add(generalOkAndCancelCtrl1); layoutControl1.Controls.Add(panelControl1); @@ -87,25 +92,25 @@ btnTemplate.TabIndex = 7; btnTemplate.Text = "模板"; // // textEdit2 // txtImportance // textEdit2.Location = new Point(644, 13); textEdit2.Name = "textEdit2"; textEdit2.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.False; textEdit2.Properties.EditFormat.FormatString = "N0"; textEdit2.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric; textEdit2.Properties.MaskSettings.Set("MaskManagerType", typeof(DevExpress.Data.Mask.NumericMaskManager)); textEdit2.Size = new Size(78, 20); textEdit2.StyleController = layoutControl1; textEdit2.TabIndex = 6; txtImportance.Location = new Point(644, 13); txtImportance.Name = "txtImportance"; txtImportance.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.False; txtImportance.Properties.EditFormat.FormatString = "N0"; txtImportance.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric; txtImportance.Properties.MaskSettings.Set("MaskManagerType", typeof(DevExpress.Data.Mask.NumericMaskManager)); txtImportance.Size = new Size(78, 20); txtImportance.StyleController = layoutControl1; txtImportance.TabIndex = 6; // // textEdit1 // txtName // textEdit1.Location = new Point(444, 13); textEdit1.Name = "textEdit1"; textEdit1.Size = new Size(128, 20); textEdit1.StyleController = layoutControl1; textEdit1.TabIndex = 5; txtName.Location = new Point(444, 13); txtName.Name = "txtName"; txtName.Size = new Size(128, 20); txtName.StyleController = layoutControl1; txtName.TabIndex = 5; // // btnEditExcel // @@ -130,10 +135,20 @@ // // panelControl1 // panelControl1.Controls.Add(universalChartExcelImportCtrl1); panelControl1.Location = new Point(12, 38); panelControl1.Name = "panelControl1"; panelControl1.Size = new Size(1038, 465); panelControl1.TabIndex = 4; // // universalChartExcelImportCtrl1 // universalChartExcelImportCtrl1.Dock = DockStyle.Fill; universalChartExcelImportCtrl1.Location = new Point(2, 2); universalChartExcelImportCtrl1.Margin = new Padding(2, 2, 2, 2); universalChartExcelImportCtrl1.Name = "universalChartExcelImportCtrl1"; universalChartExcelImportCtrl1.Size = new Size(1034, 461); universalChartExcelImportCtrl1.TabIndex = 0; // // Root // @@ -177,7 +192,7 @@ // layoutControlItem4 // layoutControlItem4.ContentVertAlignment = DevExpress.Utils.VertAlignment.Center; layoutControlItem4.Control = textEdit1; layoutControlItem4.Control = txtName; layoutControlItem4.Location = new Point(364, 0); layoutControlItem4.MaxSize = new Size(200, 24); layoutControlItem4.MinSize = new Size(200, 24); @@ -190,7 +205,7 @@ // layoutControlItem5 // layoutControlItem5.ContentVertAlignment = DevExpress.Utils.VertAlignment.Center; layoutControlItem5.Control = textEdit2; layoutControlItem5.Control = txtImportance; layoutControlItem5.Location = new Point(564, 0); layoutControlItem5.MaxSize = new Size(150, 24); layoutControlItem5.MinSize = new Size(150, 24); @@ -221,6 +236,10 @@ layoutControlItem6.TextSize = new Size(0, 0); layoutControlItem6.TextVisible = false; // // dxErrorProvider1 // dxErrorProvider1.ContainerControl = this; // // ImportAssetsExchangerCurveQLByExcelDlg // AutoScaleDimensions = new SizeF(7F, 14F); @@ -232,10 +251,11 @@ Text = "通过Excel导入"; ((ISupportInitialize)layoutControl1).EndInit(); layoutControl1.ResumeLayout(false); ((ISupportInitialize)textEdit2.Properties).EndInit(); ((ISupportInitialize)textEdit1.Properties).EndInit(); ((ISupportInitialize)txtImportance.Properties).EndInit(); ((ISupportInitialize)txtName.Properties).EndInit(); ((ISupportInitialize)btnEditExcel.Properties).EndInit(); ((ISupportInitialize)panelControl1).EndInit(); panelControl1.ResumeLayout(false); ((ISupportInitialize)Root).EndInit(); ((ISupportInitialize)layoutControlItem1).EndInit(); ((ISupportInitialize)layoutControlItem2).EndInit(); @@ -244,6 +264,7 @@ ((ISupportInitialize)layoutControlItem5).EndInit(); ((ISupportInitialize)emptySpaceItem1).EndInit(); ((ISupportInitialize)layoutControlItem6).EndInit(); ((ISupportInitialize)dxErrorProvider1).EndInit(); ResumeLayout(false); } @@ -258,11 +279,13 @@ private DevExpress.XtraLayout.LayoutControlItem layoutControlItem2; private DevExpress.XtraLayout.LayoutControlItem layoutControlItem3; private DevExpress.XtraEditors.SimpleButton btnTemplate; private DevExpress.XtraEditors.TextEdit textEdit2; private DevExpress.XtraEditors.TextEdit textEdit1; private DevExpress.XtraEditors.TextEdit txtImportance; private DevExpress.XtraEditors.TextEdit txtName; private DevExpress.XtraLayout.LayoutControlItem layoutControlItem4; private DevExpress.XtraLayout.LayoutControlItem layoutControlItem5; private DevExpress.XtraLayout.EmptySpaceItem emptySpaceItem1; private DevExpress.XtraLayout.LayoutControlItem layoutControlItem6; private UniversalChartExcelImportCtrl universalChartExcelImportCtrl1; private DevExpress.XtraEditors.DXErrorProvider.DXErrorProvider dxErrorProvider1; } } WinFrmUI/HStation.WinFrmUI.Assets.Core/20-exchanger/04-curveql/ImportAssetsExchangerCurveQLByExcelDlg.cs
@@ -1,4 +1,6 @@ using DevExpress.XtraEditors; using DevExpress.XtraSpreadsheet.Model; using HStation.Vmo; using System; using System.Collections.Generic; using System.ComponentModel; @@ -8,6 +10,7 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using Yw; namespace HStation.WinFrmUI { @@ -26,22 +29,68 @@ /// </summary> public event Action<HStation.Vmo.PhartDiagramRelationVmo> ReloadDataEvent; //进:FilePath, PhartRelation.eGraphType, // 出:PhartDiagramExGraphListVmo private AssetsExchangerMainVmo _exchanger = null; private PhartDiagramRelationVmo _vmo = null; /// <summary> /// /// </summary> public void SetBindingData() public void SetBindingData(AssetsExchangerMainVmo exchanger) { if (exchanger == null) { return; } _exchanger = exchanger; _vmo = new PhartDiagramRelationVmo(); _vmo.ObjectType = HStation.Assets.DataType.ExchangerMain; _vmo.ObjectID = exchanger.ID; _vmo.Importance = 0; this.txtImportance.EditValue = 0; } private bool Valid() { this.dxErrorProvider1.ClearErrors(); if (string.IsNullOrEmpty(this.btnEditExcel.Text.Trim())) { this.dxErrorProvider1.SetError(this.btnEditExcel, "必选项"); return false; } if (string.IsNullOrEmpty(this.txtName.Text.Trim())) { this.dxErrorProvider1.SetError(this.txtName, "必填项"); return false; } return true; } //确定 private void GeneralOkAndCancelCtrl1_OkEvent() private async void GeneralOkAndCancelCtrl1_OkEvent() { this.ReloadDataEvent?.Invoke(null); if (!Valid()) { return; } var diagram = this.universalChartExcelImportCtrl1.Get(); var diagramId = await BLLFactory<Yw.BLL.PhartDiagramExtensions>.Instance.Insert(diagram); if (diagramId < 1) { TipFormHelper.ShowError("图表信息保存失败!"); return; } _vmo.DiagramID = diagramId; _vmo.OtherName = this.txtName.Text.Trim(); _vmo.Importance = int.Parse(this.txtImportance.EditValue.ToString()); _vmo.ID = await BLLFactory<HStation.BLL.PhartDiagramRelation>.Instance.Insert(_vmo); if (_vmo.ID < 1) { TipFormHelper.ShowError("图表关联信息保存失败!"); return; } var vmo = await BLLFactory<HStation.BLL.PhartDiagramRelation>.Instance.GetByID(_vmo.ID); this.ReloadDataEvent?.Invoke(vmo); this.DialogResult = DialogResult.OK; this.Close(); } @@ -56,6 +105,7 @@ { var fileName = dlg.FileName; this.btnEditExcel.EditValue = fileName; this.universalChartExcelImportCtrl1.SetBindingData(fileName, Yw.Ahart.eCurveType.QL); } } WinFrmUI/HStation.WinFrmUI.Assets.Core/20-exchanger/04-curveql/ImportAssetsExchangerCurveQLByExcelDlg.resx
@@ -117,4 +117,7 @@ <resheader name="writer"> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> <metadata name="dxErrorProvider1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>17, 17</value> </metadata> </root> WinFrmUI/HStation.WinFrmUI.Assets.Core/20-exchanger/04-curveql/ImportAssetsExchangerCurveQLByPictureDlg.Designer.cs
@@ -28,10 +28,11 @@ /// </summary> private void InitializeComponent() { components = new Container(); layoutControl1 = new DevExpress.XtraLayout.LayoutControl(); btnTemplate = new DevExpress.XtraEditors.SimpleButton(); textEdit2 = new DevExpress.XtraEditors.TextEdit(); textEdit1 = new DevExpress.XtraEditors.TextEdit(); txtImportance = new DevExpress.XtraEditors.TextEdit(); txtName = new DevExpress.XtraEditors.TextEdit(); btnEditPicture = new DevExpress.XtraEditors.ButtonEdit(); generalOkAndCancelCtrl1 = new GeneralOkAndCancelCtrl(); panelControl1 = new DevExpress.XtraEditors.PanelControl(); @@ -43,12 +44,15 @@ layoutControlItem5 = new DevExpress.XtraLayout.LayoutControlItem(); emptySpaceItem1 = new DevExpress.XtraLayout.EmptySpaceItem(); layoutControlItem6 = new DevExpress.XtraLayout.LayoutControlItem(); dxErrorProvider1 = new DevExpress.XtraEditors.DXErrorProvider.DXErrorProvider(components); universalChartImageImportCtrl1 = new UniversalChartImageImportCtrl(); ((ISupportInitialize)layoutControl1).BeginInit(); layoutControl1.SuspendLayout(); ((ISupportInitialize)textEdit2.Properties).BeginInit(); ((ISupportInitialize)textEdit1.Properties).BeginInit(); ((ISupportInitialize)txtImportance.Properties).BeginInit(); ((ISupportInitialize)txtName.Properties).BeginInit(); ((ISupportInitialize)btnEditPicture.Properties).BeginInit(); ((ISupportInitialize)panelControl1).BeginInit(); panelControl1.SuspendLayout(); ((ISupportInitialize)Root).BeginInit(); ((ISupportInitialize)layoutControlItem1).BeginInit(); ((ISupportInitialize)layoutControlItem2).BeginInit(); @@ -57,13 +61,14 @@ ((ISupportInitialize)layoutControlItem5).BeginInit(); ((ISupportInitialize)emptySpaceItem1).BeginInit(); ((ISupportInitialize)layoutControlItem6).BeginInit(); ((ISupportInitialize)dxErrorProvider1).BeginInit(); SuspendLayout(); // // layoutControl1 // layoutControl1.Controls.Add(btnTemplate); layoutControl1.Controls.Add(textEdit2); layoutControl1.Controls.Add(textEdit1); layoutControl1.Controls.Add(txtImportance); layoutControl1.Controls.Add(txtName); layoutControl1.Controls.Add(btnEditPicture); layoutControl1.Controls.Add(generalOkAndCancelCtrl1); layoutControl1.Controls.Add(panelControl1); @@ -87,30 +92,30 @@ btnTemplate.TabIndex = 7; btnTemplate.Text = "模板"; // // textEdit2 // txtImportance // textEdit2.Location = new Point(640, 13); textEdit2.Name = "textEdit2"; textEdit2.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.False; textEdit2.Properties.EditFormat.FormatString = "N0"; textEdit2.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric; textEdit2.Properties.MaskSettings.Set("MaskManagerType", typeof(DevExpress.Data.Mask.NumericMaskManager)); textEdit2.Size = new Size(82, 20); textEdit2.StyleController = layoutControl1; textEdit2.TabIndex = 6; txtImportance.Location = new Point(640, 13); txtImportance.Name = "txtImportance"; txtImportance.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.False; txtImportance.Properties.EditFormat.FormatString = "N0"; txtImportance.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric; txtImportance.Properties.MaskSettings.Set("MaskManagerType", typeof(DevExpress.Data.Mask.NumericMaskManager)); txtImportance.Size = new Size(82, 20); txtImportance.StyleController = layoutControl1; txtImportance.TabIndex = 6; // // textEdit1 // txtName // textEdit1.Location = new Point(440, 13); textEdit1.Name = "textEdit1"; textEdit1.Size = new Size(132, 20); textEdit1.StyleController = layoutControl1; textEdit1.TabIndex = 5; txtName.Location = new Point(440, 13); txtName.Name = "txtName"; txtName.Size = new Size(132, 20); txtName.StyleController = layoutControl1; txtName.TabIndex = 5; // // btnEditExcel // btnEditPicture // btnEditPicture.Location = new Point(76, 13); btnEditPicture.Name = "btnEditExcel"; btnEditPicture.Name = "btnEditPicture"; btnEditPicture.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { new DevExpress.XtraEditors.Controls.EditorButton() }); btnEditPicture.Size = new Size(296, 20); btnEditPicture.StyleController = layoutControl1; @@ -130,6 +135,7 @@ // // panelControl1 // panelControl1.Controls.Add(universalChartImageImportCtrl1); panelControl1.Location = new Point(12, 38); panelControl1.Name = "panelControl1"; panelControl1.Size = new Size(1038, 465); @@ -177,7 +183,7 @@ // layoutControlItem4 // layoutControlItem4.ContentVertAlignment = DevExpress.Utils.VertAlignment.Center; layoutControlItem4.Control = textEdit1; layoutControlItem4.Control = txtName; layoutControlItem4.Location = new Point(364, 0); layoutControlItem4.MaxSize = new Size(200, 24); layoutControlItem4.MinSize = new Size(200, 24); @@ -190,7 +196,7 @@ // layoutControlItem5 // layoutControlItem5.ContentVertAlignment = DevExpress.Utils.VertAlignment.Center; layoutControlItem5.Control = textEdit2; layoutControlItem5.Control = txtImportance; layoutControlItem5.Location = new Point(564, 0); layoutControlItem5.MaxSize = new Size(150, 24); layoutControlItem5.MinSize = new Size(150, 24); @@ -221,6 +227,19 @@ layoutControlItem6.TextSize = new Size(0, 0); layoutControlItem6.TextVisible = false; // // dxErrorProvider1 // dxErrorProvider1.ContainerControl = this; // // universalChartImageImportCtrl1 // universalChartImageImportCtrl1.Dock = DockStyle.Fill; universalChartImageImportCtrl1.Location = new Point(2, 2); universalChartImageImportCtrl1.Margin = new Padding(2, 2, 2, 2); universalChartImageImportCtrl1.Name = "universalChartImageImportCtrl1"; universalChartImageImportCtrl1.Size = new Size(1034, 461); universalChartImageImportCtrl1.TabIndex = 0; // // ImportAssetsExchangerCurveQLByPictureDlg // AutoScaleDimensions = new SizeF(7F, 14F); @@ -232,10 +251,11 @@ Text = "通过图片导入"; ((ISupportInitialize)layoutControl1).EndInit(); layoutControl1.ResumeLayout(false); ((ISupportInitialize)textEdit2.Properties).EndInit(); ((ISupportInitialize)textEdit1.Properties).EndInit(); ((ISupportInitialize)txtImportance.Properties).EndInit(); ((ISupportInitialize)txtName.Properties).EndInit(); ((ISupportInitialize)btnEditPicture.Properties).EndInit(); ((ISupportInitialize)panelControl1).EndInit(); panelControl1.ResumeLayout(false); ((ISupportInitialize)Root).EndInit(); ((ISupportInitialize)layoutControlItem1).EndInit(); ((ISupportInitialize)layoutControlItem2).EndInit(); @@ -244,6 +264,7 @@ ((ISupportInitialize)layoutControlItem5).EndInit(); ((ISupportInitialize)emptySpaceItem1).EndInit(); ((ISupportInitialize)layoutControlItem6).EndInit(); ((ISupportInitialize)dxErrorProvider1).EndInit(); ResumeLayout(false); } @@ -258,11 +279,13 @@ private DevExpress.XtraLayout.LayoutControlItem layoutControlItem2; private DevExpress.XtraLayout.LayoutControlItem layoutControlItem3; private DevExpress.XtraEditors.SimpleButton btnTemplate; private DevExpress.XtraEditors.TextEdit textEdit2; private DevExpress.XtraEditors.TextEdit textEdit1; private DevExpress.XtraEditors.TextEdit txtImportance; private DevExpress.XtraEditors.TextEdit txtName; private DevExpress.XtraLayout.LayoutControlItem layoutControlItem4; private DevExpress.XtraLayout.LayoutControlItem layoutControlItem5; private DevExpress.XtraLayout.EmptySpaceItem emptySpaceItem1; private DevExpress.XtraLayout.LayoutControlItem layoutControlItem6; private UniversalChartImageImportCtrl universalChartImageImportCtrl1; private DevExpress.XtraEditors.DXErrorProvider.DXErrorProvider dxErrorProvider1; } } WinFrmUI/HStation.WinFrmUI.Assets.Core/20-exchanger/04-curveql/ImportAssetsExchangerCurveQLByPictureDlg.cs
@@ -1,4 +1,5 @@ using DevExpress.XtraEditors; using HStation.Vmo; using System; using System.Collections.Generic; using System.ComponentModel; @@ -8,6 +9,7 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using Yw; namespace HStation.WinFrmUI { @@ -22,24 +24,77 @@ } /// <summary> /// /// /// </summary> public event Action<HStation.Vmo.PhartDiagramRelationVmo> ReloadDataEvent; private AssetsExchangerMainVmo _exchanger = null; private PhartDiagramRelationVmo _vmo = null; /// <summary> /// /// /// </summary> public void SetBindingData() public void SetBindingData(AssetsExchangerMainVmo exchanger) { if (exchanger == null) { return; } _exchanger = exchanger; _vmo = new PhartDiagramRelationVmo(); _vmo.ObjectType = HStation.Assets.DataType.ExchangerMain; _vmo.ObjectID = exchanger.ID; _vmo.Importance = 0; this.txtImportance.EditValue = 0; } //验证 private bool Valid() { this.dxErrorProvider1.ClearErrors(); if (string.IsNullOrEmpty(this.btnEditPicture.Text.Trim())) { this.dxErrorProvider1.SetError(this.btnEditPicture, "必选项"); return false; } if (string.IsNullOrEmpty(this.txtName.Text.Trim())) { this.dxErrorProvider1.SetError(this.txtName, "必填项"); return false; } return true; } //确定 private void GeneralOkAndCancelCtrl1_OkEvent() private async void GeneralOkAndCancelCtrl1_OkEvent() { this.ReloadDataEvent?.Invoke(null); if (!Valid()) { return; } var diagram = this.universalChartImageImportCtrl1.Get(); var diagramId = await BLLFactory<Yw.BLL.PhartDiagramExtensions>.Instance.Insert(diagram); if (diagramId < 1) { TipFormHelper.ShowError("图表信息保存失败!"); return; } _vmo.DiagramID = diagramId; _vmo.OtherName = this.txtName.Text.Trim(); _vmo.Importance = int.Parse(this.txtImportance.EditValue.ToString()); _vmo.ID = await BLLFactory<HStation.BLL.PhartDiagramRelation>.Instance.Insert(_vmo); if (_vmo.ID < 1) { TipFormHelper.ShowError("图表关联信息保存失败!"); return; } var vmo = await BLLFactory<HStation.BLL.PhartDiagramRelation>.Instance.GetByID(_vmo.ID); this.ReloadDataEvent?.Invoke(vmo); this.DialogResult = DialogResult.OK; this.Close(); } //导入图片 private void btnEditPicture_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) @@ -51,6 +106,7 @@ { var fileName = dlg.FileName; this.btnEditPicture.EditValue = fileName; this.universalChartImageImportCtrl1.SetBindingData(fileName, Yw.Ahart.eCurveType.QL); } } } WinFrmUI/HStation.WinFrmUI.Assets.Core/20-exchanger/04-curveql/ImportAssetsExchangerCurveQLByPictureDlg.resx
@@ -117,4 +117,7 @@ <resheader name="writer"> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> <metadata name="dxErrorProvider1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>17, 17</value> </metadata> </root>