• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Win32.PowerModeChangedEventArgs类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Microsoft.Win32.PowerModeChangedEventArgs的典型用法代码示例。如果您正苦于以下问题:C# PowerModeChangedEventArgs类的具体用法?C# PowerModeChangedEventArgs怎么用?C# PowerModeChangedEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PowerModeChangedEventArgs类属于Microsoft.Win32命名空间,在下文中一共展示了PowerModeChangedEventArgs类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: PowerModeChanged

 static void PowerModeChanged(Object sender, PowerModeChangedEventArgs e)
 {
     if (e.Mode == PowerModes.Suspend)
     {
         Console.WriteLine("PowerMode: suspend");
     }
     if (e.Mode == PowerModes.Resume)
     {
         Console.WriteLine("PowerMode: resume");
         // give it some time to connect. wasn't necessary for me, but might be for some configurations. adjust if needed.
         System.Threading.Thread.Sleep(500);
         var connectedSsids = new List<string>();
         foreach (WlanClient.WlanInterface wlanInterface in wlan.Interfaces)
         {
             if (wlanInterface.InterfaceState != Wlan.WlanInterfaceState.Connected)
             {
                 Console.WriteLine(wlanInterface.InterfaceName + " is not connected!");
             }
             else
             {
                 Wlan.Dot11Ssid ssid = wlanInterface.CurrentConnection.wlanAssociationAttributes.dot11Ssid;
                 connectedSsids.Add(new String(Encoding.ASCII.GetChars(ssid.SSID, 0, (int)ssid.SSIDLength)));
             }
         }
         Console.WriteLine("Connected SSIDs:");
         foreach (var ssid in connectedSsids)
             Console.WriteLine("\t" + ssid);
         if (connectedSsids.Intersect(safeSSIDs).Count() > 0)
         {
             Console.WriteLine("-> save");
         }
         else
         {
             Console.WriteLine("-> unsafe. Locking workstation now!");
             LockWorkStation();
         }
     }
 }
开发者ID:vogler,项目名称:LockOut,代码行数:38,代码来源:Program.cs


示例17: OnPowerChange

 private void OnPowerChange(object s, PowerModeChangedEventArgs e)
 {
     switch (e.Mode)
     {
         case PowerModes.Resume:
             if ((btnStartStop.Text == Resources.StartText) && wasRunning)
             {
                 DS4LightBar.shuttingdown = false;
                 wasRunning = false;
                 ToggleControlService();
             }
             break;
         case PowerModes.Suspend:
             if (btnStartStop.Text == Resources.StopText)
             {
                 DS4LightBar.shuttingdown = true;
                 ToggleControlService();
                 wasRunning = true;
             }
             break;
     }
 }
开发者ID:SonicFreak94,项目名称:DS4Windows,代码行数:22,代码来源:DS4Form.cs


示例18: SystemEvents_PowerModeChanged

 void SystemEvents_PowerModeChanged(object sender, PowerModeChangedEventArgs e)
 {
     if (e.Mode == PowerModes.Resume)
         closeViewModel(true);
 }
开发者ID:Cocotus,项目名称:ssh-tunnel-agent,代码行数:5,代码来源:App.xaml.cs


示例19: PowerModeChanged

 internal void PowerModeChanged(object sender, PowerModeChangedEventArgs e)
 {
     switch (e.Mode)
     {
         case PowerModes.Resume:
             SuspendBlacklisting = false;
             Debug.WriteLine("Temporarily suspending blacklists because machine is resuming.");
             TemporarilySuspendBlacklist();
             break;
         case PowerModes.Suspend:
             Debug.WriteLine("Suspend blacklists because of computer powersave mode change.");
             SuspendBlacklisting = true;
             break;
     }
 }
开发者ID:NaseUkolyCZ,项目名称:Terrarium,代码行数:15,代码来源:MainForm.cs


示例20: SystemEvents_PowerModeChanged

    private void SystemEvents_PowerModeChanged(object sender, PowerModeChangedEventArgs e)
    {
      Settings.Instance.LogDebug("MiniDisplay: SystemPowerModeChanged event was raised.");
 
      switch (e.Mode)
      {
        case PowerModes.Resume:
          Log.Info("MiniDisplay: Resume from Suspend or Hibernation detected, starting plugin");
          SystemEvents.PowerModeChanged -= new PowerModeChangedEventHandler(this.SystemEvents_PowerModeChanged);
          this.DoStart();
          break;

        case PowerModes.StatusChange:
          break;

        case PowerModes.Suspend:
          Log.Info("MiniDisplay: Suspend or Hibernation detected, shutting down plugin");
          this.DoStop();
          return;

        default:
          return;
      }
    }
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:24,代码来源:MiniDisplay.cs



注:本文中的Microsoft.Win32.PowerModeChangedEventArgs类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Win32.RegistryKey类代码示例发布时间:2022-05-26
下一篇:
C# Win32.OpenFileDialog类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap