private void GetPinsFromClipboard() { var clipboard = Clipboard.GetText(); var pins = Chime.GetPinsFromText(clipboard); if (pins.Count > 0) { txtPin.Text = pins[0]; } }
/// <summary> /// Plays a beep based on the given chime. /// </summary> private void PlayChime(Chime chime) { switch (chime) { case Chime.High: Console.Beep(392, 500); break; case Chime.Medium: Console.Beep(262, 500); break; case Chime.Low: Console.Beep(220, 500); break; } }
private void btnJoin_Click(object sender, RoutedEventArgs e) { var pins = Chime.GetPinsFromText(txtPin.Text); // unlikely to be multiple pins, just take the first one if (pins.Count > 0) { Chime.Join(pins[0]); } else if (!string.IsNullOrEmpty(txtPin.Text)) { // if there are no extracted pins, but there is text then just use that text Chime.Join(txtPin.Text); } Close(); }
private static HashSet <string> GetPins(AppointmentItem appointment) { var rv = new List <string>(); rv.AddRange(Chime.GetPinsFromAttendees(appointment.OptionalAttendees)); rv.AddRange(Chime.GetPinsFromAttendees(appointment.RequiredAttendees)); rv.AddRange(Chime.GetPinsFromText(appointment.Location)); rv.AddRange(Chime.GetPinsFromText(appointment.Body)); /* * Debug.WriteLine(appointment.Start + " -> " + appointment.End + ": " + appointment.Subject + "\n\tLocation: " + appointment.Location + * "\n\tRequired Attendees: " + appointment.RequiredAttendees + "\n\tOptional Attendees: " + appointment.OptionalAttendees); * Debug.WriteLine("\tPins: " + string.Join("\n\t", rv)); */ return(new HashSet <string>(rv)); }
/// <summary> /// This method will be called by the sensor when a door status changes. /// It happens in real time. The main can go about whatever business it wants to do. /// </summary> /// <param name="vanDoors">The states of the doors</param> private static void ProcessSensorOutput(SynchronizedCollection <VanDoor> vanDoors) { Console.WriteLine("Door status changed"); for (int i = 0; i < vanDoors.Count; i++) { Console.WriteLine(" " + vanDoors[i].doorType.ToString() + ": " + vanDoors[i].doorStatus.ToString()); if (vanDoors[i].doorType.ToString() == "DriverSide" && vanDoors[i].doorStatus == VanDoor.DoorStatus.Open) { if (!isChiming) { Chime.PlayChime(); } isChiming = true; } if (vanDoors[i].doorType.ToString() == "DriverSide" && vanDoors[i].doorStatus == VanDoor.DoorStatus.Closed) { Chime.StopChime(); isChiming = false; } } }