/// <summary> /// Set the Blink(1) device to display a specific color. /// </summary> /// <param name="colorProcessor"> /// A color object that implements the IColorProcessor interface. /// </param> /// <returns> /// True if the color was successfully applied, False otherwise. /// </returns> public bool SetColor(IColorProcessor colorProcessor) { if (colorProcessor == null) { throw new ArgumentNullException("colorProcessor", "Argument must not be null."); } if (this.IsConnected == false) { throw new InvalidOperationException("No Blink(1) device connected."); } Rgb rgb = colorProcessor.ToRgb(); return(this.SetColor(rgb.Red, rgb.Green, rgb.Blue)); }
/// <summary> /// Set the Blink(1) device to blink with specific color. /// </summary> /// <param name="numberOfTime"> /// Number of times the blink event will occur. /// </param> /// <param name="numberOfMillisecondOn"> /// The number Of millisecond displaying the color. /// </param> /// <param name="numberOfMillisecondOff"> /// The number Of millisecond Off. /// </param> /// <param name="colorProcessor"> /// A color object that implements the IColorProcessor interface. /// </param> public void Blink(ushort numberOfTime, ushort numberOfMillisecondOn, ushort numberOfMillisecondOff, IColorProcessor colorProcessor) { if (colorProcessor == null) { throw new ArgumentNullException("colorProcessor", "Argument must not be null."); } if (this.IsConnected == false) { throw new InvalidOperationException("No Blink(1) device connected."); } Rgb rgb = colorProcessor.ToRgb(); this.Blink(numberOfTime, numberOfMillisecondOn, numberOfMillisecondOff, rgb.Red, rgb.Green, rgb.Blue); }
/// <summary> /// Fade to a color over a period of milliseconds. /// </summary> /// <param name="numberOfMillisecond"> /// The number of milliseconds the fading will last. /// </param> /// <param name="colorProcessor"> /// A color object that implements the IColorProcessor interface. /// </param> /// <param name="waitUntilFinished"> /// Specify to wait (True) or not (False) for the color fade to be finished before giving back the control. /// </param> /// <returns> /// True if the color was successfully applied, False otherwise. /// </returns> public bool FadeToColor(ushort numberOfMillisecond, IColorProcessor colorProcessor, bool waitUntilFinished) { if (colorProcessor == null) { throw new ArgumentNullException("colorProcessor", "Argument must not be null."); } if (this.IsConnected == false) { throw new InvalidOperationException("No Blink(1) device connected."); } Rgb rgb = colorProcessor.ToRgb(); return(this.FadeToColor(numberOfMillisecond, rgb.Red, rgb.Green, rgb.Blue, waitUntilFinished)); }
/// <summary> /// Set the Blink(1) device to display a specific color. /// </summary> /// <param name="colorProcessor"> /// A color object that implements the IColorProcessor interface. /// </param> /// <returns> /// True if the color was successfully applied, False otherwise. /// </returns> public bool SetColor(IColorProcessor colorProcessor) { if (colorProcessor == null) { throw new ArgumentNullException("colorProcessor", "Argument must not be null."); } if (this.IsConnected == false) { throw new InvalidOperationException("No Blink(1) device connected."); } Rgb rgb = colorProcessor.ToRgb(); return this.SetColor(rgb.Red, rgb.Green, rgb.Blue); }
/// <summary> /// Fade to a color over a period of milliseconds. /// </summary> /// <param name="numberOfMillisecond"> /// The number of milliseconds the fading will last. /// </param> /// <param name="colorProcessor"> /// A color object that implements the IColorProcessor interface. /// </param> /// <param name="waitUntilFinished"> /// Specify to wait (True) or not (False) for the color fade to be finished before giving back the control. /// </param> /// <returns> /// True if the color was successfully applied, False otherwise. /// </returns> public bool FadeToColor(ushort numberOfMillisecond, IColorProcessor colorProcessor, bool waitUntilFinished) { if (colorProcessor == null) { throw new ArgumentNullException("colorProcessor", "Argument must not be null."); } if (this.IsConnected == false) { throw new InvalidOperationException("No Blink(1) device connected."); } Rgb rgb = colorProcessor.ToRgb(); return this.FadeToColor(numberOfMillisecond, rgb.Red, rgb.Green, rgb.Blue, waitUntilFinished); }
/// <summary> /// Initializes a new instance of the <see cref="Blink1Preset"/> class. /// </summary> /// <param name="millisecond"> /// The number of milliseconds the fading will last. /// </param> /// <param name="colorProcessor"> /// A color object that implements the IColorProcessor interface. /// </param> public Blink1Preset(ushort millisecond, IColorProcessor colorProcessor) { this.Millisecond = millisecond; this.Rgb = colorProcessor.ToRgb(); }