Наследование: DynamicElement
Пример #1
0
        protected void CreateItems()
        {
            var style = new TextStyle(HOBD.theme.PhoneTextNormalStyle);

            Grid grid;

            int height = LayoutY / 4;

            grid = new Grid
            {
                Columns = new MeasureDefinition[] { LayoutX / 2, LayoutX / 2 },
                Rows    = new MeasureDefinition[] { height, height, height, height }
            };

            int idx = 0, idx2 = 0;

            foreach (var p in Content)
            {
                string label = UIContent(p);

                if (p.Equals(Selected))
                {
                    label = ">> " + label;
                }

                var e = new IconTextElement("icon.png", label)
                {
                    HandleTapAction = OnChoose
                };

                uiMapping.Add(e, p);

                grid[idx++, idx2] = e;
                if (idx >= grid.Rows.Length)
                {
                    idx = 0;
                    idx2++;
                }
                if (idx2 >= grid.Columns.Length)
                {
                    return;
                }
            }

            this.AddElement(grid);
            // , 0, 0, LayoutX, LayoutY
        }
Пример #2
0
        protected void CreateItems()
        {
            var style = new TextStyle(HOBD.theme.PhoneTextNormalStyle);

            Grid grid;

            int height = LayoutY/4;
            grid = new Grid
                {
                    Columns = new MeasureDefinition[] { LayoutX/2, LayoutX/2 },
                    Rows = new MeasureDefinition[] { height, height, height, height }
                };

            int idx = 0, idx2 = 0;

            foreach(var p in Content)
            {
                string label = UIContent(p);

                if (p.Equals(Selected)){
                    label = ">> " + label;
                }

                var e = new IconTextElement("icon.png", label){ HandleTapAction = OnChoose };

                uiMapping.Add(e, p);

                grid[idx++, idx2] = e;
                if (idx >= grid.Rows.Length){
                    idx = 0;
                    idx2++;
                }
                if (idx2 >= grid.Columns.Length)
                    return;
            }

            this.AddElement(grid);
            // , 0, 0, LayoutX, LayoutY
        }
Пример #3
0
        protected void CreateItems()
        {
            var style = new TextStyle(HOBD.theme.PhoneTextNormalStyle);

            if (grid != null) {
                this.Remove(grid);
            }

            int height = LayoutY/6;
            grid = new Grid
                {
                    Columns = new MeasureDefinition[] { LayoutX/3, LayoutX/3, LayoutX/3 },
                    Rows = new MeasureDefinition[] { height, height, height, height, height, height }
                };

            int idx = 0, idx2 = 0;

            foreach(var p in SerialPort.GetPortNames().OrderBy(s => s))
            {
                var label = p;

                if (string.Compare(HOBD.config.Port, p, true) == 0){
                    label = ">> " + label;
                }

                var e = new IconTextElement("icon_com.png", label){ HandleTapAction = OnChoosePort };

                portMapping.Add(e, p);

                grid[idx++, idx2] = e;
                if (idx >= grid.Rows.Length){
                    idx = 0;
                    idx2++;
                }
                if (idx2 >= grid.Columns.Length)
                    return;
            }

            uiBTScan = new IconTextElement("icon_bt.png", HOBD.t("Scan Again")){ HandleTapAction = OnBluetoothScan};
            grid[idx++, idx2] = uiBTScan;
            if (idx >= grid.Rows.Length){
                idx = 0;
                idx2++;
            }

            foreach(var di in bluetoothDeviceInfo)
            {
                var label = di.DeviceName;

                var p = "btspp://" + di.DeviceAddress.ToString();
                if (HOBD.config.Port.StartsWith(p)){
                    label = ">> " + label;
                }

                var e = new IconTextElement("icon_bt.png", label){ HandleTapAction = OnChoosePort};

                portMapping.Add(e, p);

                grid[idx++, idx2] = e;
                if (idx >= grid.Rows.Length){
                   idx = 0;
                   idx2++;
                }
                if (idx2 >= grid.Columns.Length)
                    return;
            }
            this.Add(grid, 0, 0, LayoutX, LayoutY);
        }
Пример #4
0
        protected void CreateItems()
        {
            var style = new TextStyle(HOBD.theme.PhoneTextNormalStyle);

            if (grid != null)
            {
                this.RemoveElement(grid);
            }

            int height = LayoutY / 6;

            grid = new Grid
            {
                Columns = new MeasureDefinition[] { LayoutX / 3, LayoutX / 3, LayoutX / 3 },
                Rows    = new MeasureDefinition[] { height, height, height, height, height, height }
            };

            int idx = 0, idx2 = 0;

            foreach (var p in SerialPort.GetPortNames().OrderBy(s => s))
            {
                var label = p;

                if (string.Compare(HOBD.config.Port, p, true) == 0)
                {
                    label = ">> " + label;
                }

                var e = new IconTextElement("icon_com.png", label)
                {
                    HandleTapAction = OnChoosePort
                };

                portMapping.Add(e, p);

                grid[idx++, idx2] = e;
                if (idx >= grid.Rows.Length)
                {
                    idx = 0;
                    idx2++;
                }
                if (idx2 >= grid.Columns.Length)
                {
                    return;
                }
            }

            uiBTScan = new IconTextElement("icon_bt.png", HOBD.t("Scan Again"))
            {
                HandleTapAction = OnBluetoothScan
            };
            grid[idx++, idx2] = uiBTScan;
            if (idx >= grid.Rows.Length)
            {
                idx = 0;
                idx2++;
            }

            foreach (var di in bluetoothDeviceInfo)
            {
                var label = di.DeviceName;

                var p = "btspp://" + di.DeviceAddress.ToString();
                if (HOBD.config.Port.StartsWith(p))
                {
                    label = ">> " + label;
                }

                var e = new IconTextElement("icon_bt.png", label)
                {
                    HandleTapAction = OnChoosePort
                };

                portMapping.Add(e, p);

                grid[idx++, idx2] = e;
                if (idx >= grid.Rows.Length)
                {
                    idx = 0;
                    idx2++;
                }
                if (idx2 >= grid.Columns.Length)
                {
                    return;
                }
            }
            this.AddElement(grid);
            // , 0, 0, LayoutX, LayoutY
        }