예제 #1
0
        static public bool CreatePerformanceHeader(TheThing pBaseThing, TheFormInfo pFormInfo, int pFldOrder, int pParent, string pSensorPicSource = "SENSORS/Images/SensorLogo_156x78.png", string pLogo = null)
        {
            var tG = TheNMIEngine.AddSmartControl(pBaseThing, pFormInfo, eFieldType.TileGroup, pFldOrder, 0, 0, null, null, new nmiCtrlTileGroup()
            {
                ParentFld = pParent, /*MaxTileWidth = 18,*/ Background = "transparent"
            });

            tG.AddOrUpdatePlatformBag(eWebPlatform.Mobile, new nmiPlatBag {
                MaxTileWidth = 6
            });
            tG.AddOrUpdatePlatformBag(eWebPlatform.HoloLens, new nmiPlatBag {
                MaxTileWidth = 12
            });

            TheNMIEngine.AddSmartControl(pBaseThing, pFormInfo, eFieldType.TileGroup, pFldOrder + 1, 0, 0, null, null, new nmiCtrlTileGroup()
            {
                ParentFld = pFldOrder, TileWidth = 6
            });
            //TheNMIEngine.AddSmartControl(pBaseThing, pFormInfo, eFieldType.StatusLight, pFldOrder + 2, 0, 0, "Current status", "StatusLevel", new TheNMIBaseControl { ParentFld = pFldOrder + 1, TileHeight = 1, TileWidth = 4 });
            //TheNMIEngine.AddSmartControl(pBaseThing, pFormInfo, eFieldType.SmartLabel, pFldOrder + 3, 0, 0, null, "LastMessage", new nmiCtrlTextArea() { ParentFld = pFldOrder + 1, TileWidth = 6, TileHeight = 1, Background = "transparent",NoTE=true, FontSize = 20, HorizontalAlignment = "left", VerticalAlignment = "center"/*, Value = pCurrentStatus*/ });

            var tMiniStatus = TheNMIEngine.AddSmartControl(pBaseThing, pFormInfo, eFieldType.TileGroup, pFldOrder + 5, 0, 0, null, null, new nmiCtrlTileGroup()
            {
                ParentFld = pFldOrder, TileWidth = 6, Background = "transparent"
            });

            if (!string.IsNullOrEmpty(pLogo))
            {
                var tBut2 = TheNMIEngine.AddSmartControl(pBaseThing, pFormInfo, eFieldType.Picture, pFldOrder + 7, 2, 0, null, null, new nmiCtrlPicture()
                {
                    ParentFld = pFldOrder + 5, TileWidth = 2, TileHeight = 1, NoTE = true, Background = "transparent", Source = pLogo
                });
                tBut2.RegisterUXEvent(pBaseThing, eUXEvents.OnClick, "ImageClick2", (sender, para) =>
                {
                    uint min = TheCommonUtils.CUInt(TheThing.GetSafePropertyNumber(pBaseThing, "StateSensorMinValue"));
                    uint max = TheCommonUtils.CUInt(TheThing.GetSafePropertyNumber(pBaseThing, "StateSensorMaxValue"));
                    TheThing.SetSafePropertyNumber(pBaseThing, "QValue", TheCommonUtils.GetRandomUInt(min, max));
                });
            }

            var tFld = TheNMIEngine.AddSmartControl(pBaseThing, pFormInfo, eFieldType.TileGroup, pFldOrder + 8, 0, 0, null, null, new nmiCtrlTileGroup()
            {
                ParentFld = pFldOrder, TileWidth = 6, TileHeight = 2, Background = "transparent"
            });

            tFld.AddOrUpdatePlatformBag(eWebPlatform.Any, new nmiPlatBag {
                Hide = true
            });
            tFld.AddOrUpdatePlatformBag(eWebPlatform.Desktop, new nmiPlatBag {
                Show = true
            });
            tFld.AddOrUpdatePlatformBag(eWebPlatform.XBox, new nmiPlatBag {
                Show = true
            });
            TheNMIEngine.AddSmartControl(pBaseThing, pFormInfo, eFieldType.SmartLabel, pFldOrder + 9, 0, 0, null, "FriendlyName", new nmiCtrlSmartLabel()
            {
                ParentFld = pFldOrder + 8, NoTE = true, TileWidth = 3, TileHeight = 1, LabelClassName = "cdeSelDevice", FontSize = 20, HorizontalAlignment = "left", VerticalAlignment = "center"                                                                                                                                            /*, Value = pSelectedDeviceName*/
            });
            if (!string.IsNullOrEmpty(pSensorPicSource))
            {
                var tBut3 = TheNMIEngine.AddSmartControl(pBaseThing, pFormInfo, eFieldType.Picture, pFldOrder + 10, 0, 0, null, null, new nmiCtrlPicture()
                {
                    NoTE = true, ParentFld = pFldOrder + 8, TileWidth = 3, TileHeight = 1, Source = pSensorPicSource
                });;
                tBut3.RegisterUXEvent(pBaseThing, eUXEvents.OnClick, "LogoClick3", (sender, para) =>
                {
                    uint min = TheCommonUtils.CUInt(TheThing.GetSafePropertyNumber(pBaseThing, "StateSensorMinValue"));
                    uint max = TheCommonUtils.CUInt(TheThing.GetSafePropertyNumber(pBaseThing, "StateSensorMaxValue"));
                    TheThing.SetSafePropertyNumber(pBaseThing, "QValue", TheCommonUtils.GetRandomUInt(min, max));
                });
            }
            TheNMIEngine.AddSmartControl(pBaseThing, pFormInfo, eFieldType.StatusLight, pFldOrder + 12, 0, 0, null, "StatusLevel", new TheNMIBaseControl {
                NoTE = true, TileHeight = 1, TileWidth = 1, ParentFld = pFldOrder + 8
            });
            TheNMIEngine.AddSmartControl(pBaseThing, pFormInfo, eFieldType.TextArea, pFldOrder + 11, 0, 0, null, "LastMessage", new nmiCtrlTextArea {
                TileHeight = 1, ParentFld = pFldOrder + 8, TileWidth = 5, FontSize = 12, NoTE = true, Foreground = "gray", Background = "Transparent"
            });

            return(true);
        }