Merge branch 'master' of http://www.scserverddns.top:13000/sc/DyeingComputer
This commit is contained in:
commit
83467de3a9
3 files changed
+92
-10
No files matched your search
+6
-3
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using DyeingComputer.UserClass;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
@@ -24,12 +25,14 @@ namespace DyeingComputer
|
||||
//DyeingComputer.Properties.Resources.Culture = new System.Globalization.CultureInfo("en-US");//设定语言
|
||||
}
|
||||
System.Threading.Mutex mutex;
|
||||
void App_Startup(object sender, StartupEventArgs e) //程序只允许启动一次
|
||||
void App_Startup(object sender, StartupEventArgs e)
|
||||
{
|
||||
LogGing.LogGingDATA("800_Start");
|
||||
bool ret;
|
||||
mutex = new System.Threading.Mutex(true, "ElectronicNeedleTherapySystem", out ret);
|
||||
mutex = new System.Threading.Mutex(true, "ElectronicNeedleTherapySystem", out ret);//程序只允许启动一次
|
||||
if (!ret)
|
||||
{
|
||||
LogGing.LogGingDATA("800_The program has been launched");
|
||||
MessageBox.Show("The program has been launched");
|
||||
Environment.Exit(0);
|
||||
}
|
||||
|
||||
+38
-1
@@ -16,9 +16,24 @@
|
||||
<Deterministic>true</Deterministic>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
@@ -26,6 +41,7 @@
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
@@ -36,6 +52,12 @@
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject>DyeingComputer.App</StartupObject>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SignManifests>false</SignManifests>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||
@@ -308,6 +330,9 @@
|
||||
<PackageReference Include="NModbus">
|
||||
<Version>3.0.81</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="NModbus.Serial">
|
||||
<Version>3.0.81</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="ScottPlot.WPF">
|
||||
<Version>5.0.37</Version>
|
||||
</PackageReference>
|
||||
@@ -339,5 +364,17 @@
|
||||
<Content Include="Fonts\font-awesome-4.7.0\fonts\fontawesome-webfont.svg" />
|
||||
<Resource Include="Fonts\font-awesome-4.7.0\HELP-US-OUT.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include=".NETFramework,Version=v4.7.2">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Microsoft .NET Framework 4.7.2 %28x86 和 x64%29</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
@@ -16,6 +16,13 @@ using DyeingComputer.UserClass;
|
||||
using System.Reflection;
|
||||
using System.Windows.Documents;
|
||||
using System.Runtime.CompilerServices;
|
||||
using NModbus;
|
||||
using NModbus.Serial;
|
||||
using NModbus.Device;
|
||||
using System.IO.Ports;
|
||||
using OpenTK.Graphics.ES11;
|
||||
using DyeingComputer.Properties;
|
||||
|
||||
|
||||
namespace DyeingComputer.ViewModel
|
||||
{
|
||||
@@ -47,8 +54,11 @@ namespace DyeingComputer.ViewModel
|
||||
public MainWindowViewModel()
|
||||
{
|
||||
WorkNumder = "----------";
|
||||
CountDown();
|
||||
SQL_data();
|
||||
CountDown(); //启动循环任务
|
||||
SQL_data(); //读数据库
|
||||
UPort(); //启动串口
|
||||
|
||||
|
||||
}
|
||||
|
||||
public string work_Temp; //显示温度
|
||||
@@ -113,6 +123,39 @@ namespace DyeingComputer.ViewModel
|
||||
lk++;
|
||||
}
|
||||
|
||||
public SerialPort port = new SerialPort();//创建串口
|
||||
void UPort()
|
||||
{
|
||||
try
|
||||
{
|
||||
port.PortName = "COM5";
|
||||
port.BaudRate = 9600;//配置
|
||||
port.DataBits = 8;
|
||||
port.Parity = Parity.None;
|
||||
port.StopBits = StopBits.One;
|
||||
port.Open();//打开串口
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogGing.LogGingDATA("800_SerialPort_Not");
|
||||
LogGing.LogGingDATA(e.Message);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// var factory = new ModbusFactory();
|
||||
// IModbusMaster master = factory.CreateRtuMaster(port);
|
||||
// IModbusSerialMaster master = ModbusSerialMaster.CreateRtu(port);
|
||||
byte slaveId = 1;
|
||||
ushort startAddress = 100;
|
||||
ushort[] registers = new ushort[] { 1, 2, 3 };
|
||||
|
||||
// write three registers
|
||||
|
||||
var master = ModbusRtuMaster.CreateSerial("COM1", 9600, Parity.None, 8, StopBits.One);
|
||||
}
|
||||
|
||||
|
||||
private SQLiteHelper SQLiteHelpers = null; //定义数据库
|
||||
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\800COMPUTER.db"; //数据库路径
|
||||
DataTable dt_d = new DataTable("DIO");
|
||||
@@ -127,14 +170,13 @@ namespace DyeingComputer.ViewModel
|
||||
dt_a = SQLiteHelpers.ExecuteDataSet("select * from IOName where type='AI' OR type='AO'", null).Tables[0];
|
||||
dt_m = SQLiteHelpers.ExecuteDataSet("select * from IOName where type='M'", null).Tables[0];
|
||||
SQLiteHelpers.Close();
|
||||
|
||||
}
|
||||
|
||||
void IO_data()//刷新
|
||||
{
|
||||
updata_dtm("1", lk);
|
||||
updata_dtd("1", Convert.ToBoolean(1));
|
||||
updata_dta("1",10000+lk);
|
||||
updata_dtm("1001", lk);
|
||||
updata_dtd("2001", Convert.ToBoolean(1));
|
||||
updata_dta("4001",10000+lk);
|
||||
|
||||
|
||||
SYSData_A = ToObservableCollection<DATA_A>(dt_a);
|
||||
|
||||
Reference in new issue
Block a user