12
12
using static SodaCL . Core . Auth . MSAuth ;
13
13
using static SodaCL . Launcher . LauncherLogging ;
14
14
using static SodaCL . Toolkits . GetResources ;
15
+ using static SodaCL . Toolkits . Dialog ;
15
16
16
17
namespace SodaCL . Pages
17
18
{
@@ -112,6 +113,7 @@ private async void GetYiyanAsync()
112
113
}
113
114
catch ( HttpRequestException ex )
114
115
{
116
+ YiYanTxb . Text = "一言获取失败" ;
115
117
Log ( ModuleList . Network , LogInfo . Error , ex . Message , ex . StackTrace ) ;
116
118
}
117
119
}
@@ -186,8 +188,8 @@ private async void MSOAuth_OpenWindows(object sender, (MSAuth.WindowsTypes, stri
186
188
await Dispatcher . InvokeAsync ( ( ) =>
187
189
{
188
190
OpenDialog ( ) ;
189
- DialogStackPan . Children . Add ( new TextBlock ( ) { Text = "正在初始化微软登录服务" , FontSize = 18 , TextAlignment = TextAlignment . Center } ) ;
190
- DialogStackPan . Children . Add ( new ProgressBar ( ) { IsIndeterminate = true , Height = 10 , Width = 300 , Margin = new Thickness ( 0 , 30 , 0 , 0 ) } ) ;
191
+ MainWindow . mainWindow . DialogStackPan . Children . Add ( new TextBlock ( ) { Text = "正在初始化微软登录服务" , FontSize = 18 , TextAlignment = TextAlignment . Center } ) ;
192
+ MainWindow . mainWindow . DialogStackPan . Children . Add ( new ProgressBar ( ) { IsIndeterminate = true , Height = 10 , Width = 300 , Margin = new Thickness ( 0 , 30 , 0 , 0 ) } ) ;
191
193
} ) ;
192
194
break ;
193
195
}
@@ -256,131 +258,28 @@ await Dispatcher.InvokeAsync(() =>
256
258
Text = GetI18NText ( "Login_Microsoft_MessageBox_OpenInBrowser_Title" )
257
259
} ) ;
258
260
StackPan . Children . Add ( exitButton ) ;
259
- DialogStackPan . Children . Add ( StackPan ) ;
260
- DialogStackPan . Children . Add ( new TextBlock
261
+ MainWindow . mainWindow . DialogStackPan . Children . Add ( StackPan ) ;
262
+ MainWindow . mainWindow . DialogStackPan . Children . Add ( new TextBlock
261
263
{
262
264
Margin = new Thickness ( 52 , 10 , 20 , 0 ) ,
263
265
Text = GetI18NText ( "Login_Microsoft_MessageBox_OpenInBrowser_Text_Tip" )
264
266
} ) ;
265
- DialogStackPan . Children . Add ( new TextBlock
267
+ MainWindow . mainWindow . DialogStackPan . Children . Add ( new TextBlock
266
268
{
267
269
Margin = new Thickness ( 50 , 10 , 20 , 0 ) ,
268
270
Style = GetStyle ( "Text_Bold" ) ,
269
271
Text = GetI18NText ( "Login_Microsoft_MessageBox_OpenInBrowser_Text_YourLoginCode" )
270
272
} ) ;
271
- DialogStackPan . Children . Add ( new TextBlock
273
+ MainWindow . mainWindow . DialogStackPan . Children . Add ( new TextBlock
272
274
{
273
275
Margin = new Thickness ( 50 , 5 , 20 , 0 ) ,
274
276
Text = deviceCode ,
275
277
FontSize = 24 ,
276
278
} ) ;
277
- DialogStackPan . Children . Add ( okButton ) ;
279
+ MainWindow . mainWindow . DialogStackPan . Children . Add ( okButton ) ;
278
280
} ) ;
279
281
}
280
282
281
- private void OpenDialog ( )
282
- {
283
- FrontGrid . Visibility = Visibility . Visible ;
284
- var easingFunc = new CubicEase
285
- {
286
- EasingMode = EasingMode . EaseInOut
287
- } ;
288
- var diaSbBig = new Storyboard ( ) ;
289
- var rectBigOpacAni = new DoubleAnimation ( 0.6 , TimeSpan . FromSeconds ( 1 ) ) ;
290
- Storyboard . SetTarget ( rectBigOpacAni , DialogRect ) ;
291
- Storyboard . SetTargetProperty ( rectBigOpacAni , new PropertyPath ( "Opacity" ) ) ;
292
- var borderBigWidthAni = new DoubleAnimation ( 400 , TimeSpan . FromSeconds ( 1 ) ) ;
293
- borderBigWidthAni . EasingFunction = easingFunc ;
294
- Storyboard . SetTarget ( borderBigWidthAni , DialogBorder ) ;
295
- Storyboard . SetTargetProperty ( borderBigWidthAni , new PropertyPath ( "Width" ) ) ;
296
- var borderBigHeightAni = new DoubleAnimation ( 250 , TimeSpan . FromSeconds ( 1 ) ) ;
297
- borderBigHeightAni . EasingFunction = easingFunc ;
298
- Storyboard . SetTarget ( borderBigHeightAni , DialogBorder ) ;
299
- Storyboard . SetTargetProperty ( borderBigHeightAni , new PropertyPath ( "Height" ) ) ;
300
- diaSbBig . Children . Add ( rectBigOpacAni ) ;
301
- diaSbBig . Children . Add ( borderBigWidthAni ) ;
302
- diaSbBig . Children . Add ( borderBigHeightAni ) ;
303
- diaSbBig . Begin ( ) ;
304
- }
305
-
306
- private void ChangeDialog ( )
307
- {
308
- DialogStackPan . Children . Clear ( ) ;
309
- FrontBorder . Visibility = Visibility . Visible ;
310
- DialogBorder . Visibility = Visibility . Hidden ;
311
- var easingFunc = new CubicEase
312
- {
313
- EasingMode = EasingMode . EaseInOut
314
- } ;
315
- var froSbSmall = new Storyboard ( ) ;
316
-
317
- var borderSmallWidthAni = new DoubleAnimation ( 400 , 0 , TimeSpan . FromSeconds ( 0.5 ) ) ;
318
- borderSmallWidthAni . EasingFunction = easingFunc ;
319
-
320
- Storyboard . SetTarget ( borderSmallWidthAni , FrontBorder ) ;
321
- Storyboard . SetTargetProperty ( borderSmallWidthAni , new PropertyPath ( "Width" ) ) ;
322
-
323
- var borderSmallHeightAni = new DoubleAnimation ( 250 , 0 , TimeSpan . FromSeconds ( 0.5 ) ) ;
324
- borderSmallHeightAni . EasingFunction = easingFunc ;
325
-
326
- Storyboard . SetTarget ( borderSmallHeightAni , FrontBorder ) ;
327
- Storyboard . SetTargetProperty ( borderSmallHeightAni , new PropertyPath ( "Height" ) ) ;
328
-
329
- froSbSmall . Children . Add ( borderSmallWidthAni ) ;
330
- froSbSmall . Children . Add ( borderSmallHeightAni ) ;
331
283
332
- var diaSbBig = new Storyboard ( ) ;
333
-
334
- var forBorderBigWidthAni = new DoubleAnimation ( 0 , 400 , TimeSpan . FromSeconds ( 1 ) ) ;
335
- forBorderBigWidthAni . EasingFunction = easingFunc ;
336
- Storyboard . SetTarget ( forBorderBigWidthAni , DialogBorder ) ;
337
- Storyboard . SetTargetProperty ( forBorderBigWidthAni , new PropertyPath ( "Width" ) ) ;
338
-
339
- var forBorderBigHeightAni = new DoubleAnimation ( 0 , 250 , TimeSpan . FromSeconds ( 1 ) ) ;
340
- forBorderBigHeightAni . EasingFunction = easingFunc ;
341
- Storyboard . SetTarget ( forBorderBigHeightAni , DialogBorder ) ;
342
- Storyboard . SetTargetProperty ( forBorderBigHeightAni , new PropertyPath ( "Height" ) ) ;
343
- diaSbBig . Children . Add ( forBorderBigWidthAni ) ;
344
- diaSbBig . Children . Add ( forBorderBigHeightAni ) ;
345
-
346
- froSbSmall . Completed += ( object sender , EventArgs e ) =>
347
- {
348
- FrontBorder . Visibility = Visibility . Hidden ;
349
- DialogBorder . Visibility = Visibility . Visible ;
350
-
351
- diaSbBig . Begin ( ) ;
352
- Trace . WriteLine ( FrontBorder . Width + FrontBorder . Width ) ;
353
- } ;
354
- froSbSmall . Begin ( ) ;
355
- }
356
-
357
- private void CloseDialog ( )
358
- {
359
- var easingFunc = new CubicEase
360
- {
361
- EasingMode = EasingMode . EaseInOut
362
- } ;
363
- var diaSbSmall = new Storyboard ( ) ;
364
- var rectSmallOpacAni = new DoubleAnimation ( 0 , TimeSpan . FromSeconds ( 0.6 ) ) ;
365
- Storyboard . SetTarget ( rectSmallOpacAni , DialogRect ) ;
366
- Storyboard . SetTargetProperty ( rectSmallOpacAni , new PropertyPath ( "Opacity" ) ) ;
367
- var borderSmallWidthAni = new DoubleAnimation ( 0 , TimeSpan . FromSeconds ( 1 ) ) ;
368
- borderSmallWidthAni . EasingFunction = easingFunc ;
369
- Storyboard . SetTarget ( borderSmallWidthAni , DialogBorder ) ;
370
- Storyboard . SetTargetProperty ( borderSmallWidthAni , new PropertyPath ( "Width" ) ) ;
371
- var borderSmallHeightAni = new DoubleAnimation ( 0 , TimeSpan . FromSeconds ( 1 ) ) ;
372
- borderSmallHeightAni . EasingFunction = easingFunc ;
373
- Storyboard . SetTarget ( borderSmallHeightAni , DialogBorder ) ;
374
- Storyboard . SetTargetProperty ( borderSmallHeightAni , new PropertyPath ( "Height" ) ) ;
375
- diaSbSmall . Children . Add ( rectSmallOpacAni ) ;
376
- diaSbSmall . Children . Add ( borderSmallWidthAni ) ;
377
- diaSbSmall . Children . Add ( borderSmallHeightAni ) ;
378
- diaSbSmall . Completed += ( object sender , EventArgs e ) =>
379
- {
380
- FrontGrid . Visibility = Visibility . Hidden ;
381
- DialogStackPan . Children . Clear ( ) ;
382
- } ;
383
- diaSbSmall . Begin ( ) ;
384
- }
385
284
}
386
285
}
0 commit comments