Пример #1
0
        protected virtual void OnMachineEvent(MachineEventArgs e)
        {
            EventHandler <MachineEventArgs> handler = MachineEvent;

            if (handler != null)
            {
                handler(this, e);
            }

            /*
             * EventHandler<MachineEventArgs> handler = MachineEvent;
             * handler?.Invoke(this, e);
             */
        }
Пример #2
0
        static void OnMachineEvent(object sender, MachineEventArgs e)
        {
            machineEventArgsList.Add(e);
            do
            {
                MachineEventArgs machineEventArgs = new MachineEventArgs();
                machineEventArgs = machineEventArgsList[0];
                logger.Info(string.Format("[{0}][{1}] {2}"
                                          , machineEventArgs.MachineName
                                          , machineEventArgs.MachineEventName
                                          , machineEventArgs.EventUser
                                          ));

                machineEventArgsList.Remove(machineEventArgs);
            } while (machineEventArgsList.Count > 0);
        }
Пример #3
0
        public void SetMachineState(string stateName)
        {
            this.StateName     = stateName;
            this.LastEventTime = DateTime.Now;
            this.LastEventName = "ChangeMachineState";

            MachineEventArgs e = new MachineEventArgs();

            e.MachineName      = this.MachineName;
            e.EventTime        = DateTime.Now;
            e.EventUser        = this.MachineName;
            e.MachineEventName = this.LastEventName;
            e.EventUser        = this.MachineName;
            e.EventValue       = stateName;

            OnMachineEvent(e);
        }