File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -107,15 +107,19 @@ private static void SystemEvents_PowerModeChanged(object sender, PowerModeChange
107107 Logging . Info ( "os wake up" ) ;
108108 if ( _controller != null )
109109 {
110- System . Timers . Timer timer = new System . Timers . Timer ( 5 * 1000 ) ;
110+ System . Timers . Timer timer = new System . Timers . Timer ( 10 * 1000 ) ;
111111 timer . Elapsed += Timer_Elapsed ;
112112 timer . AutoReset = false ;
113113 timer . Enabled = true ;
114114 timer . Start ( ) ;
115115 }
116116 break ;
117117 case PowerModes . Suspend :
118- _controller ? . Stop ( ) ;
118+ if ( _controller != null )
119+ {
120+ _controller . Stop ( ) ;
121+ Logging . Info ( "controller stopped" ) ;
122+ }
119123 Logging . Info ( "os suspend" ) ;
120124 break ;
121125 }
@@ -125,7 +129,11 @@ private static void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs
125129 {
126130 try
127131 {
128- _controller ? . Start ( ) ;
132+ if ( _controller != null )
133+ {
134+ _controller . Start ( ) ;
135+ Logging . Info ( "controller started" ) ;
136+ }
129137 }
130138 catch ( Exception ex )
131139 {
@@ -149,6 +157,7 @@ private static void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs
149157
150158 private static void Application_ApplicationExit ( object sender , EventArgs e )
151159 {
160+ SystemEvents . PowerModeChanged -= SystemEvents_PowerModeChanged ;
152161 HotKeys . Destroy ( ) ;
153162 if ( _controller != null )
154163 {
You can’t perform that action at this time.
0 commit comments