Browse Source

zhao:增加腾千里手写笔,增加图标

master
耀 3 years ago
parent
commit
a23bdc84b3

+ 15
- 11
XHPZ.Desktop/APP.cs View File

21
     {
21
     {
22
         #region 全局变量
22
         #region 全局变量
23
         /// <summary>
23
         /// <summary>
24
+        /// 是否输出测试记录日志
25
+        /// </summary>
26
+        public static bool IsOutputInfoLog = FileToolsCommon.GetConfigValue("IsOutputInfoLog") != "0";
27
+        /// <summary>
24
         /// 后台线程帮助类
28
         /// 后台线程帮助类
25
         /// </summary>
29
         /// </summary>
26
         public static BackgroundWorkerHelper BackgroundWorkerHelper => BackgroundWorkerHelper.GetInstance();
30
         public static BackgroundWorkerHelper BackgroundWorkerHelper => BackgroundWorkerHelper.GetInstance();
44
         public static bool BoardStatus = false;
48
         public static bool BoardStatus = false;
45
         #endregion
49
         #endregion
46
         #region 腾千里手写笔
50
         #region 腾千里手写笔
47
-        ///// <summary>
48
-        ///// 腾千里手写笔事件
49
-        ///// </summary>
50
-        //public static PenEvents TQLPenevents;
51
-        ///// <summary>
52
-        ///// 腾千里手写笔是否已连接
53
-        ///// </summary>
54
-        //public static bool TQLPenStatus = false;
55
-        #endregion
56
-        #region 页面
57
         /// <summary>
51
         /// <summary>
58
-        /// 批注
52
+        /// 腾千里手写笔事件
53
+        /// </summary>
54
+        public static PenEvents TQLPenevents;
55
+        /// <summary>
56
+        /// 腾千里手写笔是否已连接
59
         /// </summary>
57
         /// </summary>
58
+        public static bool TQLPenStatus = false;
59
+        #endregion
60
+        #region 页面
61
+        ///// <summary>
62
+        ///// 批注
63
+        ///// </summary>
60
         //public static PracticeWindow W_PracticeWindow = null;
64
         //public static PracticeWindow W_PracticeWindow = null;
61
         #endregion
65
         #endregion
62
         #endregion
66
         #endregion

+ 4
- 0
XHPZ.Desktop/App.config View File

3
     <startup> 
3
     <startup> 
4
         <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
4
         <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
5
     </startup>
5
     </startup>
6
+  <appSettings>
7
+      <!--是否输出其他测试日志-->
8
+      <add key="IsOutputInfoLog" value="1"/>
9
+  </appSettings>
6
 </configuration>
10
 </configuration>

BIN
XHPZ.Desktop/Images/144.png View File


BIN
XHPZ.Desktop/Images/192.png View File


BIN
XHPZ.Desktop/Images/72.png View File


BIN
XHPZ.Desktop/Images/96.png View File


+ 37
- 0
XHPZ.Desktop/MessageWindow.xaml View File

1
+<Window x:Class="XHPZ.Desktop.MessageWindow"
2
+        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3
+        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4
+        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
5
+        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
6
+        xmlns:local="clr-namespace:XHPZ.Desktop"
7
+        mc:Ignorable="d" 
8
+        Title="星火微课" WindowStartupLocation="CenterScreen"
9
+    WindowStyle="None" AllowsTransparency="True"    WindowState="Normal"
10
+    ShowInTaskbar="False"  Topmost="True" ResizeMode="NoResize" 
11
+        d:DesignHeight="250" Width="600" Height="220"  MouseMove="Window_MouseMove"  BorderThickness="7">
12
+    <Window.Effect>
13
+        <DropShadowEffect BlurRadius="10" Color="#bababa" Direction="80" ShadowDepth="0"/>
14
+    </Window.Effect>
15
+    <Grid>
16
+        <Grid.RowDefinitions>
17
+            <RowDefinition Height="50"/>
18
+            <RowDefinition Height="100*"/>
19
+            <RowDefinition Height="70"/>
20
+        </Grid.RowDefinitions>
21
+        <Grid Grid.Row="0">
22
+            <Label x:Name="lblTitle" Content="提示" HorizontalAlignment="Left" Margin="14,10,0,0" VerticalAlignment="Top" Foreground="#FF333333" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" FontSize="20" FontWeight="Bold"/>
23
+        </Grid>
24
+        <Grid Grid.Row="1">
25
+            <TextBlock x:Name="tbkContent" Margin="20,0,20,0" TextWrapping="Wrap" VerticalAlignment="Center" FontSize="20" Foreground="#FF919191" Grid.Row="1" HorizontalAlignment="Center" Text=""/>
26
+        </Grid>
27
+        <Grid Grid.Row="2" Margin="0,0,0,0">
28
+            <Border x:Name="borOk" Background="#2D8CF0" CornerRadius="6" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0,0,30,20">
29
+                <Button x:Name="BtnOK" Width="104" Height="42" Content="确定" FontSize="20"  Background="#00000000"  BorderBrush="{x:Null}" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Foreground="White"  Cursor="Hand" Click="BtnOK_Click" IsDefault="True"/>
30
+            </Border>
31
+            <Border x:Name="borCancel" Background="#E5E5E5" CornerRadius="6"  HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0,0,150,20">
32
+                <Button x:Name="BtnCancel" Width="104" Height="42" Content="取消" FontSize="20" Background="#00000000" BorderBrush="{x:Null}"  Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"  Cursor="Hand" Click="BtnCancel_Click"/>
33
+            </Border>
34
+        </Grid>
35
+
36
+    </Grid>
37
+</Window>

+ 147
- 0
XHPZ.Desktop/MessageWindow.xaml.cs View File

1
+using System.Windows;
2
+using System.Windows.Input;
3
+
4
+namespace XHPZ.Desktop
5
+{
6
+    /// <summary>
7
+    /// MessageWindow.xaml 的交互逻辑
8
+    /// </summary>
9
+    public partial class MessageWindow : Window
10
+    {
11
+        /// <summary>
12
+        /// 提示框
13
+        /// </summary>
14
+        /// <param name="MessageType">取消按钮  1不显示2显示</param>
15
+        /// <param name="Title">标题</param>
16
+        /// <param name="content">消息内容</param>
17
+        public MessageWindow(int MessageType, string Title, string Content)
18
+        {
19
+            InitializeComponent();
20
+            switch (MessageType)
21
+            {
22
+                case 1:
23
+                    borCancel.Visibility = Visibility.Hidden;
24
+                    break;
25
+                case 2:
26
+                    borCancel.Visibility = Visibility.Visible;
27
+                    break;
28
+                default:
29
+                    break;
30
+            }
31
+            lblTitle.Content = Title;
32
+            if (!string.IsNullOrWhiteSpace(Content))
33
+            {
34
+                if (Content.Length > 143)
35
+                {
36
+                    Content = Content.Substring(0, 140) + "...";
37
+                }
38
+                tbkContent.Text = Content;
39
+            }
40
+            else
41
+            {
42
+                tbkContent.Text = "错误!";
43
+            }
44
+        }
45
+        /// <summary>
46
+        /// 取消
47
+        /// </summary>
48
+        /// <param name="sender"></param>
49
+        /// <param name="e"></param>
50
+        private void BtnCancel_Click(object sender, RoutedEventArgs e)
51
+        {
52
+            DialogResult = false;
53
+        }
54
+        /// <summary>
55
+        /// 确定
56
+        /// </summary>
57
+        /// <param name="sender"></param>
58
+        /// <param name="e"></param>
59
+        private void BtnOK_Click(object sender, RoutedEventArgs e)
60
+        {
61
+            DialogResult = true;
62
+        }
63
+        /// <summary>
64
+        /// 消息提示框
65
+        /// </summary>
66
+        /// <param name="Message">消息</param>
67
+        /// <returns></returns>
68
+        public static MessageBoxResult Show(string Message)
69
+        {
70
+            string Title = "消息提示";
71
+            return Show(Message, Title);
72
+        }
73
+        /// <summary>
74
+        /// 消息提示框
75
+        /// </summary>
76
+        /// <param name="Message">消息</param>
77
+        /// <returns></returns>
78
+        public static MessageBoxResult Show(string Message, string Title)
79
+        {
80
+            MessageWindow message = new MessageWindow(1, Title, Message);
81
+            message.ShowDialog();
82
+            return MessageBoxResult.Cancel;
83
+        }
84
+        /// <summary>
85
+        /// 消息提示框
86
+        /// </summary>
87
+        /// <param name="Title">标题</param>
88
+        /// <param name="Message">消息</param>
89
+        /// <returns></returns>
90
+        public static MessageBoxResult Show(string Message, string Title, MessageBoxButton messageBox)
91
+        {
92
+            if (string.IsNullOrWhiteSpace(Title))
93
+            {
94
+                Title = "消息提示";
95
+            }
96
+            MessageWindow message = new MessageWindow(2, Title, Message);
97
+            bool? res = message.ShowDialog();
98
+            if ((bool)res)
99
+            {
100
+                if (messageBox == MessageBoxButton.OKCancel)
101
+                {
102
+                    return MessageBoxResult.OK;
103
+                }
104
+                else
105
+                {
106
+                    return MessageBoxResult.Yes;
107
+                }
108
+            }
109
+            else
110
+            {
111
+                if (messageBox == MessageBoxButton.OKCancel)
112
+                {
113
+                    return MessageBoxResult.Cancel;
114
+                }
115
+                else
116
+                {
117
+                    return MessageBoxResult.No;
118
+                }
119
+            }
120
+        }
121
+        private static MessageBoxResult Win32ToMessageBoxResult(int value)
122
+        {
123
+            switch (value)
124
+            {
125
+                case 1:
126
+                    return MessageBoxResult.OK;
127
+                case 2:
128
+                    return MessageBoxResult.Cancel;
129
+                case 6:
130
+                    return MessageBoxResult.Yes;
131
+                case 7:
132
+                    return MessageBoxResult.No;
133
+                default:
134
+                    return MessageBoxResult.No;
135
+            }
136
+        }
137
+
138
+        private void Window_MouseMove(object sender, MouseEventArgs e)
139
+        {
140
+            if (e.LeftButton == MouseButtonState.Pressed)
141
+            {
142
+                //this.DragMove();              
143
+                DragMove();
144
+            }
145
+        }
146
+    }
147
+}

+ 481
- 0
XHPZ.Desktop/TQLPen/PenEvents.cs View File

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

+ 125
- 0
XHPZ.Desktop/TQLPen/Pentiming.cs View File

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 XHPZ.Desktop
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
+}

+ 22
- 6
XHPZ.Desktop/XHPZ.Desktop.csproj View File

43
   <PropertyGroup>
43
   <PropertyGroup>
44
     <ApplicationManifest>Properties\app.manifest</ApplicationManifest>
44
     <ApplicationManifest>Properties\app.manifest</ApplicationManifest>
45
   </PropertyGroup>
45
   </PropertyGroup>
46
+  <PropertyGroup>
47
+    <ApplicationIcon>xhpz.ico</ApplicationIcon>
48
+  </PropertyGroup>
46
   <ItemGroup>
49
   <ItemGroup>
47
     <Reference Include="log4net">
50
     <Reference Include="log4net">
48
       <HintPath>..\Common\dlls\log4net.dll</HintPath>
51
       <HintPath>..\Common\dlls\log4net.dll</HintPath>
49
     </Reference>
52
     </Reference>
50
     <Reference Include="System" />
53
     <Reference Include="System" />
51
     <Reference Include="System.Data" />
54
     <Reference Include="System.Data" />
55
+    <Reference Include="System.Drawing" />
52
     <Reference Include="System.Xml" />
56
     <Reference Include="System.Xml" />
53
     <Reference Include="Microsoft.CSharp" />
57
     <Reference Include="Microsoft.CSharp" />
54
     <Reference Include="System.Core" />
58
     <Reference Include="System.Core" />
69
     <Reference Include="PresentationFramework" />
73
     <Reference Include="PresentationFramework" />
70
   </ItemGroup>
74
   </ItemGroup>
71
   <ItemGroup>
75
   <ItemGroup>
76
+    <Compile Include="TQLPen\PenEvents.cs" />
77
+    <Compile Include="TQLPen\Pentiming.cs" />
72
     <Page Include="MainWindow.xaml">
78
     <Page Include="MainWindow.xaml">
73
       <Generator>MSBuild:Compile</Generator>
79
       <Generator>MSBuild:Compile</Generator>
74
       <SubType>Designer</SubType>
80
       <SubType>Designer</SubType>
78
       <DependentUpon>MainWindow.xaml</DependentUpon>
84
       <DependentUpon>MainWindow.xaml</DependentUpon>
79
       <SubType>Code</SubType>
85
       <SubType>Code</SubType>
80
     </Compile>
86
     </Compile>
87
+    <Page Include="MessageWindow.xaml">
88
+      <Generator>MSBuild:Compile</Generator>
89
+      <SubType>Designer</SubType>
90
+    </Page>
81
   </ItemGroup>
91
   </ItemGroup>
82
   <ItemGroup>
92
   <ItemGroup>
93
+    <Compile Include="MessageWindow.xaml.cs">
94
+      <DependentUpon>MessageWindow.xaml</DependentUpon>
95
+    </Compile>
83
     <Compile Include="Properties\AssemblyInfo.cs">
96
     <Compile Include="Properties\AssemblyInfo.cs">
84
       <SubType>Code</SubType>
97
       <SubType>Code</SubType>
85
     </Compile>
98
     </Compile>
116
     <EmbeddedResource Include="CheckPoint.dll">
129
     <EmbeddedResource Include="CheckPoint.dll">
117
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
130
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
118
     </EmbeddedResource>
131
     </EmbeddedResource>
119
-    <EmbeddedResource Include="RobotDotMatrix.dll">
120
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
121
-    </EmbeddedResource>
122
-    <EmbeddedResource Include="RobotUsbWrapper.dll">
123
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
124
-    </EmbeddedResource>
125
     <EmbeddedResource Include="SonixUSB.dll">
132
     <EmbeddedResource Include="SonixUSB.dll">
126
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
133
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
127
     </EmbeddedResource>
134
     </EmbeddedResource>
128
   </ItemGroup>
135
   </ItemGroup>
136
+  <ItemGroup>
137
+    <Resource Include="Images\144.png" />
138
+    <Resource Include="Images\192.png" />
139
+    <Resource Include="Images\72.png" />
140
+    <Resource Include="Images\96.png" />
141
+  </ItemGroup>
142
+  <ItemGroup>
143
+    <Resource Include="xhpz.ico" />
144
+  </ItemGroup>
129
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
145
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
130
 </Project>
146
 </Project>

BIN
XHPZ.Desktop/xhpz.ico View File


Loading…
Cancel
Save