當前位置: 首頁>>代碼示例>>C#>>正文


C# Win32.PowerModeChangedEventArgs類代碼示例

本文整理匯總了C#中Microsoft.Win32.PowerModeChangedEventArgs的典型用法代碼示例。如果您正苦於以下問題:C# PowerModeChangedEventArgs類的具體用法?C# PowerModeChangedEventArgs怎麽用?C# PowerModeChangedEventArgs使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


PowerModeChangedEventArgs類屬於Microsoft.Win32命名空間,在下文中一共展示了PowerModeChangedEventArgs類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: SystemEvents_PowerModeChanged

 private void SystemEvents_PowerModeChanged(object sender, PowerModeChangedEventArgs e)
 {
     if(e.Mode == PowerModes.Resume)
       {
     UpdateLayout();
       }
 }
開發者ID:poulinjulien,項目名稱:hibernator,代碼行數:7,代碼來源:MainWindow.xaml.cs

示例2: SystemEvents_PowerModeChanged

 void SystemEvents_PowerModeChanged(object sender, PowerModeChangedEventArgs e)
 {
     if (e.Mode == PowerModes.Resume)
     {
         ResetKeyboardSpeed();
     }
 }
開發者ID:stefnoten,項目名稱:KeyboardSpeedReset,代碼行數:7,代碼來源:ProcessIcon.cs

示例3: SystemEvents_PowerModeChanged

 private static void SystemEvents_PowerModeChanged(object sender, PowerModeChangedEventArgs e)
 {
     try
     {
         if (e.Mode == PowerModes.Suspend)
         {
             //EventTrackerContext.Save(
             EventQueue.Enqueue(
                 new LogOnEvent()
                 {
                     IsLoggedOn = false,
                     EventTime = DateTime.Now,
                 });
         }
         else if (e.Mode == PowerModes.Resume)
         {
             //EventTrackerContext.Save(
             EventQueue.Enqueue(
                 new LogOnEvent()
                 {
                     IsLoggedOn = true,
                     EventTime = DateTime.Now,
                 });
         }
     }
     catch (Exception ex)
     {
         Logger.Log(ex.ToString());
     }
 }
開發者ID:borigas,項目名稱:EventTracker,代碼行數:30,代碼來源:LoggedOnTracker.cs

示例4: SystemEvents_PowerModeChanged

 private void SystemEvents_PowerModeChanged(object sender, PowerModeChangedEventArgs e)
 {
     if (AutomaticSwitching)
     {
         RedetectNetwork();
     }
 }
開發者ID:Saldash,項目名稱:ProxySwitcher,代碼行數:7,代碼來源:NetworkManager.cs

示例5: SystemEvents_PowerModeChanged

 private static void SystemEvents_PowerModeChanged(object sender, PowerModeChangedEventArgs e)
 {
     if ( e.Mode == PowerModes.Suspend )
     {
         SystemEvents.PowerModeChanged -= PowerHandeler;
         Environment.Exit( 0 );
     }
 }
開發者ID:Cocotus,項目名稱:XTMF,代碼行數:8,代碼來源:Program.cs

示例6: HandlePowerEvent

 public static void HandlePowerEvent(PowerModeChangedEventArgs args)
 {
     if (args.Mode == PowerModes.Resume)
     {
         Logger.Log("Refreshing on system resume");
         MakeWebRequest();
     }
 }
開發者ID:borigas,項目名稱:SafeConnect,代碼行數:8,代碼來源:SafeConnectUpdater.cs

示例7: SystemEvents_PowerModeChanged

 void SystemEvents_PowerModeChanged(object sender, PowerModeChangedEventArgs e)
 {
     if (e.Mode == PowerModes.Resume)
     {
         DisposeTimer();
         StartTimer(Timeout.InfiniteTimeSpan);
     }
 }
開發者ID:Cyrre,項目名稱:Emby,代碼行數:8,代碼來源:PeriodicTimer.cs

示例8: SystemEvents_PowerModeChanged

        /// <summary>
        /// Handles the PowerModeChanged event of the SystemEvents control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="PowerModeChangedEventArgs" /> instance containing the event data.</param>
        async void SystemEvents_PowerModeChanged(object sender, PowerModeChangedEventArgs e)
        {
            if (e.Mode == PowerModes.Resume && SystemEvent == SystemEvent.WakeFromSleep)
            {
                // This value is a bit arbitrary, but add a delay to help ensure network connections have been restored before running the task
                await Task.Delay(10000).ConfigureAwait(false);

                OnTriggered();
            }
        }
開發者ID:rezafouladian,項目名稱:Emby,代碼行數:15,代碼來源:SystemEventTrigger.cs

示例9: SystemEvents_PowerModeChanged

 void SystemEvents_PowerModeChanged(object sender, PowerModeChangedEventArgs e)
 {
     if (e.Mode == PowerModes.Resume)
     {
         if (ResumeFromSleep != null)
         {
             ResumeFromSleep(this, EventArgs.Empty);
         }
     }
 }
開發者ID:daltekkie,項目名稱:Emby.ApiClient,代碼行數:10,代碼來源:Device.cs

示例10: SystemEvents_PowerModeChanged

 async void SystemEvents_PowerModeChanged(object sender, PowerModeChangedEventArgs e)
 {
     if (e.Mode == PowerModes.Resume)
     {
         for (int i = 0; i < 20; ++i)
         {
             await Task.Delay(500);
             m_dev.SetEventNotification(m_notifyEvent.SafeWaitHandle.DangerousGetHandle());
         }
     }
 }
開發者ID:finalpatch,項目名稱:SharpTouch,代碼行數:11,代碼來源:Touchpad.cs

示例11: PowerModeChanged

 /// <summary>
 /// Method for responding to the power mode changed event. For some reason, the scanner man
 /// object gets messed up when going into suspend mode. If we release all of the scanners
 /// when suspend mode is started and reaquire them when resuming, scanning can resume.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e">Contains the mode to identify whether we're entering or leaving suspend mode.</param>
 private void PowerModeChanged(object sender, PowerModeChangedEventArgs e)
 {
     if (e.Mode == PowerModes.Suspend)
     {
         Shutdown();
     }
     else if (e.Mode == PowerModes.Resume)
     {
         Startup();
     }
 }
開發者ID:ssickles,項目名稱:archive,代碼行數:18,代碼來源:NeuroCapture.cs

示例12: SystemEvents_PowerModeChanged

 private void SystemEvents_PowerModeChanged(object sender, PowerModeChangedEventArgs e)
 {
     switch (e.Mode)
     {
         case PowerModes.Resume:
             File.AppendAllText("D:/log.txt", DateTime.Now.ToString("HH:mm:ss.fff", System.Globalization.DateTimeFormatInfo.InvariantInfo) + ": Resume");
             break;
         case PowerModes.Suspend:
             File.AppendAllText("D:/log.txt", DateTime.Now.ToString("HH:mm:ss.fff", System.Globalization.DateTimeFormatInfo.InvariantInfo) + ": Suspend");
             break;
     }
 }
開發者ID:huy8687,項目名稱:ProgramControlling,代碼行數:12,代碼來源:ControllingService.cs

示例13: SystemEvents_PowerModeChanged

 private void SystemEvents_PowerModeChanged(object sender, PowerModeChangedEventArgs e)
 {
     if (e.Mode == PowerModes.Suspend && this.IsOpen)
     {
         this.resume = true;
         this.Close();
     }
     else if (e.Mode == PowerModes.Resume && this.resume)
     {
         this.resume = false;
         this.Open();
     }
 }
開發者ID:kostapc,項目名稱:putty-tunnel-manager,代碼行數:13,代碼來源:Session.cs

示例14: PowerMode

 void PowerMode( object sender, PowerModeChangedEventArgs e )
 {
     ConsoleWriter.Write( string.Format( "****: Power mode changed event fired! {0}\n", e.Mode ), true );
     if( e.Mode == PowerModes.Suspend )
         foreach( var irc in _ircControllers )
             irc.Close();
     else
         foreach( var irc in _ircControllers.Where( r => r.ExceptionalState ) )
         {
             ConsoleWriter.Write( "****: Bad state detected." );
             irc.Close();
         }
 }
開發者ID:Zazcallabah,項目名稱:IrcNotify,代碼行數:13,代碼來源:SystemPowerStateListener.cs

示例15: collected

        static HandlerRoutine _controlHandler = null; // Keeps it from getting garbage collected (and null exception)

        private static void OnPowerChange(Object sender, PowerModeChangedEventArgs pe)
        {
            Log.WriteSystemEventLog("MCEBuddy engine app OnPowerChange called by System, Event -> " + pe.Mode.ToString(), EventLogEntryType.Information);

            switch (pe.Mode)
            {
                case PowerModes.Resume:
                    try
                    {
                        if (_pipeProxy.WithinConversionTimes()) // Resume only if we are within Conversion times else it will auto resume at the right time
                            _pipeProxy.SuspendConversion(false); // Resume
                    }
                    catch (Exception e)
                    {
                        Log.WriteSystemEventLog("MCEBuddy engine app: Error trying to resume MCEBuddy " + e.ToString(), EventLogEntryType.Warning);
                    }
                    break;

                case PowerModes.Suspend:
                    try
                    {
                        _pipeProxy.SuspendConversion(true); // suspend and buffers are flushed when suspended
                    }
                    catch (Exception e)
                    {
                        Log.WriteSystemEventLog("MCEBuddy engine app: Error trying to suspend MCEBuddy " + e.ToString(), EventLogEntryType.Warning);
                    }

                    break;

                case PowerModes.StatusChange:
                    try
                    {
                        Log.WriteSystemEventLog("MCEBuddy engine app: Power Status Change Notification, Power Status -> " + System.Windows.Forms.SystemInformation.PowerStatus.PowerLineStatus.ToString(), EventLogEntryType.Information);

                        if (System.Windows.Forms.SystemInformation.PowerStatus.PowerLineStatus == System.Windows.Forms.PowerLineStatus.Offline) // If we are on battery power
                        {
                            if (MCEBuddyConf.GlobalMCEConfig.GeneralOptions.suspendOnBattery) // If we are requested to Pause on battery power
                                _pipeProxy.SuspendConversion(true); // Suspend it
                        }
                        else if (_pipeProxy.WithinConversionTimes()) // Resume only if we are within Conversion times else it will auto resume at the right time
                            _pipeProxy.SuspendConversion(false); // Resume it (assume A/C power)
                    }
                    catch (Exception e)
                    {
                        Log.WriteSystemEventLog("MCEBuddy engine app: Error trying to change suspend mode on Power Event in MCEBuddy " + e.ToString(), EventLogEntryType.Warning);
                    }

                    break;
            }
        }
開發者ID:hoeness2,項目名稱:mcebuddy2,代碼行數:53,代碼來源:Program.cs


注:本文中的Microsoft.Win32.PowerModeChangedEventArgs類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。