Browse Source

zhao:增加腾千里点阵笔

tags/录制修改前
耀 4 years ago
parent
commit
99bb37c108

BIN
Common/dlls/CheckPoint.dll View File


BIN
Common/dlls/SonixUSB.dll View File


BIN
Common/dlls/TQLComm.dll View File


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

@@ -146,11 +146,21 @@ namespace XHWK.WKTool
146 146
         /// <summary>
147 147
         /// 笔状态,是否已连接
148 148
         /// </summary>
149
-        public static bool PenStatus;
149
+        public static bool PenStatus = false;
150 150
         /// <summary>
151 151
         /// 手写板状态,是否已连接
152 152
         /// </summary>
153
-        public static bool BoardStatus;
153
+        public static bool BoardStatus = false;
154
+        #endregion
155
+        #region 腾千里手写笔
156
+        /// <summary>
157
+        /// 腾千里手写笔事件
158
+        /// </summary>
159
+        public static PenEvents TQLPenevents;
160
+        /// <summary>
161
+        /// 腾千里手写笔是否已连接
162
+        /// </summary>
163
+        public static bool TQLPenStatus = false;
154 164
         #endregion
155 165
         #region 页面
156 166
         /// <summary>

BIN
XHWK.WKTool/CheckPoint.dll View File


+ 199
- 58
XHWK.WKTool/PracticeWindow.xaml.cs View File

@@ -45,6 +45,7 @@ namespace XHWK.WKTool
45 45
         {
46 46
             InitializeComponent();
47 47
             InitPen();
48
+            InitTQLPPen();
48 49
         }
49 50
         public void Initialize(string _imgPath = null)
50 51
         {
@@ -528,6 +529,7 @@ namespace XHWK.WKTool
528 529
             else
529 530
             {
530 531
                 isPenDown = true;
532
+               APP.W_ScreenRecordingToolbarWindow.PenPractice();
531 533
             }
532 534
         }
533 535
 
@@ -679,38 +681,40 @@ namespace XHWK.WKTool
679 681
         /// <param name="force">压力值</param>
680 682
         private void OnPenCoordinate(ulong time, string penSerial, int penType, string pageSerial, int cx, int cy, byte force)
681 683
         {
682
-            if (CheckAccess())
683
-            {
684
-                Action<ulong, string, int, string, int, int, byte> ac = new Action<ulong, string, int, string, int, int, byte>(OnPenCoordinate);
685
-                Dispatcher.Invoke(ac, new object[] { time, pageSerial, penType, pageSerial, cx, cy, force });
686
-            }
687
-            else
684
+            if (this.Visibility == Visibility.Visible)
688 685
             {
689
-                //判断是否是落笔后输出的坐标,在设置悬浮模式下,落笔前的悬浮坐标不绘制
690
-                if (!isPenDown)
686
+                if (CheckAccess())
691 687
                 {
692
-                    return;
688
+                    Action<ulong, string, int, string, int, int, byte> ac = new Action<ulong, string, int, string, int, int, byte>(OnPenCoordinate);
689
+                    Dispatcher.Invoke(ac, new object[] { time, pageSerial, penType, pageSerial, cx, cy, force });
693 690
                 }
694
-                stroke.Add(new System.Drawing.Point(cx, cy));
695
-
696
-                double PropW = blackboard_canvas.ActualWidth / A4_HEIGHT;
697
-                double PropH = blackboard_canvas.ActualHeight / A4_WIDTH;
698
-                //点
699
-                double testX = cy * PropW;
700
-                double testY = (A4_WIDTH - cx) * PropH;
701
-                //pageSerial //点阵IP地址  与打印的页面关联
702
-                if (true)
691
+                else
703 692
                 {
704
-                    Dispatcher.Invoke(new Action(() =>
693
+                    //判断是否是落笔后输出的坐标,在设置悬浮模式下,落笔前的悬浮坐标不绘制
694
+                    if (!isPenDown)
705 695
                     {
706
-                        float Pressure = force / 100f;
696
+                        return;
697
+                    }
698
+                    stroke.Add(new System.Drawing.Point(cx, cy));
699
+
700
+                    double PropW = blackboard_canvas.ActualWidth / A4_HEIGHT;
701
+                    double PropH = blackboard_canvas.ActualHeight / A4_WIDTH;
702
+                    //点
703
+                    double testX = cy * PropW;
704
+                    double testY = (A4_WIDTH - cx) * PropH;
705
+                    //pageSerial //点阵IP地址  与打印的页面关联
706
+                    if (true)
707
+                    {
708
+                        Dispatcher.Invoke(new Action(() =>
709
+                        {
710
+                            float Pressure = force / 100f;
707 711
                         ////添加笔画
708 712
                         //myblackboard.changepages(testX, testY, false, Color, PenSize, APP.pageData.currpage - 1, Pressure);
709 713
 
710 714
                         if (isFirst)
711
-                        {
712
-                            stylusPoint.X = testX;
713
-                            stylusPoint.Y = testY;
715
+                            {
716
+                                stylusPoint.X = testX;
717
+                                stylusPoint.Y = testY;
714 718
                             //_color.A = (byte)(Pressure * 255f);
715 719
                             //stylusPoint.PressureFactor = Pressure;
716 720
 
@@ -721,60 +725,61 @@ namespace XHWK.WKTool
721 725
                             //    stylusPoints.Add(stylusPoint);
722 726
                             //}
723 727
                             stylusPoints.Add(stylusPoint);
724
-                            if (stylusPoints.Count > 1)
725
-                            {
726
-                                drawing = new DrawingAttributes
728
+                                if (stylusPoints.Count > 1)
727 729
                                 {
728
-                                    Color = Colour,
729
-                                    Width = Wit * 4.5,
730
-                                    Height = Wit * 4.5,
731
-                                    FitToCurve = true,
732
-                                    IgnorePressure = false
733
-                                };
734
-                            
730
+                                    drawing = new DrawingAttributes
731
+                                    {
732
+                                        Color = Colour,
733
+                                        Width = Wit * 4.5,
734
+                                        Height = Wit * 4.5,
735
+                                        FitToCurve = true,
736
+                                        IgnorePressure = false
737
+                                    };
738
+
735 739
                                 //blackboard_canvas.Strokes = new StrokeCollection();
736 740
                                 strokes = new Stroke(stylusPoints);
737 741
 
738
-                             
739
-                                strokes.DrawingAttributes = drawing;
742
+
743
+                                    strokes.DrawingAttributes = drawing;
740 744
                                 //blackboard_canvas.Strokes.Add(strokes);
741 745
 
742 746
                                 blackboard_canvas.Strokes.Add(strokes);
743
-                                isFirst = false;
747
+                                    isFirst = false;
748
+                                }
744 749
                             }
745
-                        }
746
-                        else
747
-                        {
748
-                            if (blackboard_canvas.Strokes.Count>0)
750
+                            else
749 751
                             {
750
-                                stylusPoint.X = testX;
751
-                                stylusPoint.Y = testY;
752
-                                stylusPoints.Add(stylusPoint);
753
-                                strokes = new Stroke(stylusPoints);
754
-                                drawing = new DrawingAttributes
752
+                                if (blackboard_canvas.Strokes.Count > 0)
755 753
                                 {
756
-                                    Color = Colour,
757
-                                    Width = Wit * 4.5,
758
-                                    Height = Wit * 4.5,
759
-                                    FitToCurve = true,
760
-                                    IgnorePressure = false
761
-                                };
762
-                                strokes.DrawingAttributes = drawing;
754
+                                    stylusPoint.X = testX;
755
+                                    stylusPoint.Y = testY;
756
+                                    stylusPoints.Add(stylusPoint);
757
+                                    strokes = new Stroke(stylusPoints);
758
+                                    drawing = new DrawingAttributes
759
+                                    {
760
+                                        Color = Colour,
761
+                                        Width = Wit * 4.5,
762
+                                        Height = Wit * 4.5,
763
+                                        FitToCurve = true,
764
+                                        IgnorePressure = false
765
+                                    };
766
+                                    strokes.DrawingAttributes = drawing;
763 767
 
764 768
                                 //viewModel.InkStrokes.Add(strokes);
765 769
                                 blackboard_canvas.Strokes[blackboard_canvas.Strokes.Count - 1] = strokes;
770
+                                }
766 771
                             }
767
-                        }
768 772
 
769 773
                         //设置鼠标位置
770 774
                         if (testX > 0 && testY > 0)
771
-                        {
775
+                            {
772 776
                             //System.Windows.Point getP = scroMain.PointToScreen(new System.Windows.Point(testX, testY - scroMain.VerticalOffset));
773
-                            SetCursorPos((int)((float)testX* (PrimaryScreen.DpiX / 96f)), (int)((float)testY* (PrimaryScreen.DpiY / 96f)));
774
-                        }
775
-                    }));
776
-                }
777
+                            SetCursorPos((int)((float)testX * (PrimaryScreen.DpiX / 96f)), (int)((float)testY * (PrimaryScreen.DpiY / 96f)));
778
+                            }
779
+                        }));
780
+                    }
777 781
 
782
+                }
778 783
             }
779 784
         }
780 785
         bool isFirst = true;
@@ -853,6 +858,142 @@ namespace XHWK.WKTool
853 858
 
854 859
         #endregion
855 860
 
861
+        #region 腾千里手写笔
862
+        /// <summary>
863
+        /// 是否在书写
864
+        /// </summary>
865
+        bool isTQLPenDown = false;
866
+        /// <summary>
867
+        /// TQL点阵笔宽高
868
+        /// </summary>
869
+        static float TQLA4_WIDTH = (float)1075 / (float)150 * (float)25.4 / (float)1.524; //OID4
870
+        static float TQLA4_HEIGHT = (float)1512 / (float)150 * (float)25.4 / (float)1.524;
871
+        /// <summary>
872
+        /// 初始化
873
+        /// </summary>
874
+        public void InitTQLPPen()
875
+        {
876
+            if (APP.TQLPenevents == null)
877
+            {
878
+                APP.TQLPenevents = new PenEvents(2);
879
+            }
880
+            else
881
+            {
882
+                APP.TQLPenevents.InToType = 2;
883
+            }
884
+        }
885
+        /// <summary>
886
+        /// 笔落下
887
+        /// </summary>
888
+        public void TQLDown()
889
+        {
890
+            isTQLPenDown = true;
891
+            APP.W_ScreenRecordingToolbarWindow.PenPractice();
892
+            if (strokes != null && strokes.StylusPoints.Count > 1)
893
+            {
894
+                isFirst = true;
895
+            }
896
+            stylusPoints = new StylusPointCollection();
897
+            stylusPoint = new StylusPoint();
898
+            strokes = null;
899
+        }
900
+        /// <summary>
901
+        /// 笔抬起
902
+        /// </summary>
903
+        public void TQLUp()
904
+        {
905
+            isTQLPenDown = false;
906
+
907
+            if (strokes != null && strokes.StylusPoints.Count > 1)
908
+            {
909
+                isFirst = true;
910
+            }
911
+            stylusPoints = new StylusPointCollection();
912
+            stylusPoint = new StylusPoint();
913
+            strokes = null;
914
+        }
915
+        /// <summary>
916
+        /// 笔书写
917
+        /// </summary>
918
+        /// <param name="cx"></param>
919
+        /// <param name="cy"></param>
920
+        /// <param name="force"></param>
921
+        public void TQLPenWrite(double cx, double cy, int force)
922
+        {
923
+            if (this.Visibility == Visibility.Visible)
924
+            {
925
+                //判断是否是落笔后输出的坐标,在设置悬浮模式下,落笔前的悬浮坐标不绘制
926
+                if (!isTQLPenDown)
927
+                {
928
+                    return;
929
+                }
930
+                double PropW = blackboard_canvas.ActualWidth / TQLA4_HEIGHT;
931
+                double PropH = blackboard_canvas.ActualHeight / TQLA4_WIDTH;
932
+
933
+                double tempX = cy * PropW;
934
+                double tempY = (TQLA4_WIDTH - cx) * PropH;
935
+                Dispatcher.Invoke(new Action(() =>
936
+                {
937
+                //0~1023,亦即有 1024 阶供应用软件后续应用之用,如笔锋笔触,暂无用
938
+                float Pressure = (float)force / 1023f;
939
+                //添加笔画
940
+                if (isFirst)
941
+                    {
942
+                        stylusPoint.X = tempX;
943
+                        stylusPoint.Y = tempY;
944
+                        stylusPoints.Add(stylusPoint);
945
+                        if (stylusPoints.Count > 1)
946
+                        {
947
+                            drawing = new DrawingAttributes
948
+                            {
949
+                                Color = Colour,
950
+                                Width = Wit * 4.5,
951
+                                Height = Wit * 4.5,
952
+                                FitToCurve = true,
953
+                                IgnorePressure = false
954
+                            };
955
+
956
+                            strokes = new Stroke(stylusPoints);
957
+
958
+                            strokes.DrawingAttributes = drawing;
959
+
960
+                            blackboard_canvas.Strokes.Add(strokes);
961
+                            isFirst = false;
962
+                        }
963
+                    }
964
+                    else
965
+                    {
966
+                        if (blackboard_canvas.Strokes.Count > 0)
967
+                        {
968
+                            stylusPoint.X = tempX;
969
+                            stylusPoint.Y = tempY;
970
+                            stylusPoints.Add(stylusPoint);
971
+                            strokes = new Stroke(stylusPoints);
972
+                            drawing = new DrawingAttributes
973
+                            {
974
+                                Color = Colour,
975
+                                Width = Wit * 4.5,
976
+                                Height = Wit * 4.5,
977
+                                FitToCurve = true,
978
+                                IgnorePressure = false
979
+                            };
980
+                            strokes.DrawingAttributes = drawing;
981
+
982
+                        //viewModel.InkStrokes.Add(strokes);
983
+                        blackboard_canvas.Strokes[blackboard_canvas.Strokes.Count - 1] = strokes;
984
+                        }
985
+                    }
986
+
987
+                //设置鼠标位置
988
+                if (tempX > 0 && tempY > 0)
989
+                    {
990
+                    //System.Windows.Point getP = scroMain.PointToScreen(new System.Windows.Point(testX, testY - scroMain.VerticalOffset));
991
+                    SetCursorPos((int)((float)tempX * (PrimaryScreen.DpiX / 96f)), (int)((float)tempY * (PrimaryScreen.DpiY / 96f)));
992
+                    }
993
+                }));
994
+            }
995
+        }
996
+        #endregion
856 997
     }
857 998
 }
858 999
 

BIN
XHWK.WKTool/RobotDotMatrix.dll View File


BIN
XHWK.WKTool/RobotUsbWrapper.dll View File


+ 79
- 1
XHWK.WKTool/ScreenRecordingToolbarWindow.xaml.cs View File

@@ -97,6 +97,7 @@ namespace XHWK.WKTool
97 97
                 //practiceWin.Owner = this;
98 98
             }
99 99
             APP.W_PracticeWindow.InitPen();
100
+            APP.W_PracticeWindow.InitTQLPPen();
100 101
             APP.W_PracticeWindow.Show();
101 102
             new Thread(new ThreadStart(new Action(() =>
102 103
             {
@@ -286,6 +287,7 @@ namespace XHWK.WKTool
286 287
         {
287 288
             _state = State.End;
288 289
         }
290
+
289 291
         #region 录屏
290 292
         /// <summary>
291 293
         /// 设置录屏文件地址
@@ -603,7 +605,8 @@ namespace XHWK.WKTool
603 605
                 APP.W_XHMicroLessonSystemWindow = new XHMicroLessonSystemWindow();
604 606
             }
605 607
             APP.W_XHMicroLessonSystemWindow.InitializeKeyDownEvent();
606
-            APP.W_XHMicroLessonSystemWindow.InitPen();
608
+            APP.W_XHMicroLessonSystemWindow.InitPen(); 
609
+            APP.W_XHMicroLessonSystemWindow.InitTQLPPen();
607 610
             APP.W_XHMicroLessonSystemWindow.Show();
608 611
             if (!IsFirstRS)
609 612
             {
@@ -686,6 +689,77 @@ namespace XHWK.WKTool
686 689
             APP.W_PracticeWindow.Hide();
687 690
         }
688 691
         /// <summary>
692
+        /// 笔调用批注
693
+        /// </summary>
694
+        public void PenPractice()
695
+        {
696
+            if (!IsFirstRS)
697
+            {
698
+                if (flg != 11 && flg != 10)
699
+                {
700
+                    #region 防止连击
701
+                    if (IsPressButton)
702
+                    {
703
+                        return;
704
+                    }
705
+                    else
706
+                    {
707
+                        IsPressButton = true;
708
+                        new Thread(new ThreadStart(new Action(() =>
709
+                        {
710
+                            Thread.Sleep(500);
711
+                            IsPressButton = false;
712
+                        }))).Start();
713
+                    }
714
+                    #endregion
715
+                    string time = GetTimeStamp();
716
+                    string tempPath = AppDomain.CurrentDomain.BaseDirectory + "temp\\";
717
+                    if (!Directory.Exists(tempPath))
718
+                    {
719
+                        Directory.CreateDirectory(tempPath);
720
+                    }
721
+                    try
722
+                    {
723
+                        Dispatcher.Invoke(() =>
724
+                        {
725
+                            borOne.Background = new SolidColorBrush(Colors.LightSkyBlue);
726
+                            borTwo.Background = new SolidColorBrush(Colors.DodgerBlue);
727
+                            if (APP.W_PracticeWindow == null)
728
+                            {
729
+                                APP.W_PracticeWindow = new PracticeWindow
730
+                                {
731
+                                    Width = pwidth,
732
+                                    Height = pHeight,
733
+                                    Left = 0,
734
+                                    Top = 0
735
+                                };
736
+                            //practiceWin.Owner = this;
737
+                        }
738
+                        //APP.W_PracticeWindow.InitPen();
739
+                        //APP.W_PracticeWindow.InitTQLPPen();
740
+                        APP.W_PracticeWindow.Initialize();// imagePath);
741
+                        flg = 11;
742
+                            APP.W_PracticeWindow.Blue();
743
+                            APP.W_PracticeWindow.Show();
744
+                        });
745
+                        new Thread(new ThreadStart(new Action(() =>
746
+                        {
747
+                            Thread.Sleep(100);
748
+                            Dispatcher.Invoke(() =>
749
+                            {
750
+                                Owner = APP.W_PracticeWindow;
751
+                                Topmost = true;
752
+                            });
753
+                        }))).Start();
754
+                    }
755
+                    catch (Exception ex)
756
+                    {
757
+                        LogHelper.WriteErrLog("【批注(PracticeWindow)" + ex.Message, ex);
758
+                    }
759
+                }
760
+            }
761
+        }
762
+        /// <summary>
689 763
         /// 画笔点击事件
690 764
         /// </summary>
691 765
         /// <param name="sender"></param>
@@ -766,6 +840,7 @@ namespace XHWK.WKTool
766 840
                         //practiceWin.Owner = this;
767 841
                     }
768 842
                     APP.W_PracticeWindow.InitPen();
843
+                    APP.W_PracticeWindow.InitTQLPPen();
769 844
                     APP.W_PracticeWindow.Initialize();// imagePath);
770 845
                     flg = 11;
771 846
                     APP.W_PracticeWindow.Blue();
@@ -1071,6 +1146,7 @@ namespace XHWK.WKTool
1071 1146
                         //practiceWin.Owner = this;
1072 1147
                     }
1073 1148
                     APP.W_PracticeWindow.InitPen();
1149
+                    APP.W_PracticeWindow.InitTQLPPen();
1074 1150
                     APP.W_PracticeWindow.Initialize();//imagePath);
1075 1151
                     flg = 10;
1076 1152
                     APP.W_PracticeWindow.Red();
@@ -1136,6 +1212,7 @@ namespace XHWK.WKTool
1136 1212
                         //practiceWin.Owner = this;
1137 1213
                     }
1138 1214
                     APP.W_PracticeWindow.InitPen();
1215
+                    APP.W_PracticeWindow.InitTQLPPen();
1139 1216
                     APP.W_PracticeWindow.Initialize();//imagePath);
1140 1217
 
1141 1218
                     if (flg == 0)
@@ -1224,6 +1301,7 @@ namespace XHWK.WKTool
1224 1301
             }
1225 1302
             APP.W_XHMicroLessonSystemWindow.InitializeKeyDownEvent();
1226 1303
             APP.W_XHMicroLessonSystemWindow.InitPen();
1304
+            APP.W_XHMicroLessonSystemWindow.InitTQLPPen();
1227 1305
             APP.W_XHMicroLessonSystemWindow.Show();
1228 1306
             Hide();
1229 1307
         }

BIN
XHWK.WKTool/SonixUSB.dll View File


+ 545
- 0
XHWK.WKTool/TQLPen/PenEvents.cs View File

@@ -0,0 +1,545 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Text;
5
+using System.Threading.Tasks;
6
+
7
+using TQLComm;
8
+
9
+namespace XHWK.WKTool
10
+{
11
+    public class PenEvents : PenEvent
12
+    {
13
+        int SA = 0;
14
+        int SB = 0;
15
+        int SC = 0;
16
+        int SD = 0;
17
+        int Sindex = 0;
18
+
19
+        int S = 0;
20
+        int O = 0;
21
+        int B = 0;
22
+        int P = 0;
23
+        public static bool ConnectPen = false;
24
+        public bool ShowPointLog = false;
25
+
26
+        public static bool DrawIngend = true;
27
+
28
+        public PenCommManager Manager;
29
+
30
+        public int InToType = 0;
31
+        /// <summary>
32
+        /// TQL事件初始化,进入类型1录制2录屏
33
+        /// </summary>
34
+        /// <param name="type">进入类型1录制2录屏</param>
35
+        public PenEvents(int type)//(Form1 form)
36
+        {
37
+            InToType = type;
38
+            //this.form = form;
39
+            Manager = new PenCommManager(this);
40
+            Manager.Init();
41
+        }
42
+
43
+
44
+        public void StartRecvDataTimer1()
45
+        {
46
+            DrawIngend = false;
47
+            System.Timers.Timer t = new System.Timers.Timer(1000);
48
+            t.Elapsed += new System.Timers.ElapsedEventHandler(timerCall);
49
+            t.AutoReset = false;//设置是执行一次(false)还是一直执行(true);
50
+            t.Enabled = true;//是否执行System.Timers.Timer.Elapsed事件;
51
+        }
52
+
53
+        //委托执行的方法
54
+        private void timerCall(object source, System.Timers.ElapsedEventArgs e)
55
+        {
56
+            DrawIngend = true;
57
+            //MessageBox.Show("ni");
58
+        }
59
+
60
+        public void OnGetOIDType(uint oType)
61
+        {
62
+
63
+        }
64
+
65
+        public void OnSetOIDType(bool bSuccess)
66
+        {
67
+
68
+        }
69
+
70
+        public void onConfirmReceiveOfflineData(bool bSuccess)
71
+        {
72
+        }
73
+        
74
+        /// <summary>
75
+        /// 智能笔连接状态
76
+        /// </summary>
77
+        /// <param name="bConnected"></param>
78
+        public void onConnectionStatus(bool bConnected)
79
+        {
80
+            ConnectPen = bConnected;
81
+            try
82
+            {
83
+                if (bConnected)
84
+                {
85
+                    APP.TQLPenStatus = true;
86
+                    //form.AddLog("智能笔已连接!");
87
+                    APP.W_XHMicroLessonSystemWindow.UpdateDevStatus();
88
+                }
89
+                else
90
+                {
91
+                    APP.TQLPenStatus = false;
92
+                    //form.DisConnect();
93
+                    //form.AddLog("智能笔已断开连接!");
94
+                    APP.W_XHMicroLessonSystemWindow.UpdateDevStatus();
95
+                }
96
+            }
97
+            catch (Exception)
98
+            {
99
+            }
100
+        }
101
+
102
+        public void onContinueOfflineData(bool bSuccess)
103
+        {
104
+
105
+        }
106
+        /// <summary>
107
+        /// 下载离线数据
108
+        /// </summary>
109
+        /// <param name="bEnd"></param>
110
+        public void onEndOfDownloadOfflineData(bool bEnd)
111
+        {
112
+            if (bEnd)
113
+            {
114
+                //if (form.StartDownload) form.StartDownload = false;
115
+                //form.StartOrStop(form.StartDownload);
116
+                //form.DrawOffType = -1;
117
+
118
+                //form.AddLog("下载离线数据成功!");
119
+
120
+                //form.SetProGress(100);
121
+            }
122
+            else
123
+            {
124
+                //if (!form.StartDownload) form.StartDownload = true;
125
+                //form.AddLog("下载离线数据失败!");
126
+            }
127
+        }
128
+
129
+        public void onGetAutoPowerOffTime(short Data)
130
+        {
131
+            //if (form.PenAttribute != null) form.PenAttribute.SetoffTextString(Data.ToString());
132
+            //form.AddLog("当前自动休眠时间:" + Data.ToString() + "!");
133
+        }
134
+
135
+        public void onGetAutoPowerOnMode(bool bSetOn)
136
+        {
137
+            //if (form.PenAttribute != null) form.PenAttribute.SetSevseepComBox(bSetOn);
138
+            //form.AddLog("当前唤醒模式笔尖压力是否唤醒:" + bSetOn.ToString() + "!");
139
+        }
140
+
141
+        public void onGetBatteryPower(short Data)
142
+        {
143
+            //if (form.PenAttribute != null) form.PenAttribute.SetBatteryTextString(Data.ToString() + "%");
144
+            //form.AddLog("当前剩余电量:" + Data.ToString() + "%!");
145
+        }
146
+
147
+        public void onGetBeepStatus(bool bSetOn)
148
+        {
149
+            //if (form.PenAttribute != null) form.PenAttribute.SetBeetComBox(bSetOn);
150
+            //form.AddLog("当前蜂鸣器模式是否响动:" + bSetOn.ToString() + "!");
151
+        }
152
+
153
+        public void onGetCustomerID(uint ID1, uint ID2)
154
+        {
155
+
156
+        }
157
+
158
+        public void onGetElementCode(uint OID, uint SID, int Size)
159
+        {
160
+
161
+        }
162
+
163
+        public void onGetFWVersion(string strData)
164
+        {
165
+            //if (form.PenAttribute != null) form.PenAttribute.SetBTTextString(strData);
166
+            //form.AddLog("当前蓝牙版本号:" + strData + "!");
167
+        }
168
+
169
+        public void onGetMCUFWVersion(string strData)
170
+        {
171
+            //if (form.PenAttribute != null) form.PenAttribute.SetMCUTextString(strData);
172
+            //form.AddLog("当前MCU版本号:" + strData + "!");
173
+        }
174
+
175
+        public void onGetMacAddress(string macAddress)
176
+        {
177
+            //if (form.PenAttribute != null) form.PenAttribute.SetMAcTextString(macAddress);
178
+            //form.AddLog("当前MAC:" + macAddress + "!");
179
+        }
180
+
181
+        public void onGetOID4ElementCode(int SA, int SB, int SC, int SD, int index)
182
+        {
183
+            //if (this.SA != SA || this.SB != SB || this.SC != SC || this.SD != SD || this.Sindex != index)
184
+            //{
185
+            //    this.SA = SA; this.SB = SB; this.SC = SC; this.SD = SD; this.Sindex = index;
186
+            //    form.AddLog("SA:" + SA.ToString() + "," + "SB:" + SB.ToString() + "," + "SC:" + SC.ToString() + "," + "SD:" + SD.ToString() + "," + "index:" + index.ToString());
187
+            //}
188
+        }
189
+
190
+        public void onGetOfflineDataNo(int Data)
191
+        {
192
+            //ConnectPen = true;
193
+            //form.AddLog("当前离线数据量:" + Data.ToString() + "!");
194
+            //if (Data == 0 && form.StartDownload == true)
195
+            //{
196
+            //    form.StartDownload = false;
197
+            //    form.StartOrStop(form.StartDownload);
198
+            //    form.AddLog("下载离线数据成功!");
199
+            //}
200
+
201
+        }
202
+
203
+        public void onGetPenColor(short Data)
204
+        {
205
+            //if (form.PenAttribute != null) form.PenAttribute.SetLEDComBox(Data);
206
+            //switch (Data)
207
+            //{
208
+            //    case 1:
209
+            //        form.timing.SetPenColor(Color.Blue);
210
+            //        break;
211
+            //    case 2:
212
+            //        form.timing.SetPenColor(Color.Green);
213
+            //        break;
214
+            //    case 3:
215
+            //        form.timing.SetPenColor(Color.Cyan);
216
+            //        break;
217
+            //    case 4:
218
+            //        form.timing.SetPenColor(Color.Red);
219
+            //        break;
220
+            //    case 5:
221
+            //        form.timing.SetPenColor(Color.Magenta);
222
+            //        break;
223
+            //    case 6:
224
+            //        form.timing.SetPenColor(Color.Yellow);
225
+            //        break;
226
+            //    case 7:
227
+            //        form.timing.SetPenColor(Color.Black);
228
+            //        break;
229
+            //    default:
230
+            //        break;
231
+            //}
232
+
233
+        }
234
+        /// <summary>
235
+        /// 获取笔名
236
+        /// </summary>
237
+        /// <param name="localName"></param>
238
+        public void onGetPenLocalName(string localName)
239
+        {
240
+            //if (form.PenAttribute != null) form.PenAttribute.SetNameTextString(localName);
241
+            //form.AddLog("当前笔名:" + localName + "!");
242
+        }
243
+
244
+        public void onGetPressureCalibrationData(uint LData, uint HData)
245
+        {
246
+
247
+        }
248
+
249
+        private DateTime ConvertLongToDateTime(long d)
250
+        {
251
+            DateTime dtStart = Convert.ToDateTime("1970-1-1");
252
+            long lTime = long.Parse(d.ToString());
253
+            TimeSpan toNow = new TimeSpan(lTime);
254
+            DateTime dtResult = dtStart.AddSeconds(lTime);
255
+            return dtResult;
256
+            // return dtResult;
257
+        }
258
+
259
+        public void onGetRTC(long Data)
260
+        {
261
+            //DateTime time = ConvertLongToDateTime(Data);
262
+            //if (form.PenAttribute != null) form.PenAttribute.SetRTCTextString(time.ToString("yyyy-MM-dd HH:mm:ss"));
263
+            //form.AddLog("当前RTC:" + time.ToString("yyyy-MM-dd HH:mm:ss") + "!");
264
+        }
265
+
266
+        public void onGetSensitivityLevel(short Data)
267
+        {
268
+            //ConnectPen = true;
269
+            //if (form.PenAttribute != null) form.PenAttribute.SetSevComBox(Data);
270
+            //form.AddLog("当前压力敏感度:" + Data.ToString() + "!");
271
+        }
272
+        /// <summary>
273
+        /// 内存使用量
274
+        /// </summary>
275
+        /// <param name="Data"></param>
276
+        public void onGetUsedMemory(short Data)
277
+        {
278
+            //if (form.PenAttribute != null) form.PenAttribute.SetmemTextString(Data.ToString());
279
+            //form.AddLog("当前使用内存为:" + Data.ToString() + "!");
280
+        }
281
+        /// <summary>
282
+        /// 获取蓝牙适配器连接状态
283
+        /// </summary>
284
+        /// <param name="bReady"></param>
285
+        public void onHIDGetReady(bool bReady)
286
+        {
287
+            //if (bReady)
288
+            //{
289
+            //    form.AddLog("蓝牙适配器已连接!");
290
+            //}
291
+            //else
292
+            //{
293
+            //    form.AddLog("蓝牙适配器已断开连接!");
294
+            //}
295
+        }
296
+
297
+        public void onPauseOfflineData(bool bSuccess)
298
+        {
299
+
300
+        }
301
+
302
+        /// <summary>
303
+        /// 书写点
304
+        /// </summary>
305
+        /// <param name="dot"></param>
306
+        /// <param name="count"></param>
307
+        public void onReceiveDot(Dot dot, int count)
308
+        {
309
+            if (InToType == 1)
310
+            {
311
+                //录制模式
312
+                if (dot.type == DotType.PEN_HOVER)
313
+                {
314
+                    return;
315
+                }
316
+                else if (dot.type == DotType.PEN_DOWN)
317
+                {
318
+                    APP.W_XHMicroLessonSystemWindow.TQLDown();
319
+                }
320
+                else if (dot.type == DotType.PEN_UP)
321
+                {
322
+                    APP.W_XHMicroLessonSystemWindow.TQLUp();
323
+                }
324
+                else if (dot.type == DotType.PEN_MOVE)
325
+                {
326
+                    double CX = (double)dot.x + (double)dot.fx / 100.00;
327
+                    double CY = (double)dot.y + (double)dot.fy / 100.00;
328
+                    APP.W_XHMicroLessonSystemWindow.TQLPenWrite(CX, CY, dot.force);
329
+                    //form.AddLog("x:" + (dot.x + dot.fx / 100f).ToString() + ", " + "y:" + (dot.y + dot.fy / 100f).ToString());
330
+                }
331
+            }
332
+            else if(InToType == 2)
333
+            {
334
+                //录屏模式
335
+                if (dot.type == DotType.PEN_HOVER)
336
+                {
337
+                    return;
338
+                }
339
+                else if (dot.type == DotType.PEN_DOWN)
340
+                {
341
+                    APP.W_PracticeWindow.TQLDown();
342
+                }
343
+                else if (dot.type == DotType.PEN_UP)
344
+                {
345
+                    APP.W_PracticeWindow.TQLUp();
346
+                }
347
+                else if (dot.type == DotType.PEN_MOVE)
348
+                {
349
+                    double CX = (double)dot.x + (double)dot.fx / 100.00;
350
+                    double CY = (double)dot.y + (double)dot.fy / 100.00;
351
+                    APP.W_PracticeWindow.TQLPenWrite(CX, CY, dot.force);
352
+                    //form.AddLog("x:" + (dot.x + dot.fx / 100f).ToString() + ", " + "y:" + (dot.y + dot.fy / 100f).ToString());
353
+                }
354
+            }
355
+            ////可用于分页使用
356
+            //if (this.S != dot.sectionId || this.O != dot.ownerId || this.B != dot.noteId || this.P != dot.pageId)
357
+            //{
358
+            //    this.S = dot.sectionId; this.O = dot.ownerId; this.B = dot.noteId; this.P = dot.pageId;
359
+            //    //form.AddLog("Dot_S:" + this.S.ToString() + ", " + "Dot_O:" + this.O.ToString() + ", " + "Dot_B:" + this.B.ToString() + ", " + "Dot_P:" + this.P.ToString());
360
+            //}
361
+
362
+
363
+
364
+            //if (dot.type == DotType.PEN_HOVER) return;
365
+            //if (this.S != dot.sectionId || this.O != dot.ownerId || this.B != dot.noteId || this.P != dot.pageId)
366
+            //{
367
+            //    this.S = dot.sectionId; this.O = dot.ownerId; this.B = dot.noteId; this.P = dot.pageId;
368
+            //    //form.AddLog("Dot_S:" + this.S.ToString() + ", " + "Dot_O:" + this.O.ToString() + ", " + "Dot_B:" + this.B.ToString() + ", " + "Dot_P:" + this.P.ToString());
369
+            //}
370
+            //if (ShowPointLog == true)
371
+            //{
372
+            //    //form.AddLog("x:" + (dot.x + dot.fx / 100f).ToString() + ", " + "y:" + (dot.y + dot.fy / 100f).ToString());
373
+            //}
374
+
375
+
376
+            ///*  if (dot.type == DotType.PEN_DOWN || dot.type == DotType.PEN_MOVE || dot.type == DotType.PEN_UP)
377
+            //  {
378
+            //      form.AddLog("Dot_type:" + dot.type.ToString() + ", " + "Dot_force:" + dot.force.ToString());
379
+            //  } */
380
+
381
+
382
+            ////if (DrawingBox.DrawType != 2) DrawingBox.DrawType = 1;
383
+            ////form.Drawing(dot);
384
+            //if (DrawIngend == true)
385
+            //{
386
+            //    StartRecvDataTimer1();
387
+            //}
388
+            ///* long unixTimeStamp = (long)(dot.timeLong - 28800000);//1478162177;
389
+            // System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(2010, 1, 1)); // 当地时区
390
+            // DateTime dt = startTime.AddMilliseconds(unixTimeStamp);
391
+            // form.AddLog("ON:" + dt.ToString("MM/dd HH:mm:ss.fff"));*/
392
+        }
393
+        /// <summary>
394
+        /// 接收脱机数据
395
+        /// </summary>
396
+        /// <param name="dot"></param>
397
+        /// <param name="count"></param>
398
+        public void onReceiveOfflineData(Dot dot, int count)
399
+        {
400
+            //if (form.StartDownload == false)
401
+            //{
402
+            //    Manager.StopDownloadOfflineData();
403
+            //    return;
404
+            //}
405
+            //if (this.S != dot.sectionId || this.O != dot.ownerId || this.B != dot.noteId || this.P != dot.pageId)
406
+            //{
407
+            //    this.S = dot.sectionId; this.O = dot.ownerId; this.B = dot.noteId; this.P = dot.pageId;
408
+            //    form.AddLog("Dot_S:" + this.S.ToString() + ", " + "Dot_O:" + this.O.ToString() + ", " + "Dot_B:" + this.B.ToString() + ", " + "Dot_P:" + this.P.ToString());
409
+            //}
410
+
411
+            ///*long unixTimeStamp = (long)(dot.timeLong - 28800000);//1478162177;
412
+            //System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(2010, 1, 1)); // 当地时区
413
+            //DateTime dt = startTime.AddMilliseconds(unixTimeStamp);
414
+            //form.AddLog("OFF:" + dt.ToString("MM/dd HH:mm:ss.fff"));
415
+            //*/
416
+
417
+            ///* DateTime tmp = new System.DateTime(2010, 1, 1);
418
+            // tmp.AddMilliseconds(dot.timeLong);
419
+            // form.AddLog("TIME:" + tmp.ToString("MM/dd HH:mm:ss"));*/
420
+
421
+            //// form.AddLog("TIME:" + dot.timeLong.ToString());
422
+
423
+            //if (DrawingBox.DrawType != 2) DrawingBox.DrawType = 3;
424
+            //form.Drawing(dot);
425
+        }
426
+
427
+        public void onReceiveOriginalDot(Dot dot, int count)
428
+        {
429
+            //form.Drawing(dot);
430
+        }
431
+
432
+        public void onRemoveOfflineData(bool bRemoved)
433
+        {
434
+            //if (bRemoved)
435
+            //{
436
+
437
+            //    form.AddLog("删除离线数据成功!");
438
+            //    form.StartDownload = false;
439
+            //    form.ContinueDownload = true;
440
+            //    form.DrawOffType = -1;
441
+            //}
442
+            //else form.AddLog("删除离线数据失败!");
443
+        }
444
+
445
+        public void onSetAutoPowerOffTime(bool bsuccess)
446
+        {
447
+
448
+            //if (bsuccess) form.AddLog("设置自动休眠时间成功!");
449
+            //else form.AddLog("设置自动休眠时间失败!");
450
+        }
451
+
452
+        public void onSetAutoPowerOnMode(bool bsuccess)
453
+        {
454
+            //if (bsuccess) form.AddLog("设置笔的唤醒模式成功!");
455
+            //else form.AddLog("设置笔的唤醒模式失败!");
456
+        }
457
+
458
+        public void onSetBeepStatus(bool bsuccess)
459
+        {
460
+            //if (bsuccess) form.AddLog("设置蜂鸣器成功!");
461
+            //else form.AddLog("设置蜂鸣器失败!");
462
+        }
463
+
464
+        public void onSetCustomerID(bool bsuccess)
465
+        {
466
+
467
+        }
468
+
469
+        public void onSetElementCode(bool bSuccess)
470
+        {
471
+
472
+        }
473
+
474
+        public void onSetPenColor(bool bsuccess)
475
+        {
476
+            //if (Form1.SetColor == false) return;
477
+            //Form1.SetColor = false;
478
+            //if (bsuccess) form.AddLog("设置笔LED灯颜色成功!");
479
+            //else form.AddLog("设置笔LED灯颜色失败!");
480
+        }
481
+
482
+        public void onSetPenLocalName(bool bsuccess)
483
+        {
484
+            //if (bsuccess) form.AddLog("设置笔名成功!");
485
+            //else form.AddLog("设置笔名失败!");
486
+        }
487
+
488
+        public void onSetSensitivityLevel(bool bsuccess)
489
+        {
490
+            //if (bsuccess) form.AddLog("设置压力敏感度成功!");
491
+            //else form.AddLog("设置压力敏感度失败!");
492
+        }
493
+
494
+        public void onStartDownloadOfflineData(bool bStart)
495
+        {
496
+
497
+        }
498
+
499
+        public void onStopDownloadOfflineData(bool bStart)
500
+        {
501
+
502
+        }
503
+
504
+        public void onWriteRTC(bool bsuccess)
505
+        {
506
+            //if (bsuccess)
507
+            //{
508
+            //    form.AddLog("设置RTC成功!");
509
+            //    Manager.GetRTC();
510
+            //}
511
+            //else form.AddLog("设置RTC失败!");
512
+        }
513
+
514
+
515
+        public void DownloadOfflineDataRate(float Rate)
516
+        {
517
+            //form.SetProGress(Rate);
518
+        }
519
+
520
+        public void onGetMCUFCode(string strData)
521
+        {
522
+            //if (form.PenAttribute != null) form.PenAttribute.SetMcuCodeTextString(strData);
523
+            //form.AddLog("MCU序列号:" + strData + "!");
524
+        }
525
+
526
+        public void OnGetPenCodeType(uint oType)
527
+        {
528
+
529
+        }
530
+
531
+        public void onSetPenHover(byte type)
532
+        {
533
+            //if (type == 1)
534
+            //{
535
+            //    form.AddLog("设置悬浮打开!");
536
+            //    form.PenAttribute.SetHoverComBox(0);
537
+            //}
538
+            //else if (type == 0)
539
+            //{
540
+            //    form.AddLog("设置悬浮关闭!");
541
+            //    form.PenAttribute.SetHoverComBox(1);
542
+            //}
543
+        }
544
+    }
545
+}

+ 125
- 0
XHWK.WKTool/TQLPen/Pentiming.cs View File

@@ -0,0 +1,125 @@
1
+using System;
2
+using System.Collections;
3
+using System.Collections.Generic;
4
+using System.Drawing;
5
+using System.Linq;
6
+using System.Text;
7
+using System.Threading.Tasks;
8
+
9
+using TQLComm;
10
+
11
+namespace XHWK.WKTool
12
+{
13
+    public struct PenData
14
+    {
15
+        public int PenWidth;
16
+        public Color PenColor;
17
+        public Dot dot;
18
+        public PenData(int PenWidth, Color PenColor, Dot dot)
19
+        {
20
+            this.PenWidth = PenWidth;
21
+            this.PenColor = PenColor;
22
+            this.dot = new Dot(dot);
23
+        }
24
+
25
+        public PenData(PenData Data)
26
+        {
27
+            this.PenWidth = Data.PenWidth;
28
+            this.PenColor = Data.PenColor;
29
+            this.dot = new Dot(Data.dot);
30
+        }
31
+
32
+    }
33
+
34
+    public class DrawBezierInfo
35
+    {
36
+        public float g_x0 = 0, g_x1 = 0, g_x2 = 0, g_x3 = 0;
37
+        public float g_y0 = 0, g_y1 = 0, g_y2 = 0, g_y3 = 0;
38
+        public float g_p0 = 0, g_p1 = 0, g_p2 = 0, g_p3 = 0;
39
+        public float g_vx01 = 0, g_vy01 = 0, g_n_x0 = 0, g_n_y0 = 0;
40
+        public float g_vx21 = 0, g_vy21 = 0;
41
+        public float g_norm = 0;
42
+        public float g_n_x2 = 0, g_n_y2 = 0;
43
+        public int DrawIndex = 0;
44
+        public void clear()
45
+        {
46
+            g_x0 = 0; g_x1 = 0; g_x2 = 0; g_x3 = 0;
47
+            g_y0 = 0; g_y1 = 0; g_y2 = 0; g_y3 = 0;
48
+            g_p0 = 0; g_p1 = 0; g_p2 = 0; g_p3 = 0;
49
+            g_vx01 = 0; g_vy01 = 0; g_n_x0 = 0; g_n_y0 = 0;
50
+            g_vx21 = 0; g_vy21 = 0;
51
+            g_norm = 0;
52
+            g_n_x2 = 0; g_n_y2 = 0;
53
+            DrawIndex = 0;
54
+
55
+        }
56
+    }
57
+
58
+    public class Pentiming
59
+    {
60
+        int Width = 5;
61
+        int PenWidth = 5;
62
+        Color PenColor = Color.Black;
63
+        public ArrayList DotData = new ArrayList();
64
+
65
+        //public DrawingBox Drawing = null;
66
+        public long DrawIndex = 0;
67
+
68
+        public DrawBezierInfo BoxBezierInfo = new DrawBezierInfo();
69
+        public DrawBezierInfo ImageBezierInfo = new DrawBezierInfo();
70
+
71
+        //Form1 from = null;
72
+
73
+        public Pentiming()//(PictureBox Box, Form1 from)
74
+        {
75
+            //this.from = from;
76
+            //Drawing = new DrawingBox(Box, from);
77
+        }
78
+        public void SetPenWidth(int Raio)
79
+        {
80
+            this.PenWidth = Width * Raio;
81
+        }
82
+
83
+        public void SetPenColor(Color PenColor)
84
+        {
85
+            this.PenColor = PenColor;
86
+        }
87
+
88
+        public void DrawImaging(Dot dot)
89
+        {
90
+
91
+            PenData data = new PenData(this.PenWidth, this.PenColor, dot);
92
+
93
+            //from.timed.DotData.Add(data);
94
+            //if (DrawingBox.DrawType == 2) return;
95
+            //Drawing.Drawdot(data, ref BoxBezierInfo, ref ImageBezierInfo);
96
+        }
97
+
98
+        public void SetgScale(float gScale)
99
+        {
100
+            //Drawing.SetgScale(gScale);
101
+        }
102
+
103
+        //public Image GetImage()
104
+        //{
105
+        //    return Drawing.GetImage();
106
+        //}
107
+
108
+        public void Seep(int sp)
109
+        {
110
+            //Drawing.Seep(sp);
111
+        }
112
+
113
+        public void clear()
114
+        {
115
+
116
+            DrawIndex = 0;
117
+            BoxBezierInfo.clear();
118
+            ImageBezierInfo.clear();
119
+            DotData.Clear();
120
+            //Drawing.clear();
121
+        }
122
+
123
+
124
+    }
125
+}

+ 171
- 27
XHWK.WKTool/XHMicroLessonSystemWindow.xaml.cs View File

@@ -28,6 +28,8 @@ using System.Windows.Media;
28 28
 using System.Windows.Media.Imaging;
29 29
 using System.Windows.Threading;
30 30
 
31
+using TQLComm;
32
+
31 33
 using TStudyDigitalPen.HID;
32 34
 
33 35
 using XHWK.Model;
@@ -197,6 +199,7 @@ namespace XHWK.WKTool
197 199
             Initialize();
198 200
             InitPen();
199 201
             InitlbPen();
202
+            InitTQLPPen();
200 203
         }
201 204
         /// <summary>
202 205
         /// 初始化
@@ -4357,7 +4360,7 @@ namespace XHWK.WKTool
4357 4360
         /// <summary>
4358 4361
         /// 笔画坐标数组
4359 4362
         /// </summary>
4360
-        private List<System.Drawing.Point> stroke;
4363
+        //private List<System.Drawing.Point> stroke;
4361 4364
 
4362 4365
         /// <summary>
4363 4366
         /// 笔序列号
@@ -4378,7 +4381,7 @@ namespace XHWK.WKTool
4378 4381
         #endregion
4379 4382
         public void InitPen()
4380 4383
         {
4381
-            stroke = new List<System.Drawing.Point>();
4384
+            //stroke = new List<System.Drawing.Point>();
4382 4385
             //获取点阵笔实例,并绑定点阵笔事件
4383 4386
             //将授权文件内容传入,获取点阵笔对象实例
4384 4387
             APP.digitalPen = DigitalPenHID.GetInstance(certificates.MyLicense.Bytes);
@@ -4512,7 +4515,7 @@ namespace XHWK.WKTool
4512 4515
                 //    int to = stroke.Count - 1;
4513 4516
                 //    DrawCoordinates(from, to);
4514 4517
                 //}
4515
-                stroke.Clear();
4518
+                //stroke.Clear();
4516 4519
             }
4517 4520
             if (APP.pageData.currpage > 0)
4518 4521
             {
@@ -4647,13 +4650,13 @@ namespace XHWK.WKTool
4647 4650
                 {
4648 4651
                     return;
4649 4652
                 }
4650
-                stroke.Add(new System.Drawing.Point(cx, cy));
4653
+                //stroke.Add(new System.Drawing.Point(cx, cy));
4651 4654
 
4652 4655
                 double PropW = blackboard_canvas.ActualWidth / A4_WIDTH;
4653 4656
                 double PropH = blackboard_canvas.ActualHeight / A4_HEIGHT;
4654 4657
                 //点
4655
-                double testX = cx * PropW;
4656
-                double testY = cy * PropH;
4658
+                double tempX = cx * PropW;
4659
+                double tempY = cy * PropH;
4657 4660
                 //pageSerial //点阵IP地址  与打印的页面关联
4658 4661
                 if (APP.pageData.currpage > 0)
4659 4662
                 {
@@ -4661,16 +4664,16 @@ namespace XHWK.WKTool
4661 4664
                     {
4662 4665
                         float Pressure = force / 100f;
4663 4666
                         //myblackboard.changepages(testX, testY,false);
4664
-                        myblackboard.changepages(testX, testY, false, Color, PenSize, APP.pageData.currpage - 1, Pressure);
4667
+                        myblackboard.changepages(tempX, tempY, false, Color, PenSize, APP.pageData.currpage - 1, Pressure);
4665 4668
                         #region 设置滚动条位置
4666 4669
 
4667 4670
                         //点在显示页面上方
4668
-                        if (testY < scroMain.VerticalOffset)
4671
+                        if (tempY < scroMain.VerticalOffset)
4669 4672
                         {
4670 4673
                             //滚动条当前位置
4671 4674
                             double RollCurrentLocation = scroMain.VerticalOffset;
4672 4675
                             //向上滚动至以点为中心需要滚动的距离  
4673
-                            double UpRoll = (RollCurrentLocation - testY) + (scroMain.ActualHeight / 2);
4676
+                            double UpRoll = (RollCurrentLocation - tempY) + (scroMain.ActualHeight / 2);
4674 4677
                             //如果小于0则等于0
4675 4678
                             double RollLocation = RollCurrentLocation - UpRoll;
4676 4679
                             if (RollLocation < 0)
@@ -4682,12 +4685,12 @@ namespace XHWK.WKTool
4682 4685
                             scroMain.ScrollToVerticalOffset(RollLocation);
4683 4686
                         }
4684 4687
                         //点在显示页面下方
4685
-                        if (testY > scroMain.VerticalOffset + scroMain.ActualHeight)
4688
+                        if (tempY > scroMain.VerticalOffset + scroMain.ActualHeight)
4686 4689
                         {
4687 4690
                             //滚动条当前位置
4688 4691
                             double RollCurrentLocation = scroMain.VerticalOffset;
4689 4692
                             //向下滚动至以点为中心需要滚动的距离  
4690
-                            double DownRoll = (testY - RollCurrentLocation) - (scroMain.ActualHeight / 2);
4693
+                            double DownRoll = (tempY - RollCurrentLocation) - (scroMain.ActualHeight / 2);
4691 4694
                             //如果小于0则等于0
4692 4695
                             double RollLocation = RollCurrentLocation + DownRoll;
4693 4696
                             //滚动条最大滚动值
@@ -4707,10 +4710,10 @@ namespace XHWK.WKTool
4707 4710
                         //scroMain.ScrollToHorizontalOffset()//设置滚动条位置
4708 4711
 
4709 4712
                         //Mouse.GetPosition(this)
4710
-                        if (testX > 0 && testY > 0)
4713
+                        if (tempX > 0 && tempY > 0)
4711 4714
                         {
4712 4715
                             //System.Windows.Point getP = blackboard_canvas.PointToScreen(new System.Windows.Point(testX, testY));
4713
-                            System.Windows.Point getP = scroMain.PointToScreen(new System.Windows.Point(testX, testY - scroMain.VerticalOffset));
4716
+                            System.Windows.Point getP = scroMain.PointToScreen(new System.Windows.Point(tempX, tempY - scroMain.VerticalOffset));
4714 4717
                             SetCursorPos((int)getP.X, (int)getP.Y);
4715 4718
                         }
4716 4719
                     }));
@@ -5080,11 +5083,14 @@ namespace XHWK.WKTool
5080 5083
         /// <param name="bPress"></param>
5081 5084
         private void Form1_bigDataReportEvt1(byte bIndex, byte bPenStatus, short bx, short by, short bPress)
5082 5085
         {
5083
-
5086
+            if (bx == 0 && by == 0 && bPenStatus == 0 && bPress == 0)
5087
+            {
5088
+                return;
5089
+            }
5084 5090
             //17是按下,16是抬起
5085 5091
             if (bPenStatus == 16|| bPenStatus==0)
5086 5092
             {
5087
-                stroke.Clear();
5093
+                //stroke.Clear();
5088 5094
                 if (APP.pageData.currpage > 0)
5089 5095
                 {
5090 5096
                     Dispatcher.Invoke(new Action(() =>
@@ -5102,13 +5108,13 @@ namespace XHWK.WKTool
5102 5108
             //    LogHelper.WriteInfoLog(string.Format(@"x={0},y={1},s={2},p={3}", bx, by, bPenStatus, bPress));
5103 5109
             //}
5104 5110
 
5105
-            stroke.Add(new System.Drawing.Point(by, bx));
5111
+            //stroke.Add(new System.Drawing.Point(by, bx));
5106 5112
 
5107 5113
             double PropW = blackboard_canvas.ActualWidth / m_nDeviceH;
5108 5114
             double PropH = blackboard_canvas.ActualHeight / m_nDeviceW;
5109 5115
             //点
5110
-            double testY = (m_nDeviceW - bx) * PropH;
5111
-            double testX = by * PropW;
5116
+            double tempY = (m_nDeviceW - bx) * PropH;
5117
+            double tempX = by * PropW;
5112 5118
             //pageSerial //点阵IP地址  与打印的页面关联
5113 5119
             if (APP.pageData.currpage > 0)
5114 5120
             {
@@ -5119,17 +5125,17 @@ namespace XHWK.WKTool
5119 5125
 
5120 5126
                     if (bPress > 0)
5121 5127
                     {
5122
-                        myblackboard.changepages(testX, testY, false, Color, PenSize, APP.pageData.currpage - 1, Pressure);
5128
+                        myblackboard.changepages(tempX, tempY, false, Color, PenSize, APP.pageData.currpage - 1, Pressure);
5123 5129
                     }
5124 5130
                     #region 设置滚动条位置
5125 5131
 
5126 5132
                     //点在显示页面上方
5127
-                    if (testY < scroMain.VerticalOffset)
5133
+                    if (tempY < scroMain.VerticalOffset)
5128 5134
                     {
5129 5135
                         //滚动条当前位置
5130 5136
                         double RollCurrentLocation = scroMain.VerticalOffset;
5131 5137
                         //向上滚动至以点为中心需要滚动的距离  
5132
-                        double UpRoll = (RollCurrentLocation - testY) + (scroMain.ActualHeight / 2);
5138
+                        double UpRoll = (RollCurrentLocation - tempY) + (scroMain.ActualHeight / 2);
5133 5139
                         //如果小于0则等于0
5134 5140
                         double RollLocation = RollCurrentLocation - UpRoll;
5135 5141
                         if (RollLocation < 0)
@@ -5141,12 +5147,12 @@ namespace XHWK.WKTool
5141 5147
                         scroMain.ScrollToVerticalOffset(RollLocation);
5142 5148
                     }
5143 5149
                     //点在显示页面下方
5144
-                    if (testY > scroMain.VerticalOffset + scroMain.ActualHeight)
5150
+                    if (tempY > scroMain.VerticalOffset + scroMain.ActualHeight)
5145 5151
                     {
5146 5152
                         //滚动条当前位置
5147 5153
                         double RollCurrentLocation = scroMain.VerticalOffset;
5148 5154
                         //向下滚动至以点为中心需要滚动的距离  
5149
-                        double DownRoll = (testY - RollCurrentLocation) - (scroMain.ActualHeight / 2);
5155
+                        double DownRoll = (tempY - RollCurrentLocation) - (scroMain.ActualHeight / 2);
5150 5156
                         //如果小于0则等于0
5151 5157
                         double RollLocation = RollCurrentLocation + DownRoll;
5152 5158
                         //滚动条最大滚动值
@@ -5160,10 +5166,10 @@ namespace XHWK.WKTool
5160 5166
                         scroMain.ScrollToVerticalOffset(RollLocation);
5161 5167
                     }
5162 5168
                     #endregion
5163
-                    if (testX > 0 && testY > 0)
5169
+                    if (tempX > 0 && tempY > 0)
5164 5170
                     {
5165 5171
                         //System.Windows.Point getP = blackboard_canvas.PointToScreen(new System.Windows.Point(testX, testY));
5166
-                        System.Windows.Point getP = scroMain.PointToScreen(new System.Windows.Point(testX, testY - scroMain.VerticalOffset));
5172
+                        System.Windows.Point getP = scroMain.PointToScreen(new System.Windows.Point(tempX, tempY - scroMain.VerticalOffset));
5167 5173
                         SetCursorPos((int)getP.X, (int)getP.Y);
5168 5174
                     }
5169 5175
                 }));
@@ -5340,9 +5346,9 @@ namespace XHWK.WKTool
5340 5346
         /// <summary>
5341 5347
         /// 更新设备状态显示
5342 5348
         /// </summary>
5343
-        void UpdateDevStatus()
5349
+        public void UpdateDevStatus()
5344 5350
         {
5345
-            if (APP.BoardStatus && APP.PenStatus)
5351
+            if (APP.BoardStatus && (APP.PenStatus||APP.TQLPenStatus))
5346 5352
             {
5347 5353
                 Dispatcher.Invoke(new Action(() =>
5348 5354
                 {
@@ -5366,6 +5372,14 @@ namespace XHWK.WKTool
5366 5372
                     txbNotConnecteds.Text = "智能笔";
5367 5373
                 }));
5368 5374
             }
5375
+            else if (APP.TQLPenStatus)
5376
+            {
5377
+                Dispatcher.Invoke(new Action(() =>
5378
+                {
5379
+                    txbNotConnected.Text = "点阵笔";
5380
+                    txbNotConnecteds.Text = "点阵笔";
5381
+                }));
5382
+            }
5369 5383
             else
5370 5384
             {
5371 5385
                 Dispatcher.Invoke(new Action(() =>
@@ -5377,6 +5391,136 @@ namespace XHWK.WKTool
5377 5391
         }
5378 5392
         #endregion
5379 5393
 
5394
+        #region 腾千里手写笔
5395
+        /// <summary>
5396
+        /// 是否在书写
5397
+        /// </summary>
5398
+        bool isTQLPenDown = false;
5399
+        /// <summary>
5400
+        /// TQL点阵笔宽高
5401
+        /// </summary>
5402
+        static float TQLA4_WIDTH = (float)1075 / (float)150 * (float)25.4 / (float)1.524; //OID4
5403
+        static float TQLA4_HEIGHT = (float)1512 / (float)150 * (float)25.4 / (float)1.524;
5404
+        /// <summary>
5405
+        /// 初始化
5406
+        /// </summary>
5407
+        public void InitTQLPPen()
5408
+        {
5409
+            if (APP.TQLPenevents == null)
5410
+            {
5411
+                APP.TQLPenevents = new PenEvents(1);
5412
+            }
5413
+            else
5414
+            {
5415
+                APP.TQLPenevents.InToType = 1;
5416
+            }
5417
+        }
5418
+        /// <summary>
5419
+        /// 笔落下
5420
+        /// </summary>
5421
+        public void TQLDown()
5422
+        {
5423
+            isTQLPenDown = true;
5424
+
5425
+            if (APP.pageData.currpage > 0)
5426
+            {
5427
+                Dispatcher.Invoke(new Action(() =>
5428
+                {
5429
+                    myblackboard.changepages(0, 0, true, Color, PenSize, APP.pageData.currpage - 1, 0);
5430
+                }));
5431
+            }
5432
+        }
5433
+        /// <summary>
5434
+        /// 笔抬起
5435
+        /// </summary>
5436
+        public void TQLUp()
5437
+        {
5438
+            isTQLPenDown = false;
5439
+            //stroke.Clear();
5440
+            if (APP.pageData.currpage > 0)
5441
+            {
5442
+                Dispatcher.Invoke(new Action(() =>
5443
+                {
5444
+                    myblackboard.changepages(0, 0, true, Color, PenSize, APP.pageData.currpage - 1, 0);
5445
+                }));
5446
+            }
5447
+        }
5448
+        /// <summary>
5449
+        /// 笔书写
5450
+        /// </summary>
5451
+        /// <param name="cx"></param>
5452
+        /// <param name="cy"></param>
5453
+        /// <param name="force"></param>
5454
+        public void TQLPenWrite(double cx, double cy, int force)
5455
+        {
5456
+            //判断是否是落笔后输出的坐标,在设置悬浮模式下,落笔前的悬浮坐标不绘制
5457
+            if (!isTQLPenDown)
5458
+            {
5459
+                return;
5460
+            }
5461
+            double PropW = blackboard_canvas.ActualWidth / TQLA4_WIDTH;
5462
+            double PropH = blackboard_canvas.ActualHeight / TQLA4_HEIGHT;
5463
+            //点
5464
+            double tempX = cx * PropW;
5465
+            double tempY = cy * PropH;
5466
+
5467
+            if (APP.pageData.currpage > 0)
5468
+            {
5469
+                Dispatcher.Invoke(new Action(() =>
5470
+                {
5471
+                    //0~1023,亦即有 1024 阶供应用软件后续应用之用,如笔锋笔触,暂无用
5472
+                    float Pressure = (float)force / 1023f;
5473
+                    myblackboard.changepages(tempX, tempY, false, Color, PenSize, APP.pageData.currpage - 1, Pressure);
5474
+                    #region 设置滚动条位置
5475
+
5476
+                    //点在显示页面上方
5477
+                    if (tempY < scroMain.VerticalOffset)
5478
+                    {
5479
+                        //滚动条当前位置
5480
+                        double RollCurrentLocation = scroMain.VerticalOffset;
5481
+                        //向上滚动至以点为中心需要滚动的距离  
5482
+                        double UpRoll = (RollCurrentLocation - tempY) + (scroMain.ActualHeight / 2);
5483
+                        //如果小于0则等于0
5484
+                        double RollLocation = RollCurrentLocation - UpRoll;
5485
+                        if (RollLocation < 0)
5486
+                        {
5487
+                            RollLocation = 0;
5488
+                        }
5489
+                        ////滚动条实际偏移量
5490
+                        //double RollOffset = RollCurrentLocation - RollLocation;
5491
+                        scroMain.ScrollToVerticalOffset(RollLocation);
5492
+                    }
5493
+                    //点在显示页面下方
5494
+                    if (tempY > scroMain.VerticalOffset + scroMain.ActualHeight)
5495
+                    {
5496
+                        //滚动条当前位置
5497
+                        double RollCurrentLocation = scroMain.VerticalOffset;
5498
+                        //向下滚动至以点为中心需要滚动的距离  
5499
+                        double DownRoll = (tempY - RollCurrentLocation) - (scroMain.ActualHeight / 2);
5500
+                        //如果小于0则等于0
5501
+                        double RollLocation = RollCurrentLocation + DownRoll;
5502
+                        //滚动条最大滚动值
5503
+                        double ScrollbarMaxNum = gridM.ActualHeight - scroMain.ActualHeight;
5504
+                        if (RollLocation > ScrollbarMaxNum)
5505
+                        {
5506
+                            RollLocation = ScrollbarMaxNum;
5507
+                        }
5508
+                        ////滚动条实际偏移量
5509
+                        //double RollOffset = RollLocation-RollCurrentLocation;
5510
+                        scroMain.ScrollToVerticalOffset(RollLocation);
5511
+                    }
5512
+                    #endregion
5513
+
5514
+                    if (tempX > 0 && tempY > 0)
5515
+                    {
5516
+                        System.Windows.Point getP = scroMain.PointToScreen(new System.Windows.Point(tempX, tempY - scroMain.VerticalOffset));
5517
+                        SetCursorPos((int)getP.X, (int)getP.Y);
5518
+                    }
5519
+                }));
5520
+            }
5521
+        }
5522
+        #endregion
5523
+
5380 5524
         #region 图片拉伸移动
5381 5525
         private System.Windows.Point initialPoint;
5382 5526
 

+ 20
- 0
XHWK.WKTool/XHWK.WKTool.csproj View File

@@ -105,6 +105,10 @@
105 105
     <Reference Include="System.Xaml">
106 106
       <RequiredTargetFramework>4.0</RequiredTargetFramework>
107 107
     </Reference>
108
+    <Reference Include="TQLComm, Version=3.0.6.0, Culture=neutral, processorArchitecture=x86">
109
+      <SpecificVersion>False</SpecificVersion>
110
+      <HintPath>..\Common\dlls\TQLComm.dll</HintPath>
111
+    </Reference>
108 112
     <Reference Include="TStudy.DigitalPen, Version=3.0.0.0, Culture=neutral, processorArchitecture=x86">
109 113
       <SpecificVersion>False</SpecificVersion>
110 114
       <HintPath>..\Common\dlls\TStudy.DigitalPen.dll</HintPath>
@@ -189,6 +193,8 @@
189 193
     <Compile Include="ScreenRecordingToolbarWindow.xaml.cs">
190 194
       <DependentUpon>ScreenRecordingToolbarWindow.xaml</DependentUpon>
191 195
     </Compile>
196
+    <Compile Include="TQLPen\PenEvents.cs" />
197
+    <Compile Include="TQLPen\Pentiming.cs" />
192 198
     <Compile Include="UControl\Uc_VideoItem.xaml.cs">
193 199
       <DependentUpon>Uc_VideoItem.xaml</DependentUpon>
194 200
     </Compile>
@@ -1637,5 +1643,19 @@
1637 1643
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
1638 1644
     </EmbeddedResource>
1639 1645
   </ItemGroup>
1646
+  <ItemGroup>
1647
+    <EmbeddedResource Include="CheckPoint.dll">
1648
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
1649
+    </EmbeddedResource>
1650
+    <EmbeddedResource Include="RobotDotMatrix.dll">
1651
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
1652
+    </EmbeddedResource>
1653
+    <EmbeddedResource Include="RobotUsbWrapper.dll">
1654
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
1655
+    </EmbeddedResource>
1656
+    <EmbeddedResource Include="SonixUSB.dll">
1657
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
1658
+    </EmbeddedResource>
1659
+  </ItemGroup>
1640 1660
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
1641 1661
 </Project>

Loading…
Cancel
Save