static void powerMateManager_KnobDisplacement(object sender, PowerMateEventArgs e) { Console.WriteLine("PowerMate knob displacement event"); Console.WriteLine("PowerMate state button: {0}", (e.State.ButtonState == PowerMateButtonState.Up ? "Up" : "Down")); Console.WriteLine("PowerMate state knob displacement: {0}", e.State.KnobDisplacement); //Console.WriteLine("PowerMate led brightness: {0}", e.State.LedBrightness); //Console.WriteLine("PowerMate led pulse enabled: {0}", e.State.LedPulseEnabled ? "Yes" : "No"); //Console.WriteLine("PowerMate led pulse during sleep enabled: {0}", e.State.LedPulseDuringSleepEnabled ? "Yes" : "No"); //Console.WriteLine("PowerMate led pulse speed: {0}", e.State.LedPulseSpeed); }
static void powerMateManager_KnobDisplacement(object sender, PowerMateEventArgs e) { Console.WriteLine("PowerMate knob displacement event"); Console.WriteLine("PowerMate state button: {0}", (e.State.ButtonState == PowerMateButtonState.Up ? "Up" : "Down")); Console.WriteLine("PowerMate state knob displacement: {0}", e.State.KnobDisplacement); //Console.WriteLine("PowerMate led brightness: {0}", e.State.LedBrightness); //Console.WriteLine("PowerMate led pulse enabled: {0}", e.State.LedPulseEnabled ? "Yes" : "No"); //Console.WriteLine("PowerMate led pulse during sleep enabled: {0}", e.State.LedPulseDuringSleepEnabled ? "Yes" : "No"); //Console.WriteLine("PowerMate led pulse speed: {0}", e.State.LedPulseSpeed); }
static void powerMateManager_ButtonDown(object sender, PowerMateEventArgs e) { Console.WriteLine("PowerMate button down event"); Console.WriteLine("PowerMate state button: {0}", (e.State.ButtonState == PowerMateButtonState.Up ? "Up" : "Down")); Console.WriteLine("PowerMate state knob displacement: {0}", e.State.KnobDisplacement); }
private void powerMateManager_KnobDisplacement(object sender, PowerMateEventArgs e) { if (InvokeRequired) { // Event can be received on a separate thread, so we need to push the message // back on the GUI thread before we execute. BeginInvoke(new Action<object, PowerMateEventArgs>(powerMateManager_KnobDisplacement), sender, e); return; } UpdateGUIFromState(e.State); if (!e.State.LedPulseEnabled) { // Set LED brightness int range = rotationProgressBar.Maximum - rotationProgressBar.Minimum + 1; int value = (rotationProgressBar.Value + e.State.KnobDisplacement - rotationProgressBar.Minimum) % range; if (value < 0) value = rotationProgressBar.Maximum + value + 1; else value = rotationProgressBar.Minimum + value; rotationProgressBar.Value = value; int brightness = value * 255 / range; powerMateManager.SetLedBrightness(brightness); ledBrightnessLabel.Text = brightness.ToString(); } else { // Set pulse speed int speed = e.State.LedPulseSpeed + e.State.KnobDisplacement; speed = speed < -32 ? -32 : speed > 32 ? 32 : speed; powerMateManager.SetLedPulseSpeed(speed); ledPulseSpeedLabel.Text = speed.ToString(); } System.Diagnostics.Debug.WriteLine("PowerMate knob displacement event"); System.Diagnostics.Debug.WriteLine(String.Format("PowerMate state button: {0}", (e.State.ButtonState == PowerMateButtonState.Up ? "Up" : "Down"))); System.Diagnostics.Debug.WriteLine(String.Format("PowerMate state knob displacement: {0}", e.State.KnobDisplacement)); //System.Diagnostics.Debug.WriteLine("PowerMate led brightness: {0}", e.State.LedBrightness); //System.Diagnostics.Debug.WriteLine("PowerMate led pulse enabled: {0}", e.State.LedPulseEnabled ? "Yes" : "No"); //System.Diagnostics.Debug.WriteLine("PowerMate led pulse during sleep enabled: {0}", e.State.LedPulseDuringSleepEnabled ? "Yes" : "No"); //System.Diagnostics.Debug.WriteLine("PowerMate led pulse speed: {0}", e.State.LedPulseSpeed); }
private void powerMateManager_ButtonUp(object sender, PowerMateEventArgs e) { if (InvokeRequired) { // Event can be received on a separate thread, so we need to push the message // back on the GUI thread before we execute. BeginInvoke(new Action<object, PowerMateEventArgs>(powerMateManager_ButtonUp), sender, e); return; } UpdateGUIFromState(e.State); ledPulseLabel.Text = !e.State.LedPulseEnabled ? "On" : "Off"; powerMateManager.SetLedPulseEnabled(!e.State.LedPulseEnabled); System.Diagnostics.Debug.WriteLine("PowerMate button up event"); System.Diagnostics.Debug.WriteLine(String.Format("PowerMate state button: {0}", (e.State.ButtonState == PowerMateButtonState.Up ? "Up" : "Down"))); System.Diagnostics.Debug.WriteLine(String.Format("PowerMate state knob displacement: {0}", e.State.KnobDisplacement)); }
public void ButtonUp(object sender, PowerMateEventArgs e) { if (isStarted()) { pressed = false; Light(); SendMessage(0); } //Console.WriteLine("PowerMate button up event"); //Console.WriteLine("PowerMate state button: {0}", (e.State.ButtonState == PowerMateButtonState.Up ? "Up" : "Down")); //Console.WriteLine("PowerMate state knob displacement: {0}", e.State.KnobDisplacement); }
public void ButtonDown(object sender, PowerMateEventArgs e) { if (isStarted()) { pressed = true; Dark(); SendMessage(127); } //Console.WriteLine("PowerMate button down event"); //Console.WriteLine("PowerMate state button: {0}", (e.State.ButtonState == PowerMateButtonState.Up ? "Up" : "Down")); //Console.WriteLine("PowerMate state knob displacement: {0}", e.State.KnobDisplacement); }
static void powerMateManager_ButtonDown(object sender, PowerMateEventArgs e) { Console.WriteLine("PowerMate button down event"); Console.WriteLine("PowerMate state button: {0}", (e.State.ButtonState == PowerMateButtonState.Up ? "Up" : "Down")); Console.WriteLine("PowerMate state knob displacement: {0}", e.State.KnobDisplacement); }