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); }
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); }
public virtual bool CreateUX() { if (mIsUXInitCalled) { return(false); } mIsUXInitCalled = true; MyDashboard = TheNMIEngine.AddDashboard(MyBaseThing, new TheDashboardInfo(MyBaseEngine, "Virtual Things") { FldOrder = 5000, PropertyBag = new ThePropertyBag { "Category=Services", "Caption=<i class='fa faIcon fa-5x'></i></br>Virtual Things" } }); tVThingsForm = new TheFormInfo(TheThing.GetSafeThingGuid(MyBaseThing, "VTable"), eEngineName.NMIService, "Virtual Things", string.Format("TheThing;:;0;:;True;:;EngineName={0}", MyBaseThing.EngineName)) { IsNotAutoLoading = true, TileWidth = 12, AddButtonText = "Add V-Thing" }; TheNMIEngine.AddFormToThingUX(MyBaseThing, tVThingsForm, "CMyTable", "<i class='fa faIcon fa-5x'></i></br>V-Things List", 1, 3, 0xF0, TheNMIEngine.GetNodeForCategory(), null, new ThePropertyBag() { }); TheNMIEngine.AddCommonTableColumns(MyBaseThing, tVThingsForm, new eVThings(), eVThings.eVCountdown, false); TheNMIEngine.AddFields(tVThingsForm, new List <TheFieldInfo> { { new TheFieldInfo() { FldOrder = 800, DataItem = "MyPropertyBag.IsDisabled.Value", Flags = 2, Type = eFieldType.SingleCheck, Header = "Disable", FldWidth = 1, TileWidth = 1, TileHeight = 1, PropertyBag = new ThePropertyBag() { } } }, { new TheFieldInfo(MyBaseThing, "Value", 21, 0x40, 0) { Type = eFieldType.CircularGauge, Header = "Current Value", FldWidth = 2 } }, }); AddVSensorWizard(); TheNMIEngine.AddAboutButton(MyBaseThing, null, null, true, "REFRESH_DASH", 0xc0); TheNMIEngine.RegisterEngine(MyBaseEngine); mIsUXInitialized = true; return(true); }
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 override bool CreateUX() { if (mIsUXInitCalled) { return(false); } mIsUXInitCalled = true; if (!MyBaseEngine.GetEngineState().IsService) { return(true); } //NUI Definition for All clients // File Service Main Tile mMyDashboard = TheNMIEngine.AddDashboard(MyBaseThing, new TheDashboardInfo(MyBaseEngine, "0") { OnChangeName = "Value", PropertyBag = new nmiDashboard() { Category = "Devices", Format = "Network Status<br>Issues: {0}", LabelFormat = "Current Issues: {0}", Thumbnail = "FA5:f6ff", ClassName = "cdeLiveTile cdeLiveTileBar", SideBarTitle = "Network Services" } }); mMyDashboard.RegisterOnLoad((pDash) => { if (RootDashPanel == null) { RootDashPanel = pDash; sinkStatChanged(null); ThePropertyBag.PropBagUpdateValue(pDash.PropertyBag, "Foreground", "=", "white"); // "background-image:url('GlasButton.png');color:white;background-color:gray"); ThePropertyBag.PropBagUpdateValue(pDash.PropertyBag, "sStyle", "=", "color:white;"); // "background-image:url('GlasButton.png');color:white;background-color:gray"); ScanAllServices(); } }); // File Service Form: single instance for multi-agents TheFormInfo tAllFileServers = TheNMIEngine.AddForm(new TheFormInfo(MyBaseEngine) { cdeMID = TheThing.GetSafeThingGuid(MyBaseThing, "NETS"), FormTitle = "All Network Services", AddButtonText = "Add a Service" }); TheNMIEngine.AddFormToThingUX(MyBaseThing, tAllFileServers, "CMyTable", "<i class='fa faIcon fa-5x'></i></br>Network Services", 1, 1, 0x0, TheNMIEngine.GetNodeForCategory(), null, new nmiDashboardTile() { }); TheNMIEngine.AddCommonTableColumns(MyBaseThing, tAllFileServers, new eNetworkServiceTypes(), eNetworkServiceTypes.PingService); TheNMIEngine.AddSmartControl(MyBaseThing, tAllFileServers, eFieldType.Number, 21, 64, 0, "RTT", "Value", new nmiCtrlNumber { TileWidth = 1 }); //Easy To add Wizard var tFlds = TheNMIEngine.AddNewWizard(MyBaseThing, tAllFileServers.cdeMID, "Add new Network Service", null, (item, client) => { if (item != null) { TheThing t = item as TheThing; TheThing.SetSafePropertyBool(t, "AutoConnect", true); TheThing.SetSafePropertyBool(t, "AllowRTT", true); } }); TheFormInfo tF = tFlds["Form"] as TheFormInfo; tAllFileServers.AddTemplateType = tF.cdeMID.ToString(); TheNMIEngine.AddNewWizardPage(MyBaseThing, tF, 0, 1, 0, "Add new Service"); TheNMIEngine.AddWizardControl(MyBaseThing, tF, eFieldType.SingleEnded, 1, 1, 2, 0, "Name your Service", "FriendlyName"); TheNMIEngine.AddWizardControl(MyBaseThing, tF, eFieldType.ComboBox, 1, 2, 2, 0, "Service Type", "DeviceType", new nmiCtrlComboBox { Options = new eNetworkServiceTypes(), DefaultValue = eNetworkServiceTypes.PingService }); TheNMIEngine.AddWizardControl(MyBaseThing, tF, eFieldType.SingleEnded, 1, 3, 2, 0, "Address", "Address"); TheNMIEngine.AddWizardControl(MyBaseThing, tF, eFieldType.SmartLabel, 1, 4, 0, 0, null, null, new nmiCtrlSmartLabel { NoTE = true, FontSize = 32, Text = "Once you click finish the service will be created and started." }); TheNMIEngine.AddAboutButton(MyBaseThing, true, "REFRESH_DASH", 0xc0); mIsUXInitialized = true; return(true); }