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); }
private void SinkStatChanged(TheDashPanelInfo tDas, cdeP prop) { var i = (prop != null) ? TheCommonUtils.CInt(prop.ToString()) : TheCommonUtils.CInt(MyBaseThing.Value); var tCol = i < 3 ? "orange" : "green"; var tLevel = i < 3 ? 2 : 1; if (i == 0) { tCol = "gray"; tLevel = 0; } SummaryForm.SetUXProperty(Guid.Empty, $"Background={tCol}"); if (MyBaseThing.StatusLevel != tLevel) { MyBaseThing.StatusLevel = tLevel; } }
public virtual void InitUX() { var tHead = TheNMIEngine.AddStandardForm(MyBaseThing, MyBaseThing.FriendlyName, null, 0x0, new nmiStandardForm { MaxTileWidth = 12, IconUpdateName = "StatusLevel", UseMargin = true }); MyStatusForm = tHead["Form"] as TheFormInfo; // TheNMIEngine.AddForm(new TheFormInfo(MyBaseThing) { FormTitle = MyBaseThing.DeviceType, DefaultView = eDefaultView.Form, PropertyBag = new ThePropertyBag { "MaxTileWidth=6" } }); SummaryForm = tHead["DashIcon"] as TheDashPanelInfo; MyCollapsHead = tHead["Header"] as TheFieldInfo; SummaryForm.PropertyBag = new nmiDashboardTile { Format = $"{MyBaseThing.FriendlyName}<br>Status Level: {{0}}", LabelForeground = "white", ClassName = "cdeLiveTile cdeLiveTileBar" }; var tBlock = TheNMIEngine.AddStatusBlock(MyBaseThing, MyStatusForm, 2); tBlock["Group"].SetParent(1); tBlock["Group"].Flags = 0; tBlock["Group"].cdeA = 0; tBlock["Value"].cdeA = 0; tBlock = TheNMIEngine.AddConnectivityBlock(MyBaseThing, MyStatusForm, 120, sinkConnect); tBlock["Group"].SetParent(1); sinkUpdateUX(null); }
void sinkStatChanged(TheDashPanelInfo tDas, cdeP prop) { int tLevel = 1; string tCol = "green"; int i = TheCommonUtils.CInt(MyBaseThing.Value); if (prop != null) { i = TheCommonUtils.CInt(prop.ToString()); } if (i < 3) { tCol = "orange"; tLevel = 2; } if (i == 0) { tCol = "gray"; tLevel = 0; } SummaryForm.SetUXProperty(Guid.Empty, string.Format("Background={0}", tCol)); if (MyBaseThing.StatusLevel != tLevel) { MyBaseThing.StatusLevel = tLevel; } }
public virtual bool DoCreateUX() { MyEditorForm = new TheFormInfo(MyBaseThing) { DefaultView = eDefaultView.Form, PropertyBag = new ThePropertyBag { "MaxTileWidth=6", "HideCaption=true", "AllowDrag=true" } }; MyEditorForm.ModelID = "NMIEditor"; TheDashboardInfo tDash = TheNMIEngine.GetDashboardById(TheNMIHtml5RT.eNMIDashboard); MyEditorDashIcon = TheNMIEngine.AddFormToThingUX(tDash, MyBaseThing, MyEditorForm, "CMyForm", "NMI Control Editor", 1, 0x89, 0x80, "NMI", null, new ThePropertyBag() { "RenderTarget=cdeInSideBarRight", "NeverHide=true" }); //"mAllowDrag=true", "nVisibility=false", MySampleControl = TheNMIEngine.AddSmartControl(MyBaseThing, MyEditorForm, eFieldType.SingleEnded, 3, 2, MyBaseThing.cdeA, "CurrentValue", "Value", null); TheNMIEngine.AddSmartControl(MyBaseThing, MyEditorForm, eFieldType.TileGroup, 9, 0, 0, null, null, new nmiCtrlTileGroup { TileWidth = 7, TileHeight = 1, TileFactorY = 2 }); TheNMIEngine.AddSmartControl(MyBaseThing, MyEditorForm, eFieldType.TileButton, 10, 2, 0, "Basic", null, new nmiCtrlTileButton { ParentFld = 9, OnClick = "GRP:NMIP:Basic", TileWidth = 1, TileHeight = 1, TileFactorY = 2, NoTE = true, ClassName = "cdeTransitButton" }); TheNMIEngine.AddSmartControl(MyBaseThing, MyEditorForm, eFieldType.TileButton, 20, 2, 0, "Screen", null, new nmiCtrlTileButton { ParentFld = 9, OnClick = "GRP:NMIP:Screen", TileWidth = 1, TileHeight = 1, TileFactorY = 2, NoTE = true, ClassName = "cdeTransitButton" }); TheNMIEngine.AddSmartControl(MyBaseThing, MyEditorForm, eFieldType.TileButton, 30, 2, 0, "All", null, new nmiCtrlTileButton { ParentFld = 9, OnClick = "GRP:NMIP:All", TileWidth = 1, TileHeight = 1, TileFactorY = 2, NoTE = true, ClassName = "cdeTransitButton" }); TheNMIEngine.AddSmartControl(MyBaseThing, MyEditorForm, eFieldType.TileButton, 40, 2, 0, "Source", null, new nmiCtrlTileButton { ParentFld = 9, OnClick = "GRP:NMIP:Source", TileWidth = 1, TileHeight = 1, TileFactorY = 2, NoTE = true, ClassName = "cdeTransitButton" }); //TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.TileButton, 50, 2, 0, "Compounds", null, new nmiCtrlTileButton { OnClick = "GRP:Cate:5", TileWidth = 2, TileHeight = 1, TileFactorY = 2, NoTE = true, ClassName = "cdeTransitButton" }); //TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.TileButton, 60, 2, 0, "Gauges", null, new nmiCtrlTileButton { OnClick = "GRP:Cate:6", TileWidth = 2, TileHeight = 1, TileFactorY = 2, NoTE = true, ClassName = "cdeTransitButton" }); TheFieldInfo mSendbutton = TheNMIEngine.AddSmartControl(MyBaseThing, MyEditorForm, eFieldType.TileButton, 70, 2, 0x80, "Reload", false, "", null, new nmiCtrlTileButton() { ParentFld = 9, TileWidth = 2, NoTE = true, TileFactorY = 2, ClassName = "cdeGoodActionButton" }); mSendbutton.RegisterUXEvent(MyBaseThing, eUXEvents.OnClick, "", (pThing, pPara) => { TheProcessMessage pMsg = pPara as TheProcessMessage; if (pMsg?.Message == null) { return; } UpdateUx(pThing.GetBaseThing()); MyEditorForm.Reload(pMsg, tDash.cdeMID, true); }); TheNMIEngine.AddSmartControl(MyBaseThing, MyEditorForm, eFieldType.TileGroup, 1000, 2, 0x80, null, null, new nmiCtrlTileGroup() { Group = "NMIP:Basic" }); TheNMIEngine.AddSmartControl(MyBaseThing, MyEditorForm, eFieldType.ComboBox, 1010, 2, 0x80, "Control Type", "ControlType", new ThePropertyBag() { "Options=%RegisteredControlTypes%", "ParentFld=1000" }); GetProperty("ControlType", true).RegisterEvent(eThingEvents.PropertyChanged, (p) => { UpdateUx(MyBaseThing); }); TheNMIEngine.AddSmartControl(MyBaseThing, MyEditorForm, eFieldType.Number, 1020, 2, 0, "Tile Width", "TileWidth", new nmiCtrlNumber() { ParentFld = 1000, TileHeight = 1, TileFactorY = 1, DefaultValue = "6", TileWidth = 3 }); GetProperty("TileWidth", true).RegisterEvent(eThingEvents.PropertyChanged, (p) => { MySampleControl.SetUXProperty(Guid.Empty, "TileWidth= " + p.ToString()); }); TheNMIEngine.AddSmartControl(MyBaseThing, MyEditorForm, eFieldType.Number, 1030, 2, 0, "Tile Height", "TileHeight", new nmiCtrlNumber() { ParentFld = 1000, TileHeight = 1, TileFactorY = 1, DefaultValue = "1", TileWidth = 3 }); GetProperty("TileHeight", true).RegisterEvent(eThingEvents.PropertyChanged, (p) => { MySampleControl.SetUXProperty(Guid.Empty, "TileHeight= " + p.ToString()); }); TheNMIEngine.AddSmartControl(MyBaseThing, MyEditorForm, eFieldType.ComboBox, 1040, 2, 0, "Horizontal Alignment", "HorizontalAlignment", new nmiCtrlComboBox() { ParentFld = 1000, Options = ";left;center;right" }); GetProperty("HorizontalAlignment", true).RegisterEvent(eThingEvents.PropertyChanged, (p) => { MySampleControl.SetUXProperty(Guid.Empty, "HorizontalAlignment= " + p.ToString()); }); TheNMIEngine.AddSmartControl(MyBaseThing, MyEditorForm, eFieldType.ComboBox, 1050, 2, 0, "Class Name", "ClassName", new nmiCtrlComboBox() { ParentFld = 1000, Options = ";BlueWhite;GreenYellow;RedWhite" }); GetProperty("ClassName", true).RegisterEvent(eThingEvents.PropertyChanged, (p) => { MySampleControl.SetUXProperty(Guid.Empty, "ClassName= " + p.ToString()); }); TheNMIEngine.AddSmartControl(MyBaseThing, MyEditorForm, eFieldType.SingleEnded, 1060, 2, 0, "HelpText", "HelpText", new nmiCtrlSingleEnded() { ParentFld = 1000 }); GetProperty("HelpText", true).RegisterEvent(eThingEvents.PropertyChanged, (p) => { MySampleControl.SetUXProperty(Guid.Empty, "HelpText= " + p.ToString()); }); TheNMIEngine.AddSmartControl(MyBaseThing, MyEditorForm, eFieldType.ComboBox, 1070, 2, 0, "Opacity", "Opacity", new nmiCtrlComboBox() { ParentFld = 1000, Options = ";0.1;0.3;0.5;0.7;0.9;1.0" }); GetProperty("Opacity", true).RegisterEvent(eThingEvents.PropertyChanged, (p) => { MySampleControl.SetUXProperty(Guid.Empty, "Opacity= " + p.ToString()); }); TheNMIEngine.AddSmartControl(MyBaseThing, MyEditorForm, eFieldType.SingleCheck, 1080, 2, 0, "No TE", "NoTE", new nmiCtrlSingleCheck() { ParentFld = 1000 }); GetProperty("NoTE", true).RegisterEvent(eThingEvents.PropertyChanged, (p) => { MySampleControl.SetUXProperty(Guid.Empty, "NoTE= " + p.ToString()); }); //Screen Properties TheNMIEngine.AddSmartControl(MyBaseThing, MyEditorForm, eFieldType.TileGroup, 3000, 2, 0x80, null, null, new nmiCtrlTileGroup() { Group = "NMIP:Screen", Visibility = false }); TheNMIEngine.AddSmartControl(MyBaseThing, MyEditorForm, eFieldType.ComboOption, 3010, 2, 0x80, "NMI Screen", "FormName", new ThePropertyBag() { "Options=%GetLiveScreens%", "TileWidth=6", "TileHeight=1", "ParentFld=3000" }); TheNMIEngine.AddSmartControl(MyBaseThing, MyEditorForm, eFieldType.CheckField, 3020, 2, 0x80, "Flags", "Flags", new ThePropertyBag() { "Bits=6", "TileHeight=6", "TileFactorY=2", "ImageList=<span class='fa-stack'><i class='fa fa-stack-1x'></i><i class='fa fa-stack-2x'> </i></span>," + "<span class='fa-stack'><i class='fa fa-stack-1x'></i><i class='fa fa-stack-2x'> </i></span>," + "<span class='fa-stack'><i class='fa fa-stack-1x'></i><i class='fa fa-stack-2x text-danger' style='opacity:0.5'></i></span>," + "<span class='fa-stack'><i class='fa fa-stack-1x'></i><i class='fa fa-stack-2x text-danger' style='opacity:0.5'></i></span>," + "<span class='fa-stack'><i class='fa fa-stack-1x'></i><i class='fa fa-stack-2x text-danger' style='opacity:0.5'></i></span>," + "<span class='fa-stack'><i class='fa fa-stack-1x'></i><i class='fa fa-stack-2x text-danger' style='opacity:0.5'></i></span>", "ParentFld=3000" }).FldWidth = 1; //ALL Properties TheNMIEngine.AddSmartControl(MyBaseThing, MyEditorForm, eFieldType.TileGroup, 2000, 2, 0x80, null, null, new nmiCtrlTileGroup() { TileWidth = 6, Group = "NMIP:All", Visibility = false }); TheNMIEngine.AddSmartControl(MyBaseThing, MyEditorForm, eFieldType.Table, 2010, 0xA2, 0x80, "All Properties", "mypropertybag;1", new ThePropertyBag() { "NoTE=true", "TileHeight=4", "TileLeft=9", "TileTop=3", "TileWidth=6", "FldWidth=6", "ParentFld=2000" }); TheNMIEngine.AddSmartControl(MyBaseThing, MyEditorForm, eFieldType.SingleEnded, 2020, 0x0A, 0, "New Property Name", "ScratchName", new nmiCtrlSingleEnded() { ParentFld = 2000 }); TheFieldInfo tBut = TheNMIEngine.AddSmartControl(MyBaseThing, MyEditorForm, eFieldType.TileButton, 2040, 0x0A, 0, "Add Property", false, null, null, new nmiCtrlTileButton() { ParentFld = 2000, NoTE = true, ClassName = "cdeGoodActionButton" }); tBut.RegisterUXEvent(MyBaseThing, eUXEvents.OnClick, "AddProp", (pThing, pObj) => { TheProcessMessage pMsg = pObj as TheProcessMessage; if (pMsg?.Message == null) { return; } string[] parts = pMsg.Message.PLS.Split(':'); TheThing tOrg = pThing.GetBaseThing(); // TheThingRegistry.GetThingByMID(MyBaseEngine.GetEngineName(), TheCommonUtils.CGuid(parts[2])); //if (tOrg == null) return; string tNewPropName = TheThing.GetSafePropertyString(tOrg, "ScratchName"); if (string.IsNullOrEmpty(tNewPropName)) { TheCommCore.PublishToOriginator(pMsg.Message, new TSM(eEngineName.NMIService, "NMI_TOAST", "Please specify a new property name")); } else { if (tOrg.GetProperty(tNewPropName) != null) { TheCommCore.PublishToOriginator(pMsg.Message, new TSM(eEngineName.NMIService, "NMI_TOAST", "Property already exists")); } else { tOrg.DeclareNMIProperty(tNewPropName, ePropertyTypes.TString); TheCommCore.PublishToOriginator(pMsg.Message, new TSM(eEngineName.NMIService, "NMI_TOAST", "Property Added")); MyEditorForm.Reload(pMsg, false); } tOrg.SetProperty("ScratchName", ""); } }); //THING Connector TheNMIEngine.AddSmartControl(MyBaseThing, MyEditorForm, eFieldType.TileGroup, 5000, 2, 0x80, null, null, new nmiCtrlTileGroup() { TileWidth = 6, Group = "NMIP:Source", Visibility = false }); TheNMIEngine.AddSmartControl(MyBaseThing, MyEditorForm, eFieldType.ThingPicker, 5010, 2, 0x80, "Source Thing", "Address", new nmiCtrlThingPicker() { ParentFld = 5000, IncludeEngines = true }); TheNMIEngine.AddSmartControl(MyBaseThing, MyEditorForm, eFieldType.PropertyPicker, 5020, 2, 0x80, "Source Property", "SourceProp", new nmiCtrlPropertyPicker() { ParentFld = 5000, ThingFld = 5010 }); TheFieldInfo mSendbutton2 = TheNMIEngine.AddSmartControl(MyBaseThing, MyEditorForm, eFieldType.TileButton, 5050, 2, 0x80, "Engage", false, "", null, new nmiCtrlTileButton() { NoTE = true, TileWidth = 6, ClassName = "cdeGoodActionButton", ParentFld = 5000 }); mSendbutton2.RegisterUXEvent(MyBaseThing, eUXEvents.OnClick, "", (pThing, pPara) => { TheProcessMessage pMsg = pPara as TheProcessMessage; if (pMsg?.Message == null) { return; } UpdateUx(pThing.GetBaseThing()); }); UpdateUx(MyBaseThing); return(true); }
void sinkStatChanged(TheDashPanelInfo tDas, cdeP prop) { MyBaseThing.Value = MyBaseThing.PropertyCount.ToString(); SummaryForm.SetUXProperty(Guid.Empty, string.Format("iValue={0}", MyBaseThing.Value)); }
public virtual bool CreateUX() { if (mIsUXInitCalled) { return(false); } mIsUXInitCalled = true; var tFlds = TheNMIEngine.AddStandardForm(MyBaseThing, null, 12, null, "Value"); MyStatusForm = tFlds["Form"] as TheFormInfo; SummaryForm = tFlds["DashIcon"] as TheDashPanelInfo; SummaryForm.PropertyBag = new ThePropertyBag() { string.Format("Format={0}<br>{{0}} Properties", MyBaseThing.FriendlyName), "TileWidth=2" }; SummaryForm.RegisterPropertyChanged(sinkStatChanged); var ts = TheNMIEngine.AddStatusBlock(MyBaseThing, MyStatusForm, 10); ts["Group"].SetParent(1); var tc = TheNMIEngine.AddStartingBlock(MyBaseThing, MyStatusForm, 20, (pMsg, DoStart) => { if (DoStart) { OnChangeTimer(null); } else { StopGenerator(); } }); tc["Group"].SetParent(1); ts["Group"].Header = "Settings..."; TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.Number, 51, 2, 0x0, "###CDMyVThings.TheVThings#NumberProperties187329#Number Properties###", nameof(Gen_Config_NumberOfActiveProperties), new nmiCtrlNumber() { TileWidth = 3, ParentFld = 20 }); CountBar = TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.Number, 52, 2, 0x0, "###CDMyVThings.TheVThings#Frequencyms741318#Frequency###", nameof(Gen_Config_PropertyUpdateInterval), new nmiCtrlNumber() { TileWidth = 3, ParentFld = 20 }); TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.Number, 53, 0, 0x0, "###CDMyVThings.TheVThings#PropertiesperSecond546134#Properties per Second###", nameof(Gen_Stats_PropertiesPerSecond), new nmiCtrlNumber() { TileWidth = 3, ParentFld = 20 }); TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.Number, 54, 0, 0x0, "###CDMyVThings.TheVThings#Propertycount904939#Property Counter###", nameof(Gen_Stats_PropertyCounter), new nmiCtrlNumber() { TileWidth = 3, ParentFld = 20 }); TheFieldInfo mSendbutton = TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.TileButton, 60, 2, 0, "###CDMyVThings.TheVThings#ResetCounter741318#Reset Counter###", false, "", null, new nmiCtrlTileButton() { TileWidth = 3, ParentFld = 20, ClassName = "cdeGoodActionButton", NoTE = true }); mSendbutton.RegisterUXEvent(MyBaseThing, eUXEvents.OnClick, "", (pThing, pPara) => { TheProcessMessage pMsg = pPara as TheProcessMessage; if (pMsg == null || pMsg.Message == null) { return; } this.Gen_Stats_PropertyCounter = 0; this.Gen_Stats_PropertiesPerSecond = 0; sinkStatChanged(null, null); }); //PropTable = TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.Table, 100, 0xA2, 0x80, "###CDMyVThings.TheVThings#AllProperties100123#All Properties###", "mypropertybag;1", new TheNMIBaseControl() { TileWidth = 12, TileHeight = 6, ParentFld = 1 }); PropTable = TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.Table, 100, 0xA2, 0x80, "###CDMyVThings.TheVThings#AllProperties100123#All Properties###", "mypropertybag;0", new TheNMIBaseControl() { NoTE = true, TileWidth = 12, TileHeight = 6, ParentFld = 1 }); mIsUXInitialized = true; return(true); }
public virtual bool CreateUX() { if (mIsUXInitCalled) { return(false); } mIsUXInitCalled = true; var tFlds = TheNMIEngine.AddStandardForm(MyBaseThing, null, 12, null, "Value"); MyStatusForm = tFlds["Form"] as TheFormInfo; SummaryForm = tFlds["DashIcon"] as TheDashPanelInfo; SummaryForm.PropertyBag = new ThePropertyBag() { string.Format("Format={0}<br>{{0}} Properties", MyBaseThing.FriendlyName), "TileWidth=2" }; var ts = TheNMIEngine.AddStatusBlock(MyBaseThing, MyStatusForm, 10); ts["Group"].SetParent(1); var tc = TheNMIEngine.AddStartingBlock(MyBaseThing, MyStatusForm, 20, (pMsg, DoStart) => { if (DoStart) { StartVerifier(); } else { StopVerifier(); } }); tc["Group"].SetParent(1); ts["Group"].Header = "Settings..."; TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.Number, 41, 2, 0x0, "###CDMyVThings.TheVThings#NumberProperties295308#Number Properties###", "Gen_Config_NumberOfActiveProperties", new nmiCtrlNumber() { ParentFld = 20 }); TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.ThingPicker, 42, 2, 0xC0, "###CDMyVThings.TheVThings#ThingforPropertySubs849298#Thing for Property Subs###", "ThingToVerify", new nmiCtrlThingPicker() { IncludeEngines = true, ParentFld = 20 }); TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.Number, 43, 0, 0x0, "###CDMyVThings.TheVThings#PropertiesperSecond849298#Properties per Second###", "Gen_Stats_PropertiesPerSecond", new nmiCtrlNumber() { TileWidth = 3, ParentFld = 20 }); TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.Number, 44, 0, 0x0, "###CDMyVThings.TheVThings#Propertycounter208103#Property Counter###", "Gen_Stats_PropertyCounter", new nmiCtrlNumber() { TileWidth = 3, ParentFld = 20 }); TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.Number, 45, 2, 0x0, "###CDMyVThings.TheVThings#MinimumLatencyms44483#Minimum Latency (ms)###", "Gen_MinLatency", new nmiCtrlNumber() { TileWidth = 3, ParentFld = 20 }); TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.Number, 46, 2, 0x0, "###CDMyVThings.TheVThings#MaximumLatencyms44483#Maximum Latency (ms)###", "Gen_MaxLatency", new nmiCtrlNumber() { TileWidth = 3, ParentFld = 20 }); TheFieldInfo mSendbutton = TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.TileButton, 60, 2, 0, "###CDMyVThings.TheVThings#ResetCounter741318#Reset Counter###", false, "", null, new nmiCtrlTileButton() { TileWidth = 3, ParentFld = 20, ClassName = "cdeGoodActionButton", NoTE = true }); mSendbutton.RegisterUXEvent(MyBaseThing, eUXEvents.OnClick, "", (pThing, pPara) => { TheProcessMessage pMsg = pPara as TheProcessMessage; if (pMsg == null || pMsg.Message == null) { return; } this.Stats_PropertyCounter = 0; this.Stats_PropertiesPerSecond = 0; count = 0; _maxLatency = 0; _minLatency = long.MaxValue; // sinkStatChanged(null, null); }); PropTable = TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.Table, 120, 0xA2, 0x80, "All Properties", "mypropertybag;0", new ThePropertyBag() { "ParentFld=1", "TileWidth=12", "TileHeight=6" }); mIsUXInitialized = true; return(true); }
/// <summary> /// NMI of the Live Tag that can be overritten /// </summary> /// <returns></returns> public virtual bool DoCreateUX() { var tFlds = TheNMIEngine.AddStandardForm(MyBaseThing, "FACEPLATE", 12, null, "Value"); MyStatusForm = tFlds["Form"] as TheFormInfo; SummaryForm = tFlds["DashIcon"] as TheDashPanelInfo; SummaryForm.PropertyBag = new nmiDashboardTile() { Category = "A-NONE", Caption = "-HIDE", RenderTarget = "HomeCenterScreen" }; var ts = TheNMIEngine.AddStatusBlock(MyBaseThing, MyStatusForm, 10); ts["Group"].SetParent(1); ts["FriendlyName"].Type = eFieldType.TextArea; ts["FriendlyName"].Header = "###Friendly Name###"; TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.CollapsibleGroup, 500, 2, 0x80, "Default Properties", null, new nmiCtrlCollapsibleGroup { DoClose = true, IsSmall = true, TileWidth = 6, ParentFld = 1 }); TheNMIEngine.AddFields(MyStatusForm, new List <TheFieldInfo> { { new TheFieldInfo() { FldOrder = 20, DataItem = "cdeMID", Flags = 0, Type = eFieldType.SmartLabel, Header = "MID/Owner", PropertyBag = new TheNMIBaseControl { ParentFld = 10, TileFactorY = 2 } } }, { new TheFieldInfo() { FldOrder = 21, DataItem = "cdeO", Flags = 0, Type = eFieldType.SmartLabel, Header = "", PropertyBag = new TheNMIBaseControl { ParentFld = 10, TileFactorY = 2 } } }, { new TheFieldInfo() { FldOrder = 513, DataItem = "MyPropertyBag.EngineName.Value", Flags = 0, Type = eFieldType.TextArea, Header = "Engine Name", PropertyBag = new TheNMIBaseControl { ParentFld = 500 } } }, { new TheFieldInfo() { FldOrder = 514, DataItem = "MyPropertyBag.DeviceType.Value", Flags = 0, Type = eFieldType.SingleEnded, Header = "DeviceType", PropertyBag = new TheNMIBaseControl { ParentFld = 500 } } }, { new TheFieldInfo() { FldOrder = 515, DataItem = "MyPropertyBag.ID.Value", Flags = 0, Type = eFieldType.TextArea, Header = "ID", PropertyBag = new TheNMIBaseControl { ParentFld = 500 } } }, { new TheFieldInfo() { FldOrder = 516, DataItem = "MyPropertyBag.Address.Value", Flags = 0, Type = eFieldType.TextArea, Header = "Address", PropertyBag = new TheNMIBaseControl { ParentFld = 500 } } }, { new TheFieldInfo() { FldOrder = 518, DataItem = "MyPropertyBag.cdeStartupTime.Value", Flags = 0, Type = eFieldType.Number, Header = "Startup Time", TileWidth = 3, PropertyBag = new TheNMIBaseControl { ParentFld = 500 } } }, { new TheFieldInfo() { FldOrder = 520, DataItem = "HasLiveObject", Flags = 0, Type = eFieldType.SingleCheck, Header = "Is Alive", TileWidth = 3, PropertyBag = new TheNMIBaseControl { ParentFld = 500 } } }, { new TheFieldInfo() { FldOrder = 521, DataItem = "IsInitialized", Flags = 0, Type = eFieldType.SingleCheck, Header = "Is Init", TileWidth = 3, PropertyBag = new TheNMIBaseControl { ParentFld = 500 } } }, { new TheFieldInfo() { FldOrder = 522, DataItem = "IsUXInitialized", Flags = 0, Type = eFieldType.SingleCheck, Header = "UX Init", TileWidth = 3, PropertyBag = new TheNMIBaseControl { ParentFld = 500 } } }, }); TheFieldInfo tDl = TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.TileButton, 2000, 2, 0x0, "", null, new nmiCtrlTileButton() { Thumbnail = "FA3:f019", TileWidth = 1, TileHeight = 1, ParentFld = 1 }); tDl.RegisterUXEvent(MyBaseThing, eUXEvents.OnClick, "DOWNLOAD", OnDownloadClick); TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.CollapsibleGroup, 1000, 2, 0x80, "All Properties", null, new nmiCtrlCollapsibleGroup { DoClose = true, IsSmall = true, MaxTileWidth = 12, ParentFld = 1 }); TheNMIEngine.AddField(MyStatusForm, new TheFieldInfo() { FldOrder = 1010, DataItem = "mypropertybag", Flags = 8, Type = eFieldType.Table, TileWidth = 12, TileHeight = 7, PropertyBag = new ThePropertyBag() { "NoTE=true", "ParentFld=1000" } }); return(true); }
public virtual bool CreateUX() { if (mIsUXInitCalled) { return(false); } mIsUXInitCalled = true; var tFlds = TheNMIEngine.AddStandardForm(MyBaseThing, null, 12, null, "Value"); MyStatusForm = tFlds["Form"] as TheFormInfo; SummaryForm = tFlds["DashIcon"] as TheDashPanelInfo; SummaryForm.PropertyBag = new ThePropertyBag() { string.Format("Format={0}<br>{{0}} Properties", MyBaseThing.FriendlyName), "TileWidth=2" }; SummaryForm.RegisterPropertyChanged(sinkStatChanged); var ts = TheNMIEngine.AddStatusBlock(MyBaseThing, MyStatusForm, 10); ts["Group"].SetParent(1); var tc = TheNMIEngine.AddStartingBlock(MyBaseThing, MyStatusForm, 200, async(pMsg, DoStart) => { if (DoStart) { await StartPlaybackAsync(false); } else { await StopPlaybackAsync(null); } }); tc["Group"].SetParent(49); //ts["Group"].Header = "Settings..."; TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.CollapsibleGroup, 49, 2, 0x0, "###CDMyVThings.TheVThings#Settings#Settings...###", null, new nmiCtrlCollapsibleGroup() { ParentFld = 1, DoClose = true, IsSmall = true }); TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.Number, 50, 2, 0x0, "###CDMyVThings.TheVThings#PlaybackSpeedFactor#Speed Factor###", nameof(PlaybackSpeedFactor), new nmiCtrlNumber() { DefaultValue = "1", TileWidth = 3, ParentFld = 49 }); TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.Number, 60, 2, 0x0, "###CDMyVThings.TheVThings#PlaybackMaxItemDelay#Maximum Delay###", nameof(MaxItemDelay), new nmiCtrlNumber() { TileWidth = 3, ParentFld = 49 }); TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.Number, 70, 2, 0x0, "###CDMyVThings.TheVThings#PlaybackItemDelay#Item Delay###", nameof(PlaybackItemDelay), new nmiCtrlNumber() { TileWidth = 3, ParentFld = 49 }); TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.Number, 75, 2, 0x0, "###CDMyVThings.TheVThings#AutoStartDelay#Auto Start Delay###", nameof(AutoStartDelay), new nmiCtrlSingleCheck() { TileWidth = 3, ParentFld = 49 }); TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.SingleCheck, 80, 2, 0x0, "###CDMyVThings.TheVThings#PlaybackRestart#Restart###", nameof(RestartPlayback), new nmiCtrlSingleCheck() { TileWidth = 3, ParentFld = 49 }); TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.SingleCheck, 85, 2, 0x0, "###CDMyVThings.TheVThings#PlaybackAdjustTimestamps#Adjust times###", nameof(AdjustTimestamps), new nmiCtrlSingleCheck() { TileWidth = 3, ParentFld = 49 }); TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.Number, 87, 2, 0x0, "###CDMyVThings.TheVThings#ReplayCount#Replay Count###", nameof(ReplayCount), new nmiCtrlNumber() { TileWidth = 3, ParentFld = 49, DefaultValue = "1" }); TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.SingleEnded, 90, 2, 0x0, "###CDMyVThings.TheVThings#PlaybackInputFileName#Input File###", nameof(InputFileName), new nmiCtrlSingleEnded() { ParentFld = 49 }); TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.Number, 86, 2, 0x0, "###CDMyVThings.TheVThings#PlaybackNumberThings#Number Things###", nameof(ParallelPlaybackCount), new nmiCtrlNumber() { TileWidth = 3, ParentFld = 49 }); TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.SingleEnded, 110, 2, 0x0, "###CDMyVThings.TheVThings#PlaybackEngineName#Engine Name###", nameof(PlaybackEngineName), new nmiCtrlSingleEnded() { ParentFld = 49 }); TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.SingleEnded, 115, 2, 0x0, "###CDMyVThings.TheVThings#PlaybackDeviceType#Device Type###", nameof(PlaybackDeviceType), new nmiCtrlSingleEnded() { ParentFld = 49 }); TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.CollapsibleGroup, 120, 2, 0x0, "###CDMyVThings.TheVThings#Settings#Upload file...###", null, new nmiCtrlCollapsibleGroup() { ParentFld = 49, DoClose = true, IsSmall = true }); TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.DropUploader, 125, 2, 0x0, "###CDMyVThings.TheVThings#PlaybackInputFileDropper#Drop Input File here###", null, new nmiCtrlDropUploader { TileHeight = 6, NoTE = true, TileWidth = 6, EngineName = MyBaseEngine.GetEngineName(), MaxFileSize = 100000000, ParentFld = 120 }); TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.CollapsibleGroup, 20, 2, 0x0, "###CDMyVThings.TheVThings#KPIs#KPIs...###", null, new nmiCtrlCollapsibleGroup() { ParentFld = 1, TileWidth = 6, IsSmall = true }); TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.Number, 135, 0, 0x0, "###CDMyVThings.TheVThings#PropertiesperSecond546134#Properties per Second###", nameof(Gen_Stats_PropertiesPerSecond), new nmiCtrlNumber() { ParentFld = 20 }); TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.Number, 140, 0, 0x0, "###CDMyVThings.TheVThings#Propertycount904939#Property count###", nameof(Gen_Stats_PropertyCounter), new nmiCtrlNumber() { ParentFld = 20 }); TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.DateTime, 150, 0, 0x0, "###CDMyVThings.TheVThings#PlaybackUpdateTime#Update time###", nameof(Gen_StatsLastUpdateTime), new nmiCtrlDateTime() { ParentFld = 20 }); TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.TimeSpan, 160, 0, 0x0, "###CDMyVThings.TheVThings#PlaybackLoadDuration#Load duration###", nameof(LoadDuration), new nmiCtrlDateTime() { ParentFld = 20 }); TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.TimeSpan, 170, 0, 0x0, "###CDMyVThings.TheVThings#PlaybackDuration#Playback duration###", nameof(PlaybackDuration), new nmiCtrlDateTime() { ParentFld = 20 }); TheFieldInfo mResetCounterButton = TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.TileButton, 180, 2, 0, "###CDMyVThings.TheVThings#ResetCounter741318#Reset Counter###", false, "", null, new nmiCtrlTileButton() { ParentFld = 130, ClassName = "cdeGoodActionButton" }); mResetCounterButton.RegisterUXEvent(MyBaseThing, eUXEvents.OnClick, "", (pThing, pPara) => { if (!(pPara is TheProcessMessage pMsg) || pMsg.Message == null) { return; } this.Gen_Stats_PropertyCounter = 0; Interlocked.Exchange(ref _propertyCounter, 0); sinkStatChanged(null, null); });
public virtual bool CreateUX() { if (mIsUXInitCalled) { return(false); } mIsUXInitCalled = true; var tFlds = TheNMIEngine.AddStandardForm(MyBaseThing, null, 12, null, "Value"); MyStatusForm = tFlds["Form"] as TheFormInfo; SummaryForm = tFlds["DashIcon"] as TheDashPanelInfo; SummaryForm.PropertyBag = new ThePropertyBag() { string.Format("Format={0}<br>{{0}} Properties", MyBaseThing.FriendlyName) }; SummaryForm.RegisterPropertyChanged(sinkStatChanged); TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.Number, 21, 0, 0x0, "###CDMyVThings.TheVThings#CountOfProperties598472#Count of Properties###", "Value", new nmiCtrlNumber() { ParentFld = 1 }); TheFieldInfo mSendbutton = TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.TileButton, 22, 2, 0, "###CDMyVThings.TheVThings#Reload598472#Reload###", false, "", null, new nmiCtrlTileButton() { ParentFld = 1, NoTE = true, ClassName = "cdeGoodActionButton" }); mSendbutton.RegisterUXEvent(MyBaseThing, eUXEvents.OnClick, "", (pThing, pPara) => { TheProcessMessage pMsg = pPara as TheProcessMessage; if (pMsg?.Message == null) { return; } sinkStatChanged(null, null); MyStatusForm.Reload(pMsg, true); }); PropTable = TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.Table, 40, 0xA0, 0x80, "All Properties", "mypropertybag;0", new TheNMIBaseControl() { NoTE = true, ParentFld = 1, TileWidth = 12, TileHeight = 16 }); TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.SingleEnded, 30, 0x0A, 0, "New Property Name", "ScratchName", new nmiCtrlSingleEnded() { ParentFld = 1 }); TheFieldInfo tBut = TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.TileButton, 35, 0x0A, 0, "Add Property", false, null, null, new nmiCtrlTileButton() { ParentFld = 1, NoTE = true }); tBut.RegisterUXEvent(MyBaseThing, eUXEvents.OnClick, "AddProp", (pThing, pObj) => { TheProcessMessage pMsg = pObj as TheProcessMessage; if (pMsg?.Message == null) { return; } string[] parts = pMsg.Message.PLS.Split(':'); TheThing tOrg = TheThingRegistry.GetThingByMID(MyBaseEngine.GetEngineName(), TheCommonUtils.CGuid(parts[2])); if (tOrg == null) { return; } string tNewPropName = TheThing.GetSafePropertyString(tOrg, "ScratchName"); if (string.IsNullOrEmpty(tNewPropName)) { TheCommCore.PublishToOriginator(pMsg.Message, new TSM(eEngineName.NMIService, "NMI_TOAST", "Please specify a new property name")); } else { if (tOrg.GetProperty(tNewPropName) != null) { TheCommCore.PublishToOriginator(pMsg.Message, new TSM(eEngineName.NMIService, "NMI_TOAST", "Property already exists")); } else { tOrg.DeclareNMIProperty(tNewPropName, ePropertyTypes.TString); TheCommCore.PublishToOriginator(pMsg.Message, new TSM(eEngineName.NMIService, "NMI_TOAST", "Property Added")); MyStatusForm.Reload(pMsg, false); } } tOrg.RemoveProperty("ScratchName"); }); 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); }