Beispiel #1
0
        public UITabBar(UIControllerWithSmartObjects uiController, SmartObject smartObject)
        {
            _uiController = uiController;
            _smartObject = smartObject;

            CloudLog.Debug("{0}.ctor for SmartObject ID: {1}", GetType(), smartObject.ID);
            try
            {
                var count = 1U;
                while (true)
                {
                    var name = string.Format("Tab Button {0} Press", count);
                    if (_smartObject.BooleanOutput.Contains(name))
                    {
                        Buttons[count] = new UIButton(_smartObject, name, string.Format("Tab Button {0} Select", count));
                        count++;
                    }
                    else
                    {
                        break;
                    }
                }

                CloudLog.Debug("{0} for SmartObject ID: {1} contains {2} items", GetType(), smartObject.ID,
                    Buttons.Count);
            }
            catch (Exception e)
            {
                CloudLog.Exception(e, "Error in {0}.ctor, {1}", GetType().Name, e.Message);
            }
        }
Beispiel #2
0
 /// <summary>
 /// The default Constructor.
 /// </summary>
 protected UIActionSheet(UIControllerWithSmartObjects uiController, UIViewController view,
                         SmartObject subPageReferenceListOfButtons, UILabel titleLabel, UILabel subtitleLabel)
 {
     _uiController            = uiController;
     _view                    = view;
     _titleLabel              = titleLabel;
     _subtitleLabel           = subtitleLabel;
     _buttonList              = new UIActionSheetButtonList(uiController, subPageReferenceListOfButtons);
     _view.VisibilityChanged += ViewOnVisibilityChanged;
     CancelButtonMode         = UIActionSheetButtonMode.Red;
 }
Beispiel #3
0
        /// <summary>
        /// Creates a base class for subpage referenece lists
        /// </summary>
        /// <param name="uiController">The UI Controller for the decice</param>
        /// <param name="smartObject">The smart object for the device</param>
        /// <param name="digitalJoinIncrement">The digital join increment, must be more than 0!</param>
        /// <param name="analogJoinIncrement">The analog join increment</param>
        /// <param name="serialJoinIncrement">The serial join increment, must be more than 0!</param>
        /// <param name="callBack">A 'CreateItemForIndexCallBack' delegate to create the items</param>
        protected UISubPageReferenceList(UIControllerWithSmartObjects uiController, SmartObject smartObject, uint digitalJoinIncrement, uint analogJoinIncrement,
                                         uint serialJoinIncrement, CreateItemForIndexCallBack callBack)
        {
            _uiController         = uiController;
            _smartObject          = smartObject;
            _digitalJoinIncrement = digitalJoinIncrement;
            _analogJoinIncrement  = analogJoinIncrement;
            _serialJoinIncrement  = serialJoinIncrement;

            _smartObject.SigChange += SmartObjectOnSigChange;

            if (_digitalJoinIncrement == 0 || _serialJoinIncrement == 0)
            {
                throw new Exception("Join increments must be at least 1 for digital and serial joins");
            }

            CloudLog.Debug("{0}.ctor for SmartObject ID: {1}", GetType(), smartObject.ID);
            try
            {
                uint count = 1;
                while (true)
                {
                    var name = string.Format("Item {0} Visible", count);
                    if (_smartObject.BooleanInput.Contains(name))
                    {
                        count++;
                    }
                    else
                    {
                        break;
                    }
                }
                _maxNumberOfItems = count - 1;

                CloudLog.Debug("{0} for SmartObject ID: {1} contains {2} items", GetType(), smartObject.ID,
                               _maxNumberOfItems);

                for (uint i = 1; i <= _maxNumberOfItems; i++)
                {
                    _items[i] = callBack(this, i);
                }
            }
            catch (Exception e)
            {
                CloudLog.Exception(e, "Error in {0}.ctor, {1}", GetType().Name, e.Message);
            }
        }
Beispiel #4
0
        public UIDynamicButtonList(UIControllerWithSmartObjects uiController, SmartObject smartObject)
        {
            _uiController = uiController;
            _smartObject  = smartObject;

            _smartObject.SigChange += SmartObjectOnSigChange;

            CloudLog.Debug("{0}.ctor for SmartObject ID: {1}", GetType(), smartObject.ID);
            try
            {
                uint count = 1;
                while (true)
                {
                    var name = string.Format("Item {0} Visible", count);
                    if (_smartObject.BooleanInput.Contains(name))
                    {
                        count++;
                    }
                    else
                    {
                        break;
                    }
                }
                _maxNumberOfItems = count - 1;

                CloudLog.Debug("{0} for SmartObject ID: {1} contains {2} items", GetType(), smartObject.ID,
                               _maxNumberOfItems);

                for (uint i = 1; i <= _maxNumberOfItems; i++)
                {
                    _items[i] = new UIDynamicButtonListItem(this, i);
                }
            }
            catch (Exception e)
            {
                CloudLog.Exception(e, "Error in {0}.ctor, {1}", GetType().Name, e.Message);
            }
        }
Beispiel #5
0
 public UIActionSheetButtonList(UIControllerWithSmartObjects uiController, SmartObject smartObject)
     : base(uiController, smartObject, 1, 1, 2, (list, index) => new UIActionSheetButtonListItem(list, index))
 {
 }