/// <summary> /// Reset all image buttons to their original state /// </summary> public void resetGroupInitialState() { this.currentDepressedButton = string.Empty; foreach (string s in this.imgControllers.Keys) { if (string.IsNullOrEmpty(s)) { continue; } if (!this.imgControllers.ContainsKey(s)) { continue; } ImageButtonController ibCntrl = this.imgControllers[s]; ibCntrl.resetToOriginalState(); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="action"></param> private void internalEventHandler(object sender, ImageButtonController.ImageButtonAction action) { if ((sender != null) && (sender is Button)) { var btn = (Button)sender; if (btn.Enabled) { string buttonName = this.getButtonName(btn); ImageButtonController imgBtnCntrl = this.imgControllers[buttonName]; if (imgBtnCntrl != null && imgBtnCntrl.Initialized) { bool performAction = true; bool clearDepressed = false; if (action == ImageButtonController.ImageButtonAction.CLICK) { if (!string.IsNullOrEmpty(this.currentDepressedButton)) { ImageButtonController btnCntrl = this.imgControllers[this.currentDepressedButton]; if (!btnCntrl.isSameButton(btn)) { performAction = false; } else { clearDepressed = true; } } else { this.currentDepressedButton = buttonName; } } if (performAction) { imgBtnCntrl.performAction(action); } if (clearDepressed) { this.currentDepressedButton = string.Empty; } } } } }