Example #1
0
 /// <summary>
 /// Raised when FSX notifies us of an event.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="args"></param>
 private void SimConnect_EventObserved(object sender, SimConnectEventObservedEventArgs args)
 {
     if (args.EventId == (uint)FlightSimulatorXEventId.SlewToggle)
     {
         OnSlewToggled(EventArgs.Empty);
     }
 }
 /// <summary>
 /// Raises <see cref="EventObserved"/>.
 /// </summary>
 /// <param name="args"></param>
 private void OnEventObserved(SimConnectEventObservedEventArgs args)
 {
     if (EventObserved != null)
     {
         EventObserved(this, args);
     }
 }
Example #3
0
        /// <summary>
        /// Called when SimConnect observes an event taking place.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="data"></param>
        private void SimConnect_RecvEvent(SimConnect sender, SIMCONNECT_RECV_EVENT data)
        {
            var args = new SimConnectEventObservedEventArgs()
            {
                EventId          = data.uEventID,
                GroupId          = data.uGroupID,
                GroupIdIsUnknown = data.uGroupID == SIMCONNECT_RECV_EVENT.UNKNOWN_GROUP,
                Value            = data.dwData,
            };

            OnEventObserved(args);
        }
Example #4
0
        public void FlightSimulatorX_SlewToggled_Raised_When_User_Toggles_Slew_Manually()
        {
            _Fsx.SlewToggled += _SlewToggledEvent.Handler;
            _Fsx.Connect(new IntPtr(10));

            var args = new SimConnectEventObservedEventArgs()
            {
                EventId = (uint)FlightSimulatorXEventId.SlewToggle,
            };

            _SimConnect.Raise(s => s.EventObserved += null, args);

            Assert.AreEqual(1, _SlewToggledEvent.CallCount);
            Assert.AreSame(_Fsx, _SlewToggledEvent.Sender);
            Assert.IsNotNull(_SlewToggledEvent.Args);
        }
Example #5
0
 /// <summary>
 /// Raises <see cref="EventObserved"/>.
 /// </summary>
 /// <param name="args"></param>
 private void OnEventObserved(SimConnectEventObservedEventArgs args)
 {
     EventHelper.RaiseQuickly(EventObserved, this, args);
 }