示例#1
0
        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);
            }
        }
示例#2
0
        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);
            }
        }
示例#3
0
        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);
        }
示例#4
0
        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;
                    }
                }
            }
        }