commit 21/11/2024
This commit is contained in:
22
App.config
22
App.config
@@ -1,8 +1,12 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<configuration>
|
<configuration>
|
||||||
<startup>
|
<configSections>
|
||||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
|
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
|
||||||
</startup>
|
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
|
||||||
|
</configSections>
|
||||||
|
<startup>
|
||||||
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
|
||||||
|
</startup>
|
||||||
<runtime>
|
<runtime>
|
||||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
@@ -19,4 +23,16 @@
|
|||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
</assemblyBinding>
|
</assemblyBinding>
|
||||||
</runtime>
|
</runtime>
|
||||||
|
<entityFramework>
|
||||||
|
<providers>
|
||||||
|
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
|
||||||
|
<provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
|
||||||
|
</providers>
|
||||||
|
</entityFramework>
|
||||||
|
<system.data>
|
||||||
|
<DbProviderFactories>
|
||||||
|
<remove invariant="System.Data.SQLite.EF6" />
|
||||||
|
<add name="SQLite Data Provider (Entity Framework 6)" invariant="System.Data.SQLite.EF6" description=".NET Framework Data Provider for SQLite (Entity Framework 6)" type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6" />
|
||||||
|
<remove invariant="System.Data.SQLite" /><add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" /></DbProviderFactories>
|
||||||
|
</system.data>
|
||||||
</configuration>
|
</configuration>
|
||||||
62
Database.cs
62
Database.cs
@@ -1,6 +1,7 @@
|
|||||||
using Microsoft.Data.Sqlite;
|
using System;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data.SQLite;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@@ -26,7 +27,7 @@ namespace FAtoPA
|
|||||||
private bool CreateFSMTable()
|
private bool CreateFSMTable()
|
||||||
{
|
{
|
||||||
//Debug.WriteLine("About to execute CreateFSMTable");
|
//Debug.WriteLine("About to execute CreateFSMTable");
|
||||||
using (var connection = new SqliteConnection(connectionString))
|
using (var connection = new SQLiteConnection(connectionString))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -47,7 +48,7 @@ namespace FAtoPA
|
|||||||
}
|
}
|
||||||
|
|
||||||
public bool ClearFSMTable() {
|
public bool ClearFSMTable() {
|
||||||
using (var connection = new SqliteConnection(connectionString))
|
using (var connection = new SQLiteConnection(connectionString))
|
||||||
{
|
{
|
||||||
connection.Open();
|
connection.Open();
|
||||||
var deleteCmd = connection.CreateCommand();
|
var deleteCmd = connection.CreateCommand();
|
||||||
@@ -57,7 +58,7 @@ namespace FAtoPA
|
|||||||
int result = deleteCmd.ExecuteNonQuery();
|
int result = deleteCmd.ExecuteNonQuery();
|
||||||
return (result > 0);
|
return (result > 0);
|
||||||
}
|
}
|
||||||
catch (SqliteException e)
|
catch (SQLiteException e)
|
||||||
{
|
{
|
||||||
Debug.WriteLine("Error deleting FSMData: " + e.Message);
|
Debug.WriteLine("Error deleting FSMData: " + e.Message);
|
||||||
}
|
}
|
||||||
@@ -68,7 +69,7 @@ namespace FAtoPA
|
|||||||
public List<FSMData> GetFSMDatas()
|
public List<FSMData> GetFSMDatas()
|
||||||
{
|
{
|
||||||
List<FSMData> fsmDatas = new List<FSMData>();
|
List<FSMData> fsmDatas = new List<FSMData>();
|
||||||
using (var connection = new SqliteConnection(connectionString))
|
using (var connection = new SQLiteConnection(connectionString))
|
||||||
{
|
{
|
||||||
connection.Open();
|
connection.Open();
|
||||||
|
|
||||||
@@ -88,7 +89,7 @@ namespace FAtoPA
|
|||||||
|
|
||||||
public bool AddFSMData(params FSMData[] data)
|
public bool AddFSMData(params FSMData[] data)
|
||||||
{
|
{
|
||||||
using(var connection = new SqliteConnection(connectionString))
|
using(var connection = new SQLiteConnection(connectionString))
|
||||||
{
|
{
|
||||||
connection.Open();
|
connection.Open();
|
||||||
using (var transaction = connection.BeginTransaction())
|
using (var transaction = connection.BeginTransaction())
|
||||||
@@ -109,7 +110,7 @@ namespace FAtoPA
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (SqliteException e)
|
catch (SQLiteException e)
|
||||||
{
|
{
|
||||||
Debug.WriteLine("Error inserting FSMData: " + e.Message);
|
Debug.WriteLine("Error inserting FSMData: " + e.Message);
|
||||||
transaction.Rollback();
|
transaction.Rollback();
|
||||||
@@ -124,7 +125,7 @@ namespace FAtoPA
|
|||||||
|
|
||||||
public bool RemoveFSMDatabySIID(String SIID)
|
public bool RemoveFSMDatabySIID(String SIID)
|
||||||
{
|
{
|
||||||
using (var conn = new SqliteConnection(connectionString))
|
using (var conn = new SQLiteConnection(connectionString))
|
||||||
{
|
{
|
||||||
conn.Open();
|
conn.Open();
|
||||||
var deleteCmd = conn.CreateCommand();
|
var deleteCmd = conn.CreateCommand();
|
||||||
@@ -135,7 +136,7 @@ namespace FAtoPA
|
|||||||
int result = deleteCmd.ExecuteNonQuery();
|
int result = deleteCmd.ExecuteNonQuery();
|
||||||
return (result > 0);
|
return (result > 0);
|
||||||
}
|
}
|
||||||
catch (SqliteException e)
|
catch (SQLiteException e)
|
||||||
{
|
{
|
||||||
Debug.WriteLine("Error deleting FSMData: " + e.Message);
|
Debug.WriteLine("Error deleting FSMData: " + e.Message);
|
||||||
return false;
|
return false;
|
||||||
@@ -146,7 +147,7 @@ namespace FAtoPA
|
|||||||
private bool CreateModbusTable()
|
private bool CreateModbusTable()
|
||||||
{
|
{
|
||||||
//Debug.WriteLine("About to execute CreateModbusTable");
|
//Debug.WriteLine("About to execute CreateModbusTable");
|
||||||
using (var connection = new SqliteConnection(connectionString))
|
using (var connection = new SQLiteConnection(connectionString))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -167,7 +168,7 @@ namespace FAtoPA
|
|||||||
|
|
||||||
public bool ClearModbusTable()
|
public bool ClearModbusTable()
|
||||||
{
|
{
|
||||||
using (var connection = new SqliteConnection(connectionString))
|
using (var connection = new SQLiteConnection(connectionString))
|
||||||
{
|
{
|
||||||
connection.Open();
|
connection.Open();
|
||||||
var deleteCmd = connection.CreateCommand();
|
var deleteCmd = connection.CreateCommand();
|
||||||
@@ -177,7 +178,7 @@ namespace FAtoPA
|
|||||||
int result = deleteCmd.ExecuteNonQuery();
|
int result = deleteCmd.ExecuteNonQuery();
|
||||||
return (result > 0);
|
return (result > 0);
|
||||||
}
|
}
|
||||||
catch (SqliteException e)
|
catch (SQLiteException e)
|
||||||
{
|
{
|
||||||
Debug.WriteLine("Error deleting ModbusData: " + e.Message);
|
Debug.WriteLine("Error deleting ModbusData: " + e.Message);
|
||||||
}
|
}
|
||||||
@@ -187,7 +188,7 @@ namespace FAtoPA
|
|||||||
|
|
||||||
public Boolean AddModbusData(params ModbusData[] data)
|
public Boolean AddModbusData(params ModbusData[] data)
|
||||||
{
|
{
|
||||||
using (var connection = new SqliteConnection(connectionString))
|
using (var connection = new SQLiteConnection(connectionString))
|
||||||
{
|
{
|
||||||
connection.Open();
|
connection.Open();
|
||||||
using (var transaction = connection.BeginTransaction())
|
using (var transaction = connection.BeginTransaction())
|
||||||
@@ -208,7 +209,7 @@ namespace FAtoPA
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (SqliteException e)
|
catch (SQLiteException e)
|
||||||
{
|
{
|
||||||
Debug.WriteLine("Error inserting ModbusData: " + e.Message);
|
Debug.WriteLine("Error inserting ModbusData: " + e.Message);
|
||||||
transaction.Rollback();
|
transaction.Rollback();
|
||||||
@@ -224,7 +225,7 @@ namespace FAtoPA
|
|||||||
public List<ModbusData> GetModbusDatas()
|
public List<ModbusData> GetModbusDatas()
|
||||||
{
|
{
|
||||||
List<ModbusData> modbusDatas = new List<ModbusData>();
|
List<ModbusData> modbusDatas = new List<ModbusData>();
|
||||||
using (var connection = new SqliteConnection(connectionString))
|
using (var connection = new SQLiteConnection(connectionString))
|
||||||
{
|
{
|
||||||
connection.Open();
|
connection.Open();
|
||||||
|
|
||||||
@@ -244,7 +245,7 @@ namespace FAtoPA
|
|||||||
|
|
||||||
public bool RemoveModbusDatabySIID(String SIID)
|
public bool RemoveModbusDatabySIID(String SIID)
|
||||||
{
|
{
|
||||||
using (var conn = new SqliteConnection(connectionString))
|
using (var conn = new SQLiteConnection(connectionString))
|
||||||
{
|
{
|
||||||
conn.Open();
|
conn.Open();
|
||||||
var deleteCmd = conn.CreateCommand();
|
var deleteCmd = conn.CreateCommand();
|
||||||
@@ -255,7 +256,7 @@ namespace FAtoPA
|
|||||||
int result = deleteCmd.ExecuteNonQuery();
|
int result = deleteCmd.ExecuteNonQuery();
|
||||||
return (result > 0);
|
return (result > 0);
|
||||||
}
|
}
|
||||||
catch (SqliteException e)
|
catch (SQLiteException e)
|
||||||
{
|
{
|
||||||
Debug.WriteLine("Error deleting ModbusData: " + e.Message);
|
Debug.WriteLine("Error deleting ModbusData: " + e.Message);
|
||||||
return false;
|
return false;
|
||||||
@@ -266,7 +267,7 @@ namespace FAtoPA
|
|||||||
private bool CreateVXTable()
|
private bool CreateVXTable()
|
||||||
{
|
{
|
||||||
//Debug.WriteLine("About to execute CreateVXTable");
|
//Debug.WriteLine("About to execute CreateVXTable");
|
||||||
using (var connection = new SqliteConnection(connectionString))
|
using (var connection = new SQLiteConnection(connectionString))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -287,7 +288,7 @@ namespace FAtoPA
|
|||||||
|
|
||||||
public bool ClearVXTable()
|
public bool ClearVXTable()
|
||||||
{
|
{
|
||||||
using (var connection = new SqliteConnection(connectionString))
|
using (var connection = new SQLiteConnection(connectionString))
|
||||||
{
|
{
|
||||||
connection.Open();
|
connection.Open();
|
||||||
var deleteCmd = connection.CreateCommand();
|
var deleteCmd = connection.CreateCommand();
|
||||||
@@ -297,7 +298,7 @@ namespace FAtoPA
|
|||||||
int result = deleteCmd.ExecuteNonQuery();
|
int result = deleteCmd.ExecuteNonQuery();
|
||||||
return (result > 0);
|
return (result > 0);
|
||||||
}
|
}
|
||||||
catch (SqliteException e)
|
catch (SQLiteException e)
|
||||||
{
|
{
|
||||||
Debug.WriteLine("Error deleting VXData: " + e.Message);
|
Debug.WriteLine("Error deleting VXData: " + e.Message);
|
||||||
}
|
}
|
||||||
@@ -308,7 +309,7 @@ namespace FAtoPA
|
|||||||
public List<VXData> GetVXDatas()
|
public List<VXData> GetVXDatas()
|
||||||
{
|
{
|
||||||
List<VXData> vxDatas = new List<VXData>();
|
List<VXData> vxDatas = new List<VXData>();
|
||||||
using (var connection = new SqliteConnection(connectionString))
|
using (var connection = new SQLiteConnection(connectionString))
|
||||||
{
|
{
|
||||||
connection.Open();
|
connection.Open();
|
||||||
|
|
||||||
@@ -328,7 +329,7 @@ namespace FAtoPA
|
|||||||
|
|
||||||
public bool RemoveVXDatabySIID(String SIID)
|
public bool RemoveVXDatabySIID(String SIID)
|
||||||
{
|
{
|
||||||
using (var conn = new SqliteConnection(connectionString))
|
using (var conn = new SQLiteConnection(connectionString))
|
||||||
{
|
{
|
||||||
conn.Open();
|
conn.Open();
|
||||||
var deleteCmd = conn.CreateCommand();
|
var deleteCmd = conn.CreateCommand();
|
||||||
@@ -339,7 +340,7 @@ namespace FAtoPA
|
|||||||
int result = deleteCmd.ExecuteNonQuery();
|
int result = deleteCmd.ExecuteNonQuery();
|
||||||
return (result > 0);
|
return (result > 0);
|
||||||
}
|
}
|
||||||
catch (SqliteException e)
|
catch (SQLiteException e)
|
||||||
{
|
{
|
||||||
Debug.WriteLine("Error deleting VXData: " + e.Message);
|
Debug.WriteLine("Error deleting VXData: " + e.Message);
|
||||||
return false;
|
return false;
|
||||||
@@ -348,7 +349,7 @@ namespace FAtoPA
|
|||||||
}
|
}
|
||||||
|
|
||||||
public bool AddVXData(params VXData[] data) {
|
public bool AddVXData(params VXData[] data) {
|
||||||
using(var connection = new SqliteConnection(connectionString))
|
using(var connection = new SQLiteConnection(connectionString))
|
||||||
{
|
{
|
||||||
connection.Open();
|
connection.Open();
|
||||||
using (var transaction = connection.BeginTransaction())
|
using (var transaction = connection.BeginTransaction())
|
||||||
@@ -370,7 +371,7 @@ namespace FAtoPA
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (SqliteException e)
|
catch (SQLiteException e)
|
||||||
{
|
{
|
||||||
Debug.WriteLine("Error inserting VXData: " + e.Message);
|
Debug.WriteLine("Error inserting VXData: " + e.Message);
|
||||||
transaction.Rollback();
|
transaction.Rollback();
|
||||||
@@ -385,7 +386,7 @@ namespace FAtoPA
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class FSMData
|
class FSMData : INotifyPropertyChanged
|
||||||
{
|
{
|
||||||
public String SIID { get; set; }
|
public String SIID { get; set; }
|
||||||
public Boolean Enable { get; set; }
|
public Boolean Enable { get; set; }
|
||||||
@@ -417,6 +418,13 @@ namespace FAtoPA
|
|||||||
this.Value = "";
|
this.Value = "";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void OnPropertyChanged(string propertyName)
|
||||||
|
{
|
||||||
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||||
|
}
|
||||||
|
|
||||||
|
public event PropertyChangedEventHandler PropertyChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
class ModbusData
|
class ModbusData
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="packages\EntityFramework.6.4.4\build\EntityFramework.props" Condition="Exists('packages\EntityFramework.6.4.4\build\EntityFramework.props')" />
|
||||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
@@ -14,6 +15,8 @@
|
|||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||||
<Deterministic>true</Deterministic>
|
<Deterministic>true</Deterministic>
|
||||||
|
<NuGetPackageImportStamp>
|
||||||
|
</NuGetPackageImportStamp>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
@@ -64,6 +67,12 @@
|
|||||||
<Reference Include="DataExchangeInterfaces">
|
<Reference Include="DataExchangeInterfaces">
|
||||||
<HintPath>..\..\..\Bosch FA\FSM5000FSI-2.0.21\Release_x64\DataExchangeInterfaces.dll</HintPath>
|
<HintPath>..\..\..\Bosch FA\FSM5000FSI-2.0.21\Release_x64\DataExchangeInterfaces.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\EntityFramework.6.4.4\lib\net45\EntityFramework.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\EntityFramework.6.4.4\lib\net45\EntityFramework.SqlServer.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="FSIConfig">
|
<Reference Include="FSIConfig">
|
||||||
<HintPath>..\..\..\Bosch FA\FSM5000FSI-2.0.21\Release_x64\FSIConfig.dll</HintPath>
|
<HintPath>..\..\..\Bosch FA\FSM5000FSI-2.0.21\Release_x64\FSIConfig.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
@@ -82,9 +91,6 @@
|
|||||||
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\Microsoft.Bcl.AsyncInterfaces.9.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
|
<HintPath>packages\Microsoft.Bcl.AsyncInterfaces.9.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.Data.Sqlite, Version=9.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
|
||||||
<HintPath>packages\Microsoft.Data.Sqlite.Core.9.0.0\lib\netstandard2.0\Microsoft.Data.Sqlite.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="MPNetCIL">
|
<Reference Include="MPNetCIL">
|
||||||
<HintPath>..\..\..\Bosch FA\FSM5000FSI-2.0.21\Release_x64\MPNetCIL.dll</HintPath>
|
<HintPath>..\..\..\Bosch FA\FSM5000FSI-2.0.21\Release_x64\MPNetCIL.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
@@ -110,7 +116,17 @@
|
|||||||
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
|
<HintPath>packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Data.SQLite, Version=1.0.119.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.119.0\lib\net46\System.Data.SQLite.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Data.SQLite.EF6, Version=1.0.119.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\System.Data.SQLite.EF6.1.0.119.0\lib\net46\System.Data.SQLite.EF6.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Data.SQLite.Linq, Version=1.0.119.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\System.Data.SQLite.Linq.1.0.119.0\lib\net46\System.Data.SQLite.Linq.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="System.IO.Pipelines, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
<Reference Include="System.IO.Pipelines, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\System.IO.Pipelines.9.0.0\lib\net462\System.IO.Pipelines.dll</HintPath>
|
<HintPath>packages\System.IO.Pipelines.9.0.0\lib\net462\System.IO.Pipelines.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
@@ -204,4 +220,14 @@
|
|||||||
<None Include="App.config" />
|
<None Include="App.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||||
|
<PropertyGroup>
|
||||||
|
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Error Condition="!Exists('packages\EntityFramework.6.4.4\build\EntityFramework.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\EntityFramework.6.4.4\build\EntityFramework.props'))" />
|
||||||
|
<Error Condition="!Exists('packages\EntityFramework.6.4.4\build\EntityFramework.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\EntityFramework.6.4.4\build\EntityFramework.targets'))" />
|
||||||
|
<Error Condition="!Exists('packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.119.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.119.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets'))" />
|
||||||
|
</Target>
|
||||||
|
<Import Project="packages\EntityFramework.6.4.4\build\EntityFramework.targets" Condition="Exists('packages\EntityFramework.6.4.4\build\EntityFramework.targets')" />
|
||||||
|
<Import Project="packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.119.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets" Condition="Exists('packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.119.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets')" />
|
||||||
</Project>
|
</Project>
|
||||||
43
FSM.cs
43
FSM.cs
@@ -4,6 +4,7 @@ using FSM5000FSIAPI.Version3;
|
|||||||
using System;
|
using System;
|
||||||
using System.CodeDom;
|
using System.CodeDom;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Data.Entity.Infrastructure.Interception;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@@ -47,7 +48,6 @@ namespace FAtoPA
|
|||||||
config.PNA = pna;
|
config.PNA = pna;
|
||||||
config.LocalIPAddress = localip;
|
config.LocalIPAddress = localip;
|
||||||
config.RepositoryLocation = ".\\repository";
|
config.RepositoryLocation = ".\\repository";
|
||||||
config.AdvancedFSIConfig = new AdvancedFSIConfig();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -82,7 +82,7 @@ namespace FAtoPA
|
|||||||
TraceConsoleWritter outputter = new TraceConsoleWritter();
|
TraceConsoleWritter outputter = new TraceConsoleWritter();
|
||||||
controller.SetTraceLevel(SourceLevels.Warning); //for support issues please set the level to SourceLevels.Verbose
|
controller.SetTraceLevel(SourceLevels.Warning); //for support issues please set the level to SourceLevels.Verbose
|
||||||
Result result = controller.Startup(config);
|
Result result = controller.Startup(config);
|
||||||
//Debug.WriteLine("[FSM] Start result = "+result.ToString());
|
Debug.WriteLine("[FSM] Start result = "+result.ToString());
|
||||||
if (result==Result.SUCCESS)
|
if (result==Result.SUCCESS)
|
||||||
{
|
{
|
||||||
Started = true;
|
Started = true;
|
||||||
@@ -110,7 +110,7 @@ namespace FAtoPA
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
Result result = controller.Shutdown();
|
Result result = controller.Shutdown();
|
||||||
//Console.WriteLine("[FSM] Shutdown result = " + result.ToString());
|
Debug.WriteLine("[FSM] Shutdown result = " + result.ToString());
|
||||||
if (_event!=null) _event.ConnectStatus(false, "FSM Stopped");
|
if (_event!=null) _event.ConnectStatus(false, "FSM Stopped");
|
||||||
} catch (Exception e)
|
} catch (Exception e)
|
||||||
{
|
{
|
||||||
@@ -149,12 +149,16 @@ namespace FAtoPA
|
|||||||
/// <param name="devItemType"></param>
|
/// <param name="devItemType"></param>
|
||||||
public void SetItemType(ItemType devItemType)
|
public void SetItemType(ItemType devItemType)
|
||||||
{
|
{
|
||||||
Debug.WriteLine($"Item type {devItemType.FunctionalType} ({devItemType.Description})");
|
//Debug.WriteLine($"Item type {devItemType.FunctionalType} ({devItemType.Description})");
|
||||||
if (type_dictionary != null)
|
if (type_dictionary != null)
|
||||||
{
|
{
|
||||||
int type = int.Parse(devItemType.FunctionalType.ToString());
|
int type = int.Parse(devItemType.FunctionalType.ToString());
|
||||||
if (!type_dictionary.ContainsKey(type)) type_dictionary.Add(type, devItemType.Description);
|
if (!type_dictionary.ContainsKey(type))
|
||||||
|
{
|
||||||
|
Debug.WriteLine($"Adding key={type}, value={devItemType.Description} to type_dictionary");
|
||||||
|
type_dictionary.Add(type, devItemType.Description);
|
||||||
|
}
|
||||||
|
else Debug.WriteLine($"type_dictionary already have key={type}");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -178,12 +182,14 @@ namespace FAtoPA
|
|||||||
nodeData.Label = devItem.Label;
|
nodeData.Label = devItem.Label;
|
||||||
nodeData.Description = type_dictionary.ContainsKey(type) ? type_dictionary[type] : "Unknown";
|
nodeData.Description = type_dictionary.ContainsKey(type) ? type_dictionary[type] : "Unknown";
|
||||||
node_data.Add(SIID, nodeData);
|
node_data.Add(SIID, nodeData);
|
||||||
|
Debug.WriteLine($"Adding SIID={nodeData.SIID} Label={nodeData.Label} Description={nodeData.Description} to node_data");
|
||||||
// notify all listeners
|
// notify all listeners
|
||||||
if (listeners != null)
|
if (listeners != null)
|
||||||
foreach (var item in listeners)
|
foreach (var item in listeners)
|
||||||
item.DiscoveredSIID(SIID, nodeData);
|
item.DiscoveredSIID(SIID, nodeData);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else Debug.WriteLine($"node_data already have SIID={SIID}");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -235,22 +241,23 @@ namespace FAtoPA
|
|||||||
{
|
{
|
||||||
NodeState prev = nd.State;
|
NodeState prev = nd.State;
|
||||||
nd.State = new NodeState(devItemState);
|
nd.State = new NodeState(devItemState);
|
||||||
|
//if (prev != null)
|
||||||
|
//{
|
||||||
|
// Debug.WriteLine($"SIID={SIID} Change LogicalState from {prev.LogicalState} to {nd.State.LogicalState}");
|
||||||
|
//}
|
||||||
|
//else
|
||||||
|
//{
|
||||||
|
// Debug.WriteLine($"SIID={SIID} New LogicalState {nd.State.LogicalState}");
|
||||||
|
//}
|
||||||
|
|
||||||
// notify all listeners
|
// notify all listeners
|
||||||
if (listeners != null)
|
if (listeners != null)
|
||||||
foreach (var item in listeners)
|
foreach (var item in listeners)
|
||||||
item.NewState(SIID, prev, nd.State);
|
item.NewState(SIID, prev, nd.State);
|
||||||
|
|
||||||
if (prev != null)
|
|
||||||
{
|
} else Debug.WriteLine($"NodeData with SIID {SIID} is null");
|
||||||
Debug.WriteLine("SIID=" + SIID + " Change LogicalState from " + prev.LogicalState + " to " + nd.State.LogicalState);
|
} else Debug.WriteLine($"node_data doesn't contain SIID {SIID}");
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Debug.WriteLine("New State for SIID=" + SIID + " LogicalState=" + nd.State.LogicalState);
|
|
||||||
}
|
|
||||||
} else Debug.WriteLine("NodeData with SIID " + SIID + " is null");
|
|
||||||
} else Debug.WriteLine("node_data doesn't contain SIID " + SIID);
|
|
||||||
|
|
||||||
} else Debug.WriteLine("node_data is null");
|
} else Debug.WriteLine("node_data is null");
|
||||||
|
|
||||||
@@ -263,7 +270,7 @@ namespace FAtoPA
|
|||||||
/// <param name="mpNetTime"></param>
|
/// <param name="mpNetTime"></param>
|
||||||
public void SetMPNetTime(DateTime mpNetTime)
|
public void SetMPNetTime(DateTime mpNetTime)
|
||||||
{
|
{
|
||||||
Debug.WriteLine("Time is " + mpNetTime + ".");
|
Debug.WriteLine($"Time is {mpNetTime}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -276,7 +283,7 @@ namespace FAtoPA
|
|||||||
{
|
{
|
||||||
public override void Write(string message)
|
public override void Write(string message)
|
||||||
{
|
{
|
||||||
if (message!=null && message.Length>0) Debug.Write(message);
|
if (message!=null && message.Length>0) Debug.WriteLine(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void WriteLine(string message)
|
public override void WriteLine(string message)
|
||||||
|
|||||||
@@ -7,7 +7,10 @@
|
|||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Loaded="Window_Loaded"
|
Loaded="Window_Loaded"
|
||||||
Closing="Window_Closing"
|
Closing="Window_Closing"
|
||||||
Title="MainWindow" Height="450" Width="800">
|
Title="MainWindow"
|
||||||
|
MinWidth="800"
|
||||||
|
MinHeight="480"
|
||||||
|
WindowState="Maximized" >
|
||||||
<Grid>
|
<Grid>
|
||||||
<DockPanel>
|
<DockPanel>
|
||||||
<StatusBar DockPanel.Dock="Bottom" Height="30">
|
<StatusBar DockPanel.Dock="Bottom" Height="30">
|
||||||
@@ -102,14 +105,22 @@
|
|||||||
<ColumnDefinition Width="*"/>
|
<ColumnDefinition Width="*"/>
|
||||||
<ColumnDefinition Width="*"/>
|
<ColumnDefinition Width="*"/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Button Grid.Column="0" Margin="5" x:Name="btnAddSIID" Content="Add To Table" Click="btnAddSIID_Click"/>
|
<Button Grid.Column="0" Margin="5" x:Name="btnAddSIID" Content="Manual Add To Table" Click="btnAddSIID_Click"/>
|
||||||
<Button Grid.Column="1" Margin="5" x:Name="btnDelSIID" Content="Remove From Table" Click="btnDelSIID_Click"/>
|
<Button Grid.Column="1" Margin="5" x:Name="btnDelSIID" Content="Remove From Table" Click="btnDelSIID_Click"/>
|
||||||
<Button Grid.Column="2" Margin="5" x:Name="btnClearSIID" Content="Clear Table" Click="btnClearSIID_Click"/>
|
<Button Grid.Column="2" Margin="5" x:Name="btnClearSIID" Content="Clear Table" Click="btnClearSIID_Click"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
<DockPanel DockPanel.Dock="Left" Width="200">
|
<DockPanel DockPanel.Dock="Left" Width="300">
|
||||||
<Label Content="Detected SIID" DockPanel.Dock="Top" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"/>
|
<Label Content="Detected SIID" DockPanel.Dock="Top" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"/>
|
||||||
<Label Content="Count : 0" DockPanel.Dock="Bottom" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" x:Name="DetectedSIIDCount"/>
|
<Grid DockPanel.Dock="Bottom" Height="50">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Label Content="Count : 0" Margin="5,0" Grid.Column="0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" x:Name="DetectedSIIDCount"/>
|
||||||
|
<Button Content="Add Selected to Table" Margin="5,0" Grid.Column="1" HorizontalAlignment="Stretch" Click="AddSelectedSIID" />
|
||||||
|
</Grid>
|
||||||
|
|
||||||
<ListBox x:Name="DetectedSIID" />
|
<ListBox x:Name="DetectedSIID" />
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
<DataGrid MinRowHeight="50" x:Name="FSMTable" AutoGenerateColumns="True" AutoGeneratingColumn="FSMTable_AutoGeneratingColumn" />
|
<DataGrid MinRowHeight="50" x:Name="FSMTable" AutoGenerateColumns="True" AutoGeneratingColumn="FSMTable_AutoGeneratingColumn" />
|
||||||
|
|||||||
@@ -188,23 +188,23 @@ namespace FAtoPA.Net
|
|||||||
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
||||||
{
|
{
|
||||||
Debug.WriteLine("Window Closing");
|
Debug.WriteLine("Window Closing");
|
||||||
timer1s?.Stop();
|
timer1s.Stop();
|
||||||
fsm?.Stop();
|
fsm.Stop();
|
||||||
modbusSlave?.Stop();
|
modbusSlave.Stop();
|
||||||
vx3k?.Disconnect();
|
vx3k.Disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnStartStopFSM_Click(object sender, RoutedEventArgs e)
|
private void btnStartStopFSM_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (FSM.Started)
|
if (FSM.Started)
|
||||||
{
|
{
|
||||||
fsm?.Stop();
|
fsm.Stop();
|
||||||
btnStartStopFSM.Content = "Start FSM Connection";
|
btnStartStopFSM.Content = "Start FSM Connection";
|
||||||
FSM.Started = false;
|
FSM.Started = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fsm?.Start();
|
fsm.Start();
|
||||||
btnStartStopFSM.Content = "Stop FSM Connection";
|
btnStartStopFSM.Content = "Stop FSM Connection";
|
||||||
FSM.Started = true;
|
FSM.Started = true;
|
||||||
}
|
}
|
||||||
@@ -214,7 +214,7 @@ namespace FAtoPA.Net
|
|||||||
{
|
{
|
||||||
if (ModbusSlave.Started)
|
if (ModbusSlave.Started)
|
||||||
{
|
{
|
||||||
modbusSlave?.Stop();
|
modbusSlave.Stop();
|
||||||
btnStartStopModbus.Content = "Start Modbus Connection";
|
btnStartStopModbus.Content = "Start Modbus Connection";
|
||||||
ModbusSlave.Started = false;
|
ModbusSlave.Started = false;
|
||||||
}
|
}
|
||||||
@@ -222,7 +222,7 @@ namespace FAtoPA.Net
|
|||||||
{
|
{
|
||||||
if (config != null)
|
if (config != null)
|
||||||
{
|
{
|
||||||
modbusSlave?.Start(config.Modbus_ListenPort);
|
modbusSlave.Start(config.Modbus_ListenPort);
|
||||||
btnStartStopModbus.Content = "Stop Modbus Connection";
|
btnStartStopModbus.Content = "Stop Modbus Connection";
|
||||||
ModbusSlave.Started = true;
|
ModbusSlave.Started = true;
|
||||||
|
|
||||||
@@ -235,7 +235,7 @@ namespace FAtoPA.Net
|
|||||||
{
|
{
|
||||||
if (VX3K.Started)
|
if (VX3K.Started)
|
||||||
{
|
{
|
||||||
vx3k?.Disconnect();
|
vx3k.Disconnect();
|
||||||
btnStartStopVX.Content = "Start VX Connection";
|
btnStartStopVX.Content = "Start VX Connection";
|
||||||
VX3K.Started = false;
|
VX3K.Started = false;
|
||||||
}
|
}
|
||||||
@@ -243,7 +243,7 @@ namespace FAtoPA.Net
|
|||||||
{
|
{
|
||||||
if (config != null)
|
if (config != null)
|
||||||
{
|
{
|
||||||
vx3k?.Connect(config.VX_TargetIP, config.VX_TargetPort);
|
vx3k.Connect(config.VX_TargetIP, config.VX_TargetPort);
|
||||||
btnStartStopVX.Content = "Stop VX Connection";
|
btnStartStopVX.Content = "Stop VX Connection";
|
||||||
VX3K.Started = true;
|
VX3K.Started = true;
|
||||||
}
|
}
|
||||||
@@ -795,25 +795,21 @@ namespace FAtoPA.Net
|
|||||||
|
|
||||||
private void btnDelSIID_Click(object sender, RoutedEventArgs e)
|
private void btnDelSIID_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
SIID selected = GetSIID();
|
int selectedindex = FSMTable.SelectedIndex;
|
||||||
if (selected != null)
|
if (selectedindex >= 0)
|
||||||
{
|
{
|
||||||
|
FSMData selected = (FSMData)FSMTable.Items[selectedindex];
|
||||||
MessageBoxResult result = MessageBox.Show("Delete SIID " + selected.ToString() + " ?", "Delete SIID", MessageBoxButton.YesNo);
|
MessageBoxResult result = MessageBox.Show("Delete SIID " + selected.ToString() + " ?", "Delete SIID", MessageBoxButton.YesNo);
|
||||||
if (result == MessageBoxResult.Yes)
|
if (result == MessageBoxResult.Yes)
|
||||||
{
|
{
|
||||||
if (database != null)
|
FsmTableMember.Remove(selected);
|
||||||
{
|
database.RemoveFSMDatabySIID(selected.SIID);
|
||||||
if (database.RemoveFSMDatabySIID(selected.ToString()))
|
|
||||||
{
|
|
||||||
FSMTable.ItemsSource = database.GetFSMDatas();
|
|
||||||
FSMSIID.Remove(selected.ToString());
|
|
||||||
}
|
|
||||||
else MessageBox.Show("Failed to delete from database");
|
|
||||||
}
|
|
||||||
else MessageBox.Show("Database is null");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else MessageBox.Show("Invalid Selection");
|
else MessageBox.Show("Select a row in table to delete");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnClearSIID_Click(object sender, RoutedEventArgs e)
|
private void btnClearSIID_Click(object sender, RoutedEventArgs e)
|
||||||
@@ -821,16 +817,9 @@ namespace FAtoPA.Net
|
|||||||
MessageBoxResult result = MessageBox.Show("Clear all SIID ?", "Clear SIID", MessageBoxButton.YesNo);
|
MessageBoxResult result = MessageBox.Show("Clear all SIID ?", "Clear SIID", MessageBoxButton.YesNo);
|
||||||
if (result == MessageBoxResult.Yes)
|
if (result == MessageBoxResult.Yes)
|
||||||
{
|
{
|
||||||
if (database != null)
|
FsmTableMember.Clear();
|
||||||
{
|
database.ClearFSMTable();
|
||||||
if (database.ClearFSMTable())
|
|
||||||
{
|
|
||||||
FSMTable.ItemsSource = database.GetFSMDatas();
|
|
||||||
FSMSIID.Clear();
|
|
||||||
}
|
|
||||||
else MessageBox.Show("Failed to clear database");
|
|
||||||
}
|
|
||||||
else MessageBox.Show("Database is null");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1136,6 +1125,27 @@ namespace FAtoPA.Net
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void AddSelectedSIID(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
var lbl = DetectedSIID.SelectedItem;
|
||||||
|
if (lbl != null && lbl is Label)
|
||||||
|
{
|
||||||
|
Label selected = (Label)lbl;
|
||||||
|
if (selected.Tag is NodeData)
|
||||||
|
{
|
||||||
|
NodeData data = (NodeData)selected.Tag;
|
||||||
|
FSMData fSMData = new FSMData(data.SIID.ToString(), true, data.Description);
|
||||||
|
if (database.AddFSMData(fSMData))
|
||||||
|
{
|
||||||
|
FsmTableMember.Add(fSMData);
|
||||||
|
database.AddFSMData(fSMData);
|
||||||
|
}
|
||||||
|
else MessageBox.Show("Failed to add to database");
|
||||||
|
}
|
||||||
|
else MessageBox.Show("Selected SIID dont have NodeData");
|
||||||
|
} else MessageBox.Show("No SIID Selected");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// event handler for VX3K
|
// event handler for VX3K
|
||||||
@@ -1282,10 +1292,10 @@ namespace FAtoPA.Net
|
|||||||
// Class ini untuk update Table FSM
|
// Class ini untuk update Table FSM
|
||||||
class FSMTableUpdater : FSMResultInterface
|
class FSMTableUpdater : FSMResultInterface
|
||||||
{
|
{
|
||||||
|
// dari database
|
||||||
ObservableCollection<FSMData> data;
|
ObservableCollection<FSMData> data;
|
||||||
ListBox listbox;
|
ListBox listbox;
|
||||||
Label countlabel;
|
Label countlabel;
|
||||||
int count = 0;
|
|
||||||
public FSMTableUpdater(ObservableCollection<FSMData> data, ListBox listbox, Label countlabel)
|
public FSMTableUpdater(ObservableCollection<FSMData> data, ListBox listbox, Label countlabel)
|
||||||
{
|
{
|
||||||
this.data = data;
|
this.data = data;
|
||||||
@@ -1295,23 +1305,33 @@ namespace FAtoPA.Net
|
|||||||
|
|
||||||
public void DiscoveredSIID(string SIID, NodeData type)
|
public void DiscoveredSIID(string SIID, NodeData type)
|
||||||
{
|
{
|
||||||
Debug.WriteLine("Discovered SIID : " + SIID + " Type : " + type);
|
Debug.WriteLine("Discovered SIID : " + SIID + " Type : " + type.Description);
|
||||||
count++;
|
Application.Current.Dispatcher.Invoke(() =>
|
||||||
countlabel.Dispatcher.Invoke(() => countlabel.Content = "Count : " + count);
|
{
|
||||||
listbox.Dispatcher.Invoke(() => listbox.Items.Add(new Label() { Content = SIID + " : " + type.ToString() }));
|
listbox.Items.Add(new Label() { Content = $"{SIID} : {type.Label} : {type.Description}", Tag = type });
|
||||||
|
countlabel.Content = "Count : " + listbox.Items.Count;
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void NewState(string SIID, NodeState previous, NodeState current)
|
public void NewState(string SIID, NodeState previous, NodeState current)
|
||||||
{
|
{
|
||||||
Debug.WriteLine("New State : " + SIID + " Previous : " + previous + " Current : " + current);
|
Debug.WriteLine("New State : " + SIID + " Previous : " + previous?.LogicalState + " Current : " + current.LogicalState);
|
||||||
|
if (data != null)
|
||||||
//FSMData dd = data.First(d => d.SIID == SIID);
|
{
|
||||||
//if (dd != null)
|
foreach (var dd in data)
|
||||||
//{
|
{
|
||||||
// dd.LastUpdate = DateTime.Now.ToString();
|
if (dd.SIID.Equals(SIID))
|
||||||
// dd.Value = current.LogicalState ?? "Unknown";
|
{
|
||||||
//}
|
dd.LastUpdate = DateTime.Now.ToString();
|
||||||
|
dd.Value = current.LogicalState ?? "Unknown";
|
||||||
|
Debug.WriteLine($"Changing row in FSM Table for SIID={SIID} Value={dd.Value}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Debug.WriteLine($"FSM Table dont have row with SIID={SIID}");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1320,6 +1340,7 @@ namespace FAtoPA.Net
|
|||||||
// Class ini untuk Update Modbus Register dari FSM Update
|
// Class ini untuk Update Modbus Register dari FSM Update
|
||||||
class ModbusTriggerFromFSM : FSMResultInterface
|
class ModbusTriggerFromFSM : FSMResultInterface
|
||||||
{
|
{
|
||||||
|
// dari database
|
||||||
ObservableCollection<FSMData> source;
|
ObservableCollection<FSMData> source;
|
||||||
ObservableCollection<ModbusData> data;
|
ObservableCollection<ModbusData> data;
|
||||||
ModbusSlave slave;
|
ModbusSlave slave;
|
||||||
|
|||||||
@@ -1,13 +1,17 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
|
<package id="EntityFramework" version="6.4.4" targetFramework="net48" />
|
||||||
<package id="Microsoft.Bcl.AsyncInterfaces" version="9.0.0" targetFramework="net48" />
|
<package id="Microsoft.Bcl.AsyncInterfaces" version="9.0.0" targetFramework="net48" />
|
||||||
<package id="Microsoft.Data.Sqlite" version="9.0.0" targetFramework="net48" />
|
|
||||||
<package id="Microsoft.Data.Sqlite.Core" version="9.0.0" targetFramework="net48" />
|
|
||||||
<package id="SQLitePCLRaw.bundle_e_sqlite3" version="2.1.10" targetFramework="net48" />
|
<package id="SQLitePCLRaw.bundle_e_sqlite3" version="2.1.10" targetFramework="net48" />
|
||||||
<package id="SQLitePCLRaw.core" version="2.1.10" targetFramework="net48" />
|
<package id="SQLitePCLRaw.core" version="2.1.10" targetFramework="net48" />
|
||||||
<package id="SQLitePCLRaw.lib.e_sqlite3" version="2.1.10" targetFramework="net48" />
|
<package id="SQLitePCLRaw.lib.e_sqlite3" version="2.1.10" targetFramework="net48" />
|
||||||
<package id="SQLitePCLRaw.provider.dynamic_cdecl" version="2.1.10" targetFramework="net48" />
|
<package id="SQLitePCLRaw.provider.dynamic_cdecl" version="2.1.10" targetFramework="net48" />
|
||||||
|
<package id="Stub.System.Data.SQLite.Core.NetFramework" version="1.0.119.0" targetFramework="net48" />
|
||||||
<package id="System.Buffers" version="4.5.1" targetFramework="net48" />
|
<package id="System.Buffers" version="4.5.1" targetFramework="net48" />
|
||||||
|
<package id="System.Data.SQLite" version="1.0.119.0" targetFramework="net48" />
|
||||||
|
<package id="System.Data.SQLite.Core" version="1.0.119.0" targetFramework="net48" />
|
||||||
|
<package id="System.Data.SQLite.EF6" version="1.0.119.0" targetFramework="net48" />
|
||||||
|
<package id="System.Data.SQLite.Linq" version="1.0.119.0" targetFramework="net48" />
|
||||||
<package id="System.IO.Pipelines" version="9.0.0" targetFramework="net48" />
|
<package id="System.IO.Pipelines" version="9.0.0" targetFramework="net48" />
|
||||||
<package id="System.Memory" version="4.5.5" targetFramework="net48" />
|
<package id="System.Memory" version="4.5.5" targetFramework="net48" />
|
||||||
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net48" />
|
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net48" />
|
||||||
|
|||||||
Reference in New Issue
Block a user