Browse Source

页面全部搭建完成

ZhangXueYang
zhangxueyang 3 years ago
parent
commit
1c3d01f3ce
87 changed files with 7492 additions and 425 deletions
  1. 1
    0
      Common/Common.csproj
  2. 114
    0
      Common/system/BackgroundWorkerHelper.cs
  3. 60
    264
      Common/system/BlackboardNew.cs
  4. 29
    0
      Common/system/ImageHelper.cs
  5. 0
    1
      Common/system/JsonHelper.cs
  6. 5
    0
      XHZB.Desktop/App.config
  7. 173
    7
      XHZB.Desktop/App.cs
  8. 244
    0
      XHZB.Desktop/AttendanceWindow.xaml
  9. 52
    0
      XHZB.Desktop/AttendanceWindow.xaml.cs
  10. BIN
      XHZB.Desktop/Images/Blackboard/class_1s.png
  11. BIN
      XHZB.Desktop/Images/Blackboard/class_1un.png
  12. BIN
      XHZB.Desktop/Images/Blackboard/class_2s.png
  13. BIN
      XHZB.Desktop/Images/Blackboard/class_2un.png
  14. BIN
      XHZB.Desktop/Images/Blackboard/class_3s.png
  15. BIN
      XHZB.Desktop/Images/Blackboard/class_3un.png
  16. BIN
      XHZB.Desktop/Images/Blackboard/class_4s.png
  17. BIN
      XHZB.Desktop/Images/Blackboard/class_4un.png
  18. BIN
      XHZB.Desktop/Images/Blackboard/class_5s.png
  19. BIN
      XHZB.Desktop/Images/Blackboard/class_5un.png
  20. BIN
      XHZB.Desktop/Images/Blackboard/class_6un.png
  21. BIN
      XHZB.Desktop/Images/Blackboard/class_7un.png
  22. BIN
      XHZB.Desktop/Images/Blackboard/class_c1.png
  23. BIN
      XHZB.Desktop/Images/Blackboard/class_p1.png
  24. BIN
      XHZB.Desktop/Images/Blackboard/class_p2.png
  25. BIN
      XHZB.Desktop/Images/Blackboard/class_p3.png
  26. BIN
      XHZB.Desktop/Images/Blackboard/class_s1.png
  27. BIN
      XHZB.Desktop/Images/Blackboard/class_s2.png
  28. BIN
      XHZB.Desktop/Images/Blackboard/class_s3.png
  29. BIN
      XHZB.Desktop/Images/Blackboard/class_s4.png
  30. BIN
      XHZB.Desktop/Images/Blackboard/class_s5.png
  31. BIN
      XHZB.Desktop/Images/Blackboard/class_s6.png
  32. BIN
      XHZB.Desktop/Images/Blackboard/erase.png
  33. BIN
      XHZB.Desktop/Images/Blackboard/pen.png
  34. BIN
      XHZB.Desktop/Images/Login/account copy 2@2x.png
  35. BIN
      XHZB.Desktop/Images/Login/data copy 2@2x.png
  36. BIN
      XHZB.Desktop/Images/Login/login2_0.png
  37. BIN
      XHZB.Desktop/Images/Login/login2_0_1.png
  38. BIN
      XHZB.Desktop/Images/Login/login2_1.png
  39. BIN
      XHZB.Desktop/Images/Login/logo.png
  40. BIN
      XHZB.Desktop/Images/Login/logo@2x.png
  41. BIN
      XHZB.Desktop/Images/Login/智慧校园.png
  42. BIN
      XHZB.Desktop/Images/Login/智慧校园@2x.png
  43. BIN
      XHZB.Desktop/Images/Login/组 1(1).png
  44. BIN
      XHZB.Desktop/Images/Login/组 1.png
  45. BIN
      XHZB.Desktop/Images/Login/组 1@2x(1).png
  46. BIN
      XHZB.Desktop/Images/Login/组 1@2x.png
  47. BIN
      XHZB.Desktop/Images/Login/设置@2x.png
  48. BIN
      XHZB.Desktop/Images/RollCall/rollCall_2.png
  49. BIN
      XHZB.Desktop/Images/RollCall/rollCall_2_1.png
  50. 238
    0
      XHZB.Desktop/LoadDialog.xaml
  51. 4
    15
      XHZB.Desktop/LoadDialog.xaml.cs
  52. 470
    0
      XHZB.Desktop/LoginWindow.xaml
  53. 933
    0
      XHZB.Desktop/LoginWindow.xaml.cs
  54. 0
    12
      XHZB.Desktop/MainWindow.xaml
  55. 273
    0
      XHZB.Desktop/PracticeWindow.xaml
  56. 539
    0
      XHZB.Desktop/PracticeWindow.xaml.cs
  57. 48
    0
      XHZB.Desktop/RollCallPerfectionWindow.xaml
  58. 93
    0
      XHZB.Desktop/RollCallPerfectionWindow.xaml.cs
  59. 352
    0
      XHZB.Desktop/RollCallWindow.xaml
  60. 985
    0
      XHZB.Desktop/RollCallWindow.xaml.cs
  61. 1
    1
      XHZB.Desktop/ToolbarWindow.xaml
  62. 501
    121
      XHZB.Desktop/ToolbarWindow.xaml.cs
  63. 304
    0
      XHZB.Desktop/Utils/BlackboardNew.cs
  64. 220
    0
      XHZB.Desktop/Utils/GenericTypeConverter.cs
  65. 236
    0
      XHZB.Desktop/Utils/RegisterController.cs
  66. 17
    0
      XHZB.Desktop/Utils/ResultVo.cs
  67. 13
    0
      XHZB.Desktop/Utils/ZCache.cs
  68. 18
    0
      XHZB.Desktop/Utils/ZDelayUtil.cs
  69. 100
    4
      XHZB.Desktop/XHZB.Desktop.csproj
  70. 306
    0
      XHZB.Desktop/ZBlackboardWindow.xaml
  71. 528
    0
      XHZB.Desktop/ZBlackboardWindow.xaml.cs
  72. 1
    0
      XHZB.Desktop/packages.config
  73. 35
    0
      XHZB.Model/ClassListModel.cs
  74. 49
    0
      XHZB.Model/ClassStudentListModel.cs
  75. 14
    0
      XHZB.Model/ComboBoxBeanModel.cs
  76. 111
    0
      XHZB.Model/DirectorListModel.cs
  77. 89
    0
      XHZB.Model/LoginModel.cs
  78. 23
    0
      XHZB.Model/OnlineUserModel.cs
  79. 72
    0
      XHZB.Model/REQStartClassModel.cs
  80. 17
    0
      XHZB.Model/RollCallModel.cs
  81. 36
    0
      XHZB.Model/SavefileModel.cs
  82. 46
    0
      XHZB.Model/TsubjectbookListModel.cs
  83. 14
    0
      XHZB.Model/XHZB.Model.csproj
  84. 29
    0
      XHZB.Model/ZBMenuModel.cs
  85. 37
    0
      XHZB.Model/ZBPageModel.cs
  86. 32
    0
      XHZB.Model/ZWsBodyVo.cs
  87. 30
    0
      XHZB.Model/ZWsMsgVo.cs

+ 1
- 0
Common/Common.csproj View File

@@ -118,6 +118,7 @@
118 118
   <ItemGroup>
119 119
     <Compile Include="AESHelper.cs" />
120 120
     <Compile Include="Model\DownloadInfoModel.cs" />
121
+    <Compile Include="system\BackgroundWorkerHelper.cs" />
121 122
     <Compile Include="system\DataProvider.cs" />
122 123
     <Compile Include="system\KeyboardHookCommon.cs" />
123 124
     <Compile Include="system\MouseEventCommon.cs" />

+ 114
- 0
Common/system/BackgroundWorkerHelper.cs View File

@@ -0,0 +1,114 @@
1
+using System;
2
+using System.ComponentModel;
3
+using System.Threading;
4
+
5
+namespace Common.system
6
+{
7
+    /// <summary>
8
+    /// 后台线程帮助类
9
+    /// </summary>
10
+    public class BackgroundWorkerHelper : IDisposable
11
+    {
12
+        private static BackgroundWorkerHelper backgroundWorkerHelper = null;
13
+
14
+        public static BackgroundWorkerHelper GetInstance()
15
+        {
16
+            if (backgroundWorkerHelper == null)
17
+            {
18
+                backgroundWorkerHelper = new BackgroundWorkerHelper();
19
+            }
20
+            return backgroundWorkerHelper;
21
+        }
22
+
23
+        private BackgroundWorker backWorker = null;
24
+        private Func<object> func = null;
25
+        private Action<object> actionComplate = null;
26
+
27
+        public BackgroundWorkerHelper()
28
+        {
29
+            backWorker = new BackgroundWorker();
30
+            backWorker.DoWork += new DoWorkEventHandler(backWorker_DoWork);
31
+            backWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(backWorker_RunWorkerCompleted);
32
+        }
33
+
34
+        private void backWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
35
+        {
36
+            currentThread = null;
37
+
38
+            if (e.Error != null)
39
+            {
40
+                throw e.Error;
41
+            }
42
+            if (actionComplate != null)
43
+            {
44
+                actionComplate(e.Result);
45
+            }
46
+        }
47
+
48
+        private void backWorker_DoWork(object sender, DoWorkEventArgs e)
49
+        {
50
+            currentThread = Thread.CurrentThread;
51
+
52
+            if (func != null)
53
+            {
54
+                if (func != null)
55
+                {
56
+                    e.Result = func();
57
+                }
58
+            }
59
+        }
60
+
61
+        /// <summary>
62
+        /// 启动异步线程
63
+        /// </summary>
64
+        /// <param name="func">在异步执行的方法</param>
65
+        /// <param name="action">方法完成后</param>
66
+        public void RunWorkerAsync(Func<object> func, Action<object> action)
67
+        {
68
+            if (!backWorker.IsBusy)
69
+            {
70
+                this.func = func;
71
+                actionComplate = action;
72
+                backWorker.RunWorkerAsync();
73
+            }
74
+        }
75
+
76
+        private Thread currentThread = null;
77
+
78
+        /// <summary>
79
+        /// 强制中断
80
+        /// </summary>
81
+        public void Abort()
82
+        {
83
+            if (currentThread != null && backWorker.IsBusy)
84
+            {
85
+                currentThread.Abort();
86
+                currentThread = null;
87
+
88
+                backWorker.DoWork -= backWorker_DoWork;
89
+                backWorker.RunWorkerCompleted -= backWorker_RunWorkerCompleted;
90
+                backWorker.Dispose();
91
+
92
+                backWorker = new BackgroundWorker();
93
+                backWorker.DoWork += backWorker_DoWork;
94
+                backWorker.RunWorkerCompleted += backWorker_RunWorkerCompleted;
95
+                func = null;
96
+                actionComplate = null;
97
+            }
98
+        }
99
+
100
+        #region IDisposable 成员
101
+
102
+        /// <summary>
103
+        /// 释放资源
104
+        /// </summary>
105
+        public void Dispose()
106
+        {
107
+            actionComplate = null;
108
+            func = null;
109
+            backWorker.Dispose();
110
+        }
111
+
112
+        #endregion IDisposable 成员
113
+    }
114
+}

+ 60
- 264
Common/system/BlackboardNew.cs View File

@@ -14,22 +14,12 @@ namespace Common.system
14 14
         Pen = 1,
15 15
         Erase = 2
16 16
     };
17
-    /// <summary>
18
-    /// 画板线模型
19
-    /// </summary>
17
+
20 18
     internal class ZBBPage
21 19
     {
22
-        /// <summary>
23
-        /// 线
24
-        /// </summary>
25 20
         public List<ZBBPageStep> lines { get; set; }
26
-        /// <summary>
27
-        /// 历史记录
28
-        /// </summary>
29 21
         public List<ZBBPageStep> lines_histoty { get; set; }
30
-        /// <summary>
31
-        /// 画板模型
32
-        /// </summary>
22
+
33 23
         public ZBBPage()
34 24
         {
35 25
             lines = new List<ZBBPageStep>();
@@ -50,50 +40,34 @@ namespace Common.system
50 40
             lines_remove = new StrokeCollection();
51 41
         }
52 42
     }
53
-    public class BlackboardNew
43
+
44
+    public class ZJBlackboardNew
54 45
     {
55 46
         private InkCanvas m_canvas;
56 47
 
57 48
         //private ZPenType type = ZPenType.Pen;
58
-        /// <summary>
59
-        /// 当前页索引
60
-        /// </summary>
61 49
         private int pagenum = 0;
62
-        /// <summary>
63
-        /// 橡皮大小
64
-        /// </summary>
50
+
65 51
         private readonly int erasesize = 64;
66
-        /// <summary>
67
-        /// 笔粗细
68
-        /// </summary>
69 52
         private readonly int pensize = 3;
70
-        /// <summary>
71
-        /// 是否在进行撤销恢复操作
72
-        /// </summary>
73
-        private int undoOrRedo = 0;
74
-        /// <summary>
75
-        /// 笔颜色
76
-        /// </summary>
53
+        private int undoOrRedo = 0; //是否在进行撤销恢复操作
77 54
         private Color pencolor;
78
-        /// <summary>
79
-        /// 所有画板线
80
-        /// </summary>
55
+
81 56
         private readonly List<ZBBPage> strokes_page_all = new List<ZBBPage>();
82 57
 
83 58
         // 添加这个变量是因为在用橡皮擦时 一次操作会触发多次StrokesChanged回掉 这里是把多次回掉合并在一起
84 59
         private ZBBPageStep step = null;
85 60
 
86
-        public BlackboardNew(InkCanvas canvas)
61
+        public ZJBlackboardNew(InkCanvas canvas)
87 62
         {
88 63
             init(canvas, Colors.White);
89 64
         }
90 65
 
91
-        public BlackboardNew(InkCanvas canvas, Color _pencolor)
66
+        public ZJBlackboardNew(InkCanvas canvas, Color _pencolor)
92 67
         {
93 68
             init(canvas, _pencolor);
94 69
         }
95 70
 
96
-        private DrawingAttributes drawingAttributes;
97 71
         private void init(InkCanvas canvas, Color _pencolor)
98 72
         {
99 73
             m_canvas = canvas;
@@ -104,7 +78,9 @@ namespace Common.system
104 78
             if (canvas != null)
105 79
             {
106 80
                 canvas.EditingMode = InkCanvasEditingMode.Ink;
107
-                drawingAttributes = new DrawingAttributes();
81
+                canvas.UseCustomCursor = true;
82
+                canvas.Cursor = Cursors.Pen;
83
+                DrawingAttributes drawingAttributes = new DrawingAttributes();
108 84
                 canvas.DefaultDrawingAttributes = drawingAttributes;
109 85
                 drawingAttributes.Width = pensize;
110 86
                 drawingAttributes.Height = pensize;
@@ -136,35 +112,12 @@ namespace Common.system
136 112
         {
137 113
             if (step != null)
138 114
             {
139
-                if (pagenum + 1 > strokes_page_all.Count)
140
-                {
141
-                    ZBBPage pagetemp = new ZBBPage();
142
-                    pagetemp.lines.Add(new ZBBPageStep());
143
-                    strokes_page_all.Add(pagetemp);
144
-                }
145
-
146
-                try
147
-                {
148
-                    ZBBPage page = strokes_page_all[pagenum];
149
-                    if (page != null)
150
-                    {
151
-                        step.lines_curr.Add(m_canvas.Strokes);
152
-                        page.lines.Add(step);
153
-                        step = null;
154
-                    }
155
-                }
156
-                catch (Exception ex)
115
+                ZBBPage page = strokes_page_all[pagenum];
116
+                if (page != null)
157 117
                 {
158
-                    if (strokes_page_all != null)
159
-                    {
160
-                        if (strokes_page_all.Count == 0)
161
-                        {
162
-                            ZBBPage pagetemp = new ZBBPage();
163
-                            pagetemp.lines.Add(new ZBBPageStep());
164
-                            strokes_page_all.Add(pagetemp);
165
-                        }
166
-                    }
167
-                    LogHelper.WriteErrLog("【画板】(Canvas_MouseUp)添加失败,strokes_page_all为0," + ex.Message, ex);
118
+                    step.lines_curr.Add(m_canvas.Strokes);
119
+                    page.lines.Add(step);
120
+                    step = null;
168 121
                 }
169 122
             }
170 123
         }
@@ -194,30 +147,40 @@ namespace Common.system
194 147
                 for (int i = 0; i < e.Removed.Count; i++)
195 148
                 {
196 149
                     Stroke removeItem = e.Removed[i];
197
-                    if (step.lines_add.Contains(removeItem))
150
+                    try
198 151
                     {
199
-                        step.lines_add.Remove(removeItem);
152
+                        if (step.lines_add.Contains(removeItem))
153
+                        {
154
+                            step.lines_add.Remove(removeItem);
155
+                        }
156
+                        else
157
+                        {
158
+                            step.lines_remove.Add(removeItem);
159
+                        }
200 160
                     }
201
-                    else
161
+                    catch (System.Exception ex)
202 162
                     {
203
-                        step.lines_remove.Add(removeItem);
163
+
164
+                        LogHelper.WriteErrLog("【笔迹添加移除事件】(Strokes_StrokesChanged)" + ex.Message, ex);
204 165
                     }
205 166
                 }
206 167
             }
207 168
         }
208 169
 
209 170
         // public方法 笔
210
-        public void change_pen(Color _color)
171
+        public void change_pen(Color _color, int _size)
211 172
         {
212 173
             //this.type = ZPenType.Pen;
213 174
             DrawingAttributes drawingAttributes = new DrawingAttributes();
214 175
             m_canvas.DefaultDrawingAttributes = drawingAttributes;
215 176
             drawingAttributes.Color = _color;
216
-            drawingAttributes.Width = pensize;
217
-            drawingAttributes.Height = pensize;
177
+            drawingAttributes.Width = _size;
178
+            drawingAttributes.Height = _size;
218 179
             drawingAttributes.FitToCurve = true;
219 180
             drawingAttributes.IgnorePressure = false;
220 181
             m_canvas.EditingMode = InkCanvasEditingMode.Ink;
182
+            m_canvas.UseCustomCursor = true;
183
+            m_canvas.Cursor = Cursors.Pen;
221 184
         }
222 185
 
223 186
         // 橡皮
@@ -225,6 +188,7 @@ namespace Common.system
225 188
         {
226 189
             //this.type = ZPenType.Erase;
227 190
             m_canvas.EditingMode = InkCanvasEditingMode.EraseByPoint;
191
+            m_canvas.UseCustomCursor = false;
228 192
             m_canvas.EraserShape = new EllipseStylusShape(erasesize, erasesize, 0);
229 193
         }
230 194
 
@@ -278,39 +242,36 @@ namespace Common.system
278 242
         // 清空
279 243
         public void clear()
280 244
         {
245
+            ZBBPage page = strokes_page_all[pagenum];
246
+            int num = page.lines.Count;
247
+            for (int i = 0; i < num; i++)
248
+            {
249
+                page = strokes_page_all[pagenum];
250
+                if (page != null && m_canvas.Strokes.Count > 0 && page.lines.Count > 1)
251
+                {
252
+                    ZBBPageStep last = page.lines.Last();
253
+                    page.lines.Remove(last);
254
+                    page.lines_histoty.Add(last);
255
+                    if (page.lines.Last().lines_curr.Count > 0)
256
+                    {
257
+                        undoOrRedo = 2;
258
+                    }
259
+                    else
260
+                    {
261
+                        undoOrRedo = 1;
262
+                    }
281 263
 
282
-            //ZBBPage page = new ZBBPage();
283
-            //page.lines.Add(new ZBBPageStep());
284
-            //page.lines = new List<ZBBPageStep>();
285
-            //page.lines_histoty = new List<ZBBPageStep>();
286
-            //strokes_page_all.Add(page);
287
-
288
-            strokes_page_all.Clear();
289
-            m_canvas.Strokes.Clear();
290
-            //for (int i=0;i< strokes_page_all.Count;i++)
291
-            //{
292
-            //    ZBBPage page = strokes_page_all[pagenum];
293
-            //    if (page != null)
294
-            //    {
295
-            //        m_canvas.Strokes.Clear();
296
-            //        page.lines_histoty.Clear();
297
-            //        page.lines.Clear();
298
-            //        page.lines.Add(new ZBBPageStep());
299
-            //    }
300
-            //}
301
-
302
-
264
+                    m_canvas.Strokes.Clear();
265
+                    m_canvas.Strokes.Add(page.lines.Last().lines_curr);
266
+                }
267
+            }
303 268
         }
304
-        /// <summary>
305
-        /// 翻页
306
-        /// </summary>
307
-        /// <param name="mpagenum"></param>
269
+
308 270
         public void changepage(int mpagenum)
309 271
         {
310 272
             if (pagenum != mpagenum)
311 273
             {
312 274
                 pagenum = mpagenum;
313
-                //新增页
314 275
                 if (pagenum >= strokes_page_all.Count)
315 276
                 {
316 277
                     int numadd = pagenum - strokes_page_all.Count + 1;
@@ -323,7 +284,7 @@ namespace Common.system
323 284
                 }
324 285
 
325 286
                 ZBBPage page = strokes_page_all[pagenum];
326
-                if (page != null && page.lines.Count > 0)
287
+                if (page != null)
327 288
                 {
328 289
                     if (page.lines.Last().lines_curr.Count > 0)
329 290
                     {
@@ -334,175 +295,10 @@ namespace Common.system
334 295
                         undoOrRedo += 1;
335 296
                         m_canvas.Strokes.Clear();
336 297
                     }
337
-                    //StrokeCollection strokes = new StrokeCollection();
338
-                    StylusPointCollection stylusPoints = new StylusPointCollection();
339
-                    //System.Windows.Input.StylusPointDescription stylusPointDescription = new StylusPointDescription();
340
-                    StylusPoint stylusPoint = new StylusPoint
341
-                    {
342
-                        X = 580,
343
-                        Y = 212
344
-                    };
345
-                    stylusPoints.Add(stylusPoint);
346
-                    Stroke stroke = new Stroke(stylusPoints);
347
-
348
-                    stylusPoint.X = 581;
349
-                    stylusPoint.Y = 213;
350
-                    stylusPoints.Add(stylusPoint);
351
-                    stroke = new Stroke(stylusPoints);
352
-                    page.lines.Last().lines_curr.Add(stroke);
353
-                    m_canvas.Strokes.Add(page.lines.Last().lines_curr);
354
-                }
355
-            }
356
-        }
357 298
 
358
-        private StylusPointCollection stylusPoints = new StylusPointCollection();
359
-        private StylusPoint stylusPoint = new StylusPoint();
360
-        private Stroke stroke;
361
-        private bool isFirst = true;
362
-        public void changepages(double _x, double _y, bool _new, Color _color, int _size, int i)
363
-        {
364
-            if (_new)
365
-            {
366
-                if (stroke != null && stroke.StylusPoints.Count > 1)
367
-                {
368
-                    isFirst = true;
369
-                    try
370
-                    {
371
-                        if(strokes_page_all.Count<=i)
372
-                        {
373
-                            ZBBPage pagetemp = new ZBBPage();
374
-                            pagetemp.lines.Add(new ZBBPageStep());
375
-                            strokes_page_all.Add(pagetemp);
376
-                        }
377
-                        strokes_page_all[i].lines.Last().lines_curr.Add(stroke);
378
-                    }
379
-                    catch (Exception ex)
380
-                    {
381
-                        if (strokes_page_all != null)
382
-                        {
383
-                            if (strokes_page_all.Count == 0)
384
-                            {
385
-                                ZBBPage pagetemp = new ZBBPage();
386
-                                pagetemp.lines.Add(new ZBBPageStep());
387
-                                strokes_page_all.Add(pagetemp);
388
-                            }
389
-                        }
390
-                        LogHelper.WriteErrLog("【画板】(changepages)添加失败,strokes_page_all为0," + ex.Message, ex);
391
-                    }
392
-                }
393
-                stylusPoints = new StylusPointCollection();
394
-                stylusPoint = new StylusPoint();
395
-                stroke = null;
396
-            }
397
-            else
398
-            {
399
-                if (isFirst)
400
-                {
401
-                    stylusPoint.X = _x;
402
-                    stylusPoint.Y = _y;
403
-                    stylusPoints.Add(stylusPoint);
404
-                    if (stylusPoints.Count > 1)
405
-                    {
406
-                        stroke = new Stroke(stylusPoints);
407
-                        drawingAttributes = new DrawingAttributes
408
-                        {
409
-                            Color = _color,
410
-                            Width = _size * 4.5,
411
-                            Height = _size * 4.5,
412
-                            FitToCurve = true,
413
-                            IgnorePressure = false
414
-                        };
415
-                        stroke.DrawingAttributes = drawingAttributes;
416
-                        m_canvas.Strokes.Add(stroke);
417
-                        isFirst = false;
418
-                    }
419
-                }
420
-                else
421
-                {
422
-                    if (m_canvas.Strokes.Count > 0)
423
-                    {
424
-                        stylusPoint.X = _x;
425
-                        stylusPoint.Y = _y;
426
-                        stylusPoints.Add(stylusPoint);
427
-                        stroke = new Stroke(stylusPoints);
428
-                        drawingAttributes = new DrawingAttributes
429
-                        {
430
-                            Color = _color,
431
-                            Width = _size * 4.5,
432
-                            Height = _size * 4.5,
433
-                            FitToCurve = true,
434
-                            IgnorePressure = false
435
-                        };
436
-                        stroke.DrawingAttributes = drawingAttributes;
437
-                        m_canvas.Strokes[m_canvas.Strokes.Count - 1] = stroke;
438
-                    }
299
+                    m_canvas.Strokes.Add(page.lines.Last().lines_curr);
439 300
                 }
440 301
             }
441 302
         }
442
-
443
-
444
-
445
-
446
-
447
-
448
-
449
-
450
-
451
-
452
-
453
-
454
-
455
-
456
-
457
-
458
-        //public void changepages(double _x, double _y, bool _new, Color _color, int _size, int i)
459
-        //{
460
-        //    try
461
-        //    {
462
-        //        if (_new)
463
-        //        {
464
-        //            if (stroke != null && stroke.StylusPoints.Count > 1)
465
-        //            {
466
-        //                drawingAttributes = new DrawingAttributes();
467
-        //                //m_canvas.DefaultDrawingAttributes = drawingAttributes;
468
-        //                drawingAttributes.Color = _color;
469
-        //                drawingAttributes.Width = _size * 5;
470
-        //                drawingAttributes.Height = _size * 5;
471
-        //                drawingAttributes.FitToCurve = true;
472
-        //                drawingAttributes.IgnorePressure = false;
473
-
474
-        //                stroke.DrawingAttributes = drawingAttributes;
475
-        //                //m_canvas.DefaultDrawingAttributes= drawingAttributes;
476
-
477
-        //                m_canvas.Strokes.Add(stroke);
478
-        //                strokes_page_all[i].lines.Last().lines_curr.Add(stroke);
479
-
480
-        //                //int currCount= strokes_page_all[i].lines.Last().lines_curr.Count;
481
-        //                //if (currCount > 0)
482
-        //                //{
483
-        //                //    strokes_page_all[i].lines.Last().lines_curr[currCount - 1] = stroke;
484
-        //                //}
485
-        //                stroke = null;
486
-        //            }
487
-        //            stylusPoints = new StylusPointCollection();
488
-        //            stylusPoint = new StylusPoint();
489
-        //            //stroke = new Stroke(stylusPoints);
490
-        //            //stroke = null;
491
-        //        }
492
-        //        else
493
-        //        {
494
-        //            //stylusPoints = new StylusPointCollection();
495
-        //            //stylusPoint = new StylusPoint();
496
-        //            stylusPoint.X = _x;
497
-        //            stylusPoint.Y = _y;
498
-        //            stylusPoints.Add(stylusPoint);
499
-        //            stroke = new Stroke(stylusPoints);
500
-        //        }
501
-        //    }
502
-        //    catch (Exception ex)
503
-        //    {
504
-        //        LogHelper.WriteErrLog("【XHMicroLessonSystemWindow】(changepages)点阵比书写报错:" + ex.Message, ex);
505
-        //    }
506
-        //}
507 303
     }
508 304
 }

+ 29
- 0
Common/system/ImageHelper.cs View File

@@ -78,6 +78,35 @@ namespace Common.system
78 78
                 return null;
79 79
             }
80 80
         }
81
+        #region 截屏指定UI控件
82
+        /// <summary>
83
+        /// 保存图片
84
+        /// </summary>
85
+        /// <param name="ui">需要截图的UI控件</param>
86
+        /// <param name="filePathName">图片保存地址 命名 1.png</param>
87
+        /// <param name="width">保存宽</param>
88
+        /// <param name="height">保存高</param>
89
+        public static void SaveUIToImage(FrameworkElement ui, string filePathName, int width, int height)
90
+        {
91
+            try
92
+            {
93
+                System.IO.FileStream fs = new System.IO.FileStream(filePathName, System.IO.FileMode.Create);
94
+                //在位图中呈现UI元素
95
+                RenderTargetBitmap bmp = new RenderTargetBitmap(width, height, 96d, 96d,
96
+                System.Windows.Media.PixelFormats.Pbgra32);
97
+                bmp.Render(ui);
98
+                BitmapEncoder encoder = new PngBitmapEncoder();
99
+                encoder.Frames.Add(BitmapFrame.Create(bmp));
100
+                encoder.Save(fs);
101
+                fs.Close();
102
+            }
103
+            catch (Exception ex)
104
+            {
105
+                LogHelper.WriteErrLog("【UI生成图片】(SaveUIToImage)" + ex.Message, ex);
106
+                //Console.WriteLine(ex.Message);
107
+            }
108
+        }
109
+        #endregion
81 110
         /// <summary>
82 111
         /// 通过FileStream 来打开文件,这样就可以实现不锁定Image文件,到时可以让多用户同时访问Image文件
83 112
         /// </summary>

+ 0
- 1
Common/system/JsonHelper.cs View File

@@ -19,7 +19,6 @@ namespace Common.system
19 19
                 t, Newtonsoft.Json.Formatting.None, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Include }
20 20
                 );
21 21
         }
22
-
23 22
         /// <summary>
24 23
         /// 类对像转换成json格式
25 24
         /// </summary>

+ 5
- 0
XHZB.Desktop/App.config View File

@@ -11,5 +11,10 @@
11 11
     <!--版本号-->
12 12
     <add key="VersionCode" value="1" />
13 13
     <add key="VersionName" value="1.0.1" />
14
+    <!--图片压缩质量 0最差 100最佳-->
15
+    <add key="ImageCompressionLevel" value="100" />
16
+    <add key="userName" value="" />
17
+    <add key="password" value="" />
18
+    <add key="isRemind" value="" />
14 19
   </appSettings>
15 20
 </configuration>

+ 173
- 7
XHZB.Desktop/App.cs View File

@@ -9,6 +9,7 @@ using System.Security.Principal;
9 9
 using System.Threading;
10 10
 using System.Windows;
11 11
 using System.Windows.Threading;
12
+using XHZB.Model;
12 13
 
13 14
 namespace XHZB.Desktop
14 15
 {
@@ -71,6 +72,7 @@ namespace XHZB.Desktop
71 72
         /// </summary>
72 73
         public static string[] OutPut = new string[] { };
73 74
         public static string CameraPosition = string.Empty;
75
+        public static string fileStorageAddress = "";
74 76
         /// <summary>
75 77
         /// 数据存放目录
76 78
         /// </summary>
@@ -79,11 +81,121 @@ namespace XHZB.Desktop
79 81
         /// 是否正在
80 82
         /// </summary>
81 83
         public static bool IsUpLoad = false;
84
+        /// <summary>
85
+        /// 后台线程帮助类
86
+        /// </summary>
87
+        public static BackgroundWorkerHelper BackgroundWorkerHelper => BackgroundWorkerHelper.GetInstance();
88
+        /// <summary>
89
+        /// 提示信息
90
+        /// </summary>
91
+        public static string ErrorMessage = string.Empty; 
92
+        /// <summary>
93
+        /// 服务调用成功代码
94
+        /// </summary>
95
+        public  const int ServerScuessCode = 0;
96
+        public static int classid;
97
+        public static long roomid;
98
+        public static long askid;
99
+
100
+        public static int lsbid;
101
+        /// <summary>
102
+        /// 登陆数据
103
+        /// </summary>
104
+        public static LoginModel LoginUser;
105
+        private static List<ClassListModel> _ClassList;
106
+        /// <summary>
107
+        /// 教师任教班级出参
108
+        /// </summary>
109
+        public static List<ClassListModel> ClassList
110
+        {
111
+            get
112
+            {
113
+                if (_ClassList == null)
114
+                {
115
+                    _ClassList = new List<ClassListModel>();
116
+                }
117
+                return _ClassList;
118
+            }
119
+            set => _ClassList = value;
120
+        }
121
+        private static List<TsubjectbookListModel> _TsubjectbookList;
122
+        /// <summary>
123
+        /// 教师教材列表
124
+        /// </summary>
125
+        public static List<TsubjectbookListModel> TsubjectbookList
126
+        {
127
+            get
128
+            {
129
+                if (_TsubjectbookList == null)
130
+                {
131
+                    _TsubjectbookList = new List<TsubjectbookListModel>();
132
+                }
133
+                return _TsubjectbookList;
134
+            }
135
+            set => _TsubjectbookList = value;
136
+        }
137
+        private static List<DirectorListModel> _DirectorList;
138
+        /// <summary>
139
+        /// 章节列表 出参
140
+        /// </summary>
141
+        public static List<DirectorListModel> DirectorList
142
+        {
143
+            get
144
+            {
145
+                if (_DirectorList == null)
146
+                {
147
+                    _DirectorList = new List<DirectorListModel>();
148
+                }
149
+                return _DirectorList;
150
+            }
151
+            set => _DirectorList = value;
152
+        }
153
+        private static REQStartClassModel _REQStartClass;
154
+        /// <summary>
155
+        /// 开始课堂入参
156
+        /// </summary>
157
+        public static REQStartClassModel REQStartClass
158
+        {
159
+            get
160
+            {
161
+                if (_REQStartClass == null)
162
+                {
163
+                    _REQStartClass = new REQStartClassModel();
164
+                }
165
+                return _REQStartClass;
166
+            }
167
+            set => _REQStartClass = value;
168
+        }
169
+        /// <summary>
170
+        /// 抢答
171
+        /// </summary>
172
+        public static List<RollCallModel> RollCallList = new List<RollCallModel>();
173
+        /// <summary>
174
+        /// 在线用户
175
+        /// </summary>
176
+        public static List<OnlineUserModel> OnlineUserList = new List<OnlineUserModel>();
177
+        private static List<ClassStudentListModel> _ClassStudentList;
178
+        /// <summary>
179
+        /// 班级学生--列表 出参
180
+        /// </summary>
181
+        public static List<ClassStudentListModel> ClassStudentList
182
+        {
183
+            get
184
+            {
185
+                if (_ClassStudentList == null)
186
+                {
187
+                    _ClassStudentList = new List<ClassStudentListModel>();
188
+                }
189
+                return _ClassStudentList;
190
+            }
191
+            set => _ClassStudentList = value;
192
+        }
82 193
         #region 页面
194
+        public static LoadDialog myloading;
83 195
         /// <summary>
84 196
         /// 主页面
85 197
         /// </summary>
86
-        public static MainWindow W_MainWindow = null;
198
+        public static LoginWindow W_LoginWindow = null; 
87 199
         /// <summary>
88 200
         /// 工具栏
89 201
         /// </summary>
@@ -92,13 +204,29 @@ namespace XHZB.Desktop
92 204
         /// 个人空间
93 205
         /// </summary>
94 206
         public static UserCenterWindow W_UserCenterWindow = null;
207
+        /// <summary>
208
+        /// 抢答点名
209
+        /// </summary>
210
+        public static RollCallWindow W_RollCallWindow = null;
211
+        /// <summary>
212
+        /// 考勤
213
+        /// </summary>
214
+        public static AttendanceWindow W_AttendanceWindow = null;
215
+        /// <summary>
216
+        /// 黑板
217
+        /// </summary>
218
+        public static ZBlackboardWindow W_ZBlackboardWindow = null;
219
+        /// <summary>
220
+        /// 批注
221
+        /// </summary>
222
+        public static PracticeWindow W_PracticeWindow = null;
95 223
         #endregion
96 224
         #endregion
97 225
 
98 226
         [STAThread]
99 227
         private static void Main()
100 228
         {
101
-            //myloading = new LoadDialog();
229
+            myloading = new LoadDialog();
102 230
             StopSameProcess();
103 231
             Killffmpeg();
104 232
             try
@@ -127,9 +255,9 @@ namespace XHZB.Desktop
127 255
                         // 定义Application对象作为整个应用程序入口
128 256
                         //Application app = new Application();
129 257
                         //app.Run(wins);
130
-                        W_MainWindow = new MainWindow();
258
+                        W_LoginWindow = new LoginWindow();
131 259
                         Application app = new Application();
132
-                        app.Run(W_MainWindow);
260
+                        app.Run(W_LoginWindow);
133 261
                     }
134 262
                     else
135 263
                     {
@@ -164,9 +292,9 @@ namespace XHZB.Desktop
164 292
                         //Application app = new Application();
165 293
                         //app.Run(wins);
166 294
 
167
-                        W_MainWindow = new MainWindow();
295
+                        W_LoginWindow = new LoginWindow();
168 296
                         Application app = new Application();
169
-                        app.Run(W_MainWindow);
297
+                        app.Run(W_LoginWindow);
170 298
                     }
171 299
                     else
172 300
                     {
@@ -201,7 +329,7 @@ namespace XHZB.Desktop
201 329
                 LogHelper.WriteErrLog(ErrMessage, ex);
202 330
             }
203 331
         }
204
-
332
+    
205 333
         #region 杀死已存在的进程
206 334
         /// <summary>
207 335
         /// 结束已运行的程序
@@ -404,8 +532,46 @@ namespace XHZB.Desktop
404 532
         {
405 533
             testdata = 1;
406 534
         }
535
+        /// <summary>
536
+        /// 图片真实路径
537
+        /// </summary>
538
+        /// <returns></returns>
539
+        public static string classRoomImagePath()
540
+        {
541
+            //string path = $"{nginxHtml}school\\{ZCommonData.loginUser.schoolid}\\class\\{ZCommonData.roomid}\\";
542
+            string path = AppDomain.CurrentDomain.BaseDirectory + "temp\\"; ;
543
+            return path;
544
+        }
545
+
546
+        /// <summary>
547
+        /// 本地服务器存储路径
548
+        /// </summary>
549
+        /// <returns></returns>
550
+        public static string dbImagePath()
551
+        {
552
+            //string path = $"school\\{ZCommonData.loginUser.schoolid}\\class\\{ZCommonData.roomid}\\";
553
+            string path = AppDomain.CurrentDomain.BaseDirectory + "temp\\"; 
554
+            return path;
555
+        }
556
+        /// <summary>
557
+        /// 获取图片保存路径 设置服务器存储路径 创建人:赵耀 创建时间:2020年8月11日
558
+        /// </summary>
559
+        /// <returns></returns>
560
+        public static string GetImagePath(out string ServerSavePath)
561
+        {
562
+            string imagepath = APP.classRoomImagePath();
407 563
 
564
+            if (!Directory.Exists(imagepath))
565
+            {
566
+                Directory.CreateDirectory(imagepath);
567
+            }
568
+            TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
569
+            string timestr = Convert.ToInt64(ts.TotalMilliseconds).ToString();
570
+            string filepath = Path.Combine(imagepath, timestr + ".jpg");
408 571
 
572
+            ServerSavePath = APP.dbImagePath() + timestr + ".jpg";
573
+            return filepath;
574
+        }
409 575
         #endregion
410 576
     }
411 577
 }

+ 244
- 0
XHZB.Desktop/AttendanceWindow.xaml View File

@@ -0,0 +1,244 @@
1
+<Window x:Class="XHZB.Desktop.AttendanceWindow"
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:XHZB.Desktop"
7
+          Width="1066"
8
+    Height="768"
9
+    AllowsTransparency="True"
10
+    Closed="Window_Closed"
11
+    Loaded="Window_Loaded"
12
+   
13
+    ResizeMode="NoResize"
14
+    ShowInTaskbar="False"
15
+    Unloaded="Window_Unloaded"
16
+    WindowStartupLocation="CenterScreen"
17
+    WindowState="Normal"
18
+    WindowStyle="None"
19
+    mc:Ignorable="d" BorderThickness="7">
20
+    <Window.Effect>
21
+        <DropShadowEffect BlurRadius="10" Color="#bababa" Direction="80" ShadowDepth="0"/>
22
+    </Window.Effect>
23
+    <Window.Background>
24
+        <SolidColorBrush Opacity="1" />
25
+    </Window.Background>
26
+    <Window.Resources>
27
+
28
+        <Style x:Key="ListBoxItemStyle1" TargetType="{x:Type ListBoxItem}">
29
+            <Setter Property="FocusVisualStyle" Value="{x:Null}" />
30
+        </Style>
31
+        <Style x:Key="oiliu" TargetType="ListBoxItem">
32
+            <!--  设置控件模板  -->
33
+            <Setter Property="Template">
34
+                <Setter.Value>
35
+                    <ControlTemplate TargetType="ListBoxItem">
36
+                        <Border
37
+                            Margin="4,0,0,0"
38
+                            Padding="0"
39
+                            Background="{TemplateBinding Background}">
40
+                            <ContentPresenter
41
+                                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
42
+                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
43
+                                TextBlock.Foreground="{TemplateBinding Foreground}" />
44
+                        </Border>
45
+                    </ControlTemplate>
46
+                </Setter.Value>
47
+            </Setter>
48
+        </Style>
49
+        <Style x:Key="BigFontButtonStyle" TargetType="Button">
50
+            <Style.Setters>
51
+                <Setter Property="Template">
52
+                    <Setter.Value>
53
+                        <ControlTemplate TargetType="Button">
54
+                            <Border
55
+                                x:Name="border"
56
+                                Padding="4,2"
57
+                                Background="{TemplateBinding Background}"
58
+                                BorderBrush="DarkGray"
59
+                                BorderThickness="1"
60
+                                CornerRadius="3">
61
+                                <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
62
+                            </Border>
63
+                        </ControlTemplate>
64
+                    </Setter.Value>
65
+                </Setter>
66
+            </Style.Setters>
67
+        </Style>
68
+        <DataTemplate x:Key="UserTpl">
69
+            <StackPanel
70
+                Width="109"
71
+                Height="138"
72
+                Background="Transparent">
73
+                <Image
74
+                    Width="113"
75
+                    Height="113"
76
+                    HorizontalAlignment="Center"
77
+                    Source=".\Images\RollCall\attendance_3.png" />
78
+                <StackPanel Margin="0,-115,0,0" Background="Transparent">
79
+                    <Image
80
+                        Width="55"
81
+                        Height="55"
82
+                        Margin="0,10,0,0"
83
+                        VerticalAlignment="Center"
84
+                        Source="{Binding Pic}"
85
+                        Stretch="Fill">
86
+                        <Image.Clip>
87
+                            <EllipseGeometry
88
+                                Center="27.5,27.5"
89
+                                RadiusX="27.5"
90
+                                RadiusY="27.5" />
91
+                        </Image.Clip>
92
+                    </Image>
93
+                    <TextBlock
94
+                        Padding="0,12,0,0"
95
+                        HorizontalAlignment="Center"
96
+                        FontSize="20"
97
+                        Foreground="#3C525B"
98
+                        Text="{Binding Name}" />
99
+                </StackPanel>
100
+            </StackPanel>
101
+        </DataTemplate>
102
+    </Window.Resources>
103
+    <Grid>
104
+        <Image Source=".\Images\RollCall\attendance_0_0_0.png" Stretch="Fill" />
105
+        <Grid Margin="10,15,10,10">
106
+            <Grid.RowDefinitions>
107
+                <RowDefinition Height="70" />
108
+                <RowDefinition Height="100" />
109
+                <RowDefinition Height="*" />
110
+                <RowDefinition Height="95" />
111
+                <RowDefinition Height="64" />
112
+            </Grid.RowDefinitions>
113
+
114
+            <Grid Grid.Row="0" MouseLeftButtonDown="Window_MouseLeftButtonDown_1" HorizontalAlignment="Center">
115
+                <TextBlock  
116
+                Grid.Row="0"
117
+                HorizontalAlignment="Center"
118
+                VerticalAlignment="Center"
119
+                FontSize="30"
120
+                Foreground="White"
121
+                Text="        考勤统计结果        "/>
122
+            </Grid>
123
+
124
+            <StackPanel
125
+                Grid.Row="1"
126
+                Margin="0,0,10,0"
127
+                HorizontalAlignment="Right"
128
+                VerticalAlignment="Center"
129
+                Orientation="Horizontal">
130
+                <TextBlock FontSize="26" Text="考勤人数:" />
131
+                <TextBlock
132
+                    x:Name="txbOnlineUsers"
133
+                    Margin="0,0,0,0"
134
+                    FontSize="31"
135
+                    FontWeight="Black"
136
+                    Foreground="#136EFB"
137
+                    Text="0" />
138
+                <TextBlock
139
+                    Margin="0,0,0,0"
140
+                    FontSize="31"
141
+                    Foreground="#333333"
142
+                    Text="/" />
143
+                <TextBlock
144
+                    x:Name="txbTotalPeople"
145
+                    Margin="0,0,0,0"
146
+                    Padding="0,2,0,0"
147
+                    FontSize="28"
148
+                    Foreground="#333333"
149
+                    Text="0" />
150
+            </StackPanel>
151
+
152
+            <ListBox
153
+                x:Name="toolbar_list"
154
+                Grid.Row="2"
155
+                Margin="5,0,5,0"
156
+                Background="#f3f3f3"
157
+                BorderThickness="0"
158
+                ItemContainerStyle="{DynamicResource oiliu}"
159
+                ItemTemplate="{StaticResource UserTpl}"
160
+                ItemsSource="{Binding menuList}"
161
+                ScrollViewer.HorizontalScrollBarVisibility="Disabled"
162
+                ScrollViewer.VerticalScrollBarVisibility="Disabled">
163
+                <ListBox.Template>
164
+                    <ControlTemplate TargetType="{x:Type ListBox}">
165
+                        <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Hidden">
166
+                            <WrapPanel
167
+                                IsItemsHost="True"
168
+                                Orientation="Horizontal"
169
+                                ScrollViewer.CanContentScroll="True" />
170
+                        </ScrollViewer>
171
+                    </ControlTemplate>
172
+                </ListBox.Template>
173
+            </ListBox>
174
+            <Grid x:Name="gridImg" Grid.Row="2" Visibility="Collapsed">
175
+                <Image x:Name="img"/>
176
+            </Grid>
177
+            <Viewbox Grid.Row="3">
178
+                <Border
179
+                    Grid.Row="3"
180
+                    Margin="25,0,25,0"
181
+                    Background="#dee2e1"
182
+                    CornerRadius="5">
183
+                    <Border
184
+                        Margin="1,1,1,1"
185
+                        Background="#FFFFFF"
186
+                        CornerRadius="5">
187
+                        <StackPanel
188
+                            Grid.Row="3"
189
+                            Margin="0,5,0,5"
190
+                            Orientation="Horizontal">
191
+                            <TextBlock
192
+                                Padding="3,0,0,0"
193
+                                FontSize="20.5"
194
+                                Foreground="#FF0000"
195
+                                Text="●" />
196
+                            <TextBlock
197
+                                Padding="3,3,0,0"
198
+                                FontSize="16.5"
199
+                                Foreground="#333333"
200
+                                Text="未上线:" />
201
+                            <TextBlock
202
+                                x:Name="txbNotOnline"
203
+                                Width="1160" MinWidth="900"
204
+                                Padding="3,3,0,0"
205
+                                FontSize="16.5"
206
+                                Foreground="#999999"
207
+                                Text="暂无"
208
+                                TextWrapping="Wrap" />
209
+                        </StackPanel>
210
+                    </Border>
211
+                </Border>
212
+            </Viewbox>
213
+            <Button Cursor="Hand"
214
+                x:Name="btnEnd"
215
+                Grid.Row="4"
216
+                Width="336"
217
+                Height="46"
218
+                HorizontalAlignment="Center"
219
+                Background="White"
220
+                Click="btnEnd_Click"
221
+                Content="关闭"
222
+                FontSize="22"
223
+                FontWeight="Black"
224
+                Foreground="White"
225
+                Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}">
226
+                <Button.Template>
227
+                    <ControlTemplate TargetType="{x:Type Button}">
228
+                        <Border
229
+                            Background="#6098FF"
230
+                            BorderBrush="{TemplateBinding Control.BorderBrush}"
231
+                            BorderThickness="1"
232
+                            CornerRadius="23">
233
+
234
+                            <ContentPresenter
235
+                                HorizontalAlignment="Center"
236
+                                VerticalAlignment="Center"
237
+                                Content="{TemplateBinding ContentControl.Content}" />
238
+                        </Border>
239
+                    </ControlTemplate>
240
+                </Button.Template>
241
+            </Button>
242
+        </Grid>
243
+    </Grid>
244
+</Window>

+ 52
- 0
XHZB.Desktop/AttendanceWindow.xaml.cs View File

@@ -0,0 +1,52 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Text;
5
+using System.Threading.Tasks;
6
+using System.Windows;
7
+using System.Windows.Controls;
8
+using System.Windows.Data;
9
+using System.Windows.Documents;
10
+using System.Windows.Input;
11
+using System.Windows.Media;
12
+using System.Windows.Media.Imaging;
13
+using System.Windows.Shapes;
14
+
15
+namespace XHZB.Desktop
16
+{
17
+    /// <summary>
18
+    /// AttendanceWindow.xaml 的交互逻辑
19
+    /// </summary>
20
+    public partial class AttendanceWindow : Window
21
+    {
22
+        public AttendanceWindow()
23
+        {
24
+            InitializeComponent();
25
+        }
26
+
27
+        private void Window_Closed(object sender, EventArgs e)
28
+        {
29
+
30
+        }
31
+
32
+        private void Window_Loaded(object sender, RoutedEventArgs e)
33
+        {
34
+
35
+        }
36
+
37
+        private void Window_Unloaded(object sender, RoutedEventArgs e)
38
+        {
39
+
40
+        }
41
+
42
+        private void btnEnd_Click(object sender, RoutedEventArgs e)
43
+        {
44
+            Hide();
45
+        }
46
+
47
+        private void Window_MouseLeftButtonDown_1(object sender, MouseButtonEventArgs e)
48
+        {
49
+
50
+        }
51
+    }
52
+}

BIN
XHZB.Desktop/Images/Blackboard/class_1s.png View File


BIN
XHZB.Desktop/Images/Blackboard/class_1un.png View File


BIN
XHZB.Desktop/Images/Blackboard/class_2s.png View File


BIN
XHZB.Desktop/Images/Blackboard/class_2un.png View File


BIN
XHZB.Desktop/Images/Blackboard/class_3s.png View File


BIN
XHZB.Desktop/Images/Blackboard/class_3un.png View File


BIN
XHZB.Desktop/Images/Blackboard/class_4s.png View File


BIN
XHZB.Desktop/Images/Blackboard/class_4un.png View File


BIN
XHZB.Desktop/Images/Blackboard/class_5s.png View File


BIN
XHZB.Desktop/Images/Blackboard/class_5un.png View File


BIN
XHZB.Desktop/Images/Blackboard/class_6un.png View File


BIN
XHZB.Desktop/Images/Blackboard/class_7un.png View File


BIN
XHZB.Desktop/Images/Blackboard/class_c1.png View File


BIN
XHZB.Desktop/Images/Blackboard/class_p1.png View File


BIN
XHZB.Desktop/Images/Blackboard/class_p2.png View File


BIN
XHZB.Desktop/Images/Blackboard/class_p3.png View File


BIN
XHZB.Desktop/Images/Blackboard/class_s1.png View File


BIN
XHZB.Desktop/Images/Blackboard/class_s2.png View File


BIN
XHZB.Desktop/Images/Blackboard/class_s3.png View File


BIN
XHZB.Desktop/Images/Blackboard/class_s4.png View File


BIN
XHZB.Desktop/Images/Blackboard/class_s5.png View File


BIN
XHZB.Desktop/Images/Blackboard/class_s6.png View File


BIN
XHZB.Desktop/Images/Blackboard/erase.png View File


BIN
XHZB.Desktop/Images/Blackboard/pen.png View File


BIN
XHZB.Desktop/Images/Login/account copy 2@2x.png View File


BIN
XHZB.Desktop/Images/Login/data copy 2@2x.png View File


BIN
XHZB.Desktop/Images/Login/login2_0.png View File


BIN
XHZB.Desktop/Images/Login/login2_0_1.png View File


BIN
XHZB.Desktop/Images/Login/login2_1.png View File


BIN
XHZB.Desktop/Images/Login/logo.png View File


BIN
XHZB.Desktop/Images/Login/logo@2x.png View File


BIN
XHZB.Desktop/Images/Login/智慧校园.png View File


BIN
XHZB.Desktop/Images/Login/智慧校园@2x.png View File


BIN
XHZB.Desktop/Images/Login/组 1(1).png View File


BIN
XHZB.Desktop/Images/Login/组 1.png View File


BIN
XHZB.Desktop/Images/Login/组 1@2x(1).png View File


BIN
XHZB.Desktop/Images/Login/组 1@2x.png View File


BIN
XHZB.Desktop/Images/Login/设置@2x.png View File


BIN
XHZB.Desktop/Images/RollCall/rollCall_2.png View File


BIN
XHZB.Desktop/Images/RollCall/rollCall_2_1.png View File


+ 238
- 0
XHZB.Desktop/LoadDialog.xaml View File

@@ -0,0 +1,238 @@
1
+<Window x:Class="XHZB.Desktop.LoadDialog"
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:XHZB.Desktop"
7
+         Width="100"
8
+    Height="100"
9
+    AllowsTransparency="True"
10
+    Background="Transparent"
11
+    Opacity="1"
12
+    ResizeMode="NoResize"
13
+    Topmost="True"
14
+    WindowStartupLocation="CenterScreen"
15
+    WindowStyle="None">
16
+    <Grid>
17
+        <Border Background="#66000000" CornerRadius="10 10 10 10">
18
+            <Grid Width="60" Height="60">
19
+                <Grid.Resources>
20
+                    <DrawingBrush
21
+                        x:Key="brush"
22
+                        AlignmentX="Center"
23
+                        AlignmentY="Top"
24
+                        Stretch="None">
25
+                        <DrawingBrush.Drawing>
26
+                            <GeometryDrawing Brush="White">
27
+                                <GeometryDrawing.Geometry>
28
+                                    <EllipseGeometry RadiusX="2" RadiusY="5" />
29
+                                </GeometryDrawing.Geometry>
30
+                            </GeometryDrawing>
31
+                        </DrawingBrush.Drawing>
32
+                    </DrawingBrush>
33
+                </Grid.Resources>
34
+
35
+                <Rectangle
36
+                    x:Name="r01"
37
+                    Fill="{StaticResource brush}"
38
+                    Opacity="0.8"
39
+                    RenderTransformOrigin="0.5,0.5">
40
+                    <Rectangle.RenderTransform>
41
+                        <RotateTransform Angle="0" />
42
+                    </Rectangle.RenderTransform>
43
+                </Rectangle>
44
+                <Rectangle
45
+                    x:Name="r02"
46
+                    Fill="{StaticResource brush}"
47
+                    Opacity="0.8"
48
+                    RenderTransformOrigin="0.5,0.5">
49
+                    <Rectangle.RenderTransform>
50
+                        <RotateTransform Angle="30" />
51
+                    </Rectangle.RenderTransform>
52
+                </Rectangle>
53
+                <Rectangle
54
+                    x:Name="r03"
55
+                    Fill="{StaticResource brush}"
56
+                    Opacity="0.8"
57
+                    RenderTransformOrigin="0.5,0.5">
58
+                    <Rectangle.RenderTransform>
59
+                        <RotateTransform Angle="60" />
60
+                    </Rectangle.RenderTransform>
61
+                </Rectangle>
62
+                <Rectangle
63
+                    x:Name="r04"
64
+                    Fill="{StaticResource brush}"
65
+                    Opacity="0.8"
66
+                    RenderTransformOrigin="0.5,0.5">
67
+                    <Rectangle.RenderTransform>
68
+                        <RotateTransform Angle="90" />
69
+                    </Rectangle.RenderTransform>
70
+                </Rectangle>
71
+                <Rectangle
72
+                    x:Name="r05"
73
+                    Fill="{StaticResource brush}"
74
+                    Opacity="0.8"
75
+                    RenderTransformOrigin="0.5,0.5">
76
+                    <Rectangle.RenderTransform>
77
+                        <RotateTransform Angle="120" />
78
+                    </Rectangle.RenderTransform>
79
+                </Rectangle>
80
+                <Rectangle
81
+                    x:Name="r06"
82
+                    Fill="{StaticResource brush}"
83
+                    Opacity="0.8"
84
+                    RenderTransformOrigin="0.5,0.5">
85
+                    <Rectangle.RenderTransform>
86
+                        <RotateTransform Angle="150" />
87
+                    </Rectangle.RenderTransform>
88
+                </Rectangle>
89
+                <Rectangle
90
+                    x:Name="r07"
91
+                    Fill="{StaticResource brush}"
92
+                    Opacity="0.8"
93
+                    RenderTransformOrigin="0.5,0.5">
94
+                    <Rectangle.RenderTransform>
95
+                        <RotateTransform Angle="180" />
96
+                    </Rectangle.RenderTransform>
97
+                </Rectangle>
98
+                <Rectangle
99
+                    x:Name="r08"
100
+                    Fill="{StaticResource brush}"
101
+                    Opacity="0.8"
102
+                    RenderTransformOrigin="0.5,0.5">
103
+                    <Rectangle.RenderTransform>
104
+                        <RotateTransform Angle="210" />
105
+                    </Rectangle.RenderTransform>
106
+                </Rectangle>
107
+                <Rectangle
108
+                    x:Name="r09"
109
+                    Fill="{StaticResource brush}"
110
+                    Opacity="0.8"
111
+                    RenderTransformOrigin="0.5,0.5">
112
+                    <Rectangle.RenderTransform>
113
+                        <RotateTransform Angle="240" />
114
+                    </Rectangle.RenderTransform>
115
+                </Rectangle>
116
+                <Rectangle
117
+                    x:Name="r10"
118
+                    Fill="{StaticResource brush}"
119
+                    Opacity="0.8"
120
+                    RenderTransformOrigin="0.5,0.5">
121
+                    <Rectangle.RenderTransform>
122
+                        <RotateTransform Angle="270" />
123
+                    </Rectangle.RenderTransform>
124
+                </Rectangle>
125
+                <Rectangle
126
+                    x:Name="r11"
127
+                    Fill="{StaticResource brush}"
128
+                    Opacity="0.8"
129
+                    RenderTransformOrigin="0.5,0.5">
130
+                    <Rectangle.RenderTransform>
131
+                        <RotateTransform Angle="300" />
132
+                    </Rectangle.RenderTransform>
133
+                </Rectangle>
134
+                <Rectangle
135
+                    x:Name="r12"
136
+                    Fill="{StaticResource brush}"
137
+                    Opacity="0.8"
138
+                    RenderTransformOrigin="0.5,0.5">
139
+                    <Rectangle.RenderTransform>
140
+                        <RotateTransform Angle="330" />
141
+                    </Rectangle.RenderTransform>
142
+                </Rectangle>
143
+                <Grid.Triggers>
144
+                    <EventTrigger RoutedEvent="Grid.Loaded">
145
+                        <BeginStoryboard>
146
+                            <Storyboard RepeatBehavior="Forever">
147
+                                <DoubleAnimation
148
+                                    AutoReverse="True"
149
+                                    BeginTime="0:0:0.00000"
150
+                                    Storyboard.TargetName="r01"
151
+                                    Storyboard.TargetProperty="Opacity"
152
+                                    To="0"
153
+                                    Duration="0:0:0.08333" />
154
+                                <DoubleAnimation
155
+                                    AutoReverse="True"
156
+                                    BeginTime="0:0:0.08333"
157
+                                    Storyboard.TargetName="r02"
158
+                                    Storyboard.TargetProperty="Opacity"
159
+                                    To="0"
160
+                                    Duration="0:0:0.08333" />
161
+                                <DoubleAnimation
162
+                                    AutoReverse="True"
163
+                                    BeginTime="0:0:0.16666"
164
+                                    Storyboard.TargetName="r03"
165
+                                    Storyboard.TargetProperty="Opacity"
166
+                                    To="0"
167
+                                    Duration="0:0:0.08333" />
168
+                                <DoubleAnimation
169
+                                    AutoReverse="True"
170
+                                    BeginTime="0:0:0.24999"
171
+                                    Storyboard.TargetName="r04"
172
+                                    Storyboard.TargetProperty="Opacity"
173
+                                    To="0"
174
+                                    Duration="0:0:0.08333" />
175
+                                <DoubleAnimation
176
+                                    AutoReverse="True"
177
+                                    BeginTime="0:0:0.33332"
178
+                                    Storyboard.TargetName="r05"
179
+                                    Storyboard.TargetProperty="Opacity"
180
+                                    To="0"
181
+                                    Duration="0:0:0.08333" />
182
+                                <DoubleAnimation
183
+                                    AutoReverse="True"
184
+                                    BeginTime="0:0:0.41665"
185
+                                    Storyboard.TargetName="r06"
186
+                                    Storyboard.TargetProperty="Opacity"
187
+                                    To="0"
188
+                                    Duration="0:0:0.08333" />
189
+                                <DoubleAnimation
190
+                                    AutoReverse="True"
191
+                                    BeginTime="0:0:0.49998"
192
+                                    Storyboard.TargetName="r07"
193
+                                    Storyboard.TargetProperty="Opacity"
194
+                                    To="0"
195
+                                    Duration="0:0:0.08333" />
196
+                                <DoubleAnimation
197
+                                    AutoReverse="True"
198
+                                    BeginTime="0:0:0.58331"
199
+                                    Storyboard.TargetName="r08"
200
+                                    Storyboard.TargetProperty="Opacity"
201
+                                    To="0"
202
+                                    Duration="0:0:0.08333" />
203
+                                <DoubleAnimation
204
+                                    AutoReverse="True"
205
+                                    BeginTime="0:0:0.66664"
206
+                                    Storyboard.TargetName="r09"
207
+                                    Storyboard.TargetProperty="Opacity"
208
+                                    To="0"
209
+                                    Duration="0:0:0.08333" />
210
+                                <DoubleAnimation
211
+                                    AutoReverse="True"
212
+                                    BeginTime="0:0:0.74997"
213
+                                    Storyboard.TargetName="r10"
214
+                                    Storyboard.TargetProperty="Opacity"
215
+                                    To="0"
216
+                                    Duration="0:0:0.08333" />
217
+                                <DoubleAnimation
218
+                                    AutoReverse="True"
219
+                                    BeginTime="0:0:0.83330"
220
+                                    Storyboard.TargetName="r11"
221
+                                    Storyboard.TargetProperty="Opacity"
222
+                                    To="0"
223
+                                    Duration="0:0:0.08333" />
224
+                                <DoubleAnimation
225
+                                    AutoReverse="True"
226
+                                    BeginTime="0:0:0.91663"
227
+                                    Storyboard.TargetName="r12"
228
+                                    Storyboard.TargetProperty="Opacity"
229
+                                    To="0"
230
+                                    Duration="0:0:0.08333" />
231
+                            </Storyboard>
232
+                        </BeginStoryboard>
233
+                    </EventTrigger>
234
+                </Grid.Triggers>
235
+            </Grid>
236
+        </Border>
237
+    </Grid>
238
+</Window>

XHZB.Desktop/MainWindow.xaml.cs → XHZB.Desktop/LoadDialog.xaml.cs View File

@@ -1,6 +1,4 @@
1
-using Common.system;
2
-
3
-using System;
1
+using System;
4 2
 using System.Collections.Generic;
5 3
 using System.Linq;
6 4
 using System.Text;
@@ -12,27 +10,18 @@ using System.Windows.Documents;
12 10
 using System.Windows.Input;
13 11
 using System.Windows.Media;
14 12
 using System.Windows.Media.Imaging;
15
-using System.Windows.Navigation;
16 13
 using System.Windows.Shapes;
17 14
 
18 15
 namespace XHZB.Desktop
19 16
 {
20 17
     /// <summary>
21
-    /// 测试页面
18
+    /// Loding动画
22 19
     /// </summary>
23
-    public partial class MainWindow : Window
20
+    public partial class LoadDialog : Window
24 21
     {
25
-        public MainWindow()
22
+        public LoadDialog()
26 23
         {
27 24
             InitializeComponent();
28
-
29
-            //测试页面
30
-            //LogHelper.WriteInfoLog("启动!");
31
-            //MessageWindow.Show("启动成功!");
32
-
33
-          
34
-            APP.W_ToolbarWindow = new ToolbarWindow();
35
-            APP.W_ToolbarWindow.Show();
36 25
         }
37 26
     }
38 27
 }

+ 470
- 0
XHZB.Desktop/LoginWindow.xaml View File

@@ -0,0 +1,470 @@
1
+<Window x:Class="XHZB.Desktop.LoginWindow"
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:XHZB.Desktop" xmlns:util="clr-namespace:XHZB.Desktop.Utils"
7
+        Width="480"
8
+    Height="384"
9
+    AllowsTransparency="True"
10
+    Loaded="Window_Loaded"
11
+    MouseLeftButtonDown="Window_MouseLeftButtonDown_1"
12
+    ResizeMode="NoResize"
13
+    ShowInTaskbar="True"
14
+    SizeChanged="Window_SizeChanged"
15
+    WindowStartupLocation="CenterScreen"
16
+    WindowState="Normal"
17
+    WindowStyle="None"
18
+    mc:Ignorable="d" BorderThickness="7">
19
+    <Window.Effect>
20
+        <DropShadowEffect BlurRadius="10" Color="#bababa" Direction="80" ShadowDepth="0"/>
21
+    </Window.Effect>
22
+    <Window.Background>
23
+        <SolidColorBrush Opacity="1" />
24
+    </Window.Background>
25
+    <Window.Resources>
26
+        <!--Combox右侧下拉按钮-->
27
+        <Style TargetType="ToggleButton" x:Key="ComboxStyleBtn">
28
+            <Setter Property="Template">
29
+                <Setter.Value>
30
+                    <ControlTemplate>
31
+                        <!--下拉按钮内部背景色-->
32
+                        <Border x:Name="Back" Background="Transparent" BorderThickness="1" BorderBrush="Transparent">
33
+                            <!--下拉按钮内边框-->
34
+                            <Label Name="PathFill" Content="ˇ" FontSize="28" Padding="0,7,12,0" HorizontalAlignment="Right">
35
+
36
+                            </Label>
37
+                        </Border>
38
+                        <ControlTemplate.Triggers>
39
+                            <Trigger Property="IsMouseOver" Value="True">
40
+
41
+                                <Setter TargetName="Back" Property="Background" Value="Transparent"></Setter>
42
+                                <Setter TargetName="Back" Property="BorderBrush" Value="Transparent"></Setter>
43
+                            </Trigger>
44
+                        </ControlTemplate.Triggers>
45
+                    </ControlTemplate>
46
+                </Setter.Value>
47
+            </Setter>
48
+        </Style>
49
+        <!--Combox-->
50
+        <Style TargetType="ComboBox" x:Key="ComboBoxStyle">
51
+            <Setter Property="ItemContainerStyle">
52
+                <Setter.Value>
53
+                    <!--ComBoxItem-->
54
+                    <Style TargetType="ComboBoxItem">
55
+                        <Setter Property="MinHeight" Value="32"></Setter>
56
+                        <Setter Property="MinWidth" Value="60"></Setter>
57
+                        <Setter Property="Template">
58
+                            <Setter.Value>
59
+                                <ControlTemplate TargetType="ComboBoxItem">
60
+                                    <Border Name="Back" Background="Transparent"  BorderThickness="0,0,0,0" BorderBrush="#f3f3f3">
61
+                                        <ContentPresenter ContentSource="{Binding Source}" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10,0,0,0" ></ContentPresenter>
62
+                                    </Border>
63
+                                    <ControlTemplate.Triggers>
64
+                                        <Trigger Property="IsMouseOver" Value="True">
65
+                                            <Setter TargetName="Back" Property="Background" Value="#f3f3f3"></Setter>
66
+                                        </Trigger>
67
+                                        <!--下拉框背景色-->
68
+                                        <Trigger Property="IsHighlighted" Value="True">
69
+                                            <Setter TargetName="Back" Property="Background" Value="#f3f3f3"></Setter>
70
+                                        </Trigger>
71
+                                    </ControlTemplate.Triggers>
72
+                                </ControlTemplate>
73
+                            </Setter.Value>
74
+                        </Setter>
75
+                    </Style>
76
+                </Setter.Value>
77
+            </Setter>
78
+            <Setter Property="Template">
79
+                <Setter.Value>
80
+                    <ControlTemplate TargetType="ComboBox">
81
+                        <Grid>
82
+                            <Grid.ColumnDefinitions>
83
+
84
+                            </Grid.ColumnDefinitions>
85
+                            <!--文字区域背景和边线样式-->
86
+                            <TextBox Background="#FFFFFF" Padding="10,0,0,0" VerticalAlignment="Center"  Grid.Column="0" Foreground="Black" BorderBrush="#c0c0c0" BorderThickness="0" IsReadOnly="{TemplateBinding IsReadOnly}" Text="{TemplateBinding Text}"></TextBox>
87
+                            <Border  Grid.Column="0" BorderThickness="0.6" BorderBrush="#c0c0c0" CornerRadius="1,0,0,1">
88
+
89
+                            </Border>
90
+                            <!--右侧下拉button设置-->
91
+                            <Border Grid.Column="1" BorderThickness="0,0.6,0.6,0.6" BorderBrush="#c0c0c0" CornerRadius="0,1,1,0" >
92
+                                <ToggleButton BorderThickness="3" BorderBrush="Black" Style="{StaticResource ComboxStyleBtn}" IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" ClickMode="Press"></ToggleButton>
93
+                            </Border>
94
+                            <!--弹出popup整体设置-->
95
+                            <Popup IsOpen="{TemplateBinding IsDropDownOpen}" Placement="Bottom" x:Name="Popup" Focusable="False" AllowsTransparency="True" PopupAnimation="Slide">
96
+                                <!--弹出popup边框-->
97
+                                <Border CornerRadius="1" BorderBrush="#d2d2d2" BorderThickness="1,0,1,1" MaxHeight="{TemplateBinding MaxDropDownHeight}" MinWidth="{TemplateBinding ActualWidth}" x:Name="DropDown" SnapsToDevicePixels="True">
98
+                                    <Border.Effect>
99
+                                        <DropShadowEffect Color="Black" BlurRadius="2" ShadowDepth="0" Opacity="1"/>
100
+                                    </Border.Effect>
101
+                                    <!--下拉幕布边界背景设置 MaxHeight="{TemplateBinding MaxDropDownHeight}"-->
102
+                                    <ScrollViewer Margin="0,0,0,0"  SnapsToDevicePixels="True" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" BorderBrush="#17acae" BorderThickness="2" >
103
+                                        <!-- StackPanel 用于显示子级,方法是将 IsItemsHost 设置为 True -->
104
+                                        <StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained" Background="#FFFFFF"/>
105
+                                    </ScrollViewer>
106
+                                </Border>
107
+                            </Popup>
108
+                        </Grid>
109
+                    </ControlTemplate>
110
+                </Setter.Value>
111
+            </Setter>
112
+        </Style>
113
+
114
+
115
+
116
+
117
+
118
+        <util:GenericTypeConverter x:Key="ZJGenericTypeConverter" />
119
+
120
+        <Style x:Key="oiliu" TargetType="ListBoxItem">
121
+            <!--  设置控件模板  -->
122
+            <Setter Property="Template">
123
+                <Setter.Value>
124
+                    <ControlTemplate TargetType="ListBoxItem">
125
+                        <Border
126
+                            Margin="4,0,0,0"
127
+                            Padding="0"
128
+                            Background="{TemplateBinding Background}">
129
+                            <ContentPresenter
130
+                                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
131
+                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
132
+                                TextBlock.Foreground="{TemplateBinding Foreground}" />
133
+                        </Border>
134
+                    </ControlTemplate>
135
+                </Setter.Value>
136
+            </Setter>
137
+        </Style>
138
+    </Window.Resources>
139
+
140
+    <Viewbox>
141
+        <Grid Width="480" Height="384" >
142
+            <Grid.RowDefinitions>
143
+                <RowDefinition Height="*" />
144
+            </Grid.RowDefinitions>
145
+            <Grid.Background>
146
+                <ImageBrush x:Name="imgBrush" ImageSource="/Images/Login/login2_0_1.png" />
147
+            </Grid.Background>
148
+            <StackPanel Margin="10,0,0,0">
149
+                <Image
150
+                    Width="30"
151
+                    Height="21"
152
+                    Margin="0,10,0,0"
153
+                    HorizontalAlignment="Left"
154
+                    Source=".\Images\Login\logo@2x.png" />
155
+                <TextBlock
156
+                    Margin="35,-20,0,0"
157
+                    FontSize="13"
158
+                    Foreground="White"
159
+                    Text="星火智慧校园" />
160
+                <Button
161
+                    x:Name="btnDown"
162
+                    Width="30.8"
163
+                    Height="30.8"
164
+                    Margin="0,-25,5,0"
165
+                    HorizontalAlignment="Right"
166
+                    Click="btnDown_Click"
167
+                    Cursor="Hand"
168
+                    Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}">
169
+                    <Button.Template>
170
+                        <ControlTemplate TargetType="{x:Type Button}">
171
+                            <Border
172
+                                BorderBrush="{TemplateBinding Control.BorderBrush}"
173
+                                BorderThickness="1"
174
+                                CornerRadius="20,20,20,20">
175
+                                <Border.Background>#FFFFFFFF</Border.Background>
176
+                                <ContentPresenter
177
+                                    HorizontalAlignment="Center"
178
+                                    VerticalAlignment="Center"
179
+                                    Content="{TemplateBinding ContentControl.Content}" />
180
+                            </Border>
181
+                        </ControlTemplate>
182
+                    </Button.Template>
183
+                    <Image Source=".\Images\Login\组 1@2x(1).png" />
184
+                </Button>
185
+            </StackPanel>
186
+            <Grid 
187
+                x:Name="grLogin"
188
+                Margin="0,0,0,0"
189
+                Visibility="Visible">
190
+                <Grid.RowDefinitions>
191
+                    <RowDefinition Height="auto" />
192
+                    <RowDefinition Height="34.7" />
193
+                    <RowDefinition Height="37" />
194
+                    <RowDefinition Height="17.3" />
195
+                    <RowDefinition Height="37" />
196
+                    <RowDefinition Height="15.1" />
197
+                    <RowDefinition Height="auto" />
198
+                    <RowDefinition Height="12.8" />
199
+                    <RowDefinition Height="37" />
200
+                    <RowDefinition Height="*" />
201
+                </Grid.RowDefinitions>
202
+
203
+                <Image
204
+                    Grid.Row="0"
205
+                    Width="228"
206
+                    Height="34.5"
207
+                    Margin="0,66.2,0,0"
208
+                    HorizontalAlignment="Center"
209
+                    Source=".\Images\Login\智慧校园@2x.png" />
210
+                <Border
211
+                    Grid.Row="2"
212
+                    Width="272"
213
+                    HorizontalAlignment="Center"
214
+                    Background="White"
215
+                    CornerRadius="17">
216
+                    <TextBox
217
+                        x:Name="txbAccountNumber"
218
+                        Grid.Row="2"
219
+                        Width="272"
220
+                        Padding="40,10,0,0"
221
+                        Background="Transparent"
222
+                        BorderBrush="{x:Null}"
223
+                        BorderThickness="0"
224
+                        FontSize="15"
225
+                        Foreground="#333333"
226
+                        MouseLeftButtonDown="txbAccountNumber_MouseLeftButtonDown"
227
+                        Text="" />
228
+                </Border>
229
+                <Image
230
+                    Grid.Row="2"
231
+                    Width="13"
232
+                    Height="14"
233
+                    Margin="120,0,0,0"
234
+                    HorizontalAlignment="Left"
235
+                    Source=".\Images\Login\data copy 2@2x.png" />
236
+                <Border
237
+                    Grid.Row="4"
238
+                    Width="272"
239
+                    HorizontalAlignment="Center"
240
+                    Background="White"
241
+                    CornerRadius="17">
242
+                    <PasswordBox
243
+                        x:Name="pobPassword"
244
+                        Grid.Row="4"
245
+                        Width="230"
246
+                        Padding="20,10,0,0"
247
+                        Background="Transparent"
248
+                        BorderBrush="{x:Null}"
249
+                        BorderThickness="0"
250
+                        FontSize="15"
251
+                        Foreground="#333333"
252
+                        PasswordChar="*" />
253
+                </Border>
254
+                <Image
255
+                    Grid.Row="4"
256
+                    Width="13"
257
+                    Height="14"
258
+                    Margin="120,0,0,0"
259
+                    HorizontalAlignment="Left"
260
+                    Source=".\Images\Login\account copy 2@2x.png" />
261
+                <CheckBox Cursor="Hand"
262
+                    x:Name="ckSaveName"
263
+                    Grid.Row="6"
264
+                    Width="15.4"
265
+                    Height="15.4"
266
+                    Margin="120,0,0,0"
267
+                    HorizontalAlignment="Left"
268
+                    Click="ckSaveName_Click" />
269
+                <TextBlock
270
+                    Grid.Row="6"
271
+                    Margin="145,0,0,0"
272
+                    FontSize="15"
273
+                    Foreground="White"
274
+                    Text="记住账号" />
275
+
276
+                <Button
277
+                    x:Name="btnLogin"
278
+                    Grid.Row="8"
279
+                    Width="272"
280
+                    Height="37"
281
+                    Click="btnLogin_Click"
282
+                    Content="立即登录"
283
+                    FontSize="17"
284
+                    IsDefault="True"
285
+                    Cursor="Hand"
286
+                    Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}">
287
+                    <Button.Template>
288
+                        <ControlTemplate TargetType="{x:Type Button}">
289
+                            <Border
290
+                                BorderBrush="{TemplateBinding Control.BorderBrush}"
291
+                                BorderThickness="1"
292
+                                CornerRadius="17">
293
+                                <Border.Background>#FFFFFFFF</Border.Background>
294
+                                <ContentPresenter
295
+                                    HorizontalAlignment="Center"
296
+                                    VerticalAlignment="Center"
297
+                                    Content="{TemplateBinding ContentControl.Content}" />
298
+                            </Border>
299
+                        </ControlTemplate>
300
+                    </Button.Template>
301
+                </Button>
302
+            </Grid>
303
+
304
+            <Grid x:Name="grLoginTwo" Visibility="Collapsed">
305
+                <Grid.RowDefinitions>
306
+                    <RowDefinition Height="36" />
307
+                    <RowDefinition Height="64" />
308
+                    <!--  班级  -->
309
+                    <RowDefinition Height="*" />
310
+                </Grid.RowDefinitions>
311
+
312
+                <TextBlock Padding="0,0,0,10"
313
+                    x:Name="txbHeader"
314
+                    Grid.Row="1"
315
+                    Grid.ColumnSpan="2"
316
+                    HorizontalAlignment="Center"
317
+                    VerticalAlignment="Center"
318
+                    Block.TextAlignment="Center"
319
+                    FontSize="30"
320
+                    Foreground="White"
321
+                    Text="老师,您好!"
322
+                    TextAlignment="Center"
323
+                    TextWrapping="WrapWithOverflow" />
324
+
325
+                <Grid Grid.Row="2" Background="White">
326
+
327
+                    <Grid Margin="36,0,36,0">
328
+                        <Grid.RowDefinitions>
329
+                            <RowDefinition Height="24" />
330
+                            <RowDefinition Height="35" />
331
+                            <RowDefinition Height="24" />
332
+                            <RowDefinition Height="35" />
333
+                            <RowDefinition Height="24" />
334
+                            <RowDefinition Height="35" />
335
+                            <RowDefinition Height="*" />
336
+                            <RowDefinition Height="80" />
337
+                            <RowDefinition Height="*" />
338
+                        </Grid.RowDefinitions>
339
+                        <Grid.ColumnDefinitions>
340
+                            <ColumnDefinition Width="50" />
341
+                            <ColumnDefinition Width="*" />
342
+                        </Grid.ColumnDefinitions>
343
+                        <TextBlock
344
+                            x:Name="txbClass"
345
+                            Grid.Row="1"
346
+                            Grid.Column="0"
347
+                            Padding="0,0,0,0"
348
+                            VerticalAlignment="Center"
349
+                            Background="Transparent"
350
+                            FontSize="16"
351
+                            Foreground="Black"
352
+                            Text="班级:" />
353
+                        <ComboBox Cursor="Hand"
354
+                            x:Name="cmbClass"
355
+                            Grid.Row="1"
356
+                            Grid.Column="1"
357
+                            Height="auto"
358
+                            Margin="0,0,0,0"
359
+                            Padding="10,0,0,0"
360
+                            VerticalContentAlignment="Center"
361
+                            DisplayMemberPath="Value"
362
+                                  Style="{StaticResource ComboBoxStyle}"
363
+                            FontSize="14"
364
+                            SelectedValuePath="Key">
365
+                            <ComboBox.Resources>
366
+                                <SolidColorBrush x:Key="{x:Static SystemColors.WindowBrushKey}" Color="WhiteSmoke" />
367
+                                <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Gray" />
368
+                            </ComboBox.Resources>
369
+                        </ComboBox>
370
+                        <TextBlock
371
+                            x:Name="txbSubject"
372
+                            Grid.Row="3"
373
+                            Grid.Column="0"
374
+                            VerticalAlignment="Center"
375
+                            Background="Transparent"
376
+                            FontSize="16"
377
+                            Foreground="Black"
378
+                            Text="教材:" />
379
+
380
+                        <ComboBox Cursor="Hand"
381
+                            x:Name="book_list"
382
+                            Grid.Row="3"
383
+                            Grid.Column="1"
384
+                            Height="auto"
385
+                            Margin="0,0,0,0"
386
+                            Padding="10,0,0,0"
387
+                                  Style="{StaticResource ComboBoxStyle}"
388
+                            VerticalContentAlignment="Center"
389
+                            DisplayMemberPath="Value"
390
+                            FontSize="14"
391
+                            ItemsSource="{Binding bookList}"
392
+                            SelectedValuePath="Key"
393
+                            SelectionChanged="toolbar_list_SelectionChanged">
394
+                            <ComboBox.Resources>
395
+                                <SolidColorBrush x:Key="{x:Static SystemColors.WindowBrushKey}" Color="WhiteSmoke" />
396
+                                <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Gray" />
397
+                            </ComboBox.Resources>
398
+                        </ComboBox>
399
+
400
+                        <TextBlock
401
+                            x:Name="txbTeachingMaterial"
402
+                            Grid.Row="5"
403
+                            Grid.Column="0"
404
+                            VerticalAlignment="Center"
405
+                            Background="Transparent"
406
+                            FontSize="16"
407
+                            Foreground="Black"
408
+                            Text="章节:" />
409
+                        <ComboBox Cursor="Hand"
410
+                            x:Name="cmbTeachingMaterial"
411
+                            Grid.Row="5"
412
+                            Grid.Column="1"
413
+                            Padding="10,0,0,0"
414
+                                  Style="{StaticResource ComboBoxStyle}"
415
+                            VerticalContentAlignment="Center"
416
+                            Background="White"
417
+                            DisplayMemberPath="Value"
418
+                            FontSize="14"
419
+                            Foreground="Black"
420
+                            ItemsSource="{Binding zhangjieList}"
421
+                            SelectedValuePath="Key" />
422
+                        <Button Cursor="Hand"
423
+                            x:Name="btnClassesBegin"
424
+                            Grid.Row="7"
425
+                            Grid.ColumnSpan="2"
426
+                            Width="328"
427
+                            Height="42"
428
+                            Click="btnClassesBegin_Click"
429
+                            Content="开始上课"
430
+                            FontSize="20"
431
+                            Foreground="White">
432
+                            <Button.Template>
433
+                                <ControlTemplate TargetType="{x:Type Button}">
434
+                                    <Border
435
+                                        BorderBrush="{TemplateBinding Control.BorderBrush}"
436
+                                        BorderThickness="0"
437
+                                        CornerRadius="21">
438
+                                        <Border.Background>#2D8CF0</Border.Background>
439
+                                        <ContentPresenter
440
+                                            HorizontalAlignment="Center"
441
+                                            VerticalAlignment="Center"
442
+                                            Content="{TemplateBinding ContentControl.Content}" />
443
+                                    </Border>
444
+                                </ControlTemplate>
445
+                            </Button.Template>
446
+                        </Button>
447
+                    </Grid>
448
+                </Grid>
449
+            </Grid>
450
+
451
+            <StackPanel Orientation="Horizontal">
452
+                <TextBlock
453
+                x:Name="version_tb"
454
+                Margin="10,0,0,10"
455
+                HorizontalAlignment="Left"
456
+                VerticalAlignment="Bottom"
457
+                FontSize="16"
458
+                Foreground="White"
459
+                Text="测试版" />
460
+            </StackPanel>
461
+            <Button x:Name="btnSetUp" Height="25" Width="66" HorizontalAlignment="Right" Cursor="Hand"  Margin="0,0,5,6" VerticalAlignment="Bottom" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Click="btnSetUp_Click">
462
+                <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
463
+                    <Image Source=".\Images\Login\设置@2x.png"/>
464
+                    <TextBlock Text="设置" Foreground="White" FontSize="16"   HorizontalAlignment="Right"    
465
+                VerticalAlignment="Bottom"/>
466
+                </StackPanel>
467
+            </Button>
468
+        </Grid>
469
+    </Viewbox>
470
+</Window>

+ 933
- 0
XHZB.Desktop/LoginWindow.xaml.cs View File

@@ -0,0 +1,933 @@
1
+using Common.system;
2
+using System;
3
+using System.Collections.Generic;
4
+using System.Collections.ObjectModel;
5
+using System.Configuration;
6
+using System.Data;
7
+using System.IO;
8
+using System.Security.Principal;
9
+using System.Text;
10
+using System.Threading;
11
+using System.Windows;
12
+using System.Windows.Input;
13
+using System.Windows.Media;
14
+using System.Windows.Media.Imaging;
15
+using XHZB.Desktop.Utils;
16
+using XHZB.Model;
17
+
18
+namespace XHZB.Desktop
19
+{
20
+    /// <summary>
21
+    /// 登陆
22
+    /// </summary>
23
+    public partial class LoginWindow : Window/*, ZJDownloadUtil.ZJDownloadCallback*/
24
+    {
25
+        #region 字段&属性
26
+        //属性定义
27
+        private Dictionary<int, string> _selGroupList;
28
+        /// <summary>
29
+        /// 分组下拉列表
30
+        /// </summary>
31
+        public Dictionary<int, string> selGroupList
32
+        {
33
+            get => _selGroupList;
34
+            set => _selGroupList = value;//NotifyOfPropertyChange("selGroupList");
35
+        }
36
+        private int _Group;
37
+        /// <summary>
38
+        ///当前分组
39
+        /// </summary>
40
+        public int Group
41
+        {
42
+            get => _Group;
43
+            set => _Group = value;
44
+        }
45
+        /// <summary>
46
+        /// 调用接口
47
+        /// </summary>
48
+        private readonly RegisterController registerController = new RegisterController();
49
+        /// <summary>
50
+        /// 接口返回 0成功 1失败
51
+        /// </summary>
52
+        private int serverReturnCode = 0;
53
+        public DataTable data = new DataTable();
54
+        public DataTable DirectorList = new DataTable();
55
+        internal LoginPageData pageData = new LoginPageData();
56
+        /// <summary>
57
+        /// 记录上次用户的选择的教材
58
+        /// </summary>
59
+        private int lsbids = 0;
60
+        /// <summary>
61
+        /// 记录上次用户的选择的章节
62
+        /// </summary>
63
+        private int directorids = 0;
64
+        #endregion 字段&属性
65
+
66
+        #region 初始化
67
+        /// <summary>
68
+        /// 初始化
69
+        /// </summary>
70
+        public LoginWindow()
71
+        {
72
+            InitializeComponent();
73
+            WindowStartupLocation = WindowStartupLocation.CenterScreen;
74
+
75
+            string typestr = APP.isDebug ? "测试版" : "正式版";
76
+            bool isAdmin = IsAdministrator();
77
+            string stradmin = isAdmin ? "管理员" : "普通用户";
78
+
79
+            version_tb.Text = $"{typestr} v{FileToolsCommon.GetConfigValue("VersionName")}(Build{FileToolsCommon.GetConfigValue("VersionCode")}) [{stradmin}]";
80
+
81
+            if (File.Exists(APP.dataPath + "interfaceAddress.txt")) //若为空
82
+            {
83
+                APP.apiUrl = System.IO.File.ReadAllText(APP.dataPath + "interfaceAddress.txt", Encoding.Default);
84
+            }
85
+            if (File.Exists(APP.dataPath + "imageUploadAddress.txt")) //若为空
86
+            {
87
+                APP.uploadUrl = System.IO.File.ReadAllText(APP.dataPath + "imageUploadAddress.txt", Encoding.Default);
88
+            }
89
+            if (File.Exists(APP.dataPath + "pictureShowsAddress.txt")) //若为空
90
+            {
91
+                APP.showImageUrl = System.IO.File.ReadAllText(APP.dataPath + "pictureShowsAddress.txt", Encoding.Default);
92
+            }
93
+            if (File.Exists(APP.dataPath + "fileStorageAddress.txt")) //若为空
94
+            {
95
+                APP.fileStorageAddress = System.IO.File.ReadAllText(APP.dataPath + "fileStorageAddress.txt", Encoding.Default);
96
+            }
97
+        }
98
+        //#region 登陆页面验证本地激活码 1.验证成功 可登陆。 2.验证失败 弹出激活窗口。   关闭激活窗口,点击登陆时继续 弹出激活窗口
99
+        ///// <summary>
100
+        ///// 验证激活码
101
+        ///// </summary>
102
+        //void Verification()
103
+        //{
104
+        //    //如果本地文件为空,弹出弹窗 输密匙
105
+        //    //本地文件不为空, 解析
106
+        //    if (!File.Exists(APP.dataPath + "signature.txt"))//上次登陆时间为空 或者签名为空 或者上次登陆时间不是今天   都需要输入密匙验证 ,否则只验证本地的签名
107
+        //    {
108
+        //        KeyVerification wins = new KeyVerification
109
+        //        {
110
+        //            Topmost = true,
111
+        //            Owner = this
112
+        //        };
113
+
114
+        //        wins.ShowDialog();
115
+        //    }
116
+        //    else
117
+        //    {
118
+        //        UnderVerification();
119
+        //    }
120
+        //}
121
+        ///// <summary>
122
+        ///// 验证中
123
+        ///// </summary>
124
+        //void UnderVerification()
125
+        //{
126
+        //    MyApp.myloading.Show();
127
+        //    Shared.BackgroundWorkerHelper.RunWorkerAsync(InvokeActivationDecryptServering, InvokeActivationDecryptServerCompate);
128
+        //}
129
+        ///// <summary>
130
+        ///// 激活信息--验证签名是否过期-调用
131
+        ///// </summary>
132
+        ///// <returns></returns>
133
+        //private object InvokeActivationDecryptServering()
134
+        //{
135
+
136
+        //    return Shared.ServerMsg;
137
+        //}
138
+
139
+        ///// <summary>
140
+        ///// 激活信息--验证签名是否过期-返回结果
141
+        ///// </summary>
142
+        ///// <returns></returns>
143
+        //public void InvokeActivationDecryptServerCompate(object obj)
144
+        //{
145
+        //    Dispatcher.Invoke(new Action(() =>
146
+        //    {
147
+        //        MyApp.myloading.Hide();
148
+        //    }));
149
+
150
+        //    //解析
151
+        //    try
152
+        //    {
153
+        //        Shared.Signature = System.IO.File.ReadAllText(ZConfig.dataPath + "signature.txt", Encoding.Default);
154
+        //        string decrypt = DataProvider.TripleDESDecrypt(Shared.Signature, ZConfig.secretKey);
155
+        //        decrypt = decrypt.Replace("\u0001", "").Trim();
156
+        //        Signatures msgBean = ZJsonHelper.JsonToObj<Signatures>(decrypt);
157
+        //        long currentTimeTimestamp = DataProvider.TimestampTotalSeconds(); //当前时间 时间戳
158
+        //        if (msgBean.endtime > currentTimeTimestamp)//条件成立  解析成功 code 在有效期内
159
+        //        {
160
+        //            if (File.Exists(ZConfig.dataPath + "signatureTime.txt"))
161
+        //            {
162
+        //                string signatureTime = System.IO.File.ReadAllText(ZConfig.dataPath + "signatureTime.txt", Encoding.Default);
163
+        //                string currentTime = DateTime.Now.ToLongDateString().ToString();//当前时间  
164
+        //                if (signatureTime != currentTime)
165
+        //                {
166
+        //                    Shared.BackgroundWorkerHelper.RunWorkerAsync(InvokeActivationAddHistoryServering, InvokeActivationAddHistoryServerCompate);
167
+        //                }
168
+        //            }
169
+        //            ZConfig.isActivationSuccessful = true;
170
+        //            //Dispatcher.Invoke(new Action(() =>
171
+        //            //{
172
+        //            //    //LoginWindow win = new LoginWindow();
173
+        //            //    //win.Show();
174
+        //            //    //Close();
175
+        //            //}));
176
+        //        }
177
+        //        else//时间失效
178
+        //        {
179
+        //            Dispatcher.Invoke(new Action(() =>
180
+        //            {
181
+        //                KeyVerification wins = new KeyVerification
182
+        //                {
183
+        //                    Topmost = true,
184
+        //                    Owner = this
185
+        //                };
186
+        //                wins.ShowDialog();
187
+        //                //Close();
188
+        //            }));
189
+        //        }
190
+        //    }
191
+        //    catch (Exception) //解析失败 输code  
192
+        //    {
193
+        //        Dispatcher.Invoke(new Action(() =>
194
+        //        {
195
+        //            KeyVerification wins = new KeyVerification
196
+        //            {
197
+        //                Topmost = true,
198
+        //                Owner = this
199
+        //            };
200
+        //            wins.ShowDialog();
201
+        //            //Close();
202
+        //        }));
203
+        //    }
204
+
205
+        //}
206
+        ///// <summary>
207
+        ///// 激活信息--添加激活历史-调用
208
+        ///// </summary>
209
+        ///// <returns></returns>
210
+        //private object InvokeActivationAddHistoryServering()
211
+        //{
212
+        //    serverReturnCode = registerController.ActivationAddHistory(ref Shared.TeachingData);
213
+        //    return Shared.ServerMsg;
214
+        //}
215
+
216
+        ///// <summary>
217
+        ///// 激活信息--添加激活历史-返回结果
218
+        ///// </summary>
219
+        ///// <returns></returns>
220
+        //public void InvokeActivationAddHistoryServerCompate(object obj)
221
+        //{
222
+        //    if (!Directory.Exists(APP.dataPath))
223
+        //    {
224
+        //        Directory.CreateDirectory(APP.dataPath);
225
+        //    }
226
+        //    string ApplicationData = APP.dataPath + "signatureTime.txt";
227
+        //    string currentTime = DateTime.Now.ToLongDateString().ToString();//当前时间
228
+        //    System.IO.File.WriteAllText(ApplicationData, currentTime, Encoding.Default);//存放签名验证日期
229
+        //}
230
+        //#endregion
231
+        public bool IsAdministrator()
232
+        {
233
+            WindowsIdentity current = WindowsIdentity.GetCurrent();
234
+            WindowsPrincipal windowsPrincipal = new WindowsPrincipal(current);
235
+            return windowsPrincipal.IsInRole(WindowsBuiltInRole.Administrator);
236
+        }
237
+        /// <summary>
238
+        /// 初始化加载
239
+        /// </summary>
240
+        /// <param name="sender"></param>
241
+        /// <param name="e"></param>
242
+        private void Window_Loaded(object sender, RoutedEventArgs e)
243
+        {
244
+            WindowStartupLocation = WindowStartupLocation.CenterScreen;
245
+
246
+            btnLogin.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#1D8AF4"));
247
+            //imgBrush.ImageSource = new BitmapImage(new Uri("pack://application:,,,/Images/Login/login2_0.png"));
248
+
249
+            if (GetSettingString("isRemind").Equals("True"))
250
+            {
251
+                ckSaveName.IsChecked = true;
252
+                txbAccountNumber.Text = GetSettingString("userName");
253
+            }
254
+            //if (GetSettingString("OutputInforLog").Equals("1"))
255
+            //{
256
+            //    ZConfig.outputInforLog = true;
257
+            //}
258
+            //Verification();
259
+            getNewApp();
260
+        }
261
+        #endregion 初始化
262
+
263
+        #region 事件
264
+        /// <summary>
265
+        /// 窗体移动事件
266
+        /// </summary>
267
+        /// <param name="sender"></param>
268
+        /// <param name="e"></param>
269
+        private void Window_MouseLeftButtonDown_1(object sender, MouseButtonEventArgs e)
270
+        {
271
+            DragMove();
272
+        }
273
+        /// <summary>
274
+        /// 窗口弧度
275
+        /// </summary>
276
+        /// <param name="sender"></param>
277
+        /// <param name="e"></param>
278
+        private void Window_SizeChanged(object sender, SizeChangedEventArgs e)
279
+        {
280
+            System.Windows.Rect r = new System.Windows.Rect(e.NewSize);
281
+            RectangleGeometry gm = new RectangleGeometry(r, 1, 1);
282
+            ((UIElement)sender).Clip = gm;
283
+        }
284
+        /// <summary>
285
+        /// 登陆事件
286
+        /// </summary>
287
+        /// <param name="sender"></param>
288
+        /// <param name="e"></param>
289
+        private void btnLogin_Click(object sender, RoutedEventArgs e)
290
+        {
291
+            //if (!ZConfig.isActivationSuccessful)
292
+            //{
293
+            //    Verification();
294
+            //    return;
295
+            //}
296
+
297
+            if (string.IsNullOrEmpty(txbAccountNumber.Text))
298
+            {
299
+                MessageWindow.Show("账号未输入");
300
+                return;
301
+            }
302
+            if (string.IsNullOrEmpty(pobPassword.Password))
303
+            {
304
+                MessageWindow.Show("密码未输入");
305
+                return;
306
+            }
307
+            APP.myloading.Show();
308
+            APP.BackgroundWorkerHelper.RunWorkerAsync(InvokeServering, InvokeServerCompate);
309
+        }
310
+        /// <summary>
311
+        /// 开始上课
312
+        /// </summary>
313
+        /// <param name="sender"></param>
314
+        /// <param name="e"></param>
315
+        private void btnClassesBegin_Click(object sender, RoutedEventArgs e)
316
+        {
317
+            if (string.IsNullOrWhiteSpace(cmbClass.Text))
318
+            {
319
+                MessageWindow.Show("尚未选择班级");
320
+                return;
321
+            }
322
+            if (string.IsNullOrEmpty(cmbTeachingMaterial.Text))
323
+            {
324
+                MessageWindow.Show("尚未选择章节");
325
+                return;
326
+            }
327
+            APP.myloading.Show();
328
+            APP.classid = Convert.ToInt32(cmbClass.SelectedValue.ToString());
329
+
330
+            for (int i = 0; i < APP.ClassList.Count; i++)
331
+            {
332
+                if (APP.classid == APP.ClassList[i].classid)
333
+                {
334
+                    APP.REQStartClass.classnum = APP.ClassList[i].classnum;
335
+                }
336
+            }
337
+
338
+            APP.REQStartClass.roomname = DateTime.Now.ToString() + cmbClass.Text;
339
+            APP.REQStartClass.directorid = Convert.ToInt32(cmbTeachingMaterial.SelectedValue.ToString());
340
+            APP.REQStartClass.roomid = TimestampAddRandomNumber();
341
+            APP.roomid = APP.REQStartClass.roomid;
342
+
343
+            try
344
+            {
345
+                //记录教材 章节 及当前登陆用户id
346
+                string ApplicationData = APP.dataPath + "loginUserid.txt";
347
+                string temp = APP.LoginUser.userid.ToString();
348
+                System.IO.File.WriteAllText(ApplicationData, temp, Encoding.Default);
349
+                ApplicationData = APP.dataPath + "loginLsbid.txt";
350
+                temp = APP.lsbid.ToString();
351
+                System.IO.File.WriteAllText(ApplicationData, temp, Encoding.Default);
352
+                ApplicationData = APP.dataPath + "loginDirectorid.txt";
353
+                temp = APP.REQStartClass.directorid.ToString();
354
+                System.IO.File.WriteAllText(ApplicationData, temp, Encoding.Default);
355
+            }
356
+            catch (Exception ex)
357
+            {
358
+                LogHelper.WriteErrLog("【登陆(LoginWindow)" + ex.Message, ex);
359
+            }
360
+
361
+
362
+            APP.BackgroundWorkerHelper.RunWorkerAsync(InvokeClassStudentListServering, InvokeServerClassStudentListCompate);
363
+        }
364
+        /// <summary>
365
+        /// 返回一个时间戳加3位随机数的long型整数
366
+        /// </summary>
367
+        /// <returns></returns>
368
+        public  long TimestampAddRandomNumber()
369
+        {
370
+            TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
371
+            string timestr = Convert.ToInt64(ts.TotalMilliseconds).ToString();
372
+            long tick = DateTime.Now.Ticks;
373
+            Random ran = new Random((int)(tick & 0xffffffffL) | (int)(tick >> 32));
374
+            int random = ran.Next(100, 999);
375
+            return Convert.ToInt64(timestr + random.ToString());
376
+        }
377
+        /// <summary>
378
+        /// 关闭
379
+        /// </summary>
380
+        /// <param name="sender"></param>
381
+        /// <param name="e"></param>
382
+        private void btnDown_Click(object sender, RoutedEventArgs e)
383
+        {
384
+            Close();
385
+            Application.Current.Shutdown();
386
+            System.Environment.Exit(0);
387
+        }
388
+        #endregion 事件
389
+
390
+        #region 方法
391
+        /// <summary>
392
+        /// 读取客户设置
393
+        /// </summary>
394
+        /// <param name="settingName"></param>
395
+        /// <returns></returns>
396
+        public static string GetSettingString(string settingName)
397
+        {
398
+            try
399
+            {
400
+                string settingString = FileToolsCommon.GetConfigValue(settingName);
401
+                return settingString;
402
+            }
403
+            catch (Exception)
404
+            {
405
+                return null;
406
+            }
407
+        }
408
+        /// <summary>
409
+        /// 更新设置
410
+        /// </summary>
411
+        /// <param name="settingName"></param>
412
+        /// <param name="valueName"></param>
413
+        public static void UpdateSettingString(string settingName, string valueName)
414
+        {
415
+            //Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
416
+
417
+            //if (ConfigurationManager.AppSettings[settingName] != null)
418
+            //{
419
+            //    config.AppSettings.Settings.Remove(settingName);
420
+            //}
421
+            //config.AppSettings.Settings.Add(settingName, valueName);
422
+            //config.Save(ConfigurationSaveMode.Modified);
423
+            //ConfigurationManager.RefreshSection("appSettings");
424
+        }
425
+        /// <summary>
426
+        /// 检测APP更新
427
+        /// </summary>
428
+        private void getNewApp()
429
+        {
430
+            //new Thread(o =>
431
+            //{
432
+            //    string url = ZConfig.apiUrl + "/appclient/get_new";
433
+
434
+            //    string result = ZHttpUtil.PostAndRespStr(url, "{}");
435
+            //    Model.ResultVo<AppModel> resultObj = ZJsonHelper.JsonToObj<Model.ResultVo<AppModel>>(result);
436
+            //    if (result != null && resultObj.code == 0)
437
+            //    {
438
+            //        if (resultObj.obj != null)
439
+            //        {
440
+            //            int versionCode = resultObj.obj.versioncode;
441
+            //            int versionThis = ZConfig.versionCode;
442
+            //            if (versionThis < versionCode)
443
+            //            {
444
+            //                Dispatcher.Invoke(new Action(() =>
445
+            //                {
446
+            //                    appUpdateShow(resultObj.obj);
447
+            //                }));
448
+            //            }
449
+            //        }
450
+            //    }
451
+            //}).Start();
452
+        }
453
+        ///// <summary>
454
+        ///// 应用更新
455
+        ///// </summary>
456
+        ///// <param name="app"></param>
457
+        //private void appUpdateShow(AppModel app)
458
+        //{
459
+        //    AppUpdateWin win = new AppUpdateWin(app);
460
+        //    win.Topmost = true;
461
+        //    win.Owner = this;
462
+        //    win.ShowDialog();
463
+        //}
464
+        /// <summary>
465
+        /// 登陆服务-调用
466
+        /// </summary>
467
+        /// <returns></returns>
468
+        private object InvokeServering()
469
+        {
470
+            string accountNumber = string.Empty;
471
+            string password = string.Empty;
472
+            Dispatcher.Invoke(new Action(() =>
473
+            {
474
+                accountNumber = txbAccountNumber.Text.Replace(" ", "").Trim();
475
+                password = pobPassword.Password.Replace(" ", "").Trim();
476
+            }));
477
+            serverReturnCode = registerController.Login(accountNumber, password);
478
+            return APP.ErrorMessage;
479
+        }
480
+        /// <summary>
481
+        /// 登陆服务-返回结果
482
+        /// </summary>
483
+        /// <returns></returns>
484
+        public void InvokeServerCompate(object obj)
485
+        {
486
+            APP.myloading.Hide();
487
+            if (serverReturnCode == APP.ServerScuessCode)
488
+            {
489
+                grLogin.Visibility = Visibility.Collapsed;
490
+                grLoginTwo.Visibility = Visibility.Visible;
491
+                imgBrush.ImageSource = new BitmapImage(new Uri("pack://application:,,,/Images/Login/login2_1.png"));
492
+                txbHeader.Text = APP.LoginUser.username + "老师,您好!";
493
+                version_tb.Visibility = Visibility.Collapsed;
494
+                btnSetUp.Visibility = Visibility.Collapsed;
495
+                UpdateSettingString("userName", txbAccountNumber.Text);
496
+
497
+                new Thread(o =>
498
+                {
499
+                    InvokeClassListServering();
500
+                    Dispatcher.Invoke(new Action(() =>
501
+                    {
502
+                        InvokeServerClassListCompate();
503
+                    }));
504
+
505
+                }).Start();
506
+                new Thread(o =>
507
+                {
508
+                    InvokeTsubjectbookListServering();
509
+                    Dispatcher.Invoke(new Action(() =>
510
+                    {
511
+                        InvokeServerTsubjectbookListCompate();
512
+                    }));
513
+
514
+                }).Start();
515
+            }
516
+            else
517
+            {
518
+                MessageWindow.Show(APP.ErrorMessage);
519
+            }
520
+        }
521
+        /// <summary>
522
+        /// 教师任教班级服务-调用
523
+        /// </summary>
524
+        /// <returns></returns>
525
+        private object InvokeClassListServering()
526
+        {
527
+            serverReturnCode = registerController.ClassList();
528
+            return APP.ErrorMessage;
529
+        }
530
+        /// <summary>
531
+        /// 教师任教班级服务-返回结果
532
+        /// </summary>
533
+        /// <returns></returns>
534
+        public void InvokeServerClassListCompate()
535
+        {
536
+            if (serverReturnCode == APP.ServerScuessCode)
537
+            {
538
+                data.Columns.Add("Value");
539
+                data.Columns.Add("Key");
540
+                for (int i = 0; i < APP.ClassList.Count; i++)
541
+                {
542
+                    //创建一行
543
+                    DataRow row = data.NewRow();
544
+                    //将此行添加到table中
545
+                    data.Rows.Add(row);
546
+                    if (APP.ClassList[i].gradeid != null)
547
+                    {
548
+                        switch (APP.ClassList[i].gradeid)
549
+                        {
550
+                            case 1:
551
+                                data.Rows[i]["Value"] = "一年级" + APP.ClassList[i].classname;
552
+                                break;
553
+                            case 2:
554
+                                data.Rows[i]["Value"] = "二年级" + APP.ClassList[i].classname;
555
+                                break;
556
+                            case 3:
557
+                                data.Rows[i]["Value"] = "三年级" + APP.ClassList[i].classname;
558
+                                break;
559
+                            case 4:
560
+                                data.Rows[i]["Value"] = "四年级" + APP.ClassList[i].classname;
561
+                                break;
562
+                            case 5:
563
+                                data.Rows[i]["Value"] = "五年级" + APP.ClassList[i].classname;
564
+                                break;
565
+                            case 6:
566
+                                data.Rows[i]["Value"] = "六年级" + APP.ClassList[i].classname;
567
+                                break;
568
+                            case 7:
569
+                                data.Rows[i]["Value"] = "七年级" + APP.ClassList[i].classname;
570
+                                break;
571
+                            case 8:
572
+                                data.Rows[i]["Value"] = "八年级" + APP.ClassList[i].classname;
573
+                                break;
574
+                            case 9:
575
+                                data.Rows[i]["Value"] = "九年级" + APP.ClassList[i].classname;
576
+                                break;
577
+                            case 10:
578
+                                data.Rows[i]["Value"] = "高一" + APP.ClassList[i].classname;
579
+                                break;
580
+                            case 11:
581
+                                data.Rows[i]["Value"] = "高二" + APP.ClassList[i].classname;
582
+                                break;
583
+                            case 12:
584
+                                data.Rows[i]["Value"] = "高三" + APP.ClassList[i].classname;
585
+                                break;
586
+                            default:
587
+                                data.Rows[i]["Value"] = APP.ClassList[i].classname;
588
+                                break;
589
+                        }
590
+                    }
591
+                    else
592
+                    {
593
+                        data.Rows[i]["Value"] = APP.ClassList[i].classname;
594
+                    }
595
+
596
+                    data.Rows[i]["Key"] = APP.ClassList[i].classid;
597
+                }
598
+                dtComponentsUniqueNo = data.DefaultView.ToTable();
599
+                cmbClass.ItemsSource = dtComponentsUniqueNo.DefaultView;
600
+                cmbClass.SelectedIndex = 0;
601
+                //Shared.BackgroundWorkerHelper.RunWorkerAsync(InvokeTsubjectbookListServering, InvokeServerTsubjectbookListCompate);
602
+            }
603
+            else
604
+            {
605
+                MessageWindow.Show(APP.ErrorMessage);
606
+            }
607
+        }
608
+        /// <summary>
609
+        /// 教师教材列表服务-调用
610
+        /// </summary>
611
+        /// <returns></returns>
612
+        private object InvokeTsubjectbookListServering()
613
+        {
614
+            serverReturnCode = registerController.TsubjectbookList();
615
+            return APP.ErrorMessage;
616
+        }
617
+        /// <summary>
618
+        /// 教师教材列表服务-返回结果
619
+        /// </summary>
620
+        /// <returns></returns>
621
+        public void InvokeServerTsubjectbookListCompate()
622
+        {
623
+            if (serverReturnCode == APP.ServerScuessCode)
624
+            {
625
+                try
626
+                {
627
+                    if (File.Exists(APP.dataPath + "loginUserid.txt"))
628
+                    {
629
+                        string userid = System.IO.File.ReadAllText(APP.dataPath + "loginUserid.txt", Encoding.Default);
630
+                        if (userid.Equals(APP.LoginUser.userid.ToString()))
631
+                        {
632
+                            if (File.Exists(APP.dataPath + "loginLsbid.txt"))
633
+                            {
634
+                                string lsbid = System.IO.File.ReadAllText(APP.dataPath + "loginLsbid.txt", Encoding.Default);
635
+                                lsbids = Convert.ToInt32(lsbid);
636
+                                if (File.Exists(APP.dataPath + "loginDirectorid.txt"))
637
+                                {
638
+                                    string directorid = System.IO.File.ReadAllText(APP.dataPath + "loginDirectorid.txt", Encoding.Default);
639
+                                    directorids = Convert.ToInt32(directorid);
640
+                                }
641
+                            }
642
+                        }
643
+                    }
644
+                }
645
+                catch (Exception ex)
646
+                {
647
+                    LogHelper.WriteErrLog("【登陆(LoginWindow)" + ex.Message, ex);
648
+                }
649
+                int iTemp = 0;
650
+                for (int i = 0; i < APP.TsubjectbookList.Count; i++)
651
+                {
652
+                    if (lsbids != 0 && lsbids == APP.TsubjectbookList[i].lsbid)
653
+                    {
654
+                        iTemp = i;
655
+                    }
656
+                    pageData.bookList.Add(new ComboBoxBeanModel()
657
+                    {
658
+                        Key = APP.TsubjectbookList[i].lsbid,
659
+                        Value = $"{APP.TsubjectbookList[i].subjectname}  {APP.TsubjectbookList[i].bookname}"
660
+                    });
661
+                }
662
+                book_list.SelectedIndex = iTemp;
663
+                DataContext = pageData;
664
+            }
665
+            else
666
+            {
667
+                MessageWindow.Show(APP.ErrorMessage);
668
+            }
669
+        }
670
+        /// <summary>
671
+        /// 章节列表服务-调用
672
+        /// </summary>
673
+        /// <returns></returns>
674
+        private string InvokeDirectorListServering(int index)
675
+        {
676
+            int selectIndex = index;
677
+            if (selectIndex != -1)
678
+            {
679
+                APP.lsbid = APP.TsubjectbookList[selectIndex].lsbid;
680
+                APP.REQStartClass.subjectid = APP.TsubjectbookList[selectIndex].subjectid;
681
+                APP.REQStartClass.subjectname = APP.TsubjectbookList[selectIndex].subjectname;
682
+                APP.DirectorList = null;
683
+                serverReturnCode = registerController.DirectorList(APP.TsubjectbookList[selectIndex].lsbid,2,APP.LoginUser.userid);
684
+            }
685
+            return APP.ErrorMessage;
686
+        }
687
+        /// <summary>
688
+        /// 章节列表服务-返回结果
689
+        /// </summary>
690
+        /// <returns></returns>
691
+        public void InvokeServerDirectorListCompate()
692
+        {
693
+            if (serverReturnCode == APP.ServerScuessCode)
694
+            {
695
+                pageData.zhangjieList.Clear();
696
+                for (int i = 0; i < APP.DirectorList.Count; i++)
697
+                {
698
+                    DirectorListModel item = APP.DirectorList[i];
699
+                    pageData.zhangjieList.Add(new ComboBoxBeanModel()
700
+                    {
701
+                        Key = item.directorid,
702
+                        Value = item.directorname
703
+                    });
704
+                    addChild(item);
705
+                }
706
+                cmbTeachingMaterial.SelectedIndex = 0;
707
+                for (int i = 0; i < pageData.zhangjieList.Count; i++)
708
+                {
709
+                    if (pageData.zhangjieList[i].Key == directorids)
710
+                    {
711
+                        cmbTeachingMaterial.SelectedIndex = i;
712
+                    }
713
+                }
714
+            }
715
+            else
716
+            {
717
+                MessageWindow.Show(APP.ErrorMessage);
718
+            }
719
+        }
720
+        /// <summary>
721
+        /// 子章节递归
722
+        /// </summary>
723
+        /// <param name="directorList"></param>
724
+        private void addChild(DirectorListModel directorList)
725
+        {
726
+            if (directorList.children != null && directorList.children.Count > 0)
727
+            {
728
+                foreach (DirectorListModel child in directorList.children)
729
+                {
730
+                    pageData.zhangjieList.Add(new ComboBoxBeanModel()
731
+                    {
732
+                        Key = child.directorid,
733
+                        Value = getSpace(child.directorlevel) + child.directorname
734
+                    });
735
+                    if (child.children != null && child.children.Count > 0)
736
+                    {
737
+                        addChild(child);
738
+                    }
739
+                }
740
+            }
741
+        }
742
+        /// <summary>
743
+        /// 章节是否加空格符
744
+        /// </summary>
745
+        /// <param name="num"></param>
746
+        /// <returns></returns>
747
+        private string getSpace(int num)
748
+        {
749
+            string str = "";
750
+            for (int i = 0; i < num; i++)
751
+            {
752
+                str += "  ";
753
+            }
754
+            return str;
755
+        }
756
+        /// <summary>
757
+        /// 开始课堂服务-调用
758
+        /// </summary>
759
+        /// <returns></returns>
760
+        private object InvokeStartClassServering()
761
+        {
762
+            //Startclass startclass = new Startclass
763
+            //{
764
+            //    classid = ZCommonData.classid,
765
+            //    roomname = Shared.TeachingData.REQ_StartClass.roomname,
766
+            //    subjectid = Shared.TeachingData.REQ_StartClass.subjectid,
767
+            //    teacherid = ZCommonData.loginUser.userid,
768
+            //    directorid = Shared.TeachingData.REQ_StartClass.directorid,
769
+            //    directortype = 1,
770
+            //    schoolid = ZCommonData.loginUser.schoolid,
771
+            //    roomid = Shared.TeachingData.REQ_StartClass.roomid,
772
+            //    lsbid = ZCommonData.lsbid,
773
+            //    createtime = DataProvider.TimestampTotalSeconds()
774
+            //};
775
+            //ZSqliteManger.insertClassData(new ClassData()
776
+            //{
777
+            //    unix = DataProvider.TimestampTotalSeconds(),
778
+            //    roomid = ZCommonData.roomid,
779
+            //    api = "startclass",
780
+            //    json = ZJsonHelper.ToJson(startclass),
781
+            //    askid = DataProvider.TimestampAddRandomNumber()
782
+            //});
783
+            return APP.ErrorMessage;
784
+        }
785
+        /// <summary>
786
+        /// 开始课堂服务-返回结果
787
+        /// </summary>
788
+        /// <returns></returns>
789
+        public void InvokeStartClassCompate(object obj)
790
+        {
791
+            try
792
+            {
793
+                APP.myloading.Hide();
794
+                string imagepath = APP.classRoomImagePath();
795
+                if (!Directory.Exists(imagepath))
796
+                {
797
+                    Directory.CreateDirectory(imagepath);
798
+                }
799
+                //Shared.BackgroundWorkerHelper.RunWorkerAsync(InvokeClassStudentListServering, InvokeServerClassStudentListCompate);
800
+                ToolbarWindow win = new ToolbarWindow();
801
+
802
+                Close();
803
+                win.ShowDialog();
804
+            }
805
+            catch (Exception ex)
806
+            {
807
+
808
+                LogHelper.WriteErrLog("【LoginWindow】(InvokeStartClassCompate)" + ex.Message, ex);
809
+            }
810
+
811
+        }
812
+        /// <summary>
813
+        /// 班级学生--列表服务-调用
814
+        /// </summary>
815
+        /// <returns></returns>
816
+        private object InvokeClassStudentListServering()
817
+        {
818
+            //serverReturnCode = registerController.ClassStudentList();
819
+            return APP.ErrorMessage;
820
+        }
821
+        /// <summary>
822
+        /// 班级学生--列表服务服务-返回结果
823
+        /// </summary>
824
+        /// <returns></returns>
825
+        public void InvokeServerClassStudentListCompate(object obj)
826
+        {
827
+            //MyApp.myloading.Hide();
828
+            if (serverReturnCode == APP.ServerScuessCode)
829
+            {
830
+                APP.BackgroundWorkerHelper.RunWorkerAsync(InvokeStartClassServering, InvokeStartClassCompate);
831
+            }
832
+            else
833
+            {
834
+                APP.myloading.Hide();
835
+                MessageWindow.Show(APP.ErrorMessage);
836
+            }
837
+        }
838
+        #endregion 方法
839
+
840
+        private DataTable dtComponentsUniqueNo;
841
+        public DataTable DtComponentsUniqueNo
842
+        {
843
+            get => dtComponentsUniqueNo;
844
+            set => dtComponentsUniqueNo = value;
845
+        }
846
+        private void txbAccountNumber_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
847
+        {
848
+            txbAccountNumber.Text = "";
849
+            txbAccountNumber.Tag = "";
850
+        }
851
+
852
+        /// <summary>
853
+        /// 单选框事件
854
+        /// </summary>
855
+        /// <param name="sender"></param>
856
+        /// <param name="e"></param>
857
+
858
+        private void ckSaveName_Click(object sender, RoutedEventArgs e)
859
+        {
860
+            if (ckSaveName.IsChecked == false)
861
+            {
862
+                UpdateSettingString("isRemind", ckSaveName.IsChecked.ToString());
863
+            }
864
+            else
865
+            {
866
+                UpdateSettingString("isRemind", ckSaveName.IsChecked.ToString());
867
+            }
868
+        }
869
+
870
+        public void downloadBegin(int position)
871
+        {
872
+        }
873
+
874
+        public void downloadProgress(int position, int progress)
875
+        {
876
+        }
877
+
878
+        public void downloadEnd(int position, string filepath)
879
+        {
880
+            Console.WriteLine("下载完成" + filepath + " position:" + position);
881
+        }
882
+
883
+        /// <summary>
884
+        /// 教材选中事件
885
+        /// </summary>
886
+        /// <param name="sender"></param>
887
+        /// <param name="e"></param>
888
+        private void toolbar_list_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
889
+        {
890
+            int SelectedIndex = book_list.SelectedIndex;
891
+            new Thread(o =>
892
+            {
893
+                InvokeDirectorListServering(SelectedIndex);
894
+                Dispatcher.Invoke(new Action(() =>
895
+                {
896
+                    InvokeServerDirectorListCompate();
897
+                }));
898
+            }).Start();
899
+        }
900
+
901
+        /// <summary>
902
+        /// 设置
903
+        /// </summary>
904
+        /// <param name="sender"></param>
905
+        /// <param name="e"></param>
906
+        private void btnSetUp_Click(object sender, RoutedEventArgs e)
907
+        {
908
+            //SetWindow win = new SetWindow
909
+            //{
910
+            //    Topmost = true
911
+            //};
912
+            //win.Show();
913
+        }
914
+
915
+        public void downloadError(int position, string msg)
916
+        {
917
+            MessageWindow.Show(msg);
918
+        }
919
+    }
920
+
921
+    public class LoginPageData : NotifyModel
922
+    {
923
+        public ObservableCollection<ComboBoxBeanModel> bookList { get; set; }
924
+
925
+        public ObservableCollection<ComboBoxBeanModel> zhangjieList { get; set; }
926
+
927
+        public LoginPageData()
928
+        {
929
+            bookList = new ObservableCollection<ComboBoxBeanModel>();
930
+            zhangjieList = new ObservableCollection<ComboBoxBeanModel>();
931
+        }
932
+    }
933
+}

+ 0
- 12
XHZB.Desktop/MainWindow.xaml View File

@@ -1,12 +0,0 @@
1
-<Window x:Class="XHZB.Desktop.MainWindow"
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:XHZB.Desktop"
7
-        mc:Ignorable="d"
8
-        Title="MainWindow" Height="450" Width="800">
9
-    <Grid>
10
-        
11
-    </Grid>
12
-</Window>

+ 273
- 0
XHZB.Desktop/PracticeWindow.xaml View File

@@ -0,0 +1,273 @@
1
+<Window x:Class="XHZB.Desktop.PracticeWindow"
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:XHZB.Desktop" xmlns:Views="clr-namespace:Common.ZB;assembly=Common"
7
+        Title="PracticeWindow"  Width="1280"
8
+    Height="800"
9
+    Activated="Window_Activated"
10
+    AllowsTransparency="True"
11
+    Background="Transparent"
12
+    Closed="Window_Closed"
13
+    Deactivated="Window_Deactivated"
14
+    Opacity="1"
15
+    ShowInTaskbar="False"
16
+    WindowStyle="None"
17
+    mc:Ignorable="d">
18
+    <Window.Resources>
19
+        <DataTemplate x:Key="BMenuTemp">
20
+            <Button
21
+                x:Name="toolbar_item"
22
+                Width="60"
23
+                Height="60"
24
+                BorderThickness="0"
25
+                Click="menu_item_Click"
26
+                Cursor="Hand">
27
+                <Button.Content>
28
+                    <StackPanel Width="Auto" Background="Transparent">
29
+                        <Image
30
+                            Width="23"
31
+                            HorizontalAlignment="Center"
32
+                            Source="{Binding Pic}" />
33
+                        <TextBlock
34
+                            x:Name="menu_name"
35
+                            Margin="0,2,0,0"
36
+                            HorizontalAlignment="Center"
37
+                            Text="{Binding Name}">
38
+                            <TextBlock.Style>
39
+                                <Style TargetType="TextBlock">
40
+                                    <Setter Property="Foreground" Value="#3C525B" />
41
+                                    <Style.Triggers>
42
+                                        <DataTrigger Binding="{Binding Selected}" Value="true">
43
+                                            <Setter Property="Foreground" Value="#ffffff" />
44
+                                        </DataTrigger>
45
+                                    </Style.Triggers>
46
+                                </Style>
47
+                            </TextBlock.Style>
48
+                        </TextBlock>
49
+                    </StackPanel>
50
+                </Button.Content>
51
+                <Button.Style>
52
+                    <Style TargetType="Button">
53
+                        <Setter Property="Background" Value="Transparent" />
54
+                        <Setter Property="Template">
55
+                            <Setter.Value>
56
+                                <ControlTemplate TargetType="{x:Type Button}">
57
+                                    <Border
58
+                                        Background="{TemplateBinding Background}"
59
+                                        BorderBrush="Black"
60
+                                        BorderThickness="0">
61
+                                        <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
62
+                                    </Border>
63
+                                </ControlTemplate>
64
+                            </Setter.Value>
65
+                        </Setter>
66
+                        <Style.Triggers>
67
+                            <Trigger Property="IsMouseOver" Value="True">
68
+                                <Setter Property="Background" Value="#eee" />
69
+                            </Trigger>
70
+                            <DataTrigger Binding="{Binding Selected}" Value="true">
71
+                                <Setter Property="Background" Value="#136efb" />
72
+                            </DataTrigger>
73
+                        </Style.Triggers>
74
+                    </Style>
75
+                </Button.Style>
76
+            </Button>
77
+        </DataTemplate>
78
+
79
+        <Style TargetType="Button">
80
+            <Setter Property="BorderThickness" Value="0" />
81
+            <Setter Property="Background" Value="Transparent" />
82
+            <Setter Property="Template">
83
+                <Setter.Value>
84
+                    <ControlTemplate TargetType="{x:Type Button}">
85
+                        <Border
86
+                            Background="{TemplateBinding Background}"
87
+                            BorderBrush="Black"
88
+                            BorderThickness="0">
89
+                            <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
90
+                        </Border>
91
+                    </ControlTemplate>
92
+                </Setter.Value>
93
+            </Setter>
94
+            <Style.Triggers>
95
+                <Trigger Property="IsMouseOver" Value="True">
96
+                    <Setter Property="Background" Value="#ddd" />
97
+                </Trigger>
98
+            </Style.Triggers>
99
+        </Style>
100
+
101
+        <Style TargetType="TextBlock">
102
+            <Setter Property="Foreground" Value="#3C525B" />
103
+        </Style>
104
+    </Window.Resources>
105
+    <Grid x:Name="m_grid" Background="Black">
106
+
107
+        <Image x:Name="m_image" Margin="0,0,0,0"/>
108
+        <InkCanvas x:Name="blackboard_canvas" Background="Transparent" />
109
+
110
+        <Views:ClippingBorder
111
+            Width="60"
112
+            Height="58"
113
+            Margin="0,0,660,10"
114
+            HorizontalAlignment="Center"
115
+            VerticalAlignment="Bottom"
116
+            Background="#f3f3f3"
117
+            CornerRadius="4">
118
+            <StackPanel Orientation="Horizontal">
119
+                <Button 
120
+                    x:Name="save_button"
121
+                    Width="60"
122
+                    Click="save_button_Click"
123
+                    Cursor="Hand">
124
+                    <Button.Content>
125
+                        <StackPanel>
126
+                            <Image Width="23" Source=".\Images\Blackboard\class_1un.png" />
127
+                            <TextBlock Margin="0,4,0,0" Text="保存" />
128
+                        </StackPanel>
129
+                    </Button.Content>
130
+                </Button>
131
+            </StackPanel>
132
+        </Views:ClippingBorder>
133
+
134
+        <Views:ClippingBorder
135
+            Width="480"
136
+            Height="58"
137
+            Margin="0,0,0,10"
138
+            HorizontalAlignment="Center"
139
+            VerticalAlignment="Bottom"
140
+            Background="#f3f3f3"
141
+            CornerRadius="4">
142
+            <ItemsControl
143
+                x:Name="toolbar_list"
144
+                BorderThickness="0"
145
+                ItemTemplate="{StaticResource BMenuTemp}"
146
+                ItemsSource="{Binding menuList}">
147
+                <ItemsControl.ItemsPanel>
148
+                    <ItemsPanelTemplate>
149
+                        <StackPanel Orientation="Horizontal" />
150
+                    </ItemsPanelTemplate>
151
+                </ItemsControl.ItemsPanel>
152
+            </ItemsControl>
153
+        </Views:ClippingBorder>
154
+
155
+        <Views:ClippingBorder
156
+            x:Name="tip_Color"
157
+            Width="360"
158
+            Height="58"
159
+            Margin="0,0,0,80"
160
+            Visibility="Collapsed"
161
+            HorizontalAlignment="Center"
162
+            VerticalAlignment="Bottom"
163
+            Background="#FFFFFF"
164
+            CornerRadius="4">
165
+            <Border  Width="348"
166
+            Height="48" CornerRadius="6" Background="#E3E3E3" HorizontalAlignment="Center" Margin="6,6,6,6">
167
+                <Grid>
168
+                    <StackPanel Orientation="Horizontal">
169
+                        <Button Cursor="Hand" x:Name="btnWhite" Background="#FFFFFF" Width="38" Height="38" Margin="17,0,0,0" Click="BtnWhite_Click" />
170
+                        <Button Cursor="Hand" x:Name="btnRed" Background="#FF0000" Width="38" Height="38" Margin="17,0,0,0" Click="BtnRed_Click"/>
171
+                        <Button Cursor="Hand" x:Name="btnGray" Background="#A7A9AC" Width="38" Height="38" Margin="17,0,0,0" Click="BtnGray_Click"/>
172
+                        <Button Cursor="Hand" x:Name="btnCyanBlue" Background="#63D600" Width="38" Height="38" Margin="17,0,0,0" Click="BtnCyanBlue_Click"/>
173
+                        <Button Cursor="Hand" x:Name="btnYellow" Background="#FFBC00" Width="38" Height="38" Margin="17,0,0,0" Click="BtnYellow_Click"/>
174
+                        <Button Cursor="Hand" x:Name="btnBlue" Background="#00B4FC" Width="38" Height="38" Margin="17,0,0,0" Click="BtnBlue_Click"/>
175
+                    </StackPanel>
176
+                </Grid>
177
+            </Border>
178
+        </Views:ClippingBorder>
179
+
180
+        <Views:ClippingBorder
181
+            x:Name="tip_Size"
182
+            Width="197"
183
+            Height="58"
184
+            Margin="0,0,0,80"
185
+            Visibility="Collapsed"
186
+            HorizontalAlignment="Center"
187
+            VerticalAlignment="Bottom"
188
+            Background="#FFFFFF"
189
+            CornerRadius="6">
190
+            <Border  Width="185"
191
+            Height="48" CornerRadius="6" Background="#E3E3E3" HorizontalAlignment="Center" Margin="6,6,6,6">
192
+                <Grid>
193
+                    <StackPanel Orientation="Horizontal">
194
+                        <Button Cursor="Hand" x:Name="btnFine" Background="#E3E3E3" Width="42" Height="42" Margin="10,0,0,0" Click="BtnFine_Click" >
195
+                            <Image Width="23" Source=".\Images\Blackboard\class_s4.png"/>
196
+                        </Button>
197
+                        <Button Cursor="Hand" x:Name="btnIn" Background="#E3E3E3" Width="42" Height="42" Margin="17,0,0,0" Click="BtnIn_Click" >
198
+                            <Image Width="33" Source=".\Images\Blackboard\class_s3.png"/>
199
+                        </Button>
200
+                        <Button Cursor="Hand" x:Name="btnCrude" Background="#E3E3E3" Width="42" Height="42" Margin="17,0,0,0" Click="BtnCrude_Click" >
201
+                            <Image Width="36" Source=".\Images\Blackboard\class_s2.png"/>
202
+                        </Button>
203
+                    </StackPanel>
204
+                </Grid>
205
+            </Border>
206
+        </Views:ClippingBorder>
207
+
208
+        <Views:ClippingBorder
209
+            Width="180"
210
+            Height="58"
211
+            Margin="790,0,0,10"
212
+            HorizontalAlignment="Center"
213
+            VerticalAlignment="Bottom"
214
+            Background="#f3f3f3"
215
+            CornerRadius="4">
216
+            <StackPanel Orientation="Horizontal">
217
+                <Button Cursor="Hand"
218
+                    x:Name="last_button"
219
+                    Width="60"
220
+                    Click="last_button_Click">
221
+                    <Button.Content>
222
+                        <StackPanel>
223
+                            <Image Width="16" Source=".\Images\Blackboard\class_p1.png" />
224
+                            <TextBlock Margin="0,8,0,0" Text="上一页" />
225
+                        </StackPanel>
226
+                    </Button.Content>
227
+                </Button>
228
+                <Grid Width="60">
229
+                    <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
230
+
231
+                        <StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
232
+                            <TextBlock Text="{Binding currpage}" TextAlignment="Center" FontSize="15"/>
233
+                            <TextBlock Text="/" TextAlignment="Center" FontSize="15"/>
234
+                            <TextBlock Text="{Binding pagenum}" TextAlignment="Center" FontSize="15"/>
235
+                        </StackPanel>
236
+
237
+                        <TextBlock
238
+                            Margin="0,8,0,0"
239
+                            HorizontalAlignment="Center"
240
+                            Text="页码" />
241
+                    </StackPanel>
242
+                </Grid>
243
+                <Button Cursor="Hand"
244
+                    x:Name="next_btn"
245
+                    Width="60"
246
+                    Click="next_btn_Click">
247
+                    <Button.Content>
248
+                        <StackPanel>
249
+                            <Image Width="16" Source=".\Images\Blackboard\class_p2.png" />
250
+                            <TextBlock Margin="0,8,0,0" Text="下一页" />
251
+                        </StackPanel>
252
+                    </Button.Content>
253
+                </Button>
254
+            </StackPanel>
255
+        </Views:ClippingBorder>
256
+
257
+        <Views:ClippingBorder
258
+            x:Name="tip_outer"
259
+            Width="760"
260
+            Height="64"
261
+            HorizontalAlignment="Center"
262
+            Background="#66000000"
263
+            CornerRadius="4"
264
+            Visibility="Collapsed">
265
+            <TextBlock
266
+                x:Name="tip_tb"
267
+                HorizontalAlignment="Center"
268
+                VerticalAlignment="Center"
269
+                FontSize="26"
270
+                Foreground="#ffffff" />
271
+        </Views:ClippingBorder>
272
+    </Grid>
273
+</Window>

+ 539
- 0
XHZB.Desktop/PracticeWindow.xaml.cs View File

@@ -0,0 +1,539 @@
1
+using Common.system;
2
+using System;
3
+using System.Collections.Generic;
4
+using System.Threading;
5
+using System.Windows;
6
+using System.Windows.Controls;
7
+using System.Windows.Media;
8
+using System.Windows.Media.Imaging;
9
+using XHZB.Desktop.Utils;
10
+using XHZB.Model;
11
+
12
+namespace XHZB.Desktop
13
+{
14
+    /// <summary>
15
+    /// 批注
16
+    /// </summary>
17
+    public partial class PracticeWindow : Window
18
+    {
19
+        private readonly ZBPageModel pageData = new ZBPageModel();
20
+        private readonly BlackboardNew myblackboard;
21
+        internal double pwidth = SystemParameters.PrimaryScreenWidth;
22
+        internal double pHeight = SystemParameters.PrimaryScreenHeight;
23
+        private readonly List<string> ImageInfo = new List<string>();
24
+        private readonly int serverReturnCode = 0;
25
+        //private readonly RegisterController registerController = new RegisterController();
26
+        /// <summary>
27
+        /// 保存图片路径
28
+        /// </summary>
29
+        private string Rfpath = string.Empty;
30
+        /// <summary>
31
+        /// 初始创建黑板
32
+        /// </summary>
33
+        private readonly bool isfirstload = true;
34
+        private System.Windows.Media.Color Color = System.Windows.Media.Colors.Red;
35
+        private int Size = 3;
36
+        private string AskidName = string.Empty;
37
+
38
+        /// <summary>
39
+        /// 批注
40
+        /// </summary>
41
+        public PracticeWindow()
42
+        {
43
+            InitializeComponent();
44
+            if (isfirstload)
45
+            {
46
+                myblackboard = new BlackboardNew(blackboard_canvas, Colors.Red);
47
+                initData();
48
+                isfirstload = false;
49
+            }
50
+        }
51
+
52
+        /// <summary>
53
+        /// 初始化页面
54
+        /// </summary>
55
+        public void Initialize()
56
+        {
57
+            this.Opacity = 1;
58
+            m_grid.Background = new SolidColorBrush(Colors.Black);
59
+            AskidName = string.Empty;
60
+            isFDetais = true;
61
+            pageData.pagenum = ImageInfo.Count;
62
+            Rfpath = string.Empty;
63
+            Uri uri = new Uri(ImageInfo[pageData.currpage - 1], UriKind.Absolute);
64
+            BitmapImage bitmapImage = new BitmapImage(uri);
65
+            myblackboard.changepage(pageData.currpage - 1);
66
+            m_image.Source = bitmapImage;
67
+        }
68
+
69
+        private void initData()
70
+        {
71
+            pageData.menuList.Add(new ZBMenuModel()
72
+            {
73
+                Name = "铅笔",
74
+                Pic = "../Images/Blackboard/class_2s.png",
75
+                Selected = true
76
+            });
77
+            pageData.menuList.Add(new ZBMenuModel()
78
+            {
79
+                Name = "颜色",
80
+                Pic = "../Images/Blackboard/class_c1.png",
81
+                Selected = false
82
+            });
83
+            pageData.menuList.Add(new ZBMenuModel()
84
+            {
85
+                Name = "粗细",
86
+                Pic = "../Images/Blackboard/class_s1.png",
87
+                Selected = false
88
+            });
89
+            pageData.menuList.Add(new ZBMenuModel()
90
+            {
91
+                Name = "橡皮",
92
+                Pic = "../Images/Blackboard/class_3un.png",
93
+                Selected = false
94
+            });
95
+            pageData.menuList.Add(new ZBMenuModel()
96
+            {
97
+                Name = "清空",
98
+                Pic = "../Images/Blackboard/class_6un.png",
99
+                Selected = false
100
+            });
101
+            pageData.menuList.Add(new ZBMenuModel()
102
+            {
103
+                Name = "撤销",
104
+                Pic = "../Images/Blackboard/class_4un.png",
105
+                Selected = false
106
+            });
107
+            pageData.menuList.Add(new ZBMenuModel()
108
+            {
109
+                Name = "恢复",
110
+                Pic = "../Images/Blackboard/class_5un.png",
111
+                Selected = false
112
+            });
113
+
114
+            pageData.menuList.Add(new ZBMenuModel()
115
+            {
116
+                Name = "退出",
117
+                Pic = "../Images/Blackboard/class_7un.png",
118
+                Selected = false
119
+            });
120
+
121
+            DataContext = pageData;
122
+        }
123
+
124
+        /// <summary>
125
+        /// 暂修改为传图片地址 新增一页
126
+        /// </summary>
127
+        /// <param name="_imageInfo"></param>
128
+        public void addImage(string _imageInfo)
129
+        {
130
+            ImageInfo.Add(_imageInfo);
131
+
132
+            pageData.currpage = ImageInfo.Count;
133
+            Initialize();
134
+        }
135
+
136
+        private void menu_item_Click(object sender, RoutedEventArgs e)
137
+        {
138
+            int clickindex = 0;
139
+            List<Button> buttons = VTHelper.FindChilds<Button>(toolbar_list, "toolbar_item");
140
+            for (int i = 0; i < buttons.Count; i++)
141
+            {
142
+                if (buttons[i] == sender)
143
+                {
144
+                    clickindex = i;
145
+                    break;
146
+                }
147
+            }
148
+            if (clickindex < pageData.menuList.Count)
149
+            {
150
+                //ZBMenu menudata = pageData.menuList[clickindex];
151
+                if (clickindex == 0)
152
+                {
153
+                    tip_Size.Visibility = Visibility.Collapsed;
154
+                    tip_Color.Visibility = Visibility.Collapsed;
155
+                    if (pageData.menuList[0].Selected)
156
+                    {
157
+
158
+                    }
159
+                    else
160
+                    {
161
+                        pageData.menuList[0].Selected = true;
162
+                        pageData.menuList[3].Selected = false;
163
+                        pageData.menuList[0].Pic = "../Images/Blackboard/class_2s.png";
164
+                        pageData.menuList[3].Pic = "../Images/Blackboard/class_3un.png";
165
+                        myblackboard.change_pen(Color, Size);
166
+                    }
167
+                }
168
+                if (clickindex == 1)
169
+                {
170
+                    tip_Color.Visibility = Visibility.Visible;
171
+                    tip_Size.Visibility = Visibility.Collapsed;
172
+                }
173
+                if (clickindex == 2)
174
+                {
175
+                    tip_Color.Visibility = Visibility.Collapsed;
176
+                    tip_Size.Visibility = Visibility.Visible;
177
+                }
178
+                else if (clickindex == 3)
179
+                {
180
+                    tip_Color.Visibility = Visibility.Collapsed;
181
+                    pageData.menuList[0].Selected = false;
182
+                    pageData.menuList[3].Selected = true;
183
+                    pageData.menuList[0].Pic = "../Images/Blackboard/class_2un.png";
184
+                    pageData.menuList[3].Pic = "../Images/Blackboard/class_3s.png";
185
+                    myblackboard.change_erase();
186
+                }
187
+                else if (clickindex == 4)
188
+                {
189
+                    tip_Size.Visibility = Visibility.Collapsed;
190
+                    tip_Color.Visibility = Visibility.Collapsed;
191
+                    myblackboard.clear();
192
+                }
193
+                else if (clickindex == 5)
194
+                {
195
+                    tip_Size.Visibility = Visibility.Collapsed;
196
+                    tip_Color.Visibility = Visibility.Collapsed;
197
+                    myblackboard.undo();
198
+                }
199
+                else if (clickindex == 6)
200
+                {
201
+                    tip_Size.Visibility = Visibility.Collapsed;
202
+                    tip_Color.Visibility = Visibility.Collapsed;
203
+                    myblackboard.redo();
204
+                }
205
+                else if (clickindex == 7)
206
+                {
207
+                    tip_Size.Visibility = Visibility.Collapsed;
208
+                    tip_Color.Visibility = Visibility.Collapsed;
209
+
210
+                    //Hide();
211
+
212
+                    new Thread(new ThreadStart(new Action(() =>
213
+                    {
214
+                        Dispatcher.Invoke(new Action(() =>
215
+                        {
216
+                            m_image.Source = null;
217
+                            blackboard_canvas.Strokes.Clear();
218
+
219
+                            m_grid.Background = new SolidColorBrush(Colors.Transparent);
220
+                            this.Opacity = 0;
221
+                        }));
222
+
223
+                        Thread.Sleep(50);
224
+                        Dispatcher.Invoke(new Action(() =>
225
+                        {
226
+                            Hide();
227
+                        }));
228
+                    }))).Start();
229
+                }
230
+            }
231
+        }
232
+
233
+        // 保存图片
234
+        private void save_button_Click(object sender, RoutedEventArgs e)
235
+        {
236
+            tip_Size.Visibility = Visibility.Collapsed;
237
+            tip_Color.Visibility = Visibility.Collapsed;
238
+            try
239
+            {
240
+                string filepath = APP.GetImagePath(out string serverSavePath);
241
+                Rfpath = serverSavePath;
242
+                //TeachingDataStatic.ClassScreenshot.Add(filepath);//统计截图
243
+                ImageHelper.SaveUIToImage(m_grid, filepath, (int)Math.Round(m_grid.ActualWidth), (int)Math.Round(m_grid.ActualHeight));
244
+                //}
245
+
246
+
247
+                tip_tb.Text = "保存成功";
248
+                tip_outer.Visibility = Visibility.Visible;
249
+                new Thread(o =>
250
+                {
251
+                    int seconds = 3;//通知持续5s后消失
252
+                    System.Threading.Thread.Sleep(TimeSpan.FromSeconds(seconds));
253
+                    //Invoke到主进程中去执行
254
+                    Dispatcher.Invoke(new Action(() =>
255
+                    {
256
+                        tip_outer.Visibility = Visibility.Hidden;
257
+                    }));
258
+                }).Start();
259
+
260
+                APP.BackgroundWorkerHelper.RunWorkerAsync(InvokeServering, InvokeServerCompate);
261
+            }
262
+            catch (Exception err)
263
+            {
264
+                Console.WriteLine(err.Message);
265
+            }
266
+        }
267
+
268
+        /// <summary>
269
+        /// 上一页
270
+        /// </summary>
271
+        /// <param name="sender"></param>
272
+        /// <param name="e"></param>
273
+        private void last_button_Click(object sender, RoutedEventArgs e)
274
+        {
275
+            tip_Size.Visibility = Visibility.Collapsed;
276
+            tip_Color.Visibility = Visibility.Collapsed;
277
+            if (pageData.currpage > 1)
278
+            {
279
+                pageData.currpage -= 1;
280
+                Initialize();
281
+            }
282
+        }
283
+
284
+        /// <summary>
285
+        /// 下一页
286
+        /// </summary>
287
+        /// <param name="sender"></param>
288
+        /// <param name="e"></param>
289
+        private void next_btn_Click(object sender, RoutedEventArgs e)
290
+        {
291
+            tip_Size.Visibility = Visibility.Collapsed;
292
+            tip_Color.Visibility = Visibility.Collapsed;
293
+            if (pageData.currpage < pageData.pagenum)
294
+            {
295
+                pageData.currpage += 1;
296
+                Initialize();
297
+            }
298
+        }
299
+
300
+        private void Window_Activated(object sender, EventArgs e)
301
+        {
302
+            //Console.WriteLine("Window_Activated");
303
+        }
304
+        bool isFDetais = true;
305
+        /// <summary>
306
+        /// 简答题详情
307
+        /// </summary>
308
+        public void Detai(bool isDetai, string askidName)
309
+        {
310
+            isFDetais = isDetai;
311
+            //AskidName = askidName;
312
+        }
313
+        private void Window_Deactivated(object sender, EventArgs e)
314
+        {
315
+            try
316
+            {
317
+                if (isFDetais)
318
+                {
319
+                    ////Console.WriteLine("Window_Deactivated");
320
+                    ToolbarWindow toolbarWin = (ToolbarWindow)Owner;
321
+                    if (toolbarWin != null)
322
+                    {
323
+                        toolbarWin.Show();
324
+                    }
325
+
326
+
327
+                    Console.WriteLine("imageList.Count" + ImageInfo.Count);
328
+                }
329
+
330
+            }
331
+            catch (Exception ex)
332
+            {
333
+
334
+
335
+            }
336
+
337
+        }
338
+
339
+        /// <summary>
340
+        /// 课堂--保存图片服务-调用
341
+        /// </summary>
342
+        /// <returns></returns>
343
+        private object InvokeServering()
344
+        {
345
+            //Savefile savefile = new Savefile
346
+            //{
347
+            //    roomid = Shared.TeachingData.REQ_StartClass.roomid,
348
+            //    rfpath = Rfpath.Replace("\\", "/")
349
+            //};
350
+            //;
351
+            //savefile.rftype = 2;
352
+            //savefile.createid = ZCommonData.loginUser.userid;
353
+            //savefile.schoolid = ZCommonData.loginUser.schoolid;
354
+            //savefile.createtime = DataProvider.TimestampTotalSeconds();
355
+            //ZSqliteManger.insertClassData(new ClassData()
356
+            //{
357
+            //    unix = DataProvider.TimestampTotalSeconds(),
358
+            //    roomid = ZCommonData.roomid,
359
+            //    api = "savefile",
360
+            //    json = ZJsonHelper.ToJson(savefile),
361
+            //    askid = DataProvider.TimestampAddRandomNumber()
362
+            //});
363
+            return APP.ErrorMessage;
364
+        }
365
+
366
+        /// <summary>
367
+        /// 课堂--保存图片服务-返回结果
368
+        /// </summary>
369
+        /// <returns></returns>
370
+        public void InvokeServerCompate(object obj)
371
+        {
372
+            if (serverReturnCode == APP.ServerScuessCode)
373
+            {
374
+            }
375
+        }
376
+        /// <summary>
377
+        /// 页面关闭
378
+        /// </summary>
379
+        /// <param name="sender"></param>
380
+        /// <param name="e"></param>
381
+        private void Window_Closed(object sender, EventArgs e)
382
+        {
383
+            tip_Size.Visibility = Visibility.Collapsed;
384
+            tip_Color.Visibility = Visibility.Collapsed;
385
+            click_closeClick();
386
+        }
387
+
388
+        #region 关闭委托
389
+
390
+        /// <summary>
391
+        /// 关闭委托 结束页面 创建人:赵耀 创建时间:2020年8月13日
392
+        /// </summary>
393
+        /// <param name="sender"></param>
394
+        /// <param name="e"></param>
395
+        public delegate void CloseClick();
396
+
397
+        /// <summary>
398
+        /// 关闭委托 结束页面 创建人:赵耀 创建时间:2020年8月13日
399
+        /// </summary>
400
+        public event CloseClick click_closeClick;
401
+
402
+        #endregion 关闭委托
403
+        /// <summary>
404
+        /// 画笔颜色事件 白色
405
+        /// </summary>
406
+        /// <param name="sender"></param>
407
+        /// <param name="e"></param>
408
+        private void BtnWhite_Click(object sender, RoutedEventArgs e)
409
+        {
410
+            pageData.menuList[0].Selected = true;
411
+            pageData.menuList[3].Selected = false;
412
+            pageData.menuList[0].Pic = "../Images/Blackboard/class_2s.png";
413
+            pageData.menuList[3].Pic = "../Images/Blackboard/class_3un.png";
414
+            Color = Colors.White;
415
+            myblackboard.change_pen(Color, Size);
416
+            tip_Color.Visibility = Visibility.Collapsed;
417
+        }
418
+        /// <summary>
419
+        /// 画笔颜色事件 红色
420
+        /// </summary>
421
+        /// <param name="sender"></param>
422
+        /// <param name="e"></param>
423
+        private void BtnRed_Click(object sender, RoutedEventArgs e)
424
+        {
425
+            pageData.menuList[0].Selected = true;
426
+            pageData.menuList[3].Selected = false;
427
+            pageData.menuList[0].Pic = "../Images/Blackboard/class_2s.png";
428
+            pageData.menuList[3].Pic = "../Images/Blackboard/class_3un.png";
429
+            Color = Colors.Red;
430
+            myblackboard.change_pen(Color, Size);
431
+            tip_Color.Visibility = Visibility.Collapsed;
432
+        }
433
+        /// <summary>
434
+        /// 画笔颜色事件 灰色
435
+        /// </summary>
436
+        /// <param name="sender"></param>
437
+        /// <param name="e"></param>
438
+        private void BtnGray_Click(object sender, RoutedEventArgs e)
439
+        {
440
+            pageData.menuList[0].Selected = true;
441
+            pageData.menuList[3].Selected = false;
442
+            pageData.menuList[0].Pic = "../Images/Blackboard/class_2s.png";
443
+            pageData.menuList[3].Pic = "../Images/Blackboard/class_3un.png";
444
+            Color = Colors.Gray;
445
+            myblackboard.change_pen(Color, Size);
446
+            tip_Color.Visibility = Visibility.Collapsed;
447
+        }
448
+        /// <summary>
449
+        /// 画笔颜色事件 青色
450
+        /// </summary>
451
+        /// <param name="sender"></param>
452
+        /// <param name="e"></param>
453
+        private void BtnCyanBlue_Click(object sender, RoutedEventArgs e)
454
+        {
455
+            pageData.menuList[0].Selected = true;
456
+            pageData.menuList[3].Selected = false;
457
+            pageData.menuList[0].Pic = "../Images/Blackboard/class_2s.png";
458
+            pageData.menuList[3].Pic = "../Images/Blackboard/class_3un.png";
459
+            Color = Colors.LimeGreen;
460
+            myblackboard.change_pen(Color, Size);
461
+            tip_Color.Visibility = Visibility.Collapsed;
462
+        }
463
+        /// <summary>
464
+        /// 画笔颜色事件 黄色
465
+        /// </summary>
466
+        /// <param name="sender"></param>
467
+        /// <param name="e"></param>
468
+        private void BtnYellow_Click(object sender, RoutedEventArgs e)
469
+        {
470
+            pageData.menuList[0].Selected = true;
471
+            pageData.menuList[3].Selected = false;
472
+            pageData.menuList[0].Pic = "../Images/Blackboard/class_2s.png";
473
+            pageData.menuList[3].Pic = "../Images/Blackboard/class_3un.png";
474
+            Color = Colors.Gold;
475
+            myblackboard.change_pen(Color, Size);
476
+            tip_Color.Visibility = Visibility.Collapsed;
477
+        }
478
+        /// <summary>
479
+        /// 画笔颜色事件 蓝色
480
+        /// </summary>
481
+        /// <param name="sender"></param>
482
+        /// <param name="e"></param>
483
+        private void BtnBlue_Click(object sender, RoutedEventArgs e)
484
+        {
485
+            pageData.menuList[0].Selected = true;
486
+            pageData.menuList[3].Selected = false;
487
+            pageData.menuList[0].Pic = "../Images/Blackboard/class_2s.png";
488
+            pageData.menuList[3].Pic = "../Images/Blackboard/class_3un.png";
489
+            Color = Colors.DeepSkyBlue;
490
+            myblackboard.change_pen(Color, Size);
491
+            tip_Color.Visibility = Visibility.Collapsed;
492
+        }
493
+        /// <summary>
494
+        /// 细
495
+        /// </summary>
496
+        /// <param name="sender"></param>
497
+        /// <param name="e"></param>
498
+        private void BtnFine_Click(object sender, RoutedEventArgs e)
499
+        {
500
+            pageData.menuList[0].Selected = true;
501
+            pageData.menuList[3].Selected = false;
502
+            pageData.menuList[0].Pic = "../Images/Blackboard/class_2s.png";
503
+            pageData.menuList[3].Pic = "../Images/Blackboard/class_3un.png";
504
+            Size = 3;
505
+            myblackboard.change_pen(Color, Size);
506
+            tip_Size.Visibility = Visibility.Collapsed;
507
+        }
508
+        /// <summary>
509
+        /// 中
510
+        /// </summary>
511
+        /// <param name="sender"></param>
512
+        /// <param name="e"></param>
513
+        private void BtnIn_Click(object sender, RoutedEventArgs e)
514
+        {
515
+            pageData.menuList[0].Selected = true;
516
+            pageData.menuList[3].Selected = false;
517
+            pageData.menuList[0].Pic = "../Images/Blackboard/class_2s.png";
518
+            pageData.menuList[3].Pic = "../Images/Blackboard/class_3un.png";
519
+            Size = 6;
520
+            myblackboard.change_pen(Color, Size);
521
+            tip_Size.Visibility = Visibility.Collapsed;
522
+        }
523
+        /// <summary>
524
+        /// 粗
525
+        /// </summary>
526
+        /// <param name="sender"></param>
527
+        /// <param name="e"></param>
528
+        private void BtnCrude_Click(object sender, RoutedEventArgs e)
529
+        {
530
+            pageData.menuList[0].Selected = true;
531
+            pageData.menuList[3].Selected = false;
532
+            pageData.menuList[0].Pic = "../Images/Blackboard/class_2s.png";
533
+            pageData.menuList[3].Pic = "../Images/Blackboard/class_3un.png";
534
+            Size = 12;
535
+            myblackboard.change_pen(Color, Size);
536
+            tip_Size.Visibility = Visibility.Collapsed;
537
+        }
538
+    }
539
+}

+ 48
- 0
XHZB.Desktop/RollCallPerfectionWindow.xaml View File

@@ -0,0 +1,48 @@
1
+<Window x:Class="XHZB.Desktop.RollCallPerfectionWindow"
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:XHZB.Desktop"
7
+        mc:Ignorable="d"
8
+        Title="RollCallPerfectionWindow" Width="1280"
9
+    Height="800"
10
+    AllowsTransparency="True"
11
+
12
+    Opacity="1"
13
+    ShowInTaskbar="False"
14
+    WindowStyle="None">
15
+    <Window.Background>
16
+        <SolidColorBrush Opacity="1" ></SolidColorBrush>
17
+    </Window.Background>
18
+    <Viewbox>
19
+        <Grid>
20
+            <Border Opacity="0.6" Background="#000000" Height="1080" Width="1920" />
21
+            <StackPanel>
22
+                <Image Source=".\Images\RollCall\rollCall_0_1_1.png" Height="665" Width="671" Margin="0,180,0,0" />
23
+            </StackPanel>
24
+            <Image Source=".\Images\RollCall\rollCall_2_1.png" Height="auto" Width="332" Margin="0,140,0,0" />
25
+            <TextBlock x:Name="txbName" Text="" FontSize="40" Foreground="White" HorizontalAlignment="Center" Margin="0,570,0,0" />
26
+            <Button Cursor="Hand"  x:Name="btnNewRollCall"  FontWeight="Black" Content="重新点名" Foreground="White" FontSize="26" Width="200" Height="55" Click="btnNewRollCall_Click"  Margin="0,338,280,0">
27
+                <Button.Template>
28
+                    <ControlTemplate TargetType="{x:Type Button}">
29
+                        <Border BorderBrush="{TemplateBinding Control.BorderBrush}" BorderThickness="1" CornerRadius="27,27,27,27">
30
+                            <Border.Background>#FD790C</Border.Background>
31
+                            <ContentPresenter Content="{TemplateBinding ContentControl.Content}" HorizontalAlignment="Center" VerticalAlignment="Center" ></ContentPresenter>
32
+                        </Border>
33
+                    </ControlTemplate>
34
+                </Button.Template>
35
+            </Button>
36
+            <Button Cursor="Hand" x:Name="btnEnd"  FontWeight="Black" Content="结束点名" Foreground="White"  FontSize="26" Width="200" Height="55" Click="btnEnd_Click" Margin="280,338,0,0">
37
+                <Button.Template>
38
+                    <ControlTemplate TargetType="{x:Type Button}">
39
+                        <Border BorderBrush="{TemplateBinding Control.BorderBrush}" BorderThickness="1" CornerRadius="27,27,27,27">
40
+                            <Border.Background>#6098FF</Border.Background>
41
+                            <ContentPresenter Content="{TemplateBinding ContentControl.Content}" HorizontalAlignment="Center" VerticalAlignment="Center" ></ContentPresenter>
42
+                        </Border>
43
+                    </ControlTemplate>
44
+                </Button.Template>
45
+            </Button>
46
+        </Grid>
47
+    </Viewbox>
48
+</Window>

+ 93
- 0
XHZB.Desktop/RollCallPerfectionWindow.xaml.cs View File

@@ -0,0 +1,93 @@
1
+using System;
2
+using System.Threading;
3
+using System.Windows;
4
+using System.Windows.Controls;
5
+
6
+namespace XHZB.Desktop
7
+{
8
+    //定义委托
9
+    public delegate void ChangeTextHandler(string text);
10
+
11
+    /// <summary>
12
+    /// RollCallPerfectionWindow.xaml 的交互逻辑
13
+    /// </summary>
14
+    public partial class RollCallPerfectionWindow : Window
15
+    {
16
+        //定义事件
17
+        public event ChangeTextHandler ChangeTextEvent;
18
+
19
+        public RollCallPerfectionWindow(string _name, string _pic)
20
+        {
21
+            InitializeComponent();
22
+            this.Opacity = 1;
23
+            txbName.Text = _name;
24
+        }
25
+
26
+        public void Name(string _name)
27
+        {
28
+            this.Opacity = 1;
29
+            txbName.Text = _name;
30
+        }
31
+
32
+        /// <summary>
33
+        /// </summary>
34
+        /// <param name="sender">事件源</param>
35
+        /// <param name="e">事件对象</param>
36
+        private void radioButton1_CheckedChanged(object sender, EventArgs e)
37
+        {
38
+        }
39
+
40
+        /// <summary>
41
+        /// 结束
42
+        /// </summary>
43
+        /// <param name="sender"></param>
44
+        /// <param name="e"></param>
45
+        private void btnEnd_Click(object sender, RoutedEventArgs e)
46
+        {
47
+            //ToolbarWindow.IsNotOperation = false;
48
+
49
+            new Thread(new ThreadStart(new Action(() =>
50
+            {
51
+                Dispatcher.Invoke(new Action(() =>
52
+                {
53
+                    txbName.Text = "";
54
+                    this.Opacity = 0;
55
+                }));
56
+                Thread.Sleep(200);
57
+                Dispatcher.Invoke(new Action(() =>
58
+                {
59
+                    ChangeTextEvent?.Invoke("关闭窗口");
60
+                    Hide();
61
+                }));
62
+            }))).Start();
63
+        }
64
+
65
+        /// <summary>
66
+        /// 重新点名
67
+        /// </summary>
68
+        /// <param name="sender"></param>
69
+        /// <param name="e"></param>
70
+        private void btnNewRollCall_Click(object sender, RoutedEventArgs e)
71
+        {
72
+            RadioButton rdo = sender as RadioButton;
73
+            //引发事件
74
+            if (ChangeTextEvent != null)
75
+            {
76
+                ChangeTextEvent("重新点名");
77
+            }
78
+            new Thread(new ThreadStart(new Action(() =>
79
+            {
80
+                Dispatcher.Invoke(new Action(() =>
81
+                {
82
+                    txbName.Text = "";
83
+                    this.Opacity = 0;
84
+                }));
85
+                Thread.Sleep(200);
86
+                Dispatcher.Invoke(new Action(() =>
87
+                {
88
+                    Hide();
89
+                }));
90
+            }))).Start();
91
+        }
92
+    }
93
+}

+ 352
- 0
XHZB.Desktop/RollCallWindow.xaml View File

@@ -0,0 +1,352 @@
1
+<Window x:Class="XHZB.Desktop.RollCallWindow"
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:XHZB.Desktop"
7
+        Title="RollCallWindow"    Width="1066"
8
+    Height="768"
9
+    AllowsTransparency="True"
10
+    Closed="Window_Closed"
11
+    Opacity="1"
12
+    ShowInTaskbar="False"
13
+    WindowStartupLocation="CenterScreen"
14
+    WindowStyle="None"
15
+    mc:Ignorable="d" BorderThickness="7">
16
+    <Window.Effect>
17
+        <DropShadowEffect BlurRadius="10" Color="#bababa" Direction="80" ShadowDepth="0"/>
18
+    </Window.Effect>
19
+    <Window.Background>
20
+        <SolidColorBrush Opacity="0" Color="#000000" />
21
+    </Window.Background>
22
+    <Window.Resources>
23
+
24
+        <Style x:Key="ListBoxItemStyle1" TargetType="{x:Type ListBoxItem}">
25
+            <Setter Property="FocusVisualStyle" Value="{x:Null}" />
26
+        </Style>
27
+        <Style x:Key="MyItemContainStyle" TargetType="ListBoxItem">
28
+            <!--  设置控件模板  -->
29
+            <Setter Property="Template">
30
+                <Setter.Value>
31
+                    <ControlTemplate TargetType="ListBoxItem">
32
+                        <Border
33
+                            Margin="4,0,0,0"
34
+                            Padding="0"
35
+                            Background="{TemplateBinding Background}">
36
+                            <ContentPresenter
37
+                                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
38
+                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
39
+                                TextBlock.Foreground="{TemplateBinding Foreground}" />
40
+                        </Border>
41
+                    </ControlTemplate>
42
+                </Setter.Value>
43
+            </Setter>
44
+        </Style>
45
+        <Style x:Key="BigFontButtonStyle" TargetType="Button">
46
+            <Style.Setters>
47
+                <Setter Property="Template">
48
+                    <Setter.Value>
49
+                        <ControlTemplate TargetType="Button">
50
+                            <Border
51
+                                x:Name="border"
52
+                                Padding="4,2"
53
+                                Background="{TemplateBinding Background}"
54
+                                BorderBrush="DarkGray"
55
+                                BorderThickness="1"
56
+                                CornerRadius="3">
57
+                                <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
58
+                            </Border>
59
+                        </ControlTemplate>
60
+                    </Setter.Value>
61
+                </Setter>
62
+            </Style.Setters>
63
+        </Style>
64
+        <DataTemplate x:Key="UserItemTemp">
65
+            <Grid
66
+                Width="90"
67
+                Height="125"
68
+                Margin="9,20,9,10">
69
+                <Image
70
+                    Width="90"
71
+                    Margin="0,0,0,0"
72
+                    HorizontalAlignment="Center"
73
+                    Source="{Binding Attendance}"
74
+                    Visibility="{Binding Attendance_3}" />
75
+                <Image
76
+                    Width="90"
77
+                    Margin="0,0,0,0"
78
+                    HorizontalAlignment="Center"
79
+                    Source=".\Images\RollCall\attendance_33.png"
80
+                    Visibility="{Binding Attendance_33}" />
81
+
82
+                <StackPanel
83
+                    Margin="0,0,0,0"
84
+                    VerticalAlignment="Center"
85
+                    Background="Transparent">
86
+                    <Image
87
+                        Width="55"
88
+                        Height="55"
89
+                        HorizontalAlignment="Center"
90
+                        Source="{Binding Pic}"
91
+                        Stretch="Fill">
92
+                        <Image.Clip>
93
+                            <EllipseGeometry
94
+                                Center="27.5,27.5"
95
+                                RadiusX="27.5"
96
+                                RadiusY="27.5" />
97
+                        </Image.Clip>
98
+                    </Image>
99
+
100
+                    <TextBlock
101
+                        Padding="0,12,0,0"
102
+                        HorizontalAlignment="Center"
103
+                        FontSize="20"
104
+                        Foreground="#3C525B"
105
+                        Text="{Binding Name}" />
106
+                </StackPanel>
107
+                <Image
108
+                    x:Name="imgMedal"
109
+                    Width="42"
110
+                    Margin="0,-15,-10,0"
111
+                    HorizontalAlignment="Right"
112
+                    VerticalAlignment="Top"
113
+                    Source="{Binding Medal}" />
114
+            </Grid>
115
+        </DataTemplate>
116
+    </Window.Resources>
117
+
118
+    <Grid>
119
+        <Image Source=".\Images\RollCall\attendance_0_0_0.png" Stretch="Fill" />
120
+        <Grid Margin="10,36,10,10">
121
+            <Grid.RowDefinitions>
122
+                <RowDefinition Height="30" />
123
+                <RowDefinition Height="76" />
124
+                <RowDefinition Height="*" />
125
+                <RowDefinition Height="95" />
126
+                <RowDefinition Height="64" />
127
+            </Grid.RowDefinitions>
128
+
129
+            <!--  头部  -->
130
+            <Grid Grid.Row="0" MouseLeftButtonDown="Window_MouseLeftButtonDown_1">
131
+                <TextBlock
132
+                    Grid.Row="0"
133
+                    Margin="0,0,0,0"
134
+                    HorizontalAlignment="Center"
135
+                    VerticalAlignment="Center"
136
+                    FontSize="30"
137
+                    Foreground="White"
138
+                    Text="        课堂点名抢答        " />
139
+            </Grid>
140
+            <UniformGrid
141
+                Grid.Row="1"
142
+                Columns="2"
143
+                Rows="1">
144
+                <Button Cursor="Hand"
145
+                    x:Name="btnRandomRollCall"
146
+                    Width="223"
147
+                    Height="55"
148
+                    Margin="220,0,0,0"
149
+                    VerticalAlignment="Bottom"
150
+                    BorderThickness="0"
151
+                    Click="btnRandomRollCall_Click"
152
+                    FontSize="26"
153
+                    Foreground="White">
154
+                    <Grid>
155
+                        <Grid.RowDefinitions>
156
+                            <RowDefinition Height="auto" />
157
+                        </Grid.RowDefinitions>
158
+                        <Image
159
+                            x:Name="imgRandomRollCall"
160
+                            Grid.Row="0"
161
+                            Source=".\Images\RollCall\rollCall_10.png" />
162
+                        <Image
163
+                            x:Name="imgRandomRollCallTwo"
164
+                            Grid.Row="0"
165
+                            Source=".\Images\RollCall\rollCall_11.png"
166
+                            Visibility="Collapsed" />
167
+
168
+                        <TextBlock
169
+                            Grid.Row="0"
170
+                            Padding="50,5,0,0"
171
+                            HorizontalAlignment="Center"
172
+                            Foreground="White"
173
+                            Text="随机点名" />
174
+                        <Image
175
+                            Grid.Row="0"
176
+                            Width="31"
177
+                            Margin="40,0,0,0"
178
+                            HorizontalAlignment="Left"
179
+                            Source=".\Images\RollCall\rollCall_13.png" />
180
+                    </Grid>
181
+                    <Button.Template>
182
+                        <ControlTemplate TargetType="{x:Type Button}">
183
+                            <Border
184
+                                BorderBrush="{TemplateBinding Control.BorderBrush}"
185
+                                BorderThickness="0"
186
+                                CornerRadius="27,27,27,27">
187
+                                <Border.Background>#FFFFFF</Border.Background>
188
+                                <ContentPresenter
189
+                                    HorizontalAlignment="Center"
190
+                                    VerticalAlignment="Center"
191
+                                    Content="{TemplateBinding ContentControl.Content}" />
192
+                            </Border>
193
+                        </ControlTemplate>
194
+                    </Button.Template>
195
+                </Button>
196
+                <Button 
197
+                    x:Name="btnAnswer"
198
+                    Width="223"
199
+                    Height="55"
200
+                    Margin="0,0,220,0"
201
+                    VerticalAlignment="Bottom"
202
+                    Click="btnAnswer_Click"
203
+                    Cursor="Hand"
204
+                    FontSize="26"
205
+                    Foreground="White">
206
+                    <Grid>
207
+                        <Grid.RowDefinitions>
208
+                            <RowDefinition Height="auto" />
209
+                        </Grid.RowDefinitions>
210
+                        <Image
211
+                            x:Name="imgAnswer"
212
+                            Grid.Row="0"
213
+                            Source=".\Images\RollCall\rollCall_10.png" />
214
+                        <Image
215
+                            x:Name="imgAnswerTwo"
216
+                            Grid.Row="0"
217
+                            Source=".\Images\RollCall\rollCall_11.png"
218
+                            Visibility="Collapsed" />
219
+
220
+                        <TextBlock
221
+                            Grid.Row="0"
222
+                            Padding="50,5,0,0"
223
+                            HorizontalAlignment="Center"
224
+                            Foreground="White"
225
+                            Text="开始抢答" />
226
+                        <Image
227
+                            Grid.Row="0"
228
+                            Width="31"
229
+                            Margin="40,0,0,0"
230
+                            HorizontalAlignment="Left"
231
+                            Source=".\Images\RollCall\rollCall_12.png" />
232
+                    </Grid>
233
+                    <Button.Template>
234
+                        <ControlTemplate TargetType="{x:Type Button}">
235
+                            <Border
236
+                                BorderBrush="{TemplateBinding Control.BorderBrush}"
237
+                                BorderThickness="0"
238
+                                CornerRadius="27,27,27,27">
239
+                                <Border.Background>#FFFFFF</Border.Background>
240
+                                <ContentPresenter
241
+                                    HorizontalAlignment="Center"
242
+                                    VerticalAlignment="Center"
243
+                                    Content="{TemplateBinding ContentControl.Content}" />
244
+                            </Border>
245
+                        </ControlTemplate>
246
+                    </Button.Template>
247
+                </Button>
248
+            </UniformGrid>
249
+            <Grid Grid.Row="2">
250
+                <ListBox
251
+                    x:Name="toolbar_list"
252
+                    Margin="10,0,10,0"
253
+                    Background="#f3f3f3"
254
+                    BorderThickness="0"
255
+                    ItemContainerStyle="{DynamicResource MyItemContainStyle}"
256
+                    ItemTemplate="{StaticResource UserItemTemp}"
257
+                    ItemsSource="{Binding userList}"
258
+                    ScrollViewer.HorizontalScrollBarVisibility="Disabled"
259
+                    ScrollViewer.VerticalScrollBarVisibility="Disabled">
260
+                    <ListBox.Template>
261
+                        <ControlTemplate TargetType="{x:Type ListBox}">
262
+                            <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Hidden">
263
+                                <WrapPanel
264
+                                    IsItemsHost="True"
265
+                                    Orientation="Horizontal"
266
+                                    ScrollViewer.CanContentScroll="True" />
267
+                            </ScrollViewer>
268
+                        </ControlTemplate>
269
+                    </ListBox.Template>
270
+                </ListBox>
271
+                <StackPanel
272
+                    x:Name="stpAnswer"
273
+                    Margin="0,350,0,0"
274
+                    HorizontalAlignment="Center"
275
+                    Orientation="Horizontal"
276
+                    Visibility="Collapsed">
277
+                    <TextBlock FontSize="30" Text="共" />
278
+                    <TextBlock
279
+                        x:Name="txbNumberOfReplies"
280
+                        FontSize="30"
281
+                        Foreground="#136EFB"
282
+                        Text="0" />
283
+                    <TextBlock FontSize="30" Text="人抢答" />
284
+                </StackPanel>
285
+            </Grid>
286
+            <Viewbox Grid.Row="3">
287
+                <Border
288
+                    Grid.Row="3"
289
+                    Margin="33,0,33,0"
290
+                    Background="#dee2e1"
291
+                    CornerRadius="5">
292
+                    <Border
293
+                        Margin="1,1,1,1"
294
+                        Background="#FFFFFF"
295
+                        CornerRadius="5">
296
+                        <StackPanel
297
+                            Grid.Row="3"
298
+                            Margin="0,5,0,5"
299
+                            Orientation="Horizontal">
300
+                            <TextBlock
301
+                                Padding="3,0,0,0"
302
+                                FontSize="20.5"
303
+                                Foreground="#FF0000"
304
+                                Text="●" />
305
+                            <TextBlock
306
+                                Padding="3,3,0,0"
307
+                                FontSize="16.5"
308
+                                Foreground="#333333"
309
+                                Text="未上线:" />
310
+                            <TextBlock
311
+                                x:Name="txbNotOnline"
312
+                                MinWidth="900"
313
+                                Width="1180"
314
+                                Padding="3,3,0,0"
315
+                                FontSize="16.5"
316
+                                Foreground="#999999"
317
+                                Text="暂无"
318
+                                TextWrapping="Wrap" />
319
+                        </StackPanel>
320
+                    </Border>
321
+                </Border>
322
+            </Viewbox>
323
+            <Grid Grid.Row="4">
324
+                <Button 
325
+                    Width="336"
326
+                    Height="55"
327
+                    VerticalAlignment="Center"
328
+                    Click="btnDown_Click"
329
+                    Content="关闭"
330
+                    Cursor="Hand"
331
+                    FontSize="24"
332
+                    FontWeight="Black"
333
+                    Foreground="White">
334
+                    <Button.Template>
335
+                        <ControlTemplate TargetType="{x:Type Button}">
336
+                            <Border
337
+                                BorderBrush="{TemplateBinding Control.BorderBrush}"
338
+                                BorderThickness="0"
339
+                                CornerRadius="27,27,27,27">
340
+                                <Border.Background>#6098FF</Border.Background>
341
+                                <ContentPresenter
342
+                                    HorizontalAlignment="Center"
343
+                                    VerticalAlignment="Center"
344
+                                    Content="{TemplateBinding ContentControl.Content}" />
345
+                            </Border>
346
+                        </ControlTemplate>
347
+                    </Button.Template>
348
+                </Button>
349
+            </Grid>
350
+        </Grid>
351
+    </Grid>
352
+</Window>

+ 985
- 0
XHZB.Desktop/RollCallWindow.xaml.cs View File

@@ -0,0 +1,985 @@
1
+using Common.system;
2
+using Newtonsoft.Json;
3
+using System;
4
+using System.Collections.Generic;
5
+using System.Collections.ObjectModel;
6
+using System.IO;
7
+using System.Linq;
8
+using System.Text;
9
+using System.Threading;
10
+using System.Windows;
11
+using System.Windows.Input;
12
+using System.Windows.Threading;
13
+using XHZB.Desktop.Utils;
14
+using XHZB.Model;
15
+
16
+namespace XHZB.Desktop
17
+{
18
+    /// <summary>
19
+    /// 点名抢答
20
+    /// </summary>
21
+    public partial class RollCallWindow : Window/*, ZSocketCallback*/
22
+    {
23
+        #region 值初始化
24
+
25
+        /// <summary>
26
+        /// 服务返回 0成功
27
+        /// </summary>
28
+        private readonly int serverReturnCode = 0;
29
+
30
+        internal RollCallPageData pageData = new RollCallPageData();
31
+        private readonly RegisterController registerController = new RegisterController();
32
+        internal string backgroundOpacity = "0.5";
33
+        private readonly Random rd = new Random();
34
+        private readonly int[] iArrty = new int[3] { 201314, 201314, 201314 };
35
+        private static string userids = string.Empty;
36
+        private static string useridss = string.Empty;
37
+        private static string useridsss = string.Empty;
38
+
39
+        private static int ranNum = 201314;
40
+        private readonly int[] iArray = new int[1];
41
+
42
+        private static int returnNum = 0;
43
+        //private bool isSjdm = false;
44
+        internal double pwidth = SystemParameters.PrimaryScreenWidth;
45
+
46
+        internal double pHeight = SystemParameters.PrimaryScreenHeight;
47
+        private RollCallPerfectionWindow rollCallPerfectionWindow;
48
+
49
+        /// <summary>
50
+        /// 随机点名
51
+        /// </summary>
52
+        private bool isRollCall = false;
53
+
54
+        /// <summary>
55
+        /// 抢答
56
+        /// </summary>
57
+        private bool isRushToAnswer = false;
58
+
59
+        public string BackgroundOpacity
60
+        {
61
+            get => backgroundOpacity;
62
+            set => backgroundOpacity = value;
63
+        }
64
+        /// <summary>
65
+        /// 随机几率 1高 2中 3低
66
+        /// </summary>
67
+        string flag = "1";
68
+        int rNum = 999;
69
+        #endregion 值初始化
70
+
71
+        /// <summary>
72
+        /// 课堂点名
73
+        /// </summary>
74
+        public RollCallWindow()
75
+        {
76
+            InitializeComponent();
77
+            WindowStartupLocation = WindowStartupLocation.CenterScreen;
78
+            if (!File.Exists(APP.dataPath + "randomProbability.txt")) //若为空
79
+            {
80
+                flag = "1";
81
+            }
82
+            else
83
+            {
84
+                flag = System.IO.File.ReadAllText(APP.dataPath + "randomProbability.txt", Encoding.Default);
85
+            }
86
+            Initialize();
87
+
88
+            //ZSocketServer.getInstance().addWin(this);
89
+        }
90
+
91
+        /// <summary>
92
+        /// 初始化
93
+        /// </summary>
94
+        public void Initialize()
95
+        {
96
+            userids = string.Empty;
97
+            useridss = string.Empty;
98
+            useridsss = string.Empty;
99
+            returnNum = 0;
100
+            rNum = 999;
101
+            APP.RollCallList = new System.Collections.Generic.List<RollCallModel>();
102
+
103
+            imgRandomRollCall.Visibility = Visibility.Visible;
104
+            imgRandomRollCallTwo.Visibility = Visibility.Collapsed;
105
+            imgAnswer.Visibility = Visibility.Visible;
106
+            imgAnswerTwo.Visibility = Visibility.Collapsed;
107
+
108
+            stpAnswer.Visibility = Visibility.Collapsed;
109
+            //ToolbarWindow.IsNotOperation = true;
110
+            IsRandomRollCallButton = false;
111
+            //初始化配置文件
112
+            //ZJConfigUtil.init();
113
+            initPageData();
114
+            //ZSocketServer.getInstance().addWin(this);
115
+        }
116
+        public void userListChange()
117
+        {
118
+            Console.WriteLine("本节考勤-渲染用户列表");
119
+            Dispatcher.BeginInvoke(DispatcherPriority.Normal,
120
+               new Action(() =>
121
+               {
122
+                   receiveWsMsg(null);
123
+               }));
124
+        }
125
+        public void receiveWsMsg(ZWsMsgVo msg)
126
+        {
127
+            if (!isRollCall && !isRushToAnswer)
128
+            {
129
+                initPageData();
130
+            }
131
+            if (msg != null && msg.type == 402 && isRushToAnswer && msg.body.asktid == APP.askid)
132
+            {
133
+                Console.WriteLine(msg);
134
+
135
+
136
+                #region 去重
137
+                for (int i = 0; i < pageData.userList.Count; i++)
138
+                {
139
+                    if (msg.body.userid.ToString().Equals(pageData.userList[i].ID))
140
+                    {
141
+                        return;
142
+                    }
143
+                }
144
+                #endregion
145
+
146
+                //Askstudent askstudent = new Askstudent
147
+                //{
148
+                //    roomid = ZCommonData.roomid,
149
+                //    studentid = msg.body.userid
150
+                //};
151
+
152
+                //askstudent.asktid = ZCommonData.askid;
153
+                //askstudent.schoolid = ZCommonData.loginUser.schoolid;
154
+                //askstudent.createtime = DataProvider.TimestampTotalSeconds();
155
+                //askstudent.studentselected = 0;
156
+                //askstudent.radiocorrect = 0;
157
+                //askstudent.classid = msg.body.classid;
158
+                //ZSqliteManger.insertClassData(new ClassData()
159
+                //{
160
+                //    unix = DataProvider.TimestampTotalSeconds(),
161
+                //    roomid = ZCommonData.roomid,
162
+                //    api = "askstudent",
163
+                //    json = ZJsonHelper.ToJson(askstudent),
164
+                //    askid = ZCommonData.askid
165
+                //});
166
+
167
+                System.Collections.Generic.List<RollCallModel> callList = APP.RollCallList;
168
+                bool isUserid = true;
169
+                //if (TeachingDataStatic.RollCallStatisticsList.Count > 0)//统计抢答
170
+                //{
171
+                //    for (int i = 0; i < TeachingDataStatic.RollCallStatisticsList.Count; i++)
172
+                //    {
173
+                //        if (TeachingDataStatic.RollCallStatisticsList[i].userid == msg.body.userid)
174
+                //        {
175
+                //            TeachingDataStatic.RollCallStatisticsList[i].replies += 1;
176
+                //            isUserid = false;
177
+                //            break;
178
+                //        }
179
+                //    }
180
+                //}
181
+
182
+                if (isUserid)
183
+                {//统计
184
+                    //Shared.TeachingData.rollCall = new RollCall
185
+                    //{
186
+                    //    usertype = msg.usertype,
187
+                    //    userid = msg.body.userid,
188
+                    //    username = msg.body.username,
189
+                    //    userpic = msg.body.userpic,
190
+                    //    replies = 1
191
+                    //};
192
+                    //TeachingDataStatic.RollCallStatisticsList.Add(Shared.TeachingData.rollCall);
193
+                    //Shared.TeachingData.rollCall = new RollCall();
194
+                }
195
+
196
+                Dispatcher.Invoke(DispatcherPriority.Normal,
197
+                    new Action(() =>
198
+                    {
199
+                        try
200
+                        {
201
+                            if (pageData.userList.Count > 0)
202
+                            {
203
+                                if (pageData.userList[pageData.userList.Count - 1].askid != msg.body.asktid)
204
+                                {
205
+                                    pageData.userList.Clear();
206
+                                }
207
+                            }
208
+                        }
209
+                        catch (Exception ex)
210
+                        {
211
+                            LogHelper.WriteErrLog("【抢答】(receiveWsMsg)socket移除askid不一致用户," + ex.Message, ex);
212
+                        }
213
+
214
+                        //renderView();
215
+                        returnNum++;
216
+                        if (returnNum <= 18)
217
+                        {
218
+                            string medal = "../Images/RollCall/02log-1.png";
219
+                            string attendance = "../Images/RollCall/attendance_3.png";
220
+                            if (returnNum == 1)
221
+                            {
222
+                                medal = "../Images/RollCall/rollCall_7.png";
223
+                                attendance = "../Images/RollCall/attendance_33.png";
224
+                            }
225
+                            else if (returnNum == 2)
226
+                            {
227
+                                medal = "../Images/RollCall/rollCall_5.png";
228
+                                attendance = "../Images/RollCall/attendance_33.png";
229
+                            }
230
+                            else if (returnNum == 3)
231
+                            {
232
+                                medal = "../Images/RollCall/rollCall_6.png";
233
+                                attendance = "../Images/RollCall/attendance_33.png";
234
+                            }
235
+                            string userpic = msg.body.userpic;
236
+                            if (ZCache.headDic.ContainsKey(userpic.Replace("/", "")))
237
+                            {
238
+                                userpic = ZCache.headDic[userpic.Replace("/", "")];
239
+                            }
240
+                            else
241
+                            {
242
+                                userpic = "../Images/RollCall/attendance_1.png";
243
+                            }
244
+                            pageData.userList.Add(new RollCallPageData()
245
+                            {
246
+                                Name = msg.body.username,
247
+                                Attendance_33 = "Collapsed",
248
+                                Attendance_3 = "Visible",
249
+                                Pic = userpic,
250
+                                ID = msg.body.userid.ToString(),
251
+                                Attendance = attendance,
252
+                                Medal = medal,
253
+                                askid = msg.body.asktid
254
+
255
+                            });
256
+                            stpAnswer.Visibility = Visibility.Visible;
257
+                        }
258
+                        txbNumberOfReplies.Text = returnNum.ToString();
259
+                    }));
260
+            }
261
+        }
262
+
263
+      
264
+        System.Collections.Generic.List<OnlineUserModel> raduser = new System.Collections.Generic.List<OnlineUserModel>();
265
+        System.Collections.Generic.List<OnlineUserModel> userListNew = new System.Collections.Generic.List<OnlineUserModel>();
266
+        private void initPageData()
267
+        {
268
+            Dispatcher.Invoke(DispatcherPriority.Normal,
269
+                 new Action(() =>
270
+                 {
271
+                     if (pageData.userList.Count > 0)
272
+                     {
273
+                         pageData.userList.Clear();
274
+                     }
275
+                     List<OnlineUserModel> userList = APP.OnlineUserList;
276
+                     userListNew = new List<OnlineUserModel>();
277
+                     string userlistStr = JsonHelper.ToJson(userList);
278
+                     userListNew = JsonToList<OnlineUserModel>(userlistStr);
279
+                     List<ClassStudentListModel> classStudentList = APP.ClassStudentList;
280
+
281
+
282
+                     for (int i = 0; i < classStudentList.Count; i++)
283
+                     {
284
+                         classStudentList[i].status = 0;
285
+                         for (int j = 0; j < userListNew.Count; j++)
286
+                         {
287
+                             if (classStudentList[i].studentid == userListNew[j].userid)
288
+                             {
289
+                                 userListNew[j].num = classStudentList[i].num;
290
+                             }
291
+                         }
292
+                     }
293
+                     if (userListNew.Count > 0)
294
+                     {
295
+                         //OrderbyDescending  倒叙    OrderBy 顺序
296
+                         raduser = userListNew.OrderBy(x => x.num).ToList();
297
+                     }
298
+
299
+                     foreach (OnlineUserModel user in userListNew)
300
+                     {
301
+                         string userpic = user.userpic;
302
+                         if (ZCache.headDic.ContainsKey(userpic.Replace("/", "")))
303
+                         {
304
+                             userpic = ZCache.headDic[userpic.Replace("/", "")];
305
+                         }
306
+                         else
307
+                         {
308
+                             userpic = "../Images/RollCall/attendance_1.png";
309
+                         }
310
+
311
+                         pageData.userList.Add(new RollCallPageData()
312
+                         {
313
+                             Name = user.username,
314
+                             Attendance_33 = "Collapsed",
315
+                             Attendance_3 = "Visible",
316
+                             Pic = userpic,
317
+                             ID = user.userid.ToString(),
318
+                             Attendance = "../Images/RollCall/attendance_3.png"
319
+                         });
320
+                         foreach (ClassStudentListModel cl in classStudentList)
321
+                         {
322
+                             if (cl.studentid == user.userid)
323
+                             {
324
+                                 cl.status = 1;
325
+                             }
326
+                         }
327
+                     }
328
+                     string notOnline = string.Empty;
329
+                     foreach (ClassStudentListModel cl in classStudentList)
330
+                     {
331
+                         if (cl.status == 0)
332
+                         {
333
+                             notOnline += cl.studentname + "   ";
334
+                         }
335
+                     }
336
+                     if (!string.IsNullOrWhiteSpace(notOnline))
337
+                     {
338
+                         txbNotOnline.Text = notOnline;
339
+                     }
340
+                     else
341
+                     {
342
+                         txbNotOnline.Text = "暂无";
343
+                     }
344
+                     toolbar_list.DataContext = pageData;
345
+                 }));
346
+        }
347
+        internal static List<T> JsonToList<T>(string respstr)
348
+        {
349
+            JsonSerializer serializer = new JsonSerializer();
350
+            StringReader sr = new StringReader(respstr);
351
+            object o = serializer.Deserialize(new JsonTextReader(sr), typeof(List<T>));
352
+            List<T> list = o as List<T>;
353
+            return list;
354
+        }
355
+        /// <summary>
356
+        /// 是否已经按下按钮
357
+        /// </summary>
358
+        public bool IsRandomRollCallButton = false;
359
+        /// <summary>
360
+        /// 随机点名
361
+        /// </summary>
362
+        /// <param name="sender"></param>
363
+        /// <param name="e"></param>
364
+        private void btnRandomRollCall_Click(object sender, RoutedEventArgs e)
365
+        {
366
+            if (!IsRandomRollCallButton)
367
+            {
368
+                IsRandomRollCallButton = true;
369
+                userids = string.Empty;
370
+                useridss = string.Empty;
371
+                useridsss = string.Empty;
372
+                returnNum = 0;
373
+                APP.RollCallList = new System.Collections.Generic.List<Model.RollCallModel>();
374
+                stpAnswer.Visibility = Visibility.Collapsed;
375
+
376
+                imgRandomRollCall.Visibility = Visibility.Collapsed;
377
+                imgRandomRollCallTwo.Visibility = Visibility.Visible;
378
+                imgAnswer.Visibility = Visibility.Visible;
379
+                imgAnswerTwo.Visibility = Visibility.Collapsed;
380
+
381
+                initPageData();
382
+                if (isRushToAnswer)//如果抢答没有结束 先结束抢答
383
+                {
384
+                    //ZSocketServer.getInstance().SendMessage(ZSocketMsgManger.qiangdaEnd());
385
+                    isRushToAnswer = false;
386
+                }
387
+                if (APP.OnlineUserList.Count > 0)//判断当前在线人数大于0 点击才有效    ceshi=
388
+                {
389
+                    isRollCall = true;
390
+                    Thread.Sleep(500);
391
+                    APP.BackgroundWorkerHelper.RunWorkerAsync(InvokeRandomRollCallServering, InvokeRandomRollCallServerCompate);
392
+                }
393
+                else
394
+                {
395
+                    IsRandomRollCallButton = false;
396
+                }
397
+            }
398
+        }
399
+
400
+        /// <summary>
401
+        /// 点名抽奖效果
402
+        /// </summary>
403
+        /// <returns></returns>
404
+        private object InvokeRandomRollCallServering()
405
+        {
406
+            try
407
+            {
408
+                if (ranNum != 201314 && ranNum != 0)
409
+                {
410
+                    if (ranNum < pageData.userList.Count)
411
+                    {
412
+                        pageData.userList[ranNum].Attendance_33 = "Collapsed";
413
+                        pageData.userList[ranNum].Attendance_3 = "Visible";
414
+                        Thread.Sleep(500);
415
+                    }
416
+                }
417
+                int randomTimes = 0;//随机次数
418
+                ranNum = 0;//随机到用户的下标
419
+                if (pageData.userList.Count == 1)//当前在线1人直接选中
420
+                {
421
+                    pageData.userList[0].Attendance_33 = "Collapsed";
422
+                    pageData.userList[0].Attendance_3 = "Visible";
423
+                    Thread.Sleep(500);
424
+                    pageData.userList[0].Attendance_33 = "Visible";
425
+                    pageData.userList[0].Attendance_3 = "Collapsed";
426
+                }
427
+                else
428
+                {
429
+                    randomTimes = 10;
430
+
431
+
432
+
433
+                    //if (TeachingDataStatic.OnlineUserList.Count > 0)
434
+                    //{
435
+                    //    //OrderbyDescending  倒叙    OrderBy 顺序
436
+                    //    raduser = raduser.OrderBy(x => x.num).ToList();
437
+                    //}
438
+
439
+                    int ranNumberOfPeople = 999;
440
+                    if ("1".Equals(flag) && raduser.Count > 5)
441
+                    {
442
+
443
+
444
+                        do
445
+                        {
446
+                            long tick = DateTime.Now.Ticks;
447
+                            Random ran = new Random((int)(tick & 0xffffffffL) | (int)(tick >> 32));
448
+                            ranNumberOfPeople = ran.Next(5);
449
+
450
+
451
+                            for (int i = 0; i < userListNew.Count; i++)
452
+                            {
453
+                                if (userListNew[i].userid == raduser[ranNumberOfPeople].userid)
454
+                                {
455
+                                    ranNumberOfPeople = i;
456
+                                    break;
457
+                                }
458
+                            }
459
+                        } while (ranNumberOfPeople == rNum);
460
+
461
+
462
+                        raduser[ranNumberOfPeople].num += 1;
463
+                    }
464
+                    else if ("2".Equals(flag) && raduser.Count > 15)
465
+                    {
466
+                        do
467
+                        {
468
+                            long tick = DateTime.Now.Ticks;
469
+                            Random ran = new Random((int)(tick & 0xffffffffL) | (int)(tick >> 32));
470
+                            ranNumberOfPeople = ran.Next(15);
471
+
472
+                            for (int i = 0; i < userListNew.Count; i++)
473
+                            {
474
+                                if (userListNew[i].userid == raduser[ranNumberOfPeople].userid)
475
+                                {
476
+                                    ranNumberOfPeople = i;
477
+                                    break;
478
+                                }
479
+                            }
480
+                        } while (ranNumberOfPeople == rNum);
481
+                        raduser[ranNumberOfPeople].num += 1;
482
+                    }
483
+                    else if (raduser.Count > 30)
484
+                    {
485
+                        do
486
+                        {
487
+                            long tick = DateTime.Now.Ticks;
488
+                            Random ran = new Random((int)(tick & 0xffffffffL) | (int)(tick >> 32));
489
+                            ranNumberOfPeople = ran.Next(30);
490
+
491
+                            for (int i = 0; i < userListNew.Count; i++)
492
+                            {
493
+                                if (userListNew[i].userid == raduser[ranNumberOfPeople].userid)
494
+                                {
495
+                                    ranNumberOfPeople = i;
496
+                                    break;
497
+                                }
498
+                            }
499
+                            raduser[ranNumberOfPeople].num += 1;
500
+                        } while (ranNumberOfPeople == rNum);
501
+                    }
502
+                    else
503
+                    {
504
+                        ranNumberOfPeople = 999;
505
+                    }
506
+
507
+
508
+                    //if (APP.outputInforLog)
509
+                    //{
510
+                    //    LogHelper.WriteInfoLog("ranNum:" + TeachingDataStatic.OnlineUserList[ranNum].username + "&" + raduser[0].username + raduser[1].username + raduser[2].username + raduser[3].username + raduser[4].username + raduser[5].username);
511
+                    //}
512
+
513
+
514
+
515
+
516
+
517
+
518
+
519
+                    int ranNums = 0;//记录上一次随机的下标
520
+                    for (int i = 0; i < randomTimes; i++)
521
+                    {
522
+                        Thread.Sleep(200);
523
+                        if (i > 0)
524
+                        {
525
+
526
+                            pageData.userList[ranNum].Attendance_33 = "Collapsed";
527
+                            pageData.userList[ranNum].Attendance_3 = "Visible";
528
+
529
+                        }
530
+                        while (ranNums == ranNum)//保证这次随机的下标和上次不相同
531
+                        {
532
+                            long tick = DateTime.Now.Ticks;
533
+                            Random ran = new Random((int)(tick & 0xffffffffL) | (int)(tick >> 32));
534
+                            ranNum = ran.Next(pageData.userList.Count);
535
+                            if (i == 9 && ranNumberOfPeople != 999)
536
+                            {
537
+                                ranNum = ranNumberOfPeople;
538
+                                break;
539
+                            }
540
+                            if (pageData.userList.Count < 3)
541
+                            {
542
+                                break;
543
+                            }
544
+                        }
545
+                        ranNums = ranNum;
546
+                        rNum = ranNum;
547
+                        pageData.userList[ranNum].Attendance_33 = "Visible";
548
+                        pageData.userList[ranNum].Attendance_3 = "Collapsed";
549
+                    }
550
+                }
551
+            }
552
+            catch (Exception ex)
553
+            {
554
+                LogHelper.WriteErrLog("【抢答点名(RollCallWindow)" + ex.Message, ex);
555
+            }
556
+
557
+            return APP.ErrorMessage;
558
+        }
559
+
560
+        /// <summary>
561
+        /// 点名抽奖效果-返回结果
562
+        /// </summary>
563
+        /// <returns></returns>
564
+        public void InvokeRandomRollCallServerCompate(object obj)
565
+        {
566
+            APP.BackgroundWorkerHelper.RunWorkerAsync(InvokeInteractiveLaunchsServering, InvokeInteractiveLaunchsServerCompate);
567
+        }
568
+
569
+        private void frm_ChangeTextEvent(string text)
570
+        {
571
+            if ("重新点名".Equals(text))
572
+            {
573
+                returnNum = 0;
574
+                //ZSocketServer.getInstance().SendMessage(ZSocketMsgManger.qiangdaEnd());
575
+                initPageData();
576
+                IsRandomRollCallButton = true;
577
+                if (APP.OnlineUserList.Count > 0)//判断当前在线人数大于0 点击才有效
578
+                {
579
+                    isRollCall = true;
580
+                    APP.BackgroundWorkerHelper.RunWorkerAsync(InvokeRandomRollCallServering, InvokeRandomRollCallServerCompate);
581
+                }
582
+            }
583
+            else if ("关闭窗口".Equals(text))
584
+            {
585
+                returnNum = 0;
586
+                userids = string.Empty;
587
+                useridss = string.Empty;
588
+                useridsss = string.Empty;
589
+                isRollCall = false;
590
+                isRushToAnswer = false;
591
+                //ZSocketServer.getInstance().SendMessage(ZSocketMsgManger.qiangdaEnd());
592
+                IsRandomRollCallButton = false;
593
+                //ToolbarWindow.IsOpenRollCallWindow = false;
594
+                Hide();
595
+            }
596
+        }
597
+
598
+        private void Window_MouseLeftButtonDown_1(object sender, MouseButtonEventArgs e)
599
+        {
600
+            DragMove();
601
+        }
602
+
603
+        /// <summary>
604
+        /// 关闭
605
+        /// </summary>
606
+        /// <param name="sender"></param>
607
+        /// <param name="e"></param>
608
+        private void btnDown_Click(object sender, RoutedEventArgs e)
609
+        {
610
+            //ToolbarWindow.IsNotOperation = false;
611
+            APP.myloading.Show();
612
+            new Thread(o =>
613
+            {
614
+                returnNum = 0;
615
+                userids = string.Empty;
616
+                useridss = string.Empty;
617
+                useridsss = string.Empty;
618
+                isRollCall = false;
619
+                isRushToAnswer = false;
620
+                APP.RollCallList = new System.Collections.Generic.List<Model.RollCallModel>();
621
+                //string msg = ZSocketMsgManger.qiangdaEnd();
622
+                //ZSocketServer.getInstance().SendMessage(msg);
623
+                //ZSqliteManger.insertClassAction(new ClassAction()
624
+                //{
625
+                //    unix = DataProvider.TimestampTotalSeconds(),
626
+                //    roomid = ZCommonData.roomid,
627
+                //    type = 403,
628
+                //    json = msg,
629
+                //    askid = ZCommonData.askid
630
+                //});
631
+
632
+                Dispatcher.Invoke(new Action(() =>
633
+                {
634
+                    //ToolbarWindow.IsOpenRollCallWindow = false;
635
+                    APP.myloading.Hide();
636
+                    Hide();
637
+                }));
638
+            }).Start();
639
+
640
+        }
641
+
642
+        /// <summary>
643
+        /// 抢答
644
+        /// </summary>
645
+        /// <param name="sender"></param>
646
+        /// <param name="e"></param>
647
+        private void btnAnswer_Click(object sender, RoutedEventArgs e)
648
+        {
649
+            if (!IsRandomRollCallButton)
650
+            {
651
+                returnNum = 0;
652
+                userids = string.Empty;
653
+                useridss = string.Empty;
654
+                useridsss = string.Empty;
655
+                APP.RollCallList = new System.Collections.Generic.List<RollCallModel>();
656
+
657
+                imgRandomRollCall.Visibility = Visibility.Visible;
658
+                imgRandomRollCallTwo.Visibility = Visibility.Collapsed;
659
+                imgAnswer.Visibility = Visibility.Collapsed;
660
+                imgAnswerTwo.Visibility = Visibility.Visible;
661
+                //initPageData();
662
+                if (isRollCall)//如果随机点名没有结束 发送结束随机点名消息
663
+                {
664
+                    //ZSocketServer.getInstance().SendMessage(ZSocketMsgManger.qiangdaEnd());
665
+                    isRollCall = false;
666
+                }
667
+
668
+                if (APP.OnlineUserList.Count > 0)//判断当前在线人数大于0 点击才有效
669
+                {
670
+                    if (pageData.userList.Count > 0)
671
+                    {
672
+                        pageData.userList.Clear();
673
+                    }
674
+                    //TeachingDataStatic.rollCallNum += 1;
675
+                    txbNumberOfReplies.Text = "0";
676
+                    isRushToAnswer = true;
677
+
678
+                    APP.BackgroundWorkerHelper.RunWorkerAsync(InvokeInteractiveLaunchServering, InvokeInteractiveLaunchServerCompate);
679
+                }
680
+                else
681
+                {
682
+                    isRushToAnswer = false;
683
+                }
684
+            }
685
+        }
686
+
687
+        /// <summary>
688
+        /// 互动 抢答服务-调用
689
+        /// </summary>
690
+        /// <returns></returns>
691
+        private object InvokeInteractiveLaunchServering()
692
+        {
693
+            //Askteacher askteacher = new Askteacher
694
+            //{
695
+            //    roomid = ZCommonData.roomid,
696
+            //    asktype = 20,
697
+            //    schoolid = ZCommonData.loginUser.schoolid,
698
+            //    asktid = DataProvider.TimestampAddRandomNumber(),
699
+            //    createtime = DataProvider.TimestampTotalSeconds(),
700
+            //    asktnum = 0
701
+            //};
702
+            //ZCommonData.askid = askteacher.asktid;
703
+            //ZSqliteManger.insertClassData(new ClassData()
704
+            //{
705
+            //    unix = DataProvider.TimestampTotalSeconds(),
706
+            //    roomid = ZCommonData.roomid,
707
+            //    api = "askteacher",
708
+            //    json = ZJsonHelper.ToJson(askteacher),
709
+            //    askid = askteacher.asktid
710
+            //});
711
+
712
+            //string msg = ZSocketMsgManger.qiangdaBegin(ZCommonData.askid);
713
+            //ZSocketServer.getInstance().SendMessage(msg);
714
+
715
+
716
+            //ZSqliteManger.insertClassAction(new ClassAction()
717
+            //{
718
+            //    unix = DataProvider.TimestampTotalSeconds(),
719
+            //    roomid = ZCommonData.roomid,
720
+            //    type = 401,
721
+            //    json = msg,
722
+            //    askid = ZCommonData.askid
723
+            //});
724
+            return APP.ErrorMessage;
725
+        }
726
+
727
+        /// <summary>
728
+        /// 互动 抢答服务-返回结果
729
+        /// </summary>
730
+        /// <returns></returns>
731
+        public void InvokeInteractiveLaunchServerCompate(object obj)
732
+        {
733
+        }
734
+
735
+        /// <summary>
736
+        /// 互动 随机点名 服务-调用
737
+        /// </summary>
738
+        /// <returns></returns>
739
+        private object InvokeInteractiveLaunchsServering()
740
+        {
741
+            //Askteacher askteacher = new Askteacher
742
+            //{
743
+            //    roomid = ZCommonData.roomid,
744
+            //    asktype = 21,
745
+            //    schoolid = ZCommonData.loginUser.schoolid,
746
+            //    asktid = DataProvider.TimestampAddRandomNumber(),
747
+            //    createtime = DataProvider.TimestampTotalSeconds(),
748
+            //    asktnum = 0
749
+            //};
750
+            //ZCommonData.askid = askteacher.asktid;
751
+            //ZSqliteManger.insertClassData(new ClassData()
752
+            //{
753
+            //    unix = DataProvider.TimestampTotalSeconds(),
754
+            //    roomid = ZCommonData.roomid,
755
+            //    api = "askteacher",
756
+            //    json = ZJsonHelper.ToJson(askteacher),
757
+            //    askid = askteacher.asktid
758
+            //});
759
+
760
+            OnlineUserModel user = APP.OnlineUserList[ranNum];
761
+
762
+
763
+
764
+            Console.WriteLine("ranNum:" + ranNum.ToString() + @user.username + "Ci" + user.num.ToString());
765
+            //Askstudent askstudent = new Askstudent
766
+            //{
767
+            //    roomid = ZCommonData.roomid,
768
+            //    studentid = user.userid,
769
+            //    asktid = ZCommonData.askid,
770
+            //    classid = ZCommonData.classid,
771
+            //    schoolid = ZCommonData.loginUser.schoolid,
772
+            //    createtime = DataProvider.TimestampTotalSeconds(),
773
+            //    studentselected = 1,
774
+            //    radiocorrect = 0
775
+            //};
776
+            //ZSqliteManger.insertClassData(new ClassData()
777
+            //{
778
+            //    unix = DataProvider.TimestampTotalSeconds(),
779
+            //    roomid = ZCommonData.roomid,
780
+            //    api = "askstudent",
781
+            //    json = ZJsonHelper.ToJson(askstudent),
782
+            //    askid = askteacher.asktid
783
+            //});
784
+            //string msg = ZSocketMsgManger.dianmingBegin(ZCommonData.askid, user.userid);
785
+            //ZSocketServer.getInstance().SendMessage(msg);
786
+            //ZSqliteManger.insertClassAction(new ClassAction()
787
+            //{
788
+            //    unix = DataProvider.TimestampTotalSeconds(),
789
+            //    roomid = ZCommonData.roomid,
790
+            //    type = 411,
791
+            //    json = msg,
792
+            //    askid = ZCommonData.askid
793
+            //});
794
+            return APP.ErrorMessage;
795
+        }
796
+
797
+        /// <summary>
798
+        /// 互动 随机点名服务-返回结果
799
+        /// </summary>
800
+        /// <returns></returns>
801
+        public void InvokeInteractiveLaunchsServerCompate(object obj)
802
+        {
803
+            if (serverReturnCode == APP.ServerScuessCode)
804
+            {
805
+                OnlineUserModel user = APP.OnlineUserList[ranNum];
806
+                string userpic = user.userpic;
807
+                string userpicPath = "../Images/RollCall/attendance_1.png";
808
+                if (ZCache.headDic.ContainsKey(userpic.Replace("/", "")))
809
+                {
810
+                    userpicPath = ZCache.headDic[userpic.Replace("/", "")];
811
+                }
812
+
813
+                try
814
+                {
815
+                    #region 随机次数增加
816
+                    for (int i = 0; i < APP.ClassStudentList.Count; i++)
817
+                    {
818
+                        if (APP.ClassStudentList[i].studentid == user.userid)
819
+                        {
820
+                            APP.ClassStudentList[i].num += 1;
821
+                            break;
822
+                        }
823
+                    }
824
+                    #endregion
825
+
826
+
827
+                    bool isUserid = true;
828
+                    //if (TeachingDataStatic.RandomRollCallStatisticsList.Count > 0)
829
+                    //{
830
+                    //    for (int i = 0; i < TeachingDataStatic.RandomRollCallStatisticsList.Count; i++)
831
+                    //    {
832
+                    //        if (TeachingDataStatic.RandomRollCallStatisticsList[i].userid == user.userid)
833
+                    //        {
834
+                    //            TeachingDataStatic.RandomRollCallStatisticsList[i].replies += 1;
835
+                    //            isUserid = false;
836
+                    //            break;
837
+                    //        }
838
+                    //    }
839
+                    //}
840
+                    if (isUserid)
841
+                    {
842
+                        //RandomRollCallStatistics randomRollCallStatistics = new RandomRollCallStatistics
843
+                        //{
844
+                        //    username = user.username,
845
+                        //    userid = user.userid,
846
+                        //    userpicPath = userpicPath,
847
+                        //    replies = 1
848
+                        //};
849
+                        //TeachingDataStatic.RandomRollCallStatisticsList.Add(randomRollCallStatistics);
850
+                        //randomRollCallStatistics = new RandomRollCallStatistics();
851
+                    }
852
+                }
853
+                catch (Exception ex)
854
+                {
855
+                    LogHelper.WriteErrLog("【课堂点名(RollCallWindow)】错误日志:" + ex.Message, ex);
856
+                }
857
+                try
858
+                {
859
+                    if (rollCallPerfectionWindow == null)
860
+                    {
861
+                        rollCallPerfectionWindow = new RollCallPerfectionWindow(
862
+                      user.username,
863
+                      userpicPath
864
+                      )
865
+                        {
866
+                            Topmost = true,
867
+                            Width = pwidth,
868
+                            Height = pHeight,
869
+                            Left = 0,
870
+                            Top = 0
871
+                        };
872
+
873
+                        //订阅事件
874
+                        rollCallPerfectionWindow.ChangeTextEvent += new ChangeTextHandler(frm_ChangeTextEvent);
875
+                        rollCallPerfectionWindow.Owner = this;
876
+                    }
877
+                    else
878
+                    {
879
+                        rollCallPerfectionWindow.Name(user.username);
880
+                    }
881
+                    rollCallPerfectionWindow.Show();
882
+                }
883
+                catch (Exception ex)
884
+                {
885
+                    LogHelper.WriteErrLog("【课堂点名(RollCallWindow)】错误日志:" + ex.Message, ex);
886
+                }
887
+            }
888
+        }
889
+
890
+        /// <summary>
891
+        /// 页面关闭
892
+        /// </summary>
893
+        /// <param name="sender"></param>
894
+        /// <param name="e"></param>
895
+        private void Window_Closed(object sender, EventArgs e)
896
+        {
897
+            //ToolbarWindow.IsNotOperation = false;
898
+            click_closeClick();
899
+            //ZSocketServer.getInstance().removedWin(this);
900
+        }
901
+
902
+        #region 关闭委托
903
+
904
+        /// <summary>
905
+        /// 关闭委托 结束页面 创建人:赵耀 创建时间:2020年8月13日
906
+        /// </summary>
907
+        /// <param name="sender"></param>
908
+        /// <param name="e"></param>
909
+        public delegate void CloseClick();
910
+
911
+        /// <summary>
912
+        /// 关闭委托 结束页面 创建人:赵耀 创建时间:2020年8月13日
913
+        /// </summary>
914
+        public event CloseClick click_closeClick;
915
+
916
+        #endregion 关闭委托
917
+    }
918
+
919
+    public class RollCallPageData : NotifyModel
920
+    {
921
+        public ObservableCollection<RollCallPageData> userList { get; set; }
922
+        internal string _name;
923
+
924
+        public string Name
925
+        {
926
+            get => _name;
927
+            set { _name = value; OnPropertyChanged("Name"); }
928
+        }
929
+
930
+        internal string _id;
931
+
932
+        public string ID
933
+        {
934
+            get => _id;
935
+            set { _id = value; OnPropertyChanged("ID"); }
936
+        }
937
+
938
+        internal string _Pic;
939
+
940
+        public string Pic
941
+        {
942
+            get => _Pic;
943
+            set { _Pic = value; OnPropertyChanged("Pic"); }
944
+        }
945
+
946
+        internal string _attendance = "";
947
+
948
+        public string Attendance
949
+        {
950
+            get => _attendance;
951
+            set { _attendance = value; OnPropertyChanged("Attendance"); }
952
+        }
953
+
954
+        internal string _attendance_3 = "Visible";
955
+
956
+        public string Attendance_3
957
+        {
958
+            get => _attendance_3;
959
+            set { _attendance_3 = value; OnPropertyChanged("Attendance_3"); }
960
+        }
961
+
962
+        internal string _attendance_33 = "Visible";
963
+
964
+        public string Attendance_33
965
+        {
966
+            get => _attendance_33;
967
+            set { _attendance_33 = value; OnPropertyChanged("Attendance_33"); }
968
+        }
969
+
970
+        internal string _medal = "../Images/noting.png";
971
+
972
+        public string Medal
973
+        {
974
+            get => _medal;
975
+            set { _medal = value; OnPropertyChanged("Medal"); }
976
+        }
977
+
978
+        public long askid { get; set; }
979
+
980
+        public RollCallPageData()
981
+        {
982
+            userList = new ObservableCollection<RollCallPageData>();
983
+        }
984
+    }
985
+}

+ 1
- 1
XHZB.Desktop/ToolbarWindow.xaml View File

@@ -113,7 +113,7 @@
113 113
 
114 114
         <UniformGrid
115 115
             Name="ketangTool"
116
-            Canvas.Top="365"
116
+            Canvas.Top="238"
117 117
             Canvas.Right="100"
118 118
             Width="0"
119 119
             Height="73"

+ 501
- 121
XHZB.Desktop/ToolbarWindow.xaml.cs View File

@@ -16,6 +16,8 @@ using XHZB.Model;
16 16
 using Common.ZB;
17 17
 using XHZB.Desktop.Utils;
18 18
 using Common.system;
19
+using System.Windows.Media.Animation;
20
+using System.Threading;
19 21
 
20 22
 namespace XHZB.Desktop
21 23
 {
@@ -37,12 +39,21 @@ namespace XHZB.Desktop
37 39
         /// 工具栏数据
38 40
         /// </summary>
39 41
         internal ToolbarModel pageData = new ToolbarModel();
42
+        /// <summary>
43
+        /// 是否已打开课堂工具二级列表
44
+        /// </summary>
45
+        private bool heibanshow = false;
40 46
         #endregion
41 47
 
42 48
         #region 初始化
43 49
         public ToolbarWindow()
44 50
         {
45 51
             InitializeComponent();
52
+
53
+
54
+
55
+            heiban_btn.Click += Heiban_btn_Click;
56
+            pizhu_btn.Click += Pizhu_btn_Click;
46 57
             Topmost = true;
47 58
             Left = pwidth - 300;
48 59
             Top = (pHeight - 568) / 2;
@@ -147,127 +158,91 @@ namespace XHZB.Desktop
147 158
                     pageData.menuList[1].Name = "直播";
148 159
                 }
149 160
             }
150
-            //else if (clickindex == 2)//课堂提问
151
-            //{
152
-            //    HideLevel2();
153
-            //    try
154
-            //    {
155
-            //        #region 关闭冲突页面
156
-
157
-            //        CloseOrHideWindowPage();
158
-            //        #endregion 关闭冲突页面
159
-
160
-            //        if (screenshotWindow != null)
161
-            //        {
162
-            //            screenshotWindow.initialization();
163
-            //        }
164
-            //        else
165
-            //        {
166
-            //            screenshotWindow = new ScreenshotWindow();
167
-            //            // 订阅事件
168
-            //            screenshotWindow.ChangeTextEvent += new ChangeTextHandler(frm_ChangeTextEvent);
169
-            //            screenshotWindow.click_closeJietuWindowClick += JietuWindow_click_closeJietuWindowClick;
170
-
171
-            //        }
172
-
173
-            //        screenshotWindow.Owner = this;
174
-            //        screenshotWindow.Show();
175
-            //        jietuType = 1;
176
-            //        //ZSocketServer.getInstance().addWin(jietuWindow);
177
-            //        //jietuWindow = null;
178
-            //        //GC.Collect();
179
-            //    }
180
-            //    catch (Exception ex)
181
-            //    {
182
-            //        jietuWindow = null;
183
-            //        LogHelper.WriteErrLog("【课堂提问(toolbar_item_Click)" + ex.Message, ex);
184
-            //    }
185
-            //}
186
-            //else if (clickindex == 4)//抢答点名
187
-            //{
188
-            //    HideLevel2();
189
-            //    try
190
-            //    {
191
-            //        #region 关闭冲突页面
192
-
193
-            //        if (IsOpenRollCallWindow)
194
-            //        {
195
-            //            return;
196
-            //        }
197
-            //        else
198
-            //        {
199
-            //            CloseOrHideWindowPage();
200
-            //        }
201
-
202
-            //        #endregion 关闭冲突页面
203
-
204
-            //        if (rollCallWindow == null)
205
-            //        {
206
-            //            rollCallWindow = new RollCallWindow();
207
-            //            rollCallWindow.click_closeClick += RollCallWindow_click_closeClick;
208
-            //        }
209
-            //        else
210
-            //        {
211
-            //            rollCallWindow.Initialize();
212
-            //        }
213
-            //        rollCallWindow.Owner = this;
214
-            //        //ZSocketServer.getInstance().addWin(rollCallWindow);
215
-            //        IsOpenRollCallWindow = true;
216
-            //        rollCallWindow.Show();
217
-            //    }
218
-            //    catch (Exception ex)
219
-            //    {
220
-            //        IsOpenRollCallWindow = false;
221
-            //        rollCallWindow = null;
222
-            //        LogHelper.WriteErrLog("【抢答点名(toolbar_item_Click)" + ex.Message, ex);
223
-            //    }
224
-            //}
225
-            //else if (clickindex == 5)//课堂工具。
226
-            //{
227
-            //    try
228
-            //    {
229
-            //        heibanshow = !heibanshow;
230
-            //        List<DependencyObject> list = new List<DependencyObject>
231
-            //        {
232
-            //            heiban_btn,
233
-            //            pizhu_btn
234
-            //        };
235
-            //        if (tangceshow)
236
-            //        {
237
-            //            tangceshow = !tangceshow;
238
-            //            List<DependencyObject> lists = new List<DependencyObject>
239
-            //            {
240
-            //                import_word_btn,
241
-            //                jietu_btn
242
-            //            };
243
-            //            hideOrShow(tangceshow, tangceTool, lists);
244
-            //        }
245
-            //        hideOrShow(heibanshow, ketangTool, list);
246
-            //    }
247
-            //    catch (Exception ex)
248
-            //    {
249
-            //        LogHelper.WriteErrLog("【课堂工具(toolbar_item_Click)" + ex.Message, ex);
250
-            //    }
251
-            //}
252
-            //else if (clickindex == 7)//本节考勤
253
-            //{
254
-            //    HideLevel2();
255
-            //    try
256
-            //    {
257
-            //        showKaoqin();
258
-            //    }
259
-            //    catch (Exception ex)
260
-            //    {
261
-            //        LogHelper.WriteErrLog("【考勤(toolbar_item_Click)" + ex.Message, ex);
262
-            //    }
263
-            //}
264
-            //else if (clickindex == 8)//结束课堂。
265
-            //{
266
-            //    if (MessageWindow.Show("是否结束课堂?", "提示", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
267
-            //    {
268
-            //        closeAction();
269
-            //    }
270
-            //}
161
+            else if (clickindex == 2)//抢答点名
162
+            {
163
+                //HideLevel2();
164
+                try
165
+                {
166
+                    //#region 关闭冲突页面
167
+
168
+                    //if (IsOpenRollCallWindow)
169
+                    //{
170
+                    //    return;
171
+                    //}
172
+                    //else
173
+                    //{
174
+                    //    CloseOrHideWindowPage();
175
+                    //}
176
+
177
+                    //#endregion 关闭冲突页面
178
+
179
+                    if (APP.W_RollCallWindow == null)
180
+                    {
181
+                        APP.W_RollCallWindow = new RollCallWindow();
182
+                        //APP.W_RollCallWindow.click_closeClick += RollCallWindow_click_closeClick;
183
+                    }
184
+                    else
185
+                    {
186
+                        //APP.W_RollCallWindow.Initialize();
187
+                    }
188
+                    APP.W_RollCallWindow.Owner = this;
189
+                    //ZSocketServer.getInstance().addWin(rollCallWindow);
190
+                    //IsOpenRollCallWindow = true;
191
+                    APP.W_RollCallWindow.Show();
192
+                }
193
+                catch (Exception ex)
194
+                {
195
+                    //IsOpenRollCallWindow = false;
196
+                    //rollCallWindow = null;
197
+                    LogHelper.WriteErrLog("【抢答点名(toolbar_item_Click)" + ex.Message, ex);
198
+                }
199
+            }
200
+            else if (clickindex == 3)//课堂工具。
201
+            {
202
+                try
203
+                {
204
+                    heibanshow = !heibanshow;
205
+                    List<DependencyObject> list = new List<DependencyObject>
206
+                    {
207
+                        heiban_btn,
208
+                        pizhu_btn
209
+                    };
210
+                    //if (tangceshow)
211
+                    //{
212
+                    //    tangceshow = !tangceshow;
213
+                    //    List<DependencyObject> lists = new List<DependencyObject>
214
+                    //    {
215
+                    //        import_word_btn,
216
+                    //        jietu_btn
217
+                    //    };
218
+                    //    hideOrShow(tangceshow, tangceTool, lists);
219
+                    //}
220
+                    hideOrShow(heibanshow, ketangTool, list);
221
+                }
222
+                catch (Exception ex)
223
+                {
224
+                    LogHelper.WriteErrLog("【课堂工具(toolbar_item_Click)" + ex.Message, ex);
225
+                }
226
+            }
227
+            else if (clickindex == 4)//本节考勤
228
+            {
229
+                //HideLevel2();
230
+                try
231
+                {
232
+                    showKaoqin();
233
+                }
234
+                catch (Exception ex)
235
+                {
236
+                    LogHelper.WriteErrLog("【考勤(toolbar_item_Click)" + ex.Message, ex);
237
+                }
238
+            }
239
+            else if (clickindex == 5)//结束课堂。
240
+            {
241
+                if (MessageWindow.Show("是否结束课堂?", "提示", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
242
+                {
243
+                    closeAction();
244
+                }
245
+            }
271 246
         }
272 247
         /// <summary>
273 248
         /// 个人空间关闭
@@ -279,6 +254,411 @@ namespace XHZB.Desktop
279 254
             APP.W_UserCenterWindow = null;
280 255
             //IsOpenUserCenterWindow = false;
281 256
         }
257
+        /// <summary>
258
+        /// 考勤
259
+        /// </summary>
260
+        private void showKaoqin()
261
+        {
262
+            //if (
263
+            //        attendanceWindow != null &&
264
+            //        !attendanceWindow.IsFocused
265
+            //        )
266
+            //{
267
+            //    attendanceWindow.Focus();
268
+            //}
269
+            //else
270
+            //{
271
+            try
272
+            {
273
+                #region 关闭冲突页面
274
+
275
+                //if (IsOpenAttendanceWindow)
276
+                //{
277
+                //    return;
278
+                //}
279
+                //else
280
+                //{
281
+                //    CloseOrHideWindowPage();
282
+                //}
283
+
284
+                #endregion 关闭冲突页面
285
+
286
+                if (APP.W_AttendanceWindow == null)
287
+                {
288
+                    APP.W_AttendanceWindow = new AttendanceWindow
289
+                    {
290
+                        Owner = this
291
+                    };
292
+                    //APP.W_AttendanceWindow.Closed += AttendanceWindow_Closed;
293
+                }
294
+                else
295
+                {
296
+                    //APP.W_AttendanceWindow.Initialize();
297
+                }
298
+                //IsOpenAttendanceWindow = true;
299
+                APP.W_AttendanceWindow.Show();
300
+            }
301
+            catch (Exception ex)
302
+            {
303
+                //IsOpenAttendanceWindow = false;
304
+                //attendanceWindow = null;
305
+                LogHelper.WriteErrLog("【考勤(toolbar_item_Click)" + ex.Message, ex);
306
+            }
307
+            //}
308
+        }
309
+        /// <summary>
310
+        /// 黑板
311
+        /// </summary>
312
+        /// <param name="sender"></param>
313
+        /// <param name="e"></param>
314
+        private void Heiban_btn_Click(object sender, RoutedEventArgs e)
315
+        {
316
+            try
317
+            {
318
+                heibanshow = !heibanshow;
319
+
320
+                #region 关闭冲突页面
321
+
322
+                //CloseOrHideWindowPage();
323
+
324
+                #endregion 关闭冲突页面
325
+
326
+                List<DependencyObject> list = new List<DependencyObject>
327
+                {
328
+                    heiban_btn,
329
+                    pizhu_btn
330
+                };
331
+                hideOrShow(heibanshow, ketangTool, list);
332
+                if (APP.W_ZBlackboardWindow == null)
333
+                {
334
+                    APP.W_ZBlackboardWindow = new ZBlackboardWindow
335
+                    {
336
+                        Topmost = true,
337
+                        Width = pwidth,
338
+                        Height = pHeight,
339
+                        Left = 0,
340
+                        Top = 0,
341
+                        Owner = this
342
+                    };
343
+                    //APP.W_ZBlackboardWindow.click_closeClick += BlackboardWin2_click_closeClick;
344
+                }
345
+                //ZSocketServer.getInstance().addWin(blackboardWin2);
346
+                APP.W_ZBlackboardWindow.ShowDialog();
347
+            }
348
+            catch (Exception ex)
349
+            {
350
+                LogHelper.WriteErrLog("【黑板(Heiban_btn_Click)" + ex.Message, ex);
351
+            }
352
+        }
353
+        /// <summary>
354
+        /// 批注
355
+        /// </summary>
356
+        /// <param name="sender"></param>
357
+        /// <param name="e"></param>
358
+        private void Pizhu_btn_Click(object sender, RoutedEventArgs e)
359
+        {
360
+            try
361
+            {
362
+                heibanshow = !heibanshow;
363
+
364
+                #region 关闭冲突页面
365
+
366
+                //CloseOrHideWindowPage();
367
+
368
+                #endregion 关闭冲突页面
369
+
370
+                List<DependencyObject> list = new List<DependencyObject>
371
+                {
372
+                    heiban_btn,
373
+                    pizhu_btn
374
+                };
375
+                hideOrShow(heibanshow, ketangTool, list);
376
+                if (APP.W_PracticeWindow == null)
377
+                {
378
+                    APP.W_PracticeWindow = new PracticeWindow();
379
+                    APP.W_PracticeWindow.click_closeClick += PracticeWin_click_closeClick;
380
+                    APP.W_PracticeWindow.Topmost = true;//zhangxueyang
381
+                    APP.W_PracticeWindow.Width = pwidth;
382
+                    APP.W_PracticeWindow.Height = pHeight;
383
+                    APP.W_PracticeWindow.Left = 0;
384
+                    APP.W_PracticeWindow.Top = 0;
385
+
386
+                    APP.W_PracticeWindow.Unloaded += PracticeWin_Unloaded;
387
+                }
388
+                APP.W_PracticeWindow.Owner = this;//zhangxueyang
389
+                Hide();
390
+                addimage();
391
+                //ZSocketServer.getInstance().addWin(practiceWin);
392
+                APP.W_PracticeWindow.ShowDialog();
393
+            }
394
+            catch (Exception ex)
395
+            {
396
+                LogHelper.WriteErrLog("【批注(Pizhu_btn_Click)" + ex.Message, ex);
397
+            }
398
+        }
399
+        /// <summary>
400
+        /// 添加截图到批注
401
+        /// </summary>
402
+        private void addimage()
403
+        {
404
+            string ImagePath = ImageHelper.GetTempImagePath();
405
+            ImageHelper.GetScreenshot(new System.Drawing.Rectangle(0, 0, 0, 0), ImagePath,false,out BitmapImage bitmapImage,-1);
406
+            APP.W_PracticeWindow.addImage(ImagePath);
407
+        }
408
+        /// <summary>
409
+        /// 批注关闭
410
+        /// </summary>
411
+        private void PracticeWin_click_closeClick()
412
+        {
413
+            APP.W_PracticeWindow = null;
414
+        }
415
+        /// <summary>
416
+        /// 批注关闭时显示工具栏
417
+        /// </summary>
418
+        /// <param name="sender"></param>
419
+        /// <param name="e"></param>
420
+        private void PracticeWin_Unloaded(object sender, RoutedEventArgs e)
421
+        {
422
+            Show();
423
+        }
424
+        /// <summary>
425
+        /// 结束课堂
426
+        /// </summary>
427
+        private void closeAction()
428
+        {
429
+            //MyApp.myloading.Show();//加载等待
430
+
431
+            try
432
+            {
433
+                //#region 加载通知栏图标
434
+
435
+                //System.Windows.Forms.NotifyIcon ico = new System.Windows.Forms.NotifyIcon
436
+                //{
437
+                //    Icon = new System.Drawing.Icon(FileToolsCommon.GetFileAbsolutePath("favicon256.ico")),
438
+                //    //this.Icon.DoubleClick += Icon_DoubleClick;//双击恢复  暂无
439
+                //    Visible = true
440
+                //};
441
+
442
+                //#endregion 加载通知栏图标
443
+
444
+                //WindowState = WindowState.Minimized;
445
+
446
+                //#region 关闭已打开窗口
447
+
448
+                //pageData.tongping = !pageData.tongping;
449
+                ////停止屏幕共享
450
+                //if (pageData.tongping)
451
+                //{
452
+                //    tongpingEnd();
453
+                //    pageData.menuList[1].Pic = "../Images/MainInterface/屏幕共享@2x.png";
454
+                //    pageData.menuList[1].Name = "屏幕共享";
455
+                //    gridAnimated.Visibility = Visibility.Collapsed;
456
+                //}
457
+                //if (blackboardWin2 != null)
458
+                //{
459
+                //    blackboardWin2.Close();
460
+                //}
461
+                //if (rollCallWindow != null)
462
+                //{
463
+                //    rollCallWindow.Close();
464
+                //}
465
+                //if (classroomExamWindow != null)
466
+                //{
467
+                //    classroomExamWindow.Close();
468
+                //}
469
+                //if (classReportWindow != null)
470
+                //{
471
+                //    classReportWindow.Close();
472
+                //}
473
+                //if (practiceWin != null)
474
+                //{
475
+                //    practiceWin.Close();
476
+                //}
477
+                //if (classroomQuestionsWindow != null)
478
+                //{
479
+                //    classroomQuestionsWindow.Close();
480
+                //}
481
+                //if (jietuWindow != null)
482
+                //{
483
+                //    jietuWindow.Close();
484
+                //}
485
+                //if (attendanceWindow != null)
486
+                //{
487
+                //    attendanceWindow.Close();
488
+                //}
489
+                //if (userCenterWindow != null)
490
+                //{
491
+                //    userCenterWindow.Close();
492
+                //}
493
+
494
+                //#endregion 关闭已打开窗口
495
+
496
+
497
+
498
+                //new Thread(o =>
499
+                //{
500
+                //    StopNginx();
501
+                //    string msg = ZSocketMsgManger.classEnd();
502
+                //    ZSocketServer.getInstance().SendMessage(msg);
503
+
504
+
505
+                //    #region 清除没有上线人数的课堂数据
506
+                //    /*
507
+                //          * 上传本地数据库数据
508
+                //          *  判断该节课是否有人上线 若没人在线删除本节课数据。
509
+                //          *  可能存在多节课 1.多节课都没人上线,删除所有数据不上传。 2.多节课有上线的有没上线的情况,删除没有上线人数课的数据,将其余数据上传。
510
+                //          * 
511
+                //          * 
512
+                //          * 
513
+                //          */
514
+                //    List<ClassData> classDataList = new List<ClassData>();
515
+                //    classDataList = ZSqliteManger.queryClassData();//取所有数据
516
+
517
+
518
+                //    if (classDataList.Count > 0)
519
+                //    {
520
+                //        for (int i = 0; i < classDataList.Count; i++)
521
+                //        {
522
+                //            if ("startclass".Equals(classDataList[i].api))//获取每节课的课堂id
523
+                //            {
524
+                //                List<ClassData> classroomidDataList = new List<ClassData>();
525
+                //                classroomidDataList = ZSqliteManger.queryClassRoomidData(classDataList[i].roomid);//取该节课的所有数据
526
+                //                for (int j = 0; j < classroomidDataList.Count; j++)
527
+                //                {
528
+                //                    if ("sign".Equals(classroomidDataList[j].api))//若存在上线学生跳出循环
529
+                //                    {
530
+                //                        break;
531
+                //                    }
532
+                //                    if (j + 1 == classroomidDataList.Count)//若遍历完所有数据仍没有上线学生,删除该课堂id下所有数据
533
+                //                    {
534
+                //                        ZSqliteManger.clearClassData(classroomidDataList[j].roomid);
535
+                //                        if (classroomidDataList[j].roomid == ZCommonData.roomid)
536
+                //                        {
537
+                //                            try
538
+                //                            {
539
+                //                                string path = ZConfig.classRoomImagePath();
540
+                //                                if (Directory.Exists(path))
541
+                //                                {
542
+                //                                    Directory.Delete(path, true);
543
+                //                                }
544
+                //                            }
545
+                //                            catch (Exception ex)
546
+                //                            {
547
+                //                                LogHelper.WriteErrLog("ToolbarWindow(删除无效课堂文件夹报错:)" + ex.Message, ex);
548
+                //                            }
549
+                //                        }
550
+                //                    }
551
+                //                }
552
+                //            }
553
+                //        }
554
+
555
+                //        classDataList = new List<ClassData>();
556
+                //        classDataList = ZSqliteManger.queryClassData();//取所有数据
557
+                //    }
558
+                //    #endregion
559
+
560
+                //    if (classDataList.Count > 0)
561
+                //    {
562
+                //        bool isRoomid = false;
563
+                //        for (int i = 0; i < classDataList.Count; i++)
564
+                //        {
565
+                //            if (classDataList[i].roomid == ZCommonData.roomid)
566
+                //            {
567
+                //                isRoomid = true;
568
+                //            }
569
+                //        }
570
+
571
+                //        if (isRoomid)
572
+                //        {
573
+                //            Dictionary<string, object> stopclass = new Dictionary<string, object>
574
+                //    {
575
+                //        { "roomid", ZCommonData.roomid },
576
+                //        { "endtime", ZNumUtil.unixTime() }
577
+                //    };
578
+                //            ZCommonData.askid = ZNumUtil.randomNum();
579
+                //            ZSqliteManger.insertClassData(new ClassData()
580
+                //            {
581
+                //                unix = ZNumUtil.unixTime(),
582
+                //                roomid = ZCommonData.roomid,
583
+                //                api = "stopclass",
584
+                //                json = ZJsonHelper.ToJson(stopclass),
585
+                //                askid = ZCommonData.askid
586
+                //            });
587
+                //        }
588
+                //    }
589
+                //    ZSocketServer.getInstance().Dispose();
590
+
591
+                //    if (classDataList.Count > 0)
592
+                //    {
593
+                //        MyApp.ZipFile();
594
+                //    }
595
+
596
+
597
+                Dispatcher.Invoke(new Action(() =>
598
+                {
599
+                    System.Environment.Exit(0);
600
+                }));
601
+                //}).Start();
602
+            }
603
+            catch (Exception ex)
604
+            {
605
+
606
+                LogHelper.WriteErrLog("【ToolbarWindow】(closeAction)" + ex.Message, ex);
607
+            }
608
+
609
+
610
+        }
611
+        /// <summary>
612
+        /// 二级工具栏打开隐藏
613
+        /// </summary>
614
+        /// <param name="toolShow"></param>
615
+        /// <param name="target"></param>
616
+        /// <param name="contentList"></param>
617
+        private void hideOrShow(bool toolShow, DependencyObject target, List<DependencyObject> contentList)
618
+        {
619
+            Storyboard story = new Storyboard();
620
+            DoubleAnimation da = new DoubleAnimation();
621
+            if (toolShow)
622
+            {
623
+                da.From = 0;
624
+                da.To = 173;
625
+            }
626
+            else
627
+            {
628
+                da.From = 173.0;
629
+                da.To = 0.0;
630
+            }
631
+
632
+            //可选属性:是否往返播放
633
+            da.AutoReverse = false;
634
+            //da.RepeatBehavior = RepeatBehavior.Forever;
635
+            //da.RepeatBehavior = new RepeatBehavior(2);
636
+            da.Duration = new Duration(TimeSpan.FromSeconds(0.3));
637
+            Storyboard.SetTarget(da, target);
638
+            Storyboard.SetTargetProperty(da, new PropertyPath("Width"));
639
+            story.Children.Add(da);
640
+
641
+            foreach (DependencyObject item in contentList)
642
+            {
643
+                DoubleAnimation da2 = new DoubleAnimation();
644
+                if (toolShow)
645
+                {
646
+                    da2.From = 0;
647
+                    da2.To = 1.0;
648
+                }
649
+                else
650
+                {
651
+                    da2.From = 1.0;
652
+                    da2.To = 0.0;
653
+                }
654
+                da2.Duration = new Duration(TimeSpan.FromSeconds(0.1));
655
+                Storyboard.SetTarget(da2, item);
656
+                Storyboard.SetTargetProperty(da2, new PropertyPath("Opacity"));
657
+                story.Children.Add(da2);
658
+            }
659
+
660
+            story.Begin();
661
+        }
282 662
         private void toolbar_win_Closed(object sender, EventArgs e)
283 663
         {
284 664
 

+ 304
- 0
XHZB.Desktop/Utils/BlackboardNew.cs View File

@@ -0,0 +1,304 @@
1
+using Common.system;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Windows;
5
+using System.Windows.Controls;
6
+using System.Windows.Ink;
7
+using System.Windows.Input;
8
+using System.Windows.Media;
9
+
10
+namespace XHZB.Desktop.Utils
11
+{
12
+    internal enum ZPenType : byte
13
+    {
14
+        Pen = 1,
15
+        Erase = 2
16
+    };
17
+
18
+    internal class ZBBPage
19
+    {
20
+        public List<ZBBPageStep> lines { get; set; }
21
+        public List<ZBBPageStep> lines_histoty { get; set; }
22
+
23
+        public ZBBPage()
24
+        {
25
+            lines = new List<ZBBPageStep>();
26
+            lines_histoty = new List<ZBBPageStep>();
27
+        }
28
+    }
29
+
30
+    internal class ZBBPageStep
31
+    {
32
+        public StrokeCollection lines_curr { get; set; }
33
+        public StrokeCollection lines_add { get; set; }
34
+        public StrokeCollection lines_remove { get; set; }
35
+
36
+        public ZBBPageStep()
37
+        {
38
+            lines_curr = new StrokeCollection();
39
+            lines_add = new StrokeCollection();
40
+            lines_remove = new StrokeCollection();
41
+        }
42
+    }
43
+
44
+    public class BlackboardNew
45
+    {
46
+        private InkCanvas m_canvas;
47
+
48
+        //private ZPenType type = ZPenType.Pen;
49
+        private int pagenum = 0;
50
+
51
+        private readonly int erasesize = 64;
52
+        private readonly int pensize = 3;
53
+        private int undoOrRedo = 0; //是否在进行撤销恢复操作
54
+        private Color pencolor;
55
+
56
+        private readonly List<ZBBPage> strokes_page_all = new List<ZBBPage>();
57
+
58
+        // 添加这个变量是因为在用橡皮擦时 一次操作会触发多次StrokesChanged回掉 这里是把多次回掉合并在一起
59
+        private ZBBPageStep step = null;
60
+
61
+        public BlackboardNew(InkCanvas canvas)
62
+        {
63
+            init(canvas, Colors.White);
64
+        }
65
+
66
+        public BlackboardNew(InkCanvas canvas, Color _pencolor)
67
+        {
68
+            init(canvas, _pencolor);
69
+        }
70
+
71
+        private void init(InkCanvas canvas, Color _pencolor)
72
+        {
73
+            m_canvas = canvas;
74
+            pencolor = _pencolor;
75
+            ZBBPage page = new ZBBPage();
76
+            page.lines.Add(new ZBBPageStep());
77
+            strokes_page_all.Add(page);
78
+            if (canvas != null)
79
+            {
80
+                canvas.EditingMode = InkCanvasEditingMode.Ink;
81
+                canvas.UseCustomCursor = true;
82
+                canvas.Cursor = Cursors.Pen;
83
+                DrawingAttributes drawingAttributes = new DrawingAttributes();
84
+                canvas.DefaultDrawingAttributes = drawingAttributes;
85
+                drawingAttributes.Width = pensize;
86
+                drawingAttributes.Height = pensize;
87
+                drawingAttributes.Color = pencolor;
88
+                drawingAttributes.FitToCurve = true;
89
+                drawingAttributes.IgnorePressure = false;
90
+                canvas.Strokes.StrokesChanged += Strokes_StrokesChanged;
91
+                canvas.StrokeCollected += Canvas_StrokeCollected;
92
+                canvas.StrokeErasing += Canvas_StrokeErasing;
93
+                canvas.StrokeErased += Canvas_StrokeErased;
94
+                canvas.MouseUp += Canvas_MouseUp;
95
+            }
96
+        }
97
+
98
+        private void Canvas_StrokeErasing(object sender, InkCanvasStrokeErasingEventArgs e)
99
+        {
100
+            undoOrRedo = 0;
101
+        }
102
+
103
+        private void Canvas_StrokeErased(object sender, RoutedEventArgs e)
104
+        {
105
+        }
106
+
107
+        private void Canvas_StrokeCollected(object sender, InkCanvasStrokeCollectedEventArgs e)
108
+        {
109
+        }
110
+
111
+        private void Canvas_MouseUp(object sender, MouseButtonEventArgs e)
112
+        {
113
+            if (step != null)
114
+            {
115
+                ZBBPage page = strokes_page_all[pagenum];
116
+                if (page != null)
117
+                {
118
+                    step.lines_curr.Add(m_canvas.Strokes);
119
+                    page.lines.Add(step);
120
+                    step = null;
121
+                }
122
+            }
123
+        }
124
+
125
+        private void Strokes_StrokesChanged(object sender, StrokeCollectionChangedEventArgs e)
126
+        {
127
+            if (undoOrRedo > 0)
128
+            {
129
+                undoOrRedo -= 1;
130
+                return;
131
+            }
132
+
133
+            if (step == null)
134
+            {
135
+                step = new ZBBPageStep();
136
+            }
137
+
138
+            // 笔模式
139
+            if (e.Added.Count > 0 && e.Removed.Count == 0)
140
+            {
141
+                step.lines_add.Add(e.Added);
142
+            }
143
+            // 橡皮模式 会多次进入回掉
144
+            else if (e.Removed.Count > 0)
145
+            {
146
+                step.lines_add.Add(e.Added);
147
+                for (int i = 0; i < e.Removed.Count; i++)
148
+                {
149
+                    Stroke removeItem = e.Removed[i];
150
+                    try
151
+                    {
152
+                        if (step.lines_add.Contains(removeItem))
153
+                        {
154
+                            step.lines_add.Remove(removeItem);
155
+                        }
156
+                        else
157
+                        {
158
+                            step.lines_remove.Add(removeItem);
159
+                        }
160
+                    }
161
+                    catch (System.Exception ex)
162
+                    {
163
+
164
+                        LogHelper.WriteErrLog("【笔迹添加移除事件】(Strokes_StrokesChanged)" + ex.Message, ex);
165
+                    }
166
+                }
167
+            }
168
+        }
169
+
170
+        // public方法 笔
171
+        public void change_pen(Color _color, int _size)
172
+        {
173
+            //this.type = ZPenType.Pen;
174
+            DrawingAttributes drawingAttributes = new DrawingAttributes();
175
+            m_canvas.DefaultDrawingAttributes = drawingAttributes;
176
+            drawingAttributes.Color = _color;
177
+            drawingAttributes.Width = _size;
178
+            drawingAttributes.Height = _size;
179
+            drawingAttributes.FitToCurve = true;
180
+            drawingAttributes.IgnorePressure = false;
181
+            m_canvas.EditingMode = InkCanvasEditingMode.Ink;
182
+            m_canvas.UseCustomCursor = true;
183
+            m_canvas.Cursor = Cursors.Pen;
184
+        }
185
+
186
+        // 橡皮
187
+        public void change_erase()
188
+        {
189
+            //this.type = ZPenType.Erase;
190
+            m_canvas.EditingMode = InkCanvasEditingMode.EraseByPoint;
191
+            m_canvas.UseCustomCursor = false;
192
+            m_canvas.EraserShape = new EllipseStylusShape(erasesize, erasesize, 0);
193
+        }
194
+
195
+        // 撤销
196
+        public void undo()
197
+        {
198
+            ZBBPage page = strokes_page_all[pagenum];
199
+
200
+            if (page != null && m_canvas.Strokes.Count > 0 && page.lines.Count > 1)
201
+            {
202
+                ZBBPageStep last = page.lines.Last();
203
+                page.lines.Remove(last);
204
+                page.lines_histoty.Add(last);
205
+                if (page.lines.Last().lines_curr.Count > 0)
206
+                {
207
+                    undoOrRedo = 2;
208
+                }
209
+                else
210
+                {
211
+                    undoOrRedo = 1;
212
+                }
213
+
214
+                m_canvas.Strokes.Clear();
215
+                m_canvas.Strokes.Add(page.lines.Last().lines_curr);
216
+            }
217
+        }
218
+
219
+        // 恢复
220
+        public void redo()
221
+        {
222
+            ZBBPage page = strokes_page_all[pagenum];
223
+            if (page != null && page.lines_histoty.Count > 0)
224
+            {
225
+                ZBBPageStep line = page.lines_histoty[page.lines_histoty.Count - 1];
226
+
227
+                page.lines.Add(line);
228
+                page.lines_histoty.Remove(line);
229
+                if (page.lines.Last().lines_curr.Count > 0)
230
+                {
231
+                    undoOrRedo = 2;
232
+                }
233
+                else
234
+                {
235
+                    undoOrRedo = 1;
236
+                }
237
+                m_canvas.Strokes.Clear();
238
+                m_canvas.Strokes.Add(page.lines.Last().lines_curr);
239
+            }
240
+        }
241
+
242
+        // 清空
243
+        public void clear()
244
+        {
245
+            ZBBPage page = strokes_page_all[pagenum];
246
+            int num = page.lines.Count;
247
+            for (int i = 0; i < num; i++)
248
+            {
249
+                page = strokes_page_all[pagenum];
250
+                if (page != null && m_canvas.Strokes.Count > 0 && page.lines.Count > 1)
251
+                {
252
+                    ZBBPageStep last = page.lines.Last();
253
+                    page.lines.Remove(last);
254
+                    page.lines_histoty.Add(last);
255
+                    if (page.lines.Last().lines_curr.Count > 0)
256
+                    {
257
+                        undoOrRedo = 2;
258
+                    }
259
+                    else
260
+                    {
261
+                        undoOrRedo = 1;
262
+                    }
263
+
264
+                    m_canvas.Strokes.Clear();
265
+                    m_canvas.Strokes.Add(page.lines.Last().lines_curr);
266
+                }
267
+            }
268
+        }
269
+
270
+        public void changepage(int mpagenum)
271
+        {
272
+            if (pagenum != mpagenum)
273
+            {
274
+                pagenum = mpagenum;
275
+                if (pagenum >= strokes_page_all.Count)
276
+                {
277
+                    int numadd = pagenum - strokes_page_all.Count + 1;
278
+                    for (int i = 0; i < numadd; i++)
279
+                    {
280
+                        ZBBPage pagetemp = new ZBBPage();
281
+                        pagetemp.lines.Add(new ZBBPageStep());
282
+                        strokes_page_all.Add(pagetemp);
283
+                    }
284
+                }
285
+
286
+                ZBBPage page = strokes_page_all[pagenum];
287
+                if (page != null)
288
+                {
289
+                    if (page.lines.Last().lines_curr.Count > 0)
290
+                    {
291
+                        undoOrRedo += 1;
292
+                    }
293
+                    if (m_canvas.Strokes.Count > 0)
294
+                    {
295
+                        undoOrRedo += 1;
296
+                        m_canvas.Strokes.Clear();
297
+                    }
298
+
299
+                    m_canvas.Strokes.Add(page.lines.Last().lines_curr);
300
+                }
301
+            }
302
+        }
303
+    }
304
+}

+ 220
- 0
XHZB.Desktop/Utils/GenericTypeConverter.cs View File

@@ -0,0 +1,220 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Windows;
4
+using System.Windows.Data;
5
+
6
+namespace XHZB.Desktop.Utils
7
+{
8
+    public class GenericTypeConverter : IValueConverter
9
+    {
10
+        /// <summary>
11
+        /// 正向键值对字典
12
+        /// </summary>
13
+        private Dictionary<string, string> Alias { get; set; }
14
+
15
+        /// <summary>
16
+        /// 反向键值对字典
17
+        /// </summary>
18
+        private Dictionary<string, string> BackAlias { get; set; }
19
+
20
+        private string aliasStrTemp = "";
21
+
22
+        /// <summary>
23
+        /// 解析转换规则
24
+        /// </summary>
25
+        /// <param name="aliasStr">规则字符串</param>
26
+        private void ParseAliasByStr(string aliasStr)
27
+        {
28
+            if (aliasStrTemp == aliasStr)
29
+            {
30
+                return;
31
+            }
32
+
33
+            aliasStrTemp = aliasStr;
34
+            Alias = new Dictionary<string, string>();
35
+            BackAlias = new Dictionary<string, string>();
36
+
37
+            string content = aliasStr;
38
+
39
+            Alias = new Dictionary<string, string>();
40
+            string[] arr1 = content.Split('|');
41
+            foreach (string item in arr1)
42
+            {
43
+                string[] arr2 = item.Split(':');
44
+                string key = arr2[0];
45
+                if (key == "true")
46
+                {
47
+                    key = "True";
48
+                }
49
+                else if (key == "false")
50
+                {
51
+                    key = "False";
52
+                }
53
+                string value = arr2[1];
54
+                if (key != "other")
55
+                {
56
+                    BackAlias.Add(value, key);
57
+                }
58
+
59
+                Alias.Add(key, value);
60
+            }
61
+        }
62
+
63
+        private object ConvertCommon(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture, bool isBack)
64
+        {
65
+            if (value == null || string.IsNullOrEmpty(parameter.ToString()))
66
+            {
67
+                return null;
68
+            }
69
+
70
+            object ret = value;//如果没有匹配返回传入的值
71
+
72
+            ParseAliasByStr(parameter.ToString());
73
+            Dictionary<string, string> alias;
74
+            if (isBack)
75
+            {
76
+                alias = BackAlias;
77
+            }
78
+            else
79
+            {
80
+                alias = Alias;
81
+            }
82
+
83
+            //绑定的值
84
+            string bindingValue = value.ToString();
85
+
86
+            if (alias.ContainsKey(bindingValue))
87
+            {
88
+                ret = StringToTargetType(alias[bindingValue], targetType);
89
+            }
90
+            else if (alias.ContainsKey("other"))
91
+            {
92
+                ret = StringToTargetType(alias["other"], targetType);
93
+            }
94
+            else if (alias.ContainsKey("else"))
95
+            {
96
+                ret = StringToTargetType(alias["else"], targetType);
97
+            }
98
+
99
+            return ret;
100
+        }
101
+
102
+        /// <summary>
103
+        /// 字符串转换成目标类型,如需添加一个目标类型只需在该方法中添加一个类型判断之后转换
104
+        /// </summary>
105
+        /// <param name="strValue"></param>
106
+        /// <param name="targetType"></param>
107
+        /// <returns></returns>
108
+        private object StringToTargetType(string strValue, Type targetType)
109
+        {
110
+            object ret = null;
111
+            //目标类型 string
112
+            if (targetType == typeof(string) || targetType == typeof(char))
113
+            {
114
+                ret = strValue;
115
+            }
116
+            //目标类型 char
117
+            if (targetType == typeof(char))
118
+            {
119
+                if (strValue.Length == 1)
120
+                {
121
+                    ret = strValue;
122
+                }
123
+            }
124
+            //目标类型 int
125
+            if (targetType == typeof(int))
126
+            {
127
+                if (int.TryParse(strValue, out int temp))
128
+                {
129
+                    ret = temp;
130
+                }
131
+                else
132
+                {
133
+                    ret = 0;
134
+                }
135
+            }
136
+            //目标类型 double
137
+            if (targetType == typeof(double))
138
+            {
139
+                if (double.TryParse(strValue, out double temp))
140
+                {
141
+                    ret = temp;
142
+                }
143
+                else
144
+                {
145
+                    ret = 0;
146
+                }
147
+            }
148
+            //目标类型 float
149
+            if (targetType == typeof(float))
150
+            {
151
+                if (float.TryParse(strValue, out float temp))
152
+                {
153
+                    ret = temp;
154
+                }
155
+                else
156
+                {
157
+                    ret = 0;
158
+                }
159
+            }
160
+            //目标类型 decimal
161
+            if (targetType == typeof(decimal))
162
+            {
163
+                if (decimal.TryParse(strValue, out decimal temp))
164
+                {
165
+                    ret = temp;
166
+                }
167
+                else
168
+                {
169
+                    ret = 0;
170
+                }
171
+            }
172
+            //目标类型 bool? bool
173
+            if (targetType == typeof(bool?) || targetType == typeof(bool))
174
+            {
175
+                if (bool.TryParse(strValue, out bool temp))
176
+                {
177
+                    ret = temp;
178
+                }
179
+                else
180
+                {
181
+                    ret = false;
182
+                }
183
+            }
184
+
185
+            //目标类型 Visibility
186
+            if (targetType == typeof(Visibility))
187
+            {
188
+                switch (strValue.ToLower())
189
+                {
190
+                    case "collapsed":
191
+                        ret = Visibility.Collapsed;
192
+                        break;
193
+
194
+                    case "hidden":
195
+                        ret = Visibility.Hidden;
196
+                        break;
197
+
198
+                    case "visible":
199
+                        ret = Visibility.Visible;
200
+                        break;
201
+
202
+                    default:
203
+                        ret = Visibility.Visible;
204
+                        break;
205
+                }
206
+            }
207
+            return ret;
208
+        }
209
+
210
+        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
211
+        {
212
+            return ConvertCommon(value, targetType, parameter, culture, false);
213
+        }
214
+
215
+        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
216
+        {
217
+            return ConvertCommon(value, targetType, parameter, culture, true);
218
+        }
219
+    }
220
+}

+ 236
- 0
XHZB.Desktop/Utils/RegisterController.cs View File

@@ -0,0 +1,236 @@
1
+using Common.system;
2
+using System;
3
+using System.Collections.Generic;
4
+using System.Linq;
5
+using System.Text;
6
+using System.Threading.Tasks;
7
+using XHZB.Model;
8
+
9
+namespace XHZB.Desktop.Utils
10
+{
11
+    //接口调用
12
+    public class RegisterController
13
+    {
14
+        /// <summary>
15
+        /// 登陆
16
+        /// </summary>
17
+        /// <param name="request"></param>
18
+        /// <returns></returns>
19
+        public int Login(string loginname, string loginpwd)
20
+        {
21
+            string url = APP.apiUrl + "/user/login";//地址
22
+            Dictionary<string, object> dic = new Dictionary<string, object>
23
+            {
24
+                { "loginname", loginname},
25
+                { "loginpwd", loginpwd}
26
+            };
27
+            string body = JsonHelper.ToJson(dic);
28
+            ResultVo<LoginModel> result = HttpHelper.PostAndRespSignle<ResultVo<LoginModel>>(url, postData: body);
29
+            if (result != null)
30
+            {
31
+                APP.ErrorMessage = result.msg;
32
+                APP.LoginUser = result.obj;
33
+                return result.code;
34
+            }
35
+            else
36
+            {
37
+                APP.ErrorMessage = "网络异常!";
38
+                APP.LoginUser = new LoginModel();
39
+                return 1;
40
+            }
41
+        }
42
+        /// <summary>
43
+        /// 教师任教班级
44
+        /// </summary>
45
+        /// <param name="request"></param>
46
+        /// <returns></returns>
47
+        public int ClassList()
48
+        {
49
+            try
50
+            {
51
+                string url = APP.apiUrl + "/class_teacher/tclist";//地址
52
+                Dictionary<string, int> dic = new Dictionary<string, int>
53
+                {
54
+                    { "createid", APP.LoginUser.userid},
55
+                    { "year", APP.LoginUser.year}
56
+                };
57
+                string body = JsonHelper.ToJson(dic);
58
+                ResultVo<List<ClassListModel>> result = HttpHelper.PostAndRespSignle<ResultVo<List<ClassListModel>>>(url, postData: body);
59
+                if (result != null)
60
+                {
61
+                    APP.ErrorMessage = result.msg;
62
+                    APP.ClassList = result.obj;
63
+                    return result.code;
64
+                }
65
+                else
66
+                {
67
+                    APP.ErrorMessage = "网络异常!";
68
+                    return 1;
69
+                }
70
+            }
71
+            catch (Exception ex)
72
+            {
73
+                LogHelper.WriteErrLog("【调用接口(RegisterController)】错误日志:" + ex.Message, ex);
74
+                return 1;
75
+            }
76
+        }
77
+        /// <summary>
78
+        /// 教师教材列表
79
+        /// </summary>
80
+        /// <param name="request"></param>
81
+        /// <returns></returns>
82
+        public int TsubjectbookList()
83
+        {
84
+            try
85
+            {
86
+                string url = APP.apiUrl + "/tsubjectbook/list";//地址
87
+                Dictionary<string, int> dic = new Dictionary<string, int>
88
+                {
89
+                    { "teacherid",APP.LoginUser.userid}
90
+                };
91
+                string body = JsonHelper.ToJson(dic);
92
+                ResultVo<List<TsubjectbookListModel>> result = HttpHelper.PostAndRespSignle<ResultVo<List<TsubjectbookListModel>>>(url, postData: body);
93
+                if (result != null)
94
+                {
95
+                    APP.ErrorMessage = result.msg;
96
+                    APP.TsubjectbookList = result.obj;
97
+                    return result.code;
98
+                }
99
+                else
100
+                {
101
+                    APP.ErrorMessage = "网络异常!";
102
+                    return 1;
103
+                }
104
+            }
105
+            catch (Exception ex)
106
+            {
107
+                LogHelper.WriteErrLog("【调用接口(RegisterController)】错误日志:" + ex.Message, ex);
108
+                return 1;
109
+            }
110
+        }
111
+        /// <summary>
112
+        /// 章节--列表
113
+        /// </summary>
114
+        /// <param name="request"></param>
115
+        /// <returns></returns>
116
+        public int DirectorList(int lsbid,int directortype,int createid)
117
+        {
118
+            try
119
+            {
120
+                string url = APP.apiUrl + "/director/list";//地址
121
+                Dictionary<string, int> dic = new Dictionary<string, int>
122
+                {
123
+                    { "lsbid", lsbid },
124
+                    { "directortype", directortype },
125
+                    { "createid", createid }
126
+                };
127
+                string body = JsonHelper.ToJson(dic);
128
+                ResultVo<List<DirectorListModel>> result = HttpHelper.PostAndRespSignle<ResultVo<List<DirectorListModel>>>(url, postData: body);
129
+                if (result != null)
130
+                {
131
+                    APP.ErrorMessage = result.msg;
132
+                    APP.DirectorList = result.obj;
133
+                    return result.code;
134
+                }
135
+                else
136
+                {
137
+                    APP.ErrorMessage = "网络异常!";
138
+                    return 1;
139
+                }
140
+            }
141
+            catch (Exception ex)
142
+            {
143
+                LogHelper.WriteErrLog("【调用接口(RegisterController)】错误日志:" + ex.Message, ex);
144
+                return 1;
145
+            }
146
+        }
147
+        ///// <summary>
148
+        ///// 我的备课--列表
149
+        ///// </summary>
150
+        ///// <param name="request"></param>
151
+        ///// <returns></returns>
152
+        //public int ResourceMyList(int _lsbid, int _directorid, int _resourceclass)
153
+        //{
154
+        //    //RESP_ResourceMyList returnObj = new RESP_ResourceMyList();
155
+        //    try
156
+        //    {
157
+        //        string url = ZConfig.apiUrl + "/resource/my_list2";//地址
158
+        //        Dictionary<string, int> dic = new Dictionary<string, int>
159
+        //        {
160
+        //            { "lsbid", _lsbid},
161
+        //            { "directorid", _directorid},
162
+        //            { "resourceclass", _resourceclass},
163
+        //            { "resourcetype", 0},
164
+        //            { "readcount", 0},
165
+        //            { "createid", ZCommonData.loginUser.userid},
166
+        //            { "schoolid", ZCommonData.loginUser.schoolid}
167
+        //        };
168
+        //        string body = DataProvider.SerializeDictionaryToJsonString(dic);
169
+        //        string xmlDoc = DataProvider.HttpPost(body, url);
170
+
171
+        //        if (string.IsNullOrEmpty(xmlDoc))
172
+        //        {
173
+        //            Shared.ServerMsg = "网络异常!";
174
+        //            return 1;
175
+        //        }
176
+        //        else
177
+        //        {
178
+        //            ResultListVo<RESP_ResourceMyListTwo> obj = ZJsonHelper.JsonToObj<ResultListVo<RESP_ResourceMyListTwo>>(xmlDoc);
179
+        //            if (obj != null)
180
+        //            {
181
+        //                Shared.TeachingData.RESP_ResourceMyList.obj = new List<RESP_ResourceMyListTwo>();
182
+        //                Shared.TeachingData.RESP_ResourceMyList.obj = obj.obj;
183
+        //                return 0;
184
+        //            }
185
+        //            else
186
+        //            {
187
+        //                Shared.ServerMsg = "网络异常!";
188
+        //                return 1;
189
+        //            }
190
+        //        }
191
+        //    }
192
+        //    catch (Exception ex)
193
+        //    {
194
+        //        LogHelper.WriteErrLog("我的备课接口" + ex.Message, ex);
195
+        //    }
196
+        //    return 0;
197
+        //}
198
+        ///// <summary>
199
+        ///// 班级学生--列表
200
+        ///// </summary>
201
+        ///// <param name="request"></param>
202
+        ///// <returns></returns>
203
+        //public int ClassStudentList(ref TeachingData teachingData)
204
+        //{
205
+        //    try
206
+        //    {
207
+        //        string url = ZConfig.apiUrl + "/room/list_student";//地址
208
+        //        Dictionary<string, int> dic = new Dictionary<string, int>
209
+        //        {
210
+        //            { "classid", ZCommonData.classid },
211
+        //            {"lsbid",ZCommonData.lsbid }
212
+        //        };
213
+        //        string body = ZJsonHelper.ToJson(dic);
214
+        //        ResultVo<List<RESP_ClassStudentList>> result = ZHttpUtil.PostAndRespSignle<ResultVo<List<RESP_ClassStudentList>>>(url, postData: body);
215
+        //        Shared.ServerMsg = result?.msg;
216
+        //        int code = 0;
217
+        //        if (result != null)
218
+        //        {
219
+        //            Shared.TeachingData.RESP_ClassStudentList = result?.obj;
220
+        //        }
221
+        //        else
222
+        //        {
223
+        //            code = 1;
224
+        //            Shared.ServerMsg = "网络异常";
225
+        //        }
226
+
227
+        //        return code;
228
+        //    }
229
+        //    catch (Exception ex)
230
+        //    {
231
+        //        LogHelper.WriteErrLog("【调用接口(RegisterController)】错误日志:" + ex.Message, ex);
232
+        //    }
233
+        //    return 0;
234
+        //}
235
+    }
236
+}

+ 17
- 0
XHZB.Desktop/Utils/ResultVo.cs View File

@@ -0,0 +1,17 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Text;
5
+using System.Threading.Tasks;
6
+
7
+namespace XHZB.Desktop.Utils
8
+{
9
+    internal class ResultVo<T>
10
+    {
11
+        public int code { get; set; }
12
+
13
+        public string msg { get; set; }
14
+
15
+        public T obj { get; set; }
16
+    }
17
+}

+ 13
- 0
XHZB.Desktop/Utils/ZCache.cs View File

@@ -0,0 +1,13 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Text;
5
+using System.Threading.Tasks;
6
+
7
+namespace XHZB.Desktop.Utils
8
+{
9
+    internal class ZCache
10
+    {
11
+        public static Dictionary<string, string> headDic = new Dictionary<string, string>();
12
+    }
13
+}

+ 18
- 0
XHZB.Desktop/Utils/ZDelayUtil.cs View File

@@ -0,0 +1,18 @@
1
+using System;
2
+using System.Threading;
3
+using System.Windows.Threading;
4
+
5
+namespace XHZB.Desktop.Utils
6
+{
7
+    internal class ZDelayUtil
8
+    {
9
+        public static void delay(int sec, Dispatcher dispatcher, Action act)
10
+        {
11
+            new Thread(o =>
12
+            {
13
+                Thread.Sleep(sec * 1000);
14
+                dispatcher.Invoke(act);
15
+            }).Start();
16
+        }
17
+    }
18
+}

+ 100
- 4
XHZB.Desktop/XHZB.Desktop.csproj View File

@@ -47,8 +47,12 @@
47 47
     <Reference Include="log4net">
48 48
       <HintPath>..\Common\dlls\log4net.dll</HintPath>
49 49
     </Reference>
50
+    <Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
51
+      <HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
52
+    </Reference>
50 53
     <Reference Include="System" />
51 54
     <Reference Include="System.Data" />
55
+    <Reference Include="System.Drawing" />
52 56
     <Reference Include="System.Xml" />
53 57
     <Reference Include="Microsoft.CSharp" />
54 58
     <Reference Include="System.Core" />
@@ -66,28 +70,72 @@
66 70
     </Reference>
67 71
   </ItemGroup>
68 72
   <ItemGroup>
73
+    <Compile Include="AttendanceWindow.xaml.cs">
74
+      <DependentUpon>AttendanceWindow.xaml</DependentUpon>
75
+    </Compile>
76
+    <Compile Include="LoadDialog.xaml.cs">
77
+      <DependentUpon>LoadDialog.xaml</DependentUpon>
78
+    </Compile>
79
+    <Compile Include="PracticeWindow.xaml.cs">
80
+      <DependentUpon>PracticeWindow.xaml</DependentUpon>
81
+    </Compile>
82
+    <Compile Include="RollCallPerfectionWindow.xaml.cs">
83
+      <DependentUpon>RollCallPerfectionWindow.xaml</DependentUpon>
84
+    </Compile>
85
+    <Compile Include="RollCallWindow.xaml.cs">
86
+      <DependentUpon>RollCallWindow.xaml</DependentUpon>
87
+    </Compile>
69 88
     <Compile Include="ToolbarWindow.xaml.cs">
70 89
       <DependentUpon>ToolbarWindow.xaml</DependentUpon>
71 90
     </Compile>
72 91
     <Compile Include="UserCenterWindow.xaml.cs">
73 92
       <DependentUpon>UserCenterWindow.xaml</DependentUpon>
74 93
     </Compile>
94
+    <Compile Include="Utils\BlackboardNew.cs" />
75 95
     <Compile Include="Utils\ColorBgConverter.cs" />
76 96
     <Compile Include="Utils\ColorTextConverter.cs" />
97
+    <Compile Include="Utils\GenericTypeConverter.cs" />
98
+    <Compile Include="Utils\RegisterController.cs" />
99
+    <Compile Include="Utils\ResultVo.cs" />
77 100
     <Compile Include="Utils\VTHelper.cs" />
78
-    <Page Include="MainWindow.xaml">
101
+    <Compile Include="Utils\ZCache.cs" />
102
+    <Compile Include="Utils\ZDelayUtil.cs" />
103
+    <Compile Include="ZBlackboardWindow.xaml.cs">
104
+      <DependentUpon>ZBlackboardWindow.xaml</DependentUpon>
105
+    </Compile>
106
+    <Page Include="AttendanceWindow.xaml">
107
+      <SubType>Designer</SubType>
108
+      <Generator>MSBuild:Compile</Generator>
109
+    </Page>
110
+    <Page Include="LoadDialog.xaml">
111
+      <SubType>Designer</SubType>
112
+      <Generator>MSBuild:Compile</Generator>
113
+    </Page>
114
+    <Page Include="LoginWindow.xaml">
79 115
       <Generator>MSBuild:Compile</Generator>
80 116
       <SubType>Designer</SubType>
81 117
     </Page>
82 118
     <Compile Include="App.cs" />
83
-    <Compile Include="MainWindow.xaml.cs">
84
-      <DependentUpon>MainWindow.xaml</DependentUpon>
119
+    <Compile Include="LoginWindow.xaml.cs">
120
+      <DependentUpon>LoginWindow.xaml</DependentUpon>
85 121
       <SubType>Code</SubType>
86 122
     </Compile>
87 123
     <Page Include="MessageWindow.xaml">
88 124
       <SubType>Designer</SubType>
89 125
       <Generator>XamlIntelliSenseFileGenerator</Generator>
90 126
     </Page>
127
+    <Page Include="PracticeWindow.xaml">
128
+      <SubType>Designer</SubType>
129
+      <Generator>MSBuild:Compile</Generator>
130
+    </Page>
131
+    <Page Include="RollCallPerfectionWindow.xaml">
132
+      <SubType>Designer</SubType>
133
+      <Generator>MSBuild:Compile</Generator>
134
+    </Page>
135
+    <Page Include="RollCallWindow.xaml">
136
+      <SubType>Designer</SubType>
137
+      <Generator>MSBuild:Compile</Generator>
138
+    </Page>
91 139
     <Page Include="ToolbarWindow.xaml">
92 140
       <SubType>Designer</SubType>
93 141
       <Generator>MSBuild:Compile</Generator>
@@ -96,6 +144,10 @@
96 144
       <SubType>Designer</SubType>
97 145
       <Generator>MSBuild:Compile</Generator>
98 146
     </Page>
147
+    <Page Include="ZBlackboardWindow.xaml">
148
+      <SubType>Designer</SubType>
149
+      <Generator>MSBuild:Compile</Generator>
150
+    </Page>
99 151
   </ItemGroup>
100 152
   <ItemGroup>
101 153
     <Compile Include="MessageWindow.xaml.cs">
@@ -174,7 +226,6 @@
174 226
     <Resource Include="Images\RollCall\rollCall_11.png" />
175 227
     <Resource Include="Images\RollCall\rollCall_12.png" />
176 228
     <Resource Include="Images\RollCall\rollCall_13.png" />
177
-    <Resource Include="Images\RollCall\rollCall_2.png" />
178 229
     <Resource Include="Images\RollCall\rollCall_4.png" />
179 230
     <Resource Include="Images\RollCall\rollCall_5.png" />
180 231
     <Resource Include="Images\RollCall\rollCall_6.png" />
@@ -183,5 +234,50 @@
183 234
   <ItemGroup>
184 235
     <Resource Include="Images\ToolBar\img_shared_1.gif" />
185 236
   </ItemGroup>
237
+  <ItemGroup>
238
+    <Resource Include="Images\Blackboard\class_1s.png" />
239
+    <Resource Include="Images\Blackboard\class_1un.png" />
240
+    <Resource Include="Images\Blackboard\class_2s.png" />
241
+    <Resource Include="Images\Blackboard\class_2un.png" />
242
+    <Resource Include="Images\Blackboard\class_3s.png" />
243
+    <Resource Include="Images\Blackboard\class_3un.png" />
244
+    <Resource Include="Images\Blackboard\class_4s.png" />
245
+    <Resource Include="Images\Blackboard\class_4un.png" />
246
+    <Resource Include="Images\Blackboard\class_5s.png" />
247
+    <Resource Include="Images\Blackboard\class_5un.png" />
248
+    <Resource Include="Images\Blackboard\class_6un.png" />
249
+    <Resource Include="Images\Blackboard\class_7un.png" />
250
+    <Resource Include="Images\Blackboard\class_c1.png" />
251
+    <Resource Include="Images\Blackboard\class_p1.png" />
252
+    <Resource Include="Images\Blackboard\class_p2.png" />
253
+    <Resource Include="Images\Blackboard\class_p3.png" />
254
+    <Resource Include="Images\Blackboard\class_s1.png" />
255
+    <Resource Include="Images\Blackboard\class_s2.png" />
256
+    <Resource Include="Images\Blackboard\class_s3.png" />
257
+    <Resource Include="Images\Blackboard\class_s4.png" />
258
+    <Resource Include="Images\Blackboard\class_s5.png" />
259
+    <Resource Include="Images\Blackboard\class_s6.png" />
260
+    <Resource Include="Images\Blackboard\erase.png" />
261
+    <Resource Include="Images\Blackboard\pen.png" />
262
+  </ItemGroup>
263
+  <ItemGroup>
264
+    <Resource Include="Images\Login\account copy 2%402x.png" />
265
+    <Resource Include="Images\Login\data copy 2%402x.png" />
266
+    <Resource Include="Images\Login\login2_0.png" />
267
+    <Resource Include="Images\Login\login2_0_1.png" />
268
+    <Resource Include="Images\Login\login2_1.png" />
269
+    <Resource Include="Images\Login\logo%402x.png" />
270
+    <Resource Include="Images\Login\logo.png" />
271
+    <Resource Include="Images\Login\智慧校园%402x.png" />
272
+    <Resource Include="Images\Login\智慧校园.png" />
273
+    <Resource Include="Images\Login\组 1%281%29.png" />
274
+    <Resource Include="Images\Login\组 1%402x%281%29.png" />
275
+    <Resource Include="Images\Login\组 1%402x.png" />
276
+    <Resource Include="Images\Login\组 1.png" />
277
+    <Resource Include="Images\Login\设置%402x.png" />
278
+  </ItemGroup>
279
+  <ItemGroup>
280
+    <Resource Include="Images\RollCall\rollCall_2_1.png" />
281
+  </ItemGroup>
186 282
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
187 283
 </Project>

+ 306
- 0
XHZB.Desktop/ZBlackboardWindow.xaml View File

@@ -0,0 +1,306 @@
1
+<Window x:Class="XHZB.Desktop.ZBlackboardWindow"
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:XHZB.Desktop" xmlns:Views="clr-namespace:Common.system;assembly=Common"
7
+        mc:Ignorable="d"
8
+        Title="ZBlackboardWindow"   Width="1280"
9
+    Height="800"
10
+    AllowsTransparency="True"
11
+    Background="Transparent"
12
+    Closed="Window_Closed"
13
+    Opacity="1"
14
+    ShowInTaskbar="False"
15
+    WindowStyle="None">
16
+    <Window.Resources>
17
+        <DataTemplate x:Key="BMenuTemp">
18
+            <Button
19
+                x:Name="toolbar_item"
20
+                Width="60"
21
+                Height="60"
22
+                BorderThickness="0"
23
+                Click="menu_item_Click"
24
+                Cursor="Hand">
25
+                <Button.Content>
26
+                    <StackPanel Width="Auto" Background="Transparent">
27
+                        <Image
28
+                            Width="23"
29
+                            HorizontalAlignment="Center"
30
+                            Source="{Binding Pic}" />
31
+                        <TextBlock
32
+                            x:Name="menu_name"
33
+                            Margin="0,2,0,0"
34
+                            HorizontalAlignment="Center"
35
+                            Text="{Binding Name}">
36
+                            <TextBlock.Style>
37
+                                <Style TargetType="TextBlock">
38
+                                    <Setter Property="Foreground" Value="#3C525B" />
39
+                                    <Style.Triggers>
40
+                                        <DataTrigger Binding="{Binding Selected}" Value="true">
41
+                                            <Setter Property="Foreground" Value="#ffffff" />
42
+                                        </DataTrigger>
43
+                                    </Style.Triggers>
44
+                                </Style>
45
+                            </TextBlock.Style>
46
+                        </TextBlock>
47
+                    </StackPanel>
48
+                </Button.Content>
49
+                <Button.Style>
50
+                    <Style TargetType="Button">
51
+                        <Setter Property="Background" Value="Transparent" />
52
+                        <Setter Property="Template">
53
+                            <Setter.Value>
54
+                                <ControlTemplate TargetType="{x:Type Button}">
55
+                                    <Border
56
+                                        Background="{TemplateBinding Background}"
57
+                                        BorderBrush="Black"
58
+                                        BorderThickness="0">
59
+                                        <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
60
+                                    </Border>
61
+                                </ControlTemplate>
62
+                            </Setter.Value>
63
+                        </Setter>
64
+                        <Style.Triggers>
65
+                            <Trigger Property="IsMouseOver" Value="True">
66
+                                <Setter Property="Background" Value="#eee" />
67
+                            </Trigger>
68
+                            <DataTrigger Binding="{Binding Selected}" Value="true">
69
+                                <Setter Property="Background" Value="#136efb" />
70
+                            </DataTrigger>
71
+                        </Style.Triggers>
72
+                    </Style>
73
+                </Button.Style>
74
+            </Button>
75
+        </DataTemplate>
76
+
77
+        <Style TargetType="Button">
78
+            <Setter Property="BorderThickness" Value="0" />
79
+            <Setter Property="Background" Value="Transparent" />
80
+            <Setter Property="Template">
81
+                <Setter.Value>
82
+                    <ControlTemplate TargetType="{x:Type Button}">
83
+                        <Border
84
+                            Background="{TemplateBinding Background}"
85
+                            BorderBrush="Black"
86
+                            BorderThickness="0">
87
+                            <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
88
+                        </Border>
89
+                    </ControlTemplate>
90
+                </Setter.Value>
91
+            </Setter>
92
+            <Style.Triggers>
93
+                <Trigger Property="IsMouseOver" Value="True">
94
+                    <Setter Property="Background" Value="#ddd" />
95
+                </Trigger>
96
+            </Style.Triggers>
97
+        </Style>
98
+
99
+        <Style TargetType="TextBlock">
100
+            <Setter Property="Foreground" Value="#3C525B" />
101
+        </Style>
102
+    </Window.Resources>
103
+    <Grid Background="White" x:Name="gridMain">
104
+        <InkCanvas x:Name="blackboard_canvas" Background="#043a25" />
105
+
106
+        <Views:ZJClippingBorder
107
+            Width="60"
108
+            Height="58"
109
+            Margin="0,0,660,10"
110
+            HorizontalAlignment="Center"
111
+            VerticalAlignment="Bottom"
112
+            Background="#f3f3f3"
113
+            CornerRadius="4">
114
+            <StackPanel
115
+                Width="60"
116
+                HorizontalAlignment="Left"
117
+                Orientation="Horizontal">
118
+                <Button
119
+                    x:Name="save_button"
120
+                    Width="60"
121
+                    Click="save_button_Click"
122
+                    Cursor="Hand">
123
+                    <Button.Content>
124
+                        <StackPanel>
125
+                            <Image Width="23" Source=".\Images\Blackboard\class_1un.png" />
126
+                            <TextBlock Margin="0,4,0,0" Text="保存" />
127
+                        </StackPanel>
128
+                    </Button.Content>
129
+                </Button>
130
+            </StackPanel>
131
+        </Views:ZJClippingBorder>
132
+
133
+        <Views:ZJClippingBorder
134
+            Width="538"
135
+            Height="58"
136
+            Margin="0,0,0,10"
137
+            HorizontalAlignment="Center"
138
+            VerticalAlignment="Bottom"
139
+            Background="#f3f3f3"
140
+            CornerRadius="6">
141
+            <ItemsControl
142
+                x:Name="toolbar_list"
143
+                BorderThickness="0"
144
+                ItemTemplate="{StaticResource BMenuTemp}"
145
+                ItemsSource="{Binding menuList}">
146
+                <ItemsControl.ItemsPanel>
147
+                    <ItemsPanelTemplate>
148
+                        <StackPanel Orientation="Horizontal" />
149
+                    </ItemsPanelTemplate>
150
+                </ItemsControl.ItemsPanel>
151
+            </ItemsControl>
152
+        </Views:ZJClippingBorder>
153
+
154
+        <Views:ZJClippingBorder
155
+            x:Name="tip_Color"
156
+            Width="360"
157
+            Height="58"
158
+            Margin="0,0,0,80"
159
+            Visibility="Collapsed"
160
+            HorizontalAlignment="Center"
161
+            VerticalAlignment="Bottom"
162
+            Background="#FFFFFF"
163
+            CornerRadius="4">
164
+            <Border  Width="348"
165
+            Height="48" CornerRadius="6" Background="#E3E3E3" HorizontalAlignment="Center" Margin="6,6,6,6">
166
+                <Grid>
167
+                    <StackPanel Orientation="Horizontal">
168
+                        <Button Cursor="Hand" x:Name="btnWhite" Background="#FFFFFF" Width="38" Height="38" Margin="17,0,0,0" Click="BtnWhite_Click" />
169
+                        <Button Cursor="Hand" x:Name="btnRed" Background="#FF0000" Width="38" Height="38" Margin="17,0,0,0" Click="BtnRed_Click"/>
170
+                        <Button Cursor="Hand" x:Name="btnGray" Background="#A7A9AC" Width="38" Height="38" Margin="17,0,0,0" Click="BtnGray_Click"/>
171
+                        <Button Cursor="Hand" x:Name="btnCyanBlue" Background="#63D600" Width="38" Height="38" Margin="17,0,0,0" Click="BtnCyanBlue_Click"/>
172
+                        <Button Cursor="Hand" x:Name="btnYellow" Background="#FFBC00" Width="38" Height="38" Margin="17,0,0,0" Click="BtnYellow_Click"/>
173
+                        <Button Cursor="Hand" x:Name="btnBlue" Background="#00B4FC" Width="38" Height="38" Margin="17,0,0,0" Click="BtnBlue_Click"/>
174
+                    </StackPanel>
175
+                </Grid>
176
+            </Border>
177
+        </Views:ZJClippingBorder>
178
+
179
+        <Views:ZJClippingBorder
180
+            x:Name="tip_BlackboardColor"
181
+            Width="180"
182
+            Height="58"
183
+            Margin="0,0,0,80"
184
+            Visibility="Collapsed"
185
+            HorizontalAlignment="Center"
186
+            VerticalAlignment="Bottom"
187
+            Background="#FFFFFF"
188
+            CornerRadius="4">
189
+            <Border  Width="168"
190
+            Height="48" CornerRadius="6" Background="#E3E3E3" HorizontalAlignment="Center" Margin="6,6,6,6">
191
+                <Grid>
192
+                    <StackPanel Orientation="Horizontal">
193
+                        <Button Cursor="Hand" x:Name="btnBlack" Background="Black" Width="38" Height="38" Margin="10,0,0,0" Click="BtnBlack_Click"/>
194
+                        <Button Cursor="Hand" x:Name="btnWhites" Background="White" Width="38" Height="38" Margin="17,0,0,0" Click="BtnWhites_Click"/>
195
+                        <Button Cursor="Hand" x:Name="btnGreen" Background="#043a25" Width="38" Height="38" Margin="17,0,0,0" Click="BtnGreen_Click"/>
196
+                    </StackPanel>
197
+                </Grid>
198
+            </Border>
199
+        </Views:ZJClippingBorder>
200
+
201
+        <Views:ZJClippingBorder
202
+            x:Name="tip_Size"
203
+            Width="197"
204
+            Height="58"
205
+            Margin="0,0,0,80"
206
+            Visibility="Collapsed"
207
+            HorizontalAlignment="Center"
208
+            VerticalAlignment="Bottom"
209
+            Background="#FFFFFF"
210
+            CornerRadius="6">
211
+            <Border  Width="185"
212
+            Height="48" CornerRadius="6" Background="#E3E3E3" HorizontalAlignment="Center" Margin="6,6,6,6">
213
+                <Grid>
214
+                    <StackPanel Orientation="Horizontal">
215
+                        <Button Cursor="Hand" x:Name="btnFine" Background="#E3E3E3" Width="42" Height="42" Margin="10,0,0,0" Click="BtnFine_Click" >
216
+                            <Image Width="23" Source=".\Images\Blackboard\class_s4.png"/>
217
+                        </Button>
218
+                        <Button Cursor="Hand" x:Name="btnIn" Background="#E3E3E3" Width="42" Height="42" Margin="17,0,0,0" Click="BtnIn_Click" >
219
+                            <Image Width="33" Source=".\Images\Blackboard\class_s3.png"/>
220
+                        </Button>
221
+                        <Button Cursor="Hand" x:Name="btnCrude" Background="#E3E3E3" Width="42" Height="42" Margin="17,0,0,0" Click="BtnCrude_Click" >
222
+                            <Image Width="36" Source=".\Images\Blackboard\class_s2.png"/>
223
+                        </Button>
224
+                    </StackPanel>
225
+                </Grid>
226
+            </Border>
227
+        </Views:ZJClippingBorder>
228
+
229
+        <Views:ZJClippingBorder
230
+            Width="240"
231
+            Height="58"
232
+            Margin="830,0,0,10"
233
+            HorizontalAlignment="Center"
234
+            VerticalAlignment="Bottom"
235
+            Background="#f3f3f3"
236
+            CornerRadius="4">
237
+            <StackPanel Orientation="Horizontal">
238
+                <Button Cursor="Hand"
239
+                    x:Name="last_button"
240
+                    Width="60"
241
+                    Click="last_button_Click">
242
+                    <Button.Content>
243
+                        <StackPanel>
244
+                            <Image Width="16" Source=".\Images\Blackboard\class_p1.png" />
245
+                            <TextBlock Margin="0,8,0,0" Text="上一页" />
246
+                        </StackPanel>
247
+                    </Button.Content>
248
+                </Button>
249
+                <Grid Width="60">
250
+                    <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
251
+
252
+                        <StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
253
+                            <TextBlock Text="{Binding currpage}" TextAlignment="Center" FontSize="15"/>
254
+                            <TextBlock Text="/" TextAlignment="Center" FontSize="15"/>
255
+                            <TextBlock Text="{Binding pagenum}" TextAlignment="Center" FontSize="15"/>
256
+                        </StackPanel>
257
+
258
+                        <TextBlock
259
+                            Margin="0,8,0,0"
260
+                            HorizontalAlignment="Center"
261
+                            Text="页码" />
262
+                    </StackPanel>
263
+                </Grid>
264
+                <Button Cursor="Hand"
265
+                    x:Name="next_btn"
266
+                    Width="60"
267
+                    Click="next_btn_Click">
268
+                    <Button.Content>
269
+                        <StackPanel>
270
+                            <Image Width="16" Source=".\Images\Blackboard\class_p2.png" />
271
+                            <TextBlock Margin="0,8,0,0" Text="下一页" />
272
+                        </StackPanel>
273
+                    </Button.Content>
274
+                </Button>
275
+
276
+                <Button Cursor="Hand"
277
+                    x:Name="add_button"
278
+                    Width="60"
279
+                    Click="add_button_Click">
280
+                    <Button.Content>
281
+                        <StackPanel>
282
+                            <Image Width="16" Source=".\Images\Blackboard\class_p3.png" />
283
+                            <TextBlock Margin="0,4,0,0" Text="添加" />
284
+                        </StackPanel>
285
+                    </Button.Content>
286
+                </Button>
287
+            </StackPanel>
288
+        </Views:ZJClippingBorder>
289
+
290
+        <Views:ZJClippingBorder
291
+            x:Name="tip_outer"
292
+            Width="760"
293
+            Height="64"
294
+            HorizontalAlignment="Center"
295
+            Background="#66000000"
296
+            CornerRadius="4"
297
+            Visibility="Collapsed">
298
+            <TextBlock
299
+                x:Name="tip_tb"
300
+                HorizontalAlignment="Center"
301
+                VerticalAlignment="Center"
302
+                FontSize="26"
303
+                Foreground="#ffffff" />
304
+        </Views:ZJClippingBorder>
305
+    </Grid>
306
+</Window>

+ 528
- 0
XHZB.Desktop/ZBlackboardWindow.xaml.cs View File

@@ -0,0 +1,528 @@
1
+using Common.system;
2
+using System;
3
+using System.IO;
4
+using System.Threading;
5
+using System.Windows;
6
+using System.Windows.Controls;
7
+using System.Windows.Media;
8
+using System.Windows.Media.Imaging;
9
+using XHZB.Desktop.Utils;
10
+using XHZB.Model;
11
+
12
+namespace XHZB.Desktop
13
+{
14
+    /// <summary>
15
+    /// 黑板
16
+    /// </summary>
17
+    public partial class ZBlackboardWindow : Window
18
+    {
19
+        private readonly ZBPageModel pageData = new ZBPageModel();
20
+        private readonly BlackboardNew myblackboard;
21
+        private readonly int serverReturnCode = 0;
22
+        //private readonly RegisterController registerController = new RegisterController();
23
+        /// <summary>
24
+        /// 保存图片路径
25
+        /// </summary>
26
+        private string Rfpath = string.Empty;
27
+        private Color Color = Colors.White;
28
+        private int Size = 3;
29
+        /// <summary>
30
+        /// 黑板
31
+        /// </summary>
32
+        public ZBlackboardWindow()
33
+        {
34
+            InitializeComponent();
35
+
36
+            myblackboard = new BlackboardNew(blackboard_canvas);
37
+            initData();
38
+        }
39
+
40
+        private void initData()
41
+        {
42
+            pageData.pagenum = 1;
43
+            pageData.currpage = 1;
44
+            pageData.menuList.Add(new ZBMenuModel()
45
+            {
46
+                Name = "铅笔",
47
+                Pic = "../Images/Blackboard/class_2s.png",
48
+                Selected = true
49
+            });
50
+            pageData.menuList.Add(new ZBMenuModel()
51
+            {
52
+                Name = "颜色",
53
+                Pic = "../Images/Blackboard/class_c1.png",
54
+                Selected = false
55
+            });
56
+            pageData.menuList.Add(new ZBMenuModel()
57
+            {
58
+                Name = "粗细",
59
+                Pic = "../Images/Blackboard/class_s1.png",
60
+                Selected = false
61
+            });
62
+            pageData.menuList.Add(new ZBMenuModel()
63
+            {
64
+                Name = "橡皮",
65
+                Pic = "../Images/Blackboard/class_3un.png",
66
+                Selected = false
67
+            });
68
+            pageData.menuList.Add(new ZBMenuModel()
69
+            {
70
+                Name = "黑板颜色",
71
+                Pic = "../Images/Blackboard/class_s5.png",
72
+                Selected = false
73
+            });
74
+            pageData.menuList.Add(new ZBMenuModel()
75
+            {
76
+                Name = "清空",
77
+                Pic = "../Images/Blackboard/class_6un.png",
78
+                Selected = false
79
+            });
80
+            pageData.menuList.Add(new ZBMenuModel()
81
+            {
82
+                Name = "撤销",
83
+                Pic = "../Images/Blackboard/class_4un.png",
84
+                Selected = false
85
+            });
86
+            pageData.menuList.Add(new ZBMenuModel()
87
+            {
88
+                Name = "恢复",
89
+                Pic = "../Images/Blackboard/class_5un.png",
90
+                Selected = false
91
+            });
92
+
93
+            pageData.menuList.Add(new ZBMenuModel()
94
+            {
95
+                Name = "退出",
96
+                Pic = "../Images/Blackboard/class_7un.png",
97
+                Selected = false
98
+            });
99
+
100
+            DataContext = pageData;
101
+        }
102
+
103
+        private void menu_item_Click(object sender, RoutedEventArgs e)
104
+        {
105
+            int clickindex = 0;
106
+            System.Collections.Generic.List<Button> buttons = VTHelper.FindChilds<Button>(toolbar_list, "toolbar_item");
107
+            for (int i = 0; i < buttons.Count; i++)
108
+            {
109
+                if (buttons[i] == sender)
110
+                {
111
+                    clickindex = i;
112
+                    break;
113
+                }
114
+            }
115
+            if (clickindex < pageData.menuList.Count)
116
+            {
117
+                //ZBMenu menudata = pageData.menuList[clickindex];
118
+                if (clickindex == 0)
119
+                {
120
+                    tip_Color.Visibility = Visibility.Collapsed;
121
+                    tip_Size.Visibility = Visibility.Collapsed;
122
+                    tip_BlackboardColor.Visibility = Visibility.Collapsed;
123
+                    if (pageData.menuList[0].Selected)
124
+                    {
125
+                        //tip_Color.Visibility = Visibility.Visible;
126
+                    }
127
+                    else
128
+                    {
129
+                        pageData.menuList[0].Selected = true;
130
+                        pageData.menuList[3].Selected = false;
131
+                        pageData.menuList[0].Pic = "../Images/Blackboard/class_2s.png";
132
+                        pageData.menuList[3].Pic = "../Images/Blackboard/class_3un.png";
133
+                        myblackboard.change_pen(Color, Size);
134
+                    }
135
+
136
+                }
137
+                if (clickindex == 1)
138
+                {
139
+                    tip_Color.Visibility = Visibility.Visible;
140
+                    tip_Size.Visibility = Visibility.Collapsed;
141
+                    tip_BlackboardColor.Visibility = Visibility.Collapsed;
142
+                }
143
+                if (clickindex == 2)
144
+                {
145
+                    tip_Color.Visibility = Visibility.Collapsed;
146
+                    tip_Size.Visibility = Visibility.Visible;
147
+                    tip_BlackboardColor.Visibility = Visibility.Collapsed;
148
+                }
149
+                else if (clickindex == 3)
150
+                {
151
+                    tip_Color.Visibility = Visibility.Collapsed;
152
+                    tip_Size.Visibility = Visibility.Collapsed;
153
+                    tip_BlackboardColor.Visibility = Visibility.Collapsed;
154
+                    pageData.menuList[0].Selected = false;
155
+                    pageData.menuList[3].Selected = true;
156
+                    pageData.menuList[0].Pic = "../Images/Blackboard/class_2un.png";
157
+                    pageData.menuList[3].Pic = "../Images/Blackboard/class_3s.png";
158
+                    myblackboard.change_erase();
159
+                }
160
+                else if (clickindex == 4)
161
+                {
162
+                    tip_BlackboardColor.Visibility = Visibility.Visible;
163
+                    tip_Color.Visibility = Visibility.Collapsed;
164
+                    tip_Size.Visibility = Visibility.Collapsed;
165
+                }
166
+                else if (clickindex == 5)
167
+                {
168
+                    tip_Color.Visibility = Visibility.Collapsed;
169
+                    tip_Size.Visibility = Visibility.Collapsed;
170
+                    tip_BlackboardColor.Visibility = Visibility.Collapsed;
171
+                    myblackboard.clear();
172
+                }
173
+                else if (clickindex == 6)
174
+                {
175
+                    tip_Color.Visibility = Visibility.Collapsed;
176
+                    tip_Size.Visibility = Visibility.Collapsed;
177
+                    tip_BlackboardColor.Visibility = Visibility.Collapsed;
178
+                    myblackboard.undo();
179
+                }
180
+                else if (clickindex == 7)
181
+                {
182
+                    tip_Color.Visibility = Visibility.Collapsed;
183
+                    tip_Size.Visibility = Visibility.Collapsed;
184
+                    tip_BlackboardColor.Visibility = Visibility.Collapsed;
185
+                    myblackboard.redo();
186
+                }
187
+                else if (clickindex == 8)
188
+                {
189
+                    tip_Color.Visibility = Visibility.Collapsed;
190
+                    tip_Size.Visibility = Visibility.Collapsed;
191
+                    tip_BlackboardColor.Visibility = Visibility.Collapsed;
192
+                    Hide();
193
+
194
+                    //new Thread(new ThreadStart(new Action(() =>
195
+                    //{
196
+                    //    Dispatcher.Invoke(new Action(() =>
197
+                    //    {
198
+                    //        blackboard_canvas.Strokes.Clear();
199
+                    //    }));
200
+                    //    Thread.Sleep(500);
201
+                    //    Dispatcher.Invoke(new Action(() =>
202
+                    //    {
203
+                    //        Hide();
204
+                    //    }));
205
+                    //}))).Start();
206
+
207
+
208
+                }
209
+            }
210
+        }
211
+
212
+        private readonly string imagepaths = string.Empty;
213
+
214
+        private void save_button_Click(object sender, RoutedEventArgs e)
215
+        {
216
+            try
217
+            {
218
+                string imagepath = APP.classRoomImagePath();
219
+
220
+                if (!Directory.Exists(imagepath))
221
+                {
222
+                    Directory.CreateDirectory(imagepath);
223
+                }
224
+                TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
225
+                string timestr = Convert.ToInt64(ts.TotalMilliseconds).ToString();
226
+                string filepath = Path.Combine(imagepath, timestr + ".jpg");
227
+
228
+                //TeachingDataStatic.ClassScreenshot.Add(filepath);//课堂统计截图
229
+                Rfpath = string.Empty;
230
+                Rfpath = APP.dbImagePath() + timestr + ".jpg";
231
+                int width = (int)Math.Round(blackboard_canvas.ActualWidth);
232
+                int height = (int)Math.Round(blackboard_canvas.ActualHeight);
233
+                RenderTargetBitmap bmpCopied = new RenderTargetBitmap(
234
+                        width,
235
+                        height,
236
+                        96,
237
+                        96,
238
+                        PixelFormats.Default
239
+                    );
240
+                DrawingVisual dv = new DrawingVisual();
241
+                using (DrawingContext dc = dv.RenderOpen())
242
+                {
243
+                    VisualBrush vb = new VisualBrush(blackboard_canvas);
244
+                    dc.DrawRectangle(
245
+                        vb,
246
+                        null,
247
+                        new Rect(new System.Windows.Point(), new System.Windows.Size(width, height))
248
+                        );
249
+                }
250
+                bmpCopied.Render(dv);
251
+                using (FileStream file = new FileStream(filepath, FileMode.Create, FileAccess.Write))
252
+                {
253
+                    JpegBitmapEncoder encoder = new JpegBitmapEncoder
254
+                    {
255
+                        QualityLevel = 80
256
+                    };
257
+                    encoder.Frames.Add(BitmapFrame.Create(bmpCopied));
258
+                    encoder.Save(file);
259
+                }
260
+                tip_tb.Text = "保存成功";
261
+                tip_outer.Visibility = Visibility.Visible;
262
+                ZDelayUtil.delay(3, Dispatcher, new Action(() =>
263
+                {
264
+                    tip_outer.Visibility = Visibility.Hidden;
265
+                }));
266
+
267
+                APP.BackgroundWorkerHelper.RunWorkerAsync(InvokeServering, InvokeServerCompate);
268
+            }
269
+            catch (Exception err)
270
+            {
271
+                Console.WriteLine(err.Message);
272
+            }
273
+        }
274
+
275
+        private void add_button_Click(object sender, RoutedEventArgs e)
276
+        {
277
+            pageData.pagenum += 1;
278
+            pageData.currpage = pageData.pagenum;
279
+            myblackboard.changepage(pageData.currpage - 1);
280
+        }
281
+
282
+        private void last_button_Click(object sender, RoutedEventArgs e)
283
+        {
284
+            if (pageData.currpage > 1)
285
+            {
286
+                pageData.currpage -= 1;
287
+                myblackboard.changepage(pageData.currpage - 1);
288
+            }
289
+        }
290
+
291
+        private void next_btn_Click(object sender, RoutedEventArgs e)
292
+        {
293
+            if (pageData.currpage < pageData.pagenum)
294
+            {
295
+                pageData.currpage += 1;
296
+                myblackboard.changepage(pageData.currpage - 1);
297
+            }
298
+        }
299
+
300
+        /// <summary>
301
+        /// 课堂--保存图片服务-调用
302
+        /// </summary>
303
+        /// <returns></returns>
304
+        private object InvokeServering()
305
+        {
306
+            //Savefile savefile = new Savefile
307
+            //{
308
+            //    roomid = Shared.TeachingData.REQ_StartClass.roomid,
309
+            //    rfpath = Rfpath.Replace("\\", "/"),
310
+            //    rftype = 1,
311
+            //    createid = ZCommonData.loginUser.userid,
312
+            //    schoolid = ZCommonData.loginUser.schoolid,
313
+            //    createtime = DataProvider.TimestampTotalSeconds()
314
+            //};
315
+            //ZSqliteManger.insertClassData(new ClassData()
316
+            //{
317
+            //    unix = DataProvider.TimestampTotalSeconds(),
318
+            //    roomid = ZCommonData.roomid,
319
+            //    api = "savefile",
320
+            //    json = ZJsonHelper.ToJson(savefile),
321
+            //    askid = DataProvider.TimestampAddRandomNumber()
322
+            //});
323
+            return APP.ErrorMessage;
324
+        }
325
+
326
+        /// <summary>
327
+        /// 课堂--保存图片服务-返回结果
328
+        /// </summary>
329
+        /// <returns></returns>
330
+        public void InvokeServerCompate(object obj)
331
+        {
332
+            if (serverReturnCode == APP.ServerScuessCode)
333
+            {
334
+            }
335
+        }
336
+
337
+        /// <summary>
338
+        /// 黑板页面关闭
339
+        /// </summary>
340
+        /// <param name="sender"></param>
341
+        /// <param name="e"></param>
342
+        private void Window_Closed(object sender, EventArgs e)
343
+        {
344
+            click_closeClick();
345
+        }
346
+
347
+        #region 关闭委托
348
+
349
+        /// <summary>
350
+        /// 关闭委托 结束页面 创建人:赵耀 创建时间:2020年8月13日
351
+        /// </summary>
352
+        /// <param name="sender"></param>
353
+        /// <param name="e"></param>
354
+        public delegate void CloseClick();
355
+
356
+        /// <summary>
357
+        /// 关闭委托 结束页面 创建人:赵耀 创建时间:2020年8月13日
358
+        /// </summary>
359
+        public event CloseClick click_closeClick;
360
+
361
+        #endregion 关闭委托
362
+        /// <summary>
363
+        /// 画笔颜色事件 白色
364
+        /// </summary>
365
+        /// <param name="sender"></param>
366
+        /// <param name="e"></param>
367
+        private void BtnWhite_Click(object sender, RoutedEventArgs e)
368
+        {
369
+            pageData.menuList[0].Selected = true;
370
+            pageData.menuList[3].Selected = false;
371
+            pageData.menuList[0].Pic = "../Images/Blackboard/class_2s.png";
372
+            pageData.menuList[3].Pic = "../Images/Blackboard/class_3un.png";
373
+            Color = Colors.White;
374
+            myblackboard.change_pen(Color, Size);
375
+            tip_Color.Visibility = Visibility.Collapsed;
376
+        }
377
+        /// <summary>
378
+        /// 画笔颜色事件 红色
379
+        /// </summary>
380
+        /// <param name="sender"></param>
381
+        /// <param name="e"></param>
382
+        private void BtnRed_Click(object sender, RoutedEventArgs e)
383
+        {
384
+            pageData.menuList[0].Selected = true;
385
+            pageData.menuList[3].Selected = false;
386
+            pageData.menuList[0].Pic = "../Images/Blackboard/class_2s.png";
387
+            pageData.menuList[3].Pic = "../Images/Blackboard/class_3un.png";
388
+            Color = Colors.Red;
389
+            myblackboard.change_pen(Color, Size);
390
+            tip_Color.Visibility = Visibility.Collapsed;
391
+        }
392
+        /// <summary>
393
+        /// 画笔颜色事件 灰色
394
+        /// </summary>
395
+        /// <param name="sender"></param>
396
+        /// <param name="e"></param>
397
+        private void BtnGray_Click(object sender, RoutedEventArgs e)
398
+        {
399
+            pageData.menuList[0].Selected = true;
400
+            pageData.menuList[3].Selected = false;
401
+            pageData.menuList[0].Pic = "../Images/Blackboard/class_2s.png";
402
+            pageData.menuList[3].Pic = "../Images/Blackboard/class_3un.png";
403
+            Color = Colors.Gray;
404
+            myblackboard.change_pen(Color, Size);
405
+            tip_Color.Visibility = Visibility.Collapsed;
406
+        }
407
+        /// <summary>
408
+        /// 画笔颜色事件 青色
409
+        /// </summary>
410
+        /// <param name="sender"></param>
411
+        /// <param name="e"></param>
412
+        private void BtnCyanBlue_Click(object sender, RoutedEventArgs e)
413
+        {
414
+            pageData.menuList[0].Selected = true;
415
+            pageData.menuList[3].Selected = false;
416
+            pageData.menuList[0].Pic = "../Images/Blackboard/class_2s.png";
417
+            pageData.menuList[3].Pic = "../Images/Blackboard/class_3un.png";
418
+            Color = Colors.LimeGreen;
419
+            myblackboard.change_pen(Color, Size);
420
+            tip_Color.Visibility = Visibility.Collapsed;
421
+        }
422
+        /// <summary>
423
+        /// 画笔颜色事件 黄色
424
+        /// </summary>
425
+        /// <param name="sender"></param>
426
+        /// <param name="e"></param>
427
+        private void BtnYellow_Click(object sender, RoutedEventArgs e)
428
+        {
429
+            pageData.menuList[0].Selected = true;
430
+            pageData.menuList[3].Selected = false;
431
+            pageData.menuList[0].Pic = "../Images/Blackboard/class_2s.png";
432
+            pageData.menuList[3].Pic = "../Images/Blackboard/class_3un.png";
433
+            Color = Colors.Gold;
434
+            myblackboard.change_pen(Color, Size);
435
+            tip_Color.Visibility = Visibility.Collapsed;
436
+        }
437
+        /// <summary>
438
+        /// 画笔颜色事件 蓝色
439
+        /// </summary>
440
+        /// <param name="sender"></param>
441
+        /// <param name="e"></param>
442
+        private void BtnBlue_Click(object sender, RoutedEventArgs e)
443
+        {
444
+            pageData.menuList[0].Selected = true;
445
+            pageData.menuList[3].Selected = false;
446
+            pageData.menuList[0].Pic = "../Images/Blackboard/class_2s.png";
447
+            pageData.menuList[3].Pic = "../Images/Blackboard/class_3un.png";
448
+            Color = Colors.DeepSkyBlue;
449
+            myblackboard.change_pen(Color, Size);
450
+            tip_Color.Visibility = Visibility.Collapsed;
451
+        }
452
+        /// <summary>
453
+        /// 细
454
+        /// </summary>
455
+        /// <param name="sender"></param>
456
+        /// <param name="e"></param>
457
+        private void BtnFine_Click(object sender, RoutedEventArgs e)
458
+        {
459
+            pageData.menuList[0].Selected = true;
460
+            pageData.menuList[3].Selected = false;
461
+            pageData.menuList[0].Pic = "../Images/Blackboard/class_2s.png";
462
+            pageData.menuList[3].Pic = "../Images/Blackboard/class_3un.png";
463
+            Size = 3;
464
+            myblackboard.change_pen(Color, Size);
465
+            tip_Size.Visibility = Visibility.Collapsed;
466
+        }
467
+        /// <summary>
468
+        /// 中
469
+        /// </summary>
470
+        /// <param name="sender"></param>
471
+        /// <param name="e"></param>
472
+        private void BtnIn_Click(object sender, RoutedEventArgs e)
473
+        {
474
+            pageData.menuList[0].Selected = true;
475
+            pageData.menuList[3].Selected = false;
476
+            pageData.menuList[0].Pic = "../Images/Blackboard/class_2s.png";
477
+            pageData.menuList[3].Pic = "../Images/Blackboard/class_3un.png";
478
+            Size = 6;
479
+            myblackboard.change_pen(Color, Size);
480
+            tip_Size.Visibility = Visibility.Collapsed;
481
+        }
482
+        /// <summary>
483
+        /// 粗
484
+        /// </summary>
485
+        /// <param name="sender"></param>
486
+        /// <param name="e"></param>
487
+        private void BtnCrude_Click(object sender, RoutedEventArgs e)
488
+        {
489
+            pageData.menuList[0].Selected = true;
490
+            pageData.menuList[3].Selected = false;
491
+            pageData.menuList[0].Pic = "../Images/Blackboard/class_2s.png";
492
+            pageData.menuList[3].Pic = "../Images/Blackboard/class_3un.png";
493
+            Size = 12;
494
+            myblackboard.change_pen(Color, Size);
495
+            tip_Size.Visibility = Visibility.Collapsed;
496
+        }
497
+        /// <summary>
498
+        /// 黑板颜色 白色
499
+        /// </summary>
500
+        /// <param name="sender"></param>
501
+        /// <param name="e"></param>
502
+        private void BtnWhites_Click(object sender, RoutedEventArgs e)
503
+        {
504
+            blackboard_canvas.Background = new SolidColorBrush(Colors.White);
505
+            tip_BlackboardColor.Visibility = Visibility.Collapsed;
506
+        }
507
+        /// <summary>
508
+        /// 黑板颜色 黑色
509
+        /// </summary>
510
+        /// <param name="sender"></param>
511
+        /// <param name="e"></param>
512
+        private void BtnBlack_Click(object sender, RoutedEventArgs e)
513
+        {
514
+            blackboard_canvas.Background = new SolidColorBrush(Colors.Black);
515
+            tip_BlackboardColor.Visibility = Visibility.Collapsed;
516
+        }
517
+        /// <summary>
518
+        /// 黑板颜色 绿色
519
+        /// </summary>
520
+        /// <param name="sender"></param>
521
+        /// <param name="e"></param>
522
+        private void BtnGreen_Click(object sender, RoutedEventArgs e)
523
+        {
524
+            blackboard_canvas.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#043a25"));
525
+            tip_BlackboardColor.Visibility = Visibility.Collapsed;
526
+        }
527
+    }
528
+}

+ 1
- 0
XHZB.Desktop/packages.config View File

@@ -1,4 +1,5 @@
1 1
 <?xml version="1.0" encoding="utf-8"?>
2 2
 <packages>
3
+  <package id="Newtonsoft.Json" version="12.0.3" targetFramework="net452" />
3 4
   <package id="WpfAnimatedGif" version="2.0.0" targetFramework="net452" />
4 5
 </packages>

+ 35
- 0
XHZB.Model/ClassListModel.cs View File

@@ -0,0 +1,35 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Text;
5
+using System.Threading.Tasks;
6
+
7
+namespace XHZB.Model
8
+{
9
+    public class ClassListModel
10
+    {
11
+        /// <summary>
12
+        /// 班级id
13
+        /// </summary>
14
+        public int classid { get; set; }
15
+        /// <summary>
16
+        /// 班级
17
+        /// </summary>
18
+        public int? gradeid { get; set; }
19
+
20
+        /// <summary>
21
+        /// 班级名称
22
+        /// </summary>
23
+        public string classname { get; set; }
24
+
25
+        /// <summary>
26
+        ///
27
+        /// </summary>
28
+        public string groupid { get; set; }
29
+
30
+        /// <summary>
31
+        /// 班级学生总人数
32
+        /// </summary>
33
+        public int classnum { get; set; }
34
+    }
35
+}

+ 49
- 0
XHZB.Model/ClassStudentListModel.cs View File

@@ -0,0 +1,49 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Text;
5
+using System.Threading.Tasks;
6
+
7
+namespace XHZB.Model
8
+{
9
+    public class ClassStudentListModel
10
+    {
11
+        ///// <summary>
12
+        ///// 班级关联学生id
13
+        ///// </summary>
14
+        //public int csid { get; set; }
15
+
16
+        ///// <summary>
17
+        ///// 学号
18
+        ///// </summary>
19
+        //public string studentno { get; set; }
20
+
21
+        /// <summary>
22
+        /// 学生姓名
23
+        /// </summary>
24
+        public string studentname { get; set; }
25
+
26
+        ///// <summary>
27
+        ///// 性别1男2女
28
+        ///// </summary>
29
+        //public int ? usersex { get; set; }
30
+
31
+        ///// <summary>
32
+        ///// 班级id
33
+        ///// </summary>
34
+        //public int classid { get; set; }
35
+
36
+        /// <summary>
37
+        /// 学生id
38
+        /// </summary>
39
+        public int studentid { get; set; }
40
+        /// <summary>
41
+        /// 随机点名次数
42
+        /// </summary>
43
+        public int num { get; set; }
44
+        /// <summary>
45
+        /// 状态 0 未在线 1 在线  2 提交 3 未提交
46
+        /// </summary>
47
+        public int status { get; set; }
48
+    }
49
+}

+ 14
- 0
XHZB.Model/ComboBoxBeanModel.cs View File

@@ -0,0 +1,14 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Text;
5
+using System.Threading.Tasks;
6
+
7
+namespace XHZB.Model
8
+{
9
+    public class ComboBoxBeanModel
10
+    {
11
+        public int Key { get; set; }
12
+        public string Value { get; set; }
13
+    }
14
+}

+ 111
- 0
XHZB.Model/DirectorListModel.cs View File

@@ -0,0 +1,111 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Text;
5
+using System.Threading.Tasks;
6
+
7
+namespace XHZB.Model
8
+{
9
+    public class DirectorListModel
10
+    {
11
+        /// <summary>
12
+        /// id
13
+        /// </summary>
14
+        public int? id { get; set; }
15
+
16
+        /// <summary>
17
+        /// 创建人姓名
18
+        /// </summary>
19
+        public string createname { get; set; }
20
+
21
+        /// <summary>
22
+        /// id
23
+        /// </summary>
24
+        public int? page { get; set; }
25
+
26
+        /// <summary>
27
+        /// id
28
+        /// </summary>
29
+        public int? pageSize { get; set; }
30
+
31
+        /// <summary>
32
+        /// 章节id
33
+        /// </summary>
34
+        public int directorid { get; set; }
35
+
36
+        /// <summary>
37
+        /// 章节名称
38
+        /// </summary>
39
+        public string directorname { get; set; }
40
+
41
+        /// <summary>
42
+        /// 所属章节
43
+        /// </summary>
44
+        public int? directorpid { get; set; }
45
+
46
+        /// <summary>
47
+        /// 章节排序
48
+        /// </summary>
49
+        public int directororder { get; set; }
50
+
51
+        /// <summary>
52
+        /// 是否是叶子节点
53
+        /// </summary>
54
+        public int? leaf { get; set; }
55
+
56
+        /// <summary>
57
+        /// 教材id
58
+        /// </summary>
59
+        public int? lsbid { get; set; }
60
+
61
+        /// <summary>
62
+        /// 章节列表
63
+        /// </summary>
64
+        public int? directortype { get; set; }
65
+
66
+        /// <summary>
67
+        /// 创建人
68
+        /// </summary>
69
+        public int? createid { get; set; }
70
+
71
+        /// <summary>
72
+        /// 创建时间
73
+        /// </summary>
74
+        public int? createtime { get; set; }
75
+
76
+        /// <summary>
77
+        /// 学校id
78
+        /// </summary>
79
+        public int? schoolid { get; set; }
80
+
81
+        /// <summary>
82
+        /// 子章节
83
+        /// </summary>
84
+        public List<DirectorListModel> children { get; set; }
85
+
86
+        /// <summary>
87
+        /// 章节归属级别
88
+        /// </summary>
89
+        public int? asknum { get; set; }
90
+
91
+        /// <summary>
92
+        /// 章节归属级别
93
+        /// </summary>
94
+        public int? correctRate { get; set; }
95
+
96
+        /// <summary>
97
+        /// 章节归属级别
98
+        /// </summary>
99
+        public int? selected { get; set; }
100
+
101
+        /// <summary>
102
+        /// 章节归属级别
103
+        /// </summary>
104
+        public int directorlevel { get; set; }
105
+
106
+        public override string ToString()
107
+        {
108
+            return $"{nameof(id)}: {id}, {nameof(createname)}: {createname}, {nameof(page)}: {page}, {nameof(pageSize)}: {pageSize},{nameof(directorid)}: {directorid}, {nameof(directorname)}: {directorname}, {nameof(directorpid)}: {directorpid}, {nameof(directororder)}: {directororder}, {nameof(leaf)}: {leaf}, {nameof(lsbid)}: {lsbid}, {nameof(directortype)}: {directortype}, {nameof(directorlevel)}: {directorlevel}, {nameof(createid)}: {createid}, {nameof(createtime)}: {createtime}, {nameof(schoolid)}: {schoolid}, {nameof(children)}: {children}, {nameof(asknum)}: {asknum}, {nameof(correctRate)}: {correctRate}, {nameof(selected)}: {selected}";
109
+        }
110
+    }
111
+}

+ 89
- 0
XHZB.Model/LoginModel.cs View File

@@ -0,0 +1,89 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Text;
5
+using System.Threading.Tasks;
6
+
7
+namespace XHZB.Model
8
+{
9
+    public class LoginModel
10
+    {
11
+        public int userid { get; set; }
12
+
13
+        /// <summary>
14
+        /// 姓名
15
+        /// </summary>
16
+        public string username { get; set; }
17
+
18
+        /// <summary>
19
+        /// 登录名
20
+        /// </summary>
21
+        public string loginname { get; set; }
22
+
23
+        /// <summary>
24
+        /// 学号
25
+        /// </summary>
26
+        public string studentno { get; set; }
27
+
28
+        /// <summary>
29
+        /// 联系方式
30
+        /// </summary>
31
+        public string userphone { get; set; }
32
+
33
+        /// <summary>
34
+        /// 生日
35
+        /// </summary>
36
+        public string userbirthday { get; set; }
37
+
38
+        /// <summary>
39
+        /// 身份号
40
+        /// </summary>
41
+        public string cardid { get; set; }
42
+
43
+        /// <summary>
44
+        /// 头像地址
45
+        /// </summary>
46
+        public string headpic { get; set; }
47
+
48
+        /// <summary>
49
+        /// 用户类型999超级管理员0学校管理员1老师2学生
50
+        /// </summary>
51
+        public string usertype { get; set; }
52
+
53
+        /// <summary>
54
+        /// 状态
55
+        /// </summary>
56
+        public int userstate { get; set; }
57
+
58
+        public int createid { get; set; }
59
+        public string createname { get; set; }
60
+        public string createtime { get; set; }
61
+        public string deleteid { get; set; }
62
+        public string deletetime { get; set; }
63
+
64
+        /// <summary>
65
+        /// 当前年份
66
+        /// </summary>
67
+        public int year { get; set; }
68
+
69
+        /// <summary>
70
+        /// 学校id
71
+        /// </summary>
72
+        public int schoolid { get; set; }
73
+
74
+        /// <summary>
75
+        /// 学校名称
76
+        /// </summary>
77
+        public string schoolname { get; set; }
78
+
79
+        /// <summary>
80
+        /// 状态
81
+        /// </summary>
82
+        public int schoolstate { get; set; }
83
+
84
+        /// <summary>
85
+        /// 学校阶段1小学2初中3高中4大学
86
+        /// </summary>
87
+        public int schoollevel { get; set; }
88
+    }
89
+}

+ 23
- 0
XHZB.Model/OnlineUserModel.cs View File

@@ -0,0 +1,23 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Text;
5
+using System.Threading.Tasks;
6
+
7
+namespace XHZB.Model
8
+{
9
+    public class OnlineUserModel : IComparable<OnlineUserModel>
10
+    {
11
+        public int userid { set; get; }
12
+        public string username { set; get; }
13
+        public string userpic { set; get; }
14
+        public int usertype { set; get; }
15
+        public int status { get; set; }
16
+        public int num { get; set; }
17
+
18
+        public int CompareTo(OnlineUserModel other)
19
+        {
20
+            return string.Compare(username, other.username, true);
21
+        }
22
+    }
23
+}

+ 72
- 0
XHZB.Model/REQStartClassModel.cs View File

@@ -0,0 +1,72 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Text;
5
+using System.Threading.Tasks;
6
+
7
+namespace XHZB.Model
8
+{
9
+    public class REQStartClassModel
10
+    {
11
+        /// <summary>
12
+        /// 类型
13
+        /// </summary>
14
+        public string rtype { get; set; }
15
+        /// <summary>
16
+        /// 科目id
17
+        /// </summary>
18
+        public int subjectid { get; set; }
19
+
20
+        /// <summary>
21
+        /// 科目名称
22
+        /// </summary>
23
+        public string subjectname { get; set; }
24
+
25
+        /// <summary>
26
+        /// 班级id
27
+        /// </summary>
28
+        public int classid { get; set; }
29
+
30
+        /// <summary>
31
+        /// 班级总人数
32
+        /// </summary>
33
+        public int classnum { get; set; }
34
+
35
+        /// <summary>
36
+        /// 课堂名称
37
+        /// </summary>
38
+        public string roomname { get; set; }
39
+
40
+        /// <summary>
41
+        /// 教材id
42
+        /// </summary>
43
+        public int lsbid { get; set; }
44
+
45
+        /// <summary>
46
+        /// 教师id
47
+        /// </summary>
48
+        public int teacherid { get; set; }
49
+
50
+        /// <summary>
51
+        /// 章节id
52
+        /// </summary>
53
+        public int directorid { get; set; }
54
+
55
+        /// <summary>
56
+        /// 章节类型1系统2自定义
57
+        /// </summary>
58
+        public int directortype { get; set; }
59
+
60
+        /// <summary>
61
+        /// 学校id
62
+        /// </summary>
63
+        public int schoolid { get; set; }
64
+
65
+        public long roomid { get; set; }
66
+
67
+        /// <summary>
68
+        /// 时间戳秒
69
+        /// </summary>
70
+        public long createtime { get; set; }
71
+    }
72
+}

+ 17
- 0
XHZB.Model/RollCallModel.cs View File

@@ -0,0 +1,17 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Text;
5
+using System.Threading.Tasks;
6
+
7
+namespace XHZB.Model
8
+{
9
+    public class RollCallModel
10
+    {
11
+        public int userid { set; get; }
12
+        public string username { set; get; }
13
+        public string userpic { set; get; }
14
+        public int usertype { set; get; }
15
+        public int replies { get; set; }
16
+    }
17
+}

+ 36
- 0
XHZB.Model/SavefileModel.cs View File

@@ -0,0 +1,36 @@
1
+
2
+namespace XHZB.Model
3
+{
4
+    public class Savefile
5
+    {
6
+        /// <summary>
7
+        /// 课堂id
8
+        /// </summary>
9
+        public long roomid { get; set; }
10
+
11
+        /// <summary>
12
+        /// 图片保存路径
13
+        /// </summary>
14
+        public string rfpath { get; set; }
15
+
16
+        /// <summary>
17
+        /// 图片类型1黑板2讲评
18
+        /// </summary>
19
+        public int rftype { get; set; }
20
+
21
+        /// <summary>
22
+        /// 创建人
23
+        /// </summary>
24
+        public int createid { get; set; }
25
+
26
+        /// <summary>
27
+        /// 学校id
28
+        /// </summary>
29
+        public int schoolid { get; set; }
30
+
31
+        /// <summary>
32
+        /// 创建时间
33
+        /// </summary>
34
+        public long createtime { get; set; }
35
+    }
36
+}

+ 46
- 0
XHZB.Model/TsubjectbookListModel.cs View File

@@ -0,0 +1,46 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Text;
5
+using System.Threading.Tasks;
6
+
7
+namespace XHZB.Model
8
+{
9
+    public class TsubjectbookListModel
10
+    {
11
+        /// <summary>
12
+        /// 教师教材关系id
13
+        /// </summary>
14
+        public string tbid { get; set; }
15
+
16
+        /// <summary>
17
+        /// 教材关联关系表id
18
+        /// </summary>
19
+        public int lsbid { get; set; }
20
+
21
+        /// <summary>
22
+        /// 是否选中:0未选中1已选中
23
+        /// </summary>
24
+        public string selected { get; set; }
25
+
26
+        /// <summary>
27
+        /// 科目id
28
+        /// </summary>
29
+        public int subjectid { get; set; }
30
+
31
+        /// <summary>
32
+        /// 科目名称
33
+        /// </summary>
34
+        public string subjectname { get; set; }
35
+
36
+        /// <summary>
37
+        /// 册别名称
38
+        /// </summary>
39
+        public string bookname { get; set; }
40
+
41
+        /// <summary>
42
+        /// 封面图地址
43
+        /// </summary>
44
+        public string coverpath { get; set; }
45
+    }
46
+}

+ 14
- 0
XHZB.Model/XHZB.Model.csproj View File

@@ -42,8 +42,22 @@
42 42
   </ItemGroup>
43 43
   <ItemGroup>
44 44
     <Compile Include="Class1.cs" />
45
+    <Compile Include="ClassListModel.cs" />
46
+    <Compile Include="ClassStudentListModel.cs" />
47
+    <Compile Include="ComboBoxBeanModel.cs" />
48
+    <Compile Include="DirectorListModel.cs" />
49
+    <Compile Include="LoginModel.cs" />
45 50
     <Compile Include="NotifyModel.cs" />
51
+    <Compile Include="OnlineUserModel.cs" />
46 52
     <Compile Include="Properties\AssemblyInfo.cs" />
53
+    <Compile Include="REQStartClassModel.cs" />
54
+    <Compile Include="RollCallModel.cs" />
55
+    <Compile Include="SavefileModel.cs" />
56
+    <Compile Include="TsubjectbookListModel.cs" />
57
+    <Compile Include="ZBMenuModel.cs" />
58
+    <Compile Include="ZBPageModel.cs" />
59
+    <Compile Include="ZWsBodyVo.cs" />
60
+    <Compile Include="ZWsMsgVo.cs" />
47 61
   </ItemGroup>
48 62
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
49 63
 </Project>

+ 29
- 0
XHZB.Model/ZBMenuModel.cs View File

@@ -0,0 +1,29 @@
1
+namespace XHZB.Model
2
+{
3
+    public class ZBMenuModel : NotifyModel
4
+    {
5
+        private string _name;
6
+
7
+        public string Name
8
+        {
9
+            get => _name;
10
+            set { _name = value; OnPropertyChanged("Name"); }
11
+        }
12
+
13
+        private string _Pic;
14
+
15
+        public string Pic
16
+        {
17
+            get => _Pic;
18
+            set { _Pic = value; OnPropertyChanged("Pic"); }
19
+        }
20
+
21
+        private bool _Selected;
22
+
23
+        public bool Selected
24
+        {
25
+            get => _Selected;
26
+            set { _Selected = value; OnPropertyChanged("Selected"); }
27
+        }
28
+    }
29
+}

+ 37
- 0
XHZB.Model/ZBPageModel.cs View File

@@ -0,0 +1,37 @@
1
+using System.Collections.ObjectModel;
2
+
3
+namespace XHZB.Model
4
+{
5
+    public class ZBPageModel : NotifyModel
6
+    {
7
+        public ObservableCollection<ZBMenuModel> menuList { get; set; }
8
+        /// <summary>
9
+        /// 总页码
10
+        /// </summary>
11
+        private int _pagenum = 1;
12
+        /// <summary>
13
+        /// 总页码
14
+        /// </summary>
15
+        public int pagenum
16
+        {
17
+            get => _pagenum;
18
+            set { _pagenum = value; OnPropertyChanged("pagenum"); }
19
+        }
20
+        /// <summary>
21
+        /// 当前页 从1开始
22
+        /// </summary>
23
+        private int _currpage = 1;// 从1开始
24
+        /// <summary>
25
+        /// 当前页 从1开始
26
+        /// </summary>
27
+        public int currpage
28
+        {
29
+            get => _currpage;
30
+            set { _currpage = value; OnPropertyChanged("currpage"); }
31
+        }
32
+        public ZBPageModel()
33
+        {
34
+            menuList = new ObservableCollection<ZBMenuModel>();
35
+        }
36
+    }
37
+}

+ 32
- 0
XHZB.Model/ZWsBodyVo.cs View File

@@ -0,0 +1,32 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Text;
5
+using System.Threading.Tasks;
6
+
7
+namespace XHZB.Model
8
+{
9
+    public class ZWsBodyVo
10
+    {
11
+        public long asktid { set; get; }//互动id
12
+        public int asktype { set; get; }//30单选题31多选题32简答题
13
+        public int radionum { set; get; }//单选题选项数量
14
+        public string radioanswer { set; get; }//单选题正确答案
15
+        public string teacherpic { set; get; }//试题题干图片
16
+        public string studentans { set; get; }//单选题/简答题答案
17
+        public int paperid { set; get; }//试卷ID
18
+        public int userid { set; get; }//
19
+        public string username { set; get; }//名字
20
+        public string userpic { set; get; }//头像地址
21
+        public int pmstate { set; get; }//屏幕状态1息屏2截屏
22
+        public List<int> onlineuser { set; get; }//在线用户
23
+        //public Classroom.TClassroomPaper paper { set; get; }
24
+        //public TClassroomPaperStudent paperStudent { get; set; }
25
+
26
+        public string pic { set; get; }//同屏图片地址
27
+
28
+        public int classid { set; get; }//课堂ID
29
+
30
+        public string macaddress { get; set; }//Mac地址 
31
+    }
32
+}

+ 30
- 0
XHZB.Model/ZWsMsgVo.cs View File

@@ -0,0 +1,30 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Text;
5
+using System.Threading.Tasks;
6
+
7
+namespace XHZB.Model
8
+{
9
+    public class ZWsMsgVo
10
+    {
11
+        public int type { set; get; }
12
+        public long rid { set; get; }//互动课堂id
13
+        public int from { set; get; }//用户ssouserid
14
+
15
+        public List<int> to { set; get; }//对象
16
+
17
+        public int usertype
18
+        { set; get; }//用户ssouserid
19
+
20
+        public ZWsBodyVo body { set; get; }//内容
21
+
22
+        public string device { set; get; }// pad平板 web网页
23
+        public string msg { set; get; }// 错误信息
24
+
25
+        public ZWsMsgVo()
26
+        {
27
+            body = new ZWsBodyVo();
28
+        }
29
+    }
30
+}

Loading…
Cancel
Save