Skip to content

Commit c2da2b9

Browse files
committed
Fix Initialize being called twice when resuming from sleep
The ResumeAutomatic event is always raised when resuming from sleep while ResumeSuspend/ResumeCritical provide information as to why the PC was resumed.
1 parent e3eebef commit c2da2b9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Source/TTController.Service/TTService.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,16 +142,20 @@ protected void OnSuspend()
142142

143143
protected override bool OnPowerEvent(PowerBroadcastStatus powerStatus)
144144
{
145+
Logger.Debug("Power Event: {0}", powerStatus);
146+
145147
switch (powerStatus)
146148
{
147149
case PowerBroadcastStatus.QuerySuspendFailed:
148150
OnStart(null);
149151
break;
150152

151153
case PowerBroadcastStatus.ResumeAutomatic:
154+
OnStart(null);
155+
break;
156+
152157
case PowerBroadcastStatus.ResumeCritical:
153158
case PowerBroadcastStatus.ResumeSuspend:
154-
OnStart(null);
155159
break;
156160

157161
case PowerBroadcastStatus.QuerySuspend:

0 commit comments

Comments
 (0)