Esempio n. 1
0
        /// <summary>
        /// Called when a sensor is clicked
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void listViewSensors_DoubleClick(object sender, EventArgs e)
        {
            AntDevice antDevice = (AntDevice)listViewSensors.SelectedItems[0].Tag;

            _fitnessEquipment = antDevice as FitnessEquipment;

            Wasp wasp = antDevice.GetStrongestWasp();

            wasp.ConnectionEvent += Wasp_ConnectionEvent;;
            wasp.RequestConnection();
        }
 /// <summary>
 /// WASP Collection Changed event handler
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 /// <remarks>WASP comes up, get a connection to it</remarks>
 private void WASP_CollectionChangedEvent(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
 {
     if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Add)
     {
         _thisWasp = e.NewItems[0] as Wasp;
         Title    += " connected to " + _thisWasp.Name;
         _thisWasp.ConnectionEvent += WaspConnected;
         _thisWasp.RequestConnection();
     }
     else if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Remove)
     {
         Title = "Configure WASP-N";
         Dispatcher.Invoke(new Action(() => { buttonConf.IsEnabled = false; }));
     }
 }