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 ThePropertyBag() { string.Format("Format={0}<br>{{0}}", MyBaseThing.FriendlyName) }; var ts = TheNMIEngine.AddStatusBlock(MyBaseThing, MyStatusForm, 10); ts["Group"].SetParent(1); // loading spinner //var tDash = TheThingRegistry.IsEngineRegistered("CDMyNMIControls.TheNMIctrls") var tDash = new nmiDashboardTile { ClassName = "cdeDashPlate", Format = "Loading... <i class='fa fa-spinner fa-pulse'></i>", TileWidth = 2, TileHeight = 2, HTML = "<div><p><%C20:FriendlyName%></p><div id='COUNTD%cdeMID%'></div></div>", Style = "background-image:url('GlasButton.png');color:white;background-color:gray", RSB = true }; //: new ThePropertyBag { $"Format={MyBaseThing.FriendlyName}<br>{{0}}", "Foreground=white" }; SummaryForm.PropertyBag = tDash; SummaryForm.RegisterPropertyChanged(SinkStatChanged); var tControl = TheCommonUtils.CInt(TheThing.GetSafePropertyNumber(MyBaseThing, "ControlType")); var tBag = ThePropertyBag.CreateUXBagFromProperties(MyBaseThing); tBag.Add("ParentFld=1"); CountBar = tControl > 0 ? TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, (eFieldType)tControl, 21, 2, 0, "Current Value", "Value", tBag) : TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.BarChart, 21, 2, 0, "Current Value", "Value", new nmiCtrlBarChart { ParentFld = 1 }); //if (TheThingRegistry.IsEngineRegistered("CDMyNMIControls.TheNMIctrls")) { //MyGauge=TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.UserControl, 4000, 2, 0, "Countdown", "Value", new ThePropertyBag { "TileWidth=2", "NoTE=true", "EngineName=CDMyNMIControls.TheNMIctrls", "RenderTarget=COUNTD%cdeMID%", "ControlType=cdeNMI.ctrlCircularGauge", "LabelForeground=#00b9ff", "Foreground=#FFFFFF" }); MyGauge = TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.CircularGauge, 4000, 2, 0, "Countdown", "Value", new ThePropertyBag { "TileWidth=2", "NoTE=true", "RenderTarget=COUNTD%cdeMID%", "LabelForeground=#00b9ff", "Foreground=#FFFFFF" }); } var mSendbutton = TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.TileButton, 120, 2, 0x80, "Trigger", false, "", null, new nmiCtrlTileButton { NoTE = true, TileWidth = 3, ParentFld = 10, ClassName = "cdeGoodActionButton" }); mSendbutton.RegisterUXEvent(MyBaseThing, eUXEvents.OnClick, "", (pThing, pPara) => { if (_mTimer != null) { _mTimer.Dispose(); _mTimer = null; } SinkTriggered(GetProperty("StartValue", false)); }); var mSP = TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.TileButton, 130, 2, 0x80, "Stop", false, "", null, new nmiCtrlTileButton { NoTE = true, TileWidth = 3, ParentFld = 10, ClassName = "cdeBadActionButton" }); mSP.RegisterUXEvent(MyBaseThing, eUXEvents.OnClick, "", (pThing, pPara) => { if (_mTimer != null) { _mTimer.Dispose(); _mTimer = null; } }); // Settings Controls & User Input TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.CollapsibleGroup, 151, 2, 0x80, "Settings...", null, ThePropertyBag.Create(new nmiCtrlCollapsibleGroup { ParentFld = 1, TileWidth = 6, IsSmall = true, DoClose = true })); TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.Number, 153, 2, 0x80, "Tick time in ms", nameof(Frequency), new nmiCtrlNumber { TileWidth = 3, TileHeight = 1, ParentFld = 151 }); TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.Number, 156, 2, 0x80, "Step", nameof(Step), new nmiCtrlNumber { TileWidth = 3, TileHeight = 1, ParentFld = 151 }); TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.Number, 157, 2, 0x80, "Amplitude", nameof(Amplitude), new nmiCtrlNumber { TileWidth = 3, TileHeight = 1, ParentFld = 151 }); TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.Number, 158, 2, 0x80, "Shift", nameof(Shift), new nmiCtrlNumber { TileWidth = 3, TileHeight = 1, ParentFld = 151 }); TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.SingleCheck, 180, 2, 0x80, "Autostart", nameof(AutoStart), new nmiCtrlNumber { TileWidth = 3, TileHeight = 1, ParentFld = 151 }); return(true); }
public override bool DoCreateUX() { var tFlds = TheNMIEngine.AddStandardForm(MyBaseThing, null, null, 0, new nmiStandardForm { IconUpdateName = "Value", MaxTileWidth = 12, UseMargin = true }); MyStatusForm = tFlds["Form"] as TheFormInfo; MyStatusForm.ModelID = "CountdownForm"; ThePropertyBag tDash = new nmiDashboardTile() { ClassName = "cdeDashPlate", Caption = "Loading... <i class='fa fa-spinner fa-pulse'></i>", TileWidth = 2, TileHeight = 2, HTML = "<div><div id='COUNTD%cdeMID%'></div><p><%C20:FriendlyName%></p></div>", //TODO:SETP Move to Generate Screen for all HTML blocks! Style = "background-image:none;color:white;background-color:gray", RSB = true, RenderTarget = "HomeCenterStage" }; SummaryForm = tFlds["DashIcon"] as TheDashPanelInfo; SummaryForm.PropertyBag = tDash; SummaryForm.RegisterPropertyChanged(sinkStatChanged); tGauge = TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.CircularGauge, 4000, 2, 0, "Countdown", "Value", new ThePropertyBag() { "TileWidth=2", "NoTE=true", "RenderTarget=COUNTD%cdeMID%", "LabelForeground=#00b9ff", "Foreground=#FFFFFF" }); var ts = TheNMIEngine.AddStatusBlock(MyBaseThing, MyStatusForm, 10); ts["Group"].SetParent(1); TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.CollapsibleGroup, 150, 2, 128, "###CDMyVThings.TheVThings#Settings796959#Settings...###", null, ThePropertyBag.Create(new nmiCtrlCollapsibleGroup() { DoClose = true, TileWidth = 6, IsSmall = true, ParentFld = 1 })); TheFieldInfo mSendbutton = TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.TileButton, 151, 2, 0, "###CDMyVThings.TheVThings#Trigger796959#Trigger###", false, "", null, new nmiCtrlTileButton() { NoTE = true, ParentFld = 150, ClassName = "cdeGoodActionButton" }); mSendbutton.RegisterUXEvent(MyBaseThing, eUXEvents.OnClick, "", (pThing, pPara) => { if (mTimer != null) { mTimer.Dispose(); mTimer = null; } sinkTriggered(this.GetProperty(nameof(StartValue), false)); //UpdateUx(); }); TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.Number, 152, 2, MyBaseThing.cdeA, "###CDMyVThings.TheVThings#StartValue633339#Start Value###", nameof(StartValue), new nmiCtrlNumber { TileWidth = 3, TileHeight = 1, ParentFld = 150 }); TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.Number, 153, 2, MyBaseThing.cdeA, "###CDMyVThings.TheVThings#Ticktimeinms633339#Tick time in ms###", nameof(Frequency), new nmiCtrlNumber { TileWidth = 3, TileHeight = 1, ParentFld = 150 }); TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.SingleCheck, 154, 2, MyBaseThing.cdeA, "###CDMyVThings.TheVThings#ContinueonRestart992144#Continue on Restart###", nameof(AutoStart), new nmiCtrlNumber { TileWidth = 3, TileHeight = 1, ParentFld = 150 }); TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.SingleCheck, 155, 2, MyBaseThing.cdeA, "###CDMyVThings.TheVThings#StartOverwhenzero992144#Start Over when zero###", nameof(Restart), new nmiCtrlNumber { TileWidth = 3, TileHeight = 1, ParentFld = 150 }); int tControl = TheCommonUtils.CInt(TheThing.GetSafePropertyNumber(MyBaseThing, "ControlType")); ThePropertyBag tBag = ThePropertyBag.CreateUXBagFromProperties(MyBaseThing); tBag.Add("ParentFld=1"); if (tControl > 0) { CountBar = TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, (eFieldType)tControl, 100, 2, MyBaseThing.cdeA, "CurrentValue", "Value", tBag); } else { TheThing.SetSafePropertyString(MyBaseThing, "ControlType", "34"); TheThing.SetSafePropertyString(MyBaseThing, "NoTE", "true"); TheThing.SetSafePropertyString(MyBaseThing, "TileWidth", "6"); TheThing.SetSafePropertyString(MyBaseThing, "TileHeight", "1"); CountBar = TheNMIEngine.AddSmartControl(MyBaseThing, MyStatusForm, eFieldType.BarChart, 100, 2, MyBaseThing.cdeA, "CurrentValue", "Value", new nmiCtrlBarChart() { NoTE = true, TileWidth = 6, TileHeight = 1, ParentFld = 10 }); } return(true); }