Commit c280d311 authored by wangjunqiang's avatar wangjunqiang

消除所有warning并优化部分代码

parent d269da47
...@@ -5,6 +5,7 @@ using System.Linq; ...@@ -5,6 +5,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using GcDevicePc.Common; using GcDevicePc.Common;
using GcDevicePc.GCBuffer;
namespace GcDevicePc namespace GcDevicePc
{ {
...@@ -308,26 +309,23 @@ namespace GcDevicePc ...@@ -308,26 +309,23 @@ namespace GcDevicePc
// } // }
//} //}
//public void InitAllGCConfig() public void InitGCHWConfig()
//{ {
// int devicecount = 0; int devicecount = 0;
// devicecount = globaldata.DeviceList.Count; devicecount = globaldata.DeviceList.Count;
// int i = 0; int i = 0;
// string tmpfile = ""; string tmpfile = "";
if (devicecount > 0)
// if (devicecount > 0) {
// { for (i = 0; i < devicecount; i++)
// globaldata.GCHWConfigs.Clear(); {
// for (i = 0; i < devicecount; i++) tmpfile = globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.StatusFolder + "\\DevStatus.ini";
// { HWConfig m_hwconfig = new HWConfig(tmpfile);
// tmpfile = globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.StatusFolder + "\\" + globaldata.DeviceName[i].ToString() + "\\DevStatus.ini"; m_hwconfig.GetHWConfig();
// HWConfig m_hwconfig = new HWConfig(tmpfile); }
// m_hwconfig.GetHWConfig(); }
// globaldata.GCHWConfigs.Add(m_hwconfig);
// }
// }
//} }
/// <summary> /// <summary>
/// 初始化基础线程 /// 初始化基础线程
......
using System;
using System.Runtime.InteropServices;
using System.Text;
namespace GcDevicePc.Common
{
class FileTransfer
{
[DllImport(@"WtFileSender.dll", EntryPoint = "fnWtClientInit", CharSet = CharSet.Unicode)]
private static extern uint fnWtClientInit(byte[] Ip, ushort wTcpPort);
[DllImport(@"WtFileSender.dll", EntryPoint = "fnWtFileSeverInit")]
private static extern uint fnWtFileSeverInit(ushort wTcpPort);
[DllImport(@"WtFileSender.dll", EntryPoint = "fnWtFileClose")]
private static extern void fnWtClientClose(uint handle);
[DllImport(@"WtFileSender.dll", EntryPoint = "fnWtClientCopytoServer")]
private static extern int fnWtClientCopytoServer(uint handle, byte[] lpszFileName, byte[] lpszFilePathName, byte[] lpszRemoteFilePath);
[DllImport(@"WtFileSender.dll", EntryPoint = "fnWtClientCopyfromServer")]
private static extern int fnWtClientCopyfromServer(uint handle, byte[] lpszFileName, byte[] lpszFilePathName, byte[] lpszRemoteFilePath);
[DllImport(@"WtFileSender.dll", EntryPoint = "fnWtCloseCEPro")]
private static extern int fnWtCloseCEPro(uint handle, byte[] lpszFileName);
[DllImport(@"WtFileSender.dll", EntryPoint = "fnWtRunPro")]
private static extern int fnWtRunPro(uint handle, byte[] lpszFileName, byte[] lpszRemoteFilePath);
private uint hFileServerHandle;
public void WtClientInit(String RemoteIP, ushort wport)
{
try
{
byte[] fIP = Encoding.Unicode.GetBytes(RemoteIP);
this.hFileServerHandle = fnWtClientInit(fIP, wport);
}
catch
{
}
}
public void WtClientClose()
{
try
{
fnWtClientClose(this.hFileServerHandle);
}
catch
{
}
}
public int WtClientCopytoServer(String filename, String filepath, String RemoteFilePath)
{
int bret;
byte[] bfilename = Encoding.Unicode.GetBytes(filename);
byte[] bfilepath = Encoding.Unicode.GetBytes(filepath);
byte[] bRemoteFilePath = Encoding.Unicode.GetBytes(RemoteFilePath);
bret = fnWtClientCopytoServer(this.hFileServerHandle, bfilename, bfilepath, bRemoteFilePath);
return bret;
}
public int WtClientCopyfromServer(String filename, String filepath, String RemoteFilePath)
{
int bret;
byte[] bfilename = Encoding.Unicode.GetBytes(filename);
byte[] bfilepath = Encoding.Unicode.GetBytes(filepath);
byte[] bRemoteFilePath = Encoding.Unicode.GetBytes(RemoteFilePath);
bret = fnWtClientCopyfromServer(this.hFileServerHandle, bfilename, bfilepath, bRemoteFilePath);
return bret;
}
public int WtHMICloseRro(String filename)
{
int bret;
byte[] bfilename = Encoding.Unicode.GetBytes(filename);
bret = fnWtCloseCEPro(this.hFileServerHandle, bfilename);
return bret;
}
public int WtHMIRunPro(String filename, String RemoteFilePath)
{
int bret;
byte[] bfilename = Encoding.Unicode.GetBytes(filename);
byte[] bRemoteFilePath = Encoding.Unicode.GetBytes(RemoteFilePath);
bret = fnWtRunPro(this.hFileServerHandle, bfilename, bRemoteFilePath);
return bret;
}
}
}
...@@ -19,6 +19,7 @@ namespace GcDevicePc.Common ...@@ -19,6 +19,7 @@ namespace GcDevicePc.Common
private IniFile RunTableFile; private IniFile RunTableFile;
private IniFile AsRunTableFile; private IniFile AsRunTableFile;
public Int32 TotalNum = 0;
public List<String> _methodname = new List<String>(); public List<String> _methodname = new List<String>();
public List<Int32> _runcount = new List<Int32>(); public List<Int32> _runcount = new List<Int32>();
public List<Int32> _runtime = new List<Int32>(); public List<Int32> _runtime = new List<Int32>();
...@@ -64,12 +65,12 @@ namespace GcDevicePc.Common ...@@ -64,12 +65,12 @@ namespace GcDevicePc.Common
public void LoadRunTable() public void LoadRunTable()
{ {
RunTableFile = new IniFile(_filename); RunTableFile = new IniFile(_filename);
int num = 0; //int num = 0;
int i = 0; int i = 0;
if (RunTableFile.KeyExists("Total", "count")) if (RunTableFile.KeyExists("Total", "count"))
{ {
num = RunTableFile.ReadInteger("Total", "count"); this.TotalNum = RunTableFile.ReadInteger("Total", "count");
for (i = 0; i < num ; i++) for (i = 0; i < TotalNum; i++)
{ {
_methodname.Add(RunTableFile.ReadString("运行表",i.ToString())); _methodname.Add(RunTableFile.ReadString("运行表",i.ToString()));
_runcount.Add(RunTableFile.ReadInteger("循环", i.ToString())); _runcount.Add(RunTableFile.ReadInteger("循环", i.ToString()));
...@@ -108,6 +109,8 @@ namespace GcDevicePc.Common ...@@ -108,6 +109,8 @@ namespace GcDevicePc.Common
_methodname.Add(name); _methodname.Add(name);
_runcount.Add(count); _runcount.Add(count);
_runtime.Add(time); _runtime.Add(time);
TotalNum++;
} }
public void ModifyItem(Int32 index, String name, Int32 count, Int32 time) public void ModifyItem(Int32 index, String name, Int32 count, Int32 time)
...@@ -131,13 +134,14 @@ namespace GcDevicePc.Common ...@@ -131,13 +134,14 @@ namespace GcDevicePc.Common
_methodname.RemoveAt(indexno); _methodname.RemoveAt(indexno);
_runcount.RemoveAt(indexno); _runcount.RemoveAt(indexno);
_runtime.RemoveAt(indexno); _runtime.RemoveAt(indexno);
TotalNum--;
return true; return true;
} }
} }
return false; return false;
} }
private bool saveini(IniFile saveini) private bool SaveIni(IniFile saveini)
{ {
int i; int i;
int count = _methodname.Count & _runcount.Count & _runtime.Count; int count = _methodname.Count & _runcount.Count & _runtime.Count;
...@@ -156,14 +160,23 @@ namespace GcDevicePc.Common ...@@ -156,14 +160,23 @@ namespace GcDevicePc.Common
saveini.WriteInteger("运行时间", i.ToString(), _runtime[i]); saveini.WriteInteger("运行时间", i.ToString(), _runtime[i]);
} }
if (TotalNum == count)
{
saveini.WriteInteger("Total", "count", count); saveini.WriteInteger("Total", "count", count);
}
else
{
Log.Info("Run Table File Bug");
}
return true; return true;
} }
public bool SaveRunTable() public bool SaveRunTable()
{ {
return saveini(RunTableFile); return SaveIni(RunTableFile);
} }
...@@ -189,7 +202,7 @@ namespace GcDevicePc.Common ...@@ -189,7 +202,7 @@ namespace GcDevicePc.Common
AsRunTableFile = new IniFile(_asfilename); AsRunTableFile = new IniFile(_asfilename);
return saveini(AsRunTableFile); return SaveIni(AsRunTableFile);
} }
......
...@@ -14,7 +14,7 @@ using GcDevicePc.IniParam; ...@@ -14,7 +14,7 @@ using GcDevicePc.IniParam;
namespace GcDevicePc.ConfigDlg namespace GcDevicePc.ConfigDlg
{ {
public delegate void ChangeMNameForUp(string name); // public delegate void ChangeMNameForUp(string name);
public delegate void SendUpdateCMD(bool flag); public delegate void SendUpdateCMD(bool flag);
public partial class MethodBase : Form public partial class MethodBase : Form
{ {
...@@ -310,7 +310,7 @@ namespace GcDevicePc.ConfigDlg ...@@ -310,7 +310,7 @@ namespace GcDevicePc.ConfigDlg
//} //}
} }
public event ChangeMNameForUp changenameforup; // public event ChangeMNameForUp changenameforup;
public event SendUpdateCMD sendupdatecmd; public event SendUpdateCMD sendupdatecmd;
private void updatebtn_Click(object sender, EventArgs e) private void updatebtn_Click(object sender, EventArgs e)
{ {
......
...@@ -63,8 +63,8 @@ namespace GcDevicePc ...@@ -63,8 +63,8 @@ namespace GcDevicePc
} }
double fDetvalueold = 0; double fDetvalueold = 0;
double iDetvalueold = 0; // double iDetvalueold = 0;
double bDetvalueold = 0; // double bDetvalueold = 0;
ListViewItem tempshow; ListViewItem tempshow;
private void dataupdate_Tick(object sender, EventArgs e) private void dataupdate_Tick(object sender, EventArgs e)
{ {
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
namespace GcDevicePc namespace GcDevicePc
...@@ -11,22 +10,25 @@ namespace GcDevicePc ...@@ -11,22 +10,25 @@ namespace GcDevicePc
{ {
[DllImport(@"WtFileSender.dll", EntryPoint = "fnWtClientInit", CharSet = CharSet.Unicode)] [DllImport(@"WtFileSender.dll", EntryPoint = "fnWtClientInit", CharSet = CharSet.Unicode)]
public static extern uint fnWtClientInit(byte[] Ip, ushort wTcpPort); private static extern uint fnWtClientInit(byte[] Ip, ushort wTcpPort);
[DllImport(@"WtFileSender.dll", EntryPoint = "fnWtFileSeverInit")] [DllImport(@"WtFileSender.dll", EntryPoint = "fnWtFileSeverInit")]
private static extern uint fnWtFileSeverInit(ushort wTcpPort);
public static extern void fnWtClientClose(uint handle); [DllImport(@"WtFileSender.dll", EntryPoint = "fnWtClientClose")]
[DllImport(@"WtFileSender.dll", EntryPoint = "fnWtFileClose")] private static extern void fnWtClientClose(uint handle);
public static extern uint fnWtFileSeverInit(ushort wTcpPort);
[DllImport(@"WtFileSender.dll", EntryPoint = "fnWtClientCopytoServer")] [DllImport(@"WtFileSender.dll", EntryPoint = "fnWtClientCopytoServer")]
public static extern int fnWtClientCopytoServer(uint handle, byte[] lpszFileName, byte[] lpszFilePathName, byte[] lpszRemoteFilePath); private static extern int fnWtClientCopytoServer(uint handle, byte[] lpszFileName, byte[] lpszFilePathName, byte[] lpszRemoteFilePath);
[DllImport(@"WtFileSender.dll", EntryPoint = "fnWtClientCopyfromServer")] [DllImport(@"WtFileSender.dll", EntryPoint = "fnWtClientCopyfromServer")]
public static extern int fnWtClientCopyfromServer(uint handle, byte[] lpszFileName, byte[] lpszFilePathName, byte[] lpszRemoteFilePath); private static extern int fnWtClientCopyfromServer(uint handle, byte[] lpszFileName, byte[] lpszFilePathName, byte[] lpszRemoteFilePath);
[DllImport(@"WtFileSender.dll", EntryPoint = "fnWtCloseCEPro")] [DllImport(@"WtFileSender.dll", EntryPoint = "fnWtCloseCEPro")]
public static extern int fnWtCloseCEPro(uint handle, byte[] lpszFileName); private static extern int fnWtCloseCEPro(uint handle, byte[] lpszFileName);
[DllImport(@"WtFileSender.dll", EntryPoint = "fnWtRunPro")] [DllImport(@"WtFileSender.dll", EntryPoint = "fnWtRunPro")]
public static extern int fnWtRunPro(uint handle, byte[] lpszFileName, byte[] lpszRemoteFilePath); private static extern int fnWtRunPro(uint handle, byte[] lpszFileName, byte[] lpszRemoteFilePath);
private uint hFileServerHandle; private uint hFileServerHandle;
...@@ -39,7 +41,7 @@ namespace GcDevicePc ...@@ -39,7 +41,7 @@ namespace GcDevicePc
} }
catch catch
{ {
Console.WriteLine("fnWtClientClose Error");
} }
} }
...@@ -53,7 +55,7 @@ namespace GcDevicePc ...@@ -53,7 +55,7 @@ namespace GcDevicePc
} }
catch catch
{ {
Console.WriteLine("WtClientInit Error");
} }
} }
......
...@@ -113,10 +113,123 @@ namespace GcDevicePc.GCBuffer ...@@ -113,10 +113,123 @@ namespace GcDevicePc.GCBuffer
public ShowInfo ShowList = new ShowInfo(); public ShowInfo ShowList = new ShowInfo();
public DPBuffer() public void DPInit()
{ {
ShowList.showtime.runtimenow = 0; ShowList.showtime.runtimenow = 0;
ShowList.showValve.ValveOneTime.start1 = 0; ShowList.showValve.ValveOneTime.start1 = 0;
this.ShowList.showtemp.FPActualTemp = 0.0f;
this.ShowList.showtemp.FPSetTemp = 0.0f;
this.ShowList.showtemp.BPActualTemp = 0.0f;
this.ShowList.showtemp.BPSetTemp = 0.0f;
this.ShowList.showtemp.ColActualTemp = 0.0f;
this.ShowList.showtemp.ColSetTemp = 0.0f;
this.ShowList.showtemp.fDetActualTemp = 0.0f;
this.ShowList.showtemp.fDetSetTemp = 0.0f;
this.ShowList.showtemp.iDetActualTemp = 0.0f;
this.ShowList.showtemp.iDetSetTemp = 0.0f;
this.ShowList.showtemp.bDetActualTemp = 0.0f;
this.ShowList.showtemp.bDetSetTemp = 0.0f;
this.ShowList.showtemp.AuxActualTemp1 = 0.0f;
this.ShowList.showtemp.AuxSetTemp1 = 0.0f;
this.ShowList.showtemp.AuxActualTemp2 = 0.0f;
this.ShowList.showtemp.AuxSetTemp2 = 0.0f;
this.ShowList.showValve.u16ValveOne = false;
this.ShowList.showValve.ValveOneTime.start1 = 0;
this.ShowList.showValve.ValveOneTime.end1 = 0;
this.ShowList.showValve.ValveOneTime.start2 = 0;
this.ShowList.showValve.ValveOneTime.end2 = 0;
this.ShowList.showValve.ValveOneTime.start3 = 0;
this.ShowList.showValve.ValveOneTime.end3 = 0;
this.ShowList.showValve.ValveOneTime.start4 = 0;
this.ShowList.showValve.ValveOneTime.end4 = 0;
this.ShowList.showValve.u16ValveTwo = false;
this.ShowList.showValve.ValveTwoTime.start1 = 0;
this.ShowList.showValve.ValveTwoTime.end1 = 0;
this.ShowList.showValve.ValveTwoTime.start2 = 0;
this.ShowList.showValve.ValveTwoTime.end2 = 0;
this.ShowList.showValve.ValveTwoTime.start3 = 0;
this.ShowList.showValve.ValveTwoTime.end3 = 0;
this.ShowList.showValve.ValveTwoTime.start4 = 0;
this.ShowList.showValve.ValveTwoTime.end4 = 0;
this.ShowList.showValve.u16ValveThree = false;
this.ShowList.showValve.ValveThreeTime.start1 = 0;
this.ShowList.showValve.ValveThreeTime.end1 = 0;
this.ShowList.showValve.ValveThreeTime.start2 = 0;
this.ShowList.showValve.ValveThreeTime.end2 = 0;
this.ShowList.showValve.ValveThreeTime.start3 = 0;
this.ShowList.showValve.ValveThreeTime.end3 = 0;
this.ShowList.showValve.ValveThreeTime.start4 = 0;
this.ShowList.showValve.ValveThreeTime.end4 = 0;
this.ShowList.showValve.u16ValveFour = false;
this.ShowList.showValve.ValveFourTime.start1 = 0;
this.ShowList.showValve.ValveFourTime.end1 = 0;
this.ShowList.showValve.ValveFourTime.start2 = 0;
this.ShowList.showValve.ValveFourTime.end2 = 0;
this.ShowList.showValve.ValveFourTime.start3 = 0;
this.ShowList.showValve.ValveFourTime.end3 = 0;
this.ShowList.showValve.ValveFourTime.start4 = 0;
this.ShowList.showValve.ValveFourTime.end4 = 0;
this.ShowList.showValve.u16ValveFive = false;
this.ShowList.showValve.ValveFiveTime.start1 = 0;
this.ShowList.showValve.ValveFiveTime.end1 = 0;
this.ShowList.showValve.ValveFiveTime.start2 = 0;
this.ShowList.showValve.ValveFiveTime.end2 = 0;
this.ShowList.showValve.ValveFiveTime.start3 = 0;
this.ShowList.showValve.ValveFiveTime.end3 = 0;
this.ShowList.showValve.ValveFiveTime.start4 = 0;
this.ShowList.showValve.ValveFiveTime.end4 = 0;
this.ShowList.showValve.u16ValveSix = false;
this.ShowList.showValve.ValveSixTime.start1 = 0;
this.ShowList.showValve.ValveSixTime.end1 = 0;
this.ShowList.showValve.ValveSixTime.start2 = 0;
this.ShowList.showValve.ValveSixTime.end2 = 0;
this.ShowList.showValve.ValveSixTime.start3 = 0;
this.ShowList.showValve.ValveSixTime.end3 = 0;
this.ShowList.showValve.ValveSixTime.start4 = 0;
this.ShowList.showValve.ValveSixTime.end4 = 0;
//this.ShowList.showValve.ValveTime = new valvetime[6];
//for (i = 0; i < 6; i++)
//{
// this.ShowList.showValve.ValveTime[i].start = new float[4];
// this.ShowList.showValve.ValveTime[i].end = new float[4];
//}
this.ShowList.showISport.fallpressure = 0.0f;
this.ShowList.showISport.fpressure1 = 0.0f;
this.ShowList.showISport.fpressure2 = 0.0f;
this.ShowList.showISport.fpressure3 = 0.0f;
this.ShowList.showISport.ballpressure = 0.0f;
this.ShowList.showISport.bpressure1 = 0.0f;
this.ShowList.showISport.bpressure2 = 0.0f;
this.ShowList.showISport.bpressure3 = 0.0f;
this.ShowList.showDet.fDetPol = 0;
this.ShowList.showDet.fDetValue = 0.0f;
this.ShowList.showDet.fDetStatue = 0;
this.ShowList.showDet.fDetSwitch = false;
this.ShowList.showDet.iDetPol = 0;
this.ShowList.showDet.iDetValue = 0.0f;
this.ShowList.showDet.iDetStatue = 0;
this.ShowList.showDet.iDetSwitch = false;
this.ShowList.showDet.bDetPol = 0;
this.ShowList.showDet.bDetValue = 0.0f;
this.ShowList.showDet.bDetStatue = 0;
this.ShowList.showDet.bDetSwitch = false;
// this.ShowList.errorifo.ErrorStatus = new byte[9];
}
public DPBuffer()
{
DPInit();
} }
~DPBuffer() ~DPBuffer()
......
This diff is collapsed.
...@@ -171,7 +171,7 @@ namespace GcDevicePc.GCBuffer ...@@ -171,7 +171,7 @@ namespace GcDevicePc.GCBuffer
public string sASSolventB; //进样后溶剂B public string sASSolventB; //进样后溶剂B
public ushort u16PushPullTimes; //推拉针芯次数 public ushort u16PushPullTimes; //推拉针芯次数
//其他参数 //其他参数
UNION_TEMP fCurTemp; //进样室当前温度 // UNION_TEMP fCurTemp; //进样室当前温度
public float fSetTemp; //进样室设定温度 public float fSetTemp; //进样室设定温度
} }
......
...@@ -68,6 +68,8 @@ namespace GcDevicePc.GCBuffer ...@@ -68,6 +68,8 @@ namespace GcDevicePc.GCBuffer
gcpcinfo.pcfolderinfo.LogFolder = null; gcpcinfo.pcfolderinfo.LogFolder = null;
gcpcinfo.pcfileinfo.cur_MethodName = null; gcpcinfo.pcfileinfo.cur_MethodName = null;
gcpcinfo.pcfileinfo.cur_BATMethodName = null;
gcpcinfo.pcfileinfo.new_MethodName = null;
gcpcinfo.pcfileinfo.cur_OpenMethodName = null; gcpcinfo.pcfileinfo.cur_OpenMethodName = null;
gcpcinfo.pcfileinfo.cur_StatusName = null; gcpcinfo.pcfileinfo.cur_StatusName = null;
gcpcinfo.pcfileinfo.cur_RunTab = null; gcpcinfo.pcfileinfo.cur_RunTab = null;
......
...@@ -187,6 +187,7 @@ ...@@ -187,6 +187,7 @@
<Compile Include="CK_UI\WaveTotalForm.Designer.cs"> <Compile Include="CK_UI\WaveTotalForm.Designer.cs">
<DependentUpon>WaveTotalForm.cs</DependentUpon> <DependentUpon>WaveTotalForm.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Common\FileTransfer.cs" />
<Compile Include="Common\GCModbus.cs" /> <Compile Include="Common\GCModbus.cs" />
<Compile Include="Common\GCModbusSlave.cs" /> <Compile Include="Common\GCModbusSlave.cs" />
<Compile Include="Common\FileHelper.cs" /> <Compile Include="Common\FileHelper.cs" />
...@@ -332,7 +333,6 @@ ...@@ -332,7 +333,6 @@
<Compile Include="GCBuffer\HWConfig.cs" /> <Compile Include="GCBuffer\HWConfig.cs" />
<Compile Include="GCBuffer\MethodConfig.cs" /> <Compile Include="GCBuffer\MethodConfig.cs" />
<Compile Include="GCBuffer\PCBuffer.cs" /> <Compile Include="GCBuffer\PCBuffer.cs" />
<Compile Include="GCBuffer\RingBufferManager.cs" />
<Compile Include="GCBuffer\SignalBuffer.cs" /> <Compile Include="GCBuffer\SignalBuffer.cs" />
<Compile Include="GCMain.cs"> <Compile Include="GCMain.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
......
using System; using System;
using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using System.Diagnostics; using System.Diagnostics;
using GcDevicePc.ProThread; using GcDevicePc.ProThread;
using GcDevicePc.Common; using GcDevicePc.Common;
using GcDevicePc.IniParam;
using System.Threading; using System.Threading;
using System.IO;
using GcDevicePc.CK_UI; using GcDevicePc.CK_UI;
using GcDevicePc.Common;
namespace GcDevicePc namespace GcDevicePc
{ {
...@@ -1538,8 +1530,8 @@ namespace GcDevicePc ...@@ -1538,8 +1530,8 @@ namespace GcDevicePc
globaldata.m_configDlg.m_AuxDlg.reflashContent(); globaldata.m_configDlg.m_AuxDlg.reflashContent();
// globaldata.m_configDlg.m_SignalDlg.reflashContent(); // globaldata.m_configDlg.m_SignalDlg.reflashContent();
globaldata.m_configDlg.changenameforup -= new ConfigDlg.ChangeMNameForUp(SetMainFormMethodName); // globaldata.m_configDlg.changenameforup -= new ConfigDlg.ChangeMNameForUp(SetMainFormMethodName);
globaldata.m_configDlg.changenameforup += new ConfigDlg.ChangeMNameForUp(SetMainFormMethodName); // globaldata.m_configDlg.changenameforup += new ConfigDlg.ChangeMNameForUp(SetMainFormMethodName);
globaldata.m_configDlg.sendupdatecmd -= new ConfigDlg.SendUpdateCMD(SendPCCMD); globaldata.m_configDlg.sendupdatecmd -= new ConfigDlg.SendUpdateCMD(SendPCCMD);
globaldata.m_configDlg.sendupdatecmd += new ConfigDlg.SendUpdateCMD(SendPCCMD); globaldata.m_configDlg.sendupdatecmd += new ConfigDlg.SendUpdateCMD(SendPCCMD);
globaldata.m_configDlg.Show(); globaldata.m_configDlg.Show();
...@@ -1572,8 +1564,8 @@ namespace GcDevicePc ...@@ -1572,8 +1564,8 @@ namespace GcDevicePc
globaldata.m_configDlg.m_AuxDlg.reflashContent(); globaldata.m_configDlg.m_AuxDlg.reflashContent();
// globaldata.m_configDlg.m_SignalDlg.reflashContent(); // globaldata.m_configDlg.m_SignalDlg.reflashContent();
globaldata.m_configDlg.changenameforup -= new ConfigDlg.ChangeMNameForUp(SetMainFormMethodName); // globaldata.m_configDlg.changenameforup -= new ConfigDlg.ChangeMNameForUp(SetMainFormMethodName);
globaldata.m_configDlg.changenameforup += new ConfigDlg.ChangeMNameForUp(SetMainFormMethodName); // globaldata.m_configDlg.changenameforup += new ConfigDlg.ChangeMNameForUp(SetMainFormMethodName);
globaldata.m_configDlg.sendupdatecmd -= new ConfigDlg.SendUpdateCMD(SendPCCMD); globaldata.m_configDlg.sendupdatecmd -= new ConfigDlg.SendUpdateCMD(SendPCCMD);
globaldata.m_configDlg.sendupdatecmd += new ConfigDlg.SendUpdateCMD(SendPCCMD); globaldata.m_configDlg.sendupdatecmd += new ConfigDlg.SendUpdateCMD(SendPCCMD);
...@@ -1610,8 +1602,8 @@ namespace GcDevicePc ...@@ -1610,8 +1602,8 @@ namespace GcDevicePc
globaldata.m_configDlg.m_AuxDlg.reflashContent(); globaldata.m_configDlg.m_AuxDlg.reflashContent();
// globaldata.m_configDlg.m_SignalDlg.reflashContent(); // globaldata.m_configDlg.m_SignalDlg.reflashContent();
globaldata.m_configDlg.changenameforup -= new ConfigDlg.ChangeMNameForUp(SetMainFormMethodName); // globaldata.m_configDlg.changenameforup -= new ConfigDlg.ChangeMNameForUp(SetMainFormMethodName);
globaldata.m_configDlg.changenameforup += new ConfigDlg.ChangeMNameForUp(SetMainFormMethodName); // globaldata.m_configDlg.changenameforup += new ConfigDlg.ChangeMNameForUp(SetMainFormMethodName);
globaldata.m_configDlg.sendupdatecmd -= new ConfigDlg.SendUpdateCMD(SendPCCMD); globaldata.m_configDlg.sendupdatecmd -= new ConfigDlg.SendUpdateCMD(SendPCCMD);
globaldata.m_configDlg.sendupdatecmd += new ConfigDlg.SendUpdateCMD(SendPCCMD); globaldata.m_configDlg.sendupdatecmd += new ConfigDlg.SendUpdateCMD(SendPCCMD);
globaldata.m_configDlg.Show(); globaldata.m_configDlg.Show();
......
...@@ -1918,8 +1918,8 @@ namespace GcDevicePc ...@@ -1918,8 +1918,8 @@ namespace GcDevicePc
globaldata.m_configDlg.m_AuxDlg.reflashContent(); globaldata.m_configDlg.m_AuxDlg.reflashContent();
// globaldata.m_configDlg.m_SignalDlg.reflashContent(); // globaldata.m_configDlg.m_SignalDlg.reflashContent();
globaldata.m_configDlg.changenameforup -= new ConfigDlg.ChangeMNameForUp(SetMainFormMethodName); // globaldata.m_configDlg.changenameforup -= new ConfigDlg.ChangeMNameForUp(SetMainFormMethodName);
globaldata.m_configDlg.changenameforup += new ConfigDlg.ChangeMNameForUp(SetMainFormMethodName); // globaldata.m_configDlg.changenameforup += new ConfigDlg.ChangeMNameForUp(SetMainFormMethodName);
globaldata.m_configDlg.sendupdatecmd -= new ConfigDlg.SendUpdateCMD(SendPCCMD); globaldata.m_configDlg.sendupdatecmd -= new ConfigDlg.SendUpdateCMD(SendPCCMD);
globaldata.m_configDlg.sendupdatecmd += new ConfigDlg.SendUpdateCMD(SendPCCMD); globaldata.m_configDlg.sendupdatecmd += new ConfigDlg.SendUpdateCMD(SendPCCMD);
globaldata.m_configDlg.Show(); globaldata.m_configDlg.Show();
...@@ -2021,8 +2021,8 @@ namespace GcDevicePc ...@@ -2021,8 +2021,8 @@ namespace GcDevicePc
globaldata.m_configDlg.m_AuxDlg.reflashContent(); globaldata.m_configDlg.m_AuxDlg.reflashContent();
// globaldata.m_configDlg.m_SignalDlg.reflashContent(); // globaldata.m_configDlg.m_SignalDlg.reflashContent();
globaldata.m_configDlg.changenameforup -= new ConfigDlg.ChangeMNameForUp(SetMainFormMethodName); // globaldata.m_configDlg.changenameforup -= new ConfigDlg.ChangeMNameForUp(SetMainFormMethodName);
globaldata.m_configDlg.changenameforup += new ConfigDlg.ChangeMNameForUp(SetMainFormMethodName); // globaldata.m_configDlg.changenameforup += new ConfigDlg.ChangeMNameForUp(SetMainFormMethodName);
globaldata.m_configDlg.sendupdatecmd -= new ConfigDlg.SendUpdateCMD(SendPCCMD); globaldata.m_configDlg.sendupdatecmd -= new ConfigDlg.SendUpdateCMD(SendPCCMD);
globaldata.m_configDlg.sendupdatecmd += new ConfigDlg.SendUpdateCMD(SendPCCMD); globaldata.m_configDlg.sendupdatecmd += new ConfigDlg.SendUpdateCMD(SendPCCMD);
...@@ -2059,8 +2059,8 @@ namespace GcDevicePc ...@@ -2059,8 +2059,8 @@ namespace GcDevicePc
globaldata.m_configDlg.m_AuxDlg.reflashContent(); globaldata.m_configDlg.m_AuxDlg.reflashContent();
// globaldata.m_configDlg.m_SignalDlg.reflashContent(); // globaldata.m_configDlg.m_SignalDlg.reflashContent();
globaldata.m_configDlg.changenameforup -= new ConfigDlg.ChangeMNameForUp(SetMainFormMethodName); // globaldata.m_configDlg.changenameforup -= new ConfigDlg.ChangeMNameForUp(SetMainFormMethodName);
globaldata.m_configDlg.changenameforup += new ConfigDlg.ChangeMNameForUp(SetMainFormMethodName); // globaldata.m_configDlg.changenameforup += new ConfigDlg.ChangeMNameForUp(SetMainFormMethodName);
globaldata.m_configDlg.sendupdatecmd -= new ConfigDlg.SendUpdateCMD(SendPCCMD); globaldata.m_configDlg.sendupdatecmd -= new ConfigDlg.SendUpdateCMD(SendPCCMD);
globaldata.m_configDlg.sendupdatecmd += new ConfigDlg.SendUpdateCMD(SendPCCMD); globaldata.m_configDlg.sendupdatecmd += new ConfigDlg.SendUpdateCMD(SendPCCMD);
globaldata.m_configDlg.Show(); globaldata.m_configDlg.Show();
......
...@@ -21,8 +21,8 @@ namespace GcDevicePc.ProThread ...@@ -21,8 +21,8 @@ namespace GcDevicePc.ProThread
static bool dataflag = false; static bool dataflag = false;
static bool recvend = false; static bool recvend = false;
static bool threadrestart = false; // static bool threadrestart = false;
static bool lastthreadend = false; // static bool lastthreadend = false;
private static void DataRcv_Work() private static void DataRcv_Work()
{ {
...@@ -144,7 +144,7 @@ namespace GcDevicePc.ProThread ...@@ -144,7 +144,7 @@ namespace GcDevicePc.ProThread
else else
{ {
Console.WriteLine("老线程退出!"); Console.WriteLine("老线程退出!");
lastthreadend = true; // lastthreadend = true;
} }
} }
...@@ -157,7 +157,7 @@ namespace GcDevicePc.ProThread ...@@ -157,7 +157,7 @@ namespace GcDevicePc.ProThread
catch (Exception ex) catch (Exception ex)
{ {
Console.WriteLine(ex.Message); Console.WriteLine(ex.Message);
threadrestart = true; // threadrestart = true;
var socket = ar.AsyncState as Socket; var socket = ar.AsyncState as Socket;
socket.Shutdown(SocketShutdown.Both); socket.Shutdown(SocketShutdown.Both);
socket.Close(); socket.Close();
......
...@@ -154,7 +154,8 @@ namespace GcDevicePc ...@@ -154,7 +154,8 @@ namespace GcDevicePc
{ {
if (createNew) if (createNew)
{ {
Application.Run(new StartForm()); // Application.Run(new StartForm());
Application.Run(new Test());
} }
else else
{ {
......
...@@ -42,6 +42,9 @@ ...@@ -42,6 +42,9 @@
this.sysimages = new System.Windows.Forms.ImageList(this.components); this.sysimages = new System.Windows.Forms.ImageList(this.components);
this.button2 = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button();
this.pictureMenu1 = new GcDevicePc.Controls.PictureMenu(); this.pictureMenu1 = new GcDevicePc.Controls.PictureMenu();
this.filetest = new System.Windows.Forms.GroupBox();
this.file_test = new System.Windows.Forms.Button();
this.filetest.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// textBox1 // textBox1
...@@ -78,7 +81,7 @@ ...@@ -78,7 +81,7 @@
// //
// button1 // button1
// //
this.button1.Location = new System.Drawing.Point(304, 139); this.button1.Location = new System.Drawing.Point(304, 124);
this.button1.Name = "button1"; this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23); this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 4; this.button1.TabIndex = 4;
...@@ -151,7 +154,7 @@ ...@@ -151,7 +154,7 @@
// //
// button2 // button2
// //
this.button2.Location = new System.Drawing.Point(142, 299); this.button2.Location = new System.Drawing.Point(304, 183);
this.button2.Name = "button2"; this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 23); this.button2.Size = new System.Drawing.Size(75, 23);
this.button2.TabIndex = 8; this.button2.TabIndex = 8;
...@@ -182,11 +185,32 @@ ...@@ -182,11 +185,32 @@
this.pictureMenu1.PMOptBtnClicked += new GcDevicePc.Controls.PictureMenu.OptBthClickHandle(this.pictureMenu1_PMOptBtnClicked); this.pictureMenu1.PMOptBtnClicked += new GcDevicePc.Controls.PictureMenu.OptBthClickHandle(this.pictureMenu1_PMOptBtnClicked);
this.pictureMenu1.PMSysBtnClicked += new GcDevicePc.Controls.PictureMenu.SysBthClickHandle(this.pictureMenu1_PMSysBtnClicked); this.pictureMenu1.PMSysBtnClicked += new GcDevicePc.Controls.PictureMenu.SysBthClickHandle(this.pictureMenu1_PMSysBtnClicked);
// //
// filetest
//
this.filetest.Controls.Add(this.file_test);
this.filetest.Location = new System.Drawing.Point(440, 106);
this.filetest.Name = "filetest";
this.filetest.Size = new System.Drawing.Size(200, 100);
this.filetest.TabIndex = 10;
this.filetest.TabStop = false;
this.filetest.Text = "文件传输测试";
//
// file_test
//
this.file_test.Location = new System.Drawing.Point(59, 42);
this.file_test.Name = "file_test";
this.file_test.Size = new System.Drawing.Size(75, 23);
this.file_test.TabIndex = 0;
this.file_test.Text = "开始";
this.file_test.UseVisualStyleBackColor = true;
this.file_test.Click += new System.EventHandler(this.file_test_Click);
//
// Test // Test
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1008, 497); this.ClientSize = new System.Drawing.Size(1008, 497);
this.Controls.Add(this.filetest);
this.Controls.Add(this.pictureMenu1); this.Controls.Add(this.pictureMenu1);
this.Controls.Add(this.button2); this.Controls.Add(this.button2);
this.Controls.Add(this.textBox3); this.Controls.Add(this.textBox3);
...@@ -200,6 +224,7 @@ ...@@ -200,6 +224,7 @@
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "Test"; this.Name = "Test";
this.Text = "文件获取"; this.Text = "文件获取";
this.filetest.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
...@@ -219,5 +244,7 @@ ...@@ -219,5 +244,7 @@
private System.Windows.Forms.ImageList sysimages; private System.Windows.Forms.ImageList sysimages;
private System.Windows.Forms.Button button2; private System.Windows.Forms.Button button2;
private Controls.PictureMenu pictureMenu1; private Controls.PictureMenu pictureMenu1;
private System.Windows.Forms.GroupBox filetest;
private System.Windows.Forms.Button file_test;
} }
} }
\ No newline at end of file
...@@ -5,6 +5,7 @@ using System.Data; ...@@ -5,6 +5,7 @@ using System.Data;
using System.Drawing; using System.Drawing;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading;
using System.Windows.Forms; using System.Windows.Forms;
using WeifenLuo.WinFormsUI.Docking; using WeifenLuo.WinFormsUI.Docking;
using GcDevicePc.Controls; using GcDevicePc.Controls;
...@@ -95,5 +96,67 @@ namespace GcDevicePc ...@@ -95,5 +96,67 @@ namespace GcDevicePc
} }
} }
public void file_test_Click(object sender, EventArgs e)
{
int ret;
string remoteFolder1 = "\\Hard Disk2\\仪器方法\\";
// string remoteFolder2 = "\\Hard Disk2\\仪器状态\\";
// string remoteFolder3 = "\\Hard Disk2\\运行表\\";
List<String> filename = new List<string>();
filename.Add("2016方法1.ini");
filename.Add("AAA.ini");
filename.Add("FID.ini");
filename.Add("NMHC.ini");
filename.Add("开机.ini");
// string devfile = "DevStatus.ini";
// string runfile = "RunMethod.ini";
string localfile = System.Windows.Forms.Application.StartupPath + "\\Debugfile\\";
try
{
if (globaldata.connection_ip != null && globaldata.connection_ip != "")
{
int i = 0;
int count = 100;
FileServerClient mainclient = new FileServerClient();
while (count -- > 0)
{
for (i = 0; i < filename.Count; i++)
{
if (System.IO.File.Exists(localfile + filename[i]))
{
System.IO.File.Delete(localfile + filename[i]);
}
mainclient.WtClientInit(globaldata.connection_ip, globaldata.fileserverport);
ret = mainclient.WtClientCopytoServer(filename[i], localfile + filename[i], remoteFolder1);
Thread.Sleep(1000);
if (System.IO.File.Exists(localfile + filename[i]))
{
Console.WriteLine(filename[i] + " 获取成功1111111111111");
}
}
}
mainclient.WtClientClose();
}
}
catch (Exception ex)
{
Console.WriteLine("Error:" + ex.Message);
}
}
} }
} }
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment