Hello,
I am trying to develop a small app in c# 4.0 .net framework to help me start/stop an application when going/resuming from sleep. I am using the following code
SystemEvents.PowerModeChanged+=OnPowerChange;
privatevoidOnPowerChange(Object sender,PowerModeChangedEventArgs e){string lines;try{switch(e.Mode){/// When resume has occuredcasePowerModes.Resume:
lines ="Resuming.\r\n";System.IO.StreamWriter file =newSystem.IO.StreamWriter("out1.txt");
file.WriteLine(lines);
file.Close();break;/// When Suspend has occuredcasePowerModes.Suspend:
lines ="Suspending.\r\n";
file =newSystem.IO.StreamWriter("out2.txt");
file.WriteLine(lines);
file.Close();break;casePowerModes.StatusChange:
lines ="Status Changed.\r\n";
file =newSystem.IO.StreamWriter("out3.txt");
file.WriteLine(lines);
file.Close();break;default:break;}}catch(Exception ex){
lines ="Error: \r\n"+ ex.Message+"\r\n";System.IO.StreamWriter file =newSystem.IO.StreamWriter("error.txt");
file.WriteLine(lines);
file.Close();}}
The problem is that on my developing machine everything works fine but when I tried it on my home theater pc when resuming from sleep nothing happens. The only time the above event fires is when I enter suspend mode. When I resume from sleep nothing happens.
The only difference that exist between the two machines and can potentially be causing the issue is that in my htpc I pass the video through a yamaha receiver and from there to my TV. I notice that every time the problem appears nothing is shown in my TV (no video). I have to press some key on my remote to get my TV to show something. On the development machine however everything is working fine and both of my monitors are displaying video after resuming from sleep.
Does anybody has any idea why this is happening? Could this be a bug in .net framework that is created when you pass the hdmi video through a receiver before connecting it to a Monitor/TV?
Regards
phanos