4
4
using System . Diagnostics ;
5
5
using System . Drawing . Drawing2D ;
6
6
using System . Drawing . Imaging ;
7
- using System . IO ;
8
7
using System . Timers ;
9
8
10
9
namespace GHelper . AnimeMatrix
@@ -69,49 +68,51 @@ public void SetMatrix(bool wakeUp = false)
69
68
StopMatrixTimer ( ) ;
70
69
StopMatrixAudio ( ) ;
71
70
72
- try
73
- {
74
- device . SetProvider ( ) ;
75
- }
76
- catch ( Exception ex )
71
+ Task . Run ( ( ) =>
77
72
{
78
- Logger . WriteLine ( ex . Message ) ;
79
- return ;
80
- }
73
+ try
74
+ {
75
+ device . SetProvider ( ) ;
76
+ }
77
+ catch ( Exception ex )
78
+ {
79
+ Logger . WriteLine ( ex . Message ) ;
80
+ return ;
81
+ }
81
82
82
- if ( wakeUp && AppConfig . ContainsModel ( "401" ) ) device . WakeUp ( ) ;
83
+ if ( wakeUp && AppConfig . ContainsModel ( "401" ) ) device . WakeUp ( ) ;
83
84
84
- if ( brightness == 0 || ( auto && SystemInformation . PowerStatus . PowerLineStatus != PowerLineStatus . Online ) )
85
- {
86
- device . SetDisplayState ( false ) ;
87
- device . SetDisplayState ( false ) ; // some devices are dumb
88
- Logger . WriteLine ( "Matrix Off" ) ;
89
- }
90
- else
91
- {
92
- device . SetDisplayState ( true ) ;
93
- device . SetBrightness ( ( BrightnessMode ) brightness ) ;
94
-
95
- switch ( running )
85
+ if ( brightness == 0 || ( auto && SystemInformation . PowerStatus . PowerLineStatus != PowerLineStatus . Online ) )
96
86
{
97
- case 2 :
98
- SetMatrixPicture ( AppConfig . GetString ( "matrix_picture" ) ) ;
99
- break ;
100
- case 3 :
101
- SetMatrixClock ( ) ;
102
- break ;
103
- case 4 :
104
- SetMatrixAudio ( ) ;
105
- break ;
106
- default :
107
- device . SetBuiltInAnimation ( true , animation ) ;
108
- Logger . WriteLine ( "Matrix builtin " + animation . AsByte ) ;
109
- break ;
87
+ device . SetDisplayState ( false ) ;
88
+ device . SetDisplayState ( false ) ; // some devices are dumb
89
+ Logger . WriteLine ( "Matrix Off" ) ;
90
+ }
91
+ else
92
+ {
93
+ device . SetDisplayState ( true ) ;
94
+ device . SetBrightness ( ( BrightnessMode ) brightness ) ;
95
+
96
+ switch ( running )
97
+ {
98
+ case 2 :
99
+ SetMatrixPicture ( AppConfig . GetString ( "matrix_picture" ) ) ;
100
+ break ;
101
+ case 3 :
102
+ SetMatrixClock ( ) ;
103
+ break ;
104
+ case 4 :
105
+ SetMatrixAudio ( ) ;
106
+ break ;
107
+ default :
108
+ device . SetBuiltInAnimation ( true , animation ) ;
109
+ Logger . WriteLine ( "Matrix builtin " + animation . AsByte ) ;
110
+ break ;
111
+ }
110
112
111
113
}
114
+ } ) ;
112
115
113
- //mat.SetBrightness((BrightnessMode)brightness);
114
- }
115
116
116
117
}
117
118
private void StartMatrixTimer ( int interval = 100 )
@@ -358,10 +359,10 @@ protected void ProcessPicture(Image image)
358
359
359
360
int matrixZoom = AppConfig . Get ( "matrix_zoom" , 100 ) ;
360
361
int matrixContrast = AppConfig . Get ( "matrix_contrast" , 100 ) ;
361
-
362
+
362
363
int matrixSpeed = AppConfig . Get ( "matrix_speed" , 50 ) ;
363
364
364
- MatrixRotation rotation = ( MatrixRotation ) AppConfig . Get ( "matrix_rotation" , 0 ) ;
365
+ MatrixRotation rotation = ( MatrixRotation ) AppConfig . Get ( "matrix_rotation" , 0 ) ;
365
366
366
367
InterpolationMode matrixQuality = ( InterpolationMode ) AppConfig . Get ( "matrix_quality" , 0 ) ;
367
368
@@ -382,7 +383,7 @@ protected void ProcessPicture(Image image)
382
383
device . GenerateFrame ( image , matrixZoom , matrixX , matrixY , matrixQuality , matrixContrast ) ;
383
384
else
384
385
device . GenerateFrameDiagonal ( image , matrixZoom , matrixX , matrixY , matrixQuality , matrixContrast ) ;
385
-
386
+
386
387
device . AddFrame ( ) ;
387
388
}
388
389
0 commit comments