예제 #1
0
        private void fillOptions()
        {
            string strRoutineName = "MQTTSlaveGroup: fillOptions";

            try
            { //Fill Debug levels...
                ucmqtt.cmbDebug.Items.Clear();
                for (int i = 1; i <= Globals.MAX_DEBUG_LEVEL; i++)
                {
                    ucmqtt.cmbDebug.Items.Add(i.ToString());
                }
                ucmqtt.cmbDebug.SelectedIndex = 0;
                ucmqtt.CmbOutput.Items.Clear();
                foreach (String st in MQTTSlave.getOutputTypes())
                {
                    ucmqtt.CmbOutput.Items.Add(st.ToString());
                }
                if (ucmqtt.CmbOutput.Items.Count > 0)
                {
                    ucmqtt.CmbOutput.SelectedIndex = 0;
                }

                #region Fill QoS
                //Namrata:23/04/2019
                ucmqtt.CmbQoS.Items.Clear();
                foreach (String st in MQTTSlave.getQoS())
                {
                    ucmqtt.CmbQoS.Items.Add(st.ToString());
                }
                if (ucmqtt.CmbQoS.Items.Count > 0)
                {
                    ucmqtt.CmbQoS.SelectedIndex = 0;
                }
                #endregion Fill QoS

                #region Fill Broker
                //Namrata:23/04/2019
                ucmqtt.CmbBroker.Items.Clear();
                foreach (String st in MQTTSlave.getBroker())
                {
                    ucmqtt.CmbBroker.Items.Add(st.ToString());
                }
                if (ucmqtt.CmbBroker.Items.Count > 0)
                {
                    ucmqtt.CmbBroker.SelectedIndex = 0;
                }
                #endregion Fill Broker
            }
            catch (Exception ex)
            {
                MessageBox.Show(strRoutineName + ": " + "Error: " + ex.Message.ToString(), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #2
0
        private void loadValues()
        {
            string strRoutineName = "MQTTSlaveGroup:loadValues";

            try
            {
                MQTTSlave MQTT = mbsList.ElementAt(editIndex);
                if (MQTT != null)
                {
                    ucmqtt.txtSlaveNum.Text    = MQTT.SlaveNum;
                    ucmqtt.txtBorkerAddr.Text  = MQTT.BrokerAddress;
                    ucmqtt.txtTopic.Text       = MQTT.Topic;
                    ucmqtt.txtUserName.Text    = MQTT.UserName;
                    ucmqtt.txtPassword.Text    = MQTT.Password;
                    ucmqtt.txtCertificate.Text = MQTT.Certificate;
                    ucmqtt.TxtTLSLevel.Text    = MQTT.TLSLevel;
                    //ucmqtt.txtBroker.Text = MQTT.Broker;//Namrata:23/04/2019
                    ucmqtt.txtScanTime.Text        = MQTT.ScanTime;
                    ucmqtt.txtPortNum.Text         = MQTT.PortNum;//Namrata:23/04/2019
                    ucmqtt.txtFirmwareVersion.Text = MQTT.AppFirmwareVersion;
                    ucmqtt.cmbDebug.SelectedIndex  = ucmqtt.cmbDebug.FindStringExact(MQTT.DEBUG);
                    ucmqtt.CmbOutput.SelectedIndex = ucmqtt.CmbOutput.FindStringExact(MQTT.Output);
                    ucmqtt.CmbQoS.SelectedIndex    = ucmqtt.CmbQoS.FindStringExact(MQTT.QoS); //Namrata:23/04/2019
                    ucmqtt.CmbBroker.Text          = MQTT.Broker.ToString();                  //Namrata:23/04/2019
                    if (MQTT.Run.ToLower() == "yes")
                    {
                        ucmqtt.chkRun.Checked = true;
                    }
                    else
                    {
                        ucmqtt.chkRun.Checked = false;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(strRoutineName + ": " + "Error: " + ex.Message.ToString(), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }