|
@@ -4851,7 +4851,7 @@ namespace XHWK.WKTool
|
4851
|
4851
|
|
4852
|
4852
|
bool AreSynchronized = false;
|
4853
|
4853
|
/// <summary>
|
4854
|
|
- /// 笔模式
|
|
4854
|
+ /// 是否为笔模式
|
4855
|
4855
|
/// </summary>
|
4856
|
4856
|
bool IsPen = false;
|
4857
|
4857
|
#endregion
|
|
@@ -4863,15 +4863,27 @@ namespace XHWK.WKTool
|
4863
|
4863
|
/// </summary>
|
4864
|
4864
|
private void deviceHand()
|
4865
|
4865
|
{
|
|
4866
|
+ if (APP.IsOutputInfoLog)
|
|
4867
|
+ {
|
|
4868
|
+ LogHelper.WriteInfoLog(string.Format("切换笔模式:设备类型:{0}", deviceType.ToString()));
|
|
4869
|
+ }
|
4866
|
4870
|
if (deviceType == eDeviceType.T8B_D2 || deviceType == eDeviceType.T8Y || deviceType == eDeviceType.T8S_LQ)
|
4867
|
4871
|
{
|
4868
|
4872
|
robotpenController.GetInstance().setDeviceMode(eDeviceMode.DEVICE_HAND);
|
|
4873
|
+ if (APP.IsOutputInfoLog)
|
|
4874
|
+ {
|
|
4875
|
+ LogHelper.WriteInfoLog("使用robotpenController.GetInstance().setDeviceMode(eDeviceMode.DEVICE_HAND)切换");
|
|
4876
|
+ }
|
4869
|
4877
|
}
|
4870
|
4878
|
else
|
4871
|
4879
|
{
|
4872
|
4880
|
IsPen = true;
|
4873
|
4881
|
//获取当前设备模式,根据模式切换鼠标和笔
|
4874
|
4882
|
robotpenController.GetInstance()._Send(cmdId.SearchMode);
|
|
4883
|
+ if (APP.IsOutputInfoLog)
|
|
4884
|
+ {
|
|
4885
|
+ LogHelper.WriteInfoLog("发送(cmdId.SearchMode)");
|
|
4886
|
+ }
|
4875
|
4887
|
}
|
4876
|
4888
|
}
|
4877
|
4889
|
/// <summary>
|
|
@@ -4882,31 +4894,56 @@ namespace XHWK.WKTool
|
4882
|
4894
|
if (deviceType == eDeviceType.T8B_D2 || deviceType == eDeviceType.T8Y || deviceType == eDeviceType.T8S_LQ)
|
4883
|
4895
|
{
|
4884
|
4896
|
robotpenController.GetInstance().setDeviceMode(eDeviceMode.DEVICE_MOUSE);
|
|
4897
|
+ if (APP.IsOutputInfoLog)
|
|
4898
|
+ {
|
|
4899
|
+ LogHelper.WriteInfoLog("使用robotpenController.GetInstance().setDeviceMode(eDeviceMode.DEVICE_MOUSE)切换");
|
|
4900
|
+ }
|
4885
|
4901
|
}
|
4886
|
4902
|
else
|
4887
|
4903
|
{
|
4888
|
4904
|
IsPen = false;
|
4889
|
4905
|
//获取当前设备模式,根据模式切换鼠标和笔
|
4890
|
4906
|
robotpenController.GetInstance()._Send(cmdId.SearchMode);
|
|
4907
|
+ if (APP.IsOutputInfoLog)
|
|
4908
|
+ {
|
|
4909
|
+ LogHelper.WriteInfoLog("发送(cmdId.SearchMode)");
|
|
4910
|
+ }
|
4891
|
4911
|
}
|
4892
|
4912
|
}
|
4893
|
4913
|
|
4894
|
4914
|
private void Form1_searchModeEvt(int modeType)
|
4895
|
4915
|
{
|
|
4916
|
+ //笔模式
|
4896
|
4917
|
if (modeType == 1)
|
4897
|
4918
|
{
|
|
4919
|
+ if (APP.IsOutputInfoLog)
|
|
4920
|
+ {
|
|
4921
|
+ LogHelper.WriteInfoLog("当前为笔模式时,切换回鼠标模式");
|
|
4922
|
+ }
|
4898
|
4923
|
//当前为笔模式时 切换回鼠标模式
|
4899
|
|
- if(!IsPen)
|
|
4924
|
+ if (!IsPen)
|
4900
|
4925
|
{
|
4901
|
4926
|
robotpenController.GetInstance()._Send(cmdId.SwitchMode);
|
|
4927
|
+ if (APP.IsOutputInfoLog)
|
|
4928
|
+ {
|
|
4929
|
+ LogHelper.WriteInfoLog("T7设备切换成鼠标模式._Send(cmdId.SwitchMode)");
|
|
4930
|
+ }
|
4902
|
4931
|
}
|
4903
|
4932
|
}
|
4904
|
4933
|
else
|
4905
|
4934
|
{
|
|
4935
|
+ if (APP.IsOutputInfoLog)
|
|
4936
|
+ {
|
|
4937
|
+ LogHelper.WriteInfoLog("当前为鼠标模式 切换为笔模式");
|
|
4938
|
+ }
|
4906
|
4939
|
//当前为鼠标模式 切换为笔模式
|
4907
|
|
- if(isOpen)
|
|
4940
|
+ if (isOpen)
|
4908
|
4941
|
{
|
4909
|
4942
|
robotpenController.GetInstance()._Send(cmdId.SwitchMode);
|
|
4943
|
+ if (APP.IsOutputInfoLog)
|
|
4944
|
+ {
|
|
4945
|
+ LogHelper.WriteInfoLog("T7设备切换成笔模式._Send(cmdId.SwitchMode)");
|
|
4946
|
+ }
|
4910
|
4947
|
}
|
4911
|
4948
|
}
|
4912
|
4949
|
}
|
|
@@ -4915,18 +4952,34 @@ namespace XHWK.WKTool
|
4915
|
4952
|
{
|
4916
|
4953
|
if (modeType == 1)
|
4917
|
4954
|
{
|
|
4955
|
+ if (APP.IsOutputInfoLog)
|
|
4956
|
+ {
|
|
4957
|
+ LogHelper.WriteInfoLog("已切换成笔模式");
|
|
4958
|
+ }
|
4918
|
4959
|
//当前为笔模式时 切换回鼠标模式
|
4919
|
4960
|
if (!IsPen)
|
4920
|
4961
|
{
|
4921
|
4962
|
robotpenController.GetInstance()._Send(cmdId.SwitchMode);
|
|
4963
|
+ if (APP.IsOutputInfoLog)
|
|
4964
|
+ {
|
|
4965
|
+ LogHelper.WriteInfoLog("T7设备切换成鼠标模式._Send(cmdId.SwitchMode)");
|
|
4966
|
+ }
|
4922
|
4967
|
}
|
4923
|
4968
|
}
|
4924
|
4969
|
else
|
4925
|
4970
|
{
|
|
4971
|
+ if (APP.IsOutputInfoLog)
|
|
4972
|
+ {
|
|
4973
|
+ LogHelper.WriteInfoLog("已切换成鼠标模式");
|
|
4974
|
+ }
|
4926
|
4975
|
//当前为鼠标模式 切换为笔模式
|
4927
|
4976
|
if (isOpen)
|
4928
|
4977
|
{
|
4929
|
4978
|
robotpenController.GetInstance()._Send(cmdId.SwitchMode);
|
|
4979
|
+ if (APP.IsOutputInfoLog)
|
|
4980
|
+ {
|
|
4981
|
+ LogHelper.WriteInfoLog("T7设备切换成笔模式._Send(cmdId.SwitchMode)");
|
|
4982
|
+ }
|
4930
|
4983
|
}
|
4931
|
4984
|
}
|
4932
|
4985
|
}
|
|
@@ -4935,7 +4988,6 @@ namespace XHWK.WKTool
|
4935
|
4988
|
{
|
4936
|
4989
|
try
|
4937
|
4990
|
{
|
4938
|
|
-
|
4939
|
4991
|
robotpenController.GetInstance()._ConnectInitialize(eDeviceType.Gateway, IntPtr.Zero);
|
4940
|
4992
|
robotpenController.GetInstance().deviceChangeEvt += new robotpenController.DeviceChange(Form1_deviceChangeEvt);
|
4941
|
4993
|
robotpenController.GetInstance().searchModeEvt += Form1_searchModeEvt;
|
|
@@ -4965,7 +5017,7 @@ namespace XHWK.WKTool
|
4965
|
5017
|
}
|
4966
|
5018
|
catch (Exception ex)
|
4967
|
5019
|
{
|
4968
|
|
-
|
|
5020
|
+ LogHelper.WriteErrLog("设备初始化失败:" + ex.Message, ex);
|
4969
|
5021
|
}
|
4970
|
5022
|
}
|
4971
|
5023
|
/// <summary>
|
|
@@ -4989,11 +5041,19 @@ namespace XHWK.WKTool
|
4989
|
5041
|
{
|
4990
|
5042
|
//throw new NotImplementedException();
|
4991
|
5043
|
//Console.WriteLine();
|
4992
|
|
- if (APP.IsOutputInfoLog)
|
|
5044
|
+ try
|
4993
|
5045
|
{
|
4994
|
|
- LogHelper.WriteInfoLog(string.Format("设备状态{0} PID = {1}", bStatus, uPid));
|
|
5046
|
+ if (APP.IsOutputInfoLog)
|
|
5047
|
+ {
|
|
5048
|
+ LogHelper.WriteInfoLog(string.Format("设备状态{0} PID = {1}", bStatus, uPid));
|
|
5049
|
+ }
|
|
5050
|
+ }
|
|
5051
|
+ catch (Exception)
|
|
5052
|
+ {
|
|
5053
|
+
|
4995
|
5054
|
}
|
4996
|
|
- SetListView();
|
|
5055
|
+ //SetListView();
|
|
5056
|
+ CheckUsbConnect();
|
4997
|
5057
|
}
|
4998
|
5058
|
|
4999
|
5059
|
/// <summary>
|
|
@@ -5104,6 +5164,10 @@ namespace XHWK.WKTool
|
5104
|
5164
|
usbIsConnected = false;
|
5105
|
5165
|
Thread.Sleep(200);
|
5106
|
5166
|
int nDeviceCount = robotpenController.GetInstance()._GetDeviceCount();
|
|
5167
|
+ if (APP.IsOutputInfoLog)
|
|
5168
|
+ {
|
|
5169
|
+ LogHelper.WriteInfoLog(string.Format("当前有 {0} 个设备", nDeviceCount));
|
|
5170
|
+ }
|
5107
|
5171
|
if (nDeviceCount > 0)
|
5108
|
5172
|
{
|
5109
|
5173
|
//this.listView1.BeginUpdate();
|
|
@@ -5133,6 +5197,10 @@ namespace XHWK.WKTool
|
5133
|
5197
|
|
5134
|
5198
|
APP.BoardStatus = true;
|
5135
|
5199
|
UpdateDevStatus();
|
|
5200
|
+ if (APP.IsOutputInfoLog)
|
|
5201
|
+ {
|
|
5202
|
+ LogHelper.WriteInfoLog(string.Format("设备类型:{0}", deviceType.ToString()));
|
|
5203
|
+ }
|
5136
|
5204
|
//Dispatcher.Invoke(new Action(() =>
|
5137
|
5205
|
//{
|
5138
|
5206
|
// txbNotConnected.Text = "手写板";
|