예제 #1
0
        // ---------------------------------------------------------------------------------------------------------------------------------------
        // ---------------------------------------------------------------------------------------------------------------------------------------
        // ---------------------------------------------------------------------------------------------------------------------------------------
        // ---------------------------------------------------------------------------------------------------------------------------------------
        // -------------------------------------------------------     Flight Sim Part    --------------------------------------------------------
        // ---------------------------------------------------------------------------------------------------------------------------------------
        // ---------------------------------------------------------------------------------------------------------------------------------------
        // ---------------------------------------------------------------------------------------------------------------------------------------
        // ---------------------------------------------------------------------------------------------------------------------------------------


        private void SimConnectApp_FSConnectionStatusChanged(object sender, bool state)
        {
            if (state)
            {
                smiFSConnect.Text  = "SimConnect: Connected";
                smiFSConnect.Image = new Bitmap(Properties.Resources.connected);
            }
            else
            {
                smiFSConnect.Text  = "SimConnect: Not Connected";
                smiFSConnect.Image = new Bitmap(Properties.Resources.disconnected);
                if (simConnectApp != null)
                {
                    simConnectApp = null;
                }
                connectionTimer.Start();
            }
        }
예제 #2
0
        private void ConnectToSim()
        {
            if (simConnectApp != null)
            {
                DisconnectFromFS();
            }

            if (fsType == FlightSimType.FST_P3D)
            {
                simConnectApp = new SimConnectP3D(this.Handle);
            }
            else if (fsType == FlightSimType.FST_FSX)
            {
                simConnectApp = new SimConnectFSX(this.Handle);
            }
            else
            {
                return;
            }
            simConnectApp.FSConnectionStatusChanged += new ConnectionEventHandler(SimConnectApp_FSConnectionStatusChanged);
            simConnectApp.OnSimConnectDataReceived  += new SimConnectDataReceived(SimConnectApp_SimDataReceived);
            simConnectApp.ConnectToSimConnect();
        }
예제 #3
0
 private void DisconnectFromFS()
 {
     simConnectApp.DisconnectSim();
     simConnectApp = null;
 }