void plc_PLCModeChanged(object sender, PLCModeChangedEventArgs args) { if (args.PLC.FirstPass) { AddLog(args.Time + " : " + args.PLC.Topic + " переведен в " + args.PLC.Mode.ToString()); args.PLC.FirstPass = false; } else { if (args.PLC.Mode == PLCMode.RemoteDownloadInProgress) { AddLog(args.Time + " : Потеря связи с " + args.PLC.Topic + " в " + args.PLC.LostConnectionTime); if (DateTime.Now.Hour > 6 && DateTime.Now.Hour < 23) { SendSms("Потеря связи с " + args.PLC.Topic + " в " + args.PLC.LostConnectionTime); args.PLC.LostConnectionSmsSended = true; } } else { AddLog(args.Time + " : " + args.PLC.Topic + " переведен в " + args.PLC.Mode.ToString()); if (DateTime.Now.Hour > 6 && DateTime.Now.Hour < 23) { SendSms(args.Time + " : " + args.PLC.Topic + " переведен в " + args.PLC.Mode.ToString()); } } } }
protected virtual void OnPLCModeChanged(PLCModeChangedEventArgs e) { PLCModeChangedEventHandler handler = PLCModeChanged; if (handler != null) { handler(this, e); } }