Пример #1
0
 //해당 EVENT가 발생시 실행할 함수 제거.
 public void RemoveEventCallback(EVENT_ID aEventID, EventNotifyCallback aCallback)
 {
     if (dicEventNotifyCallbacks.ContainsKey(aEventID))
     {
         dicEventNotifyCallbacks[aEventID] -= aCallback;
     }
 }
Пример #2
0
        /// <summary>
        /// RegisterEvent
        /// Registers an IListener object to a specific event
        /// </summary>
        /// <param name="eventID"></param>
        /// <param name="obj"></param>
        public void RegisterEvent(EVENT_ID eventID, IListener obj)
        {
            if (CheckParams(eventID, obj))
            {
                return;
            }

            mEvents[(short)eventID].AddObject(obj);
        }
Пример #3
0
        /// <summary>
        /// SendEvent
        /// Queues the event to be processed
        /// </summary>
        /// <param name="eventID"></param>
        /// <param name="obj"></param>
        public void SendEvent(EVENT_ID eventID, IListener obj)
        {
            if (CheckParams(eventID, obj))
            {
                return;
            }

            CEvent temp = new CEvent(obj, eventID);
            mEventList.Add(temp);
        }
Пример #4
0
 //해당 EVENT가 발생시 실행할 함수 등록.
 public void AddEventCallback(EVENT_ID aEventID, EventNotifyCallback aCallback)
 {
     if (false == dicEventNotifyCallbacks.ContainsKey(aEventID))
     {
         dicEventNotifyCallbacks.Add(aEventID, aCallback);
     }
     else
     {
         dicEventNotifyCallbacks[aEventID] += aCallback;
     }
 }
Пример #5
0
    //EVENT 발생 알림.
    public void NotifyEvent(EVENT_ID aEventID, Int64[] aEventValues)
    {
        if (false == dicEventNotifyCallbacks.ContainsKey(aEventID))
        {
            return;
        }

        if (null == dicEventNotifyCallbacks[aEventID])
        {
            return;
        }

        dicEventNotifyCallbacks[aEventID](aEventValues);
    }
Пример #6
0
 public CEvent(IListener _param, EVENT_ID _id)
 {
     mParam = _param;
     mID = _id;
 }
Пример #7
0
 public CEvent()
 {
     mParam = null;
     mID = EVENT_ID.BAD_EVENT;
 }
Пример #8
0
 /// <summary>
 /// Need to make sure our event parameters are in range and good
 /// </summary>
 /// <param name="eventID"></param>
 /// <param name="obj"></param>
 /// <returns>bool </returns>
 private bool CheckParams(EVENT_ID eventID, IListener obj)
 {
     return eventID <= EVENT_ID.BAD_EVENT || eventID >= EVENT_ID.NUM_EVENTS || obj == null;
 }
Пример #9
0
        private void UpdateEvent(EVENT_ID Event, int Valeur)
        {
            switch (Event)
            {
            case EVENT_ID.PARKING_BRAKE:
                Dernier.ParkingBrake = Convert.ToBoolean(Valeur);
                break;

            case EVENT_ID.PAUSE:
                Dernier.Pause = Convert.ToBoolean(Valeur);
                break;

            case EVENT_ID.OVERSPEED:
                Dernier.OverSpeed = Convert.ToBoolean(Valeur);
                break;

            case EVENT_ID.STALLING:
                Dernier.Stalling = Convert.ToBoolean(Valeur);
                break;

            case EVENT_ID.CRASH:
                if (Valeur > 0)
                {
                    Dernier.Crash = true;
                }
                else
                {
                    Dernier.Crash = false;
                }
                break;

            case EVENT_ID.SLEW:
                Dernier.Slew = Convert.ToBoolean(Valeur);
                break;

            case EVENT_ID.PUSHBACK:
                Dernier.Pushback = (Valeur < 3);
                break;

            case EVENT_ID.SIMSTART:
                Dernier.RunState = Convert.ToBoolean(Valeur);
                break;

            case EVENT_ID.ON_GROUND:
                Dernier.OnGround = Convert.ToBoolean(Valeur);
                if (Dernier.OnGround)
                {
                    if (Dernier.Vario < -800)
                    {
                        Dernier.Crash = true;
                    }
                }
                break;

            case EVENT_ID.ALTIMETER_SETTING:
                Dernier.AltimeterSetting = Valeur;
                break;

            case EVENT_ID.FLAPS_HANDLE_INDEX:
                Dernier.FlapsIndex = Valeur;
                break;

            case EVENT_ID.GEAR_HANDLE_POSITION:
                Dernier.GearPos = Convert.ToBoolean(Valeur);
                break;

            case EVENT_ID.LANDING_LIGHT:
                Dernier.LandingLight = Convert.ToBoolean(Valeur);
                break;

            case EVENT_ID.BEACON_LIGHT:
                Dernier.BeaconLight = Convert.ToBoolean(Valeur);
                break;

            case EVENT_ID.STROBE_LIGHT:
                Dernier.StrobeLight = Convert.ToBoolean(Valeur);
                break;

            case EVENT_ID.NAV_LIGHT:
                Dernier.NavLight = Convert.ToBoolean(Valeur);
                break;

            case EVENT_ID.RECOGNITION_LIGHT:
                Dernier.RecoLight = Convert.ToBoolean(Valeur);
                break;

            case EVENT_ID.SMOKE_ENABLE:
                Dernier.Smoke = Convert.ToBoolean(Valeur);
                break;

            default:
                break;
            }
        }
Пример #10
0
 public void RemoveEventCallback(EVENT_ID aEventID, EventNotifyCallback aCallback)
 {
     dicEventNotifyCallbacks[aEventID] -= aCallback;
 }