git_bsmd/AIS/AISAdmin/EditAssignmentDialog.cs

47 lines
1.4 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using bsmd.AIS2Service;
namespace AISAdmin
{
public partial class EditAssignmentDialog : Form
{
public EditAssignmentDialog()
{
InitializeComponent();
}
public MonitorAssignment Assignment { get; set; }
private void EditAssignmentDialog_Load(object sender, EventArgs e)
{
comboBoxType.DataSource = Enum.GetValues(typeof(MonitorAssignment.ZoneMonitorType));
this.numericUpDownMMSI.Value = Assignment.MMSI;
this.comboBoxType.SelectedItem = Assignment.MonitorType;
}
private void buttonOK_Click(object sender, EventArgs e)
{
this.Assignment.MMSI = (int) this.numericUpDownMMSI.Value;
if (Enum.TryParse<MonitorAssignment.ZoneMonitorType>(this.comboBoxType.SelectedValue.ToString(), out MonitorAssignment.ZoneMonitorType mType))
this.Assignment.MonitorType = mType;
this.DialogResult = DialogResult.OK;
this.Close();
}
private void buttonCancel_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
this.Close();
}
}
}