datasheet window wip
This commit is contained in:
16
Datasheet.Designer.cs
generated
16
Datasheet.Designer.cs
generated
@@ -29,13 +29,27 @@
|
|||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Datasheet));
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Datasheet));
|
||||||
|
this.listView1 = new System.Windows.Forms.ListView();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
|
// listView1
|
||||||
|
//
|
||||||
|
this.listView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||||
|
| System.Windows.Forms.AnchorStyles.Left)
|
||||||
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.listView1.HideSelection = false;
|
||||||
|
this.listView1.Location = new System.Drawing.Point(12, 137);
|
||||||
|
this.listView1.Name = "listView1";
|
||||||
|
this.listView1.Size = new System.Drawing.Size(716, 301);
|
||||||
|
this.listView1.TabIndex = 0;
|
||||||
|
this.listView1.UseCompatibleStateImageBehavior = false;
|
||||||
|
//
|
||||||
// Datasheet
|
// Datasheet
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(740, 450);
|
this.ClientSize = new System.Drawing.Size(740, 450);
|
||||||
|
this.Controls.Add(this.listView1);
|
||||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||||
this.Name = "Datasheet";
|
this.Name = "Datasheet";
|
||||||
this.Text = "Datasheet";
|
this.Text = "Datasheet";
|
||||||
@@ -44,5 +58,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
private System.Windows.Forms.ListView listView1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
34
Datasheet.cs
34
Datasheet.cs
@@ -13,24 +13,30 @@ namespace Gidrolock_Modbus_Scanner
|
|||||||
public partial class Datasheet : Form
|
public partial class Datasheet : Form
|
||||||
{
|
{
|
||||||
int pollDelay = 250; // delay between each entry poll, ms
|
int pollDelay = 250; // delay between each entry poll, ms
|
||||||
List<EntryUI> entries = new List<EntryUI>();
|
Device device = App.device;
|
||||||
|
|
||||||
public Datasheet()
|
public Datasheet()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
listView1.AllowColumnReorder = true;
|
||||||
}
|
listView1.CheckBoxes = true;
|
||||||
|
listView1.FullRowSelect = true;
|
||||||
|
listView1.GridLines = true;
|
||||||
|
|
||||||
public class EntryUI : GroupBox
|
listView1.Columns.Add("#", -2, HorizontalAlignment.Left);
|
||||||
{
|
listView1.Columns.Add("Name", -2, HorizontalAlignment.Left);
|
||||||
public Label Label_Name;
|
listView1.Columns.Add("Value", -2, HorizontalAlignment.Left);
|
||||||
public Label Label_Value;
|
listView1.Columns.Add("Address", -2, HorizontalAlignment.Left);
|
||||||
public ToolTip ToolTip;
|
|
||||||
public EntryUI(string name, string description, int address, string registerType, string dataType)
|
|
||||||
{
|
|
||||||
Label_Name.Text = name;
|
|
||||||
ToolTip.SetToolTip(this, description);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
for (int i = 0; i < device.entries.Count; i++)
|
||||||
|
{
|
||||||
|
ListViewItem item = new ListViewItem(i.ToString());
|
||||||
|
item.SubItems.Add(device.entries[i].name);
|
||||||
|
item.SubItems.Add(" ");
|
||||||
|
item.SubItems.Add(device.entries[i].address.ToString());
|
||||||
|
|
||||||
|
listView1.Items.Add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,20 +68,27 @@
|
|||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="json.cs" />
|
<Compile Include="Datasheet.cs">
|
||||||
<Compile Include="Modbus.cs" />
|
|
||||||
<Compile Include="Form1.cs">
|
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Form1.Designer.cs">
|
<Compile Include="Datasheet.Designer.cs">
|
||||||
<DependentUpon>Form1.cs</DependentUpon>
|
<DependentUpon>Datasheet.cs</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Json.cs" />
|
||||||
|
<Compile Include="Modbus.cs" />
|
||||||
|
<Compile Include="Main.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Main.Designer.cs">
|
||||||
|
<DependentUpon>Main.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Program.cs" />
|
<Compile Include="Program.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="Timeout.cs" />
|
<EmbeddedResource Include="Datasheet.resx">
|
||||||
<Compile Include="Tools.cs" />
|
<DependentUpon>Datasheet.cs</DependentUpon>
|
||||||
<EmbeddedResource Include="Form1.resx">
|
</EmbeddedResource>
|
||||||
<DependentUpon>Form1.cs</DependentUpon>
|
<EmbeddedResource Include="Main.resx">
|
||||||
|
<DependentUpon>Main.cs</DependentUpon>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Include="Properties\Resources.resx">
|
<EmbeddedResource Include="Properties\Resources.resx">
|
||||||
<Generator>ResXFileCodeGenerator</Generator>
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
|
|||||||
2
Json.cs
2
Json.cs
@@ -40,5 +40,5 @@ namespace Gidrolock_Modbus_Scanner
|
|||||||
this.readOnce = readOnce;
|
this.readOnce = readOnce;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public enum RegisterType { Coil, DiscreteInput, HoldingRegister, InputRegister }
|
public enum RegisterType { Coil, Discrete, Holding, Input }
|
||||||
}
|
}
|
||||||
|
|||||||
1
Main.cs
1
Main.cs
@@ -214,6 +214,7 @@ namespace Gidrolock_Modbus_Scanner
|
|||||||
{
|
{
|
||||||
AddLog("Попытка подключиться к устройству " + device.name);
|
AddLog("Попытка подключиться к устройству " + device.name);
|
||||||
Datasheet datasheet = new Datasheet();
|
Datasheet datasheet = new Datasheet();
|
||||||
|
datasheet.Show();
|
||||||
/*
|
/*
|
||||||
if (Radio_SerialPort.Checked)
|
if (Radio_SerialPort.Checked)
|
||||||
await SendMessageAsync(FunctionCode.InputRegister, 200, 6);
|
await SendMessageAsync(FunctionCode.InputRegister, 200, 6);
|
||||||
|
|||||||
Reference in New Issue
Block a user