Exemplo n.º 1
0
        protected virtual void Data_DataChange(ListData listData, ListDataChangeEventArgs args)
        {
            if (args.EventType == eListDataChangeEventType.IsStartingToLoad)
            {
                this.Buttons[1].Title = "Loading...";
                this.Buttons[1].Icon  = UIMediaIcons.Blank;
                this.NumberOfItems    = 1;
                if (LoadingSubPageOverlay != null)
                {
                    LoadingSubPageOverlay.BoolValue = true;
                }
            }
            else if (args.EventType == eListDataChangeEventType.HasCleared)
            {
                for (uint item = 1; item <= this.NumberOfItems; item++)
                {
                    this.Buttons[item].Feedback = false;
                }
                this.NumberOfItems = 0;
            }
            else if (args.EventType == eListDataChangeEventType.HasLoaded)
            {
                ushort listSize;

                if (listData.Count > this.MaxNumberOfItems)
                {
                    listSize = this.MaxNumberOfItems;
                }
                else
                {
                    listSize = (ushort)listData.Count;
                }

                this.NumberOfItems = listSize;

                for (uint item = 1; item <= listSize; item++)
                {
                    int listDataIndex = (int)item - 1;
                    this.Buttons[item].Title        = listData[listDataIndex].Title;
                    this.Buttons[item].Icon         = listData[listDataIndex].Icon;
                    this.Buttons[item].LinkedObject = listData[listDataIndex].DataObject;
                    this.Buttons[item].Enabled      = listData[listDataIndex].Enabled;
                    this.Buttons[item].Feedback     = listData[listDataIndex].IsSelected;
                }

                if (LoadingSubPageOverlay != null)
                {
                    LoadingSubPageOverlay.BoolValue = false;
                }
            }
            else if (args.EventType == eListDataChangeEventType.ItemSelectionHasChanged)
            {
                for (uint item = 1; item <= this.NumberOfItems; item++)
                {
                    int listDataIndex = (int)item - 1;
                    this.Buttons[item].Feedback = listData[listDataIndex].IsSelected;
                }
            }
        }
Exemplo n.º 2
0
        protected override void Data_DataChange(ListData listData, ListDataChangeEventArgs args)
        {
            if (args.EventType == eListDataChangeEventType.HasLoaded)
            {
                ushort listSize;

                if (listData.Count > this.MaxNumberOfItems)
                {
                    listSize = this.MaxNumberOfItems;
                }
                else
                {
                    listSize = (ushort)listData.Count;
                }

                this.NumberOfItems = listSize;

                for (uint item = 1; item <= listSize; item++)
                {
                    int listDataIndex = (int)item - 1;
                    this.Buttons[item].Title = listData[listDataIndex].Title;
                    if (listData[listDataIndex].IsSelected)
                    {
                        this.Buttons[item].Icon = UIMediaIcons.CheckboxChecked;
                    }
                    else
                    {
                        this.Buttons[item].Icon = UIMediaIcons.CheckboxOff;
                    }
                    this.Buttons[item].LinkedObject = listData[listDataIndex].DataObject;
                    this.Buttons[item].Enabled      = listData[listDataIndex].Enabled;
                }

                if (LoadingSubPageOverlay != null)
                {
                    LoadingSubPageOverlay.BoolValue = false;
                }
            }
            else if (args.EventType == eListDataChangeEventType.ItemSelectionHasChanged)
            {
                for (uint item = 1; item <= this.NumberOfItems; item++)
                {
                    int listDataIndex = (int)item - 1;
                    if (listData[listDataIndex].IsSelected)
                    {
                        this.Buttons[item].Icon = UIMediaIcons.CheckboxChecked;
                    }
                    else
                    {
                        this.Buttons[item].Icon = UIMediaIcons.CheckboxOff;
                    }
                }
            }
            else
            {
                base.Data_DataChange(listData, args);
            }
        }
        protected virtual void Data_DataChange(ListData listData, ListDataChangeEventArgs args)
        {
            if (args.EventType == eListDataChangeEventType.HasCleared)
            {
                this.NumberOfItems = 0;
            }
            else if (args.EventType == eListDataChangeEventType.HasLoaded)
            {
                ushort listSize;

                if (listData.Count > this.MaxNumberOfItems)
                {
                    listSize = this.MaxNumberOfItems;
                }
                else
                {
                    listSize = (ushort)listData.Count;
                }

                this.NumberOfItems = listSize;

                for (uint item = 1; item <= listSize; item++)
                {
                    this.DeviceSmartObject.StringInput[string.Format("Set Item {0} Text", item)]
                    .StringValue = listData[(int)item - 1].Title;
                }
            }
            else if (args.EventType == eListDataChangeEventType.ItemSelectionHasChanged)
            {
                ListDataObject item = listData.Where(i => i.IsSelected).FirstOrDefault();
                if (item != null)
                {
                    int index = listData.IndexOf(item);
                    this.SelectedItem = (ushort)(index + 1);
                }
            }
        }