コード例 #1
0
        protected override bool OnPowerEvent(PowerBroadcastStatus status)
        {
            try
            {
                if (ctx.EventLog)
                {
                    if (status == PowerBroadcastStatus.Suspend)
                    {
                        EventLog.WriteEntry("Entering Standby");
                    }
                    if (status == PowerBroadcastStatus.ResumeSuspend)
                    {
                        if (this[typeof(PowerBroadcastFallback)] != null)
                        {
                            return(true);
                        }

                        EventLog.WriteEntry("Resuming Operation");
                    }
                }

                PowerChange?.Invoke(this, new PowerChangeEvent {
                    Status = status
                });
            }
            catch (Exception e)
            {
                EventLog.WriteEntry(e.ToString(), EventLogEntryType.Error, 99);
            }

            return(true);
        }
コード例 #2
0
 internal void SendEvent(ModuleBase source, PowerChangeEvent e)
 {
     PowerChange?.Invoke(source, e);
 }