Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
        public override bool CreateUX()
        {
            if (mIsUXInitialized)
            {
                return(true);                  //No processing if Storage is not active
            }
            mIsUXInitialized = true;
            TheDashboardInfo tDash = TheNMIEngine.AddDashboard(MyBaseThing, new TheDashboardInfo(MyBaseEngine, "Storage Service: MS-SQL")
            {
                cdeA        = 0xC0,
                FldOrder    = 11,
                PropertyBag = new nmiDashboardTile()
                {
                    Category = "Services", Caption = "<i class='fa faIcon fa-5x'>&#xf1c0;</i></br>Storage Service: MS-SQL"
                }
            });

            if (TheCDEngines.MyIStorageService != null)
            {
                var tF = TheNMIEngine.AddStandardForm(MyBaseThing, "SQL Storage Settings", 20, TheThing.GetSafeThingGuid(MyBaseThing, "SQLStorageSettings").ToString(), null, 0xF0);
                var tMyUserSettingsForm = tF["Form"] as TheFormInfo;
                TheNMIEngine.AddSmartControl(MyBaseThing, tMyUserSettingsForm, eFieldType.CollapsibleGroup, 30, 2, 0, "Storage Options", null, new nmiCtrlCollapsibleGroup()
                {
                    ParentFld = 1, DoClose = false, IsSmall = true, TileWidth = 6
                });
                TheFieldInfo thingRegistryBtn = TheNMIEngine.AddSmartControl(MyBaseThing, tMyUserSettingsForm, eFieldType.SingleCheck, 40, 2, 0, "Store Thing Registry", "StoreThingRegistry", new nmiCtrlSingleCheck()
                {
                    HelpText = "You have to restart the relay in order for this setting to get in effect", ParentFld = 30, DefaultValue = "False"
                });
                thingRegistryBtn.RegisterPropertyChanged(SinkUpdateStorage);
                TheNMIEngine.AddSmartControl(MyBaseThing, tMyUserSettingsForm, eFieldType.SingleCheck, 50, 2, 0, "Don't Log Queue Updates", "DontLogQueue", new nmiCtrlSingleCheck()
                {
                    TileWidth = 3, ParentFld = 30
                });
            }

            //var tList=TheCDEngines.EnumerateStorageMirror().FirstOrDefault(s=>s.Value.Contains("TheFieldInfo"));
            ////if (tList != null)
            //{
            //    TheChartDefinition pChart = new TheChartDefinition(new Guid("{F7468BC6-03F7-4BF7-A0B7-A5A7B2A55645}"), tList.Value, 100, tList.Key, true, "", "", "");
            //    TheNMIEngine.AddChartScreen(MyBaseThing, pChart, 3, "Sensor Chart", 3, 0, "Charts", false, new ThePropertyBag() { ".NoTE=true", ".TileWidth=12", ".TileHeight=6", "Header=All Sensor Data" });
            //}
            TheNMIEngine.AddAboutButton(MyBaseThing, null, TheNMIEngine.GetNodeForCategory());

            return(true);
        }
Exemplo n.º 6
0
        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'>&#xf61f;</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'>&#xf0ce;</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);
        }
Exemplo n.º 7
0
        public bool CreateUX()
        {
            if (mIsUXInitCalled)
            {
                return(false);
            }
            mIsUXInitCalled = true;

            //NUI Definition for All clients
            TheNMIEngine.AddDashboard(MyBaseThing, new TheDashboardInfo(MyBaseEngine, "Visitor Log")
            {
                PropertyBag = new nmiDashboard {
                    Category = "Diagnostics", Caption = "<i class='fa faIcon fa-5x'>&#xf0c0;</i></br>Visitor Log"
                }
            });

            TheFormInfo tMyForm = TheNMIEngine.AddForm(new TheFormInfo(MyBaseThing)
            {
                FormTitle = "Visitor Log of " + TheBaseAssets.MyServiceHostInfo.MyStationName, DefaultView = eDefaultView.Form, TileWidth = 10
            });

            TheNMIEngine.AddFormToThingUX(MyBaseThing, tMyForm, "CMyForm", "My Visitor Log</br><span style='font-size:xx-small'>" + TheBaseAssets.MyServiceHostInfo.MyStationName + "</span>", 3, 3, 0, TheNMIEngine.GetNodeForCategory(), null, null);
            TheNMIEngine.AddSmartControl(MyBaseThing, tMyForm, eFieldType.SingleEnded, 2, 0, 0, "Visitor Count Since Startup", "VisitorCount", new ThePropertyBag()
            {
                "TileWidth=3"
            });
            TheNMIEngine.AddSmartControl(MyBaseThing, tMyForm, eFieldType.SingleEnded, 3, 0, 0, "Connected Browser", "BrowserCount", new ThePropertyBag()
            {
                "TileWidth=3"
            });

            #region GoogleMaps
            string gKey = null;
            if (TheBaseAssets.MyCmdArgs.ContainsKey("GoogleMapsKey"))
            {
                gKey = TheBaseAssets.MyCmdArgs["GoogleMapsKey"];
            }
            if (TheNMIEngine.IsControlTypeRegistered("cdeNMI.ctrlGoogleMaps") && !string.IsNullOrEmpty(gKey))
            {
                TheNMIEngine.AddSmartControl(MyBaseThing, tMyForm, eFieldType.CollapsibleGroup, 420, 2, 0, "Google Maps", null, new nmiCtrlCollapsibleGroup()
                {
                    TileWidth = 12, IsSmall = true
                });
                var myGoogleMap = TheNMIEngine.AddSmartControl(MyBaseThing, tMyForm, eFieldType.UserControl, 421, 0, 0, null, "MapCoords", new ThePropertyBag()
                {
                    "NoTE=true", "ParentFld=420", "Zoom=4", "Tilt=45", "Lat=48", "Lng=-122", $"GoogleKey={gKey}", //TODO: Make configuration setting
                    "TileWidth=10", "TileHeight=10", "ControlType=cdeNMI.ctrlGoogleMaps", "Markers=[{ \"Description\": \"Home\",\"latitude\": 48,\"longitude\": -122 }]"
                });
                TheNMIEngine.AddSmartControl(MyBaseThing, tMyForm, eFieldType.SingleEnded, 422, 2, 0, "Coordinates", "Lat", new nmiCtrlSingleEnded()
                {
                    TileWidth = 3, ParentFld = 420
                });
                TheNMIEngine.AddSmartControl(MyBaseThing, tMyForm, eFieldType.SingleEnded, 423, 2, 0, "", "Lng", new nmiCtrlSingleEnded()
                {
                    NoTE = true, TileWidth = 1, ParentFld = 420
                });
                GetProperty("Lat", true).RegisterEvent(eThingEvents.PropertyChangedByUX, (p) => {
                    myGoogleMap?.SetUXProperty(Guid.Empty, $"Lat={p.ToString()}");
                });
                GetProperty("Lng", true).RegisterEvent(eThingEvents.PropertyChangedByUX, (p) => {
                    myGoogleMap?.SetUXProperty(Guid.Empty, $"Lng={p.ToString()}");
                });

                TheFieldInfo tBarZOOM = TheNMIEngine.AddSmartControl(MyBaseThing, tMyForm, eFieldType.BarChart, 427, 2, 0, "Zoom", "ZoomVal", new ThePropertyBag()
                {
                    "NoTE=true", "TileHeight=1", "TileWidth=6", "IsVertical=false", "ParentFld=420", "MaxValue=20"
                });
                tBarZOOM.RegisterUXEvent(MyBaseThing, eUXEvents.OnPropertyChanged, "Value", (sender, para) =>
                {
                    TheProcessMessage tP = para as TheProcessMessage;
                    if (tP != null && tP.Message != null)
                    {
                        myGoogleMap?.SetUXProperty(tP.Message.GetOriginator(), $"Zoom={tP.Message.PLS}");
                    }
                });

                tMyForm.RegisterEvent2(eUXEvents.OnShow, (pMsg, arg) => {
                    var tVisits = MyVisitorLog.GetAllVisitors();
                    if (tVisits?.Count > 0)
                    {
                        myGoogleMap?.SetUXProperty(pMsg.Message.GetOriginator(), $"Markers={TheCommonUtils.SerializeObjectToJSONString(tVisits)}");
                    }
                });
            }
            #endregion


            TheFormInfo tConns = new TheFormInfo(TheThing.GetSafeThingGuid(MyBaseThing, "FootPrints"), eEngineName.NMIService, "Node Footprints", MyNodePrintsName, "Add Footprint", null)
            {
                IsNotAutoLoading = true
            };
            TheNMIEngine.AddFormToThingUX(MyBaseThing, tConns, "CMyTable", "Node Footprints", 1, 9, 0x80, "Node Type Definitions", null, new ThePropertyBag()
            {
                "Visibility=true"
            });
            TheNMIEngine.AddSmartControl(MyBaseThing, tConns, eFieldType.Number, 10, 0, 0x0, "Counter", "Counter", new nmiCtrlNumber()
            {
                TileWidth = 1, FldWidth = 1
            });
            TheNMIEngine.AddSmartControl(MyBaseThing, tConns, eFieldType.SingleEnded, 20, 2, 0x0, "Node Type", "NodeType", new nmiCtrlNumber()
            {
                TileWidth = 3, FldWidth = 3
            });
            TheNMIEngine.AddSmartControl(MyBaseThing, tConns, eFieldType.Number, 25, 2, 0x0, "Plugin Count", "ExactCount", new nmiCtrlNumber()
            {
                TileWidth = 1, FldWidth = 1
            });
            TheNMIEngine.AddSmartControl(MyBaseThing, tConns, eFieldType.TextArea, 30, 2, 0xC0, "Plugin Footprint", "Footprint", new nmiCtrlTextArea()
            {
                TileWidth = 10, TileHeight = 2, FldWidth = 10
            });
            TheNMIEngine.AddTableButtons(tConns, false, 100);

            TheNMIEngine.AddAboutButton(MyBaseThing);
            mIsUXInitialized = true;
            return(true);
        }
Exemplo n.º 8
0
        public override bool CreateUX()
        {
            if (mIsUXInitCalled)
            {
                return(false);
            }
            mIsUXInitCalled = true;

            //NUI Definition for All clients
            mMyDashboard = TheNMIEngine.AddDashboard(MyBaseThing, new TheDashboardInfo(MyBaseEngine, "OPC UA Client")
            {
                PropertyBag = new nmiDashboardTile()
                {
                    Category = " Connectivity", Thumbnail = "opcLarge.png;1;cdeLargeIcon", TileWidth = 3, TileHeight = 4, ClassName = "cdeLiveTile cdeLargeTile"
                }
            });

            var tFlds = TheNMIEngine.AddStandardForm(MyBaseThing, "OPC General Settings", "OPCD", 0, new nmiStandardForm {
                MaxTileWidth = 12, UseMargin = true, Category = TheNMIEngine.GetNodeForCategory()
            });
            TheFormInfo tMyForm = tFlds["Form"] as TheFormInfo;

            TheNMIEngine.AddSmartControl(MyBaseThing, tMyForm, eFieldType.CollapsibleGroup, 5, 2, 0xc0, "GLS Discovery Service", null, ThePropertyBag.Create(new nmiCtrlCollapsibleGroup()
            {
                DoClose = false, IsSmall = true, TileWidth = 6, ParentFld = 1
            }));
            TheNMIEngine.AddSmartControl(MyBaseThing, tMyForm, eFieldType.SingleEnded, 10, 2, 0, "GLS Address", "Address", new nmiCtrlSingleEnded()
            {
                ParentFld = 5
            });
            TheFieldInfo tBut = TheNMIEngine.AddSmartControl(MyBaseThing, tMyForm, eFieldType.TileButton, 11, 2, 0, "Scan for Servers", null, new nmiCtrlTileButton()
            {
                ParentFld = 5, ClassName = "cdeGoodActionButton"
            });

            tBut.RegisterUXEvent(MyBaseThing, eUXEvents.OnClick, "SCAN", (pThing, pObj) =>
            {
                TheProcessMessage pMsg = pObj as TheProcessMessage;
                if (pMsg != null)
                {
                    TheCommCore.PublishToOriginator(pMsg.Message, new TSM(eEngineName.NMIService, "NMI_TOAST", "Scanning..."));
                    GetEndpoints();
                    mMyDashboard.Reload(pMsg, false);
                }
            });

            TheNMIEngine.AddSmartControl(MyBaseThing, tMyForm, eFieldType.CollapsibleGroup, 15, 2, 0xc0, "Tracing (all clients)...", null, ThePropertyBag.Create(new nmiCtrlCollapsibleGroup()
            {
                DoClose = false, TileWidth = 6, IsSmall = true, ParentFld = 1
            }));

            TheNMIEngine.AddSmartControl(MyBaseThing, tMyForm, eFieldType.SingleCheck, 16, 2, 0, "OPC Client File Tracing", nameof(EnableTracing), new nmiCtrlSingleCheck {
                TileWidth = 3, ParentFld = 15
            });
            TheNMIEngine.AddSmartControl(MyBaseThing, tMyForm, eFieldType.SingleCheck, 17, 2, 0, "OPC Client Trace to Log", nameof(EnableTracingToLog), new nmiCtrlSingleCheck {
                TileWidth = 3, ParentFld = 15
            });
            TheNMIEngine.AddSmartControl(MyBaseThing, tMyForm, eFieldType.Number, 18, 2, 0, "OPC Client Trace Mask", nameof(OPCTraceMask), new nmiCtrlNumber {
                TileWidth = 6, ParentFld = 15, HelpText = "1=Err,2=Info,4=Stk,8=Svc,16=SvcDtl,32=Op,64=OpDtl,128=Start,256=Ext,512=Sec"
            });



            TheFormInfo tAllOPCUASrvs = new TheFormInfo(MyBaseEngine)
            {
                cdeMID = TheThing.GetSafeThingGuid(MyBaseThing, "OPCS"), defDataSource = string.Format("TheThing;:;0;:;True;:;DeviceType={1};EngineName={0}", MyBaseEngine.GetEngineName(), eOPCDeviceTypes.OPCRemoteServer), FormTitle = "Discovered OPC-UA Servers", AddButtonText = "Add a Server"
            };

            TheNMIEngine.AddFormToThingUX(MyBaseThing, tAllOPCUASrvs, "CMyTable", "All OPC-UA Remote Servers", 1, 0x0F, 0xC0, TheNMIEngine.GetNodeForCategory(), null, new ThePropertyBag()
            {
                "Thumbnail=OPCLogo.png;1.0"
            });
            var tOpcs = TheNMIEngine.AddCommonTableColumns(MyBaseThing, tAllOPCUASrvs);

            tOpcs["Address"].Header      = "Server URL";
            tOpcs["Address"].PropertyBag = new nmiCtrlSingleEnded {
                TileWidth = 4, FldWidth = 4
            };

            TheNMIEngine.AddField(tAllOPCUASrvs, new TheFieldInfo()
            {
                FldOrder = 5, cdeA = 0xC0, Flags = 2, Type = eFieldType.SingleCheck, Header = "Auto-Connect", DataItem = "MyPropertyBag.AutoConnect.Value"
            });
            TheNMIEngine.AddField(tAllOPCUASrvs, new TheFieldInfo()
            {
                FldOrder = 6, cdeA = 0xC0, Flags = 2, Type = eFieldType.SingleCheck, Header = "Connected", DataItem = "MyPropertyBag.IsConnected.Value", PropertyBag = new nmiCtrlSingleCheck {
                    AreYouSure = "Are you sure you want to connect/disconnect?"
                }
            });
            //            TheNMIEngine.AddField(tAllOPCUASrvs, new TheFieldInfo() { FldOrder = 13, Flags = 2, cdeA = 0xFF, Type = eFieldType.SingleEnded, Header = "Friendly Name", DataItem = "MyPropertyBag.FriendlyName.Value", PropertyBag = new ThePropertyBag() { "FldWidth=3" } });
            //TheNMIEngine.AddField(tAllOPCUASrvs, new TheFieldInfo() { FldOrder = 14, Flags = 2, cdeA = 0xC0, Type = eFieldType.SingleEnded, Header = "Server URL", DataItem = "MyPropertyBag.Address.Value", PropertyBag = new ThePropertyBag() { "FldWidth=5" } });
            TheNMIEngine.AddField(tAllOPCUASrvs, new TheFieldInfo()
            {
                FldOrder = 50, cdeA = 0xFF, Type = eFieldType.DateTime, Header = "Last Update", DataItem = "MyPropertyBag.LastUpdate.Value", PropertyBag = new ThePropertyBag()
                {
                    "FldWidth=3"
                }
            });
            TheNMIEngine.AddField(tAllOPCUASrvs, new TheFieldInfo()
            {
                FldOrder = 55, cdeA = 0xFF, Type = eFieldType.DateTime, Header = "Last Receive", DataItem = "MyPropertyBag.LastDataReceivedTime.Value", PropertyBag = new ThePropertyBag()
                {
                    "FldWidth=3"
                }
            });
            //TheNMIEngine.AddTableButtons(tAllOPCUASrvs);

            TheThingRegistry.UpdateEngineUX(MyBaseEngine.GetEngineName());

            TheNMIEngine.AddLiveTagTable(MyBaseThing, eOPCDeviceTypes.OPCLiveTag, "UA Live Tags", TheNMIEngine.GetNodeForCategory());
            TheNMIEngine.AddLiveTagTable(MyBaseThing, eOPCDeviceTypes.OPCMethod, "UA Methods", TheNMIEngine.GetNodeForCategory());

            TheNMIEngine.AddTileBreak(MyBaseThing, mMyDashboard, "..A");

            TheNMIEngine.AddAboutButton(MyBaseThing, true, "REFRESH_DASH", 0xc0);
            TheNMIEngine.RegisterEngine(MyBaseEngine);

            CreateOPCWizard();

            mIsUXInitialized = true;
            return(true);
        }
Exemplo n.º 9
0
        public bool CreateUX()
        {
            if (!mIsUXInitStarted)
            {
                mIsUXInitStarted = true;

                //NUI Definition for All clients
                TheNMIEngine.AddDashboard(MyBaseThing, new TheDashboardInfo(MyBaseEngine, "Thing Provisioner")
                {
                    PropertyBag = new nmiDashboardTile {
                        Caption = "Thing Provisioner", Category = "Services", Thumbnail = "FA5Sf110",
                    }
                });

                if (TheCommonUtils.CBool(TheBaseAssets.MySettings.GetSetting("RedPill")))
                {
                    MyScriptTable = new TheFormInfo(TheThing.GetSafeThingGuid(MyBaseThing, "SCRIPT_TABLE"), eEngineName.NMIService, "Script Table", $"ScriptTableFields{MyBaseThing.ID}")
                    {
                        PropertyBag = new nmiCtrlFormView {
                            TileWidth = 12, TileHeight = 10
                        }
                    };
                    TheNMIEngine.AddFormToThingUX(MyBaseThing, MyScriptTable, "CMyTable", "Script Table", 1, 3, 0xF0, null, null, new ThePropertyBag()
                    {
                        "Visibility=true"
                    });
                    TheNMIEngine.AddSmartControl(MyBaseThing, MyScriptTable, eFieldType.SingleCheck, 48, 2, 0, "Disabled", nameof(ScriptSnapshot.Disabled), new nmiCtrlSingleEnded()
                    {
                        TileWidth = 1, FldWidth = 1
                    });
                    TheNMIEngine.AddSmartControl(MyBaseThing, MyScriptTable, eFieldType.SingleEnded, 50, 0, 0, "Script Name", nameof(ScriptSnapshot.ScriptName), new nmiCtrlSingleEnded()
                    {
                        TileWidth = 2, FldWidth = 2
                    });
                    TheNMIEngine.AddSmartControl(MyBaseThing, MyScriptTable, eFieldType.Number, 55, 0, 0, "Script Step", nameof(ScriptSnapshot.ScriptStep), new nmiCtrlNumber()
                    {
                        TileWidth = 1, FldWidth = 1
                    });
                    TheNMIEngine.AddSmartControl(MyBaseThing, MyScriptTable, eFieldType.SingleEnded, 60, 0, 0, "Step Status", nameof(ScriptSnapshot.ScriptStatus), new nmiCtrlSingleEnded()
                    {
                        TileWidth = 2, FldWidth = 2
                    });
                    TheNMIEngine.AddSmartControl(MyBaseThing, MyScriptTable, eFieldType.SingleEnded, 65, 2, 0, "Step Name", nameof(ScriptSnapshot.StepName), new nmiCtrlSingleEnded()
                    {
                        TileWidth = 2, FldWidth = 2
                    });
                    TheNMIEngine.AddSmartControl(MyBaseThing, MyScriptTable, eFieldType.DateTime, 67, 0, 0, "Time", nameof(ScriptSnapshot.LastUpdate), new nmiCtrlDateTime()
                    {
                        TileWidth = 1, FldWidth = 1
                    });

                    TheNMIEngine.AddTableButtons(MyScriptTable);

                    if (TheCommonUtils.CBool(TheBaseAssets.MySettings.GetSetting("EnableDiagnostics")))
                    {
                        CreateScriptEditTemplate();

                        var button = TheNMIEngine.AddSmartControl(MyBaseThing, MyScriptTable, eFieldType.TileButton, 45, 2, 0, "Replay", null, new nmiCtrlTileButton()
                        {
                            TileWidth = 1, TileHeight = 1, FldWidth = 1, ClassName = "cdeGoodActionButton"
                        });
                        button.RegisterUXEvent(MyBaseThing, eUXEvents.OnClick, "test", async(sender, pPara) =>
                        {
                            try
                            {
                                if (!(pPara is TheProcessMessage pMSG) || pMSG.Message == null)
                                {
                                    return;
                                }

                                string[] cmd = pMSG.Message.PLS.Split(':');
                                if (cmd.Length > 2)
                                {
                                    var tScript = MyScriptTableStorage.GetEntryByID(TheCommonUtils.CGuid(cmd[2]));

                                    if (null != tScript)
                                    {
                                        if (string.IsNullOrEmpty(tScript.ScriptName))
                                        {
                                            var script = LoadScript(tScript.FileName);
                                            await RunScriptAsync(script, tScript.Context, tScript.ScriptStep - 1, true);
                                        }
                                        //Rerun script step from snapshot.
                                        await RunScriptAsync(tScript.ContextScript, tScript.Context, tScript.ScriptStep - 1, true);
                                    }
                                }
                            }
                            catch (Exception e)
                            {
                                MyBaseThing.LastMessage = $"Error replaying: {e.Message}";
                            }
                        });
                    }
                }

                TheNMIEngine.AddAboutButton(MyBaseThing, false);
                mIsUXInitCompleted = true;
            }
            return(true);
        }
Exemplo n.º 10
0
        public override bool CreateUX()
        {
            if (mIsUXInitCalled)
            {
                return(false);
            }
            mIsUXInitCalled = true;

            MyPCVitalsDashboard = TheNMIEngine.AddDashboard(MyBaseThing, new TheDashboardInfo(MyBaseEngine, "Node Vitals")
            {
                PropertyBag = new ThePropertyBag()
                {
                    "Category=Diagnostics", "Caption=Node Vitals", "Thumbnail=FA5:f108",
                }
            });

            TheFormInfo tMyConfForm = new TheFormInfo(TheThing.GetSafeThingGuid(MyBaseThing, "Config"), eEngineName.NMIService, "Setting", string.Format("TheThing;:;0;:;True;:;cdeMID={0}", MyBaseThing.cdeMID))
            {
                DefaultView = eDefaultView.Form, PropertyBag = new ThePropertyBag {
                    "TileWidth=6"
                }
            };

            TheNMIEngine.AddFormToThingUX(MyBaseThing, tMyConfForm, "CMyForm", "Settings", 1, 9, 0xC0, TheNMIEngine.GetNodeForCategory(), null, null);

            TheNMIEngine.AddSmartControl(MyBaseThing, tMyConfForm, eFieldType.SingleCheck, 1, 2, 0xC0, "Disable Collection", "IsHealthCollectionOff");
            //TheNMIEngine.AddSmartControl(MyBaseThing, tMyConfForm, eFieldType.SingleCheck, 2, 2, 0xC0, "Enable OHM", "EnableOHM");
            TheNMIEngine.AddSmartControl(MyBaseThing, tMyConfForm, eFieldType.Number, 10, 2, 0xC0, "Health Collection Cycle", "HealthCollectionCycle");
            TheNMIEngine.AddSmartControl(MyBaseThing, tMyConfForm, eFieldType.Number, 11, 2, 0xC0, "Sensor Delay", "SensorDelay");
            TheNMIEngine.AddSmartControl(MyBaseThing, tMyConfForm, eFieldType.Number, 12, 2, 0xC0, "Sensor Deadband", "SensorAccelDeadband");
            TheNMIEngine.AddSmartControl(MyBaseThing, tMyConfForm, eFieldType.Number, 13, 2, 0xC0, "Chart Values", "ChartValues", new nmiCtrlNumber {
                MinValue = 10
            });
            TheNMIEngine.AddSmartControl(MyBaseThing, tMyConfForm, eFieldType.Number, 14, 2, 0xC0, "Default Chart TileWidth", "ChartSize", new nmiCtrlNumber {
                MinValue = 6, MaxValue = 30
            });

            if (!TheCommonUtils.IsHostADevice())
            {
                TheFormInfo tMyForm = new TheFormInfo()
                {
                    cdeMID = new Guid("{A3765D29-8EFF-4F09-B5BC-E5CE4C7DEA6F}"), FormTitle = "CPU Details", defDataSource = "TheThing;:;0;:;True;:;DeviceType=CPUInfo"
                };
                TheNMIEngine.AddFormToThingUX(MyBaseThing, tMyForm, "CMyTable", "CPUs", 2, 3, 0, "Live Tables", null, null);

                TheNMIEngine.AddField(tMyForm, new TheFieldInfo()
                {
                    FldOrder = 5, FldWidth = 4, Flags = 2, cdeA = 0x0, Type = eFieldType.SingleEnded, Header = "Friendly Name", DataItem = "MyPropertyBag.FriendlyName.Value"
                });
                TheNMIEngine.AddField(tMyForm, new TheFieldInfo()
                {
                    FldOrder = 6, FldWidth = 2, Flags = 0, cdeA = 0x0, Type = eFieldType.SingleEnded, Header = "HostURL", DataItem = "MyPropertyBag.HostUrl.Value"
                });

                TheNMIEngine.AddField(tMyForm, new TheFieldInfo()
                {
                    FldOrder = 11, Flags = 0, cdeA = 0x0, Type = eFieldType.SingleEnded, Header = "Speed", DataItem = "MyPropertyBag.MaxClockSpeed.Value"
                });
                TheNMIEngine.AddField(tMyForm, new TheFieldInfo()
                {
                    FldOrder = 12, Flags = 0, cdeA = 0x0, Type = eFieldType.SingleEnded, Header = "Cores", DataItem = "MyPropertyBag.NumberOfCores.Value"
                });
                TheNMIEngine.AddField(tMyForm, new TheFieldInfo()
                {
                    FldOrder = 13, FldWidth = 2, Flags = 0, cdeA = 0x0, Type = eFieldType.SingleEnded, Header = "Manufacturer", DataItem = "MyPropertyBag.Manufacturer.Value"
                });
                TheNMIEngine.AddField(tMyForm, new TheFieldInfo()
                {
                    FldOrder = 14, Flags = 0, cdeA = 0xC0, Type = eFieldType.SingleEnded, Header = "Architecture", DataItem = "MyPropertyBag.AddressWidth.Value"
                });
                TheNMIEngine.AddField(tMyForm, new TheFieldInfo()
                {
                    FldOrder = 15, Flags = 0, cdeA = 0xC0, Type = eFieldType.SingleEnded, Header = "Rev", DataItem = "MyPropertyBag.Revision.Value"
                });
                TheNMIEngine.AddField(tMyForm, new TheFieldInfo()
                {
                    FldOrder = 16, Flags = 0, cdeA = 0xC0, Type = eFieldType.SingleEnded, Header = "L2 Cache", DataItem = "MyPropertyBag.L2CacheSize.Value"
                });
                TheNMIEngine.AddField(tMyForm, new TheFieldInfo()
                {
                    FldOrder = 17, Flags = 0, cdeA = 0xC0, Type = eFieldType.SingleEnded, Header = "Version", DataItem = "MyPropertyBag.Version.Value"
                });

                TheNMIEngine.AddField(tMyForm, new TheFieldInfo()
                {
                    FldOrder = 80, FldWidth = 2, cdeA = 0xFF, Type = eFieldType.DateTime, Header = "Last Update", DataItem = "MyPropertyBag.LastUpdate.Value"
                });


                TheFormInfo tMyHForm = new TheFormInfo()
                {
                    cdeMID = new Guid("{33170B1F-CA19-4DC6-A18F-15B5F7669E0A}"), FormTitle = "PC Health Details", defDataSource = "TheThing;:;0;:;True;:;DeviceType=PC-Health"
                };
                TheNMIEngine.AddFormToThingUX(MyBaseThing, tMyHForm, "CMyTable", "PC Health", 3, 3, 0, "Live Tables", null, null);

                TheNMIEngine.AddField(tMyHForm, new TheFieldInfo()
                {
                    FldOrder = 5, FldWidth = 3, Flags = 2, cdeA = 0x0, Type = eFieldType.SingleEnded, Header = "Friendly Name", DataItem = "MyPropertyBag.FriendlyName.Value"
                });
                TheNMIEngine.AddField(tMyHForm, new TheFieldInfo()
                {
                    FldOrder = 6, FldWidth = 2, Flags = 0, cdeA = 0x0, Type = eFieldType.SingleEnded, Header = "HostAddress", DataItem = "MyPropertyBag.HostAddress.Value"
                });
                TheNMIEngine.AddField(tMyHForm, new TheFieldInfo()
                {
                    FldOrder = 7, FldWidth = 3, Flags = 0, cdeA = 0x0, Type = eFieldType.SingleEnded, Header = "Host Version", DataItem = "MyPropertyBag.HostVersion.Value"
                });
                //TheNMIEngine.AddField(tMyHForm, new TheFieldInfo() { FldOrder = 8, Flags = 0, cdeA = 0xC0, Type = eFieldType.SingleEnded, Header = "Station Roles", DataItem = "MyPropertyBag.StationRoles.Value" });

                TheNMIEngine.AddField(tMyHForm, new TheFieldInfo()
                {
                    FldOrder = 11, Flags = 0, cdeA = 0x0, Type = eFieldType.SingleEnded, Header = "CPU Load", DataItem = "MyPropertyBag.CPULoad.Value"
                });
                TheNMIEngine.AddField(tMyHForm, new TheFieldInfo()
                {
                    FldOrder = 13, Flags = 0, cdeA = 0x0, Type = eFieldType.SingleEnded, Header = "CPU Temp", DataItem = "MyPropertyBag.CPUTemp.Value"
                });
                //TheNMIEngine.AddField(tMyHForm, new TheFieldInfo() { FldOrder = 14, Flags = 0, cdeA = 0x0, Type = eFieldType.SingleEnded, Header = "Core Temps", DataItem = "MyPropertyBag.CoreTemps.Value" });

                TheNMIEngine.AddField(tMyHForm, new TheFieldInfo()
                {
                    FldOrder = 21, FldWidth = 2, Flags = 0, cdeA = 0x0, Type = eFieldType.SingleEnded, Header = "RAM Available", DataItem = "MyPropertyBag.RAMAvailable.Value"
                });
                TheNMIEngine.AddField(tMyHForm, new TheFieldInfo()
                {
                    FldOrder = 22, FldWidth = 2, Flags = 0, cdeA = 0x0, Type = eFieldType.SingleEnded, Header = "PC Uptime", DataItem = "MyPropertyBag.PCUptime.Value"
                });
                TheNMIEngine.AddField(tMyHForm, new TheFieldInfo()
                {
                    FldOrder = 23, Flags = 0, cdeA = 0x0, Type = eFieldType.SingleEnded, Header = "Watts", DataItem = "MyPropertyBag.StationWatts.Value"
                });

                TheNMIEngine.AddField(tMyHForm, new TheFieldInfo()
                {
                    FldOrder = 31, Flags = 0, cdeA = 0x0, Type = eFieldType.SingleEnded, Header = "cdeUptime", DataItem = "MyPropertyBag.cdeUptime.Value"
                });
                TheNMIEngine.AddField(tMyHForm, new TheFieldInfo()
                {
                    FldOrder = 32, Flags = 0, cdeA = 0x0, Type = eFieldType.SingleEnded, Header = "cdeHandles", DataItem = "MyPropertyBag.cdeHandles.Value"
                });
                TheNMIEngine.AddField(tMyHForm, new TheFieldInfo()
                {
                    FldOrder = 33, Flags = 0, cdeA = 0x0, Type = eFieldType.SingleEnded, Header = "cdeWorkingSetSize", DataItem = "MyPropertyBag.cdeWorkingSetSize.Value"
                });
                TheNMIEngine.AddField(tMyHForm, new TheFieldInfo()
                {
                    FldOrder = 34, Flags = 0, cdeA = 0x0, Type = eFieldType.SingleEnded, Header = "cdeThreadCount", DataItem = "MyPropertyBag.cdeThreadCount.Value"
                });
                TheNMIEngine.AddField(tMyHForm, new TheFieldInfo()
                {
                    FldOrder = 35, Flags = 0, cdeA = 0x0, Type = eFieldType.SingleEnded, Header = "EventTimeOuts", DataItem = "MyPropertyBag.TotalEventTimeouts.Value"
                });
                TheNMIEngine.AddField(tMyHForm, new TheFieldInfo()
                {
                    FldOrder = 36, Flags = 0, cdeA = 0x0, Type = eFieldType.SingleEnded, Header = "QSenders", DataItem = "MyPropertyBag.QSenders.Value"
                });
                TheNMIEngine.AddField(tMyHForm, new TheFieldInfo()
                {
                    FldOrder = 37, Flags = 0, cdeA = 0x0, Type = eFieldType.SingleEnded, Header = "TSM Inserts", DataItem = "MyPropertyBag.QSInserted.Value"
                });
                TheNMIEngine.AddField(tMyHForm, new TheFieldInfo()
                {
                    FldOrder = 38, Flags = 0, cdeA = 0x0, Type = eFieldType.SingleEnded, Header = "TSM Sents", DataItem = "MyPropertyBag.QSSent.Value"
                });

                TheNMIEngine.AddField(tMyHForm, new TheFieldInfo()
                {
                    FldOrder = 80, FldWidth = 2, cdeA = 0xFF, Type = eFieldType.DateTime, Header = "Last Update", DataItem = "MyPropertyBag.LastUpdate.Value"
                });
            }

            if (!TheBaseAssets.MyServiceHostInfo.IsCloudService)
            {
                int tBS = (int)TheThing.GetSafePropertyNumber(MyBaseThing, "ChartValues");
                if (tBS < 10)
                {
                    tBS = 10;
                }
                if (tBS > 10000)
                {
                    tBS = 10000;
                }

                int tCS = (int)TheThing.GetSafePropertyNumber(MyBaseThing, "ChartSize");
                if (tCS < 6)
                {
                    tCS = 6;
                }

                TheNMIEngine.AddChartScreen(MyBaseThing, new TheChartDefinition(TheThing.GetSafeThingGuid(MyBaseThing, "CPUState"), "Computer CPU State", tBS, "TheHealthHistory", true, "", "PB.HostAddress", "PB.CPULoad;PB.CPUTemp;PB.RAMAvailable")
                {
                    GroupMode = 0, IntervalInMS = 0
                }, 2, 3, 0, TheNMIEngine.GetNodeForCategory(), false, new ThePropertyBag()
                {
                    ".TileHeight=8", ".NoTE=true", $".TileWidth={tCS}", $"Header={TheNMIEngine.GetNodeForCategory()}"
                });
                TheNMIEngine.AddChartScreen(MyBaseThing, new TheChartDefinition(TheThing.GetSafeThingGuid(MyBaseThing, "CDERes"), "CDE Resources", tBS, "TheHealthHistory", true, "", "PB.HostAddress", "PB.cdeHandles;PB.cdeWorkingSetSize")
                {
                    GroupMode = 0, IntervalInMS = 0
                }, 5, 3, 0, TheNMIEngine.GetNodeForCategory(), false, new ThePropertyBag()
                {
                    ".TileHeight=8", ".NoTE=true", $".TileWidth={tCS}", $"Header={TheNMIEngine.GetNodeForCategory()}"
                });
                TheNMIEngine.AddChartScreen(MyBaseThing, new TheChartDefinition(TheThing.GetSafeThingGuid(MyBaseThing, "CDEKPIs"), "CDE KPIs", tBS, "TheHealthHistory", true, "", "PB.HostAddress", "PB.QSenders;PB.QSLocalProcessed;PB.QSSent;PB.QKBSent;PB.QKBReceived;PB.QSInserted;PB.EventTimeouts;PB.TotalEventTimeouts;PB.CCTSMsRelayed;PB.CCTSMsReceived;PB.CCTSMsEvaluated;PB.HTCallbacks;PB.KPI1;PB.KPI2;PB.KPI3;PB.KPI4;PB.KPI5;PB.KPI10")
                {
                    GroupMode = 0, IntervalInMS = 0
                }, 5, 3, 0, TheNMIEngine.GetNodeForCategory(), false, new ThePropertyBag()
                {
                    ".TileHeight=8", ".NoTE=true", $".TileWidth={tCS}", $"Header={TheNMIEngine.GetNodeForCategory()}"
                });

                if (!TheCommonUtils.IsOnLinux())
                {
                    var tMyLiveForm = TheNMIEngine.AddStandardForm(MyBaseThing, "Live CPU Chart", 18, "CPULoad", null, 0, TheNMIEngine.GetNodeForCategory());
                    (tMyLiveForm["Header"] as TheFieldInfo).Header = $"{TheNMIEngine.GetNodeForCategory()} CPU Chart";
                    var tc = TheNMIEngine.AddSmartControl(MyBaseThing, tMyLiveForm["Form"] as TheFormInfo, eFieldType.UserControl, 22, 0, 0, "CPU Load", "LoadBucket", new ThePropertyBag()
                    {
                        "ParentFld=1",
                        "ControlType=Line Chart", "Title=CPU Load", "SubTitle=" + GetProperty("HostAddress", true),
                        "SeriesNames=[{ \"name\":\"CPU-Load\", \"lineColor\":\"rgba(0,255,0,0.39)\"}, { \"name\":\"CDE-Load\", \"lineColor\":\"rgba(0,0,255,0.39)\"}]",
                        "TileHeight=4", "Speed=800", "Delay=0", "Background=rgba(0,0,0,0.01)", "MaxValue=100", "NoTE=true"
                    });
                    tc.AddOrUpdatePlatformBag(eWebPlatform.Any, new nmiPlatBag {
                        TileWidth = 18
                    });
                    tc.AddOrUpdatePlatformBag(eWebPlatform.Mobile, new nmiPlatBag {
                        TileWidth = 6
                    });
                    tc.AddOrUpdatePlatformBag(eWebPlatform.HoloLens, new nmiPlatBag {
                        TileWidth = 12
                    });
                }
            }

            if (TheCommonUtils.CBool(TheBaseAssets.MySettings.GetSetting("PCVitalsMaster")))
            {
                TheFormInfo tMyFormUp = TheNMIEngine.AddForm(new TheFormInfo(MyBaseThing)
                {
                    cdeMID = TheThing.GetSafeThingGuid(MyBaseThing, "THHUPLOAD"), FormTitle = "PC Vitals Uploader", DefaultView = eDefaultView.Form
                });
                TheNMIEngine.AddFormToThingUX(MyBaseThing, tMyFormUp, "CMyForm", "PC Vitals Uploader", 3, 13, 0x80, TheNMIEngine.GetNodeForCategory(), null, new nmiDashboardTile {
                    TileThumbnail = "FA3:f093",
                });
                TheNMIEngine.AddSmartControl(MyBaseThing, tMyFormUp, eFieldType.DropUploader, 3, 2, 128, "Drop a TheHealthHistory-file here", null,
                                             new nmiCtrlDropUploader {
                    TileHeight = 6, NoTE = true, TileWidth = 6, EngineName = MyBaseEngine.GetEngineName(), MaxFileSize = 10000000
                });
                FindTHHFiles();
            }


            TheNMIEngine.AddPageDefinitions(new List <ThePageDefinition>
            {
                { new ThePageDefinition(new Guid("{7FED3369-AF7C-451F-9ED1-71131BB993F4}"), "/PCHEALTH", "Health Info", "", Guid.Empty)
                  {
                      WPID = 10, IncludeCDE = true, RequireLogin = false, PortalGuid = MyBaseEngine.GetDashboardGuid(), StartScreen = MyBaseEngine.GetDashboardGuid()
                  } },
            });
            TheNMIEngine.AddAboutButton(MyBaseThing);
            TheNMIEngine.RegisterEngine(MyBaseEngine);

            mIsUXInitialized = true;
            return(true);
        }
Exemplo n.º 11
0
        public bool CreateUX()
        {
            if (mIsUXInitCalled)
            {
                return(false);
            }
            mIsUXInitCalled = true;

            //NUI Definition for All clients
            mMyDashboard = TheNMIEngine.AddDashboard(MyBaseThing, new TheDashboardInfo(MyBaseEngine, "MQTT Sender")
            {
                PropertyBag = new ThePropertyBag()
                {
                    "Category=Connectors"
                }
            });

            TheFormInfo tAllCloudConnections = new TheFormInfo(MyBaseEngine)
            {
                cdeMID = TheThing.GetSafeThingGuid(MyBaseThing, "MQTTC"), defDataSource = string.Format("TheThing;:;0;:;True;:;EngineName={0}", MyBaseEngine.GetEngineName()), FormTitle = "Cloud Connections", AddButtonText = "Add a Connection"
            };

            TheNMIEngine.AddFormToThingUX(MyBaseThing, tAllCloudConnections, "CMyTable", "MQTT Connections", 1, 0x0D, 0xC0, TheNMIEngine.GetNodeForCategory(), null, new ThePropertyBag()
            {
            });


            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 = 2, 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 = 12, cdeA = 0xFF, Flags = 2, Type = eFieldType.ComboBox, PropertyBag = new nmiCtrlComboBox()
                {
                    Options = MqttDeviceTypes.GetValues(), FldWidth = 3
                }, DefaultValue = MqttDeviceTypes.MqttSender, Header = "DeviceType", DataItem = "MyPropertyBag.DeviceType.Value"
            });
            TheNMIEngine.AddField(tAllCloudConnections, new TheFieldInfo()
            {
                FldOrder = 13, Flags = 2, cdeA = 0xFF, Type = eFieldType.SingleEnded, FldWidth = 3, Header = "Friendly Name", DataItem = "MyPropertyBag.FriendlyName.Value"
            });
            TheNMIEngine.AddField(tAllCloudConnections, new TheFieldInfo()
            {
                FldOrder = 14, Flags = 0, cdeA = 0xC0, Type = eFieldType.SingleEnded, FldWidth = 2, Header = "Address", DataItem = "MyPropertyBag.Address.Value"
            });

            TheNMIEngine.AddField(tAllCloudConnections, new TheFieldInfo()
            {
                FldOrder = 50, cdeA = 0xFF, Type = eFieldType.DateTime, FldWidth = 2, Header = "Last Update", DataItem = "MyPropertyBag.LastUpdate.Value"
            });
            TheNMIEngine.AddTableButtons(tAllCloudConnections, true, 100);

            TheThingRegistry.UpdateEngineUX(MyBaseEngine.GetEngineName());

            TheNMIEngine.AddAboutButton(MyBaseThing, true, "REFRESH_DASH", 0xc0);
            TheNMIEngine.RegisterEngine(MyBaseEngine);

            mIsUXInitialized = true;
            return(true);
        }
Exemplo n.º 12
0
        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'>&#xf0ce;</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);
        }