private static void IsSwitchedChanged(BindableObject bindable, object oldValue, object newValue) { SwitchWithLabel switchWithLabel = (SwitchWithLabel)bindable; Boolean isPressed = (Boolean)newValue; if (!switchWithLabel._isUpdating && !String.IsNullOrEmpty(switchWithLabel.SwitchGroup)) { UnpressAllInGroupExcept(switchWithLabel.SwitchGroup, switchWithLabel); } }
private static void SwitchGroupChanged(BindableObject bindable, object oldValue, object newValue) { SwitchWithLabel switchWithLabel = (SwitchWithLabel)bindable; String oldGroup = (String)oldValue; String newGroup = (String)newValue; if (!String.IsNullOrEmpty(oldGroup)) { RemoveFromGroup(switchWithLabel, oldGroup); } if (!String.IsNullOrEmpty(newGroup)) { AddToGroup(switchWithLabel, newGroup); } }
private static void AddToGroup(SwitchWithLabel button, String group) { DLoggerManager.Instance.Logger.Log(devoctomy.DFramework.Logging.Interfaces.LoggerMessageType.VerboseHigh | devoctomy.DFramework.Logging.Interfaces.LoggerMessageType.Information, "Adding tab button '{0}' to group '{1}'.", button.Label, group); List <SwitchWithLabel> groupButtons = null; if (_switchGroups.ContainsKey(group)) { groupButtons = _switchGroups[group]; } else { groupButtons = new List <SwitchWithLabel>(); _switchGroups.Add(group, groupButtons); } groupButtons.Add(button); }
private static void UnpressAllInGroupExcept(String group, SwitchWithLabel except) { DLoggerManager.Instance.Logger.Log(devoctomy.DFramework.Logging.Interfaces.LoggerMessageType.VerboseHigh | devoctomy.DFramework.Logging.Interfaces.LoggerMessageType.Information, "Unpressing all switches in group '{0}', except '{1}'.", group, except.Label); List <SwitchWithLabel> groupButtons = null; if (_switchGroups.ContainsKey(group)) { groupButtons = _switchGroups[group]; foreach (SwitchWithLabel curButton in groupButtons) { if (curButton != except) { curButton._isUpdating = true; curButton.IsSwitched = false; curButton._isUpdating = false; } } } }