public override bool CreateUX() { if (mIsUXInitCalled) { return(false); } mIsUXInitCalled = true; if (!TheBaseAssets.MyServiceHostInfo.IsCloudService) { MyDash = TheNMIEngine.AddDashboard(MyBaseThing, new TheDashboardInfo(MyBaseEngine, "Messaging") { PropertyBag = new ThePropertyBag() { "Category=Services", "Caption=Messaging", "Thumbnail=FA5:f658" } }); var tFlds = TheNMIEngine.CreateEngineForms(MyBaseThing, TheThing.GetSafeThingGuid(MyBaseThing, "MSGT"), "Messaging Targets", null, 0, 0x0F, 0xF0, TheNMIEngine.GetNodeForCategory(), "REFFRESHME", false, $"{eMessageTypes.EMAIL}", eMessageTypes.EMAIL); //;{eMessageTypes.SMS} not ready - needs carrier servername+port+ssl TheFormInfo tForm = tFlds["Form"] as TheFormInfo; tForm.IsReadOnly = false; tForm.AddButtonText = "Add a new Messaging Target"; (tFlds["Name"] as TheFieldInfo).Header = "Target Name"; (tFlds["DashIcon"] as TheDashPanelInfo).PanelTitle = "Messaging Targets"; TheNMIEngine.AddSmartControl(MyBaseThing, tForm, eFieldType.SingleEnded, 50, 2, 0, "Recipient", "Recipient", null).FldWidth = 3; } mIsUXInitialized = true; return(true); }
public override bool CreateUX() { if (!mIsUXInitCalled) { mIsUXInitCalled = true; mMyDashboard = TheNMIEngine.AddDashboard(MyBaseThing, new TheDashboardInfo(MyBaseEngine, "###Image Service###") { PropertyBag = new nmiDashboard { Category = "###Services###", Caption = "<i class='fa faIcon fa-5x'></i></br>###Image Service###" } }); var tFlds = TheNMIEngine.CreateEngineForms(MyBaseThing, TheThing.GetSafeThingGuid(MyBaseThing, "MYNAME"), "###My Images###", null, 20, 0x0F, 0xF0, TheNMIEngine.GetNodeForCategory(), "REFFRESHME", false, new eImageTypes(), eImageTypes.Bitmap); TheFormInfo tForm = tFlds["Form"] as TheFormInfo; TheNMIEngine.AddSmartControl(MyBaseThing, tForm, eFieldType.Picture, 5, 0, 0, "###Current Image###", "CurrentImage", new nmiCtrlPicture { FldWidth = 1, TileHeight = 1 }); var tMyForm2 = TheNMIEngine.AddStandardForm(MyBaseThing, "###New Image Uploader###", 6, "ImageUp", null, 0xC0); TheNMIEngine.AddSmartControl(MyBaseThing, tMyForm2["Form"] as TheFormInfo, eFieldType.DropUploader, 3, 2, 0, "###Drop an image-file here###", null, new nmiCtrlDropUploader { TileHeight = 6, ParentFld = 1, NoTE = true, TileWidth = 6, EngineName = MyBaseEngine.GetEngineName(), MaxFileSize = 5000000 }); mIsUXInitialized = true; } return(true); }
protected override void DoCreateUX(TheFormInfo pForm) { base.DoCreateUX(pForm); var AdressFld = TheNMIEngine.GetFieldByFldOrder(pForm, 124); AdressFld.Header = "RSS Endpoint"; }
public override bool CreateUX() { if (!mIsUXInitialized) { mIsUXInitialized = true; TheFormInfo tMyLiveForm = new TheFormInfo(MyBaseThing) //, eEngineName.NMIService, "BTMid:" + MyBaseThing.cdeMID.ToString(), null) { DefaultView = eDefaultView.IFrame, PropertyBag = new nmiCtrlIFrameView { TileWidth = 18, TileHeight = 11, Source = $"/CDEWRA{MyBaseThing.cdeMID}", OnIFrameLoaded = "NOWN:IFRA" } }; tMyLiveForm.RegisterEvent2(eUXEvents.OnLoad, (pMsg, Para) => { //TheNMIEngine.SetUXProperty(pMsg.Message.GetOriginator(), tMyLiveForm.cdeMID, $"Source={HostUrl}/CDEWRA{MyBaseThing.cdeMID}"); }); TheNMIEngine.AddFormToThingUX(MyBaseThing, tMyLiveForm, "CMyForm", $"WebApp: {MyBaseThing.FriendlyName}", 1, 3, 0, Category, null, new ThePropertyBag() { }); MyBaseThing.RegisterEvent($"OnLoaded:{tMyLiveForm.cdeMID}:IFRA", (sender, obj) => { if (!(obj is TheProcessMessage t)) { return; } //TheNMIEngine.SetUXProperty(t.Message.GetOriginator(), tMyLiveForm.cdeMID, "Source=http://www.c-labs.com"); });
public override void DoCreateUX(TheFormInfo tMyForm, ThePropertyBag pChartsBag = null) { base.DoCreateUX(tMyForm); AddSpeedGauge(tMyForm); var tEngage = TheNMIEngine.AddSmartControl(MyBaseThing, tMyForm, eFieldType.TileButton, 25012, 2, 0xC0, "Restart KPI", null, new nmiCtrlNumber { ParentFld = TheDefaultSensor.SensorActionArea, TileWidth = 6, NoTE = true }); tEngage.RegisterUXEvent(MyBaseThing, eUXEvents.OnClick, "reset", (sender, para) => { EngageMapper(); }); var tRemove = TheNMIEngine.AddSmartControl(MyBaseThing, tMyForm, eFieldType.TileButton, 25013, 2, 0xC0, "Delete this KPI Report", null, new nmiCtrlNumber { ParentFld = TheDefaultSensor.SensorActionArea, TileWidth = 6, NoTE = true }); tRemove.RegisterUXEvent(MyBaseThing, eUXEvents.OnClick, "remove", (sender, para) => { TheThing tT = TheThingRegistry.GetThingByID(MyBaseEngine.GetEngineName(), MyBaseThing.ID); if (tT != null) { TheThingRegistry.UnmapPropertyMapper(mRealThingGuid); TheThingRegistry.DeleteThing(tT); } }); }
public virtual void CreateUXBase(string formTitle) { var tFlds = TheNMIEngine.AddStandardForm(MyBaseThing, "FACEPLATE"); MyForm = tFlds["Form"] as TheFormInfo; var ts = TheNMIEngine.AddStatusBlock(MyBaseThing, MyForm, 3); ts["Group"].SetParent(1); var tc = TheNMIEngine.AddConnectivityBlock(MyBaseThing, MyForm, 20, (pMsg, bConnect) => { if (bConnect) { Connect(); } else { Disconnect(true); } }); tc["Group"].SetParent(1); }
protected override void DoCreateUX(TheFormInfo pForm) { base.DoCreateUX(pForm); MyStatusFormDashPanel.PropertyBag = new nmiDashboardTile { Thumbnail = "FA5Bf392" }; }
public bool CreateUX() { if (!mIsUXInitStarted) { mIsUXInitStarted = true; //NUI Definition for All clients mMyDashboard = TheNMIEngine.AddDashboard(MyBaseThing, new TheDashboardInfo(MyBaseEngine, "My Sample Plugin Screens")); TheFormInfo tMyForm = TheNMIEngine.AddForm(new TheFormInfo(MyBaseThing) { FormTitle = "Welcome to my Sample Page", DefaultView = eDefaultView.Form }); TheNMIEngine.AddFormToThingUX(MyBaseThing, tMyForm, "CMyForm", "My Sample Form", 3, 3, 0, TheNMIEngine.GetNodeForCategory(), null, null); TheNMIEngine.AddSmartControl(MyBaseThing, tMyForm, eFieldType.SingleEnded, 2, 2, 0, "My Sample Value Is", "SampleProperty"); TheNMIEngine.AddSmartControl(MyBaseThing, tMyForm, eFieldType.BarChart, 3, 2, 0, "My Sample Value Bar", "SampleProperty", new nmiCtrlBarChart() { MaxValue = 255, TileHeight = 2, IsVertical = true, Foreground = "blue" }); TheNMIEngine.AddAboutButton(MyBaseThing, true); mIsUXInitCompleted = true; } return(true); }
internal static TheFormInfo GenerateForm(Guid FormId, TheClientInfo pClientInfo) { if (TheCDEngines.MyNMIService == null) { return(null); } TheFormInfo tDef = TheNMIEngine.GetFormById(FormId); if (tDef == null) { return(null); } TheFormInfo tToSend = tDef.Clone(pClientInfo.WebPlatform); TheNMIEngine.CheckAddButtonPermission(pClientInfo, tToSend); tToSend.AssociatedClassName = FormId.ToString(); var tso = GetScreenOptions(FormId, pClientInfo, tDef); if (tso != null && tso.TileWidth > 0) { tToSend.TileWidth = tso.TileWidth; } tToSend.FormFields = GetPermittedFields(FormId, pClientInfo, tso, true); return(tToSend); }
public void AddSpeedGauge(TheFormInfo tMyForm, int pFldNumber = 25000, int pParentFld = TheDefaultSensor.SensorGaugeGroup, bool IsHighGood = false) { string Plotband = ""; if (IsHighGood) { Plotband = $"PlotBand=[{{ \"from\": {TheThing.GetSafePropertyNumber(MyBaseThing, "StateSensorMinValue")}, \"to\": {TheThing.GetSafePropertyNumber(MyBaseThing, "StateSensorAverage")}, \"color\": \"#FF000088\" }}, {{ \"from\": {TheThing.GetSafePropertyNumber(MyBaseThing, "StateSensorAverage")}, \"to\": {TheThing.GetSafePropertyNumber(MyBaseThing, "StateSensorMaxValue")}, \"color\": \"#00FF0044\" }}]"; } else { Plotband = $"PlotBand=[{{ \"from\": {TheThing.GetSafePropertyNumber(MyBaseThing, "StateSensorMinValue")}, \"to\": {TheThing.GetSafePropertyNumber(MyBaseThing, "StateSensorAverage")}, \"color\": \"#00FF0088\" }}, {{ \"from\": {TheThing.GetSafePropertyNumber(MyBaseThing, "StateSensorAverage")}, \"to\": {TheThing.GetSafePropertyNumber(MyBaseThing, "StateSensorMaxValue")}, \"color\": \"#FF000044\" }}]"; } GaugeFld = TheNMIEngine.AddSmartControl(MyBaseThing, tMyForm, eFieldType.UserControl, pFldNumber, 0, 0, null, "QValue", new ThePropertyBag() { "ControlType=Speed Gauge", "NoTE=true", $"ParentFld={pParentFld}", "TileWidth=6", "TileHeight=3", $"MinValue={TheThing.GetSafePropertyNumber(MyBaseThing,"StateSensorMinValue")}", $"MaxValue={TheThing.GetSafePropertyNumber(MyBaseThing,"StateSensorMaxValue")}", $"SubTitle={TheThing.GetSafePropertyString(MyBaseThing, "StateSensorUnit")}", Plotband, $"SetSeries={{ \"name\": \"{TheThing.GetSafePropertyString(MyBaseThing, "StateSensorValueName")}\",\"data\": [{TheThing.GetSafePropertyNumber(MyBaseThing,"QValue")}],\"tooltip\": {{ \"valueSuffix\": \" {TheThing.GetSafePropertyString(MyBaseThing, "StateSensorUnit")}\"}}}}", $"Value={MyBaseThing.Value}" }); }
public override bool CreateUX() { if (!mIsUXInitCalled) { mIsUXInitCalled = true; TheNMIEngine.RegisterControlType(MyBaseEngine, "C3 Chart", "CDMyC3.ctrlC3Chart", "CDMyC3.ctrlC3Chart"); TheNMIEngine.RegisterControlType(MyBaseEngine, "Time Line Chart", "CDMyC3.ctrlTimeLineChart", "CDMyC3.ctrlTimeLineChart"); TheNMIEngine.RegisterControlType(MyBaseEngine, "Live Chart", "CDMyC3.ctrlProLiveChart"); TheNMIEngine.RegisterControlType(MyBaseEngine, "Stack Chart", "CDMyC3.ctrlC3StackChart"); TheNMIEngine.RegisterControlType(MyBaseEngine, "Cyto Chart", "CDMyC3.ctrlProCytoChart"); TheNMIEngine.RegisterControlType(MyBaseEngine, "Line Chart", "CDMyC3.ctrlC3Line"); //NUI Definition for All clients if (TheCommonUtils.CBool(TheBaseAssets.MySettings.GetSetting("ShowSamples"))) { mMyDashboard = TheNMIEngine.AddDashboard(MyBaseThing, new TheDashboardInfo(MyBaseEngine, "C3 Charts") { FldOrder = 7010, PropertyBag = new ThePropertyBag() { "Category=NMI Extensions", "HideShowAll=true", "Caption=<span style='font-size:64px'>C3</span><br>Charts" } }); TheFormInfo tMyForm = TheNMIEngine.AddForm(new TheFormInfo(MyBaseThing) { FormTitle = "C3 Samples Page", DefaultView = eDefaultView.Form }); TheNMIEngine.AddFormToThingUX(MyBaseThing, tMyForm, "CMyForm", "My Sample Form", 3, 3, 0, TheNMIEngine.GetNodeForCategory(), null, null); TheNMIEngine.AddSmartControl(MyBaseThing, tMyForm, eFieldType.CollapsibleGroup, 10, 2, 0, "Value Tester", null, new nmiCtrlCollapsibleGroup { TileWidth = 6, ClassName = "AXGroup", IsSmall = true }); TheNMIEngine.AddSmartControl(MyBaseThing, tMyForm, eFieldType.SingleEnded, 11, 2, 0, "My Sample Value Is", "SampleProperty", new nmiCtrlSingleEnded { ParentFld = 10 }); TheNMIEngine.AddSmartControl(MyBaseThing, tMyForm, eFieldType.BarChart, 12, 2, 0, "My Sample Value Bar", "SampleProperty", new nmiCtrlBarChart() { ParentFld = 10, MaxValue = 255, TileHeight = 2 }); //TheNMIEngine.AddSmartControl(MyBaseThing, tMyForm, eFieldType.CollapsibleGroup, 29, 2, 0, "Pie Demo", null, new nmiCtrlCollapsibleGroup { /*TileHeight = 5, */TileWidth = 6, ClassName = "AXGroup", IsSmall = true }); //TheNMIEngine.AddSmartControl(MyBaseThing, tMyForm, eFieldType.UserControl, 30, 2, 0, "My Pie", "SampleProperty", new ctrlC3Chart { ChartType="pie", UpdateData = true, NoTE = true, ParentFld = 29, TileHeight = 4, TileWidth = 6, SetSeries = "[[\"Dogs\", 100],[\"Cats\", 20],[\"Birds\", 34]]" }); //TheNMIEngine.AddSmartControl(MyBaseThing, tMyForm, eFieldType.CollapsibleGroup, 34, 2, 0, "Pie Demo", null, new nmiCtrlCollapsibleGroup { /*TileHeight = 5, */TileWidth = 6, ClassName = "AXGroup", IsSmall = true }); //TheNMIEngine.AddSmartControl(MyBaseThing, tMyForm, eFieldType.UserControl, 35, 2, 0, "My Gauge", "SampleProperty", new ctrlC3Chart { ChartType="gauge", UpdateData = true, TileHeight = 4, ParentFld = 34, MaxValue = 255, TileWidth = 6, SetSeries = "[[\"Dogs\", 100]]" }); TheNMIEngine.AddSmartControl(MyBaseThing, tMyForm, eFieldType.CollapsibleGroup, 39, 2, 0, "Chart Demo", null, new nmiCtrlCollapsibleGroup { /*TileHeight = 5, */ TileWidth = 12, ClassName = "AXGroup", IsSmall = true }); ctrlC3Chart.AddC3Chart(MyBaseThing, tMyForm, 50, 39, true, new ctrlC3Chart { NoTE = true, TileHeight = 4, ParentFld = 39, ChartType = "bar", TileWidth = 12, SetSeries = "[[\"Dogs\", 100],[\"Cats\", 20],[\"Birds\", 34]]", Group = "[[\"Dogs\", \"Cats\"]]" }); TheNMIEngine.AddAboutButton(MyBaseThing); } TheNMIEngine.RegisterEngine(MyBaseEngine); 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, "<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); }
protected override void DoCreateUX(TheFormInfo pForm) { base.DoCreateUX(pForm); var AdressFld = TheNMIEngine.GetFieldByFldOrder(pForm, 124); AdressFld.Header = "Address of Graylog Server"; var tcheck = TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.SingleCheck, 140, 2, 0x80, "Write to Console", "ToConsole", new nmiCtrlSingleCheck { ParentFld = 120 }); }
protected override void DoCreateUX(TheFormInfo pForm) { base.DoCreateUX(pForm); var AdressFld = TheNMIEngine.GetFieldByFldOrder(pForm, 124); AdressFld.Header = "Path to IIS Trace Logs Folder"; //TheNMIEngine.AddSmartControl(MyBaseThing, pForm, eFieldType.SingleEnded, 200, 2, 0, "Path to IIS Trace Logs Folder", nameof(IISFailedReqTraceFolderPath), new nmiCtrlSingleEnded { TileWidth = 6, ParentFld = 120, HelpText = "e.g. C:\\inetpub\\logs\\FailedReqLogFiles\\W3SVC1" }); TheNMIEngine.AddSmartControl(MyBaseThing, pForm, eFieldType.SingleCheck, 201, 2, 0, "Disable Write to SYSLOG", nameof(DisableWriteToSYSLOG), new nmiCtrlSingleCheck { ParentFld = 120, DefaultValue = "false" }); }
void CreateScriptEditTemplate() { MSE = new TheFormInfo(new Guid("{00000000-6AD1-45AE-BE61-96AF02329613}"), eEngineName.NMIService, "Script Editor", null) { DefaultView = eDefaultView.Form, IsNotAutoLoading = true, PropertyBag = new nmiCtrlFormTemplate { TableReference = $"{TheThing.GetSafeThingGuid(MyBaseThing, "SCRIPT_TABLE")}", TileWidth = 12 } }; TheNMIEngine.AddFormToThingUX(MyBaseThing, MSE, "CMyForm", "Script Editor", 100, 3, 0xF0, null, null, new ThePropertyBag() { "Visibility=false" }); TheNMIEngine.AddSmartControl(MyBaseThing, MSE, eFieldType.SingleEnded, 50, 0, 0, "Script Name", "ScriptName", new nmiCtrlSingleEnded() { TileWidth = 12 }); TheNMIEngine.AddSmartControl(MyBaseThing, MSE, eFieldType.TextArea, 60, 2, 0, null, "ScriptRaw", new nmiCtrlTextArea() { NoTE = true, TileWidth = 12, TileHeight = 12 }); TheNMIEngine.AddSmartControl(MyBaseThing, MSE, eFieldType.TextArea, 110, 0, 0, "Last Error", "ScriptError", new nmiCtrlTextArea() { TileWidth = 12, TileHeight = 3 }); var but = TheNMIEngine.AddSmartControl(MyBaseThing, MSE, eFieldType.TileButton, 100, 2, 0, "Save Script", null, new nmiCtrlTileButton() { TileWidth = 6, NoTE = true, TileHeight = 1, ClassName = "cdeGoodActionButton" }); but.RegisterUXEvent(MyBaseThing, eUXEvents.OnClick, "SaveScript", (sender, pPara) => { if (!(pPara is TheProcessMessage pMSG) || pMSG.Message == null) { return; } var tP = pMSG.Message.PLS.Split(':'); var t = MyScriptTableStorage.MyMirrorCache.GetEntryByID(TheCommonUtils.CGuid(tP[2])); try { var Res = TheCommonUtils.DeserializeJSONStringToObject <TheScript>(t.ScriptRaw); t.ScriptError = "ok"; MSE.Reload(pMSG, true); } catch (Exception ee) { t.ScriptError = ee.ToString(); MSE.Reload(pMSG, true); return; } File.WriteAllText(t.FileName, t.ScriptRaw); TheCommCore.PublishToOriginator(pMSG.Message, new TSM(eEngineName.NMIService, "NMI_TTS", TheThing.GetSafeThingGuid(MyBaseThing, "SCRIPT_TABLE").ToString())); //This is the same as the TTS:.. from above...but with an additional roundtrip to the Relay });
public override bool CreateUX() { if (mIsUXInitCalled) { return(false); } mIsUXInitCalled = true; tDashGuid = TheNMIEngine.AddDashboard(MyBaseThing, new TheDashboardInfo(MyBaseEngine, "") { PropertyBag = new ThePropertyBag() { "Category=Services", "Caption=Web-Relay", "Thumbnail=FA5:f382" }, FldOrder = 8500, cdeA = 0 }); TheFormInfo tRelayForm = TheNMIEngine.CreateEngineForms(MyBaseThing, TheThing.GetSafeThingGuid(MyBaseThing, MyBaseEngine.GetFriendlyName()), "Admin Apps", null, 1, 1, 0x00C0, "Administration", "REFRESH_DASH"); tRelayForm.GetFromFirstNodeOnly = true; tRelayForm.AddButtonText = "Add New Site"; tRelayForm.AddACL = 128; tRelayForm.defDataSource = $"TheThing;:;0;:;True;:;EngineName={MyBaseEngine.GetEngineName()};DeviceType={eWebAppTypes.TheWebApp}"; tRelayForm.AssociatedClassName = "CMyTable"; TheNMIEngine.AddSmartControl(MyBaseThing, tRelayForm, eFieldType.SingleEnded, 40, 2, 0x80, "###Address###", "Address", new nmiCtrlSingleEnded { FldWidth = 6, TileWidth = 6, HelpText = "Leave blank to use Relay-Web-Server", Caption = "Target Url" }); TheNMIEngine.AddSmartControl(MyBaseThing, tRelayForm, eFieldType.SingleEnded, 60, 2, 0x80, "Category", "Category", new nmiCtrlSingleEnded() { FldWidth = 2 }); TheNMIEngine.AddSmartControl(MyBaseThing, tRelayForm, eFieldType.SingleEnded, 50, 2, 0x80, "HomePage", "HomePage", new nmiCtrlSingleEnded() { FldWidth = 2, DefaultValue = "/" }); TheNMIEngine.AddSmartControl(MyBaseThing, tRelayForm, eFieldType.CheckField, 80, 2, 0x80, "ACL", "cdeA", new nmiCtrlCheckField { FldWidth = 8, DefaultValue = "0", Bits = 8 }); TheNMIEngine.AddSmartControl(MyBaseThing, tRelayForm, eFieldType.SingleEnded, 90, 2, 0x80, "UserID", "SUID", new nmiCtrlSingleEnded() { FldWidth = 2 }); TheNMIEngine.AddSmartControl(MyBaseThing, tRelayForm, eFieldType.Password, 100, 3, 0x80, "Password", "SPWD", new nmiCtrlPassword { FldWidth = 2 }); TheNMIEngine.AddSmartControl(MyBaseThing, tRelayForm, eFieldType.SingleCheck, 110, 2, 0x80, "HTTP1.0", "IsHTTP10", new nmiCtrlSingleCheck { FldWidth = 1 }); mIsUXInitialized = true; return(true); }
public override bool CreateUX() { if (!mIsUXInitCalled) { mIsUXInitCalled = true; var tFormGuid = new TheFormInfo(MyBaseThing) { FormTitle = "Event Log", defDataSource = "EventLog", IsReadOnly = true, IsNotAutoLoading = true, PropertyBag = new nmiCtrlTableView { ShowFilterField = true } }; TheNMIEngine.AddFormToThingUX(MyBaseThing, tFormGuid, "CMyTable", "Event Log", 6, 3, 128, $"..Event Logs on {TheCommonUtils.GetMyNodeName()}", null, new ThePropertyBag { "Thumbnail=FA5:f073" }); //;:;50;:;True //TheNMIEngine.AddForm(tFormGuid); TheNMIEngine.AddFields(tFormGuid, new List <TheFieldInfo> { { new TheFieldInfo() { FldOrder = 5, DataItem = "EventCategory", Flags = 0, Type = eFieldType.DateTime, Header = "Category", FldWidth = 2 } }, { new TheFieldInfo() { FldOrder = 10, DataItem = "EventTime", Flags = 0, Type = eFieldType.DateTime, Header = "Event Time", FldWidth = 2 } }, { new TheFieldInfo() { FldOrder = 20, DataItem = "StationName", Flags = 0, Type = eFieldType.SingleEnded, Header = "Node Name", FldWidth = 2 } }, { new TheFieldInfo() { FldOrder = 30, DataItem = "EventName", Flags = 0, Type = eFieldType.SingleEnded, Header = "Event Name", FldWidth = 2 } }, { new TheFieldInfo() { FldOrder = 40, DataItem = "EventString", Flags = 0, Type = eFieldType.SingleEnded, Header = "Event", FldWidth = 4 } }, { new TheFieldInfo() { FldOrder = 50, DataItem = "EventTrigger", Flags = 0, Type = eFieldType.SingleEnded, Header = "Trigger Object", FldWidth = 2 } }, { new TheFieldInfo() { FldOrder = 60, DataItem = "ActionObject", Flags = 0, Type = eFieldType.SingleEnded, Header = "Action Object", FldWidth = 2 } }, }); mIsUXInitialized = true; } return(true); }
static public void TheSensorLabel(TheThing pBaseThing, TheFormInfo pFormInfo, int pFldOrder, int pParent, string LabelTitle, string pValue, string pFormat = "") { TheNMIEngine.AddSmartControl(pBaseThing, pFormInfo, eFieldType.SmartLabel, pFldOrder, 0, 0, LabelTitle, pValue, new nmiCtrlSmartLabel() { ParentFld = pParent, TileFactorY = 2, TileWidth = 6, LabelClassName = "cdeSensorLabel", Background = "transparent", FontSize = 16, HorizontalAlignment = "left", VerticalAlignment = "center", Format = pFormat // Value = pValue }); }
public override void CreateUXBase(string formTitle) { base.CreateUXBase(formTitle); // Form for the Things for which events are to be sent to the cloud string tDataSource = nameof(TConnectionThing); if (MyConnectionThings != null) { tDataSource = MyConnectionThings.StoreMID.ToString(); } MyConnectionThingsForm = new TheFormInfo(TheThing.GetSafeThingGuid(MyBaseThing, "AzureThings_ID"), eEngineName.NMIService, $"{formTitle}: Things to Connect", tDataSource) { IsNotAutoLoading = true, AddButtonText = "Add new Thing" }; TheNMIEngine.AddFormToThingUX(MyBaseThing, MyConnectionThingsForm, "CMyTable", $"{formTitle} Thing List", 1, 3, 0xF0, null, null, new ThePropertyBag() { "Visibility=false" }); TheNMIEngine.AddFields(MyConnectionThingsForm, new List <TheFieldInfo> { new TheFieldInfo() { FldOrder = 12, DataItem = "ThingMID", Flags = 2, cdeA = 0xC0, Type = eFieldType.ThingPicker, Header = "Thing to Connect", FldWidth = 3, PropertyBag = new nmiCtrlThingPicker() { IncludeEngines = true } }, //new TheFieldInfo() { FldOrder=16,DataItem="PartitionKey",Flags=2,Type=eFieldType.ComboBox,Header="Partition Key for EventHub",FldWidth=3, HelpText="",DefaultValue= TheAzureThing.PartitionKeyChoices.Aggregate ("", (a,p) => a+p+";").TrimEnd(';') }, }); TheNMIEngine.AddFields(MyConnectionThingsForm, new List <TheFieldInfo> { // TODO Add Folder button? { new TheFieldInfo() { cdeA = 0x80, FldOrder = 100, DataItem = "CDE_DELETE", Flags = 2, Type = eFieldType.TileButton, TileLeft = 0, TileTop = 9, TileWidth = 1, TileHeight = 1 } }, }); // Add link to AzureThing list to AzureReceiver form TheNMIEngine.AddSmartControl(MyBaseThing, MyForm, eFieldType.TileButton, 11, 2, 0xF0, "Show Receive Thing List", null, new nmiCtrlTileButton() { NoTE = true, OnClick = $"TTS:{MyConnectionThingsForm.cdeMID}", ClassName = "cdeTransitButton", ParentFld = 3 }); }
public override bool CreateUX() { if (!mIsUXInitCalled) { mIsUXInitCalled = true; mMyDashboard = NMI.AddDashboard(MyBaseThing, new TheDashboardInfo(MyBaseEngine, "My Demo Plugin Screen with Things")); var tFlds = NMI.CreateEngineForms(MyBaseThing, TT.GetSafeThingGuid(MyBaseThing, "MYNAME"), "List of $safeitemrootname$", null, 20, 0x0F, 0xF0, NMI.GetNodeForCategory(), "REFFRESHME", true, new e$safeitemrootname$DeviceTypes(), e$safeitemrootname$DeviceTypes.cdeThingDeviceTypeA); TheFormInfo tForm = tFlds["Form"] as TheFormInfo; tForm.AddButtonText = "Add new $safeitemrootname$"; NMI.RegisterEngine(MyBaseEngine); //Registers this engine and its resources with the C-DEngine mIsUXInitialized = true; } return(true); }
public static TheFieldInfo Add4x2Edit(TT MyBaseThing, TheFormInfo pForm, eFieldType pType, int StartFld, int ParentFld, int flg, string pLabel, string pUpdateName, ThePropertyBag pBag = null) { NMI.AddSmartControl(MyBaseThing, pForm, eFieldType.TileGroup, StartFld, 0, 0, null, null, new nmiCtrlTileGroup { ParentFld = ParentFld, TileWidth = 6 }); NMI.AddSmartControl(MyBaseThing, pForm, eFieldType.SmartLabel, StartFld + 1, 0, 0, null, null, new nmiCtrlSmartLabel { Style = "width:80%; font-size:20px; text-align:left; padding:20px;", NoTE = true, Text = pLabel, ParentFld = StartFld, TileWidth = 4 }); var fld = NMI.AddSmartControl(MyBaseThing, pForm, pType, StartFld + 2, flg, 0, null, pUpdateName, new nmiCtrlNumber { ParentFld = StartFld, TileWidth = 2 }); if (pBag != null) { fld.PropertyBag = pBag; } return(fld); }
private void AddWizardHeader(TheFormInfo tMyForm2) { //Sanja header TheNMIEngine.AddSmartControl(MyBaseThing, tMyForm2, eFieldType.TileGroup, 2, 0, 0, null, null, new nmiCtrlTileGroup { TileWidth = 12, TileHeight = 1 }); TheNMIEngine.AddSmartControl(MyBaseThing, tMyForm2, eFieldType.TileGroup, 3, 0, 0, null, null, new nmiCtrlTileGroup { ParentFld = 2, TileWidth = 4, TileHeight = 1 }); TheNMIEngine.AddSmartControl(MyBaseThing, tMyForm2, eFieldType.TileGroup, 4, 0, 0, null, null, new nmiCtrlTileGroup { ParentFld = 2, TileWidth = 8, TileHeight = 1, }); TheNMIEngine.AddSmartControl(MyBaseThing, tMyForm2, eFieldType.Picture, 5, 0, 0, null, null, new nmiCtrlPicture { ParentFld = 3, TileWidth = 4, TileHeight = 1, Source = "Images/logowz.png", NoTE = true, }); TheNMIEngine.AddSmartControl(MyBaseThing, tMyForm2, eFieldType.SmartLabel, 6, 0, 0, null, null, new nmiCtrlSmartLabel { ParentFld = 4, TileWidth = 8, TileHeight = 1, FontSize = 30, VerticalAlignment = "center", NoTE = true, Text = "Welcome to the rule creating wizard." }); //Remove this section if we decide no direct navivation to a page TheNMIEngine.AddSmartControl(MyBaseThing, tMyForm2, eFieldType.TileButton, 10, 2, 0, "Welcome", null, new nmiCtrlTileButton { ParentFld = 200, OnClick = "GRP:WizarePage:1", TileWidth = 2, TileHeight = 1, TileFactorY = 2, NoTE = true }); TheNMIEngine.AddSmartControl(MyBaseThing, tMyForm2, eFieldType.TileButton, 20, 2, 0, "Rule Trigger", null, new nmiCtrlTileButton { ParentFld = 200, OnClick = "GRP:WizarePage:2", TileWidth = 2, TileHeight = 1, TileFactorY = 2, NoTE = true }); TheNMIEngine.AddSmartControl(MyBaseThing, tMyForm2, eFieldType.TileButton, 30, 2, 0, "Action Type", null, new nmiCtrlTileButton { ParentFld = 200, OnClick = "GRP:WizarePage:3", TileWidth = 2, TileHeight = 1, TileFactorY = 2, NoTE = true }); TheNMIEngine.AddSmartControl(MyBaseThing, tMyForm2, eFieldType.TileButton, 40, 2, 0, "Action Object", null, new nmiCtrlTileButton { ParentFld = 200, OnClick = "GRP:WizarePage:4", TileWidth = 2, TileHeight = 1, TileFactorY = 2, NoTE = true }); TheNMIEngine.AddSmartControl(MyBaseThing, tMyForm2, eFieldType.TileButton, 50, 2, 0, "Action TSM", null, new nmiCtrlTileButton { ParentFld = 200, OnClick = "GRP:WizarePage:5", TileWidth = 2, TileHeight = 1, TileFactorY = 2, NoTE = true }); TheNMIEngine.AddSmartControl(MyBaseThing, tMyForm2, eFieldType.TileButton, 60, 2, 0, "Finish", null, new nmiCtrlTileButton { ParentFld = 200, OnClick = "GRP:WizarePage:6", TileWidth = 2, TileHeight = 1, TileFactorY = 2, NoTE = true }); //horizontal line TheNMIEngine.AddSmartControl(MyBaseThing, tMyForm2, eFieldType.TileGroup, 65, 0, 0, null, null, new nmiCtrlTileGroup { TileWidth = 12, TileHeight = 1, TileFactorY = 12, Background = "white", Opacity = .2 }); }
public bool CreateUX() { if (!mIsUXInitStarted) { mIsUXInitStarted = true; mMyDashboard = TheNMIEngine.AddDashboard(MyBaseThing, new TheDashboardInfo(MyBaseEngine, "My NMI Demo Screens") { PropertyBag = new nmiDashboardTile { Caption = "<i class='fa faIcon fa-5x'></i></br>NMI Demo Screens", Category = "NMI Extensions" } }); var tFlds = TheNMIEngine.CreateEngineForms(MyBaseThing, TheThing.GetSafeThingGuid(MyBaseThing, "MYNAME"), "List of TheDemoScreens", null, 20, 0x0F, 0xF0, TheNMIEngine.GetNodeForCategory(), "REFFRESHME", true, new eTheDemoScreensTypes(), eTheDemoScreensTypes.DemoIFrame); TheFormInfo tForm = tFlds["Form"] as TheFormInfo; TheNMIEngine.RegisterEngine(MyBaseEngine); mIsUXInitCompleted = true; } return(true); }
public override bool CreateUX() { if (!mIsUXInitCalled) { mIsUXInitCalled = true; var tHead = TheNMIEngine.AddStandardForm(MyBaseThing, MyBaseThing.FriendlyName, 12, null, null, 0, $"..Event Logs on {TheCommonUtils.GetMyNodeName()}"); MyStatusForm = tHead["Form"] as TheFormInfo; // TheNMIEngine.AddForm(new TheFormInfo(MyBaseThing) { FormTitle = MyBaseThing.DeviceType, DefaultView = eDefaultView.Form, PropertyBag = new ThePropertyBag { "MaxTileWidth=6" } }); MyStatusFormDashPanel = tHead["DashIcon"] as TheDashPanelInfo; var tBlock = TheNMIEngine.AddStatusBlock(MyBaseThing, MyStatusForm, 2); tBlock["Group"].SetParent(1); tBlock = TheNMIEngine.AddConnectivityBlock(MyBaseThing, MyStatusForm, 120, sinkConnect); tBlock["Group"].SetParent(1); DoCreateUX(tHead["Form"] as TheFormInfo); mIsUXInitialized = true; } return(true); }
protected override void DoCreateUX(TheFormInfo pForm) { base.DoCreateUX(pForm); pForm.PropertyBag = new nmiCtrlFormView { MaxTileWidth = 12 }; TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.SingleCheck, 140, 2, 0x80, "Write to Console", "WriteToConsole", new nmiCtrlSingleCheck { ParentFld = 120, TileWidth = 3 }); TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.SingleCheck, 141, 2, 0x80, "Each Category in separate file", "EachCategoryInOwnFile", new nmiCtrlSingleCheck { ParentFld = 120, TileWidth = 3 }); TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.SingleCheck, 142, 2, 0x80, "Each day in a separate file", "EachDayInOwnFile", new nmiCtrlSingleCheck { ParentFld = 120, TileWidth = 3 }); //TODO: add log Details (LogFileLocation, MaxLength, MaxFiles, EachCategoryInOwnFile) CreateLogTable(1000, 1); }
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); }
/// <summary> /// Similar to the MidTypeC, but with more items and is scrollable /// creates a tile group (8x8) with Title(8x1) and 11 label/value smart labels (8x1) TEMPERATURE /// </summary> /// <param name="pBaseThing"></param> /// <param name="pFormInfo"></param> /// <param name="pFldOrder"></param> /// <param name="pParent"></param> /// <param name="pTtile"></param> /// <param name="pManufacturer"></param> /// <param name="pDeviceType"></param> /// <param name="pDeviceID"></param> /// <param name="pOrderID"></param> /// <param name="pSerialNum"></param> /// <param name="pHardwareVersion"></param> /// <param name="pSoftwareVersion"></param> /// <param name="pInstallDate"></param> /// <param name="pFunction"></param> /// <param name="pLocation"></param> /// <returns></returns> static public bool CreateDeviceDetails(TheThing pBaseThing, TheFormInfo pFormInfo, int pFldOrder, int pParent, List <string> tCustom = null) { var tD = TheNMIEngine.AddSmartControl(pBaseThing, pFormInfo, eFieldType.CollapsibleGroup, pFldOrder, 2, 0, "Device Description", null, new nmiCtrlCollapsibleGroup() { ParentFld = pParent, TileWidth = 6, Background = "transparent", Foreground = "black", IsSmall = true, HorizontalAlignment = "left" }); //LabelClassName = "cdeTileGroupHeaderSmall SensorGroupLabel", LabelForeground = "white", tD.AddOrUpdatePlatformBag(eWebPlatform.HoloLens, new nmiPlatBag { Hide = true }); tD.AddOrUpdatePlatformBag(eWebPlatform.TeslaXS, new nmiPlatBag { Hide = true }); tD.AddOrUpdatePlatformBag(eWebPlatform.Mobile, new nmiCtrlCollapsibleGroup { DoClose = true }); TheNMIEngine.AddSmartControl(pBaseThing, pFormInfo, eFieldType.TileGroup, pFldOrder + 1, 0, 0, null, null, new nmiCtrlCollapsibleGroup() { ParentFld = pFldOrder, TileWidth = 6, TileHeight = 4, IsVScrollable = true }); TheSensorLabel(pBaseThing, pFormInfo, pFldOrder + 2, pFldOrder + 1, "Manufacturer", "VendorName"); TheSensorLabel(pBaseThing, pFormInfo, pFldOrder + 3, pFldOrder + 1, "Product Name", "ProductName"); TheSensorLabel(pBaseThing, pFormInfo, pFldOrder + 4, pFldOrder + 1, "Product ID", "ProductID"); TheSensorLabel(pBaseThing, pFormInfo, pFldOrder + 5, pFldOrder + 1, "Product Text", "ProductText"); TheSensorLabel(pBaseThing, pFormInfo, pFldOrder + 6, pFldOrder + 1, "Serial Number", "SerialNumber"); TheSensorLabel(pBaseThing, pFormInfo, pFldOrder + 7, pFldOrder + 1, "Application Tag", "AppTag"); if (tCustom != null && tCustom.Count > 0) { var i = 0; foreach (string t in tCustom) { var ta = t.Split(','); if (ta.Length > 1) { TheSensorLabel(pBaseThing, pFormInfo, (pFldOrder + i) + 8, pFldOrder + 1, ta[0], ta[1], ta.Length > 2 ? ta[2] : ""); i++; } } } return(true); }
public static void AddC3Chart(TheThing pMyBaseThing, TheFormInfo pForm, int pFldOrder, int parentFld, bool AddTestGroup, ThePropertyBag pBag) { if (pBag == null) { pBag = new ThePropertyBag(); } if (parentFld >= 0) { ThePropertyBag.PropBagUpdateValue(pBag, "ParentFld", "=", parentFld.ToString()); } var tChartCtrl = TheNMIEngine.AddSmartControl(pMyBaseThing, pForm, eFieldType.UserControl, pFldOrder, 2, 0, null, "SampleProperty", pBag); if (AddTestGroup) { TheNMIEngine.AddSmartControl(pMyBaseThing, pForm, eFieldType.CollapsibleGroup, pFldOrder + 1, 2, 0, "Chart Settings", null, new nmiCtrlCollapsibleGroup { ParentFld = parentFld, IsSmall = true, DoClose = true }); var tFld = TheNMIEngine.AddSmartControl(pMyBaseThing, pForm, eFieldType.ComboBox, pFldOrder + 2, 2, 0, "Chart Type", null, new nmiCtrlComboBox { ParentFld = pFldOrder + 1, DefaultValue = "line", Options = "pie;bar;gauge;donut;spline;step;area;area-spline;area-step;scatter;line" }); tFld.RegisterUXEvent(pMyBaseThing, eUXEvents.OnPropertyChanged, "Value", (sender, para) => { var t = para as TheProcessMessage; if (t != null) { tChartCtrl.SetUXProperty(t.Message.GetOriginator(), $"ChartType={t.Message.PLS}"); } }); var tFld2 = TheNMIEngine.AddSmartControl(pMyBaseThing, pForm, eFieldType.SingleCheck, pFldOrder + 3, 2, 0, "Update Data", null, new nmiCtrlSingleCheck { ParentFld = pFldOrder + 1 }); tFld2.RegisterUXEvent(pMyBaseThing, eUXEvents.OnPropertyChanged, "Value", (sender, para) => { var t = para as TheProcessMessage; if (t != null) { tChartCtrl.SetUXProperty(t.Message.GetOriginator(), $"UpdateData={t.Message.PLS}"); } }); } }
public static TheFieldInfo AddSpeedGauge(TT MyBaseThing, TheFormInfo tMyForm, int pFldNumber, int pParentFld, string Label, string Units, string UpdateName, int MinVal, int MaxVal, int errLevel, int Wid = 4, bool invertRange = false) { string Plotband = $"PlotBand=[{{ \"from\": {MinVal}, \"to\": {errLevel}, \"color\": \"#FF000088\" }}, {{ \"from\": {errLevel}, \"to\": {MaxVal}, \"color\": \"#00FF0044\" }}]"; if (invertRange) { Plotband = $"PlotBand=[{{ \"from\": {MinVal}, \"to\": {errLevel}, \"color\": \"#00FF0044\" }}, {{ \"from\": {errLevel}, \"to\": {MaxVal}, \"color\": \"#FF000088\" }}]"; } return(NMI.AddSmartControl(MyBaseThing, tMyForm, eFieldType.UserControl, pFldNumber, 0, 0, null, UpdateName, new ThePropertyBag() { "ControlType=Speed Gauge", "NoTE=true", $"ParentFld={pParentFld}", $"TileWidth={Wid}", $"TileHeight={Wid}", $"MinValue={MinVal}", $"MaxValue={MaxVal}", $"SubTitle={Units}", Plotband, $"SetSeries={{ \"name\": \"{Label}\",\"data\": [{TT.GetSafePropertyNumber(MyBaseThing,UpdateName)}],\"tooltip\": {{ \"valueSuffix\": \" {Units}\"}}}}", $"Value={TT.GetSafePropertyNumber(MyBaseThing,UpdateName)}" })); }