예제 #1
0
        private string BuildDD(string name, string selectedValue = "")
        {
            var  dd = new clsJQuery.jqDropList("dd", this.PageName, false);
            bool sel;

            DataRow[] rows;

            dd.id           = "o" + name;
            dd.autoPostBack = true;
            dd.AddItem("", "", false);
            //save the visible text of the options for later use
            if (_ddTable == null)
            {
                _ddTable = new DataTable();
                _ddTable.Columns.Add("ObjectName", typeof(string));
                _ddTable.Columns.Add("OptionName", typeof(string));
                _ddTable.Columns.Add("OptionValue", typeof(string));
            }

            rows = _ddTable.Select("ObjectName='" + name + "'");
            foreach (var row in rows)
            {
                if ((string)row["OptionValue"] == selectedValue)
                {
                    sel = true;
                }
                else
                {
                    sel = false;
                }
                dd.AddItem((string)row["OptionName"], (string)row["OptionValue"], sel);
            }
            _ddTable.AcceptChanges();
            return(dd.Build());
        }
예제 #2
0
        private string CreateDeviceDropdown(string floorChosen, string roomChosen, int?deviceId, string uid, string uniqueControllerId)
        {
            string deviceDropDownParameter = Constants.DeviceDropdownKey;
            var    devicesFromFloorAndRoom = _floorsRomsAndDevices.GetDevices(floorChosen, roomChosen);
            var    chosenDevice            = -1;
            var    noSelectionMade         = false;

            if (deviceId.HasValue)
            {
                chosenDevice = deviceId.Value;
            }
            else
            {
                noSelectionMade = true;
            }
            var listToReturn = new clsJQuery.jqDropList(deviceDropDownParameter + uid + uniqueControllerId, Constants.EventsPage, true);

            listToReturn.AddItem("", "-1", noSelectionMade);
            foreach (var hsDevice in devicesFromFloorAndRoom)
            {
                var currentDeviceId = hsDevice.DeviceId;
                listToReturn.AddItem(hsDevice.DeviceName, currentDeviceId.ToString(), currentDeviceId == chosenDevice);
            }
            return(listToReturn.Build());
        }
예제 #3
0
        /// <summary>
        /// Return the string required to create a web page drop list.
        /// </summary>
        protected string FormDropDown(string Name, ref NameValueCollection Options, int selected, int width = 150, bool SubmitForm = true, bool AddBlankRow = false,
                                      bool AutoPostback = true, string Tooltip = "", bool Enabled = true, string ddMsg = "", string SelectedValue = "")
        {
            clsJQuery.jqDropList dd = new clsJQuery.jqDropList(Name, PageName, SubmitForm);

            dd.selectedItemIndex = -1;
            dd.id           = "o" + Name;
            dd.autoPostBack = AutoPostback;
            dd.toolTip      = Tooltip;
            dd.style        = "width: " + width + "px;";
            dd.enabled      = Enabled;

            //Add a blank area to the top of the list
            if (AddBlankRow)
            {
                dd.AddItem(ddMsg, "", false);
            }

            if (Options != null)
            {
                for (int i = 0; i < Options.Count; i++)
                {
                    bool sel = (i == selected) || (Options.Get(i) == SelectedValue);

                    dd.AddItem(Options.GetKey(i), Options.Get(i), sel);
                }
            }

            return(dd.Build());
        }
예제 #4
0
        /// <summary>
        ///     Return the string required to create a web page drop list.
        /// </summary>
        protected string FormDropDown(string name, ref NameValueCollection options, int selected, int width = 150,
                                      bool submitForm      = true, bool addBlankRow = false,
                                      bool autoPostback    = true, string tooltip   = "", bool enabled = true, string ddMsg = "",
                                      string selectedValue = "")
        {
            var dd = new clsJQuery.jqDropList(name, PageName, submitForm)
            {
                selectedItemIndex = -1,
                id           = "o" + name,
                autoPostBack = autoPostback,
                toolTip      = tooltip,
                style        = "width: " + width + "px;",
                enabled      = enabled
            };


            //Add a blank area to the top of the list
            if (addBlankRow)
            {
                dd.AddItem(ddMsg, "", false);
            }

            if (options != null)
            {
                for (var i = 0; i < options.Count; i++)
                {
                    var sel = i == selected || options.Get(i) == selectedValue;

                    dd.AddItem(options.GetKey(i), options.Get(i), sel);
                }
            }

            return(dd.Build());
        }
예제 #5
0
        private string BuildAddNewWebPageBody([AllowNull] ChromecastDevice device)
        {
            string name = device != null?device.Name.ToString() : string.Empty;

            string ip = device != null?device.DeviceIP.ToString() : string.Empty;

            string id          = device != null ? device.Id : string.Empty;
            string buttonLabel = device != null ? "Save" : "Add";
            string header      = device != null ? "Edit" : "Add New";
            int    volume      = device != null ? (device.Volume ?? -1) : -1;

            StringBuilder stb = new StringBuilder();

            stb.Append(PageBuilderAndMenu.clsPageBuilder.FormStart("ftmDeviceChange", "IdChange", "Post"));

            stb.Append(@"<div>");
            stb.Append(@"<table class='full_width_table'");
            stb.Append("<tr height='5'><td style='width:25%'></td><td style='width:20%'></td><td style='width:55%'></td></tr>");
            stb.Append(Invariant($"<tr><td class='tableheader' colspan=3>{header}</td></tr>"));
            stb.Append(Invariant($"<tr><td class='tablecell'>Name:</td><td class='tablecell' colspan=2>{HtmlTextBox(NameId, name, @readonly: !string.IsNullOrEmpty(id))}</td></tr>"));
            stb.Append(Invariant($"<tr><td class='tablecell'>DeviceIP:</td><td class='tablecell' colspan=2>{HtmlTextBox(DeviceIPId, ip)}</td></tr>"));
            stb.Append("<tr><td class='tablecell'>Volume:</td><td class='tablecell' colspan=2>");

            var volumeDropDown = new clsJQuery.jqDropList(NameToId(VolumeId), PageName, false)
            {
                toolTip      = "Select Volume of device when Spoken",
                autoPostBack = false,
            };

            volumeDropDown.AddItem("Don't Change", NoValueForVoice, volume == -1);

            foreach (var value in Enumerable.Range(1, 100))
            {
                var stringValue = value.ToString(CultureInfo.InvariantCulture);
                volumeDropDown.AddItem(stringValue, stringValue, volume == value);
            }

            stb.Append(volumeDropDown.Build());
            stb.Append("</td></tr>");
            stb.Append(Invariant($"<tr><td colspan=3>{HtmlTextBox(DeviceIdId, id, type: "hidden")}<div id='{SaveErrorDivId}' style='color:Red'></div></td><td></td></tr>"));
            stb.Append(Invariant($"<tr><td colspan=3>{FormPageButton(SaveDeviceName, buttonLabel)}"));

            if (device != null)
            {
                stb.Append(FormPageButton(DeleteDeviceName, "Delete"));
            }

            stb.Append(FormPageButton(CancelDeviceName, "Cancel"));
            stb.Append(Invariant($"</td><td></td></tr>"));
            stb.Append("<tr height='5'><td colspan=3></td></tr>");
            stb.Append(@" </table>");
            stb.Append(@"</div>");
            stb.Append(PageBuilderAndMenu.clsPageBuilder.FormEnd());

            return(stb.ToString());
        }
예제 #6
0
        private string CreateSettingTable()
        {
            StringBuilder stb = new StringBuilder();

            stb.Append(PageBuilderAndMenu.clsPageBuilder.FormStart("ftmSettings", "Id", "Post"));
            stb.Append(@"<table class='full_width_table'");
            stb.Append("<tr height='2'><td width=25%></td><td></td></tr>");
            stb.Append("<tr><td class='tableheader' colspan=2>Settings</td></tr>");
            stb.Append(Invariant($@"<tr  class='tablecell'><td>Override Server IP Address:</td><td>{
                                HtmlTextBox(ServerIPAddressId,
                                            pluginConfig.WebServerIPAddress != null ? pluginConfig.WebServerIPAddress.ToString() : string.Empty)
                                }</td ></tr>"));
            stb.Append(Invariant($@"<tr class='tablecell'><td>Server Port:</td><td>{
                                HtmlTextBox(ServerPortId, pluginConfig.WebServerPort.ToString(CultureInfo.InvariantCulture))
                                }</td></tr>"));
            stb.Append(Invariant($@"<tr class='tablecell'><td>Foward Speech To HomeSeer:</td><td>{
                                FormCheckBox(FormatSpeechId, string.Empty, pluginConfig.ForwardSpeach, false)
                                }</td></tr>"));

            stb.Append("<tr class='tablecell'><td>SAPI Voice:</td><td>");
            string sapiVoice      = pluginConfig.SAPIVoice;
            var    volumeDropDown = new clsJQuery.jqDropList(NameToId(SapiVoiceId), PageName, false)
            {
                toolTip      = "Select SAPI Voice",
                autoPostBack = false,
            };

            volumeDropDown.AddItem("Don't Set", NoValueForVoice, string.IsNullOrWhiteSpace(sapiVoice));

            using (var speechSynthesizer = new SpeechSynthesizer())
            {
                foreach (var value in speechSynthesizer.GetInstalledVoices())
                {
                    var stringValue = value.VoiceInfo.Name;
                    volumeDropDown.AddItem(stringValue, stringValue, sapiVoice == stringValue);
                }
            }
            stb.Append(volumeDropDown.Build());

            stb.Append("</td></tr>");

            stb.Append(Invariant($@"<tr class='tablecell'><td>Debug Logging Enabled:</td><td>{
                                  FormCheckBox(DebugLoggingId, string.Empty, pluginConfig.DebugLogging, false)
                                  }</td></tr>"));
            stb.Append(Invariant($"<tr class='tablecell'><td><div id='{SaveErrorDivId}' style='color:Red'></div></td><td></td></tr>"));

            stb.Append(Invariant($@"<tr class='tablecell'><td>{FormPageButton(SaveSettingName, "Save")}</td><td></td></tr>"));

            stb.Append(@"<tr height='5'><td colspan=2></td></tr>");
            stb.Append(@"</table");
            stb.Append(PageBuilderAndMenu.clsPageBuilder.FormEnd());
            return(stb.ToString());
        }
예제 #7
0
        private clsJQuery.jqDropList CreateDropDown(string dropDownParameter, string chosenValue, List <string> unitList, string uid, string uniqueControllerId)
        {
            var dropList = new clsJQuery.jqDropList(dropDownParameter + uid + uniqueControllerId, Constants.EventsPage, true);

            dropList.AddItem("", "", false);
            foreach (var unit in unitList)
            {
                if (!string.IsNullOrEmpty(unit))
                {
                    dropList.AddItem(unit, unit, unit == chosenValue);
                }
            }
            return(dropList);
        }
예제 #8
0
        private clsJQuery.jqDropList CreateDropDownFromNameValueCollection(string dropDownParameter, string chosenValue, NameValueCollection unitList, string uid, string uniqueControllerId, bool noDefaultBlank = false)
        {
            var dropList = new clsJQuery.jqDropList(dropDownParameter + uid + uniqueControllerId, Constants.EventsPage, true);

            if (!noDefaultBlank)
            {
                dropList.AddItem("", "", false);
            }
            foreach (var unit in unitList.AllKeys)
            {
                dropList.AddItem(unitList[unit], unit, unit == chosenValue);
            }
            return(dropList);
        }
예제 #9
0
        protected static string FormDropDown(string name, NameValueCollection options, string selected,
                                             int width, string tooltip, bool autoPostBack, string pageName)
        {
            var dropdown = new clsJQuery.jqDropList(name, pageName, false)
            {
                selectedItemIndex = -1,
                id           = NameToIdWithPrefix(name),
                autoPostBack = autoPostBack,
                toolTip      = tooltip,
                style        = Invariant($"width: {width}px;"),
                enabled      = true,
                submitForm   = autoPostBack,
            };

            if (options != null)
            {
                for (var i = 0; i < options.Count; i++)
                {
                    var sel = options.GetKey(i) == selected;
                    dropdown.AddItem(options.Get(i), options.GetKey(i), sel);
                }
            }

            return(dropdown.Build());
        }
예제 #10
0
 private static void BuildColorDropdown(string pageName, clsJQuery.jqDropList dropdown, WD200NormalModeColor selectedColor)
 {
     foreach (int i in Enum.GetValues(typeof(WD200NormalModeColor)))
     {
         dropdown.AddItem(((WD200NormalModeColor)i).ToString(), i.ToString(), (int)selectedColor == i);
     }
 }
예제 #11
0
        public string BuildDropList(string name, bool rebuilding = false)
        {
            var ddl = new clsJQuery.jqDropList(name, this.PageName, false);

            ddl.id           = "o" + name;
            ddl.autoPostBack = true;

            //Get the items we want to have in the drop down list
            var items        = new List <string>();
            var selectedItem = string.Empty;

            switch (name)
            {
            case "DropListLocation":
                items        = _utils.Devices().Select(x => x.get_Location(_hs)).Distinct().OrderBy(x => x).ToList();
                selectedItem = _settings.Location;
                break;

            case "DropListLocation2":
                items        = _utils.Devices().Select(x => x.get_Location2(_hs)).Distinct().OrderBy(x => x).ToList();
                selectedItem = _settings.Location2;
                break;
            }

            //... and add them to the control with a blank on top
            ddl.AddItem("", "", true);
            foreach (var item in items)
            {
                ddl.AddItem(item, item, (item == selectedItem));
            }

            string ret = string.Empty;

            if (rebuilding)
            {
                ret = ddl.Build();
                this.divToUpdate.Add(name + "_div", ret);
            }
            else
            {
                ret = "<div style='float: left;'  id='" + name + "_div'>" + ddl.Build() + "</div>";
            }
            return(ret);
        }
예제 #12
0
        public string GetPagePlugin(string pageName, string user, int userRights, string queryString)
        {
            StringBuilder pluginSB = new StringBuilder();
            OptionsPage   page     = this;

            try
            {
                page.reset();

                // handle queries with special data

                /*System.Collections.Specialized.NameValueCollection parts = null;
                 * if ((!string.IsNullOrEmpty(queryString)))
                 * {
                 *  parts = HttpUtility.ParseQueryString(queryString);
                 * }
                 * if (parts != null)
                 * {
                 *  if (parts["myslide1"] == "myslide_name_open")
                 *  {
                 *      // handle a get for tab content
                 *      string name = parts["name"];
                 *      return ("<table><tr><td>cell1</td><td>cell2</td></tr><tr><td>cell row 2</td><td>cell 2 row 2</td></tr></table>");
                 *      //Return ("<div><b>content data for tab</b><br><b>content data for tab</b><br><b>content data for tab</b><br><b>content data for tab</b><br><b>content data for tab</b><br><b>content data for tab</b><br></div>")
                 *  }
                 *  if (parts["myslide1"] == "myslide_name_close")
                 *  {
                 *      return "";
                 *  }
                 * }*/

                this.AddHeader(Util.hs.GetPageHeader(pageName, Util.IFACE_NAME, "", "", false, true));
                //pluginSB.Append("<link rel = 'stylesheet' href = 'hspi_rachiosiid/css/style.css' type = 'text/css' /><br>");
                //page.AddHeader(pluginSB.ToString());



                //page.RefreshIntervalMilliSeconds = 5000
                // handler for our status div
                //stb.Append(page.AddAjaxHandler("/devicestatus?ref=3576", "stat"))
                pluginSB.Append(this.AddAjaxHandlerPost("action=updatetime", this.PageName));



                // page body starts here



                pluginSB.Append(clsPageBuilder.DivStart("pluginpage", ""));
                //Dim dv As DeviceClass = GetDeviceByRef(3576)
                //Dim CS As CAPIStatus
                //CS = dv.GetStatus

                pluginSB.AppendLine("<table class='full_width_table' cellspacing='0' width='100%' >");
                pluginSB.AppendLine("<tr><td  colspan='1' >");
                // Status/Options Tabs

                clsJQuery.jqTabs jqtabs = new clsJQuery.jqTabs("optionsTab", this.PageName);

                // Options Tab
                clsJQuery.Tab tab = new clsJQuery.Tab();
                tab          = new clsJQuery.Tab();
                tab.tabTitle = "Options";
                tab.tabDIVID = "rachiosiid-options";

                var optionsString = new StringBuilder();

                optionsString.Append("<table cellspacing='0' cellpadding='5'  width='100%'>");

                // Rachio API Access Token
                optionsString.Append("<tr><td class='tableheader' colspan='2'>Rachio API Access Token</td></tr>");
                optionsString.Append("<tr><td class='tablecell'>API Access Token</td>");
                optionsString.Append("<td class='tablecell'>");
                optionsString.Append(PageBuilderAndMenu.clsPageBuilder.FormStart("myform1", "testpage", "post"));


                clsJQuery.jqTextBox tokenTextBox = new clsJQuery.jqTextBox("APIToken", "text", apiKey, this.PageName, 30, true);
                tokenTextBox.promptText  = "Enter your Rachio API access token.";
                tokenTextBox.toolTip     = "Access Token";
                tokenTextBox.dialogWidth = 600;
                optionsString.Append(tokenTextBox.Build());



                clsJQuery.jqOverlay ol = new clsJQuery.jqOverlay("ov1", this.PageName, false, "events_overlay");
                ol.toolTip = "Help with API Access Token";
                ol.label   = "Help?";

                clsJQuery.jqButton apiBut = new clsJQuery.jqButton("apilink", "Rachio-API", this.PageName, true);
                apiBut.url = "https://app.rach.io/";

                ol.overlayHTML  = PageBuilderAndMenu.clsPageBuilder.FormStart("overlayformm", "testpage", "post");
                ol.overlayHTML += "<div>If you don't have an<br>access token saved, follow<br>the button link below to<br>navigate to the Rachio API.<br>Sign in and copy the <br>API Access Token within<br> the settings menu on the<br>top-right of the page.<br><br>" + apiBut.Build() + "</div>";
                ol.overlayHTML += PageBuilderAndMenu.clsPageBuilder.FormEnd();
                optionsString.Append(ol.Build());
                optionsString.Append(PageBuilderAndMenu.clsPageBuilder.FormEnd());
                optionsString.Append("</td></tr>");

                // Rachio Options
                optionsString.Append("<tr><td class='tableheader' colspan='2'>Rachio Options</td></tr>");

                optionsString.Append("<tr><td class='tablecell'>Unit Type</td>");
                optionsString.Append("<td class='tablecell'>");
                clsJQuery.jqDropList dl = new clsJQuery.jqDropList("unitType", this.PageName, false);
                dl.toolTip = "Select your preferred units.";
                if (unitType == null || unitType.Equals("US"))
                {
                    dl.AddItem("U.S. customary  units (miles, °F, etc...)", "1", true);
                    dl.AddItem("Metric system units (kms, °C, etc...)", "2", false);
                }
                else
                {
                    dl.AddItem("U.S. customary  units (miles, °F, etc...)", "1", false);
                    dl.AddItem("Metric system units (kms, °C, etc...)", "2", true);
                }
                dl.autoPostBack = true;
                optionsString.Append(dl.Build());

                clsJQuery.jqDropList dl2 = new clsJQuery.jqDropList("updateInterval", this.PageName, false);
                optionsString.Append("</td></tr>");

                optionsString.Append("<tr><td class='tablecell'>Update Frequency</td>");
                optionsString.Append("<td class='tablecell'>");
                dl2.toolTip = "Specify how often RachioSIID receives updates from the Rachio API servers.";

                for (int i = 1; i < 61; i++)
                {
                    dl2.AddItem(i.ToString() + " Minute(s)", i.ToString(), updateInterval == i);
                }

                dl2.autoPostBack = true;
                optionsString.Append(dl2.Build());

                optionsString.Append("</td></tr>");

                optionsString.Append("<tr><td class='tablecell'>Zones View</td>");
                optionsString.Append("<td class='tablecell'>");
                optionsString.Append(PageBuilderAndMenu.clsPageBuilder.FormStart("myform2", "testpage", "post"));

                clsJQuery.jqOverlay ol2 = new clsJQuery.jqOverlay("ov2", this.PageName, false, "events_overlay");
                ol2.toolTip      = "Specify which Zone devices are in view";
                ol2.label        = "Zones";
                ol2.overlayHTML  = PageBuilderAndMenu.clsPageBuilder.FormStart("overlayformm", "testpage", "post");
                ol2.overlayHTML += "<div>Select which Zones are visible:<br><br>";

                for (int i = 1; i < 17; i++)
                {
                    clsJQuery.jqCheckBox zoneCheck = new clsJQuery.jqCheckBox("ZoneCheck" + i, "Zone " + i, this.PageName, true, false);
                    if (ZoneChecks != null)
                    {
                        zoneCheck.@checked = ZoneChecks[i - 1];
                    }
                    else
                    {
                        zoneCheck.@checked = true;
                    }
                    zoneCheck.enabled = true;
                    ol2.overlayHTML  += zoneCheck.Build() + "<br>";
                }

                ol2.overlayHTML += "</div>";
                ol2.overlayHTML += PageBuilderAndMenu.clsPageBuilder.FormEnd();
                optionsString.Append(ol2.Build());
                optionsString.Append(PageBuilderAndMenu.clsPageBuilder.FormEnd());
                optionsString.Append("</td></tr>");

                // Homeseer Device Options

                /*optionsString.Append("<tr><td class='header' colspan='2'>Homeseer Device Options</td></tr>");
                 *
                 * optionsString.Append("<tr><td>Forecast Days</td>");
                 * optionsString.Append("<td>");
                 * dl.toolTip = "Specify the number of days to create weather forecast devices.";
                 *
                 *
                 * dl.AddItem("Disabled", "1", false);
                 * dl.AddItem("Today's Forecast", "2", true);
                 * dl.AddItem("Today's and Tomorrow's Forecast", "3", false);
                 * for (int i = 4; i < 9; i++)
                 * {
                 *      dl.AddItem((i-2).ToString() + " Day Forecast", i.ToString(), false);
                 * }
                 *
                 * dl.autoPostBack = true;
                 * optionsString.Append(dl.Build());
                 * dl.ClearItems();
                 * optionsString.Append("</td></tr>");
                 *
                 * optionsString.Append("<tr><td>Device Image</td>");
                 * optionsString.Append("<td>");
                 * dl.toolTip = "Select your preferred units.";
                 * dl.AddItem("Yes", "1", true);
                 * dl.AddItem("No", "2", false);
                 * dl.autoPostBack = true;
                 * optionsString.Append(dl.Build());
                 * dl.ClearItems();
                 * optionsString.Append("</td></tr>");*/

                // Web Page Access

                /*optionsString.Append("<tr><td class='header' colspan='2'>Web Page Access</td></tr>");
                 *
                 * optionsString.Append("<tr><td>Forecast Days</td>");
                 * optionsString.Append("<td>");
                 * optionsString.Append(PageBuilderAndMenu.clsPageBuilder.FormStart("FormCheckbox", "userroles", "post"));
                 *
                 * clsJQuery.jqCheckBox guestCheck = new clsJQuery.jqCheckBox("guestCheck", "Guest", this.PageName, true, false);
                 * guestCheck.@checked = false;
                 * optionsString.Append(guestCheck.Build());
                 *
                 * clsJQuery.jqCheckBox adminCheck = new clsJQuery.jqCheckBox("adminCheck", "Admin", this.PageName, true, false);
                 * adminCheck.@checked = true;
                 * adminCheck.enabled = false;
                 * optionsString.Append(adminCheck.Build());
                 *
                 * clsJQuery.jqCheckBox normalCheck = new clsJQuery.jqCheckBox("normalCheck", "Normal", this.PageName, true, false);
                 * normalCheck.@checked = false;
                 * optionsString.Append(normalCheck.Build());
                 *
                 * clsJQuery.jqCheckBox localCheck = new clsJQuery.jqCheckBox("localCheck", "Local", this.PageName, true, false);
                 * localCheck.@checked = false;
                 * optionsString.Append(localCheck.Build());
                 *
                 * optionsString.Append("</td></tr>");*/

                // Applications Options
                optionsString.Append("<tr><td class='tableheader' colspan='2'>Applications Options</td></tr>");
                optionsString.Append("<tr><td class='tablecell'>Logging Level</td>");
                optionsString.Append("<td class='tablecell'>");

                clsJQuery.jqDropList dl3 = new clsJQuery.jqDropList("loggingType", this.PageName, false);
                dl3.toolTip = "Specifiy the plugin logging level";
                if (loggingType == "Off")
                {
                    dl3.AddItem("Off", "1", true);
                    dl3.AddItem("Debug", "2", false);
                }
                else
                {
                    dl3.AddItem("Off", "1", false);
                    dl3.AddItem("Debug", "2", true);
                }

                /*var logLevel = new string[10] {"", "Emergency", "Alert", "Critical", "Error", "Warning", "Notice", "", "Trace", "Debug"};
                 * for (int i = 1; i < 10; i++)
                 * {
                 *  if(i==7)
                 *      dl.AddItem("Informational", i.ToString(), true);
                 *  else
                 *      dl.AddItem(logLevel[i], i.ToString(), false);
                 * }*/

                dl3.autoPostBack = true;
                optionsString.Append(dl3.Build());

                optionsString.Append("</td></tr>");

                optionsString.Append("</table>");



                tab.tabContent = optionsString.ToString();
                jqtabs.tabs.Add(tab);

                pluginSB.Append(jqtabs.Build());
                pluginSB.AppendLine("</td></tr></table>");


                // container test
                //Dim statCont As New clsJQuery.jqContainer("contid", "Office Lamp", "/homeseer/on.gif", 100, 100, "this is the content")
                //stb.Append(statCont.build)
            }
            catch (Exception ex)
            {
                pluginSB.Append("Status/Options error: " + ex.Message);
            }
            pluginSB.Append("<br>");

            pluginSB.Append(DivEnd());
            page.AddBody(pluginSB.ToString());

            return(page.BuildPage());
        }
예제 #13
0
        public override string TriggerBuildUI(string unique, IPlugInAPI.strTrigActInfo trigInfo)
        {
            StringBuilder sb   = new StringBuilder();
            TriggerData   trig = TriggerData.Unserialize(trigInfo.DataIn);

            clsJQuery.jqDropList dropList;

            Program.WriteLog(LogType.Console, "Building UI for " + trig);

            if (!Condition)
            {
                dropList = new clsJQuery.jqDropList("TrigType" + unique, "events", true);
                dropList.AddItem("This device's value was set:", ((byte)TriggerType.DeviceValueSet).ToString(),
                                 trig.Type == TriggerType.DeviceValueSet);
                dropList.AddItem("This device's value changed:", ((byte)TriggerType.DeviceValueChanged).ToString(),
                                 trig.Type == TriggerType.DeviceValueChanged);
                sb.Append(dropList.Build());
            }

            dropList = new clsJQuery.jqDropList("DeviceLeft" + unique, "events", true);
            dropList.AddItem("(Select A Device)", "0", trig.DevRefLeft == 0);
            foreach (DeviceData device in devices)
            {
                dropList.AddItem(device.Name, device.DevRef.ToString(), trig.DevRefLeft == device.DevRef);
            }

            sb.Append(dropList.Build());
            if (!Condition)
            {
                sb.Append("<br />And it is ");
            }
            else
            {
                sb.Append(" is ");
            }

            dropList = new clsJQuery.jqDropList("CompOperator" + unique, "events", true);
            dropList.AddItem("less than", ((int)TriggerComp.LessThan).ToString(), trig.Comparison == TriggerComp.LessThan);
            dropList.AddItem("less than or equal to", ((int)TriggerComp.LessThanOrEqual).ToString(),
                             trig.Comparison == TriggerComp.LessThanOrEqual);
            dropList.AddItem("equal to", ((int)TriggerComp.Equal).ToString(), trig.Comparison == TriggerComp.Equal);
            dropList.AddItem("greater than", ((int)TriggerComp.GreaterThan).ToString(),
                             trig.Comparison == TriggerComp.GreaterThan);
            dropList.AddItem("greater than or equal to", ((int)TriggerComp.GreaterThanOrEqual).ToString(),
                             trig.Comparison == TriggerComp.GreaterThanOrEqual);
            dropList.AddItem("not equal to", ((int)TriggerComp.NotEqual).ToString(), trig.Comparison == TriggerComp.NotEqual);
            sb.Append(dropList.Build());

            if (Condition)
            {
                sb.Append("<br />");
            }

            sb.Append(" the value of: ");

            dropList = new clsJQuery.jqDropList("DeviceRight" + unique, "events", true);
            dropList.AddItem("(Select A Device)", "0", trig.DevRefRight == 0);
            foreach (DeviceData device in devices)
            {
                dropList.AddItem(device.Name, device.DevRef.ToString(), trig.DevRefRight == device.DevRef);
            }

            sb.Append(dropList.Build());
            return(sb.ToString());
        }