static void Main(string[] args) { int CSDurationMilliseconds = 0; DateTime wakeTime = new DateTime(); try { if (ConfigurationManager.AppSettings["wakeTime"] != null) { wakeTime = Convert.ToDateTime(ConfigurationManager.AppSettings["wakeTime"]); } else { wakeTime = DateTime.Now.AddMinutes(2); } System.TimeSpan wakeInMs = wakeTime.Subtract(DateTime.Now); CSDurationMilliseconds = wakeInMs.Milliseconds; IWDTF2 WDTF = new WDTF2(); IWDTFSystemAction2 Sys = (IWDTFSystemAction2)WDTF.SystemDepot.ThisSystem.GetInterface("System"); // Sys.SleepWakeTimeInSeconds = 60; // Sys.Sleep(4); Sys.ConnectedStandby(CSDurationMilliseconds); } catch (Exception e) { } }
private static void _setConnectedStandby(int delay, int duration, int iterations) { try { for (int i = 0; i < iterations; i++) { Thread.Sleep(delay); var wdtf = new WDTF2(); var system = (IWDTFSystemAction2)wdtf.SystemDepot.ThisSystem.GetInterface("System"); system.ConnectedStandby(duration); } } catch (Exception) { } }