Browse Source

zhao:修改倒计时

tags/录制修改前
耀 4 years ago
parent
commit
14af630d78

+ 138
- 19
XHWK.WKTool/CountdownWindow.xaml.cs View File

@@ -1,4 +1,6 @@
1
-using System;
1
+using Common.system;
2
+
3
+using System;
2 4
 using System.Threading;
3 5
 using System.Windows;
4 6
 using System.Windows.Controls;
@@ -12,24 +14,56 @@ namespace XHWK.WKTool
12 14
     /// </summary>
13 15
     public partial class CountdownWindow : Window
14 16
     {
15
-        public CountdownWindow(int changeTime = 650)
17
+        public CountdownWindow()
16 18
         {
17 19
             InitializeComponent();
18
-            timer = new System.Timers.Timer(changeTime);//设置执行一次(false)还是一直执行(true)
19
-            timer.AutoReset = true;//设置是否执行System.Timers.Timer.Elapsed事件
20
-            timer.Elapsed +=new System.Timers.ElapsedEventHandler(Timer_Elapsed);
21
-            Initialize();
22 20
         }
23 21
         /// <summary>
24 22
         /// 计时器
25 23
         /// </summary>
26 24
         System.Timers.Timer timer;
27
-        int ImgNum = 9;
28
-        public void Initialize(int changeTime=650)
25
+        int ImgNum = 21;
26
+        public void Initialize(int changeTime=2100)
29 27
         {
30
-            timer.Interval = changeTime/3;
31
-            timer.Enabled = true; //启动计时器
32
-            ImgNum = 9;
28
+            ImgNum = 21;
29
+            bool IsStart = true;
30
+            new Thread(new ThreadStart(new Action(() =>
31
+            {
32
+                while (IsStart)
33
+                {
34
+                    try
35
+                    {
36
+                        if (ImgNum >= 1)
37
+                        {
38
+                            loadingImg(ImgNum);
39
+                            LogHelper.WriteInfoLog("【" + ImgNum + "】");
40
+                            ImgNum--;
41
+                            Thread.Sleep(changeTime / 21);
42
+                        }
43
+                        else
44
+                        {
45
+                            IsStart = false;
46
+                            Dispatcher.Invoke(
47
+                                      DispatcherPriority.Send,
48
+                                      new Action(() =>
49
+                                      {
50
+                          imgLoding.Source = new BitmapImage(new Uri("pack://application:,,/Images/countdown3_1.png"));
51
+                          Hide();
52
+                      }));
53
+                        }
54
+                    }
55
+                    catch (Exception ex)
56
+                    {
57
+                        LogHelper.WriteErrLog("【录屏等待】(Initialize)" + ex.Message, ex);
58
+                    }
59
+                }
60
+            }))).Start();
61
+            //timer = new System.Timers.Timer(changeTime/21);//设置执行一次(false)还是一直执行(true)
62
+            //timer.AutoReset = true;//设置是否执行System.Timers.Timer.Elapsed事件
63
+            //timer.Elapsed +=new System.Timers.ElapsedEventHandler(Timer_Elapsed);
64
+            ////timer.Interval = changeTime/21;
65
+            //timer.Enabled = true; //启动计时器
66
+            //ImgNum = 21;
33 67
         }
34 68
 
35 69
         private void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
@@ -38,6 +72,7 @@ namespace XHWK.WKTool
38 72
             {
39 73
                 loadingImg(ImgNum);
40 74
                 ImgNum--;
75
+                LogHelper.WriteInfoLog("【"+ImgNum+"】");
41 76
             }
42 77
             else
43 78
             {
@@ -46,7 +81,7 @@ namespace XHWK.WKTool
46 81
                   DispatcherPriority.Send,
47 82
                   new Action(() =>
48 83
                   {
49
-                      imgLoding.Source = new BitmapImage(new Uri("pack://application:,,/Images/countdown3_3.png"));
84
+                      imgLoding.Source = new BitmapImage(new Uri("pack://application:,,/Images/countdown3_1.png"));
50 85
                       Hide();
51 86
                   }));
52 87
             }
@@ -63,14 +98,14 @@ namespace XHWK.WKTool
63 98
                     Dispatcher.Invoke(
64 99
                       DispatcherPriority.Send,
65 100
                       new Action(() => { 
66
-                          imgLoding.Source = new BitmapImage(new Uri("pack://application:,,/Images/countdown1_1.png"));
101
+                          imgLoding.Source = new BitmapImage(new Uri("pack://application:,,/Images/countdown1_5.png"));
67 102
                       }));
68 103
                     break;
69 104
                 case 2:
70 105
                     Dispatcher.Invoke(
71 106
                       DispatcherPriority.Send,
72 107
                       new Action(() => {
73
-                          imgLoding.Source = new BitmapImage(new Uri("pack://application:,,/Images/countdown1_2.png"));
108
+                          imgLoding.Source = new BitmapImage(new Uri("pack://application:,,/Images/countdown1_4.png"));
74 109
                       }));
75 110
                     break;
76 111
                 case 3:
@@ -84,44 +119,128 @@ namespace XHWK.WKTool
84 119
                     Dispatcher.Invoke(
85 120
                       DispatcherPriority.Send,
86 121
                       new Action(() => {
87
-                          imgLoding.Source = new BitmapImage(new Uri("pack://application:,,/Images/countdown2_1.png"));
122
+                          imgLoding.Source = new BitmapImage(new Uri("pack://application:,,/Images/countdown1_2.png"));
88 123
                       }));
89 124
                     break;
90 125
                 case 5:
91 126
                     Dispatcher.Invoke(
92 127
                       DispatcherPriority.Send,
93 128
                       new Action(() => {
94
-                          imgLoding.Source = new BitmapImage(new Uri("pack://application:,,/Images/countdown2_2.png"));
129
+                          imgLoding.Source = new BitmapImage(new Uri("pack://application:,,/Images/countdown1_1.png"));
95 130
                       }));
96 131
                     break;
97 132
                 case 6:
98 133
                     Dispatcher.Invoke(
99 134
                       DispatcherPriority.Send,
100 135
                       new Action(() => {
101
-                          imgLoding.Source = new BitmapImage(new Uri("pack://application:,,/Images/countdown2_3.png"));
136
+                          imgLoding.Source = new BitmapImage(new Uri("pack://application:,,/Images/countdown2_7.png"));
102 137
                       }));
103 138
                     break;
104 139
                 case 7:
105 140
                     Dispatcher.Invoke(
106 141
                       DispatcherPriority.Send,
107 142
                       new Action(() => {
108
-                          imgLoding.Source = new BitmapImage(new Uri("pack://application:,,/Images/countdown3_1.png"));
143
+                          imgLoding.Source = new BitmapImage(new Uri("pack://application:,,/Images/countdown2_6.png"));
109 144
                       }));
110 145
                     break;
111 146
                 case 8:
112 147
                     Dispatcher.Invoke(
113 148
                       DispatcherPriority.Send,
114 149
                       new Action(() => {
115
-                          imgLoding.Source = new BitmapImage(new Uri("pack://application:,,/Images/countdown3_2.png"));
150
+                          imgLoding.Source = new BitmapImage(new Uri("pack://application:,,/Images/countdown2_5.png"));
116 151
                       }));
117 152
                     break;
118 153
                 case 9:
154
+                    Dispatcher.Invoke(
155
+                      DispatcherPriority.Send,
156
+                      new Action(() => {
157
+                          imgLoding.Source = new BitmapImage(new Uri("pack://application:,,/Images/countdown2_4.png"));
158
+                      }));
159
+                    break;
160
+                case 10:
161
+                    Dispatcher.Invoke(
162
+                      DispatcherPriority.Send,
163
+                      new Action(() => {
164
+                          imgLoding.Source = new BitmapImage(new Uri("pack://application:,,/Images/countdown2_3.png"));
165
+                      }));
166
+                    break;
167
+                case 11:
168
+                    Dispatcher.Invoke(
169
+                      DispatcherPriority.Send,
170
+                      new Action(() => {
171
+                          imgLoding.Source = new BitmapImage(new Uri("pack://application:,,/Images/countdown2_2.png"));
172
+                      }));
173
+                    break;
174
+                case 12:
175
+                    Dispatcher.Invoke(
176
+                      DispatcherPriority.Send,
177
+                      new Action(() => {
178
+                          imgLoding.Source = new BitmapImage(new Uri("pack://application:,,/Images/countdown2_1.png"));
179
+                      }));
180
+                    break;
181
+                case 13:
182
+                    Dispatcher.Invoke(
183
+                      DispatcherPriority.Send,
184
+                      new Action(() => {
185
+                          imgLoding.Source = new BitmapImage(new Uri("pack://application:,,/Images/countdown3_9.png"));
186
+                      }));
187
+                    break;
188
+                case 14:
189
+                    Dispatcher.Invoke(
190
+                      DispatcherPriority.Send,
191
+                      new Action(() => {
192
+                          imgLoding.Source = new BitmapImage(new Uri("pack://application:,,/Images/countdown3_8.png"));
193
+                      }));
194
+                    break;
195
+                case 15:
196
+                    Dispatcher.Invoke(
197
+                      DispatcherPriority.Send,
198
+                      new Action(() => {
199
+                          imgLoding.Source = new BitmapImage(new Uri("pack://application:,,/Images/countdown3_7.png"));
200
+                      }));
201
+                    break;
202
+                case 16:
203
+                    Dispatcher.Invoke(
204
+                      DispatcherPriority.Send,
205
+                      new Action(() => {
206
+                          imgLoding.Source = new BitmapImage(new Uri("pack://application:,,/Images/countdown3_6.png"));
207
+                      }));
208
+                    break;
209
+                case 17:
210
+                    Dispatcher.Invoke(
211
+                      DispatcherPriority.Send,
212
+                      new Action(() => {
213
+                          imgLoding.Source = new BitmapImage(new Uri("pack://application:,,/Images/countdown3_5.png"));
214
+                      }));
215
+                    break;
216
+                case 18:
217
+                    Dispatcher.Invoke(
218
+                      DispatcherPriority.Send,
219
+                      new Action(() => {
220
+                          imgLoding.Source = new BitmapImage(new Uri("pack://application:,,/Images/countdown3_4.png"));
221
+                      }));
222
+                    break;
223
+                case 19:
119 224
                     Dispatcher.Invoke(
120 225
                       DispatcherPriority.Send,
121 226
                       new Action(() => {
122 227
                           imgLoding.Source = new BitmapImage(new Uri("pack://application:,,/Images/countdown3_3.png"));
123 228
                       }));
124 229
                     break;
230
+                case 20:
231
+                    Dispatcher.Invoke(
232
+                      DispatcherPriority.Send,
233
+                      new Action(() => {
234
+                          imgLoding.Source = new BitmapImage(new Uri("pack://application:,,/Images/countdown3_2.png"));
235
+                      }));
236
+                    break;
237
+                case 21:
238
+                    Dispatcher.Invoke(
239
+                      DispatcherPriority.Send,
240
+                      new Action(() => {
241
+                          imgLoding.Source = new BitmapImage(new Uri("pack://application:,,/Images/countdown3_1.png"));
242
+                      }));
243
+                    break;
125 244
                 default:
126 245
                     break;
127 246
             }

BIN
XHWK.WKTool/Images/countdown1_1.png View File


BIN
XHWK.WKTool/Images/countdown1_2.png View File


BIN
XHWK.WKTool/Images/countdown1_3.png View File


BIN
XHWK.WKTool/Images/countdown1_4.png View File


BIN
XHWK.WKTool/Images/countdown1_5.png View File


BIN
XHWK.WKTool/Images/countdown2_1.png View File


BIN
XHWK.WKTool/Images/countdown2_2.png View File


BIN
XHWK.WKTool/Images/countdown2_3.png View File


BIN
XHWK.WKTool/Images/countdown2_4.png View File


BIN
XHWK.WKTool/Images/countdown2_5.png View File


BIN
XHWK.WKTool/Images/countdown2_6.png View File


BIN
XHWK.WKTool/Images/countdown2_7.png View File


BIN
XHWK.WKTool/Images/countdown3_1.png View File


BIN
XHWK.WKTool/Images/countdown3_2.png View File


BIN
XHWK.WKTool/Images/countdown3_3.png View File


BIN
XHWK.WKTool/Images/countdown3_4.png View File


BIN
XHWK.WKTool/Images/countdown3_5.png View File


BIN
XHWK.WKTool/Images/countdown3_6.png View File


BIN
XHWK.WKTool/Images/countdown3_7.png View File


BIN
XHWK.WKTool/Images/countdown3_8.png View File


BIN
XHWK.WKTool/Images/countdown3_9.png View File


+ 1
- 0
XHWK.WKTool/XHMicroLessonSystemWindow.xaml.cs View File

@@ -1273,6 +1273,7 @@ namespace XHWK.WKTool
1273 1273
                     if (APP.W_CountdownWindow == null)
1274 1274
                     {
1275 1275
                         APP.W_CountdownWindow = new CountdownWindow();
1276
+                        APP.W_CountdownWindow.Initialize();
1276 1277
                         //APP.W_CountdownWindow.Topmost = true;
1277 1278
                     }
1278 1279
                     else

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

@@ -1525,5 +1525,19 @@
1525 1525
   <ItemGroup>
1526 1526
     <Resource Include="Images\img_load.gif" />
1527 1527
   </ItemGroup>
1528
+  <ItemGroup>
1529
+    <Resource Include="Images\countdown1_4.png" />
1530
+    <Resource Include="Images\countdown1_5.png" />
1531
+    <Resource Include="Images\countdown2_4.png" />
1532
+    <Resource Include="Images\countdown2_5.png" />
1533
+    <Resource Include="Images\countdown2_6.png" />
1534
+    <Resource Include="Images\countdown2_7.png" />
1535
+    <Resource Include="Images\countdown3_4.png" />
1536
+    <Resource Include="Images\countdown3_5.png" />
1537
+    <Resource Include="Images\countdown3_6.png" />
1538
+    <Resource Include="Images\countdown3_7.png" />
1539
+    <Resource Include="Images\countdown3_8.png" />
1540
+    <Resource Include="Images\countdown3_9.png" />
1541
+  </ItemGroup>
1528 1542
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
1529 1543
 </Project>

Loading…
Cancel
Save