1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- using DevExpress.XtraEditors;
- using ExtensionsDev;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Data.Entity;
- using System.Drawing;
- using System.Linq;
- using System.Windows.Forms;
- using DataSimulation.Repostory;
- using DataSimulation.Repostory.EFContext;
- using DataSimulation.Repostory.Model;
- namespace DataSimulation.Forms.EditForms
- {
- public partial class AntEditor : DevExpress.XtraEditors.XtraForm
- {
- public AntInfo info;
- public AntEditor()
- {
- InitializeComponent();
- this.layoutControl1.UseDefault();
- this.Text = "添加天线";
- info = new AntInfo();
- this.StartPosition = FormStartPosition.CenterParent;
- }
- public AntEditor(AntInfo info)
- : this()
- {
- this.Text = "编辑天线";
- this.info = info;
- }
- private void AntEditor_Load(object sender, EventArgs e)
- {
- if (this.Text == "编辑天线" && info != null)
- {
- this.txtAntName.Text = info.AntName;
- this.txtAntLon.Text = $"{info.AntLon}";
- this.txtAntLat.Text = $"{info.AntLat}";
- }
- }
- private void btnCancel_Click(object sender, EventArgs e)
- {
- this.DialogResult = DialogResult.Cancel;
- }
- private void btnOk_Click(object sender, EventArgs e)
- {
- try
- {
- info.AntName = txtAntName.Text.Trim();
- info.AntLon = Convert.ToDouble(txtAntLon.Text);
- info.AntLat = Convert.ToDouble(txtAntLat.Text);
- this.DialogResult = DialogResult.OK;
- }
- catch (Exception ex)
- {
- Serilog.Log.Error(ex, $"{this.Text}信息出错");
- DxHelper.MsgBoxHelper.ShowError($"{this.Text}信息出错");
- }
- }
- }
- }
|