From bcc8a35a336c40cb478372fa459d1cdb15129355 Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Thu, 29 Dec 2022 13:51:46 +0100 Subject: [PATCH] weiter mit assignments --- AIS/AISAdmin/EditAssignmentDialog.Designer.cs | 126 ++++++++++++++++++ AIS/AISAdmin/EditAssignmentDialog.cs | 39 ++++++ AIS/AISAdmin/EditAssignmentDialog.resx | 60 +++++++++ AIS/AISAdmin/Main.Designer.cs | 21 +-- AIS/AISAdmin/Main.cs | 11 ++ 5 files changed, 247 insertions(+), 10 deletions(-) create mode 100644 AIS/AISAdmin/EditAssignmentDialog.Designer.cs create mode 100644 AIS/AISAdmin/EditAssignmentDialog.cs create mode 100644 AIS/AISAdmin/EditAssignmentDialog.resx diff --git a/AIS/AISAdmin/EditAssignmentDialog.Designer.cs b/AIS/AISAdmin/EditAssignmentDialog.Designer.cs new file mode 100644 index 00000000..f9dd8376 --- /dev/null +++ b/AIS/AISAdmin/EditAssignmentDialog.Designer.cs @@ -0,0 +1,126 @@ +namespace AISAdmin +{ + partial class EditAssignmentDialog + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.buttonOK = new System.Windows.Forms.Button(); + this.buttonCancel = new System.Windows.Forms.Button(); + this.label1 = new System.Windows.Forms.Label(); + this.numericUpDownMMSI = new System.Windows.Forms.NumericUpDown(); + this.label2 = new System.Windows.Forms.Label(); + this.comboBoxType = new System.Windows.Forms.ComboBox(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownMMSI)).BeginInit(); + this.SuspendLayout(); + // + // buttonOK + // + this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonOK.Location = new System.Drawing.Point(56, 88); + this.buttonOK.Name = "buttonOK"; + this.buttonOK.Size = new System.Drawing.Size(75, 23); + this.buttonOK.TabIndex = 0; + this.buttonOK.Text = "OK"; + this.buttonOK.UseVisualStyleBackColor = true; + this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click); + // + // buttonCancel + // + this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonCancel.Location = new System.Drawing.Point(137, 88); + this.buttonCancel.Name = "buttonCancel"; + this.buttonCancel.Size = new System.Drawing.Size(75, 23); + this.buttonCancel.TabIndex = 1; + this.buttonCancel.Text = "Cancel"; + this.buttonCancel.UseVisualStyleBackColor = true; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(12, 9); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(38, 15); + this.label1.TabIndex = 2; + this.label1.Text = "MMSI"; + // + // numericUpDownMMSI + // + this.numericUpDownMMSI.Location = new System.Drawing.Point(56, 7); + this.numericUpDownMMSI.Name = "numericUpDownMMSI"; + this.numericUpDownMMSI.Size = new System.Drawing.Size(156, 23); + this.numericUpDownMMSI.TabIndex = 3; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(12, 41); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(31, 15); + this.label2.TabIndex = 4; + this.label2.Text = "Type"; + // + // comboBoxType + // + this.comboBoxType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBoxType.FormattingEnabled = true; + this.comboBoxType.Location = new System.Drawing.Point(55, 36); + this.comboBoxType.Name = "comboBoxType"; + this.comboBoxType.Size = new System.Drawing.Size(157, 23); + this.comboBoxType.TabIndex = 5; + // + // EditAssignmentDialog + // + this.AcceptButton = this.buttonOK; + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.buttonCancel; + this.ClientSize = new System.Drawing.Size(218, 117); + this.Controls.Add(this.comboBoxType); + this.Controls.Add(this.label2); + this.Controls.Add(this.numericUpDownMMSI); + this.Controls.Add(this.label1); + this.Controls.Add(this.buttonCancel); + this.Controls.Add(this.buttonOK); + this.Name = "EditAssignmentDialog"; + this.Text = "Edit assignment"; + this.Load += new System.EventHandler(this.EditAssignmentDialog_Load); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownMMSI)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private Button buttonOK; + private Button buttonCancel; + private Label label1; + private NumericUpDown numericUpDownMMSI; + private Label label2; + private ComboBox comboBoxType; + } +} \ No newline at end of file diff --git a/AIS/AISAdmin/EditAssignmentDialog.cs b/AIS/AISAdmin/EditAssignmentDialog.cs new file mode 100644 index 00000000..a07771b9 --- /dev/null +++ b/AIS/AISAdmin/EditAssignmentDialog.cs @@ -0,0 +1,39 @@ +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; + MonitorAssignment.ZoneMonitorType mType; + Enum.TryParse(this.comboBoxType.SelectedValue.ToString(), out mType); + this.Assignment.MonitorType = mType; + } + } +} diff --git a/AIS/AISAdmin/EditAssignmentDialog.resx b/AIS/AISAdmin/EditAssignmentDialog.resx new file mode 100644 index 00000000..f298a7be --- /dev/null +++ b/AIS/AISAdmin/EditAssignmentDialog.resx @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/AIS/AISAdmin/Main.Designer.cs b/AIS/AISAdmin/Main.Designer.cs index 7864f6d3..46f68f24 100644 --- a/AIS/AISAdmin/Main.Designer.cs +++ b/AIS/AISAdmin/Main.Designer.cs @@ -43,6 +43,7 @@ this.listBoxZones = new System.Windows.Forms.ListBox(); this.buttonImportZone = new System.Windows.Forms.Button(); this.groupBoxAssignments = new System.Windows.Forms.GroupBox(); + this.label2 = new System.Windows.Forms.Label(); this.listBoxTargets = new System.Windows.Forms.ListBox(); this.buttonAssignSelectedTarget = new System.Windows.Forms.Button(); this.buttonDeleteAssignment = new System.Windows.Forms.Button(); @@ -50,7 +51,6 @@ this.listBoxAssignment = new System.Windows.Forms.ListBox(); this.textBoxGroup = new System.Windows.Forms.TextBox(); this.buttonSaveGroup = new System.Windows.Forms.Button(); - this.label2 = new System.Windows.Forms.Label(); this.groupBoxZones.SuspendLayout(); this.groupBoxAssignments.SuspendLayout(); this.SuspendLayout(); @@ -213,6 +213,15 @@ this.groupBoxAssignments.TabStop = false; this.groupBoxAssignments.Text = "Assignments"; // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(7, 19); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(286, 15); + this.label2.TabIndex = 8; + this.label2.Text = "Assignment will be to all zones in the selected group!"; + // // listBoxTargets // this.listBoxTargets.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) @@ -254,6 +263,7 @@ this.buttonNewAssignment.Size = new System.Drawing.Size(37, 31); this.buttonNewAssignment.TabIndex = 3; this.buttonNewAssignment.UseVisualStyleBackColor = true; + this.buttonNewAssignment.Click += new System.EventHandler(this.buttonNewAssignment_Click); // // listBoxAssignment // @@ -286,15 +296,6 @@ this.buttonSaveGroup.UseVisualStyleBackColor = true; this.buttonSaveGroup.Click += new System.EventHandler(this.buttonSaveGroup_Click); // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(7, 19); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(286, 15); - this.label2.TabIndex = 8; - this.label2.Text = "Assignment will be to all zones in the selected group!"; - // // Main // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); diff --git a/AIS/AISAdmin/Main.cs b/AIS/AISAdmin/Main.cs index a6539779..4978fb6b 100644 --- a/AIS/AISAdmin/Main.cs +++ b/AIS/AISAdmin/Main.cs @@ -179,5 +179,16 @@ namespace AISAdmin this.listBoxAssignment.DataSource = new BindingList(this._zoneAssignmentDict[mz]); } } + + private void buttonNewAssignment_Click(object sender, EventArgs e) + { + MonitorAssignment ma = new(-1); + using EditAssignmentDialog ead = new EditAssignmentDialog(); + ead.Assignment = ma; + if(ead.ShowDialog() == DialogResult.OK) + { + + } + } } } \ No newline at end of file