Browse Source

zhao:1修改智能笔,增加写字板

tags/录制修改前
耀 3 years ago
parent
commit
759c6eb41c

BIN
Common/dlls/RbtBezier.dll View File


BIN
Common/dlls/RobotDotMatrix.dll View File


BIN
Common/dlls/RobotUsbWrapper.dll View File


BIN
Common/dlls/RobotpenGateway.dll View File


+ 5
- 2
Common/system/BlackboardNew.cs View File

@@ -359,7 +359,7 @@ namespace Common.system
359 359
         private StylusPoint stylusPoint = new StylusPoint();
360 360
         private Stroke stroke;
361 361
         private bool isFirst = true;
362
-        public void changepages(double _x, double _y, bool _new, Color _color, int _size, int i)
362
+        public void changepages(double _x, double _y, bool _new, Color _color, int _size, int i, float Pressure)
363 363
         {
364 364
             if (_new)
365 365
             {
@@ -400,6 +400,8 @@ namespace Common.system
400 400
                 {
401 401
                     stylusPoint.X = _x;
402 402
                     stylusPoint.Y = _y;
403
+                    //_color.A = (byte)(Pressure * 255f);
404
+                    //stylusPoint.PressureFactor = Pressure;
403 405
                     stylusPoints.Add(stylusPoint);
404 406
                     if (stylusPoints.Count > 1)
405 407
                     {
@@ -410,7 +412,8 @@ namespace Common.system
410 412
                             Width = _size * 4.5,
411 413
                             Height = _size * 4.5,
412 414
                             FitToCurve = true,
413
-                            IgnorePressure = false
415
+                            //IsHighlighter =true,
416
+                            IgnorePressure = true
414 417
                         };
415 418
                         stroke.DrawingAttributes = drawingAttributes;
416 419
                         m_canvas.Strokes.Add(stroke);

+ 5
- 0
Common/system/FFMpeg.cs View File

@@ -22,6 +22,7 @@ namespace Common.system
22 22
     /// </summary>
23 23
     public class FFMpeg
24 24
     {
25
+        #region 变量
25 26
         public Process myProcess = null;
26 27
 
27 28
         /// <summary>
@@ -42,6 +43,8 @@ namespace Common.system
42 43
         /// 是否可以录制麦克风
43 44
         /// </summary>
44 45
         private bool IsRecordMicrophone = true;
46
+        #endregion
47
+
45 48
         /// <summary>
46 49
         /// 录制屏幕
47 50
         /// </summary>
@@ -848,6 +851,8 @@ namespace Common.system
848 851
                 FileToolsCommon.AppendText(LogPath, output.Data + "\r\n");
849 852
             }
850 853
         }
854
+
855
+
851 856
         #region 麦克风声卡检测
852 857
         #region 获取麦克风
853 858
         private bool IsMicrophone = false;

+ 5
- 0
XHWK.WKTool/App.config View File

@@ -6,7 +6,10 @@
6 6
   <appSettings>
7 7
     <!--0正式 1测试-->
8 8
     <add key="IsDebug" value="1" />
9
+    <!--是否输出视频记录日志:0否-->
9 10
     <add key="OutputVideoLog" value="0"/>
11
+    <!--是否输出其他测试日志-->
12
+    <add key="IsOutputInfoLog" value="0"/>
10 13
     <!--文件存放路径  路径\账户名\讲解名称_x.MP4-->
11 14
     <add key="VideoSavePath" value="D:\星火微课" />
12 15
     <!--视频格式 1、MP4 2、FlV 3、AVI-->
@@ -31,6 +34,8 @@
31 34
     <add key="CameraPosition" value="1" />
32 35
     <!--上传每片大小 Mb-->
33 36
     <add key="UploadSliceLen" value="1" />
37
+    <!--是否隐藏录屏工具栏 1 隐藏 0不隐藏-->
38
+    <add key="IsHideSRTool" value="1" />
34 39
     <!--版本号-->
35 40
     <add key="VersionCode" value="54" />
36 41
     <add key="VersionName" value="2.5.4" />

+ 12
- 0
XHWK.WKTool/App.cs View File

@@ -27,6 +27,14 @@ namespace XHWK.WKTool
27 27
         /// </summary>
28 28
         public static bool isDebug = FileToolsCommon.GetConfigValue("IsDebug") != "0";
29 29
         /// <summary>
30
+        /// 是否输出测试记录日志
31
+        /// </summary>
32
+        public static bool IsOutputInfoLog = FileToolsCommon.GetConfigValue("IsOutputInfoLog") != "0";
33
+        /// <summary>
34
+        /// 是否隐藏录屏工具栏
35
+        /// </summary>
36
+        public static bool IsHideSRTool= FileToolsCommon.GetConfigValue("IsHideSRTool") != "0";
37
+        /// <summary>
30 38
         /// 接口地址
31 39
         /// </summary>
32 40
         public static string apiUrl = isDebug ? "http://schoolapitest.xhkjedu.com" : FileToolsCommon.GetConfigValue("APIRequestAddress");
@@ -139,6 +147,10 @@ namespace XHWK.WKTool
139 147
         /// 笔状态,是否已连接
140 148
         /// </summary>
141 149
         public static bool PenStatus;
150
+        /// <summary>
151
+        /// 手写板状态,是否已连接
152
+        /// </summary>
153
+        public static bool BoardStatus;
142 154
         #endregion
143 155
         #region 页面
144 156
         /// <summary>

+ 1
- 1
XHWK.WKTool/LoginWindow.xaml.cs View File

@@ -224,7 +224,7 @@ namespace XHWK.WKTool
224 224
                 }
225 225
 
226 226
             }
227
-            catch (Exception ex)
227
+            catch (Exception)
228 228
             {
229 229
             }
230 230
         }

+ 3
- 3
XHWK.WKTool/Properties/AssemblyInfo.cs View File

@@ -5,11 +5,11 @@ using System.Windows;
5 5
 // 有关程序集的一般信息由以下
6 6
 // 控制。更改这些特性值可修改
7 7
 // 与程序集关联的信息。
8
-[assembly: AssemblyTitle("XHWK.WKTool")]
8
+[assembly: AssemblyTitle("星火微课")]
9 9
 [assembly: AssemblyDescription("")]
10 10
 [assembly: AssemblyConfiguration("")]
11
-[assembly: AssemblyCompany("")]
12
-[assembly: AssemblyProduct("XHWK.WKTool")]
11
+[assembly: AssemblyCompany("河南星火燎原软件科技有限公司")]
12
+[assembly: AssemblyProduct("星火微课")]
13 13
 [assembly: AssemblyCopyright("Copyright ©  2020")]
14 14
 [assembly: AssemblyTrademark("")]
15 15
 [assembly: AssemblyCulture("")]

+ 40
- 27
XHWK.WKTool/ScreenRecordingToolbarWindow.xaml.cs View File

@@ -425,15 +425,19 @@ namespace XHWK.WKTool
425 425
                                                         //borOne.Background = new SolidColorBrush(Colors.LightBlue);
426 426
                 BtnRecordingScreen.ToolTip = "暂停";
427 427
 
428
-                if (APP.W_MinToolbar == null)
428
+                #region 隐藏工具栏
429
+                if (APP.IsHideSRTool)
429 430
                 {
430
-                    APP.W_MinToolbar = new MinToolbar();
431
-
431
+                    if (APP.W_MinToolbar == null)
432
+                    {
433
+                        APP.W_MinToolbar = new MinToolbar();
434
+                    }
435
+                    APP.W_MinToolbar.Topmost = true;
436
+                    APP.W_MinToolbar.Initialize(this.Top);
437
+                    gridToobar.Visibility = Visibility.Hidden;
438
+                    APP.W_MinToolbar.Show();
432 439
                 }
433
-                APP.W_MinToolbar.Topmost = true;
434
-                APP.W_MinToolbar.Initialize(this.Top);
435
-                gridToobar.Visibility = Visibility.Hidden;
436
-                APP.W_MinToolbar.Show();
440
+                #endregion
437 441
                 try
438 442
                 {
439 443
                     #region 4秒内不可点击
@@ -566,7 +570,10 @@ namespace XHWK.WKTool
566 570
                 }))).Start();
567 571
             }
568 572
             #endregion
569
-            APP.W_MinToolbar.Hide();
573
+            if (APP.W_MinToolbar != null)
574
+            {
575
+                APP.W_MinToolbar.Hide();
576
+            }
570 577
             BtnRecordingScreen.ToolTip = "开始";
571 578
             k_hook.Stop();
572 579
             IsSuspend = true;
@@ -1156,7 +1163,10 @@ namespace XHWK.WKTool
1156 1163
                 }
1157 1164
                 k_hook.Stop();
1158 1165
                 BtnRecordingScreen.ToolTip = "开始";
1159
-                APP.W_MinToolbar.Hide();
1166
+                if (APP.W_MinToolbar != null)
1167
+                {
1168
+                    APP.W_MinToolbar.Hide();
1169
+                }
1160 1170
                 IsSuspend = true;
1161 1171
                 txbTime.Text = "00:00";
1162 1172
 
@@ -1270,27 +1280,30 @@ namespace XHWK.WKTool
1270 1280
         {
1271 1281
             if(BtnRecordingScreen.ToolTip.ToString().Equals ("暂停")&& gridToobar.Visibility == Visibility.Visible)
1272 1282
             {
1273
-                if (APP.W_MinToolbar == null)
1283
+                if (APP.IsHideSRTool)
1274 1284
                 {
1275
-                    APP.W_MinToolbar = new MinToolbar();
1285
+                    if (APP.W_MinToolbar == null)
1286
+                    {
1287
+                        APP.W_MinToolbar = new MinToolbar();
1276 1288
 
1277
-                }
1278
-                APP.W_MinToolbar.Topmost = true;
1279
-                APP.W_MinToolbar.Initialize(this.Top);
1280
-                //else
1281
-                //{
1282
-                //    APP.W_CountdownWindow.Initialize(true, 1800);
1283
-                //}
1284
-                new Thread(new ThreadStart(new Action(() =>
1285
-                {
1286
-                    Thread.Sleep(500);
1287
-                    Dispatcher.Invoke(() =>
1289
+                    }
1290
+                    APP.W_MinToolbar.Topmost = true;
1291
+                    APP.W_MinToolbar.Initialize(this.Top);
1292
+                    //else
1293
+                    //{
1294
+                    //    APP.W_CountdownWindow.Initialize(true, 1800);
1295
+                    //}
1296
+                    new Thread(new ThreadStart(new Action(() =>
1288 1297
                     {
1289
-                        gridToobar.Visibility = Visibility.Hidden;
1290
-                        APP.W_MinToolbar.Show();
1291
-                    });
1292
-                }))).Start();
1293
-                //Console.WriteLine(this.Top+"max");
1298
+                        Thread.Sleep(500);
1299
+                        Dispatcher.Invoke(() =>
1300
+                        {
1301
+                            gridToobar.Visibility = Visibility.Hidden;
1302
+                            APP.W_MinToolbar.Show();
1303
+                        });
1304
+                    }))).Start();
1305
+                    //Console.WriteLine(this.Top+"max");
1306
+                }
1294 1307
             }
1295 1308
         }
1296 1309
     }

+ 2
- 2
XHWK.WKTool/XHMicroLessonSystemWindow.xaml View File

@@ -384,7 +384,7 @@
384 384
                         <ColumnDefinition Width="*"/>
385 385
                     </Grid.ColumnDefinitions>
386 386
 
387
-                    <TextBlock Grid.Row="0" Grid.Column="0" Text="智能笔" FontSize="16" Foreground="#333333" HorizontalAlignment="Right" Margin="0,30,0,0"/>
387
+                    <TextBlock Grid.Row="0" Grid.Column="0" Text="设备" FontSize="16" Foreground="#333333" HorizontalAlignment="Right" Margin="0,30,0,0"/>
388 388
                     <TextBlock Grid.Row="0" Grid.Column="1" x:Name="txbNotConnecteds"  Text="未连接" FontSize="14" Foreground="#333333" Margin="30,30,0,0"/>
389 389
 
390 390
                     <TextBlock Grid.Row="1" Grid.Column="0" Text="视频格式" FontSize="16" Foreground="#333333" HorizontalAlignment="Right"/>
@@ -715,7 +715,7 @@
715 715
                     <TextBlock Text="摄像头: " FontSize="14" Padding="5,4,0,0"/>
716 716
                     <RadioButton Cursor="Hand" x:Name="rbnOpen" Content=" 开" Style="{StaticResource radBase}" FontSize="14" Margin="0,4,0,0" Click="RbnOpen_Click"/>
717 717
                     <RadioButton Cursor="Hand" x:Name="rbnTurnOff" Content=" 关"  Style="{StaticResource radBase}" FontSize="14" Margin="5,4,10,0" IsChecked="True" Click="RbnTurnOff_Click"/>
718
-                    <TextBlock Text="智能笔: " FontSize="14" Padding="0,4,0,0"/>
718
+                    <TextBlock Text="设备: " FontSize="14" Padding="0,4,0,0"/>
719 719
                     <TextBlock x:Name="txbNotConnected" Text="未连接" FontSize="14" Padding="0,4,5,0"/>
720 720
                 </StackPanel>
721 721
             </Grid>

+ 378
- 15
XHWK.WKTool/XHMicroLessonSystemWindow.xaml.cs View File

@@ -6,6 +6,8 @@ using ComeCapture;
6 6
 
7 7
 using Common.system;
8 8
 
9
+using RobotpenGateway;
10
+
9 11
 using System;
10 12
 using System.Collections.Generic;
11 13
 using System.Diagnostics;
@@ -194,6 +196,7 @@ namespace XHWK.WKTool
194 196
             txbStoragePath.Content = FileToolsCommon.GetConfigValue("VideoSavePath");
195 197
             Initialize();
196 198
             InitPen();
199
+            InitlbPen();
197 200
 
198 201
         }
199 202
         /// <summary>
@@ -3338,6 +3341,8 @@ namespace XHWK.WKTool
3338 3341
             #endregion
3339 3342
             blackboard_canvas.Visibility = Visibility.Collapsed;
3340 3343
             EndRecord();
3344
+            //鼠标模式
3345
+            deviceMouse();
3341 3346
         }
3342 3347
 
3343 3348
         /// <summary>
@@ -3400,7 +3405,8 @@ namespace XHWK.WKTool
3400 3405
                         }
3401 3406
                     }
3402 3407
                     #endregion
3403
-
3408
+                    //电子版切换笔模式
3409
+                    deviceHand();
3404 3410
                     txbTime.Visibility = Visibility.Visible;
3405 3411
 
3406 3412
                     VideoInfo = new Model_Video
@@ -4479,7 +4485,7 @@ namespace XHWK.WKTool
4479 4485
             {
4480 4486
                 Dispatcher.Invoke(new Action(() =>
4481 4487
                 {
4482
-                    myblackboard.changepages(0, 0, true, Color, PenSize, APP.pageData.currpage - 1);
4488
+                    myblackboard.changepages(0, 0, true, Color, PenSize, APP.pageData.currpage - 1,0);
4483 4489
                 }));
4484 4490
             }
4485 4491
 
@@ -4503,12 +4509,12 @@ namespace XHWK.WKTool
4503 4509
             {
4504 4510
                 APP.PenSerial = penSerial;
4505 4511
                 APP.PenStatus = false;
4506
-
4507
-                Dispatcher.Invoke(new Action(() =>
4508
-                {
4509
-                    txbNotConnected.Text = "未连接";
4510
-                    txbNotConnecteds.Text = "未连接";
4511
-                }));
4512
+                UpdateDevStatus();
4513
+                //Dispatcher.Invoke(new Action(() =>
4514
+                //{
4515
+                //    txbNotConnected.Text = "未连接";
4516
+                //    txbNotConnecteds.Text = "未连接";
4517
+                //}));
4512 4518
             }
4513 4519
         }
4514 4520
 
@@ -4535,11 +4541,12 @@ namespace XHWK.WKTool
4535 4541
 
4536 4542
                 //开始接收笔数据
4537 4543
                 APP.digitalPen.GetPenData(penSerial);
4538
-                Dispatcher.Invoke(new Action(() =>
4539
-                {
4540
-                    txbNotConnected.Text = "已连接";
4541
-                    txbNotConnecteds.Text = "已连接";
4542
-                }));
4544
+                UpdateDevStatus();
4545
+                //Dispatcher.Invoke(new Action(() =>
4546
+                //{
4547
+                //    txbNotConnected.Text = "已连接";
4548
+                //    txbNotConnecteds.Text = "已连接";
4549
+                //}));
4543 4550
 
4544 4551
             }
4545 4552
         }
@@ -4619,9 +4626,9 @@ namespace XHWK.WKTool
4619 4626
                 {
4620 4627
                     Dispatcher.Invoke(new Action(() =>
4621 4628
                     {
4629
+                        float Pressure = force / 100f;
4622 4630
                         //myblackboard.changepages(testX, testY,false);
4623
-                        myblackboard.changepages(testX, testY, false, Color, PenSize, APP.pageData.currpage - 1);
4624
-
4631
+                        myblackboard.changepages(testX, testY, false, Color, PenSize, APP.pageData.currpage - 1, Pressure);
4625 4632
                         #region 设置滚动条位置
4626 4633
 
4627 4634
                         //点在显示页面上方
@@ -4762,6 +4769,331 @@ namespace XHWK.WKTool
4762 4769
 
4763 4770
         #endregion
4764 4771
 
4772
+        #region 写字板模式
4773
+        #region 值初始化
4774
+
4775
+        [System.Runtime.InteropServices.DllImport("kernel32.dll", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
4776
+        public static extern void OutputDebugString(string message);
4777
+
4778
+        public bool usbIsConnected = false;
4779
+
4780
+        //Angle angle = Angle._270;
4781
+        eDeviceType deviceType = eDeviceType.Unknow;
4782
+        /// <summary>
4783
+        /// 点缩放比例
4784
+        /// </summary>
4785
+        private double m_nCompress = 0;
4786
+        private double m_nCompress_x = 0;
4787
+        private double m_nCompress_y = 0;
4788
+
4789
+        /// <summary>
4790
+        /// 0:画布根据板子适配
4791
+        /// 1:板子根据画布适配
4792
+        /// </summary>
4793
+        private int type = 1;//默认画笔根据板子适配
4794
+        bool bScreenO = false;//判断是否是横屏,默认横屏,true:横屏幕;false:竖屏
4795
+        Drawing drawing;
4796
+
4797
+        //List<RobotPoint> plist = new List<RobotPoint>();
4798
+
4799
+        //画布宽高
4800
+        //private int m_nDeviceW = 21000;
4801
+        //private int m_nDeviceH = 29700;
4802
+        private int m_nDeviceW = 22600;
4803
+        private int m_nDeviceH = 16650;
4804
+        private RobotpenGateway.robotpenController.returnPointData date = null;
4805
+
4806
+        private int nResource = 0;
4807
+        private ReportRate RR = ReportRate.R_200;
4808
+        string Mac = string.Empty;
4809
+
4810
+        int Recog_create = 0;
4811
+        int Recog_adddate = 0;
4812
+        int Recog_start = 0;
4813
+
4814
+        public bool isOpen = true;
4815
+
4816
+        //PrintType ptype = PrintType.NoMarkCode_FB2;
4817
+        //int pageData = 0;
4818
+
4819
+        bool AreSynchronized = false;
4820
+        //Dictionary<string, drawFormForA4> fa4dic = new Dictionary<string, drawFormForA4>();
4821
+        //drawFormForA4 dfa4_sync;
4822
+        //string[] szSubjectArray = new string[21] { "未选", "语文", "数学", "英语", "物理", "化学", "生物", "历史", "地理", "政治", "自然", "科一", "科二", "科三", "科四", "科五", "科六", "科七", "科八", "科九", "科十" };
4823
+
4824
+        #endregion
4825
+
4826
+        #region 罗博智慧笔
4827
+
4828
+        /// <summary>
4829
+        /// 笔模式
4830
+        /// </summary>
4831
+        private void deviceHand()
4832
+        {
4833
+            robotpenController.GetInstance().setDeviceMode(eDeviceMode.DEVICE_HAND);
4834
+        }
4835
+        /// <summary>
4836
+        /// 鼠标模式
4837
+        /// </summary>
4838
+        private void deviceMouse()
4839
+        {
4840
+            robotpenController.GetInstance().setDeviceMode(eDeviceMode.DEVICE_MOUSE);
4841
+        }
4842
+        //初始化笔服务
4843
+        private void InitlbPen()
4844
+        {
4845
+            try
4846
+            {
4847
+
4848
+                robotpenController.GetInstance()._ConnectInitialize(eDeviceType.Gateway, IntPtr.Zero);
4849
+                robotpenController.GetInstance().deviceChangeEvt += new robotpenController.DeviceChange(Form1_deviceChangeEvt);
4850
+                //robotpenController.GetInstance().deviceChangeEvt += new robotpenController.DeviceChange(Form1_deviceChangeEvt);
4851
+                //robotpenController.GetInstance().gatewatVersionEvt += Form1_gatewatVersionEvt;
4852
+                //robotpenController.GetInstance().nodeStatusEvt += Form1_nodeStatusEvt;
4853
+                //    robotpenController.GetInstance().searchModeEvt += Form1_searchModeEvt;
4854
+
4855
+                //// 所有设备均注册该页码显示消息 目前只有T9设备才会有页码识别功能, 客户代码可以根据设备来判断是否消费该事件
4856
+                //robotpenController.GetInstance().showPageEvt += new robotpenController.ShowPage(Form1_showPageEvt);
4857
+                //// T8A 按键消息 为了适应其他demo也能响应, 所以任何demo都消费此事件, 客户代码可根据设备类型判断是否消费此事件
4858
+                //robotpenController.GetInstance().keyPressEvt += new robotpenController.KeyPress(Form1_keyPressEvt);
4859
+
4860
+                //robotpenController.GetInstance().PageSensorCallback_Evt += Rbtnet__PageSensorEvt_;
4861
+
4862
+                date = new RobotpenGateway.robotpenController.returnPointData(Form1_bigDataReportEvt1);
4863
+                robotpenController.GetInstance().initDeletgate(ref date);
4864
+
4865
+                CheckUsbConnect();
4866
+                ////robotpenController.GetInstance().returnOptimizePointDataEvt += new robotpenController.returnOptimizePointData(Form1_returnOptimizePointDataEvt);
4867
+
4868
+                //robotpenController.GetInstance().startSyncNoteDataEvt += new robotpenController.startSyncNoteData(Form1_startSyncNoteDataEvt);
4869
+                //robotpenController.GetInstance().startSyncNoteData_kzEvt += Form1_startSyncNoteData_kzEvt;
4870
+                //robotpenController.GetInstance().syncNoteDataEvt += new robotpenController.syncNoteData(Form1_syncNoteDataEvt);
4871
+                //robotpenController.GetInstance().endSyncNoteDataEvt += new robotpenController.endSyncNoteData(Form1_endSyncNoteDataEvt);
4872
+                //robotpenController.GetInstance().getOfflineNoteDataEvt += new robotpenController.getOfflineNoteData(Form1_getOfflineNoteDataEvt);
4873
+            }
4874
+            catch (Exception ex)
4875
+            {
4876
+
4877
+            }
4878
+        }
4879
+        /// <summary>
4880
+        /// 委托实例函数,用于异步修改listview显示的USB连接设备信息
4881
+        /// </summary>
4882
+        private void SetListView()
4883
+        {
4884
+            if (usbIsConnected)
4885
+            {
4886
+                robotpenController.GetInstance()._CloseConnect();
4887
+            }
4888
+            CheckUsbConnect();
4889
+        }
4890
+
4891
+        /// <summary>
4892
+        /// 设备插拔消息,更新listview
4893
+        /// </summary>
4894
+        /// <param name="bStatus"></param>
4895
+        /// <param name="uPid"></param>
4896
+        void Form1_deviceChangeEvt(bool bStatus, ushort uPid)
4897
+        {
4898
+            //throw new NotImplementedException();
4899
+            //Console.WriteLine();
4900
+
4901
+            LogHelper.WriteInfoLog(string.Format("设备状态{0} PID = {1}", bStatus, uPid));
4902
+            SetListView();
4903
+        }
4904
+
4905
+        /// <summary>
4906
+        /// 
4907
+        /// </summary>        
4908
+        /// /// <param name="bIndex"></param>
4909
+        /// <param name="bPenStatus"></param>
4910
+        /// <param name="bx"></param>
4911
+        /// <param name="by"></param>
4912
+        /// <param name="bPress"></param>
4913
+        private void Form1_bigDataReportEvt1(byte bIndex, byte bPenStatus, short bx, short by, short bPress)
4914
+        {
4915
+
4916
+            //17是按下,16是抬起
4917
+            if (bPenStatus == 16|| bPenStatus==0)
4918
+            {
4919
+                stroke.Clear();
4920
+                if (APP.pageData.currpage > 0)
4921
+                {
4922
+                    Dispatcher.Invoke(new Action(() =>
4923
+                    {
4924
+                        myblackboard.changepages(0, 0, true, Color, PenSize, APP.pageData.currpage - 1, 0);
4925
+                    }));
4926
+                }
4927
+            }
4928
+            ////按下
4929
+            //if (bPenStatus == 17)
4930
+            //{
4931
+            //}
4932
+            if(APP.IsOutputInfoLog)
4933
+            {
4934
+                LogHelper.WriteInfoLog(string.Format(@"x={0},y={1},s={2},p={3}", bx, by, bPenStatus, bPress));
4935
+            }
4936
+
4937
+            stroke.Add(new System.Drawing.Point(by, bx));
4938
+
4939
+            double PropW = blackboard_canvas.ActualWidth / m_nDeviceH;
4940
+            double PropH = blackboard_canvas.ActualHeight / m_nDeviceW;
4941
+            //点
4942
+            double testY = (m_nDeviceW - bx) * PropH;
4943
+            double testX = by * PropW;
4944
+            //pageSerial //点阵IP地址  与打印的页面关联
4945
+            if (APP.pageData.currpage > 0)
4946
+            {
4947
+                Dispatcher.Invoke(new Action(() =>
4948
+                {
4949
+                    float Pressure = bPress / 100f;
4950
+                    //myblackboard.changepages(testX, testY,false);
4951
+
4952
+                    if (bPress > 0)
4953
+                    {
4954
+                        myblackboard.changepages(testX, testY, false, Color, PenSize, APP.pageData.currpage - 1, Pressure);
4955
+                    }
4956
+                    #region 设置滚动条位置
4957
+
4958
+                    //点在显示页面上方
4959
+                    if (testY < scroMain.VerticalOffset)
4960
+                    {
4961
+                        //滚动条当前位置
4962
+                        double RollCurrentLocation = scroMain.VerticalOffset;
4963
+                        //向上滚动至以点为中心需要滚动的距离  
4964
+                        double UpRoll = (RollCurrentLocation - testY) + (scroMain.ActualHeight / 2);
4965
+                        //如果小于0则等于0
4966
+                        double RollLocation = RollCurrentLocation - UpRoll;
4967
+                        if (RollLocation < 0)
4968
+                        {
4969
+                            RollLocation = 0;
4970
+                        }
4971
+                        ////滚动条实际偏移量
4972
+                        //double RollOffset = RollCurrentLocation - RollLocation;
4973
+                        scroMain.ScrollToVerticalOffset(RollLocation);
4974
+                    }
4975
+                    //点在显示页面下方
4976
+                    if (testY > scroMain.VerticalOffset + scroMain.ActualHeight)
4977
+                    {
4978
+                        //滚动条当前位置
4979
+                        double RollCurrentLocation = scroMain.VerticalOffset;
4980
+                        //向下滚动至以点为中心需要滚动的距离  
4981
+                        double DownRoll = (testY - RollCurrentLocation) - (scroMain.ActualHeight / 2);
4982
+                        //如果小于0则等于0
4983
+                        double RollLocation = RollCurrentLocation + DownRoll;
4984
+                        //滚动条最大滚动值
4985
+                        double ScrollbarMaxNum = gridM.ActualHeight - scroMain.ActualHeight;
4986
+                        if (RollLocation > ScrollbarMaxNum)
4987
+                        {
4988
+                            RollLocation = ScrollbarMaxNum;
4989
+                        }
4990
+                        ////滚动条实际偏移量
4991
+                        //double RollOffset = RollLocation-RollCurrentLocation;
4992
+                        scroMain.ScrollToVerticalOffset(RollLocation);
4993
+                    }
4994
+                    #endregion
4995
+                    if (testX > 0 && testY > 0)
4996
+                    {
4997
+                        //System.Windows.Point getP = blackboard_canvas.PointToScreen(new System.Windows.Point(testX, testY));
4998
+                        System.Windows.Point getP = scroMain.PointToScreen(new System.Windows.Point(testX, testY - scroMain.VerticalOffset));
4999
+                        SetCursorPos((int)getP.X, (int)getP.Y);
5000
+                    }
5001
+                }));
5002
+            }
5003
+        }
5004
+
5005
+        /// <summary>
5006
+        /// 判断是否有设备连接
5007
+        /// </summary>
5008
+        public void CheckUsbConnect()
5009
+        {
5010
+            usbIsConnected = false;
5011
+            Thread.Sleep(200);
5012
+            int nDeviceCount = robotpenController.GetInstance()._GetDeviceCount();
5013
+            if (nDeviceCount > 0)
5014
+            {
5015
+                //this.listView1.BeginUpdate();
5016
+                for (int i = 0; i < nDeviceCount; ++i)
5017
+                {
5018
+                    ushort npid = 0;
5019
+                    ushort nvid = 0;
5020
+                    string strDeviceName = string.Empty;
5021
+                    eDeviceType dtype = eDeviceType.Unknow;
5022
+                    if (robotpenController.GetInstance()._GetAvailableDevice(i, ref npid, ref nvid, ref strDeviceName, ref dtype))
5023
+                    {
5024
+                        if (!usbIsConnected)
5025
+                        {
5026
+                            usbIsConnected = true;
5027
+                            deviceType = dtype;
5028
+                            robotpenController.GetInstance()._ConnectInitialize(deviceType, IntPtr.Zero);
5029
+                            int nRes = robotpenController.GetInstance()._ConnectOpen();
5030
+                            if (nRes != 0)
5031
+                            {
5032
+                                //LogHelper.WriteInfoLog(string.Format(@"x={0},y={1},s={2},p={3}", bx, by, bPenStatus, bPress));
5033
+                                LogHelper.WriteErrLog("设备自动连接失败,请重新插拔设备或尝试手动连接!",null);
5034
+                                usbIsConnected = false;
5035
+                                break;
5036
+                            }
5037
+                            //robotpenController.GetInstance()._Send(cmdId.SwitchMode);
5038
+                            robotpenController.GetInstance()._Send(cmdId.GetConfig);
5039
+
5040
+                            APP.BoardStatus = true;
5041
+                            UpdateDevStatus();
5042
+                            //Dispatcher.Invoke(new Action(() =>
5043
+                            //{
5044
+                            //    txbNotConnected.Text = "手写板";
5045
+                            //    txbNotConnecteds.Text = "手写板";
5046
+                            //}));
5047
+                        }
5048
+                    }
5049
+                }
5050
+            }
5051
+            else
5052
+            {
5053
+                APP.BoardStatus = false;
5054
+                UpdateDevStatus();
5055
+            }
5056
+        }
5057
+
5058
+        #endregion
5059
+
5060
+        void UpdateDevStatus()
5061
+        {
5062
+            if (APP.BoardStatus && APP.PenStatus)
5063
+            {
5064
+                Dispatcher.Invoke(new Action(() =>
5065
+                {
5066
+                    txbNotConnected.Text = "笔/板";
5067
+                    txbNotConnecteds.Text = "笔/板";
5068
+                }));
5069
+            }
5070
+            else if(APP.BoardStatus)
5071
+            {
5072
+                Dispatcher.Invoke(new Action(() =>
5073
+                {
5074
+                    txbNotConnected.Text = "手写板";
5075
+                    txbNotConnecteds.Text = "手写板";
5076
+                }));
5077
+            }
5078
+            else if (APP.PenStatus)
5079
+            {
5080
+                Dispatcher.Invoke(new Action(() =>
5081
+                {
5082
+                    txbNotConnected.Text = "智能笔";
5083
+                    txbNotConnecteds.Text = "智能笔";
5084
+                }));
5085
+            }
5086
+            else
5087
+            {
5088
+                Dispatcher.Invoke(new Action(() =>
5089
+                {
5090
+                    txbNotConnected.Text = "未连接";
5091
+                    txbNotConnecteds.Text = "未连接";
5092
+                }));
5093
+            }
5094
+        }
5095
+        #endregion
5096
+
4765 5097
         #region 图片拉伸移动
4766 5098
         private System.Windows.Point initialPoint;
4767 5099
 
@@ -5269,10 +5601,41 @@ namespace XHWK.WKTool
5269 5601
         }
5270 5602
         #endregion
5271 5603
 
5604
+        private void Button_Click(object sender, RoutedEventArgs e)
5605
+        {
5606
+            robotpenController.GetInstance().setDeviceMode(eDeviceMode.DEVICE_HAND);
5607
+        }
5608
+
5609
+        private void Button_Click_1(object sender, RoutedEventArgs e)
5610
+        {
5611
+            robotpenController.GetInstance().setDeviceMode(eDeviceMode.DEVICE_MOUSE);
5612
+        }
5272 5613
     }
5273 5614
     public class PageData
5274 5615
     {
5275 5616
         public int PageCode { get; set; }
5276 5617
         public string PageName { get; set; }
5277 5618
     }
5619
+
5620
+
5621
+    public enum ReportRate
5622
+    {
5623
+        R_200,
5624
+        R_160,
5625
+        R_120,
5626
+        R_80,
5627
+        R_40
5628
+    }
5629
+
5630
+    public class RobotPoint
5631
+    {
5632
+        public int bIndex { get; set; }
5633
+        public int bPenStatus { get; set; }
5634
+        public float bx { get; set; }
5635
+        public float by { get; set; }
5636
+        public float bPress { get; set; }
5637
+        public float bWidth { get; set; }
5638
+        public float bSpeed { get; set; }
5639
+        public bool isOptimize { get; set; }
5640
+    }
5278 5641
 }

+ 5
- 1
XHWK.WKTool/XHWK.WKTool.csproj View File

@@ -68,7 +68,7 @@
68 68
     <Reference Include="Aspose.PDF, Version=19.1.0.0, Culture=neutral, PublicKeyToken=716fcc553a201e56, processorArchitecture=MSIL">
69 69
       <HintPath>..\packages\Aspose.PDF.19.1.0\lib\net4.0\Aspose.PDF.dll</HintPath>
70 70
     </Reference>
71
-    <Reference Include="Aspose.Slides, Version=15.1.0.0, Culture=neutral, PublicKeyToken=00725b1ceb58d0a9, processorArchitecture=MSIL">
71
+    <Reference Include="Aspose.Slides, Version=17.9.1.0, Culture=neutral, PublicKeyToken=716fcc553a201e56, processorArchitecture=MSIL">
72 72
       <SpecificVersion>False</SpecificVersion>
73 73
       <HintPath>..\dl\Aspose.Slides.dll</HintPath>
74 74
     </Reference>
@@ -85,6 +85,10 @@
85 85
       <SpecificVersion>False</SpecificVersion>
86 86
       <HintPath>..\Common\dlls\Newtonsoft.Json.dll</HintPath>
87 87
     </Reference>
88
+    <Reference Include="RobotpenGateway, Version=1.1.6.1, Culture=neutral, processorArchitecture=x86">
89
+      <SpecificVersion>False</SpecificVersion>
90
+      <HintPath>..\Common\dlls\RobotpenGateway.dll</HintPath>
91
+    </Reference>
88 92
     <Reference Include="System" />
89 93
     <Reference Include="System.Configuration" />
90 94
     <Reference Include="System.Data" />

Loading…
Cancel
Save