当前位置: 首页>>代码示例>>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;未经允许,请勿转载。