mirror of
https://github.com/ekinnee/SharpCAT.git
synced 2026-03-03 03:33:55 +01:00
Add console based test app.
Changeup on namespaces. Experimenting with events.
This commit is contained in:
parent
978c15b951
commit
b3c5c52965
|
|
@ -7,6 +7,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpCATForms", "SharpCATFo
|
|||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SharpCATLib", "SharpCAT\SharpCATLib.csproj", "{DAD3E7BE-905A-4768-A695-0BCF96171E35}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpCATConsole", "SharpCATConsole\SharpCATConsole.csproj", "{C0C9250E-EFCE-4F8F-8249-345647440EB9}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
|
@ -21,6 +23,10 @@ Global
|
|||
{DAD3E7BE-905A-4768-A695-0BCF96171E35}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{DAD3E7BE-905A-4768-A695-0BCF96171E35}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{DAD3E7BE-905A-4768-A695-0BCF96171E35}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{C0C9250E-EFCE-4F8F-8249-345647440EB9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C0C9250E-EFCE-4F8F-8249-345647440EB9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C0C9250E-EFCE-4F8F-8249-345647440EB9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C0C9250E-EFCE-4F8F-8249-345647440EB9}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
|
|||
|
|
@ -1,9 +1,26 @@
|
|||
using System.IO.Ports;
|
||||
using System;
|
||||
using System.IO.Ports;
|
||||
|
||||
namespace SharpCATLib
|
||||
{
|
||||
public class SharpCAT
|
||||
{
|
||||
public SharpCAT()
|
||||
{
|
||||
PortsSelected += new EventHandler(OnPortsSelected);
|
||||
}
|
||||
|
||||
public event EventHandler PortsSelected;
|
||||
public void OnSetPortsToUse()
|
||||
{
|
||||
PortsSelected?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
private void OnPortsSelected(object s, EventArgs e)
|
||||
{
|
||||
//Init and start the serial ports selected.
|
||||
}
|
||||
|
||||
public double[] CTCSSTones = { 67.0, 69.3, 71.9, 74.4, 77.0, 79.7, 82.5, 85.4, 88.5,
|
||||
91.5, 94.8, 97.4, 100.0, 103.5, 107.2, 110.9, 114.8, 118.8, 123, 127.3, 131.8,
|
||||
136.5, 141.3, 146.2, 151.4, 156.7, 162.2, 167.9, 173.8, 179.9, 186.2, 192.8,
|
||||
|
|
@ -25,5 +42,8 @@ namespace SharpCATLib
|
|||
|
||||
private readonly string CmdPad = "00000000";
|
||||
|
||||
private SerialPort[] PortsToUse;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
6
SharpCATConsole/App.config
Normal file
6
SharpCATConsole/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>
|
||||
24
SharpCATConsole/Program.cs
Normal file
24
SharpCATConsole/Program.cs
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using SharpCATLib;
|
||||
|
||||
namespace SharpCATConsole
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
SharpCAT sharpCAT = new SharpCAT();
|
||||
Console.WriteLine("Ports found: ");
|
||||
foreach (var port in sharpCAT.PortNames)
|
||||
{
|
||||
Console.WriteLine(port);
|
||||
}
|
||||
|
||||
Console.ReadKey();
|
||||
}
|
||||
}
|
||||
}
|
||||
36
SharpCATConsole/Properties/AssemblyInfo.cs
Normal file
36
SharpCATConsole/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("SharpCATConsole")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("SharpCATConsole")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2019")]
|
||||
[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("c0c9250e-efce-4f8f-8249-345647440eb9")]
|
||||
|
||||
// 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")]
|
||||
63
SharpCATConsole/SharpCATConsole.csproj
Normal file
63
SharpCATConsole/SharpCATConsole.csproj
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" 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>{C0C9250E-EFCE-4F8F-8249-345647440EB9}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>SharpCATConsole</RootNamespace>
|
||||
<AssemblyName>SharpCATConsole</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<Deterministic>true</Deterministic>
|
||||
</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.Core" />
|
||||
<Reference Include="System.IO.Ports, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.IO.Ports.4.5.0\lib\net461\System.IO.Ports.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SharpCAT\SharpCATLib.csproj">
|
||||
<Project>{dad3e7be-905a-4768-a695-0bcf96171e35}</Project>
|
||||
<Name>SharpCATLib</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
84
SharpCATForms/Form1.Designer.cs
generated
84
SharpCATForms/Form1.Designer.cs
generated
|
|
@ -28,43 +28,99 @@
|
|||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.ComPorts = new System.Windows.Forms.ListBox();
|
||||
this.tabControl1 = new System.Windows.Forms.TabControl();
|
||||
this.ComPort1Tab = new System.Windows.Forms.TabPage();
|
||||
this.ComPort2Tab = new System.Windows.Forms.TabPage();
|
||||
this.textBox1 = new System.Windows.Forms.TextBox();
|
||||
this.textBox2 = new System.Windows.Forms.TextBox();
|
||||
this.ComPortListBox = new System.Windows.Forms.ListBox();
|
||||
this.tabControl1.SuspendLayout();
|
||||
this.ComPort1Tab.SuspendLayout();
|
||||
this.ComPort2Tab.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// ComPorts
|
||||
// tabControl1
|
||||
//
|
||||
this.ComPorts.FormattingEnabled = true;
|
||||
this.ComPorts.Location = new System.Drawing.Point(229, 25);
|
||||
this.ComPorts.Name = "ComPorts";
|
||||
this.ComPorts.Size = new System.Drawing.Size(120, 95);
|
||||
this.ComPorts.TabIndex = 0;
|
||||
this.tabControl1.Controls.Add(this.ComPort1Tab);
|
||||
this.tabControl1.Controls.Add(this.ComPort2Tab);
|
||||
this.tabControl1.Location = new System.Drawing.Point(12, 12);
|
||||
this.tabControl1.Name = "tabControl1";
|
||||
this.tabControl1.SelectedIndex = 0;
|
||||
this.tabControl1.Size = new System.Drawing.Size(364, 410);
|
||||
this.tabControl1.TabIndex = 0;
|
||||
//
|
||||
// ComPort1Tab
|
||||
//
|
||||
this.ComPort1Tab.Controls.Add(this.textBox1);
|
||||
this.ComPort1Tab.Location = new System.Drawing.Point(4, 22);
|
||||
this.ComPort1Tab.Name = "ComPort1Tab";
|
||||
this.ComPort1Tab.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.ComPort1Tab.Size = new System.Drawing.Size(356, 384);
|
||||
this.ComPort1Tab.TabIndex = 0;
|
||||
this.ComPort1Tab.Text = "Port 1";
|
||||
this.ComPort1Tab.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// ComPort2Tab
|
||||
//
|
||||
this.ComPort2Tab.Controls.Add(this.textBox2);
|
||||
this.ComPort2Tab.Location = new System.Drawing.Point(4, 22);
|
||||
this.ComPort2Tab.Name = "ComPort2Tab";
|
||||
this.ComPort2Tab.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.ComPort2Tab.Size = new System.Drawing.Size(356, 384);
|
||||
this.ComPort2Tab.TabIndex = 1;
|
||||
this.ComPort2Tab.Text = "Port 2";
|
||||
this.ComPort2Tab.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// textBox1
|
||||
//
|
||||
this.textBox1.Location = new System.Drawing.Point(98, 335);
|
||||
this.textBox1.Location = new System.Drawing.Point(7, 7);
|
||||
this.textBox1.Multiline = true;
|
||||
this.textBox1.Name = "textBox1";
|
||||
this.textBox1.Size = new System.Drawing.Size(100, 20);
|
||||
this.textBox1.TabIndex = 1;
|
||||
this.textBox1.Size = new System.Drawing.Size(340, 371);
|
||||
this.textBox1.TabIndex = 0;
|
||||
//
|
||||
// textBox2
|
||||
//
|
||||
this.textBox2.Location = new System.Drawing.Point(7, 7);
|
||||
this.textBox2.Multiline = true;
|
||||
this.textBox2.Name = "textBox2";
|
||||
this.textBox2.Size = new System.Drawing.Size(340, 371);
|
||||
this.textBox2.TabIndex = 1;
|
||||
//
|
||||
// ComPortListBox
|
||||
//
|
||||
this.ComPortListBox.FormattingEnabled = true;
|
||||
this.ComPortListBox.Location = new System.Drawing.Point(462, 48);
|
||||
this.ComPortListBox.Name = "ComPortListBox";
|
||||
this.ComPortListBox.Size = new System.Drawing.Size(120, 95);
|
||||
this.ComPortListBox.TabIndex = 1;
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Controls.Add(this.textBox1);
|
||||
this.Controls.Add(this.ComPorts);
|
||||
this.Controls.Add(this.ComPortListBox);
|
||||
this.Controls.Add(this.tabControl1);
|
||||
this.Name = "Form1";
|
||||
this.Text = "Form1";
|
||||
this.tabControl1.ResumeLayout(false);
|
||||
this.ComPort1Tab.ResumeLayout(false);
|
||||
this.ComPort1Tab.PerformLayout();
|
||||
this.ComPort2Tab.ResumeLayout(false);
|
||||
this.ComPort2Tab.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.ListBox ComPorts;
|
||||
private System.Windows.Forms.TabControl tabControl1;
|
||||
private System.Windows.Forms.TabPage ComPort1Tab;
|
||||
private System.Windows.Forms.TextBox textBox1;
|
||||
private System.Windows.Forms.TabPage ComPort2Tab;
|
||||
private System.Windows.Forms.TextBox textBox2;
|
||||
private System.Windows.Forms.ListBox ComPortListBox;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ namespace SharpCATForms
|
|||
|
||||
InitializeComponent();
|
||||
|
||||
ComPorts.DataSource = sharpCAT.PortNames;
|
||||
ComPortListBox.DataSource = sharpCAT.PortNames;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -40,9 +40,6 @@
|
|||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.IO.Ports, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.IO.Ports.4.5.0\lib\net461\System.IO.Ports.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
|
|
@ -74,7 +71,6 @@
|
|||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<None Include="packages.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
|
|
|
|||
Loading…
Reference in a new issue