private void HandleConnectionStateChange(DroneNetworkConnectionStateChangedEventArgs e)
        {
            UpdateConnectionStateLabel(e);

            if (e.State == DroneNetworkConnectionState.PingSuccesful)
            {
                WaitToStartApplication();
            }
        }
예제 #2
0
 // Event handlers
 private void droneControl_NetworkConnectionStateChanged_Async(object sender, DroneNetworkConnectionStateChangedEventArgs e)
 {
     //Dispatcher.BeginInvoke(new DroneNetworkConnectionStateChangedEventHandler(droneControl_NetworkConnectionStateChanged_Sync), sender, e);
     if (e.State == DroneNetworkConnectionState.ScanningForNewNetworks)
     {
         UpdateUISync("Drono tinklo paieška");
     }
     if (e.State == DroneNetworkConnectionState.TryingToConnect)
     {
         UpdateUISync("Bandoma prisijungti prie Drono");
     }
     if (e.State == DroneNetworkConnectionState.PingSuccesful)
     {
         UpdateUISync("Ping sėkmingas");
         Connect();
     }
     if (e.State == DroneNetworkConnectionState.NotConnected)
     {
         UpdateUISync("Neprisijungė");
     }
 }
 private void UpdateConnectionStateLabel(DroneNetworkConnectionStateChangedEventArgs e)
 {
     if (e.State == DroneNetworkConnectionState.NotConnected)
         labelProgress.Content = "Not connected";
     if (e.State == DroneNetworkConnectionState.ScanningForNewNetworks)
         labelProgress.Content = e.CurrentInterfaceName + ": Scanning network ...";
     else if (e.State == DroneNetworkConnectionState.TryingToConnect)
         labelProgress.Content =  e.CurrentInterfaceName + ": Trying to connect to drone network ...";
     else if (e.State == DroneNetworkConnectionState.ConnectedToNetwork)
         labelProgress.Content = e.CurrentInterfaceName + ": Connected to drone network, pinging (" + e.CurrentPingRetries + "/" + e.MaxPingRetries + ") ...";
     else if (e.State == DroneNetworkConnectionState.PingSuccesful)
         labelProgress.Content = e.CurrentInterfaceName + ": Ping successful, starting main program ...";
 }
 private void droneControl_NetworkConnectionStateChanged_Sync(object sender, DroneNetworkConnectionStateChangedEventArgs e)
 {
     HandleConnectionStateChange(e);
 }
 private void droneControl_NetworkConnectionStateChanged_Async(object sender, DroneNetworkConnectionStateChangedEventArgs e)
 {
     Dispatcher.BeginInvoke(new DroneNetworkConnectionStateChangedEventHandler(droneControl_NetworkConnectionStateChanged_Sync), sender, e);
 }
예제 #6
0
 private void networkConnector_ConnectionStateChanged(object sender, DroneNetworkConnectionStateChangedEventArgs e)
 {
     InvokeNetworkConnectionStateChange(e);
 }
예제 #7
0
        private void InvokeNetworkConnectionStateChange(DroneNetworkConnectionStateChangedEventArgs e)
        {
            if (e.State == DroneNetworkConnectionState.PingSuccesful)
            {
                if (connectToBothNetworkAndDrone)
                    ConnectDrone();
                else
                    connecting = false;
            }

            if (NetworkConnectionStateChanged != null)
                NetworkConnectionStateChanged.Invoke(this, e);
        }
예제 #8
0
 void droneControl_NetworkConnectionStateChanged(object sender, DroneNetworkConnectionStateChangedEventArgs e)
 {
     if ( this.NetworkConnectionStateChanged != null )
     {
         this.NetworkConnectionStateChanged( sender, "(" + e.CurrentInterfaceName + ")" + e.State.ToString() );
     }
 }