public override void InitUX() { const string pingParameterLabel = "###PingParameterLabel#Ping Parameter...###"; const string pingDelayLabel = "###PingDelayLabel#Ping Delay###"; const string pingTimeOutLabel = "###PingTimeOutLabel#Ping Time Out###"; const string pingFailureLimitLabel = "###PingFailureLimitLabel#Failure Limit###"; const string pingTripTimeLabel = "###PingTripTimeLabel#Trip Time###"; const string pingSendRttLabel = "###PingSendRttLabel#Send RTT###"; base.InitUX(); TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.CollapsibleGroup, 300, 2, 0xc0, pingParameterLabel, null, new nmiCtrlCollapsibleGroup { DoClose = true, ParentFld = 120, /*TileWidth = 11, TileFactorX=2, */ IsSmall = true }); TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.Number, 301, 2, 0xc0, pingDelayLabel, false, "PingDelay", null, new nmiCtrlNumber { TileWidth = 4, ParentFld = 300 }); TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.Number, 302, 2, 0xc0, pingTimeOutLabel, false, "PingTimeOut", null, new nmiCtrlNumber { TileWidth = 4, ParentFld = 300 }); TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.Number, 303, 2, 0xc0, pingFailureLimitLabel, false, "FailureLimit", null, new nmiCtrlNumber { TileWidth = 4, ParentFld = 300 }); TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.Number, 304, 0, 0x00, pingTripTimeLabel, false, "RoundTripTime", null, new nmiCtrlNumber { TileWidth = 4, ParentFld = 300 }); TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.SingleCheck, 305, 2, 0x00, pingSendRttLabel, false, "AllowRTT", null, new nmiCtrlSingleCheck { TileWidth = 3, ParentFld = 300 }); }
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}" }); }
private void SetCtrlType() { if (CountBar == null) { return; } string tControl = ThePropertyBag.PropBagGetValue(CountBar.PropertyBag, "ControlType", "="); eFieldType tCtrlType = eFieldType.SingleEnded; if (!string.IsNullOrEmpty(tControl) && TheCommonUtils.CInt(tControl) == 0 && tControl.Length > 0) { TheControlType tType = TheNMIEngine.GetControlTypeByType(tControl); if (tType != null) { ThePropertyBag.PropBagUpdateValue(CountBar.PropertyBag, "EngineName", "=", tType.BaseEngineName); } tCtrlType = eFieldType.UserControl; } else { tCtrlType = (eFieldType)TheCommonUtils.CInt(tControl); } CountBar.Type = tCtrlType; CountBar.Flags = TheCommonUtils.CInt(ThePropertyBag.PropBagGetValue(CountBar.PropertyBag, "Flags", "=")); CountBar.PropertyBag = new TheNMIBaseControl { ParentFld = 1 }; CountBar.UpdateUXProperties(Guid.Empty); CountBar.RegisterUXEvent(MyBaseThing, eUXEvents.OnClick, "click", (sener, para) => { TheThing.SetSafePropertyBool(MyBaseThing, "ClickState", !TheThing.GetSafePropertyBool(MyBaseThing, "ClickState")); }); }
protected override void DoCreateUX(TheFormInfo pForm) { base.DoCreateUX(pForm); var AdressFld = TheNMIEngine.GetFieldByFldOrder(pForm, 124); AdressFld.Header = "RSS Endpoint"; }
public override bool DoCreateUX() { TheThing.SetSafePropertyString(MyBaseThing, "StateSensorIcon", "/Images/iconToplogo.png"); var res = base.DoCreateUX(); var ValueFld = TheNMIEngine.GetFieldByFldOrder(base.MyStatusForm, 15); ValueFld.Type = eFieldType.SingleEnded; TheNMIEngine.DeleteFieldsByRange(base.MyStatusForm, 14, 14); TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.DateTime, 14, 0, 0, "###Last Update###", "SourceTimeStamp", new nmiCtrlDateTime() { ParentFld = 10 }); SummaryForm.PropertyBag = new nmiDashboardTile() { Category = "..", Caption = "hhh" }; TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.SingleCheck, 523, 2, 128, "Array 2 Properties", "StoreArrayInProperties", new nmiCtrlDateTime() { ParentFld = 500 }); return(res); }
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"); });
void SetupModbusProperties(bool bReload, TheProcessMessage pMsg) { if (MyModConnectForm != null) { List <TheFieldInfo> tLst = TheNMIEngine.GetFieldsByFunc(s => s.FormID == MyModConnectForm.cdeMID); foreach (TheFieldInfo tInfo in tLst) { if (tInfo.FldOrder >= 600 && TheCommonUtils.CInt(tInfo.PropBagGetValue("ParentFld")) == 500) { TheNMIEngine.DeleteFieldById(tInfo.cdeMID); } } List <cdeP> props = MyBaseThing.GetPropertiesMetaStartingWith("MODPROP"); int fldCnt = 600; foreach (var p in props) { var field = MyModFieldStore.MyMirrorCache.GetEntryByFunc(s => s.PropertyName == p.Name); if (field != null) { TheNMIEngine.AddSmartControl(MyBaseThing, MyModConnectForm, eFieldType.SingleEnded, fldCnt++, field.AllowWrite ? 2 : 0, 0, p.Name, p.Name, new nmiCtrlSingleEnded() { TileWidth = 6, ParentFld = 500 }); } } MyModConnectForm.Reload(pMsg, bReload); } }
public override bool CreateUX() { if (!mIsUXInitCalled) { mIsUXInitCalled = true; var tMyForm2 = TheNMIEngine.AddStandardForm(MyBaseThing, MyBaseThing.FriendlyName, 6, MyBaseThing.cdeMID.ToString(), null, 0xC0, "Images"); (tMyForm2["DashIcon"] as TheDashPanelInfo)?.SetUXProperty(Guid.Empty, $"BackgroundImage={TheThing.GetSafePropertyString(MyBaseThing,"CurrentImage").Replace('\\','/')}"); var tMyForm = tMyForm2["Form"] as TheFormInfo; tMyForm.RegisterEvent2(eUXEvents.OnShow, (sender, para) => { (tMyForm2["DashIcon"] as TheDashPanelInfo)?.SetUXProperty(Guid.Empty, $"BackgroundImage={TheThing.GetSafePropertyString(MyBaseThing, "CurrentImage").Replace('\\', '/')}"); }); TheNMIEngine.AddSmartControl(MyBaseThing, tMyForm, eFieldType.TileGroup, 10, 0, 0, null, null, new nmiCtrlPicture { ParentFld = 1, TileWidth = 6 }); TheNMIEngine.AddSmartControl(MyBaseThing, tMyForm, eFieldType.DropUploader, 20, 2, 0, "###Drop an image-file here###", "CurrentImage", new nmiCtrlDropUploader { TileHeight = 6, ParentFld = 10, NoTE = true, TileWidth = 6, EngineName = MyBaseEngine.GetEngineName(), MaxFileSize = 500000 }); TheNMIEngine.AddSmartControl(MyBaseThing, tMyForm, eFieldType.SingleEnded, 30, 2, 0, "###Image Name###", "FriendlyName", new nmiCtrlSingleEnded { ParentFld = 10 }); mIsUXInitialized = true; } return(true); }
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); }
private void SetCtrlType() { if (MySampleControl == null) { return; } string tControl = ThePropertyBag.PropBagGetValue(MySampleControl.PropertyBag, "ControlType", "="); eFieldType tCtrlType = eFieldType.SingleEnded; if (!string.IsNullOrEmpty(tControl) && TheCommonUtils.CInt(tControl) == 0 && tControl.Length > 0) { TheControlType tType = TheNMIEngine.GetControlTypeByType(tControl); if (tType != null) { ThePropertyBag.PropBagUpdateValue(MySampleControl.PropertyBag, "EngineName", "=", tType.BaseEngineName); } tCtrlType = eFieldType.UserControl; } else { tCtrlType = (eFieldType)TheCommonUtils.CInt(tControl); } MySampleControl.Type = tCtrlType; MySampleControl.Flags = TheCommonUtils.CInt(ThePropertyBag.PropBagGetValue(MySampleControl.PropertyBag, "Flags", "=")); MySampleControl.UpdateUXProperties(Guid.Empty); }
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); }
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; 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 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); }
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); }
void sinkUpdateUX(cdeP pProp) { int i = MyBaseThing.StatusLevel; //Optimizing that GetProperty is not called 3 times SummaryForm?.SetUXProperty(Guid.Empty, string.Format("Background={0}", TheNMIEngine.GetStatusColor(i))); MyBaseEngine.ProcessMessage(new TheProcessMessage(new TSM(MyBaseEngine.GetEngineName(), "UPDATE_VALUE"))); }
public override void DoCreateUX() { var flds = TheNMIEngine.AddNewWizard(MyBaseThing, new Guid("6C34871C-D49B-4D7A-84E0-35E25B1F18B8"), "Welcome to the Test Automation Demo", new nmiCtrlWizard { SideBarTitle = "DEMO: Test Automation Wizard", SideBarIconFA = "", Caption = "New Test Automation Wizard" }); var tMyForm2 = flds["Form"] as TheFormInfo; AddWizardHeader(tMyForm2); //Not Required but looks nice. Might become a later addition to the APIs var tFlds = TheNMIEngine.AddNewWizardPage(MyBaseThing, tMyForm2, 0, 1, 2, null /*"TEST"*/); TheNMIEngine.AddWizardControl(MyBaseThing, tMyForm2, eFieldType.SmartLabel, 1, 0, 0, 0, null, null, new TheNMIBaseControl { Value = "Before starting this wizard you need to have a node type for application to test and agents running on your test enviroment", NoTE = true, FontSize = 18 }); tFlds = TheNMIEngine.AddNewWizardPage(MyBaseThing, tMyForm2, 1, 2, 3, null /* "Rule Trigger"*/); TheNMIEngine.AddWizardControl(MyBaseThing, tMyForm2, eFieldType.SingleEnded, 2, 1, 2, 0, "TestName", "TestName", new nmiCtrlThingPicker { }); TheNMIEngine.AddWizardControl(MyBaseThing, tMyForm2, eFieldType.PropertyPicker, 2, 2, 2, 0, "Select Node Type to Test", "NodeType", new nmiCtrlPropertyPicker { ThingFld = 260 }); TheNMIEngine.AddWizardControl(MyBaseThing, tMyForm2, eFieldType.Number, 2, 3, 2, 0, "Instance Counter", "InstanceCounter", new nmiCtrlNumber { Explainer = "Instance Counter: How many instances of this type to be crated" }); TheNMIEngine.AddWizardControl(MyBaseThing, tMyForm2, eFieldType.Number, 2, 4, 2, 0, "Mesh Counter", "MeshCounter", new nmiCtrlNumber { Explainer = "Mesh Counter: How many customer meshes" }); tFlds = TheNMIEngine.AddNewWizardPage(MyBaseThing, tMyForm2, 2, 3, 4, null /*"Action Type"*/, "5:'<%MyPropertyBag.ActionObjectType.Value%>'!='CDE_THING' && '<%MyPropertyBag.ActionObjectType.Value%>'!=''"); TheNMIEngine.AddWizardControl(MyBaseThing, tMyForm2, eFieldType.ComboBox, 3, 1, 2, 0, "Select Controller", "Controller", new nmiCtrlComboBox { }); TheNMIEngine.AddWizardControl(MyBaseThing, tMyForm2, eFieldType.TileButton, 3, 2, 2, 0, "Add Controller", "AddController", new nmiCtrlTileButton { Explainer = "Click to add to host controller." }); TheNMIEngine.AddWizardControl(MyBaseThing, tMyForm2, eFieldType.TextArea, 3, 3, 2, 0, "Controllers", "Controllers", new nmiCtrlTileButton { Explainer = "Click to add to host controller." }); tFlds = TheNMIEngine.AddNewWizardPage(MyBaseThing, tMyForm2, 3, 4, 0, null /*"Final Settings"*"*/); TheNMIEngine.AddWizardControl(MyBaseThing, tMyForm2, eFieldType.SmartLabel, 4, 1, 0, 0, null, null, new nmiCtrlSingleEnded { Value = "After finish go to", NoTE = true, FontSize = 18 }); TheNMIEngine.AddWizardControl(MyBaseThing, tMyForm2, eFieldType.TileButton, 4, 2, 2, 0, "My Test Automations", "MyTestAutomations", new nmiCtrlTileButton { TileWidth = 3, NoTE = true }); TheNMIEngine.AddWizardControl(MyBaseThing, tMyForm2, eFieldType.TileButton, 4, 3, 2, 0, "My Test Definitions", "MyTestDefinitionss", new nmiCtrlTileButton { TileWidth = 3, NoTE = true }); TheNMIEngine.AddWizardControl(MyBaseThing, tMyForm2, eFieldType.TileButton, 4, 4, 2, 0, "My Test Enviroments", "MyTestEnviroments", new nmiCtrlTileButton { TileWidth = 3, NoTE = true }); TheNMIEngine.AddWizardControl(MyBaseThing, tMyForm2, eFieldType.TileButton, 4, 5, 2, 0, "Go back to test manager", "BackToTestManager", new nmiCtrlTileButton { TileWidth = 3, NoTE = 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); }
private void ShowKPI(int pFldOrder, string pLabel, string pUpdName, int MaxVal = 100, int AveVal = 50, string pUnits = "bytes") { TheNMIEngine.AddSmartControl(MyBaseThing, mMyForm, eFieldType.TileGroup, pFldOrder, 0, 0, null, null, new nmiCtrlTileGroup { ParentFld = 300, TileWidth = 6 }); TheNMIEngine.AddSmartControl(MyBaseThing, mMyForm, eFieldType.SmartLabel, pFldOrder + 1, 0, 0, null, null, new nmiCtrlSmartLabel { ParentFld = pFldOrder, Text = pLabel, NoTE = true, TileFactorY = 2, TileHeight = 1, TileWidth = 5, ClassName = "cdeTileGroupHeaderSmall" }); var tBut = TheNMIEngine.AddSmartControl(MyBaseThing, mMyForm, eFieldType.TileButton, pFldOrder + 2, 2, 0, "V-Tise", null, new nmiCtrlTileButton { ParentFld = pFldOrder, NoTE = true, TileFactorY = 2, TileHeight = 1, TileWidth = 1, ClassName = "cdeGlassButton" }); tBut.RegisterUXEvent(MyBaseThing, eUXEvents.OnClick, $"But{pUpdName}", (sender, para) => { TheThing tT = TheThingRegistry.GetThingByID(MyBaseEngine.GetEngineName(), $"ISO{MyBaseThing.cdeMID}:{pUpdName}"); if (tT == null) { TheKPIReport tRep = new TheKPIReport(null, MyPlugin); TheThing.SetSafePropertyGuid(tRep, "RealSensorThing", MyBaseThing.cdeMID); tRep.GetBaseThing().ID = $"ISO{MyBaseThing.cdeMID}:{pUpdName}"; MyBaseThing.GetProperty(pUpdName, true); TheThing.SetSafePropertyString(tRep, "RealSensorProperty", pUpdName); TheThing.SetSafePropertyNumber(tRep, "StateSensorMaxValue", MaxVal); TheThing.SetSafePropertyNumber(tRep, "StateSensorAverage", AveVal); TheThing.SetSafePropertyNumber(tRep, "StateSensorSteps", MaxVal / 15); TheThing.SetSafePropertyString(tRep, "StateSensorValueName", pLabel); TheThing.SetSafePropertyString(tRep, "StateSensorUnit", pUnits); TheThing.SetSafePropertyString(tRep, "FriendlyName", MyBaseThing.FriendlyName); TheThing.SetSafePropertyString(tRep, "ReportName", $"ISO-KPI: {MyBaseThing.FriendlyName} - {pLabel}"); TheThing.SetSafePropertyString(tRep, "ReportCategory", "ISO KPI Reports"); ThePluginInfo tI = MyPlugin.GetBaseEngine().GetPluginInfo(); if (tI != null) { TheThing.SetSafePropertyString(tRep, "SerialNumber", TheCommonUtils.CStr(tI.CurrentVersion)); TheThing.SetSafePropertyString(tRep, "VendorName", TheCommonUtils.CStr(tI.Developer)); TheThing.SetSafePropertyString(tRep, "ProductName", TheCommonUtils.CStr(tI.ServiceDescription)); TheThing.SetSafePropertyString(tRep, "ProductText", TheCommonUtils.CStr(tI.LongDescription)); TheThing.SetSafePropertyString(tRep, "VendorText", TheCommonUtils.CStr(tI.DeveloperUrl)); TheThing.SetSafePropertyString(tRep, "ProductID", TheCommonUtils.CStr(tI.cdeMID)); } TheThingRegistry.RegisterThing(tRep); MyBaseEngine.ProcessMessage(new TheProcessMessage(new TSM(MyBaseEngine.GetEngineName(), "REFRESH_DASH"))); } else { TheCommCore.PublishToOriginator((para as TheProcessMessage).Message, new TSM(eEngineName.NMIService, "NMI_TTS", tT.cdeMID.ToString())); } }); TheNMIEngine.AddSmartControl(MyBaseThing, mMyForm, eFieldType.SmartLabel, pFldOrder + 3, 0, 0, null, pUpdName, new nmiCtrlSingleEnded { ParentFld = pFldOrder, TileWidth = 2 }); TheNMIEngine.AddSmartControl(MyBaseThing, mMyForm, eFieldType.BarChart, pFldOrder + 4, 0, 0, null, pUpdName, new nmiCtrlBarChart() { ParentFld = pFldOrder, MaxValue = MaxVal, TileWidth = 4, NoTE = true, Foreground = "blue" }); }
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) { mIsUXInitCalled = true; mMyDashboard = TheNMIEngine.AddDashboard(MyBaseThing, new TheDashboardInfo(MyBaseEngine, "Historian Sample")); TheNMIEngine.AddAboutButton4(MyBaseThing, mMyDashboard, null, true); 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); }
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 DoCreateUX() { return(true); //TODO: Make much better UX here...Remove Controls first then create (see OPC DA Plugin) #pragma warning disable CS0162 MyStatusForm = TheNMIEngine.AddForm(new TheFormInfo(MyBaseThing) { FormTitle = MyBaseThing.FriendlyName, DefaultView = eDefaultView.Form }); SummaryForm = TheNMIEngine.AddFormToThingUX(MyBaseThing, MyStatusForm, "CMyForm", MyBaseThing.FriendlyName, 3, 1, 0x0, "OPC UA Methods", "FriendlyName", new ThePropertyBag() { }); TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.SingleEnded, 1, 0, MyBaseThing.cdeA, "OPC UA Method Name", "FriendlyName"); TheFieldInfo mSendbutton = TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.TileButton, 2, 0x82, 0, "Call", false, "", null, new ThePropertyBag() { "PreventDefault", "TileWidth=2", "TileHeight=1", "Style=background-image:url('GlasButton.png');" }); mSendbutton.RegisterUXEvent(MyBaseThing, eUXEvents.OnClick, "", (pThing, pObj) => { TheProcessMessage pMsg = pObj as TheProcessMessage; if (m_Method == null || m_Method.MyOPCServer == null || !m_Method.MyOPCServer.IsConnected) { TheCommCore.PublishToOriginator(pMsg.Message, new TSM(eEngineName.NMIService, "NMI_TOAST", "Server not connected - please connect first")); return; } HandleMessage(this, new TheProcessMessage(new TSM(MyBaseThing.EngineName, "CALL_METHOD:" + TheCommonUtils.cdeGuidToString(Guid.NewGuid())))); }); TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.TextArea, 3, 0, 0xC0, "Last MSG", false, "LastMessage", null, new ThePropertyBag() { "TileWidth=6", "TileHeight=3" }); TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.SmartLabel, 100, 0, MyBaseThing.cdeA, "", false, null, null, new ThePropertyBag() { "Format=Input Arguments", "Style=font-size:20px;text-align: left;float:none;clear:left;background-color:black;color:white;" }); TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.SmartLabel, 200, 0, MyBaseThing.cdeA, "", false, null, null, new ThePropertyBag() { "Format=Output Arguments", "Style=font-size:20px;text-align: left;float:none;clear:left;background-color:black;color:white;" }); CreateDynUX(false); return(true); #pragma warning restore CS0162 }
public override bool DoCreateUX() { var tFlds = TheNMIEngine.AddStandardForm(MyBaseThing, null, 12, null, "Value"); MyStatusForm = tFlds["Form"] as TheFormInfo; SummaryForm = tFlds["DashIcon"] as TheDashPanelInfo; SummaryForm.PropertyBag = new nmiDashboardTile() { Format = $"{MyBaseThing.FriendlyName}<br>{{0}}" }; var ts = TheNMIEngine.AddStatusBlock(MyBaseThing, MyStatusForm, 10); ts["Group"].SetParent(1); ts["Value"].SetParent(1); //CountBar = TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.Number, 100, 0, 0x0, "Trigger Cnt", "Value", new nmiCtrlNumber() { ParentFld=1 }); TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.CollapsibleGroup, 200, 2, 128, "###CDMyVThings.TheVThings#Settings901637#Settings...###", null, new nmiCtrlCollapsibleGroup() { ParentFld = 1, TileWidth = 6, IsSmall = true, DoClose = true }); TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.Number, 202, 2, 0x0, "###CDMyVThings.TheVThings#MstoTrigger260442#Ms to Trigger###", "MsToTrigger", new nmiCtrlNumber() { ParentFld = 200, TileWidth = 3 }); TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.Number, 203, 2, 0x0, "###CDMyVThings.TheVThings#LoopTime96821#Loop Time###", "LoopPeriod", new nmiCtrlNumber() { ParentFld = 200, TileWidth = 3 }); var tc = TheNMIEngine.AddStartingBlock(MyBaseThing, MyStatusForm, 1000, (pMsg, DoConn) => { if (DoConn) { MyBaseThing.Value = "0"; sinkTriggered(null); } else { MyBaseThing.Value = "0"; StopTimer(); } }, 128, "IsActive"); tc["Group"].SetParent(1); tc["Group"].Header = "Timer Control"; 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 }); }