예제 #1
0
 /// <summary>
 /// Handler for the pairing timeout timer, which sets us to 'not pairing' if we haven't paired yet.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void pairingTimeout(Object sender, ElapsedEventArgs e)
 {
     // Only reset our pairing state if we haven't paired, and if this timer is the most recent timer created
     if (_pairingState == PairingState.PairingAttempt && sender == pairingTimeoutTimer)
     {
         this.PairingState   = PairingState.NotPaired;
         pairingTimeoutTimer = null;
     }
 }
예제 #2
0
        /// <summary>
        /// Converts a pairing state to a Brush. This is useful so that if we want to change the color scheme for different states, we only need to do it here.
        /// </summary>
        /// <param name="state"></param>
        /// <returns></returns>
        public static Brush GetBrushFromPairingState(PairingState state)
        {
            switch (state)
            {
            case (PairingState.NotPaired): return(Brushes.DarkRed);

            case (PairingState.PairingAttempt): return(Brushes.Orange);

            case (PairingState.Paired): return(Brushes.Green);

            default: return(Brushes.White);
            }
        }
예제 #3
0
 /// <summary>
 /// Handler for the pairing timeout timer, which sets us to 'not pairing' if we haven't paired yet.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void pairingTimeout(Object sender, ElapsedEventArgs e)
 {
     // Only reset our pairing state if we haven't paired, and if this timer is the most recent timer created
     if (_pairingState == PairingState.PairingAttempt && sender == pairingTimeoutTimer)
     {
         this.PairingState = PairingState.NotPaired;
         pairingTimeoutTimer = null;
     }
 }
예제 #4
0
 private void occludedTimeout(Object sender, ElapsedEventArgs e)
 {
     if (_pairingState == PairingState.PairedButOccluded && sender == occludedTimeoutTimer)
     {
         this.PairingState = PairingState.NotPaired;
         occludedTimeoutTimer = null;
     }
 }
예제 #5
0
        internal PairablePerson CreateTestPerson(int newId, int? holdsId = null, PairingState? pairState = null)
        {
            PairablePerson person = new PairablePerson
            {
                Identifier = newId.ToString(),
                HeldDeviceIdentifier = holdsId.ToString() ?? null,
                Location = null,
                Orientation = null,
                PairingState = pairState ?? PairingState.NotPaired
            };

            return person;
        }
예제 #6
0
        internal PairableDevice CreateTestDevice(int newId, int? heldById = null, PairingState? pairState = null)
        {
            PairableDevice device = new PairableDevice
            {
                Identifier = newId.ToString(),
                HeldByPersonIdentifier = heldById.ToString() ?? null,
                PairingState = pairState ?? PairingState.NotPaired
            };

            return device;
        }
예제 #7
0
 /// <summary>
 /// Converts a pairing state to a Brush. This is useful so that if we want to change the color scheme for different states, we only need to do it here.
 /// </summary>
 /// <param name="state"></param>
 /// <returns></returns>
 public static Brush GetBrushFromPairingState(PairingState state)
 {
     switch (state)
     {
         case (PairingState.NotPaired): return Brushes.DarkRed;
         case (PairingState.PairingAttempt): return Brushes.Orange;
         case (PairingState.Paired): return Brushes.Green;
         default: return Brushes.White;
     }
 }