Event args passed to the Received event.
상속: System.EventArgs
예제 #1
0
        void OnReceive(object sender, ReceivedEventArgs e)
        {
            Boolean valid = false;
            var code = e.IRCode;
            var now = DateTime.UtcNow;

            // we keep track of when we see codes so we don't fire too often
            lock(this.Locker) {
                DateTime lastTime;
                if(this.LastSeen.TryGetValue(code, out lastTime)) {
                    if(now - lastTime > MinimumDuration)
                        valid = true;
                } else {
                    valid = true;
                }

                if(valid)
                    this.LastSeen[code] = now;
            }

            //Console.WriteLine("IR RX: " + e.IRCode + " " + valid);

            if(!valid)
                return;

            GenericCommand ev = null;

            switch(code) {
                // OK button
                case "230A011050A5":
                    ev = this.OnDvrOk;
                    break;

                // Red C button
                case "2308041050A5":
                    ev = this.OnDvrAv;
                    break;

                case "2308151050A5":
                    ev = this.OnDvrChannelUp;
                    break;

                case "2308150450A5":
                    ev = this.OnDvrChannelDown;
                    break;

                case "435B541051F4":
                    ev = this.OnOppoOk;
                    break;

                default:

                    break;
            }

            if(ev != null) {
                ev();
            }
        }
예제 #2
0
 private static void mc_Received(object sender, ReceivedEventArgs e)
 {
     Console.WriteLine("Received: {0}", e.IRCode);
 }