Commit c280d311 authored by wangjunqiang's avatar wangjunqiang

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

parent d269da47
......@@ -5,6 +5,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using GcDevicePc.Common;
using GcDevicePc.GCBuffer;
namespace GcDevicePc
{
......@@ -308,26 +309,23 @@ namespace GcDevicePc
// }
//}
//public void InitAllGCConfig()
//{
// int devicecount = 0;
// devicecount = globaldata.DeviceList.Count;
// int i = 0;
// string tmpfile = "";
// if (devicecount > 0)
// {
// globaldata.GCHWConfigs.Clear();
// for (i = 0; i < devicecount; i++)
// {
// tmpfile = globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.StatusFolder + "\\" + globaldata.DeviceName[i].ToString() + "\\DevStatus.ini";
// HWConfig m_hwconfig = new HWConfig(tmpfile);
// m_hwconfig.GetHWConfig();
// globaldata.GCHWConfigs.Add(m_hwconfig);
// }
// }
public void InitGCHWConfig()
{
int devicecount = 0;
devicecount = globaldata.DeviceList.Count;
int i = 0;
string tmpfile = "";
if (devicecount > 0)
{
for (i = 0; i < devicecount; i++)
{
tmpfile = globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.StatusFolder + "\\DevStatus.ini";
HWConfig m_hwconfig = new HWConfig(tmpfile);
m_hwconfig.GetHWConfig();
}
}
//}
}
/// <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
private IniFile RunTableFile;
private IniFile AsRunTableFile;
public Int32 TotalNum = 0;
public List<String> _methodname = new List<String>();
public List<Int32> _runcount = new List<Int32>();
public List<Int32> _runtime = new List<Int32>();
......@@ -64,12 +65,12 @@ namespace GcDevicePc.Common
public void LoadRunTable()
{
RunTableFile = new IniFile(_filename);
int num = 0;
//int num = 0;
int i = 0;
if (RunTableFile.KeyExists("Total", "count"))
{
num = RunTableFile.ReadInteger("Total", "count");
for (i = 0; i < num ; i++)
this.TotalNum = RunTableFile.ReadInteger("Total", "count");
for (i = 0; i < TotalNum; i++)
{
_methodname.Add(RunTableFile.ReadString("运行表",i.ToString()));
_runcount.Add(RunTableFile.ReadInteger("循环", i.ToString()));
......@@ -108,6 +109,8 @@ namespace GcDevicePc.Common
_methodname.Add(name);
_runcount.Add(count);
_runtime.Add(time);
TotalNum++;
}
public void ModifyItem(Int32 index, String name, Int32 count, Int32 time)
......@@ -131,13 +134,14 @@ namespace GcDevicePc.Common
_methodname.RemoveAt(indexno);
_runcount.RemoveAt(indexno);
_runtime.RemoveAt(indexno);
TotalNum--;
return true;
}
}
return false;
}
private bool saveini(IniFile saveini)
private bool SaveIni(IniFile saveini)
{
int i;
int count = _methodname.Count & _runcount.Count & _runtime.Count;
......@@ -156,14 +160,23 @@ namespace GcDevicePc.Common
saveini.WriteInteger("运行时间", i.ToString(), _runtime[i]);
}
if (TotalNum == count)
{
saveini.WriteInteger("Total", "count", count);
}
else
{
Log.Info("Run Table File Bug");
}
return true;
}
public bool SaveRunTable()
{
return saveini(RunTableFile);
return SaveIni(RunTableFile);
}
......@@ -189,7 +202,7 @@ namespace GcDevicePc.Common
AsRunTableFile = new IniFile(_asfilename);
return saveini(AsRunTableFile);
return SaveIni(AsRunTableFile);
}
......
......@@ -14,7 +14,7 @@ using GcDevicePc.IniParam;
namespace GcDevicePc.ConfigDlg
{
public delegate void ChangeMNameForUp(string name);
// public delegate void ChangeMNameForUp(string name);
public delegate void SendUpdateCMD(bool flag);
public partial class MethodBase : Form
{
......@@ -310,7 +310,7 @@ namespace GcDevicePc.ConfigDlg
//}
}
public event ChangeMNameForUp changenameforup;
// public event ChangeMNameForUp changenameforup;
public event SendUpdateCMD sendupdatecmd;
private void updatebtn_Click(object sender, EventArgs e)
{
......
......@@ -63,8 +63,8 @@ namespace GcDevicePc
}
double fDetvalueold = 0;
double iDetvalueold = 0;
double bDetvalueold = 0;
// double iDetvalueold = 0;
// double bDetvalueold = 0;
ListViewItem tempshow;
private void dataupdate_Tick(object sender, EventArgs e)
{
......
......@@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
namespace GcDevicePc
......@@ -11,22 +10,25 @@ namespace GcDevicePc
{
[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")]
private static extern uint fnWtFileSeverInit(ushort wTcpPort);
public static extern void fnWtClientClose(uint handle);
[DllImport(@"WtFileSender.dll", EntryPoint = "fnWtFileClose")]
[DllImport(@"WtFileSender.dll", EntryPoint = "fnWtClientClose")]
private static extern void fnWtClientClose(uint handle);
public static extern uint fnWtFileSeverInit(ushort wTcpPort);
[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")]
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")]
public static extern int fnWtCloseCEPro(uint handle, byte[] lpszFileName);
private static extern int fnWtCloseCEPro(uint handle, byte[] lpszFileName);
[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;
......@@ -39,7 +41,7 @@ namespace GcDevicePc
}
catch
{
Console.WriteLine("fnWtClientClose Error");
}
}
......@@ -53,7 +55,7 @@ namespace GcDevicePc
}
catch
{
Console.WriteLine("WtClientInit Error");
}
}
......
......@@ -113,10 +113,123 @@ namespace GcDevicePc.GCBuffer
public ShowInfo ShowList = new ShowInfo();
public DPBuffer()
public void DPInit()
{
ShowList.showtime.runtimenow = 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()
......
This diff is collapsed.
......@@ -171,7 +171,7 @@ namespace GcDevicePc.GCBuffer
public string sASSolventB; //进样后溶剂B
public ushort u16PushPullTimes; //推拉针芯次数
//其他参数
UNION_TEMP fCurTemp; //进样室当前温度
// UNION_TEMP fCurTemp; //进样室当前温度
public float fSetTemp; //进样室设定温度
}
......
......@@ -68,6 +68,8 @@ namespace GcDevicePc.GCBuffer
gcpcinfo.pcfolderinfo.LogFolder = null;
gcpcinfo.pcfileinfo.cur_MethodName = null;
gcpcinfo.pcfileinfo.cur_BATMethodName = null;
gcpcinfo.pcfileinfo.new_MethodName = null;
gcpcinfo.pcfileinfo.cur_OpenMethodName = null;
gcpcinfo.pcfileinfo.cur_StatusName = null;
gcpcinfo.pcfileinfo.cur_RunTab = null;
......
......@@ -187,6 +187,7 @@
<Compile Include="CK_UI\WaveTotalForm.Designer.cs">
<DependentUpon>WaveTotalForm.cs</DependentUpon>
</Compile>
<Compile Include="Common\FileTransfer.cs" />
<Compile Include="Common\GCModbus.cs" />
<Compile Include="Common\GCModbusSlave.cs" />
<Compile Include="Common\FileHelper.cs" />
......@@ -332,7 +333,6 @@
<Compile Include="GCBuffer\HWConfig.cs" />
<Compile Include="GCBuffer\MethodConfig.cs" />
<Compile Include="GCBuffer\PCBuffer.cs" />
<Compile Include="GCBuffer\RingBufferManager.cs" />
<Compile Include="GCBuffer\SignalBuffer.cs" />
<Compile Include="GCMain.cs">
<SubType>Form</SubType>
......
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using GcDevicePc.ProThread;
using GcDevicePc.Common;
using GcDevicePc.IniParam;
using System.Threading;
using System.IO;
using GcDevicePc.CK_UI;
using GcDevicePc.Common;
namespace GcDevicePc
{
......@@ -1538,8 +1530,8 @@ namespace GcDevicePc
globaldata.m_configDlg.m_AuxDlg.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.Show();
......@@ -1572,8 +1564,8 @@ namespace GcDevicePc
globaldata.m_configDlg.m_AuxDlg.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);
......@@ -1610,8 +1602,8 @@ namespace GcDevicePc
globaldata.m_configDlg.m_AuxDlg.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.Show();
......
......@@ -1918,8 +1918,8 @@ namespace GcDevicePc
globaldata.m_configDlg.m_AuxDlg.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.Show();
......@@ -2021,8 +2021,8 @@ namespace GcDevicePc
globaldata.m_configDlg.m_AuxDlg.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);
......@@ -2059,8 +2059,8 @@ namespace GcDevicePc
globaldata.m_configDlg.m_AuxDlg.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.Show();
......
......@@ -21,8 +21,8 @@ namespace GcDevicePc.ProThread
static bool dataflag = false;
static bool recvend = false;
static bool threadrestart = false;
static bool lastthreadend = false;
// static bool threadrestart = false;
// static bool lastthreadend = false;
private static void DataRcv_Work()
{
......@@ -144,7 +144,7 @@ namespace GcDevicePc.ProThread
else
{
Console.WriteLine("老线程退出!");
lastthreadend = true;
// lastthreadend = true;
}
}
......@@ -157,7 +157,7 @@ namespace GcDevicePc.ProThread
catch (Exception ex)
{
Console.WriteLine(ex.Message);
threadrestart = true;
// threadrestart = true;
var socket = ar.AsyncState as Socket;
socket.Shutdown(SocketShutdown.Both);
socket.Close();
......
......@@ -154,7 +154,8 @@ namespace GcDevicePc
{
if (createNew)
{
Application.Run(new StartForm());
// Application.Run(new StartForm());
Application.Run(new Test());
}
else
{
......
......@@ -42,6 +42,9 @@
this.sysimages = new System.Windows.Forms.ImageList(this.components);
this.button2 = new System.Windows.Forms.Button();
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();
//
// textBox1
......@@ -78,7 +81,7 @@
//
// 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.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 4;
......@@ -151,7 +154,7 @@
//
// 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.Size = new System.Drawing.Size(75, 23);
this.button2.TabIndex = 8;
......@@ -182,11 +185,32 @@
this.pictureMenu1.PMOptBtnClicked += new GcDevicePc.Controls.PictureMenu.OptBthClickHandle(this.pictureMenu1_PMOptBtnClicked);
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
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1008, 497);
this.Controls.Add(this.filetest);
this.Controls.Add(this.pictureMenu1);
this.Controls.Add(this.button2);
this.Controls.Add(this.textBox3);
......@@ -200,6 +224,7 @@
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "Test";
this.Text = "文件获取";
this.filetest.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
......@@ -219,5 +244,7 @@
private System.Windows.Forms.ImageList sysimages;
private System.Windows.Forms.Button button2;
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;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using WeifenLuo.WinFormsUI.Docking;
using GcDevicePc.Controls;
......@@ -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