DataStreamInterfaceTest and DataStreamMeter projects added
This commit is contained in:
parent
49d4cf1ac0
commit
97ce601d31
4
.gitignore
vendored
4
.gitignore
vendored
@ -4,6 +4,10 @@ Config/bin/
|
||||
Config/obj/
|
||||
DataStreamInterface/bin/
|
||||
DataStreamInterface/obj/
|
||||
DataStreamInterfaceTest/bin/
|
||||
DataStreamInterfaceTest/obj/
|
||||
DataStreamMeter/bin/
|
||||
DataStreamMeter/obj/
|
||||
Decrypt/bin/
|
||||
Decrypt/obj/
|
||||
DeviceTest/bin/
|
||||
|
||||
@ -385,7 +385,7 @@ namespace Config
|
||||
case Unit.lph: return 1000 * v; /// 1 l/h
|
||||
case Unit.lpm: return v / 0.06; /// 1 l/m
|
||||
case Unit.lps: return v / 3.6; /// 1 l/s
|
||||
case Unit.USgalps: return 0.733811257326 * v; /// 1 US gallon per second
|
||||
case Unit.USgalps: return 0.0733811257326 * v; /// 1 US gallon per second
|
||||
case Unit.m3pm: return v / 60; /// 1 m3/m
|
||||
case Unit.cfs: return 0.009809629644858 * v; /// 1 cubic foot per second
|
||||
|
||||
|
||||
@ -7,12 +7,12 @@ namespace DataStreamInterface
|
||||
{
|
||||
public class DataFrame
|
||||
{
|
||||
public readonly UInt64 ID; /// Frame ID
|
||||
public readonly Int64 ID; /// Frame ID
|
||||
public readonly double Time; /// Time stamp in units of time
|
||||
public readonly double Volume; /// Volume in units of volume
|
||||
public readonly double[] Quantity; /// An array of optional quantities in their respective units
|
||||
|
||||
public DataFrame(UInt64 id, double time, double volume, double[] quantity)
|
||||
public DataFrame(Int64 id, double time, double volume, double[] quantity)
|
||||
{
|
||||
ID = id;
|
||||
Time = time;
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>DataStreamInterface</RootNamespace>
|
||||
<AssemblyName>DataStreamInterface</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
@ -21,6 +21,7 @@
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
@ -29,9 +30,11 @@
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.ComponentModel.Composition" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
|
||||
Binary file not shown.
@ -259,7 +259,7 @@ namespace DataStreamInterface
|
||||
case Unit.lph: return 1000 * v; /// 1 l/h
|
||||
case Unit.lpm: return v / 0.06; /// 1 l/m
|
||||
case Unit.lps: return v / 3.6; /// 1 l/s
|
||||
case Unit.USgalps: return 0.733811257326 * v; /// 1 US gallon per second
|
||||
case Unit.USgalps: return 0.0733811257326 * v; /// 1 US gallon per second
|
||||
case Unit.m3pm: return v / 60; /// 1 m3/m
|
||||
case Unit.cfs: return 0.009809629644858 * v; /// 1 cubic foot per second
|
||||
|
||||
|
||||
@ -2,10 +2,6 @@
|
||||
/// Copyright (c) 2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DataStreamInterface
|
||||
{
|
||||
@ -51,9 +47,9 @@ namespace DataStreamInterface
|
||||
/// Stops saving measurement results into internal data structures of the component.
|
||||
/// Updates ID of the last date frame received from the meter.
|
||||
/// </summary>
|
||||
/// <param name="lastFrameID">ID of the last date frame</param>
|
||||
/// <param name="storedFramesCount">Number of stored date frames</param>
|
||||
/// <returns>true when successful</returns>
|
||||
bool StopMeasurement(out UInt64 lastFrameID);
|
||||
bool StopMeasurement(out Int64 storedFramesCount);
|
||||
|
||||
///------------------------------------------------
|
||||
/// Units of time, volume and optional quantities
|
||||
@ -70,7 +66,7 @@ namespace DataStreamInterface
|
||||
Unit GetVolumeUnits();
|
||||
|
||||
///-----------------------------------------------
|
||||
/// Ooptional quantities: count, units, captions
|
||||
/// Optional quantities: count, units, captions
|
||||
///-----------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
@ -83,13 +79,13 @@ namespace DataStreamInterface
|
||||
/// Returns units of the specified quantity
|
||||
/// </summary>
|
||||
/// <param name="quanityNr">Zero based quantity number 0 .. quantites count-1</param>
|
||||
Unit GetQuantityUnits(int quanityNr);
|
||||
Unit GetQuantityUnits(int quantityNr);
|
||||
|
||||
/// <summary>
|
||||
/// Returns caption of the specified quantity
|
||||
/// </summary>
|
||||
/// <param name="quanityNr">Zero based quantity number 0 .. quantites count-1</param>
|
||||
string GetQuantityCaption(int quanityNr);
|
||||
string GetQuantityCaption(int quantityNr);
|
||||
|
||||
///---------------------------
|
||||
/// Datastream data exchange
|
||||
@ -101,7 +97,7 @@ namespace DataStreamInterface
|
||||
/// <param name="id">First frame ID</param>
|
||||
/// <param name="count">Frames count</param>
|
||||
/// <returns>Selected data frames</returns>
|
||||
DataFrame[] GetFrames(UInt64 id, int count);
|
||||
DataFrame[] GetFrames(Int64 id, int count);
|
||||
|
||||
/// <summary>
|
||||
/// Returns ID of the data frame where time equals or exceeds the specified time.
|
||||
@ -109,6 +105,6 @@ namespace DataStreamInterface
|
||||
/// </summary>
|
||||
/// <param name="time">Time</param>
|
||||
/// <returns>ID of the data frame at or after the pecified time</returns>
|
||||
UInt64 GetID(double time);
|
||||
Int64 GetID(double time);
|
||||
}
|
||||
}
|
||||
|
||||
36
DataStreamInterfaceTest/ActivityLog.cs
Normal file
36
DataStreamInterfaceTest/ActivityLog.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace DataStreamInterfaceTest
|
||||
{
|
||||
public class ActivityLog
|
||||
{
|
||||
const int LinesCount = 50;
|
||||
|
||||
TextBox textBox;
|
||||
string[] lines;
|
||||
string activity;
|
||||
|
||||
public ActivityLog(TextBox textBox)
|
||||
{
|
||||
this.textBox = textBox;
|
||||
lines = new string[LinesCount];
|
||||
for (int i = 0; i < LinesCount; i++) lines[i] = string.Empty;
|
||||
}
|
||||
|
||||
public void Print(string log)
|
||||
{
|
||||
for (int i = LinesCount - 1; i > 0; i--) lines[i] = lines[i - 1];
|
||||
lines[0] = log;
|
||||
DisplayLines();
|
||||
}
|
||||
|
||||
private void DisplayLines()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
foreach (var line in lines) sb.AppendLine(line);
|
||||
textBox.Text = sb.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
6
DataStreamInterfaceTest/App.config
Normal file
6
DataStreamInterfaceTest/App.config
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
||||
</startup>
|
||||
</configuration>
|
||||
134
DataStreamInterfaceTest/DataStreamInterfaceTest.csproj
Normal file
134
DataStreamInterfaceTest/DataStreamInterfaceTest.csproj
Normal file
@ -0,0 +1,134 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{1D1EEF9C-7F41-43D3-BD09-5054D00F7A23}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>DataStreamInterfaceTest</RootNamespace>
|
||||
<AssemblyName>DataStreamInterfaceTest</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.ComponentModel.Composition" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ActivityLog.cs" />
|
||||
<Compile Include="DemoMainWnd.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="DemoMainWnd.Designer.cs">
|
||||
<DependentUpon>DemoMainWnd.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="GetDblValueDlg.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="GetDblValueDlg.designer.cs">
|
||||
<DependentUpon>GetDblValueDlg.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="GetFrameBoundariesDlg.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="GetFrameBoundariesDlg.designer.cs">
|
||||
<DependentUpon>GetFrameBoundariesDlg.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="GetIntegerNumberDlg.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="GetIntegerNumberDlg.Designer.cs">
|
||||
<DependentUpon>GetIntegerNumberDlg.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="GetStateDlg.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="GetStateDlg.designer.cs">
|
||||
<DependentUpon>GetStateDlg.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="LviIDComparer.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<EmbeddedResource Include="DemoMainWnd.resx">
|
||||
<DependentUpon>DemoMainWnd.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="GetDblValueDlg.resx">
|
||||
<DependentUpon>GetDblValueDlg.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="GetFrameBoundariesDlg.resx">
|
||||
<DependentUpon>GetFrameBoundariesDlg.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="GetIntegerNumberDlg.resx">
|
||||
<DependentUpon>GetIntegerNumberDlg.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="GetStateDlg.resx">
|
||||
<DependentUpon>GetStateDlg.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\DataStreamInterface\DataStreamInterface.csproj">
|
||||
<Project>{7ebeea14-91c4-48d7-af0a-7a4bc3ff9a28}</Project>
|
||||
<Name>DataStreamInterface</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
379
DataStreamInterfaceTest/DemoMainWnd.Designer.cs
generated
Normal file
379
DataStreamInterfaceTest/DemoMainWnd.Designer.cs
generated
Normal file
@ -0,0 +1,379 @@
|
||||
namespace DataStreamInterfaceTest
|
||||
{
|
||||
partial class DemoMainWnd
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
|
||||
this.getIDButton = new System.Windows.Forms.Button();
|
||||
this.getFramesButton = new System.Windows.Forms.Button();
|
||||
this.measurementLabel = new System.Windows.Forms.Label();
|
||||
this.stateLabel = new System.Windows.Forms.Label();
|
||||
this.capabilitiesLabel = new System.Windows.Forms.Label();
|
||||
this.getQuantityUnitsButton = new System.Windows.Forms.Button();
|
||||
this.getQuantityCaptionButton = new System.Windows.Forms.Button();
|
||||
this.getQuantitiesCountButton = new System.Windows.Forms.Button();
|
||||
this.getVolumeUnitsButton = new System.Windows.Forms.Button();
|
||||
this.getTimeUnitsButton = new System.Windows.Forms.Button();
|
||||
this.setStateButton = new System.Windows.Forms.Button();
|
||||
this.getStateButton = new System.Windows.Forms.Button();
|
||||
this.stopMeasurementButton = new System.Windows.Forms.Button();
|
||||
this.startMeasurementButton = new System.Windows.Forms.Button();
|
||||
this.closeConnectionButton = new System.Windows.Forms.Button();
|
||||
this.openConnectionButton = new System.Windows.Forms.Button();
|
||||
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
|
||||
this.logsTextBox = new System.Windows.Forms.TextBox();
|
||||
this.dataTabControl = new System.Windows.Forms.TabControl();
|
||||
this.tabPage1 = new System.Windows.Forms.TabPage();
|
||||
this.tabPage2 = new System.Windows.Forms.TabPage();
|
||||
this.framesListView = new System.Windows.Forms.ListView();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
||||
this.splitContainer1.Panel1.SuspendLayout();
|
||||
this.splitContainer1.Panel2.SuspendLayout();
|
||||
this.splitContainer1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit();
|
||||
this.splitContainer2.Panel1.SuspendLayout();
|
||||
this.splitContainer2.Panel2.SuspendLayout();
|
||||
this.splitContainer2.SuspendLayout();
|
||||
this.dataTabControl.SuspendLayout();
|
||||
this.tabPage1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// splitContainer1
|
||||
//
|
||||
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
|
||||
this.splitContainer1.IsSplitterFixed = true;
|
||||
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
|
||||
this.splitContainer1.Name = "splitContainer1";
|
||||
//
|
||||
// splitContainer1.Panel1
|
||||
//
|
||||
this.splitContainer1.Panel1.Controls.Add(this.getIDButton);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.getFramesButton);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.measurementLabel);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.stateLabel);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.capabilitiesLabel);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.getQuantityUnitsButton);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.getQuantityCaptionButton);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.getQuantitiesCountButton);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.getVolumeUnitsButton);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.getTimeUnitsButton);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.setStateButton);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.getStateButton);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.stopMeasurementButton);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.startMeasurementButton);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.closeConnectionButton);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.openConnectionButton);
|
||||
//
|
||||
// splitContainer1.Panel2
|
||||
//
|
||||
this.splitContainer1.Panel2.Controls.Add(this.splitContainer2);
|
||||
this.splitContainer1.Size = new System.Drawing.Size(826, 583);
|
||||
this.splitContainer1.SplitterDistance = 150;
|
||||
this.splitContainer1.TabIndex = 0;
|
||||
//
|
||||
// getIDButton
|
||||
//
|
||||
this.getIDButton.Location = new System.Drawing.Point(12, 480);
|
||||
this.getIDButton.Name = "getIDButton";
|
||||
this.getIDButton.Size = new System.Drawing.Size(128, 24);
|
||||
this.getIDButton.TabIndex = 12;
|
||||
this.getIDButton.Text = "Get ID";
|
||||
this.getIDButton.UseVisualStyleBackColor = true;
|
||||
this.getIDButton.Click += new System.EventHandler(this.getIDButton_Click);
|
||||
//
|
||||
// getFramesButton
|
||||
//
|
||||
this.getFramesButton.Location = new System.Drawing.Point(12, 450);
|
||||
this.getFramesButton.Name = "getFramesButton";
|
||||
this.getFramesButton.Size = new System.Drawing.Size(128, 24);
|
||||
this.getFramesButton.TabIndex = 11;
|
||||
this.getFramesButton.Text = "Get frames";
|
||||
this.getFramesButton.UseVisualStyleBackColor = true;
|
||||
this.getFramesButton.Click += new System.EventHandler(this.getFramesButton_Click);
|
||||
//
|
||||
// measurementLabel
|
||||
//
|
||||
this.measurementLabel.AutoSize = true;
|
||||
this.measurementLabel.Location = new System.Drawing.Point(12, 374);
|
||||
this.measurementLabel.Name = "measurementLabel";
|
||||
this.measurementLabel.Size = new System.Drawing.Size(74, 13);
|
||||
this.measurementLabel.TabIndex = 15;
|
||||
this.measurementLabel.Text = "Measurement:";
|
||||
//
|
||||
// stateLabel
|
||||
//
|
||||
this.stateLabel.AutoSize = true;
|
||||
this.stateLabel.Location = new System.Drawing.Point(12, 194);
|
||||
this.stateLabel.Name = "stateLabel";
|
||||
this.stateLabel.Size = new System.Drawing.Size(112, 13);
|
||||
this.stateLabel.TabIndex = 14;
|
||||
this.stateLabel.Text = "State and connection:";
|
||||
//
|
||||
// capabilitiesLabel
|
||||
//
|
||||
this.capabilitiesLabel.AutoSize = true;
|
||||
this.capabilitiesLabel.Location = new System.Drawing.Point(12, 9);
|
||||
this.capabilitiesLabel.Name = "capabilitiesLabel";
|
||||
this.capabilitiesLabel.Size = new System.Drawing.Size(63, 13);
|
||||
this.capabilitiesLabel.TabIndex = 13;
|
||||
this.capabilitiesLabel.Text = "Capabilities:";
|
||||
//
|
||||
// getQuantityUnitsButton
|
||||
//
|
||||
this.getQuantityUnitsButton.Location = new System.Drawing.Point(12, 145);
|
||||
this.getQuantityUnitsButton.Name = "getQuantityUnitsButton";
|
||||
this.getQuantityUnitsButton.Size = new System.Drawing.Size(128, 24);
|
||||
this.getQuantityUnitsButton.TabIndex = 4;
|
||||
this.getQuantityUnitsButton.Text = "Get quantity units";
|
||||
this.getQuantityUnitsButton.UseVisualStyleBackColor = true;
|
||||
this.getQuantityUnitsButton.Click += new System.EventHandler(this.getQuantityUnitsButton_Click);
|
||||
//
|
||||
// getQuantityCaptionButton
|
||||
//
|
||||
this.getQuantityCaptionButton.Location = new System.Drawing.Point(12, 115);
|
||||
this.getQuantityCaptionButton.Name = "getQuantityCaptionButton";
|
||||
this.getQuantityCaptionButton.Size = new System.Drawing.Size(128, 24);
|
||||
this.getQuantityCaptionButton.TabIndex = 3;
|
||||
this.getQuantityCaptionButton.Text = "Get quantity caption";
|
||||
this.getQuantityCaptionButton.UseVisualStyleBackColor = true;
|
||||
this.getQuantityCaptionButton.Click += new System.EventHandler(this.getQuantityCaptionButton_Click);
|
||||
//
|
||||
// getQuantitiesCountButton
|
||||
//
|
||||
this.getQuantitiesCountButton.Location = new System.Drawing.Point(12, 85);
|
||||
this.getQuantitiesCountButton.Name = "getQuantitiesCountButton";
|
||||
this.getQuantitiesCountButton.Size = new System.Drawing.Size(128, 24);
|
||||
this.getQuantitiesCountButton.TabIndex = 2;
|
||||
this.getQuantitiesCountButton.Text = "Get quantities count";
|
||||
this.getQuantitiesCountButton.UseVisualStyleBackColor = true;
|
||||
this.getQuantitiesCountButton.Click += new System.EventHandler(this.getQuantitiesCountButton_Click);
|
||||
//
|
||||
// getVolumeUnitsButton
|
||||
//
|
||||
this.getVolumeUnitsButton.Location = new System.Drawing.Point(12, 55);
|
||||
this.getVolumeUnitsButton.Name = "getVolumeUnitsButton";
|
||||
this.getVolumeUnitsButton.Size = new System.Drawing.Size(128, 24);
|
||||
this.getVolumeUnitsButton.TabIndex = 1;
|
||||
this.getVolumeUnitsButton.Text = "Get volume units";
|
||||
this.getVolumeUnitsButton.UseVisualStyleBackColor = true;
|
||||
this.getVolumeUnitsButton.Click += new System.EventHandler(this.getVolumeUnitsButton_Click);
|
||||
//
|
||||
// getTimeUnitsButton
|
||||
//
|
||||
this.getTimeUnitsButton.Location = new System.Drawing.Point(12, 25);
|
||||
this.getTimeUnitsButton.Name = "getTimeUnitsButton";
|
||||
this.getTimeUnitsButton.Size = new System.Drawing.Size(128, 24);
|
||||
this.getTimeUnitsButton.TabIndex = 0;
|
||||
this.getTimeUnitsButton.Text = "Get time units";
|
||||
this.getTimeUnitsButton.UseVisualStyleBackColor = true;
|
||||
this.getTimeUnitsButton.Click += new System.EventHandler(this.getTimeUnitsButton_Click);
|
||||
//
|
||||
// setStateButton
|
||||
//
|
||||
this.setStateButton.Location = new System.Drawing.Point(12, 315);
|
||||
this.setStateButton.Name = "setStateButton";
|
||||
this.setStateButton.Size = new System.Drawing.Size(128, 24);
|
||||
this.setStateButton.TabIndex = 8;
|
||||
this.setStateButton.Text = "Set state";
|
||||
this.setStateButton.UseVisualStyleBackColor = true;
|
||||
this.setStateButton.Click += new System.EventHandler(this.setStateButton_Click);
|
||||
//
|
||||
// getStateButton
|
||||
//
|
||||
this.getStateButton.Location = new System.Drawing.Point(12, 285);
|
||||
this.getStateButton.Name = "getStateButton";
|
||||
this.getStateButton.Size = new System.Drawing.Size(128, 24);
|
||||
this.getStateButton.TabIndex = 7;
|
||||
this.getStateButton.Text = "Get state";
|
||||
this.getStateButton.UseVisualStyleBackColor = true;
|
||||
this.getStateButton.Click += new System.EventHandler(this.getStateButton_Click);
|
||||
//
|
||||
// stopMeasurementButton
|
||||
//
|
||||
this.stopMeasurementButton.Location = new System.Drawing.Point(12, 420);
|
||||
this.stopMeasurementButton.Name = "stopMeasurementButton";
|
||||
this.stopMeasurementButton.Size = new System.Drawing.Size(128, 24);
|
||||
this.stopMeasurementButton.TabIndex = 10;
|
||||
this.stopMeasurementButton.Text = "Stop measurement";
|
||||
this.stopMeasurementButton.UseVisualStyleBackColor = true;
|
||||
this.stopMeasurementButton.Click += new System.EventHandler(this.stopMeasurementButton_Click);
|
||||
//
|
||||
// startMeasurementButton
|
||||
//
|
||||
this.startMeasurementButton.Location = new System.Drawing.Point(12, 390);
|
||||
this.startMeasurementButton.Name = "startMeasurementButton";
|
||||
this.startMeasurementButton.Size = new System.Drawing.Size(128, 24);
|
||||
this.startMeasurementButton.TabIndex = 9;
|
||||
this.startMeasurementButton.Text = "Start measurement";
|
||||
this.startMeasurementButton.UseVisualStyleBackColor = true;
|
||||
this.startMeasurementButton.Click += new System.EventHandler(this.startMeasurementButton_Click);
|
||||
//
|
||||
// closeConnectionButton
|
||||
//
|
||||
this.closeConnectionButton.Location = new System.Drawing.Point(12, 240);
|
||||
this.closeConnectionButton.Name = "closeConnectionButton";
|
||||
this.closeConnectionButton.Size = new System.Drawing.Size(128, 24);
|
||||
this.closeConnectionButton.TabIndex = 6;
|
||||
this.closeConnectionButton.Text = "Close connection";
|
||||
this.closeConnectionButton.UseVisualStyleBackColor = true;
|
||||
this.closeConnectionButton.Click += new System.EventHandler(this.closeConnectionButton_Click);
|
||||
//
|
||||
// openConnectionButton
|
||||
//
|
||||
this.openConnectionButton.Location = new System.Drawing.Point(12, 210);
|
||||
this.openConnectionButton.Name = "openConnectionButton";
|
||||
this.openConnectionButton.Size = new System.Drawing.Size(128, 24);
|
||||
this.openConnectionButton.TabIndex = 5;
|
||||
this.openConnectionButton.Text = "Open connection";
|
||||
this.openConnectionButton.UseVisualStyleBackColor = true;
|
||||
this.openConnectionButton.Click += new System.EventHandler(this.openConnectionButton_Click);
|
||||
//
|
||||
// splitContainer2
|
||||
//
|
||||
this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.splitContainer2.Location = new System.Drawing.Point(0, 0);
|
||||
this.splitContainer2.Name = "splitContainer2";
|
||||
this.splitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal;
|
||||
//
|
||||
// splitContainer2.Panel1
|
||||
//
|
||||
this.splitContainer2.Panel1.Controls.Add(this.logsTextBox);
|
||||
//
|
||||
// splitContainer2.Panel2
|
||||
//
|
||||
this.splitContainer2.Panel2.Controls.Add(this.dataTabControl);
|
||||
this.splitContainer2.Size = new System.Drawing.Size(672, 583);
|
||||
this.splitContainer2.SplitterDistance = 222;
|
||||
this.splitContainer2.TabIndex = 0;
|
||||
//
|
||||
// logsTextBox
|
||||
//
|
||||
this.logsTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.logsTextBox.Location = new System.Drawing.Point(0, 0);
|
||||
this.logsTextBox.Multiline = true;
|
||||
this.logsTextBox.Name = "logsTextBox";
|
||||
this.logsTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
||||
this.logsTextBox.Size = new System.Drawing.Size(672, 222);
|
||||
this.logsTextBox.TabIndex = 0;
|
||||
//
|
||||
// dataTabControl
|
||||
//
|
||||
this.dataTabControl.Controls.Add(this.tabPage1);
|
||||
this.dataTabControl.Controls.Add(this.tabPage2);
|
||||
this.dataTabControl.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.dataTabControl.Location = new System.Drawing.Point(0, 0);
|
||||
this.dataTabControl.Name = "dataTabControl";
|
||||
this.dataTabControl.SelectedIndex = 0;
|
||||
this.dataTabControl.Size = new System.Drawing.Size(672, 357);
|
||||
this.dataTabControl.TabIndex = 0;
|
||||
//
|
||||
// tabPage1
|
||||
//
|
||||
this.tabPage1.Controls.Add(this.framesListView);
|
||||
this.tabPage1.Location = new System.Drawing.Point(4, 22);
|
||||
this.tabPage1.Name = "tabPage1";
|
||||
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tabPage1.Size = new System.Drawing.Size(664, 331);
|
||||
this.tabPage1.TabIndex = 0;
|
||||
this.tabPage1.Text = "Transferred frames";
|
||||
this.tabPage1.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// tabPage2
|
||||
//
|
||||
this.tabPage2.Location = new System.Drawing.Point(4, 22);
|
||||
this.tabPage2.Name = "tabPage2";
|
||||
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tabPage2.Size = new System.Drawing.Size(664, 331);
|
||||
this.tabPage2.TabIndex = 1;
|
||||
this.tabPage2.Text = "Graph";
|
||||
this.tabPage2.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// framesListView
|
||||
//
|
||||
this.framesListView.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.framesListView.GridLines = true;
|
||||
this.framesListView.Location = new System.Drawing.Point(3, 3);
|
||||
this.framesListView.Name = "framesListView";
|
||||
this.framesListView.Size = new System.Drawing.Size(658, 325);
|
||||
this.framesListView.TabIndex = 0;
|
||||
this.framesListView.UseCompatibleStateImageBehavior = false;
|
||||
this.framesListView.View = System.Windows.Forms.View.Details;
|
||||
//
|
||||
// DemoMainWnd
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(826, 583);
|
||||
this.Controls.Add(this.splitContainer1);
|
||||
this.Name = "DemoMainWnd";
|
||||
this.Text = "Datastream interface test";
|
||||
this.splitContainer1.Panel1.ResumeLayout(false);
|
||||
this.splitContainer1.Panel1.PerformLayout();
|
||||
this.splitContainer1.Panel2.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
|
||||
this.splitContainer1.ResumeLayout(false);
|
||||
this.splitContainer2.Panel1.ResumeLayout(false);
|
||||
this.splitContainer2.Panel1.PerformLayout();
|
||||
this.splitContainer2.Panel2.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit();
|
||||
this.splitContainer2.ResumeLayout(false);
|
||||
this.dataTabControl.ResumeLayout(false);
|
||||
this.tabPage1.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.SplitContainer splitContainer1;
|
||||
private System.Windows.Forms.Button openConnectionButton;
|
||||
private System.Windows.Forms.Button closeConnectionButton;
|
||||
private System.Windows.Forms.Button stopMeasurementButton;
|
||||
private System.Windows.Forms.Button startMeasurementButton;
|
||||
private System.Windows.Forms.Button setStateButton;
|
||||
private System.Windows.Forms.Button getStateButton;
|
||||
private System.Windows.Forms.Button getQuantityUnitsButton;
|
||||
private System.Windows.Forms.Button getQuantityCaptionButton;
|
||||
private System.Windows.Forms.Button getQuantitiesCountButton;
|
||||
private System.Windows.Forms.Button getVolumeUnitsButton;
|
||||
private System.Windows.Forms.Button getTimeUnitsButton;
|
||||
private System.Windows.Forms.Label measurementLabel;
|
||||
private System.Windows.Forms.Label stateLabel;
|
||||
private System.Windows.Forms.Label capabilitiesLabel;
|
||||
private System.Windows.Forms.Button getIDButton;
|
||||
private System.Windows.Forms.Button getFramesButton;
|
||||
private System.Windows.Forms.SplitContainer splitContainer2;
|
||||
private System.Windows.Forms.TextBox logsTextBox;
|
||||
private System.Windows.Forms.TabControl dataTabControl;
|
||||
private System.Windows.Forms.TabPage tabPage1;
|
||||
private System.Windows.Forms.ListView framesListView;
|
||||
private System.Windows.Forms.TabPage tabPage2;
|
||||
}
|
||||
}
|
||||
|
||||
284
DataStreamInterfaceTest/DemoMainWnd.cs
Normal file
284
DataStreamInterfaceTest/DemoMainWnd.cs
Normal file
@ -0,0 +1,284 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using DataStreamInterface;
|
||||
|
||||
namespace DataStreamInterfaceTest
|
||||
{
|
||||
public partial class DemoMainWnd : Form
|
||||
{
|
||||
IDataStreamMeter dataStreamMeter;
|
||||
|
||||
ActivityLog activityLog;
|
||||
|
||||
Unit timeUnits;
|
||||
Unit volumeUnits;
|
||||
int quantitiesCount;
|
||||
string[] quantityCaption;
|
||||
Unit[] quantityUnit;
|
||||
|
||||
Int64 storedFramesCount;
|
||||
DataFrame[] transferredFrames;
|
||||
|
||||
public DemoMainWnd() : this(null) { }
|
||||
|
||||
public DemoMainWnd(IDataStreamMeter dataStreamMeter)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.dataStreamMeter = dataStreamMeter;
|
||||
activityLog = new ActivityLog(logsTextBox);
|
||||
|
||||
framesListView.Columns.Add("ID", 100);
|
||||
framesListView.Columns.Add("Time", 100);
|
||||
framesListView.Columns.Add("Volume", 100);
|
||||
framesListView.Columns.Add("Additional quantities", 300);
|
||||
framesListView.ListViewItemSorter = new LviIDComparer();
|
||||
}
|
||||
|
||||
void ShowNoMeterInterfaceMessage()
|
||||
{
|
||||
MessageBox.Show("No datastream meter interface");
|
||||
}
|
||||
|
||||
private void getTimeUnitsButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataStreamMeter == null)
|
||||
ShowNoMeterInterfaceMessage();
|
||||
else
|
||||
{
|
||||
timeUnits = dataStreamMeter.GetTimeUnits();
|
||||
activityLog.Print(string.Format("Time units are {0}", timeUnits));
|
||||
}
|
||||
}
|
||||
|
||||
private void getVolumeUnitsButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataStreamMeter == null)
|
||||
ShowNoMeterInterfaceMessage();
|
||||
else
|
||||
{
|
||||
volumeUnits = dataStreamMeter.GetVolumeUnits();
|
||||
activityLog.Print(string.Format("Volume units are {0}", volumeUnits));
|
||||
}
|
||||
}
|
||||
|
||||
private void getQuantitiesCountButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataStreamMeter == null)
|
||||
ShowNoMeterInterfaceMessage();
|
||||
else
|
||||
{
|
||||
int quantitesCountOri = quantitiesCount;
|
||||
quantitiesCount = dataStreamMeter.GetQuantitiesCount();
|
||||
activityLog.Print(string.Format("There are {0} additional quantites", quantitiesCount));
|
||||
|
||||
if (quantitesCountOri == 0)
|
||||
{
|
||||
quantityUnit = new Unit[quantitiesCount];
|
||||
quantityCaption = new string[quantitiesCount];
|
||||
for (int i = 0; i < quantitiesCount; i++) quantityCaption[i] = string.Empty;
|
||||
}
|
||||
else if (quantitiesCount != quantitesCountOri)
|
||||
{
|
||||
quantityUnit = new Unit[quantitiesCount];
|
||||
quantityCaption = new string[quantitiesCount];
|
||||
for (int i = 0; i < quantitiesCount; i++) quantityCaption[i] = string.Empty;
|
||||
|
||||
activityLog.Print(string.Format("Quantities count changed during operation"));
|
||||
MessageBox.Show("Quantities count changed during operation", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void getQuantityCaptionButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataStreamMeter == null)
|
||||
ShowNoMeterInterfaceMessage();
|
||||
else
|
||||
{
|
||||
GetIntegerNumberDlg dlg = new GetIntegerNumberDlg(string.Format("Enter index {0} .. {1}", 0, quantitiesCount - 1), 0, quantitiesCount - 1);
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
quantityCaption[dlg.Number] = dataStreamMeter.GetQuantityCaption(dlg.Number);
|
||||
activityLog.Print(string.Format("Caption of quantity #{0} is {1}", dlg.Number, quantityCaption[dlg.Number]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void getQuantityUnitsButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataStreamMeter == null)
|
||||
ShowNoMeterInterfaceMessage();
|
||||
else
|
||||
{
|
||||
GetIntegerNumberDlg dlg = new GetIntegerNumberDlg(string.Format("Enter index {0} .. {1}", 0, quantitiesCount - 1), 0, quantitiesCount - 1);
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
quantityUnit[dlg.Number] = dataStreamMeter.GetQuantityUnits(dlg.Number);
|
||||
activityLog.Print(string.Format("Units of quantity #{0} are {1}", dlg.Number, quantityUnit[dlg.Number]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void openConnectionButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataStreamMeter == null)
|
||||
ShowNoMeterInterfaceMessage();
|
||||
else
|
||||
{
|
||||
string meterId;
|
||||
if (dataStreamMeter.OpenConnection("no connection parameters", out meterId))
|
||||
{
|
||||
activityLog.Print(string.Format("Connection established, meter ID is {0}", meterId));
|
||||
}
|
||||
else
|
||||
{
|
||||
activityLog.Print("Failed to establish a connection");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void closeConnectionButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataStreamMeter == null)
|
||||
ShowNoMeterInterfaceMessage();
|
||||
else
|
||||
{
|
||||
if (dataStreamMeter.CloseConnection())
|
||||
{
|
||||
framesListView.Items.Clear();
|
||||
activityLog.Print("Connection closed");
|
||||
}
|
||||
else
|
||||
{
|
||||
activityLog.Print("Failed to close the connection");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void getStateButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataStreamMeter == null)
|
||||
ShowNoMeterInterfaceMessage();
|
||||
else
|
||||
{
|
||||
int state;
|
||||
string parameter;
|
||||
if (dataStreamMeter.GetState(out state, out parameter))
|
||||
{
|
||||
activityLog.Print(string.Format("Water meter state is {0} / {1}", state, parameter));
|
||||
}
|
||||
else
|
||||
{
|
||||
activityLog.Print("Failed to obtain the water meter state");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setStateButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataStreamMeter == null)
|
||||
ShowNoMeterInterfaceMessage();
|
||||
else
|
||||
{
|
||||
GetStateDlg dlg = new GetStateDlg();
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
if (dataStreamMeter.SetState(dlg.State, dlg.Parameter))
|
||||
{
|
||||
activityLog.Print(string.Format("Water meter state set to {0} / {1}", dlg.State, dlg.Parameter));
|
||||
}
|
||||
else
|
||||
{
|
||||
activityLog.Print(string.Format("Failed to set the water meter state to {0} / {1}", dlg.State, dlg.Parameter));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void startMeasurementButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataStreamMeter == null)
|
||||
ShowNoMeterInterfaceMessage();
|
||||
else
|
||||
{
|
||||
if (dataStreamMeter.StartMeasurement())
|
||||
{
|
||||
framesListView.Items.Clear();
|
||||
activityLog.Print(string.Format("Measurement started"));
|
||||
}
|
||||
else
|
||||
{
|
||||
activityLog.Print("Failed to start a measurement");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void stopMeasurementButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataStreamMeter == null)
|
||||
ShowNoMeterInterfaceMessage();
|
||||
else
|
||||
{
|
||||
if (dataStreamMeter.StopMeasurement(out storedFramesCount))
|
||||
{
|
||||
framesListView.Items.Clear();
|
||||
activityLog.Print(string.Format("Measurement sopped, {0} frames acquired", storedFramesCount));
|
||||
}
|
||||
else
|
||||
{
|
||||
activityLog.Print("Failed to stop the measurement");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void getFramesButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataStreamMeter == null)
|
||||
ShowNoMeterInterfaceMessage();
|
||||
else
|
||||
{
|
||||
GetFrameBoundariesDlg dlg = new GetFrameBoundariesDlg("Enter frames range boundaries", 0, storedFramesCount - 1);
|
||||
if (dlg.ShowDialog() != DialogResult.OK) return;
|
||||
DataFrame[] frames = dataStreamMeter.GetFrames(dlg.From, Convert.ToInt32(dlg.To - dlg.From + 1));
|
||||
{
|
||||
foreach (var frame in frames)
|
||||
{
|
||||
if (frame != null) framesListView.Items.Add(GetListViewItem(frame));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void getIDButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataStreamMeter == null)
|
||||
ShowNoMeterInterfaceMessage();
|
||||
else
|
||||
{
|
||||
GetDblValueDlg dlg = new GetDblValueDlg("Enter time in seconds");
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
Int64 id = dataStreamMeter.GetID(dlg.DblValue);
|
||||
activityLog.Print(string.Format("GetID({0}) returned {1}", dlg.DblValue, id));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ListViewItem GetListViewItem(DataFrame frame)
|
||||
{
|
||||
ListViewItem lvi = new ListViewItem(frame.ID.ToString());
|
||||
lvi.SubItems.Add(frame.Time.ToString());
|
||||
lvi.SubItems.Add(frame.Volume.ToString());
|
||||
StringBuilder sb = new StringBuilder();
|
||||
foreach (var quantity in frame.Quantity)
|
||||
{
|
||||
sb.Append(quantity.ToString());
|
||||
sb.Append(" ");
|
||||
}
|
||||
lvi.SubItems.Add(sb.ToString());
|
||||
lvi.Tag = frame;
|
||||
return lvi;
|
||||
}
|
||||
}
|
||||
}
|
||||
120
DataStreamInterfaceTest/DemoMainWnd.resx
Normal file
120
DataStreamInterfaceTest/DemoMainWnd.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
88
DataStreamInterfaceTest/GetDblValueDlg.Designer.cs
generated
Normal file
88
DataStreamInterfaceTest/GetDblValueDlg.Designer.cs
generated
Normal file
@ -0,0 +1,88 @@
|
||||
namespace DataStreamInterfaceTest
|
||||
{
|
||||
partial class GetDblValueDlg
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.valueTextBox = new System.Windows.Forms.TextBox();
|
||||
this.okButton = new System.Windows.Forms.Button();
|
||||
this.cancelButton = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// valueTextBox
|
||||
//
|
||||
this.valueTextBox.Location = new System.Drawing.Point(35, 20);
|
||||
this.valueTextBox.Name = "valueTextBox";
|
||||
this.valueTextBox.Size = new System.Drawing.Size(94, 20);
|
||||
this.valueTextBox.TabIndex = 0;
|
||||
//
|
||||
// okButton
|
||||
//
|
||||
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.okButton.Location = new System.Drawing.Point(216, 16);
|
||||
this.okButton.Name = "okButton";
|
||||
this.okButton.Size = new System.Drawing.Size(75, 29);
|
||||
this.okButton.TabIndex = 1;
|
||||
this.okButton.Text = "OK";
|
||||
this.okButton.UseVisualStyleBackColor = true;
|
||||
this.okButton.Click += new System.EventHandler(this.okButton_Click);
|
||||
//
|
||||
// cancelButton
|
||||
//
|
||||
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.cancelButton.Location = new System.Drawing.Point(306, 16);
|
||||
this.cancelButton.Name = "cancelButton";
|
||||
this.cancelButton.Size = new System.Drawing.Size(75, 29);
|
||||
this.cancelButton.TabIndex = 2;
|
||||
this.cancelButton.Text = "Cancel";
|
||||
this.cancelButton.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// GetFlowDlg
|
||||
//
|
||||
this.AcceptButton = this.okButton;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.CancelButton = this.cancelButton;
|
||||
this.ClientSize = new System.Drawing.Size(396, 58);
|
||||
this.Controls.Add(this.cancelButton);
|
||||
this.Controls.Add(this.okButton);
|
||||
this.Controls.Add(this.valueTextBox);
|
||||
this.Name = "GetFlowDlg";
|
||||
this.Text = "Enter flow";
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TextBox valueTextBox;
|
||||
private System.Windows.Forms.Button okButton;
|
||||
private System.Windows.Forms.Button cancelButton;
|
||||
}
|
||||
}
|
||||
59
DataStreamInterfaceTest/GetDblValueDlg.cs
Normal file
59
DataStreamInterfaceTest/GetDblValueDlg.cs
Normal file
@ -0,0 +1,59 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace DataStreamInterfaceTest
|
||||
{
|
||||
public partial class GetDblValueDlg : Form
|
||||
{
|
||||
public double DblValue;
|
||||
|
||||
double lowerLimit;
|
||||
double upperLimit;
|
||||
|
||||
|
||||
public GetDblValueDlg()
|
||||
: this("Enter flow in [m3/h] please")
|
||||
{
|
||||
}
|
||||
|
||||
public GetDblValueDlg(string title)
|
||||
: this(title, 0, 100.0)
|
||||
{
|
||||
}
|
||||
|
||||
public GetDblValueDlg(string title, double lowerLimit, double upperLimit)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.Text = title;
|
||||
this.lowerLimit = lowerLimit;
|
||||
this.upperLimit = upperLimit;
|
||||
}
|
||||
|
||||
|
||||
private void okButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
double val;
|
||||
if (TryParseUDouble(valueTextBox.Text, out val))
|
||||
{
|
||||
DblValue = val;
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Invalid value");
|
||||
DialogResult = DialogResult.None;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parse an unsigned double number
|
||||
/// </summary>
|
||||
bool TryParseUDouble(string text, out double result)
|
||||
{
|
||||
return double.TryParse(text, NumberStyles.AllowDecimalPoint, CultureInfo.CurrentCulture, out result) ||
|
||||
double.TryParse(text, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out result);
|
||||
}
|
||||
}
|
||||
}
|
||||
120
DataStreamInterfaceTest/GetDblValueDlg.resx
Normal file
120
DataStreamInterfaceTest/GetDblValueDlg.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
126
DataStreamInterfaceTest/GetFrameBoundariesDlg.Designer.cs
generated
Normal file
126
DataStreamInterfaceTest/GetFrameBoundariesDlg.Designer.cs
generated
Normal file
@ -0,0 +1,126 @@
|
||||
namespace DataStreamInterfaceTest
|
||||
{
|
||||
partial class GetFrameBoundariesDlg
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.fromTextBox = new System.Windows.Forms.TextBox();
|
||||
this.okButton = new System.Windows.Forms.Button();
|
||||
this.cancelButton = new System.Windows.Forms.Button();
|
||||
this.toTextBox = new System.Windows.Forms.TextBox();
|
||||
this.fromLabel = new System.Windows.Forms.Label();
|
||||
this.toLabel = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// fromTextBox
|
||||
//
|
||||
this.fromTextBox.Location = new System.Drawing.Point(89, 16);
|
||||
this.fromTextBox.Name = "fromTextBox";
|
||||
this.fromTextBox.Size = new System.Drawing.Size(100, 20);
|
||||
this.fromTextBox.TabIndex = 0;
|
||||
//
|
||||
// okButton
|
||||
//
|
||||
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.okButton.Location = new System.Drawing.Point(225, 24);
|
||||
this.okButton.Name = "okButton";
|
||||
this.okButton.Size = new System.Drawing.Size(75, 36);
|
||||
this.okButton.TabIndex = 1;
|
||||
this.okButton.Text = "OK";
|
||||
this.okButton.UseVisualStyleBackColor = true;
|
||||
this.okButton.Click += new System.EventHandler(this.okButton_Click);
|
||||
//
|
||||
// cancelButton
|
||||
//
|
||||
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.cancelButton.Location = new System.Drawing.Point(316, 24);
|
||||
this.cancelButton.Name = "cancelButton";
|
||||
this.cancelButton.Size = new System.Drawing.Size(75, 36);
|
||||
this.cancelButton.TabIndex = 2;
|
||||
this.cancelButton.Text = "Cancel";
|
||||
this.cancelButton.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// toTextBox
|
||||
//
|
||||
this.toTextBox.Location = new System.Drawing.Point(89, 46);
|
||||
this.toTextBox.Name = "toTextBox";
|
||||
this.toTextBox.Size = new System.Drawing.Size(100, 20);
|
||||
this.toTextBox.TabIndex = 3;
|
||||
//
|
||||
// fromLabel
|
||||
//
|
||||
this.fromLabel.AutoSize = true;
|
||||
this.fromLabel.Location = new System.Drawing.Point(12, 19);
|
||||
this.fromLabel.Name = "fromLabel";
|
||||
this.fromLabel.Size = new System.Drawing.Size(30, 13);
|
||||
this.fromLabel.TabIndex = 4;
|
||||
this.fromLabel.Text = "From";
|
||||
//
|
||||
// toLabel
|
||||
//
|
||||
this.toLabel.AutoSize = true;
|
||||
this.toLabel.Location = new System.Drawing.Point(12, 49);
|
||||
this.toLabel.Name = "toLabel";
|
||||
this.toLabel.Size = new System.Drawing.Size(20, 13);
|
||||
this.toLabel.TabIndex = 5;
|
||||
this.toLabel.Text = "To";
|
||||
//
|
||||
// GetFrameBoundariesDlg
|
||||
//
|
||||
this.AcceptButton = this.okButton;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.AutoSize = true;
|
||||
this.CancelButton = this.cancelButton;
|
||||
this.ClientSize = new System.Drawing.Size(419, 79);
|
||||
this.ControlBox = false;
|
||||
this.Controls.Add(this.toLabel);
|
||||
this.Controls.Add(this.fromLabel);
|
||||
this.Controls.Add(this.toTextBox);
|
||||
this.Controls.Add(this.cancelButton);
|
||||
this.Controls.Add(this.okButton);
|
||||
this.Controls.Add(this.fromTextBox);
|
||||
this.Name = "GetFrameBoundariesDlg";
|
||||
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Enter frames range boundaries";
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TextBox fromTextBox;
|
||||
private System.Windows.Forms.Button okButton;
|
||||
private System.Windows.Forms.Button cancelButton;
|
||||
private System.Windows.Forms.TextBox toTextBox;
|
||||
private System.Windows.Forms.Label fromLabel;
|
||||
private System.Windows.Forms.Label toLabel;
|
||||
}
|
||||
}
|
||||
88
DataStreamInterfaceTest/GetFrameBoundariesDlg.cs
Normal file
88
DataStreamInterfaceTest/GetFrameBoundariesDlg.cs
Normal file
@ -0,0 +1,88 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace DataStreamInterfaceTest
|
||||
{
|
||||
public partial class GetFrameBoundariesDlg : Form
|
||||
{
|
||||
/// <summary>
|
||||
/// Integer number entered in this form
|
||||
/// </summary>
|
||||
public Int64 From;
|
||||
public Int64 To;
|
||||
|
||||
Int64 lowerLimit;
|
||||
Int64 upperLimit;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor
|
||||
/// </summary>
|
||||
public GetFrameBoundariesDlg()
|
||||
: this("Enter state please")
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor with a custom window title.
|
||||
/// </summary>
|
||||
/// <param name="title">Window title</param>
|
||||
public GetFrameBoundariesDlg(string title)
|
||||
: this(title, Int64.MinValue, Int64.MaxValue)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor with a custom window title, limits and non-empty initial value.
|
||||
/// </summary>
|
||||
/// <param name="title">Window title</param>
|
||||
/// <param name="lowerLimit">Lower limit</param>
|
||||
/// <param name="upperLimit">Upper limit</param>
|
||||
/// <param name="initialValue">Initial value</param>
|
||||
public GetFrameBoundariesDlg(string title, Int64 lowerLimit, Int64 upperLimit, int initialValue)
|
||||
: this(title, lowerLimit, upperLimit)
|
||||
{
|
||||
fromTextBox.Text = initialValue.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor with a custom window title and lower/upper limits.
|
||||
/// </summary>
|
||||
/// <param name="title">Window title</param>
|
||||
/// <param name="lowerLimit">Lower limit</param>
|
||||
/// <param name="upperLimit">Upper limit</param>
|
||||
public GetFrameBoundariesDlg(string title, Int64 lowerLimit, Int64 upperLimit)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.Text = title;
|
||||
this.lowerLimit = lowerLimit;
|
||||
this.upperLimit = upperLimit;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// OK button handler that verifies validity of the entered value.
|
||||
/// </summary>
|
||||
private void okButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
Int64 from;
|
||||
Int64 to;
|
||||
if (Int64.TryParse(fromTextBox.Text, out from) && from >= lowerLimit && from <= upperLimit &&
|
||||
Int64.TryParse(toTextBox.Text, out to) && to >= lowerLimit && to <= upperLimit &&
|
||||
to >= from && to < from + Int32.MaxValue)
|
||||
{
|
||||
From = from;
|
||||
To = to;
|
||||
DialogResult = DialogResult.OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
string message = (lowerLimit != 0 || upperLimit != Int32.MaxValue)
|
||||
? string.Format("Invalid boundaries ({0}..{1})", lowerLimit, upperLimit)
|
||||
: "Invalid boundaries";
|
||||
MessageBox.Show(message);
|
||||
DialogResult = DialogResult.None; /// Prevent closing this window
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
120
DataStreamInterfaceTest/GetFrameBoundariesDlg.resx
Normal file
120
DataStreamInterfaceTest/GetFrameBoundariesDlg.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
90
DataStreamInterfaceTest/GetIntegerNumberDlg.Designer.cs
generated
Normal file
90
DataStreamInterfaceTest/GetIntegerNumberDlg.Designer.cs
generated
Normal file
@ -0,0 +1,90 @@
|
||||
namespace DataStreamInterfaceTest
|
||||
{
|
||||
partial class GetIntegerNumberDlg
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.numberTextBox = new System.Windows.Forms.TextBox();
|
||||
this.okButton = new System.Windows.Forms.Button();
|
||||
this.cancelButton = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// numberTextBox
|
||||
//
|
||||
this.numberTextBox.Location = new System.Drawing.Point(36, 16);
|
||||
this.numberTextBox.Name = "numberTextBox";
|
||||
this.numberTextBox.Size = new System.Drawing.Size(100, 20);
|
||||
this.numberTextBox.TabIndex = 0;
|
||||
//
|
||||
// okButton
|
||||
//
|
||||
this.okButton.Location = new System.Drawing.Point(174, 7);
|
||||
this.okButton.Name = "okButton";
|
||||
this.okButton.Size = new System.Drawing.Size(75, 36);
|
||||
this.okButton.TabIndex = 1;
|
||||
this.okButton.Text = "OK";
|
||||
this.okButton.UseVisualStyleBackColor = true;
|
||||
this.okButton.Click += new System.EventHandler(this.okButton_Click);
|
||||
//
|
||||
// cancelButton
|
||||
//
|
||||
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.cancelButton.Location = new System.Drawing.Point(265, 7);
|
||||
this.cancelButton.Name = "cancelButton";
|
||||
this.cancelButton.Size = new System.Drawing.Size(75, 36);
|
||||
this.cancelButton.TabIndex = 2;
|
||||
this.cancelButton.Text = "Cancel";
|
||||
this.cancelButton.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// GetIntegerNumberDlg
|
||||
//
|
||||
this.AcceptButton = this.okButton;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.AutoSize = true;
|
||||
this.CancelButton = this.cancelButton;
|
||||
this.ClientSize = new System.Drawing.Size(363, 50);
|
||||
this.ControlBox = false;
|
||||
this.Controls.Add(this.cancelButton);
|
||||
this.Controls.Add(this.okButton);
|
||||
this.Controls.Add(this.numberTextBox);
|
||||
this.Name = "GetIntegerNumberDlg";
|
||||
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Enter integer number please";
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TextBox numberTextBox;
|
||||
private System.Windows.Forms.Button okButton;
|
||||
private System.Windows.Forms.Button cancelButton;
|
||||
}
|
||||
}
|
||||
83
DataStreamInterfaceTest/GetIntegerNumberDlg.cs
Normal file
83
DataStreamInterfaceTest/GetIntegerNumberDlg.cs
Normal file
@ -0,0 +1,83 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace DataStreamInterfaceTest
|
||||
{
|
||||
public partial class GetIntegerNumberDlg : Form
|
||||
{
|
||||
/// <summary>
|
||||
/// Integer number entered in this form
|
||||
/// </summary>
|
||||
public int Number;
|
||||
|
||||
int lowerLimit;
|
||||
int upperLimit;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor
|
||||
/// </summary>
|
||||
public GetIntegerNumberDlg()
|
||||
: this("Enter integer number please")
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor with a custom window title.
|
||||
/// </summary>
|
||||
/// <param name="title">Window title</param>
|
||||
public GetIntegerNumberDlg(string title)
|
||||
: this(title, Int32.MinValue, Int32.MaxValue)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor with a custom window title, limits and non-empty initial value.
|
||||
/// </summary>
|
||||
/// <param name="title">Window title</param>
|
||||
/// <param name="lowerLimit">Lower limit</param>
|
||||
/// <param name="upperLimit">Upper limit</param>
|
||||
/// <param name="initialValue">Initial value</param>
|
||||
public GetIntegerNumberDlg(string title, int lowerLimit, int upperLimit, int initialValue)
|
||||
: this(title, lowerLimit, upperLimit)
|
||||
{
|
||||
numberTextBox.Text = initialValue.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor with a custom window title and lower/upper limits.
|
||||
/// </summary>
|
||||
/// <param name="title">Window title</param>
|
||||
/// <param name="lowerLimit">Lower limit</param>
|
||||
/// <param name="upperLimit">Upper limit</param>
|
||||
public GetIntegerNumberDlg(string title, int lowerLimit, int upperLimit)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.Text = title;
|
||||
this.lowerLimit = lowerLimit;
|
||||
this.upperLimit = upperLimit;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// OK button handler that verifies validity of the entered value.
|
||||
/// </summary>
|
||||
private void okButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
int number;
|
||||
if (int.TryParse(numberTextBox.Text, out number) && number >= lowerLimit && number <= upperLimit)
|
||||
{
|
||||
Number = number;
|
||||
DialogResult = DialogResult.OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
string message = (lowerLimit != Int32.MinValue || upperLimit != Int32.MaxValue)
|
||||
? string.Format("Invalid integer number ({0}..{1})", lowerLimit, upperLimit)
|
||||
: "Invalid integer number";
|
||||
MessageBox.Show(message);
|
||||
DialogResult = DialogResult.None; /// Prevent closing this window
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
120
DataStreamInterfaceTest/GetIntegerNumberDlg.resx
Normal file
120
DataStreamInterfaceTest/GetIntegerNumberDlg.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
126
DataStreamInterfaceTest/GetStateDlg.Designer.cs
generated
Normal file
126
DataStreamInterfaceTest/GetStateDlg.Designer.cs
generated
Normal file
@ -0,0 +1,126 @@
|
||||
namespace DataStreamInterfaceTest
|
||||
{
|
||||
partial class GetStateDlg
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.stateTextBox = new System.Windows.Forms.TextBox();
|
||||
this.okButton = new System.Windows.Forms.Button();
|
||||
this.cancelButton = new System.Windows.Forms.Button();
|
||||
this.parameterTextBox = new System.Windows.Forms.TextBox();
|
||||
this.stateLabel = new System.Windows.Forms.Label();
|
||||
this.parameterLabel = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// stateTextBox
|
||||
//
|
||||
this.stateTextBox.Location = new System.Drawing.Point(89, 16);
|
||||
this.stateTextBox.Name = "stateTextBox";
|
||||
this.stateTextBox.Size = new System.Drawing.Size(100, 20);
|
||||
this.stateTextBox.TabIndex = 0;
|
||||
//
|
||||
// okButton
|
||||
//
|
||||
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.okButton.Location = new System.Drawing.Point(225, 24);
|
||||
this.okButton.Name = "okButton";
|
||||
this.okButton.Size = new System.Drawing.Size(75, 36);
|
||||
this.okButton.TabIndex = 1;
|
||||
this.okButton.Text = "OK";
|
||||
this.okButton.UseVisualStyleBackColor = true;
|
||||
this.okButton.Click += new System.EventHandler(this.okButton_Click);
|
||||
//
|
||||
// cancelButton
|
||||
//
|
||||
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.cancelButton.Location = new System.Drawing.Point(316, 24);
|
||||
this.cancelButton.Name = "cancelButton";
|
||||
this.cancelButton.Size = new System.Drawing.Size(75, 36);
|
||||
this.cancelButton.TabIndex = 2;
|
||||
this.cancelButton.Text = "Cancel";
|
||||
this.cancelButton.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// parameterTextBox
|
||||
//
|
||||
this.parameterTextBox.Location = new System.Drawing.Point(89, 46);
|
||||
this.parameterTextBox.Name = "parameterTextBox";
|
||||
this.parameterTextBox.Size = new System.Drawing.Size(100, 20);
|
||||
this.parameterTextBox.TabIndex = 3;
|
||||
//
|
||||
// stateLabel
|
||||
//
|
||||
this.stateLabel.AutoSize = true;
|
||||
this.stateLabel.Location = new System.Drawing.Point(12, 19);
|
||||
this.stateLabel.Name = "stateLabel";
|
||||
this.stateLabel.Size = new System.Drawing.Size(32, 13);
|
||||
this.stateLabel.TabIndex = 4;
|
||||
this.stateLabel.Text = "State";
|
||||
//
|
||||
// parameterLabel
|
||||
//
|
||||
this.parameterLabel.AutoSize = true;
|
||||
this.parameterLabel.Location = new System.Drawing.Point(12, 49);
|
||||
this.parameterLabel.Name = "parameterLabel";
|
||||
this.parameterLabel.Size = new System.Drawing.Size(55, 13);
|
||||
this.parameterLabel.TabIndex = 5;
|
||||
this.parameterLabel.Text = "Parameter";
|
||||
//
|
||||
// GetStateDlg
|
||||
//
|
||||
this.AcceptButton = this.okButton;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.AutoSize = true;
|
||||
this.CancelButton = this.cancelButton;
|
||||
this.ClientSize = new System.Drawing.Size(419, 79);
|
||||
this.ControlBox = false;
|
||||
this.Controls.Add(this.parameterLabel);
|
||||
this.Controls.Add(this.stateLabel);
|
||||
this.Controls.Add(this.parameterTextBox);
|
||||
this.Controls.Add(this.cancelButton);
|
||||
this.Controls.Add(this.okButton);
|
||||
this.Controls.Add(this.stateTextBox);
|
||||
this.Name = "GetStateDlg";
|
||||
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Enter state please";
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TextBox stateTextBox;
|
||||
private System.Windows.Forms.Button okButton;
|
||||
private System.Windows.Forms.Button cancelButton;
|
||||
private System.Windows.Forms.TextBox parameterTextBox;
|
||||
private System.Windows.Forms.Label stateLabel;
|
||||
private System.Windows.Forms.Label parameterLabel;
|
||||
}
|
||||
}
|
||||
85
DataStreamInterfaceTest/GetStateDlg.cs
Normal file
85
DataStreamInterfaceTest/GetStateDlg.cs
Normal file
@ -0,0 +1,85 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace DataStreamInterfaceTest
|
||||
{
|
||||
public partial class GetStateDlg : Form
|
||||
{
|
||||
/// <summary>
|
||||
/// Integer number entered in this form
|
||||
/// </summary>
|
||||
public int State;
|
||||
public string Parameter;
|
||||
|
||||
int lowerLimit;
|
||||
int upperLimit;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor
|
||||
/// </summary>
|
||||
public GetStateDlg()
|
||||
: this("Enter state please")
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor with a custom window title.
|
||||
/// </summary>
|
||||
/// <param name="title">Window title</param>
|
||||
public GetStateDlg(string title)
|
||||
: this(title, Int32.MinValue, Int32.MaxValue)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor with a custom window title, limits and non-empty initial value.
|
||||
/// </summary>
|
||||
/// <param name="title">Window title</param>
|
||||
/// <param name="lowerLimit">Lower limit</param>
|
||||
/// <param name="upperLimit">Upper limit</param>
|
||||
/// <param name="initialValue">Initial value</param>
|
||||
public GetStateDlg(string title, int lowerLimit, int upperLimit, int initialValue)
|
||||
: this(title, lowerLimit, upperLimit)
|
||||
{
|
||||
stateTextBox.Text = initialValue.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor with a custom window title and lower/upper limits.
|
||||
/// </summary>
|
||||
/// <param name="title">Window title</param>
|
||||
/// <param name="lowerLimit">Lower limit</param>
|
||||
/// <param name="upperLimit">Upper limit</param>
|
||||
public GetStateDlg(string title, int lowerLimit, int upperLimit)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.Text = title;
|
||||
this.lowerLimit = lowerLimit;
|
||||
this.upperLimit = upperLimit;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// OK button handler that verifies validity of the entered value.
|
||||
/// </summary>
|
||||
private void okButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
int number;
|
||||
if (int.TryParse(stateTextBox.Text, out number) && number >= lowerLimit && number <= upperLimit)
|
||||
{
|
||||
State = number;
|
||||
Parameter = parameterTextBox.Text;
|
||||
DialogResult = DialogResult.OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
string message = (lowerLimit != Int32.MinValue || upperLimit != Int32.MaxValue)
|
||||
? string.Format("Invalid state ({0}..{1})", lowerLimit, upperLimit)
|
||||
: "Invalid state";
|
||||
MessageBox.Show(message);
|
||||
DialogResult = DialogResult.None; /// Prevent closing this window
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
120
DataStreamInterfaceTest/GetStateDlg.resx
Normal file
120
DataStreamInterfaceTest/GetStateDlg.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
39
DataStreamInterfaceTest/LviIDComparer.cs
Normal file
39
DataStreamInterfaceTest/LviIDComparer.cs
Normal file
@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace DataStreamInterfaceTest
|
||||
{
|
||||
public class LviIDComparer : IComparer
|
||||
{
|
||||
int column;
|
||||
SortOrder order;
|
||||
|
||||
public LviIDComparer()
|
||||
{
|
||||
column = 0;
|
||||
order = SortOrder.Ascending;
|
||||
}
|
||||
|
||||
public LviIDComparer(int column, SortOrder order)
|
||||
{
|
||||
this.column = column;
|
||||
this.order = order;
|
||||
}
|
||||
|
||||
public int Compare(object x, object y)
|
||||
{
|
||||
Int64 valX = Int64.Parse(((ListViewItem)x).SubItems[column].Text);
|
||||
Int64 valY = Int64.Parse(((ListViewItem)y).SubItems[column].Text);
|
||||
|
||||
if (order == SortOrder.Ascending)
|
||||
{
|
||||
return valX > valY ? 1 : valX == valY ? 0 : -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return valX < valY ? 1 : valX == valY ? 0 : -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
55
DataStreamInterfaceTest/Program.cs
Normal file
55
DataStreamInterfaceTest/Program.cs
Normal file
@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.ComponentModel.Composition.Hosting;
|
||||
using System.Windows.Forms;
|
||||
using DataStreamInterface;
|
||||
|
||||
namespace DataStreamInterfaceTest
|
||||
{
|
||||
class Program
|
||||
{
|
||||
#if DEBUG
|
||||
const string CatalogDir = "..\\..\\..\\DataStreamMeter\\bin\\Debug";
|
||||
#else
|
||||
const string CatalogDir = "..\\..\\..\\DataStreamMeter\\bin\\Release";
|
||||
#endif
|
||||
|
||||
[Import(typeof(IDataStreamMeter))]
|
||||
IDataStreamMeter dataStreamMeter;
|
||||
|
||||
private Program()
|
||||
{
|
||||
Console.WriteLine("Components found:");
|
||||
foreach (var file in Directory.EnumerateFiles(CatalogDir))
|
||||
{
|
||||
Console.WriteLine(file);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var catalog = new AggregateCatalog();
|
||||
catalog.Catalogs.Add(new AssemblyCatalog(typeof(DataStreamInterface.IDataStreamMeter).Assembly));
|
||||
catalog.Catalogs.Add(new DirectoryCatalog(CatalogDir));
|
||||
(new CompositionContainer(catalog)).ComposeParts(this);
|
||||
}
|
||||
catch (CompositionException compositionException)
|
||||
{
|
||||
Console.WriteLine(compositionException.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
Program p = new Program();
|
||||
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new DemoMainWnd(p.dataStreamMeter));
|
||||
}
|
||||
}
|
||||
}
|
||||
36
DataStreamInterfaceTest/Properties/AssemblyInfo.cs
Normal file
36
DataStreamInterfaceTest/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("DataStreamInterfaceTest")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("DataStreamInterfaceTest")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2020")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("429fdea9-ec3a-47d8-88b3-5df11de8b4c8")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
71
DataStreamInterfaceTest/Properties/Resources.Designer.cs
generated
Normal file
71
DataStreamInterfaceTest/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,71 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace DataStreamInterfaceTest.Properties
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources
|
||||
{
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((resourceMan == null))
|
||||
{
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DataStreamMainDemo.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture
|
||||
{
|
||||
get
|
||||
{
|
||||
return resourceCulture;
|
||||
}
|
||||
set
|
||||
{
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
117
DataStreamInterfaceTest/Properties/Resources.resx
Normal file
117
DataStreamInterfaceTest/Properties/Resources.resx
Normal file
@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
30
DataStreamInterfaceTest/Properties/Settings.Designer.cs
generated
Normal file
30
DataStreamInterfaceTest/Properties/Settings.Designer.cs
generated
Normal file
@ -0,0 +1,30 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace DataStreamInterfaceTest.Properties
|
||||
{
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
|
||||
{
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default
|
||||
{
|
||||
get
|
||||
{
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
7
DataStreamInterfaceTest/Properties/Settings.settings
Normal file
7
DataStreamInterfaceTest/Properties/Settings.settings
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
85
DataStreamMeter/DataStreamMeter.csproj
Normal file
85
DataStreamMeter/DataStreamMeter.csproj
Normal file
@ -0,0 +1,85 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{E6925701-57A6-4167-B5C4-BF670F1DE310}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>DataStreamMeter</RootNamespace>
|
||||
<AssemblyName>DataStreamMeter</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.ComponentModel.Composition" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="GetDblValueDlg.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="GetDblValueDlg.Designer.cs">
|
||||
<DependentUpon>GetDblValueDlg.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="MeterDataEventArgs.cs" />
|
||||
<Compile Include="MeterSimulationDlg.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="MeterSimulationDlg.Designer.cs">
|
||||
<DependentUpon>MeterSimulationDlg.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="MeterSimulation.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Sample.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\DataStreamInterface\DataStreamInterface.csproj">
|
||||
<Project>{7ebeea14-91c4-48d7-af0a-7a4bc3ff9a28}</Project>
|
||||
<Name>DataStreamInterface</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="GetDblValueDlg.resx">
|
||||
<DependentUpon>GetDblValueDlg.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="MeterSimulationDlg.resx">
|
||||
<DependentUpon>MeterSimulationDlg.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
88
DataStreamMeter/GetDblValueDlg.Designer.cs
generated
Normal file
88
DataStreamMeter/GetDblValueDlg.Designer.cs
generated
Normal file
@ -0,0 +1,88 @@
|
||||
namespace DataStreamMeter
|
||||
{
|
||||
partial class GetDblValueDlg
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.valueTextBox = new System.Windows.Forms.TextBox();
|
||||
this.okButton = new System.Windows.Forms.Button();
|
||||
this.cancelButton = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// valueTextBox
|
||||
//
|
||||
this.valueTextBox.Location = new System.Drawing.Point(35, 20);
|
||||
this.valueTextBox.Name = "valueTextBox";
|
||||
this.valueTextBox.Size = new System.Drawing.Size(94, 20);
|
||||
this.valueTextBox.TabIndex = 0;
|
||||
//
|
||||
// okButton
|
||||
//
|
||||
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.okButton.Location = new System.Drawing.Point(216, 16);
|
||||
this.okButton.Name = "okButton";
|
||||
this.okButton.Size = new System.Drawing.Size(75, 29);
|
||||
this.okButton.TabIndex = 1;
|
||||
this.okButton.Text = "OK";
|
||||
this.okButton.UseVisualStyleBackColor = true;
|
||||
this.okButton.Click += new System.EventHandler(this.okButton_Click);
|
||||
//
|
||||
// cancelButton
|
||||
//
|
||||
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.cancelButton.Location = new System.Drawing.Point(306, 16);
|
||||
this.cancelButton.Name = "cancelButton";
|
||||
this.cancelButton.Size = new System.Drawing.Size(75, 29);
|
||||
this.cancelButton.TabIndex = 2;
|
||||
this.cancelButton.Text = "Cancel";
|
||||
this.cancelButton.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// GetFlowDlg
|
||||
//
|
||||
this.AcceptButton = this.okButton;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.CancelButton = this.cancelButton;
|
||||
this.ClientSize = new System.Drawing.Size(396, 58);
|
||||
this.Controls.Add(this.cancelButton);
|
||||
this.Controls.Add(this.okButton);
|
||||
this.Controls.Add(this.valueTextBox);
|
||||
this.Name = "GetFlowDlg";
|
||||
this.Text = "Enter flow";
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TextBox valueTextBox;
|
||||
private System.Windows.Forms.Button okButton;
|
||||
private System.Windows.Forms.Button cancelButton;
|
||||
}
|
||||
}
|
||||
59
DataStreamMeter/GetDblValueDlg.cs
Normal file
59
DataStreamMeter/GetDblValueDlg.cs
Normal file
@ -0,0 +1,59 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace DataStreamMeter
|
||||
{
|
||||
public partial class GetDblValueDlg : Form
|
||||
{
|
||||
public double DblValue;
|
||||
|
||||
double lowerLimit;
|
||||
double upperLimit;
|
||||
|
||||
|
||||
public GetDblValueDlg()
|
||||
: this("Enter flow in [m3/h] please")
|
||||
{
|
||||
}
|
||||
|
||||
public GetDblValueDlg(string title)
|
||||
: this(title, 0, 100.0)
|
||||
{
|
||||
}
|
||||
|
||||
public GetDblValueDlg(string title, double lowerLimit, double upperLimit)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.Text = title;
|
||||
this.lowerLimit = lowerLimit;
|
||||
this.upperLimit = upperLimit;
|
||||
}
|
||||
|
||||
|
||||
private void okButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
double val;
|
||||
if (TryParseUDouble(valueTextBox.Text, out val))
|
||||
{
|
||||
DblValue = val;
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Invalid value");
|
||||
DialogResult = DialogResult.None;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parse an unsigned double number
|
||||
/// </summary>
|
||||
bool TryParseUDouble(string text, out double result)
|
||||
{
|
||||
return double.TryParse(text, NumberStyles.AllowDecimalPoint, CultureInfo.CurrentCulture, out result) ||
|
||||
double.TryParse(text, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out result);
|
||||
}
|
||||
}
|
||||
}
|
||||
120
DataStreamMeter/GetDblValueDlg.resx
Normal file
120
DataStreamMeter/GetDblValueDlg.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
20
DataStreamMeter/MeterDataEventArgs.cs
Normal file
20
DataStreamMeter/MeterDataEventArgs.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
|
||||
namespace DataStreamMeter
|
||||
{
|
||||
public class MeterDataEventArgs : EventArgs
|
||||
{
|
||||
public State State;
|
||||
public double Time;
|
||||
public double Volume;
|
||||
public double Flow;
|
||||
|
||||
public MeterDataEventArgs(State state, double time, double volume, double flow)
|
||||
{
|
||||
State = state;
|
||||
Time = time;
|
||||
Volume = volume;
|
||||
Flow = flow;
|
||||
}
|
||||
}
|
||||
}
|
||||
319
DataStreamMeter/MeterSimulation.cs
Normal file
319
DataStreamMeter/MeterSimulation.cs
Normal file
@ -0,0 +1,319 @@
|
||||
using System;
|
||||
using System.ComponentModel.Composition;
|
||||
using DataStreamInterface;
|
||||
|
||||
namespace DataStreamMeter
|
||||
{
|
||||
[Export(typeof(IDataStreamMeter))]
|
||||
public class MeterSimulation : IDataStreamMeter
|
||||
{
|
||||
MeterSimulationDlg modelessDlg;
|
||||
|
||||
/// Water meter specification
|
||||
public readonly string MeterID = "3141592653";
|
||||
public const Unit TimeUnits = Unit.s; /// Unit.s, Unit.ms, ...
|
||||
public const Unit VolumeUnits = Unit.l; /// Unit.l, Unit.USgal, ...
|
||||
public const Unit FlowUnits = Unit.m3ph; /// Unit.m3ph, Unit.USgalps, Unit.cfs, ...
|
||||
public const double SamplingPeriodSec = 0.125; /// Sampling period in seconds (here 125 ms, 8 Hz)
|
||||
public readonly double SamplingPeriod;
|
||||
|
||||
|
||||
public const Int64 MaxSamplesCount = 40000; /// Maximal test time is SamplingPeriod * MaxSamplesCount
|
||||
Sample[] samples = new Sample[MaxSamplesCount];
|
||||
Int64 storedSamplesCount;
|
||||
|
||||
|
||||
readonly object stateChangeAndTimerTickLock = new object();
|
||||
public State State;
|
||||
string connectionParameters;
|
||||
|
||||
/// initialTime is time when simulation started
|
||||
/// (lastSampleTime - initialTime).TotalSeconds is multiple of Sampling Period
|
||||
DateTime initialTime;
|
||||
|
||||
/// Last user interface tick info
|
||||
bool lastTickValid;
|
||||
State lastTickState;
|
||||
|
||||
/// Values incrementally updated on each timer tick
|
||||
double currentTime;
|
||||
double currentVolume;
|
||||
double currentFlow;
|
||||
double currentFlow_m3ph;
|
||||
|
||||
DateTime startTimeStamp; /// Measurement start DateTime
|
||||
double startTime; /// Measurement start time in seconds
|
||||
DateTime stopTimeStamp; /// Measurement end DateTime
|
||||
double stopTime; /// Measurement end time in seconds
|
||||
|
||||
|
||||
public MeterSimulation()
|
||||
{
|
||||
modelessDlg = null;
|
||||
State = State.Disconnected;
|
||||
SamplingPeriod = DataStreamInterface.Units.ConvertTo(TimeUnits, SamplingPeriodSec);
|
||||
lastTickValid = false;
|
||||
initialTime = DateTime.Now.Date; /// An arbitrary initial time (in this case the last midnight)
|
||||
}
|
||||
|
||||
public Unit GetTimeUnits()
|
||||
{
|
||||
return TimeUnits;
|
||||
}
|
||||
|
||||
public Unit GetVolumeUnits()
|
||||
{
|
||||
return VolumeUnits;
|
||||
}
|
||||
|
||||
public int GetQuantitiesCount()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public string GetQuantityCaption(int quantityNr)
|
||||
{
|
||||
if (quantityNr == 0) return "Flow";
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public Unit GetQuantityUnits(int quantityNr)
|
||||
{
|
||||
if (quantityNr == 0) return FlowUnits;
|
||||
return Unit.None;
|
||||
}
|
||||
|
||||
public bool OpenConnection(string connectionParameters, out string meterID)
|
||||
{
|
||||
lock (stateChangeAndTimerTickLock)
|
||||
{
|
||||
if (State != State.Disconnected)
|
||||
{
|
||||
/// Meter is already connected
|
||||
meterID = MeterID;
|
||||
return true;
|
||||
}
|
||||
|
||||
/// Connect the meter
|
||||
meterID = MeterID;
|
||||
this.connectionParameters = connectionParameters;
|
||||
lastTickValid = false;
|
||||
State = State.Connected;
|
||||
}
|
||||
|
||||
/// Open modeless form
|
||||
modelessDlg = new MeterSimulationDlg(this, MeterID);
|
||||
modelessDlg.Show();
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool CloseConnection()
|
||||
{
|
||||
bool closeModelessDlg = false;
|
||||
|
||||
lock (stateChangeAndTimerTickLock)
|
||||
{
|
||||
if (State != State.Disconnected)
|
||||
{
|
||||
State = State.Disconnected;
|
||||
storedSamplesCount = 0;
|
||||
closeModelessDlg = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (closeModelessDlg)
|
||||
{
|
||||
if (modelessDlg != null) modelessDlg.Close();
|
||||
modelessDlg = null;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool GetState(out int state, out string parameter)
|
||||
{
|
||||
state = (int)this.State;
|
||||
parameter = this.connectionParameters;
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool SetState(int state, string parameter)
|
||||
{
|
||||
/// It's not allowed to change the satate in this demo
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool StartMeasurement()
|
||||
{
|
||||
lock (stateChangeAndTimerTickLock)
|
||||
{
|
||||
if (State == State.Connected)
|
||||
{
|
||||
startTimeStamp = DateTime.Now;
|
||||
startTime = TimeInSecondsFromDateTime(startTimeStamp, initialTime, SamplingPeriodSec);
|
||||
storedSamplesCount = 0;
|
||||
State = State.MeasurementInProgress;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool StopMeasurement(out Int64 storedFramesCount)
|
||||
{
|
||||
lock (stateChangeAndTimerTickLock)
|
||||
{
|
||||
if (State == State.MeasurementInProgress)
|
||||
{
|
||||
stopTimeStamp = DateTime.Now;
|
||||
stopTime = TimeInSecondsFromDateTime(stopTimeStamp, initialTime, SamplingPeriodSec);
|
||||
|
||||
int newSamplesCount = Convert.ToInt32(Math.Round((stopTime - currentTime) / SamplingPeriodSec));
|
||||
double time = Units.ConvertTo(TimeUnits, currentTime);
|
||||
double volume = currentVolume;
|
||||
double volumeIncrement = Units.ConvertTo(VolumeUnits, currentFlow_m3ph * (SamplingPeriodSec / 3.6));
|
||||
for (int i = 0; i < newSamplesCount; i++)
|
||||
{
|
||||
time += SamplingPeriod;
|
||||
volume += volumeIncrement;
|
||||
if (storedSamplesCount < MaxSamplesCount)
|
||||
{
|
||||
samples[storedSamplesCount++] = new Sample(time, volume, currentFlow);
|
||||
}
|
||||
}
|
||||
|
||||
State = State.Connected;
|
||||
storedFramesCount = storedSamplesCount;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
storedFramesCount = 0;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void TimerTick(double flow_m3ph)
|
||||
{
|
||||
lock (stateChangeAndTimerTickLock)
|
||||
{
|
||||
double lastSampleTime = TimeInSecondsFromDateTime(DateTime.Now, initialTime, SamplingPeriodSec);
|
||||
currentFlow_m3ph = flow_m3ph;
|
||||
currentFlow = Units.ConvertTo(FlowUnits, flow_m3ph);
|
||||
|
||||
if (!lastTickValid)
|
||||
{
|
||||
currentTime = lastSampleTime;
|
||||
currentVolume = 0;
|
||||
lastTickValid = true;
|
||||
lastTickState = State;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
int newSamplesCount = Convert.ToInt32(Math.Round((lastSampleTime - currentTime) / SamplingPeriodSec));
|
||||
double volumeIncrement = Units.ConvertTo(VolumeUnits, currentFlow_m3ph * (SamplingPeriodSec / 3.6));
|
||||
for (int i = 0; i < newSamplesCount; i++)
|
||||
{
|
||||
currentTime += SamplingPeriodSec;
|
||||
currentVolume += volumeIncrement;
|
||||
|
||||
if (State == State.MeasurementInProgress && currentTime > startTime && storedSamplesCount < MaxSamplesCount)
|
||||
{
|
||||
samples[storedSamplesCount++] = new Sample(Units.ConvertTo(TimeUnits, currentTime), currentVolume, currentFlow);
|
||||
}
|
||||
}
|
||||
currentTime = lastSampleTime; /// Rectify, prevent error propagation
|
||||
lastTickState = State;
|
||||
}
|
||||
}
|
||||
|
||||
modelessDlg.OnMeterdata(new MeterDataEventArgs(State, currentTime, currentVolume, currentFlow));
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Obtain the last time instance before 'DateTime time' which is multiple of samplingPeriod-s after 'DateTime initialTime'.
|
||||
/// </summary>
|
||||
/// <param name="time">Time to be converted to seconds and rounded to samplingPeriod-s</param>
|
||||
/// <param name="startTime">Initial time</param>
|
||||
/// <param name="samplePeriod">Sampling period in seconds</param>
|
||||
/// <returns></returns>
|
||||
double TimeInSecondsFromDateTime(DateTime time, DateTime initialTime, double samplingPeriod)
|
||||
{
|
||||
TimeSpan span = time - initialTime;
|
||||
return samplingPeriod * Math.Floor(span.TotalSeconds / samplingPeriod);
|
||||
}
|
||||
|
||||
|
||||
///---------------------------
|
||||
/// Datastream data exchange
|
||||
///---------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Retuns 'count' data frames starting with data frame with ID = 'id'
|
||||
/// </summary>
|
||||
/// <param name="id">First frame ID</param>
|
||||
/// <param name="count">Frames count</param>
|
||||
/// <returns>Selected data frames</returns>
|
||||
public DataFrame[] GetFrames(Int64 startID, int count)
|
||||
{
|
||||
DataFrame[] frames = new DataFrame[count];
|
||||
|
||||
if (State != State.MeasurementInProgress)
|
||||
{
|
||||
for (int j = 0; j < count; j++)
|
||||
{
|
||||
Int64 id = startID + j;
|
||||
if (id < storedSamplesCount)
|
||||
{
|
||||
frames[j] = new DataFrame(id, samples[id].Time, samples[id].Volume, new double[1] { samples[id].Flow });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return frames;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns ID of the data frame where time equals or exceeds the specified time.
|
||||
/// When time of the first frame (ID=0) is larger then specified time, function returns 0.
|
||||
/// </summary>
|
||||
/// <param name="time">Time</param>
|
||||
/// <returns>ID of the data frame at or after the pecified time</returns>
|
||||
public Int64 GetID(double time)
|
||||
{
|
||||
if (storedSamplesCount == 0) return -1;
|
||||
|
||||
Int64 lo = 0;
|
||||
Int64 hi = storedSamplesCount - 1;
|
||||
|
||||
if (samples[hi].Time < time) return -1;
|
||||
|
||||
while (lo < hi)
|
||||
{
|
||||
Int64 mid = (lo + hi) / 2;
|
||||
if (samples[mid].Time < time)
|
||||
{
|
||||
lo = mid + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
hi = mid;
|
||||
}
|
||||
}
|
||||
|
||||
return lo;
|
||||
}
|
||||
}
|
||||
|
||||
public enum State
|
||||
{
|
||||
Disconnected = 0,
|
||||
Connected = 1,
|
||||
MeasurementInProgress = 2,
|
||||
}
|
||||
}
|
||||
323
DataStreamMeter/MeterSimulationDlg.Designer.cs
generated
Normal file
323
DataStreamMeter/MeterSimulationDlg.Designer.cs
generated
Normal file
@ -0,0 +1,323 @@
|
||||
namespace DataStreamMeter
|
||||
{
|
||||
partial class MeterSimulationDlg
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.meterIDGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.volumeUnitsTextBox = new System.Windows.Forms.TextBox();
|
||||
this.timeUnitsTextBox = new System.Windows.Forms.TextBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.meterIDTextBox = new System.Windows.Forms.TextBox();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.setFlowButton = new System.Windows.Forms.Button();
|
||||
this.flowm3phTextBox = new System.Windows.Forms.TextBox();
|
||||
this.flowTrackBar = new System.Windows.Forms.TrackBar();
|
||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||
this.flowTextBox = new System.Windows.Forms.TextBox();
|
||||
this.volumeTextBox = new System.Windows.Forms.TextBox();
|
||||
this.timeTextBox = new System.Windows.Forms.TextBox();
|
||||
this.stateTextBox = new System.Windows.Forms.TextBox();
|
||||
this.label8 = new System.Windows.Forms.Label();
|
||||
this.label7 = new System.Windows.Forms.Label();
|
||||
this.label6 = new System.Windows.Forms.Label();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.lastUITickTextBox = new System.Windows.Forms.TextBox();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.timer1 = new System.Windows.Forms.Timer(this.components);
|
||||
this.meterIDGroupBox.SuspendLayout();
|
||||
this.groupBox1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.flowTrackBar)).BeginInit();
|
||||
this.groupBox2.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// meterIDGroupBox
|
||||
//
|
||||
this.meterIDGroupBox.Controls.Add(this.label3);
|
||||
this.meterIDGroupBox.Controls.Add(this.label2);
|
||||
this.meterIDGroupBox.Controls.Add(this.volumeUnitsTextBox);
|
||||
this.meterIDGroupBox.Controls.Add(this.timeUnitsTextBox);
|
||||
this.meterIDGroupBox.Controls.Add(this.label1);
|
||||
this.meterIDGroupBox.Controls.Add(this.meterIDTextBox);
|
||||
this.meterIDGroupBox.Location = new System.Drawing.Point(12, 12);
|
||||
this.meterIDGroupBox.Name = "meterIDGroupBox";
|
||||
this.meterIDGroupBox.Size = new System.Drawing.Size(453, 105);
|
||||
this.meterIDGroupBox.TabIndex = 0;
|
||||
this.meterIDGroupBox.TabStop = false;
|
||||
this.meterIDGroupBox.Text = "Water meter info";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(18, 76);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(67, 13);
|
||||
this.label3.TabIndex = 5;
|
||||
this.label3.Text = "Volume units";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(18, 50);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(55, 13);
|
||||
this.label2.TabIndex = 4;
|
||||
this.label2.Text = "Time units";
|
||||
//
|
||||
// volumeUnitsTextBox
|
||||
//
|
||||
this.volumeUnitsTextBox.Enabled = false;
|
||||
this.volumeUnitsTextBox.Location = new System.Drawing.Point(122, 73);
|
||||
this.volumeUnitsTextBox.Name = "volumeUnitsTextBox";
|
||||
this.volumeUnitsTextBox.Size = new System.Drawing.Size(52, 20);
|
||||
this.volumeUnitsTextBox.TabIndex = 3;
|
||||
//
|
||||
// timeUnitsTextBox
|
||||
//
|
||||
this.timeUnitsTextBox.Enabled = false;
|
||||
this.timeUnitsTextBox.Location = new System.Drawing.Point(122, 47);
|
||||
this.timeUnitsTextBox.Name = "timeUnitsTextBox";
|
||||
this.timeUnitsTextBox.Size = new System.Drawing.Size(52, 20);
|
||||
this.timeUnitsTextBox.TabIndex = 2;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(18, 24);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(73, 13);
|
||||
this.label1.TabIndex = 1;
|
||||
this.label1.Text = "Meter ID (s/n)";
|
||||
//
|
||||
// meterIDTextBox
|
||||
//
|
||||
this.meterIDTextBox.Enabled = false;
|
||||
this.meterIDTextBox.Location = new System.Drawing.Point(122, 21);
|
||||
this.meterIDTextBox.Name = "meterIDTextBox";
|
||||
this.meterIDTextBox.Size = new System.Drawing.Size(145, 20);
|
||||
this.meterIDTextBox.TabIndex = 0;
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Controls.Add(this.setFlowButton);
|
||||
this.groupBox1.Controls.Add(this.flowm3phTextBox);
|
||||
this.groupBox1.Controls.Add(this.flowTrackBar);
|
||||
this.groupBox1.Location = new System.Drawing.Point(12, 123);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Size = new System.Drawing.Size(453, 96);
|
||||
this.groupBox1.TabIndex = 1;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "Flow";
|
||||
//
|
||||
// setFlowButton
|
||||
//
|
||||
this.setFlowButton.Location = new System.Drawing.Point(289, 17);
|
||||
this.setFlowButton.Name = "setFlowButton";
|
||||
this.setFlowButton.Size = new System.Drawing.Size(75, 23);
|
||||
this.setFlowButton.TabIndex = 4;
|
||||
this.setFlowButton.Text = "Set value";
|
||||
this.setFlowButton.UseVisualStyleBackColor = true;
|
||||
this.setFlowButton.Click += new System.EventHandler(this.setFlowButton_Click);
|
||||
//
|
||||
// flowm3phTextBox
|
||||
//
|
||||
this.flowm3phTextBox.Enabled = false;
|
||||
this.flowm3phTextBox.Location = new System.Drawing.Point(122, 19);
|
||||
this.flowm3phTextBox.Name = "flowm3phTextBox";
|
||||
this.flowm3phTextBox.Size = new System.Drawing.Size(145, 20);
|
||||
this.flowm3phTextBox.TabIndex = 3;
|
||||
//
|
||||
// flowTrackBar
|
||||
//
|
||||
this.flowTrackBar.LargeChange = 1;
|
||||
this.flowTrackBar.Location = new System.Drawing.Point(0, 43);
|
||||
this.flowTrackBar.Maximum = 25;
|
||||
this.flowTrackBar.Name = "flowTrackBar";
|
||||
this.flowTrackBar.Size = new System.Drawing.Size(447, 45);
|
||||
this.flowTrackBar.TabIndex = 2;
|
||||
this.flowTrackBar.Scroll += new System.EventHandler(this.flowTrackBar_Scroll);
|
||||
//
|
||||
// groupBox2
|
||||
//
|
||||
this.groupBox2.Controls.Add(this.flowTextBox);
|
||||
this.groupBox2.Controls.Add(this.volumeTextBox);
|
||||
this.groupBox2.Controls.Add(this.timeTextBox);
|
||||
this.groupBox2.Controls.Add(this.stateTextBox);
|
||||
this.groupBox2.Controls.Add(this.label8);
|
||||
this.groupBox2.Controls.Add(this.label7);
|
||||
this.groupBox2.Controls.Add(this.label6);
|
||||
this.groupBox2.Controls.Add(this.label5);
|
||||
this.groupBox2.Controls.Add(this.lastUITickTextBox);
|
||||
this.groupBox2.Controls.Add(this.label4);
|
||||
this.groupBox2.Location = new System.Drawing.Point(12, 225);
|
||||
this.groupBox2.Name = "groupBox2";
|
||||
this.groupBox2.Size = new System.Drawing.Size(453, 150);
|
||||
this.groupBox2.TabIndex = 2;
|
||||
this.groupBox2.TabStop = false;
|
||||
this.groupBox2.Text = "State";
|
||||
//
|
||||
// flowTextBox
|
||||
//
|
||||
this.flowTextBox.Enabled = false;
|
||||
this.flowTextBox.Location = new System.Drawing.Point(122, 121);
|
||||
this.flowTextBox.Name = "flowTextBox";
|
||||
this.flowTextBox.Size = new System.Drawing.Size(99, 20);
|
||||
this.flowTextBox.TabIndex = 9;
|
||||
//
|
||||
// volumeTextBox
|
||||
//
|
||||
this.volumeTextBox.Enabled = false;
|
||||
this.volumeTextBox.Location = new System.Drawing.Point(122, 95);
|
||||
this.volumeTextBox.Name = "volumeTextBox";
|
||||
this.volumeTextBox.Size = new System.Drawing.Size(99, 20);
|
||||
this.volumeTextBox.TabIndex = 8;
|
||||
//
|
||||
// timeTextBox
|
||||
//
|
||||
this.timeTextBox.Enabled = false;
|
||||
this.timeTextBox.Location = new System.Drawing.Point(122, 68);
|
||||
this.timeTextBox.Name = "timeTextBox";
|
||||
this.timeTextBox.Size = new System.Drawing.Size(99, 20);
|
||||
this.timeTextBox.TabIndex = 7;
|
||||
//
|
||||
// stateTextBox
|
||||
//
|
||||
this.stateTextBox.Enabled = false;
|
||||
this.stateTextBox.Location = new System.Drawing.Point(122, 42);
|
||||
this.stateTextBox.Name = "stateTextBox";
|
||||
this.stateTextBox.Size = new System.Drawing.Size(99, 20);
|
||||
this.stateTextBox.TabIndex = 6;
|
||||
//
|
||||
// label8
|
||||
//
|
||||
this.label8.AutoSize = true;
|
||||
this.label8.Location = new System.Drawing.Point(18, 124);
|
||||
this.label8.Name = "label8";
|
||||
this.label8.Size = new System.Drawing.Size(29, 13);
|
||||
this.label8.TabIndex = 5;
|
||||
this.label8.Text = "Flow";
|
||||
//
|
||||
// label7
|
||||
//
|
||||
this.label7.AutoSize = true;
|
||||
this.label7.Location = new System.Drawing.Point(18, 98);
|
||||
this.label7.Name = "label7";
|
||||
this.label7.Size = new System.Drawing.Size(42, 13);
|
||||
this.label7.TabIndex = 4;
|
||||
this.label7.Text = "Volume";
|
||||
//
|
||||
// label6
|
||||
//
|
||||
this.label6.AutoSize = true;
|
||||
this.label6.Location = new System.Drawing.Point(18, 71);
|
||||
this.label6.Name = "label6";
|
||||
this.label6.Size = new System.Drawing.Size(30, 13);
|
||||
this.label6.TabIndex = 3;
|
||||
this.label6.Text = "Time";
|
||||
//
|
||||
// label5
|
||||
//
|
||||
this.label5.AutoSize = true;
|
||||
this.label5.Location = new System.Drawing.Point(18, 45);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Size = new System.Drawing.Size(32, 13);
|
||||
this.label5.TabIndex = 2;
|
||||
this.label5.Text = "State";
|
||||
//
|
||||
// lastUITickTextBox
|
||||
//
|
||||
this.lastUITickTextBox.Enabled = false;
|
||||
this.lastUITickTextBox.Location = new System.Drawing.Point(122, 13);
|
||||
this.lastUITickTextBox.Name = "lastUITickTextBox";
|
||||
this.lastUITickTextBox.Size = new System.Drawing.Size(145, 20);
|
||||
this.lastUITickTextBox.TabIndex = 1;
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(18, 16);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(61, 13);
|
||||
this.label4.TabIndex = 0;
|
||||
this.label4.Text = "Last UI tick";
|
||||
//
|
||||
// timer1
|
||||
//
|
||||
this.timer1.Interval = 1000;
|
||||
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
|
||||
//
|
||||
// MeterSimulationDlg
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(477, 387);
|
||||
this.Controls.Add(this.groupBox2);
|
||||
this.Controls.Add(this.groupBox1);
|
||||
this.Controls.Add(this.meterIDGroupBox);
|
||||
this.Name = "MeterSimulationDlg";
|
||||
this.Text = "MeterDialog";
|
||||
this.meterIDGroupBox.ResumeLayout(false);
|
||||
this.meterIDGroupBox.PerformLayout();
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
this.groupBox1.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.flowTrackBar)).EndInit();
|
||||
this.groupBox2.ResumeLayout(false);
|
||||
this.groupBox2.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.GroupBox meterIDGroupBox;
|
||||
private System.Windows.Forms.TextBox meterIDTextBox;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.TextBox volumeUnitsTextBox;
|
||||
private System.Windows.Forms.TextBox timeUnitsTextBox;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.GroupBox groupBox1;
|
||||
private System.Windows.Forms.TextBox flowm3phTextBox;
|
||||
private System.Windows.Forms.TrackBar flowTrackBar;
|
||||
private System.Windows.Forms.GroupBox groupBox2;
|
||||
private System.Windows.Forms.Button setFlowButton;
|
||||
private System.Windows.Forms.Timer timer1;
|
||||
private System.Windows.Forms.TextBox lastUITickTextBox;
|
||||
private System.Windows.Forms.Label label4;
|
||||
private System.Windows.Forms.TextBox flowTextBox;
|
||||
private System.Windows.Forms.TextBox volumeTextBox;
|
||||
private System.Windows.Forms.TextBox timeTextBox;
|
||||
private System.Windows.Forms.TextBox stateTextBox;
|
||||
private System.Windows.Forms.Label label8;
|
||||
private System.Windows.Forms.Label label7;
|
||||
private System.Windows.Forms.Label label6;
|
||||
private System.Windows.Forms.Label label5;
|
||||
}
|
||||
}
|
||||
91
DataStreamMeter/MeterSimulationDlg.cs
Normal file
91
DataStreamMeter/MeterSimulationDlg.cs
Normal file
@ -0,0 +1,91 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace DataStreamMeter
|
||||
{
|
||||
public partial class MeterSimulationDlg : Form
|
||||
{
|
||||
MeterSimulation meterSimulation;
|
||||
double currentFlow;
|
||||
|
||||
|
||||
public string MeterID;
|
||||
|
||||
|
||||
public void OnMeterdata(MeterDataEventArgs args)
|
||||
{
|
||||
if (MeterDataHandler == null) return;
|
||||
MeterDataHandler(null, args);
|
||||
}
|
||||
public event EventHandler<MeterDataEventArgs> MeterDataHandler;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor with no meter
|
||||
/// </summary>
|
||||
public MeterSimulationDlg()
|
||||
: this(null, string.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
public MeterSimulationDlg(MeterSimulation meterSimulation, string meterID)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.meterSimulation = meterSimulation;
|
||||
meterIDTextBox.Text = meterID;
|
||||
|
||||
currentFlow = 0;
|
||||
flowm3phTextBox.Text = currentFlow.ToString();
|
||||
flowTrackBar.Value = Convert.ToInt32(currentFlow);
|
||||
|
||||
MeterDataHandler += delegate(object sender, MeterDataEventArgs args)
|
||||
{
|
||||
if (InvokeRequired)
|
||||
{
|
||||
Invoke(new EventHandler<MeterDataEventArgs>(DisplayMeterData), sender, args);
|
||||
}
|
||||
else
|
||||
{
|
||||
DisplayMeterData(sender, args);
|
||||
}
|
||||
};
|
||||
|
||||
if (meterSimulation != null)
|
||||
{
|
||||
timer1.Enabled = true;
|
||||
timer1.Start();
|
||||
}
|
||||
}
|
||||
|
||||
private void flowTrackBar_Scroll(object sender, EventArgs e)
|
||||
{
|
||||
currentFlow = flowTrackBar.Value;
|
||||
flowm3phTextBox.Text = currentFlow.ToString("F2");
|
||||
}
|
||||
|
||||
private void setFlowButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
GetDblValueDlg dlg = new GetDblValueDlg("Enter flow in [m3/h] please", 0, 25.0);
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
currentFlow = dlg.DblValue;
|
||||
flowm3phTextBox.Text = currentFlow.ToString();
|
||||
flowTrackBar.Value = Convert.ToInt32(currentFlow);
|
||||
}
|
||||
}
|
||||
|
||||
private void timer1_Tick(object sender, EventArgs e)
|
||||
{
|
||||
lastUITickTextBox.Text = DateTime.Now.ToString("HH:mm:ss fff");
|
||||
meterSimulation.TimerTick(currentFlow);
|
||||
}
|
||||
|
||||
void DisplayMeterData(object sender, MeterDataEventArgs args)
|
||||
{
|
||||
stateTextBox.Text = args.State.ToString();
|
||||
timeTextBox.Text = args.Time.ToString();
|
||||
volumeTextBox.Text = args.Volume.ToString();
|
||||
flowTextBox.Text = args.Flow.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
123
DataStreamMeter/MeterSimulationDlg.resx
Normal file
123
DataStreamMeter/MeterSimulationDlg.resx
Normal file
@ -0,0 +1,123 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
||||
36
DataStreamMeter/Properties/AssemblyInfo.cs
Normal file
36
DataStreamMeter/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("DataStreamMeter")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("DataStreamMeter")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2020")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("8acd46eb-c84d-4199-9f40-7420b7ebabc2")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
23
DataStreamMeter/Sample.cs
Normal file
23
DataStreamMeter/Sample.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using System;
|
||||
|
||||
namespace DataStreamMeter
|
||||
{
|
||||
public class Sample
|
||||
{
|
||||
public readonly double Time; /// In water meter time units
|
||||
public readonly double Volume; /// In water meter colume units
|
||||
public readonly double Flow; /// In water meter flow units
|
||||
|
||||
public Sample(double time, double volume, double flow)
|
||||
{
|
||||
Time = time;
|
||||
Volume = volume;
|
||||
Flow = flow;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("time={0} volume={1} flow={2}", Time, Volume, Flow);
|
||||
}
|
||||
}
|
||||
}
|
||||
28
TBF.sln
28
TBF.sln
@ -71,6 +71,14 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataStreamInterface", "Data
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ResetBatchNr", "ResetBatchNr\ResetBatchNr.csproj", "{D7F5A111-B2DF-4761-9574-AB730DF573A6}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataStreamInterfaceTest", "DataStreamInterfaceTest\DataStreamInterfaceTest.csproj", "{1D1EEF9C-7F41-43D3-BD09-5054D00F7A23}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{E6925701-57A6-4167-B5C4-BF670F1DE310} = {E6925701-57A6-4167-B5C4-BF670F1DE310}
|
||||
{7EBEEA14-91C4-48D7-AF0A-7A4BC3FF9A28} = {7EBEEA14-91C4-48D7-AF0A-7A4BC3FF9A28}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataStreamMeter", "DataStreamMeter\DataStreamMeter.csproj", "{E6925701-57A6-4167-B5C4-BF670F1DE310}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -315,6 +323,26 @@ Global
|
||||
{D7F5A111-B2DF-4761-9574-AB730DF573A6}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{D7F5A111-B2DF-4761-9574-AB730DF573A6}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{D7F5A111-B2DF-4761-9574-AB730DF573A6}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{1D1EEF9C-7F41-43D3-BD09-5054D00F7A23}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1D1EEF9C-7F41-43D3-BD09-5054D00F7A23}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1D1EEF9C-7F41-43D3-BD09-5054D00F7A23}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{1D1EEF9C-7F41-43D3-BD09-5054D00F7A23}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{1D1EEF9C-7F41-43D3-BD09-5054D00F7A23}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{1D1EEF9C-7F41-43D3-BD09-5054D00F7A23}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1D1EEF9C-7F41-43D3-BD09-5054D00F7A23}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{1D1EEF9C-7F41-43D3-BD09-5054D00F7A23}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{1D1EEF9C-7F41-43D3-BD09-5054D00F7A23}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{1D1EEF9C-7F41-43D3-BD09-5054D00F7A23}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{E6925701-57A6-4167-B5C4-BF670F1DE310}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E6925701-57A6-4167-B5C4-BF670F1DE310}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E6925701-57A6-4167-B5C4-BF670F1DE310}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{E6925701-57A6-4167-B5C4-BF670F1DE310}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{E6925701-57A6-4167-B5C4-BF670F1DE310}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{E6925701-57A6-4167-B5C4-BF670F1DE310}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E6925701-57A6-4167-B5C4-BF670F1DE310}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{E6925701-57A6-4167-B5C4-BF670F1DE310}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{E6925701-57A6-4167-B5C4-BF670F1DE310}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{E6925701-57A6-4167-B5C4-BF670F1DE310}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@ -4,6 +4,10 @@ rmdir /s /q Config\bin
|
||||
rmdir /s /q Config\obj
|
||||
rmdir /s /q DataStreamInterface\bin
|
||||
rmdir /s /q DataStreamInterface\obj
|
||||
rmdir /s /q DataStreamInterfaceTest\bin
|
||||
rmdir /s /q DataStreamInterfaceTest\obj
|
||||
rmdir /s /q DataStreamMeter\bin
|
||||
rmdir /s /q DataStreamMeter\obj
|
||||
rmdir /s /q Decrypt\bin
|
||||
rmdir /s /q Decrypt\obj
|
||||
rmdir /s /q DeviceTest\bin
|
||||
|
||||
Loading…
Reference in New Issue
Block a user