/// This event handler is called whenever the soft buttons are pressed or released. private void monoDeviceSoftButtonsChanged(object sender, LcdSoftButtonsEventArgs e) { LcdDevice device = (LcdDevice)sender; // First button if ((e.SoftButtons & LcdSoftButtons.Button0) == LcdSoftButtons.Button0) { m_showTitles = !m_showTitles; } // Second button if ((e.SoftButtons & LcdSoftButtons.Button1) == LcdSoftButtons.Button1) { } // Third button if ((e.SoftButtons & LcdSoftButtons.Button2) == LcdSoftButtons.Button2) { } // Fourth button if ((e.SoftButtons & LcdSoftButtons.Button3) == LcdSoftButtons.Button3) { //m_keepRunning = false; } }
public override void buttonPressedMonochrome(object sender, LcdSoftButtonsEventArgs e) { // First button is pressed, switch to page one if ((e.SoftButtons & LcdSoftButtons.Button0) == LcdSoftButtons.Button0) { plugin_.goToPreviousPage(); } // Second button is pressed else if (((e.SoftButtons & LcdSoftButtons.Button1) == LcdSoftButtons.Button1) && !synchronized_) { if (lyricsPosition_ > 0) { lyricsPosition_--; } } // Third button is pressed else if ((e.SoftButtons & LcdSoftButtons.Button2) == LcdSoftButtons.Button2 && !synchronized_) { if (lyricsPosition_ < lyrics_.Count) { lyricsPosition_++; } } // Fourth button is pressed else if ((e.SoftButtons & LcdSoftButtons.Button3) == LcdSoftButtons.Button3) { plugin_.goToNextPage(); } }
void _Device_SoftButtonsChanged(object sender, LcdSoftButtonsEventArgs e) { if (this.CurrentPage is MyLcdGdiPage) { ((MyLcdGdiPage)this.CurrentPage).OnSoftButtonsChanged(e); } }
internal void OnSoftButtonsChanged(LcdSoftButtonsEventArgs e) { if (this.SoftButtonsChanged != null) { this.SoftButtonsChanged(this, e); } }
public override void buttonPressedMonochrome(object sender, LcdSoftButtonsEventArgs e) { // First button is pressed, switch to page one if ((e.SoftButtons & LcdSoftButtons.Button0) == LcdSoftButtons.Button0) { if (index_ != 0) { plugin_.goToPreviousPage(); } else { plugin_.changePlayState(controlSelected_); } } // Second button is pressed else if (((e.SoftButtons & LcdSoftButtons.Button1) == LcdSoftButtons.Button1)) { if (controlSelected_ != 0) { controlSelected_ -= 1; } for (int i = 0; i < controlsGdi_.Length; i++) { controlsGdi_[i].HorizontalAlignment = LcdGdiHorizontalAlignment.Left; } controlsGdi_[controlSelected_].HorizontalAlignment = LcdGdiHorizontalAlignment.Center; } // Third button is pressed else if ((e.SoftButtons & LcdSoftButtons.Button2) == LcdSoftButtons.Button2) { if (controlSelected_ != 4) { controlSelected_ += 1; } for (int i = 0; i < controlsGdi_.Length; i++) { controlsGdi_[i].HorizontalAlignment = LcdGdiHorizontalAlignment.Left; } controlsGdi_[controlSelected_].HorizontalAlignment = LcdGdiHorizontalAlignment.Center; } // Fourth button is pressed else if ((e.SoftButtons & LcdSoftButtons.Button3) == LcdSoftButtons.Button3) { if (index_ == 0) { plugin_.goToNextPage(); } else { plugin_.changePlayState(controlSelected_); } } }
/// <summary> /// This event handler is called whenever the soft buttons are pressed or released. /// </summary> private static void MonoDevice_SoftButtonsChanged(object sender, LcdSoftButtonsEventArgs e) { LcdDevice device = (LcdDevice)sender; Console.WriteLine(e.SoftButtons); // First button (remember that buttons start at index 0) is pressed, switch to page one if ((e.SoftButtons & LcdSoftButtons.Button0) == LcdSoftButtons.Button0) { device.CurrentPage = device.Pages[0]; } // Second button is pressed, switch to page two if ((e.SoftButtons & LcdSoftButtons.Button1) == LcdSoftButtons.Button1) { device.CurrentPage = device.Pages[1]; } // Third button is pressed, do a garbage collection (for testing purpose only!) if ((e.SoftButtons & LcdSoftButtons.Button2) == LcdSoftButtons.Button2) { GC.Collect(); } // Fourth button is pressed, exit if ((e.SoftButtons & LcdSoftButtons.Button3) == LcdSoftButtons.Button3) { _mustExit = true; } }
/// This event handler is called whenever the soft buttons are pressed or released. private void monoDeviceSoftButtonsChanged(object sender, LcdSoftButtonsEventArgs e) { LcdDevice device = (LcdDevice)sender; // First button if ((e.SoftButtons & LcdSoftButtons.Button0) == LcdSoftButtons.Button0) { m_showTitles = !m_showTitles; } // Second button if ((e.SoftButtons & LcdSoftButtons.Button1) == LcdSoftButtons.Button1) { keybd_event(Convert.ToByte(Keys.MediaPreviousTrack), 0, 0x00, 0); //KEYDOWN PrevTrack Key keybd_event(Convert.ToByte(Keys.MediaPreviousTrack), 0, 0x02, 0); //KEYUP PrevTrack Key } // Third button if ((e.SoftButtons & LcdSoftButtons.Button2) == LcdSoftButtons.Button2) { keybd_event(Convert.ToByte(Keys.MediaPlayPause), 0, 0x00, 0); //KEYDOWN PlayPause Key keybd_event(Convert.ToByte(Keys.MediaPlayPause), 0, 0x02, 0); //KEYUP PlayPause Key } // Fourth button if ((e.SoftButtons & LcdSoftButtons.Button3) == LcdSoftButtons.Button3) { //m_keepRunning = false; keybd_event(Convert.ToByte(Keys.MediaNextTrack), 0, 0x00, 0); //KEYDOWN NextTrack Key keybd_event(Convert.ToByte(Keys.MediaNextTrack), 0, 0x02, 0); //KEYUP NextTrack Key } }
void NewMessage_SoftButtonsChanged(object sender, LcdSoftButtonsEventArgs e) { if (e.SoftButtons == LcdSoftButtons.None) { return; } if (e.SoftButtons == LcdSoftButtons.Button3) { _Device.SetAsForegroundApplet = false; } }
public override void buttonPressedColor(object sender, LcdSoftButtonsEventArgs e) { if ((e.SoftButtons & LcdSoftButtons.Left) == LcdSoftButtons.Left) { plugin_.goToPreviousPage(); } //G19 up button pressed else if ((e.SoftButtons & LcdSoftButtons.Up) == LcdSoftButtons.Up) { if (controlSelected_ != 0) { controlSelected_ -= 1; } for (int i = 0; i < controlsGdi_.Length; i++) { controlsGdi_[i].HorizontalAlignment = LcdGdiHorizontalAlignment.Left; } controlsGdi_[controlSelected_].HorizontalAlignment = LcdGdiHorizontalAlignment.Center; } //G19 down button pressed else if ((e.SoftButtons & LcdSoftButtons.Down) == LcdSoftButtons.Down) { if (controlSelected_ != controlsGdi_.Length - 1) { controlSelected_ += 1; } for (int i = 0; i < controlsGdi_.Length; i++) { controlsGdi_[i].HorizontalAlignment = LcdGdiHorizontalAlignment.Left; } controlsGdi_[controlSelected_].HorizontalAlignment = LcdGdiHorizontalAlignment.Center; } //G19 Right button else if ((e.SoftButtons & LcdSoftButtons.Right) == LcdSoftButtons.Right) { plugin_.goToNextPage(); } //G19 Ok button else if ((e.SoftButtons & LcdSoftButtons.Ok) == LcdSoftButtons.Ok) { plugin_.changePlayState(controlSelected_); } }
private void buttonPressed(object sender, LcdSoftButtonsEventArgs e) { LcdDevice device = (LcdDevice)sender; if (device.DeviceType == LcdDeviceType.Monochrome) { lcdScreenList_[currentPage_].buttonPressedMonochrome(sender, e); } else if (device.DeviceType == LcdDeviceType.Qvga) { lcdScreenList_[currentPage_].buttonPressedColor(sender, e); } }
/// <summary> /// When soft buttons are pressed, switch to previous image if left arrow button was clicked, /// switch to next if the right arrow button was clicked, or closes the application if /// the cancel button was clicked. /// </summary> private void QvgaDevice_SoftButtonsChanged(object sender, LcdSoftButtonsEventArgs e) { if ((e.SoftButtons & LcdSoftButtons.Cancel) == LcdSoftButtons.Cancel) { Invoke(Shutdown); } else if ((e.SoftButtons & LcdSoftButtons.Left) == LcdSoftButtons.Left) { Invoke(_sampleControl.PreviousImage); } else if ((e.SoftButtons & LcdSoftButtons.Right) == LcdSoftButtons.Right) { Invoke(_sampleControl.NextImage); } }
public override void buttonPressedColor(object sender, LcdSoftButtonsEventArgs e) { if ((e.SoftButtons & LcdSoftButtons.Left) == LcdSoftButtons.Left) { plugin_.goToPreviousPage(); } //G19 up button pressed else if ((e.SoftButtons & LcdSoftButtons.Up) == LcdSoftButtons.Up) { volume_ += volumeChanger_; if (volume_ > 1) { volume_ = 1; } plugin_.changeVolume(volume_); } //G19 down button pressed else if ((e.SoftButtons & LcdSoftButtons.Down) == LcdSoftButtons.Down) { volume_ -= volumeChanger_; if (volume_ < 0) { volume_ = 0; } plugin_.changeVolume(volume_); } //G19 Right button else if ((e.SoftButtons & LcdSoftButtons.Right) == LcdSoftButtons.Right) { plugin_.goToNextPage(); } //G19 Ok button else if ((e.SoftButtons & LcdSoftButtons.Ok) == LcdSoftButtons.Ok) { } }
public override void buttonPressedColor(object sender, LcdSoftButtonsEventArgs e) { if ((e.SoftButtons & LcdSoftButtons.Left) == LcdSoftButtons.Left) { plugin_.goToPreviousPage(); } //G19 up button pressed else if ((e.SoftButtons & LcdSoftButtons.Up) == LcdSoftButtons.Up) { if (rating_ != 5) { rating_ += 0.5f; plugin_.changeRating(rating_); } plugin_.getSongData(); } //G19 down button pressed else if ((e.SoftButtons & LcdSoftButtons.Down) == LcdSoftButtons.Down) { if (rating_ != 0) { rating_ -= 0.5f; plugin_.changeRating(rating_); } plugin_.getSongData(); } //G19 Right button else if ((e.SoftButtons & LcdSoftButtons.Right) == LcdSoftButtons.Right) { plugin_.goToNextPage(); } //G19 Ok button else if ((e.SoftButtons & LcdSoftButtons.Ok) == LcdSoftButtons.Ok) { } }
public override void buttonPressedMonochrome(object sender, LcdSoftButtonsEventArgs e) { // First button is pressed, switch to page one if ((e.SoftButtons & LcdSoftButtons.Button0) == LcdSoftButtons.Button0) { plugin_.goToPreviousPage(); } // Second button is pressed else if (((e.SoftButtons & LcdSoftButtons.Button1) == LcdSoftButtons.Button1)) { volume_ -= volumeChanger_; if (volume_ < 0) { volume_ = 0; } plugin_.changeVolume(volume_); } // Third button is pressed else if ((e.SoftButtons & LcdSoftButtons.Button2) == LcdSoftButtons.Button2) { volume_ += volumeChanger_; if (volume_ > 1) { volume_ = 1; } plugin_.changeVolume(volume_); } // Fourth button is pressed else if ((e.SoftButtons & LcdSoftButtons.Button3) == LcdSoftButtons.Button3) { plugin_.goToNextPage(); } }
/// This event handler is called whenever the soft buttons are pressed or released. private void MonoDeviceSoftButtonsChanged(object sender, LcdSoftButtonsEventArgs e) { var device = (LcdDevice)sender; // First button if ((e.SoftButtons & LcdSoftButtons.Button0) == LcdSoftButtons.Button0) { button1Pressed = true; } if ((e.SoftButtons & LcdSoftButtons.Button1) == LcdSoftButtons.Button0) { //button2Pressed = true; } if ((e.SoftButtons & LcdSoftButtons.Button2) == LcdSoftButtons.Button0) { //button3Pressed = true; } if ((e.SoftButtons & LcdSoftButtons.Button3) == LcdSoftButtons.Button0) { //button4Pressed = true; } }
public override void buttonPressedMonochrome(object sender, LcdSoftButtonsEventArgs e) { // First button is pressed, switch to page one if ((e.SoftButtons & LcdSoftButtons.Button0) == LcdSoftButtons.Button0) { plugin_.goToPreviousPage(); } // Second button is pressed else if (((e.SoftButtons & LcdSoftButtons.Button1) == LcdSoftButtons.Button1)) { if (rating_ != 0) { rating_ -= 0.5f; plugin_.changeRating(rating_); } plugin_.getSongData(); } // Third button is pressed else if ((e.SoftButtons & LcdSoftButtons.Button2) == LcdSoftButtons.Button2) { if (rating_ != 5) { rating_ += 0.5f; plugin_.changeRating(rating_); } plugin_.getSongData(); } // Fourth button is pressed else if ((e.SoftButtons & LcdSoftButtons.Button3) == LcdSoftButtons.Button3) { plugin_.goToNextPage(); } }
public override void buttonPressedColor(object sender, LcdSoftButtonsEventArgs e) { if ((e.SoftButtons & LcdSoftButtons.Left) == LcdSoftButtons.Left) { plugin_.goToPreviousPage(); } //G19 up button pressed else if ((e.SoftButtons & LcdSoftButtons.Up) == LcdSoftButtons.Up && !synchronized_) { if (lyricsPosition_ > 0) { lyricsPosition_--; } } //G19 down button pressed else if ((e.SoftButtons & LcdSoftButtons.Down) == LcdSoftButtons.Down && !synchronized_) { if (lyricsPosition_ < lyrics_.Count) { lyricsPosition_++; } } //G19 Right button else if ((e.SoftButtons & LcdSoftButtons.Right) == LcdSoftButtons.Right) { plugin_.goToNextPage(); } //G19 Ok button else if ((e.SoftButtons & LcdSoftButtons.Ok) == LcdSoftButtons.Ok) { } }
public override void buttonPressedMonochrome(object sender, LcdSoftButtonsEventArgs e) { if ((e.SoftButtons & LcdSoftButtons.Button0) == LcdSoftButtons.Button0) { if (index_ == 0) { switch (settingSelected_) { case 0: shuffle_ = !shuffle_; this.settingsGdi_[0].Text = "shuffle_: " + shuffle_; break; case 1: autoDJ_ = !autoDJ_; this.settingsGdi_[1].Text = "Auto DJ: " + autoDJ_; break; case 2: equaliser_ = !equaliser_; settingsGdi_[2].Text = "Equalizer: " + equaliser_; break; case 3: if (repeatSelected_ == 2) { repeatSelected_ = 0; } else { repeatSelected_++; } repeat_ = repeatArray_[repeatSelected_]; settingsGdi_[3].Text = "Repeat: " + repeat_; break; } ; plugin_.changeSettings(autoDJ_, equaliser_, shuffle_, repeat_); } else { plugin_.goToPreviousPage(); } } else if (((e.SoftButtons & LcdSoftButtons.Button1) == LcdSoftButtons.Button1)) { if (settingSelected_ != 0) { settingSelected_ -= 1; } for (int i = 0; i < settingsGdi_.Length; i++) { settingsGdi_[i].HorizontalAlignment = LcdGdiHorizontalAlignment.Left; } settingsGdi_[settingSelected_].HorizontalAlignment = LcdGdiHorizontalAlignment.Center; } // Third button is pressed else if ((e.SoftButtons & LcdSoftButtons.Button2) == LcdSoftButtons.Button2) { if (settingSelected_ != 3) { settingSelected_ += 1; } for (int i = 0; i < settingsGdi_.Length; i++) { settingsGdi_[i].HorizontalAlignment = LcdGdiHorizontalAlignment.Left; } settingsGdi_[settingSelected_].HorizontalAlignment = LcdGdiHorizontalAlignment.Center; } else if ((e.SoftButtons & LcdSoftButtons.Button3) == LcdSoftButtons.Button3) { if (index_ != 0) { switch (settingSelected_) { case 0: shuffle_ = !shuffle_; this.settingsGdi_[0].Text = "shuffle_: " + shuffle_; break; case 1: autoDJ_ = !autoDJ_; this.settingsGdi_[1].Text = "Auto DJ: " + autoDJ_; break; case 2: equaliser_ = !equaliser_; settingsGdi_[2].Text = "Equalizer: " + equaliser_; break; case 3: if (repeatSelected_ == 2) { repeatSelected_ = 0; } else { repeatSelected_++; } repeat_ = repeatArray_[repeatSelected_]; settingsGdi_[3].Text = "Repeat: " + repeat_; break; } ; plugin_.changeSettings(autoDJ_, equaliser_, shuffle_, repeat_); } else { plugin_.goToNextPage(); } } }
/// <summary> /// This event handler is called whenever the soft buttons are pressed or released. /// </summary> private static void MonoDevice_SoftButtonsChanged(object sender, LcdSoftButtonsEventArgs e) { LcdDevice device = (LcdDevice)sender; Console.WriteLine(e.SoftButtons); // First button (remember that buttons start at index 0) is pressed, switch to page one if ((e.SoftButtons & LcdSoftButtons.Button0) == LcdSoftButtons.Button0) { RespawnDateTimes[(int) Mobs.Baron] = DateTime.Now.AddSeconds(RespawnTimes[(int)Mobs.Baron]); isMobDead[(int)Mobs.Baron] = true; } // Second button is pressed, switch to page two if ((e.SoftButtons & LcdSoftButtons.Button1) == LcdSoftButtons.Button1) { RespawnDateTimes[(int)Mobs.Dragon] = DateTime.Now.AddSeconds(RespawnTimes[(int)Mobs.Dragon]); isMobDead[(int)Mobs.Dragon] = true; } // Third button is pressed, do a garbage collection (for testing purpose only!) if ((e.SoftButtons & LcdSoftButtons.Button2) == LcdSoftButtons.Button2) { var mobIndex = 2 + Current_CampIndex; RespawnDateTimes[mobIndex] = DateTime.Now.AddSeconds(RespawnTimes[mobIndex]); isMobDead[mobIndex] = true; } // Fourth button is pressed, exit if ((e.SoftButtons & LcdSoftButtons.Button3) == LcdSoftButtons.Button3) { Current_CampIndex = (Current_CampIndex + 1) % 4; SoundPlayer.Stream = LoLTimer.Resources.snd_scroll; SoundPlayer.Play(); var line = ((LcdGdiLine)Page_MainPage.Children.Find(child => (String)child.Tag == "currentSelectionLine")); var mobIndex = 2 + Current_CampIndex; var textElement = getPageTextElement(Page_MainPage, TagNames[mobIndex]); line.StartPoint = new PointF(textElement.AbsolutePosition.X + 2, textElement.AbsolutePosition.Y + 10); line.EndPoint = new PointF((textElement.AbsolutePosition + textElement.FinalSize).X + 1, (textElement.AbsolutePosition + textElement.FinalSize).Y); } else if (e.SoftButtons > 0) { SoundPlayer.Stream = LoLTimer.Resources.snd_select; SoundPlayer.Play(); } }
public override void buttonPressedColor(object sender, LcdSoftButtonsEventArgs e) { //G19 up button pressed if ((e.SoftButtons & LcdSoftButtons.Up) == LcdSoftButtons.Up) { if (volumeActive_) { volume_ += volumeChanger_; if (volume_ > 1) { volume_ = 1; } plugin_.changeVolume(volume_); } else { if (settingSelected_ != 0) { settingSelected_ -= 1; } } for (int i = 0; i < settingsGdi_.Length; i++) { settingsGdi_[i].HorizontalAlignment = LcdGdiHorizontalAlignment.Left; } settingsGdi_[settingSelected_].HorizontalAlignment = LcdGdiHorizontalAlignment.Center; } //G19 down button pressed else if ((e.SoftButtons & LcdSoftButtons.Down) == LcdSoftButtons.Down) { if (volumeActive_) { volume_ -= volumeChanger_; if (volume_ < 0) { volume_ = 0; } plugin_.changeVolume(volume_); } else { if (settingSelected_ != this.settingsGdi_.Length - 1) { settingSelected_ += 1; } } for (int i = 0; i < settingsGdi_.Length; i++) { settingsGdi_[i].HorizontalAlignment = LcdGdiHorizontalAlignment.Left; } settingsGdi_[settingSelected_].HorizontalAlignment = LcdGdiHorizontalAlignment.Center; } //G19 Ok button else if ((e.SoftButtons & LcdSoftButtons.Ok) == LcdSoftButtons.Ok) { switch (settingSelected_) { case 0: shuffle_ = !shuffle_; settingsGdi_[0].Text = "Shuffle: " + shuffle_; break; case 1: autoDJ_ = !autoDJ_; settingsGdi_[1].Text = "Auto DJ: " + autoDJ_; break; case 2: equaliser_ = !equaliser_; settingsGdi_[2].Text = "Equalizer: " + equaliser_; break; case 3: if (repeatSelected_ == 2) { repeatSelected_ = 0; } else { repeatSelected_++; } repeat_ = repeatArray_[repeatSelected_]; settingsGdi_[3].Text = "Repeat: " + repeat_; break; case 4: volumeActive_ = !volumeActive_; break; } ; } else if ((e.SoftButtons & LcdSoftButtons.Left) == LcdSoftButtons.Left) { plugin_.goToPreviousPage(); } else if ((e.SoftButtons & LcdSoftButtons.Right) == LcdSoftButtons.Right) { plugin_.goToNextPage(); } }
private static void MonoDevice_SoftButtonsChanged(object sender, LcdSoftButtonsEventArgs e) { LcdDevice device = (LcdDevice)sender; Console.WriteLine(e.SoftButtons); // First button (remember that buttons start at index 0) is pressed, switch to page one if ((e.SoftButtons & LcdSoftButtons.Button0) == LcdSoftButtons.Button0) _forceUpdate = true; // Second button is pressed, switch to page two //if ((e.SoftButtons & LcdSoftButtons.Button1) == LcdSoftButtons.Button1) //device.CurrentPage = device.Pages[1]; // Third button is pressed, do a garbage collection (for testing purpose only!) if ((e.SoftButtons & LcdSoftButtons.Button2) == LcdSoftButtons.Button2) GC.Collect(); // Fourth button is pressed, exit if ((e.SoftButtons & LcdSoftButtons.Button3) == LcdSoftButtons.Button3) _mustExit = true; }
static void _device_SoftButtonsChanged(object sender, LcdSoftButtonsEventArgs e) { if (_inConfigMode) { return; } if ((e.SoftButtons & LcdSoftButtons.Button0) == LcdSoftButtons.Button0) { ConsoleReporter.Report("BUTTON_0 pressed", ConsoleReporter.ReportStatus.Error, _logEnabled); if (_exitQuestion) { _mustExit = true; return; } sview.MoveSelectorUp(); } if ((e.SoftButtons & LcdSoftButtons.Button1) == LcdSoftButtons.Button1) { ConsoleReporter.Report("BUTTON_1 pressed", ConsoleReporter.ReportStatus.Error, _logEnabled); if (_exitQuestion) { return; } sview.MoveSelectorDown(); } if ((e.SoftButtons & LcdSoftButtons.Button2) == LcdSoftButtons.Button2) { ConsoleReporter.Report("BUTTON_2 pressed", ConsoleReporter.ReportStatus.Error, _logEnabled); if (_exitQuestion) { return; } sview.ExecuteSelected(); } if ((e.SoftButtons & LcdSoftButtons.Button3) == LcdSoftButtons.Button3) { ConsoleReporter.Report("BUTTON_3 pressed", ConsoleReporter.ReportStatus.Error, _logEnabled); if (sview.ConfigButtonsEnabled) { ConsoleReporter.Report("Config pressed", ConsoleReporter.ReportStatus.None, _logEnabled); _applet_Configure(null, null); return; } if (_exitQuestion) { _currentPageIndex = 0; _exitQuestion = false; ConsoleReporter.Report("_EXITQUESTION disabled", ConsoleReporter.ReportStatus.None, _logEnabled); return; } else { _currentPageIndex = 1; _exitQuestion = true; ConsoleReporter.Report("_EXITQUESTION enabled", ConsoleReporter.ReportStatus.None, _logEnabled); return; } } }
//public virtual void createMono() //{ //} //public virtual void createColor() //{ //} //public virtual void buttonPressed(object sender, LcdSoftButtonsEventArgs e) //{ //} public virtual void buttonPressedMonochrome(object sender, LcdSoftButtonsEventArgs e) { }
public virtual void buttonPressedColor(object sender, LcdSoftButtonsEventArgs e) { }
/// <summary> /// When soft buttons are pressed, switch to previous image if left arrow button was clicked, /// switch to next if the right arrow button was clicked, or closes the application if /// the cancel button was clicked. /// </summary> private void LcdDeviceSoftButtonsChanged(object sender, LcdSoftButtonsEventArgs e) { if ((e.SoftButtons & LcdSoftButtons.Cancel) == LcdSoftButtons.Cancel) { this.Invoke(this.Shutdown); } }
/// <summary> /// Event handler for button press on a device. /// </summary> /// <param name="sender">Device on which button was pressed</param> /// <param name="e">Button event arguments</param> private static void DeviceSoftButtonsChanged(object sender, LcdSoftButtonsEventArgs e) { LcdDeviceMonochrome device = (LcdDeviceMonochrome)sender; // First button if ((e.SoftButtons & LcdSoftButtons.Button0) == LcdSoftButtons.Button0) { if (button0Up) { button0Up = false; if (device.CurrentPage == device.Pages[0]) { DecrementListState(ref devicesList); } else if (device.CurrentPage == device.Pages[2]) { DecrementListState(ref entriesList); } } } else { button0Up = true; } // Second button if ((e.SoftButtons & LcdSoftButtons.Button1) == LcdSoftButtons.Button1) { if (button1Up) { button1Up = false; if (device.CurrentPage == device.Pages[0]) { IncrementListState(ref devicesList, 3); } else if (device.CurrentPage == device.Pages[2]) { IncrementListState(ref entriesList, 3); } } } else { button1Up = true; } // Third button if ((e.SoftButtons & LcdSoftButtons.Button2) == LcdSoftButtons.Button2) { if (button2Up) { button2Up = false; if (device.CurrentPage == device.Pages[0]) { lock (devicesList.Lock) { if (devicesList.Items != null && devicesList.Items.Length > 0) { actions.Add(Action.Connect); device.Pages[1].SetAsCurrentDevicePage(); } } } else if (device.CurrentPage == device.Pages[1] && ccid == null) { actions.Add(Action.Connect); } else if (device.CurrentPage == device.Pages[2]) { lock (entriesList.Lock) { if (entryCode.HasValue && !entryCode.Value.Credential.Name.Equals(entriesList.Items[entriesList.Selected].Name)) { // Reset code object entryCode = null; // Reset text elements LcdGdiPage page = (LcdGdiPage)device.Pages[3]; LcdGdiScrollViewer scrollView = (LcdGdiScrollViewer)page.Children[4]; LcdGdiText textName = (LcdGdiText)scrollView.Child; LcdGdiText textCode = (LcdGdiText)page.Children[5]; textName.Text = null; textCode.Text = null; } } device.Pages[3].SetAsCurrentDevicePage(); } else if (device.CurrentPage == device.Pages[3]) { lock (entriesList.Lock) { LcdGdiPage page = (LcdGdiPage)device.Pages[3]; LcdGdiImage refreshIcon = (LcdGdiImage)page.Children[0]; if (refreshIcon.IsVisible) { entryCode = null; } } } } } else { button2Up = true; } // Fourth button if ((e.SoftButtons & LcdSoftButtons.Button3) == LcdSoftButtons.Button3) { if (button3Up) { button3Up = false; if (device.CurrentPage == device.Pages[1] || device.CurrentPage == device.Pages[2]) { device.Pages[0].SetAsCurrentDevicePage(); } else if (device.CurrentPage == device.Pages[3]) { device.Pages[2].SetAsCurrentDevicePage(); } } } else { button3Up = true; } }
void _device_SoftButtonsChanged(object sender, LcdSoftButtonsEventArgs e) { TriggerEvent(OnButtonPress, e.SoftButtons); }
static void Device_SoftButtonsChanged(object sender, LcdSoftButtonsEventArgs e) { if (e.SoftButtons == LcdSoftButtons.Button0) { Console.WriteLine("Button 1 "); if (CurrentIndex >= 1) { CurrentIndex -= 1; Device.DoUpdateAndDraw(); } } if (e.SoftButtons == LcdSoftButtons.Button1) { Console.WriteLine("Button 2 "); if (CurrentIndex + 4 <= Process.GetProcesses().Length) { CurrentIndex += 1; CreateGDIPages(); //Device.DoUpdateAndDraw(); } } if (e.SoftButtons == LcdSoftButtons.Button2) { Console.WriteLine("Kill... " + GetProcesses()[CurrentIndex].ProcessName); GetProcesses()[CurrentIndex].Kill(); Device.DoUpdateAndDraw(); } if (e.SoftButtons == LcdSoftButtons.Button3) { _mustExit = true; } }