weiteres Arbeiten an der Speicherung der Alarm Strukturen
This commit is contained in:
parent
02d347b592
commit
5cd5632ca7
@ -16,6 +16,11 @@
|
||||
<None Remove="Resources\pencil.png" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="log4net" Version="2.0.15" />
|
||||
<PackageReference Include="System.Data.SQLite.Core" Version="1.0.117" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\bsmd.AIS2Service\bsmd.AIS2Service.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
38
AIS/AISAdmin/Main.Designer.cs
generated
38
AIS/AISAdmin/Main.Designer.cs
generated
@ -37,7 +37,7 @@
|
||||
this.groupBoxZones = new System.Windows.Forms.GroupBox();
|
||||
this.checkBoxZoneActive = new System.Windows.Forms.CheckBox();
|
||||
this.buttonSaveZone = new System.Windows.Forms.Button();
|
||||
this.textBox2 = new System.Windows.Forms.TextBox();
|
||||
this.textBoxZone = new System.Windows.Forms.TextBox();
|
||||
this.buttonDeleteZone = new System.Windows.Forms.Button();
|
||||
this.buttonEditZone = new System.Windows.Forms.Button();
|
||||
this.buttonImportZone = new System.Windows.Forms.Button();
|
||||
@ -45,7 +45,7 @@
|
||||
this.buttonZoneUp = new System.Windows.Forms.Button();
|
||||
this.listBoxZones = new System.Windows.Forms.ListBox();
|
||||
this.groupBoxAssignments = new System.Windows.Forms.GroupBox();
|
||||
this.textBox1 = new System.Windows.Forms.TextBox();
|
||||
this.textBoxGroup = new System.Windows.Forms.TextBox();
|
||||
this.buttonSaveGroup = new System.Windows.Forms.Button();
|
||||
this.groupBoxZones.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
@ -67,6 +67,7 @@
|
||||
this.comboBoxGroup.Name = "comboBoxGroup";
|
||||
this.comboBoxGroup.Size = new System.Drawing.Size(137, 23);
|
||||
this.comboBoxGroup.TabIndex = 1;
|
||||
this.comboBoxGroup.SelectedIndexChanged += new System.EventHandler(this.comboBoxGroup_SelectedIndexChanged);
|
||||
//
|
||||
// buttonNewGroup
|
||||
//
|
||||
@ -104,7 +105,7 @@
|
||||
//
|
||||
this.groupBoxZones.Controls.Add(this.checkBoxZoneActive);
|
||||
this.groupBoxZones.Controls.Add(this.buttonSaveZone);
|
||||
this.groupBoxZones.Controls.Add(this.textBox2);
|
||||
this.groupBoxZones.Controls.Add(this.textBoxZone);
|
||||
this.groupBoxZones.Controls.Add(this.buttonDeleteZone);
|
||||
this.groupBoxZones.Controls.Add(this.buttonEditZone);
|
||||
this.groupBoxZones.Controls.Add(this.buttonImportZone);
|
||||
@ -139,13 +140,13 @@
|
||||
this.buttonSaveZone.UseVisualStyleBackColor = true;
|
||||
this.buttonSaveZone.Click += new System.EventHandler(this.buttonSaveZone_Click);
|
||||
//
|
||||
// textBox2
|
||||
// textBoxZone
|
||||
//
|
||||
this.textBox2.Location = new System.Drawing.Point(525, 27);
|
||||
this.textBox2.Name = "textBox2";
|
||||
this.textBox2.ReadOnly = true;
|
||||
this.textBox2.Size = new System.Drawing.Size(202, 23);
|
||||
this.textBox2.TabIndex = 9;
|
||||
this.textBoxZone.Location = new System.Drawing.Point(525, 27);
|
||||
this.textBoxZone.Name = "textBoxZone";
|
||||
this.textBoxZone.ReadOnly = true;
|
||||
this.textBoxZone.Size = new System.Drawing.Size(202, 23);
|
||||
this.textBoxZone.TabIndex = 9;
|
||||
//
|
||||
// buttonDeleteZone
|
||||
//
|
||||
@ -220,13 +221,13 @@
|
||||
this.groupBoxAssignments.TabStop = false;
|
||||
this.groupBoxAssignments.Text = "Assignments";
|
||||
//
|
||||
// textBox1
|
||||
// textBoxGroup
|
||||
//
|
||||
this.textBox1.Location = new System.Drawing.Point(335, 11);
|
||||
this.textBox1.Name = "textBox1";
|
||||
this.textBox1.ReadOnly = true;
|
||||
this.textBox1.Size = new System.Drawing.Size(160, 23);
|
||||
this.textBox1.TabIndex = 7;
|
||||
this.textBoxGroup.Location = new System.Drawing.Point(335, 11);
|
||||
this.textBoxGroup.Name = "textBoxGroup";
|
||||
this.textBoxGroup.ReadOnly = true;
|
||||
this.textBoxGroup.Size = new System.Drawing.Size(160, 23);
|
||||
this.textBoxGroup.TabIndex = 7;
|
||||
//
|
||||
// buttonSaveGroup
|
||||
//
|
||||
@ -245,7 +246,7 @@
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Controls.Add(this.buttonSaveGroup);
|
||||
this.Controls.Add(this.textBox1);
|
||||
this.Controls.Add(this.textBoxGroup);
|
||||
this.Controls.Add(this.groupBoxAssignments);
|
||||
this.Controls.Add(this.groupBoxZones);
|
||||
this.Controls.Add(this.buttonDeleteGroup);
|
||||
@ -257,6 +258,7 @@
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.Name = "Main";
|
||||
this.Text = "AIS Admin";
|
||||
this.Load += new System.EventHandler(this.Main_Load);
|
||||
this.groupBoxZones.ResumeLayout(false);
|
||||
this.groupBoxZones.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
@ -276,10 +278,10 @@
|
||||
private ListBox listBoxZones;
|
||||
private Button buttonZoneDown;
|
||||
private Button buttonZoneUp;
|
||||
private TextBox textBox1;
|
||||
private TextBox textBoxGroup;
|
||||
private Button buttonSaveGroup;
|
||||
private Button buttonSaveZone;
|
||||
private TextBox textBox2;
|
||||
private TextBox textBoxZone;
|
||||
private Button buttonDeleteZone;
|
||||
private Button buttonEditZone;
|
||||
private Button buttonImportZone;
|
||||
|
||||
@ -1,7 +1,14 @@
|
||||
using bsmd.AIS2Service;
|
||||
|
||||
namespace AISAdmin
|
||||
{
|
||||
|
||||
public partial class Main : Form
|
||||
{
|
||||
private AIS_SQLiteStorage? _storage;
|
||||
private List<MonitorGroup>? _monitorGroups;
|
||||
private List<MonitorZone>? _monitorZones;
|
||||
|
||||
public Main()
|
||||
{
|
||||
InitializeComponent();
|
||||
@ -39,7 +46,8 @@ namespace AISAdmin
|
||||
|
||||
private void buttonNewGroup_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
this.textBoxGroup.ReadOnly = false;
|
||||
this.buttonSaveGroup.Enabled = true;
|
||||
}
|
||||
|
||||
private void buttonEditGroup_Click(object sender, EventArgs e)
|
||||
@ -54,7 +62,52 @@ namespace AISAdmin
|
||||
|
||||
private void buttonSaveGroup_Click(object sender, EventArgs e)
|
||||
{
|
||||
if(this.textBoxGroup.Text != null)
|
||||
{
|
||||
string groupName = this.textBoxGroup.Text.Trim();
|
||||
if(groupName.Length > 0)
|
||||
{
|
||||
MonitorGroup mg = new MonitorGroup(-1, groupName);
|
||||
if(_storage.Save(mg))
|
||||
{
|
||||
this._monitorGroups?.Add(mg);
|
||||
this.comboBoxGroup.SelectedItem = mg;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.buttonSaveGroup.Enabled = false;
|
||||
this.textBoxGroup.ReadOnly = true;
|
||||
}
|
||||
|
||||
private void Main_Load(object sender, EventArgs e)
|
||||
{
|
||||
_storage = new AIS_SQLiteStorage(null);
|
||||
_monitorGroups = _storage.LoadGroups();
|
||||
_monitorZones = _storage.LoadMonitorZones();
|
||||
this.comboBoxGroup.DataSource = _monitorGroups;
|
||||
this.comboBoxGroup.DisplayMember = "Name";
|
||||
}
|
||||
|
||||
private void comboBoxGroup_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
MonitorGroup mGroup = (MonitorGroup) this.comboBoxGroup.SelectedItem;
|
||||
if (mGroup != null)
|
||||
{
|
||||
this.textBoxGroup.Text = mGroup.Name;
|
||||
List<MonitorZone> groupZones = new List<MonitorZone>();
|
||||
foreach(MonitorZone mZone in _monitorZones)
|
||||
{
|
||||
if (mZone.MonitorGroupId == mGroup.Id)
|
||||
groupZones.Add(mZone);
|
||||
}
|
||||
groupZones.Sort();
|
||||
this.listBoxZones.DataSource = groupZones;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.listBoxZones.DataSource = null;
|
||||
this.textBoxGroup.ResetText();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -16,7 +16,7 @@ namespace bsmd.AIS2Service
|
||||
/// past track. It is just intended to function as a "saving the state" of the AIS situation.
|
||||
/// Attention: Alarm zones / alarms are also stored here. This might or might not be such a great idea.
|
||||
/// </summary>
|
||||
internal class AIS_SQLiteStorage : IAISThread
|
||||
public class AIS_SQLiteStorage : IAISThread
|
||||
{
|
||||
#region Fields
|
||||
|
||||
@ -504,11 +504,11 @@ namespace bsmd.AIS2Service
|
||||
}
|
||||
}
|
||||
|
||||
public int GetLastInsertId()
|
||||
public long GetLastInsertId()
|
||||
{
|
||||
string sql = "SELECT last_insert_rowid()";
|
||||
SQLiteCommand cmd = new SQLiteCommand(sql, _connection);
|
||||
int lastID = (Int32)cmd.ExecuteScalar();
|
||||
long lastID = (long) cmd.ExecuteScalar();
|
||||
return lastID;
|
||||
}
|
||||
|
||||
|
||||
@ -17,14 +17,14 @@ namespace bsmd.AIS2Service
|
||||
|
||||
public class DBEntity
|
||||
{
|
||||
protected int _id; // PK from database
|
||||
protected long _id; // PK from database
|
||||
|
||||
public DBEntity(int id)
|
||||
public DBEntity(long id)
|
||||
{
|
||||
_id = id;
|
||||
}
|
||||
|
||||
public int Id { get { return _id; } set { _id = value; } }
|
||||
public long Id { get { return _id; } set { _id = value; } }
|
||||
|
||||
}
|
||||
|
||||
@ -43,7 +43,7 @@ namespace bsmd.AIS2Service
|
||||
|
||||
#region Construction
|
||||
|
||||
public MonitorGroup(int id, string name) : base( id )
|
||||
public MonitorGroup(long id, string name) : base( id )
|
||||
{
|
||||
_name = name;
|
||||
}
|
||||
@ -76,7 +76,7 @@ namespace bsmd.AIS2Service
|
||||
|
||||
#region Construction
|
||||
|
||||
public MonitorZone(int id, string name) : base (id)
|
||||
public MonitorZone(long id, string name) : base (id)
|
||||
{
|
||||
_name = name;
|
||||
}
|
||||
@ -95,7 +95,7 @@ namespace bsmd.AIS2Service
|
||||
|
||||
public int Sequence { get; set; }
|
||||
|
||||
public int MonitorGroupId { get; set; }
|
||||
public long MonitorGroupId { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
@ -130,13 +130,13 @@ namespace bsmd.AIS2Service
|
||||
public class GeoPoint : DBEntity
|
||||
{
|
||||
|
||||
public GeoPoint(int id) : base (id)
|
||||
public GeoPoint(long id) : base (id)
|
||||
{}
|
||||
|
||||
public double Lat { get; set; }
|
||||
public double Lon { get; set; }
|
||||
|
||||
public int MonitorZoneId { get; set; }
|
||||
public long MonitorZoneId { get; set; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
@ -146,7 +146,7 @@ namespace bsmd.AIS2Service
|
||||
public class MonitorAssignment : DBEntity
|
||||
{
|
||||
|
||||
public MonitorAssignment(int id) : base(id)
|
||||
public MonitorAssignment(long id) : base(id)
|
||||
{}
|
||||
|
||||
[Flags]
|
||||
@ -157,9 +157,7 @@ namespace bsmd.AIS2Service
|
||||
EXIT = 2,
|
||||
PASSTHROUGH = 4, // outside - enter - inside - exit - outside
|
||||
LEAVE_AND_RETURN = 8 // inside - exit - outside - enter - inside
|
||||
}
|
||||
|
||||
public int Id { get { return _id; } }
|
||||
}
|
||||
|
||||
public int MMSI { get; set; }
|
||||
|
||||
@ -175,7 +173,7 @@ namespace bsmd.AIS2Service
|
||||
{
|
||||
private readonly MonitorAssignment _assignment;
|
||||
|
||||
public Alarm(int id, MonitorAssignment assignment) : base(id) { _assignment = assignment; }
|
||||
public Alarm(long id, MonitorAssignment assignment) : base(id) { _assignment = assignment; }
|
||||
|
||||
public MonitorAssignment Assignment { get { return _assignment; } }
|
||||
|
||||
|
||||
@ -48,7 +48,7 @@
|
||||
<HintPath>packages\Microsoft.Owin.Hosting.4.2.2\lib\net45\Microsoft.Owin.Hosting.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<HintPath>packages\Newtonsoft.Json.13.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Owin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f0ebd12fd5e55cc5, processorArchitecture=MSIL">
|
||||
<HintPath>packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
|
||||
@ -57,8 +57,8 @@
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Configuration.Install" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Data.SQLite, Version=1.0.116.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
|
||||
<HintPath>packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.116.0\lib\net46\System.Data.SQLite.dll</HintPath>
|
||||
<Reference Include="System.Data.SQLite, Version=1.0.117.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
|
||||
<HintPath>packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.117.0\lib\net46\System.Data.SQLite.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Management" />
|
||||
<Reference Include="System.Drawing" />
|
||||
@ -156,11 +156,11 @@
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.116.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets" Condition="Exists('packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.116.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets')" />
|
||||
<Import Project="packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.117.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets" Condition="Exists('packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.117.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.116.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.116.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets'))" />
|
||||
<Error Condition="!Exists('packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.117.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.117.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
||||
@ -10,8 +10,8 @@
|
||||
<package id="Microsoft.Owin" version="4.2.2" targetFramework="net48" />
|
||||
<package id="Microsoft.Owin.Host.HttpListener" version="4.2.2" targetFramework="net48" />
|
||||
<package id="Microsoft.Owin.Hosting" version="4.2.2" targetFramework="net48" />
|
||||
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net48" />
|
||||
<package id="Newtonsoft.Json" version="13.0.2" targetFramework="net48" />
|
||||
<package id="Owin" version="1.0" targetFramework="net48" />
|
||||
<package id="Stub.System.Data.SQLite.Core.NetFramework" version="1.0.116.0" targetFramework="net48" />
|
||||
<package id="System.Data.SQLite.Core" version="1.0.116.0" targetFramework="net48" />
|
||||
<package id="Stub.System.Data.SQLite.Core.NetFramework" version="1.0.117.0" targetFramework="net48" />
|
||||
<package id="System.Data.SQLite.Core" version="1.0.117.0" targetFramework="net48" />
|
||||
</packages>
|
||||
Loading…
Reference in New Issue
Block a user