public bool CreateUX()
        {
            if (mIsUXInitCalled)
            {
                return(false);
            }
            mIsUXInitCalled = true;

            //NUI Definition for All clients
            mMyDashboard = TheNMIEngine.AddDashboard(MyBaseThing, new TheDashboardInfo(MyBaseEngine, "<i class='cl-font cl-Logo fa-5x'></i><br>Mesh Receiver")
            {
                PropertyBag = new ThePropertyBag()
                {
                    "Category=Connectors"
                }
            });

            TheFormInfo tAllCloudConnections = new TheFormInfo(MyBaseEngine)
            {
                cdeMID = TheThing.GetSafeThingGuid(MyBaseThing, "MeshR"), defDataSource = string.Format("TheThing;:;0;:;True;:;EngineName={0}", MyBaseEngine.GetEngineName()), FormTitle = "Mesh Receiver Connections", AddButtonText = "Add a Connection"
            };

            TheNMIEngine.AddFormToThingUX(MyBaseThing, tAllCloudConnections, "CMyTable", "Mesh Receivers", 1, 0x0D, 0xC0, TheNMIEngine.GetNodeForCategory(), null, new ThePropertyBag()
            {
                "Thumbnail=MicrosoftAzure.png;0.5"
            });
            TheNMIEngine.AddCommonTableColumns(MyBaseThing, tAllCloudConnections, MeshDeviceTypes.GetValues(), MeshDeviceTypes.MeshReceiver, false, true);

            TheNMIEngine.AddField(tAllCloudConnections, new TheFieldInfo()
            {
                FldOrder = 5, cdeA = 0xC0, Flags = 6, Type = eFieldType.SingleCheck, FldWidth = 1, Header = "Auto-Connect", DataItem = "MyPropertyBag.AutoConnect.Value"
            });
            TheNMIEngine.AddField(tAllCloudConnections, new TheFieldInfo()
            {
                FldOrder = 6, cdeA = 0xC0, Flags = 0, Type = eFieldType.SingleCheck, FldWidth = 1, Header = "Is Connected", DataItem = "MyPropertyBag.IsConnected.Value", PropertyBag = new nmiCtrlSingleCheck {
                    AreYouSure = "Are you sure you want to connect/disconnect?"
                }
            });
            TheNMIEngine.AddField(tAllCloudConnections, new TheFieldInfo()
            {
                FldOrder = 7, cdeA = 0xC0, Flags = 0, Type = eFieldType.SingleCheck, FldWidth = 1, Header = "Connecting", DataItem = "MyPropertyBag.Connecting.Value"
            });
            TheNMIEngine.AddField(tAllCloudConnections, new TheFieldInfo()
            {
                FldOrder = 8, cdeA = 0xC0, Flags = 0, Type = eFieldType.SingleCheck, FldWidth = 1, Header = "Disconnecting", DataItem = "MyPropertyBag.Disconnecting.Value"
            });
            TheNMIEngine.AddField(tAllCloudConnections, new TheFieldInfo()
            {
                FldOrder = 50, cdeA = 0xFF, Type = eFieldType.DateTime, FldWidth = 2, Header = "Last Update", DataItem = "MyPropertyBag.LastUpdate.Value"
            });

            TheThingRegistry.UpdateEngineUX(MyBaseEngine.GetEngineName());

            TheNMIEngine.AddAboutButton(MyBaseThing, true, "REFRESH_DASH", 0xc0);
            TheNMIEngine.RegisterEngine(MyBaseEngine);

            mIsUXInitialized = true;
            return(true);
        }
Esempio n. 2
0
        public override bool CreateUX()
        {
            if (mIsUXInitCalled)
            {
                return(false);
            }
            mIsUXInitCalled = true;
            TheNMIEngine.RegisterEngine(MyBaseEngine);

            mMyDashboard = TheNMIEngine.AddDashboard(MyBaseThing, new TheDashboardInfo(MyBaseEngine, "Prometheus Exporters")
            {
                PropertyBag = new ThePropertyBag()
                {
                    "Category=Diagnostics", "Thumbnail=images/prometheus_logo_grey.png;0.5"
                }
            });

            TheFormInfo tAllCloudConnections = new TheFormInfo(MyBaseEngine)
            {
                cdeMID = TheThing.GetSafeThingGuid(MyBaseThing, "AZC"), defDataSource = string.Format("TheThing;:;0;:;True;:;EngineName={0}", MyBaseEngine.GetEngineName()), FormTitle = "Prometheus Exporters", AddButtonText = "Add a Sender"
            };

            TheNMIEngine.AddFormToThingUX(MyBaseThing, tAllCloudConnections, "CMyTable", "Prometheus Exporters", 1, 0x0D, 0xC0, TheNMIEngine.GetNodeForCategory(), null, new ThePropertyBag()
            {
                "Thumbnail=images/prometheus_logo_grey.png.png;0.5"
            });

            TheNMIEngine.AddCommonTableColumns(MyBaseThing, tAllCloudConnections, PrometheusDeviceTypes.GetValues(), PrometheusDeviceTypes.PrometheusExporter);

            TheNMIEngine.AddField(tAllCloudConnections, new TheFieldInfo()
            {
                FldOrder = 5, cdeA = 0xC0, Flags = 6, Type = eFieldType.SingleCheck, FldWidth = 1, Header = "Auto-Connect", DataItem = "MyPropertyBag.AutoConnect.Value"
            });
            TheNMIEngine.AddField(tAllCloudConnections, new TheFieldInfo()
            {
                FldOrder = 6, cdeA = 0xC0, Flags = 0, Type = eFieldType.SingleCheck, FldWidth = 1, Header = "Is Connected", DataItem = "MyPropertyBag.IsConnected.Value"
            });
            TheNMIEngine.AddField(tAllCloudConnections, new TheFieldInfo()
            {
                FldOrder = 7, cdeA = 0xC0, Flags = 0, Type = eFieldType.SingleCheck, FldWidth = 1, Header = "Connecting", DataItem = "MyPropertyBag.Connecting.Value"
            });
            TheNMIEngine.AddField(tAllCloudConnections, new TheFieldInfo()
            {
                FldOrder = 8, cdeA = 0xC0, Flags = 0, Type = eFieldType.SingleCheck, FldWidth = 1, Header = "Disconnecting", DataItem = "MyPropertyBag.Disconnecting.Value"
            });
            TheNMIEngine.AddField(tAllCloudConnections, new TheFieldInfo()
            {
                FldOrder = 50, cdeA = 0xFF, Type = eFieldType.DateTime, FldWidth = 2, Header = "Last Update", DataItem = "MyPropertyBag.LastUpdate.Value"
            });

            TheThingRegistry.UpdateEngineUX(MyBaseEngine.GetEngineName());

            TheNMIEngine.AddAboutButton(MyBaseThing, true, "REFRESH_DASH", 0xc0);

            mIsUXInitialized = true;
            return(true);
        }
Esempio n. 3
0
        public override bool CreateUX()
        {
            if (mIsUXInitCalled)
            {
                return(false);
            }
            mIsUXInitCalled = true;

            //NUI Definition for All clients
            mMyDashboard = TheNMIEngine.AddDashboard(MyBaseThing, new TheDashboardInfo(MyBaseEngine, "OPC UA Client")
            {
                PropertyBag = new nmiDashboardTile()
                {
                    Category = " Connectivity", Thumbnail = "opcLarge.png;1;cdeLargeIcon", TileWidth = 3, TileHeight = 4, ClassName = "cdeLiveTile cdeLargeTile"
                }
            });

            var tFlds = TheNMIEngine.AddStandardForm(MyBaseThing, "OPC General Settings", "OPCD", 0, new nmiStandardForm {
                MaxTileWidth = 12, UseMargin = true, Category = TheNMIEngine.GetNodeForCategory()
            });
            TheFormInfo tMyForm = tFlds["Form"] as TheFormInfo;

            TheNMIEngine.AddSmartControl(MyBaseThing, tMyForm, eFieldType.CollapsibleGroup, 5, 2, 0xc0, "GLS Discovery Service", null, ThePropertyBag.Create(new nmiCtrlCollapsibleGroup()
            {
                DoClose = false, IsSmall = true, TileWidth = 6, ParentFld = 1
            }));
            TheNMIEngine.AddSmartControl(MyBaseThing, tMyForm, eFieldType.SingleEnded, 10, 2, 0, "GLS Address", "Address", new nmiCtrlSingleEnded()
            {
                ParentFld = 5
            });
            TheFieldInfo tBut = TheNMIEngine.AddSmartControl(MyBaseThing, tMyForm, eFieldType.TileButton, 11, 2, 0, "Scan for Servers", null, new nmiCtrlTileButton()
            {
                ParentFld = 5, ClassName = "cdeGoodActionButton"
            });

            tBut.RegisterUXEvent(MyBaseThing, eUXEvents.OnClick, "SCAN", (pThing, pObj) =>
            {
                TheProcessMessage pMsg = pObj as TheProcessMessage;
                if (pMsg != null)
                {
                    TheCommCore.PublishToOriginator(pMsg.Message, new TSM(eEngineName.NMIService, "NMI_TOAST", "Scanning..."));
                    GetEndpoints();
                    mMyDashboard.Reload(pMsg, false);
                }
            });

            TheNMIEngine.AddSmartControl(MyBaseThing, tMyForm, eFieldType.CollapsibleGroup, 15, 2, 0xc0, "Tracing (all clients)...", null, ThePropertyBag.Create(new nmiCtrlCollapsibleGroup()
            {
                DoClose = false, TileWidth = 6, IsSmall = true, ParentFld = 1
            }));

            TheNMIEngine.AddSmartControl(MyBaseThing, tMyForm, eFieldType.SingleCheck, 16, 2, 0, "OPC Client File Tracing", nameof(EnableTracing), new nmiCtrlSingleCheck {
                TileWidth = 3, ParentFld = 15
            });
            TheNMIEngine.AddSmartControl(MyBaseThing, tMyForm, eFieldType.SingleCheck, 17, 2, 0, "OPC Client Trace to Log", nameof(EnableTracingToLog), new nmiCtrlSingleCheck {
                TileWidth = 3, ParentFld = 15
            });
            TheNMIEngine.AddSmartControl(MyBaseThing, tMyForm, eFieldType.Number, 18, 2, 0, "OPC Client Trace Mask", nameof(OPCTraceMask), new nmiCtrlNumber {
                TileWidth = 6, ParentFld = 15, HelpText = "1=Err,2=Info,4=Stk,8=Svc,16=SvcDtl,32=Op,64=OpDtl,128=Start,256=Ext,512=Sec"
            });



            TheFormInfo tAllOPCUASrvs = new TheFormInfo(MyBaseEngine)
            {
                cdeMID = TheThing.GetSafeThingGuid(MyBaseThing, "OPCS"), defDataSource = string.Format("TheThing;:;0;:;True;:;DeviceType={1};EngineName={0}", MyBaseEngine.GetEngineName(), eOPCDeviceTypes.OPCRemoteServer), FormTitle = "Discovered OPC-UA Servers", AddButtonText = "Add a Server"
            };

            TheNMIEngine.AddFormToThingUX(MyBaseThing, tAllOPCUASrvs, "CMyTable", "All OPC-UA Remote Servers", 1, 0x0F, 0xC0, TheNMIEngine.GetNodeForCategory(), null, new ThePropertyBag()
            {
                "Thumbnail=OPCLogo.png;1.0"
            });
            var tOpcs = TheNMIEngine.AddCommonTableColumns(MyBaseThing, tAllOPCUASrvs);

            tOpcs["Address"].Header      = "Server URL";
            tOpcs["Address"].PropertyBag = new nmiCtrlSingleEnded {
                TileWidth = 4, FldWidth = 4
            };

            TheNMIEngine.AddField(tAllOPCUASrvs, new TheFieldInfo()
            {
                FldOrder = 5, cdeA = 0xC0, Flags = 2, Type = eFieldType.SingleCheck, Header = "Auto-Connect", DataItem = "MyPropertyBag.AutoConnect.Value"
            });
            TheNMIEngine.AddField(tAllOPCUASrvs, new TheFieldInfo()
            {
                FldOrder = 6, cdeA = 0xC0, Flags = 2, Type = eFieldType.SingleCheck, Header = "Connected", DataItem = "MyPropertyBag.IsConnected.Value", PropertyBag = new nmiCtrlSingleCheck {
                    AreYouSure = "Are you sure you want to connect/disconnect?"
                }
            });
            //            TheNMIEngine.AddField(tAllOPCUASrvs, new TheFieldInfo() { FldOrder = 13, Flags = 2, cdeA = 0xFF, Type = eFieldType.SingleEnded, Header = "Friendly Name", DataItem = "MyPropertyBag.FriendlyName.Value", PropertyBag = new ThePropertyBag() { "FldWidth=3" } });
            //TheNMIEngine.AddField(tAllOPCUASrvs, new TheFieldInfo() { FldOrder = 14, Flags = 2, cdeA = 0xC0, Type = eFieldType.SingleEnded, Header = "Server URL", DataItem = "MyPropertyBag.Address.Value", PropertyBag = new ThePropertyBag() { "FldWidth=5" } });
            TheNMIEngine.AddField(tAllOPCUASrvs, new TheFieldInfo()
            {
                FldOrder = 50, cdeA = 0xFF, Type = eFieldType.DateTime, Header = "Last Update", DataItem = "MyPropertyBag.LastUpdate.Value", PropertyBag = new ThePropertyBag()
                {
                    "FldWidth=3"
                }
            });
            TheNMIEngine.AddField(tAllOPCUASrvs, new TheFieldInfo()
            {
                FldOrder = 55, cdeA = 0xFF, Type = eFieldType.DateTime, Header = "Last Receive", DataItem = "MyPropertyBag.LastDataReceivedTime.Value", PropertyBag = new ThePropertyBag()
                {
                    "FldWidth=3"
                }
            });
            //TheNMIEngine.AddTableButtons(tAllOPCUASrvs);

            TheThingRegistry.UpdateEngineUX(MyBaseEngine.GetEngineName());

            TheNMIEngine.AddLiveTagTable(MyBaseThing, eOPCDeviceTypes.OPCLiveTag, "UA Live Tags", TheNMIEngine.GetNodeForCategory());
            TheNMIEngine.AddLiveTagTable(MyBaseThing, eOPCDeviceTypes.OPCMethod, "UA Methods", TheNMIEngine.GetNodeForCategory());

            TheNMIEngine.AddTileBreak(MyBaseThing, mMyDashboard, "..A");

            TheNMIEngine.AddAboutButton(MyBaseThing, true, "REFRESH_DASH", 0xc0);
            TheNMIEngine.RegisterEngine(MyBaseEngine);

            CreateOPCWizard();

            mIsUXInitialized = true;
            return(true);
        }
        public bool CreateUX()
        {
            if (mIsUXInitCalled)
            {
                return(false);
            }
            mIsUXInitCalled = true;

            //NUI Definition for All clients
            mMyDashboard = TheNMIEngine.AddDashboard(MyBaseThing, new TheDashboardInfo(MyBaseEngine, "MQTT Sender")
            {
                PropertyBag = new ThePropertyBag()
                {
                    "Category=Connectors"
                }
            });

            TheFormInfo tAllCloudConnections = new TheFormInfo(MyBaseEngine)
            {
                cdeMID = TheThing.GetSafeThingGuid(MyBaseThing, "MQTTC"), defDataSource = string.Format("TheThing;:;0;:;True;:;EngineName={0}", MyBaseEngine.GetEngineName()), FormTitle = "Cloud Connections", AddButtonText = "Add a Connection"
            };

            TheNMIEngine.AddFormToThingUX(MyBaseThing, tAllCloudConnections, "CMyTable", "MQTT Connections", 1, 0x0D, 0xC0, TheNMIEngine.GetNodeForCategory(), null, new ThePropertyBag()
            {
            });


            TheNMIEngine.AddField(tAllCloudConnections, new TheFieldInfo()
            {
                FldOrder = 5, cdeA = 0xC0, Flags = 6, Type = eFieldType.SingleCheck, FldWidth = 1, Header = "Auto-Connect", DataItem = "MyPropertyBag.AutoConnect.Value"
            });
            TheNMIEngine.AddField(tAllCloudConnections, new TheFieldInfo()
            {
                FldOrder = 6, cdeA = 0xC0, Flags = 2, Type = eFieldType.SingleCheck, FldWidth = 1, Header = "Is Connected", DataItem = "MyPropertyBag.IsConnected.Value", PropertyBag = new nmiCtrlSingleCheck {
                    AreYouSure = "Are you sure you want to connect/disconnect?"
                }
            });
            TheNMIEngine.AddField(tAllCloudConnections, new TheFieldInfo()
            {
                FldOrder = 7, cdeA = 0xC0, Flags = 0, Type = eFieldType.SingleCheck, FldWidth = 1, Header = "Connecting", DataItem = "MyPropertyBag.Connecting.Value"
            });
            TheNMIEngine.AddField(tAllCloudConnections, new TheFieldInfo()
            {
                FldOrder = 8, cdeA = 0xC0, Flags = 0, Type = eFieldType.SingleCheck, FldWidth = 1, Header = "Disconnecting", DataItem = "MyPropertyBag.Disconnecting.Value"
            });
            TheNMIEngine.AddField(tAllCloudConnections, new TheFieldInfo()
            {
                FldOrder = 12, cdeA = 0xFF, Flags = 2, Type = eFieldType.ComboBox, PropertyBag = new nmiCtrlComboBox()
                {
                    Options = MqttDeviceTypes.GetValues(), FldWidth = 3
                }, DefaultValue = MqttDeviceTypes.MqttSender, Header = "DeviceType", DataItem = "MyPropertyBag.DeviceType.Value"
            });
            TheNMIEngine.AddField(tAllCloudConnections, new TheFieldInfo()
            {
                FldOrder = 13, Flags = 2, cdeA = 0xFF, Type = eFieldType.SingleEnded, FldWidth = 3, Header = "Friendly Name", DataItem = "MyPropertyBag.FriendlyName.Value"
            });
            TheNMIEngine.AddField(tAllCloudConnections, new TheFieldInfo()
            {
                FldOrder = 14, Flags = 0, cdeA = 0xC0, Type = eFieldType.SingleEnded, FldWidth = 2, Header = "Address", DataItem = "MyPropertyBag.Address.Value"
            });

            TheNMIEngine.AddField(tAllCloudConnections, new TheFieldInfo()
            {
                FldOrder = 50, cdeA = 0xFF, Type = eFieldType.DateTime, FldWidth = 2, Header = "Last Update", DataItem = "MyPropertyBag.LastUpdate.Value"
            });
            TheNMIEngine.AddTableButtons(tAllCloudConnections, true, 100);

            TheThingRegistry.UpdateEngineUX(MyBaseEngine.GetEngineName());

            TheNMIEngine.AddAboutButton(MyBaseThing, true, "REFRESH_DASH", 0xc0);
            TheNMIEngine.RegisterEngine(MyBaseEngine);

            mIsUXInitialized = true;
            return(true);
        }