예제 #1
0
        private void RestoreUDP()
        {
            if (ConfigHelper.Check("UDPClientLogin"))
            {
                textBoxUDPClientLogin.Text = ConfigHelper.GetConfig("UDPClientLogin");
            }
            else
            {
                ConfigHelper.SetConfig("UDPClientLogin", textBoxUDPClientLogin.Text);
            }

            if (ConfigHelper.Check("UDPClient_Checked"))
            {
                radioButtonUDPClient.Checked = DgiotHelper.StrTobool(ConfigHelper.GetConfig("UDPClient_Checked"));
            }
            else
            {
                ConfigHelper.SetConfig("UDPClient_Checked", DgiotHelper.BoolTostr(radioButtonUDPClient.Checked));
            }
        }
예제 #2
0
 private void CheckBoxBridge_CheckedChanged(object sender, EventArgs e)
 {
     ConfigHelper.SetConfig("Bridge_Checked", DgiotHelper.BoolTostr(checkBoxBridge.Checked));
 }
예제 #3
0
 private void CheckBoxOPCDA_CheckedChanged(object sender, EventArgs e)
 {
     ConfigHelper.SetConfig("OPCDACheck", DgiotHelper.BoolTostr(checkBoxOPCDA.Checked));
     OPCDAHelper.StartMonitor();
 }
예제 #4
0
 private void RadioButtonUDPClient_CheckedChanged(object sender, EventArgs e)
 {
     ConfigHelper.SetConfig("UDPClient_Checked", DgiotHelper.BoolTostr(radioButtonTcpClient.Checked));
     ConfigHelper.SetConfig("TcpClient_Checked", DgiotHelper.BoolTostr(false));
     ConfigHelper.SetConfig("MqttClient_Checked", DgiotHelper.BoolTostr(false));
 }
예제 #5
0
 private void CheckBoxDisplayHexCheckedChanged(object sender, EventArgs e)
 {
     ConfigHelper.SetConfig("DisplayHex", DgiotHelper.BoolTostr(checkBoxDisplayHex.Checked));
     LogHelper.Config();
 }
예제 #6
0
 private void CheckBoxReconnectCheckedChanged(object sender, EventArgs e)
 {
     ConfigHelper.SetConfig("ReconnectChecked", DgiotHelper.BoolTostr(checkBoxReconnect.Checked));
 }
예제 #7
0
        private void RestoreMqtt()
        {
            if (ConfigHelper.Check("MqttUserName"))
            {
                textBoxMqttUserName.Text = ConfigHelper.GetConfig("MqttUserName");
            }
            else
            {
                ConfigHelper.SetConfig("MqttUserName", textBoxMqttUserName.Text);
            }

            if (ConfigHelper.Check("MqttPassword"))
            {
                textBoxMqttPassword.Text = ConfigHelper.GetConfig("MqttPassword");
            }
            else
            {
                ConfigHelper.SetConfig("MqttPassword", textBoxMqttPassword.Text);
            }

            if (ConfigHelper.Check("MqttClientId"))
            {
                textBoxMqttClientId.Text = ConfigHelper.GetConfig("MqttClientId");
            }
            else
            {
                ConfigHelper.SetConfig("MqttClientId", comboBoxDtuAddr.Text);
            }

            if (ConfigHelper.Check("MqttPubTopic"))
            {
                textBoxMqttPubTopic.Text = ConfigHelper.GetConfig("MqttPubTopic");
            }
            else
            {
                ConfigHelper.SetConfig("MqttPubTopic", textBoxMqttPubTopic.Text);
            }

            if (ConfigHelper.Check("MqttSubTopic"))
            {
                textBoxMqttSubTopic.Text = ConfigHelper.GetConfig("MqttSubTopic");
            }
            else
            {
                ConfigHelper.SetConfig("MqttSubTopic", textBoxMqttSubTopic.Text);
            }

            if (ConfigHelper.Check("CmdProdxy"))
            {
                var tmp = ConfigHelper.GetConfig("CmdProdxy");
                comboBoxCmdProdxy.SelectedIndex = comboBoxCmdProdxy.Items.IndexOf(tmp);
            }
            else
            {
                ConfigHelper.SetConfig("CmdProdxy", comboBoxCmdProdxy.Text);
            }

            if (ConfigHelper.Check("MqttClient_Checked"))
            {
                radioButtonMqttClient.Checked = DgiotHelper.StrTobool(ConfigHelper.GetConfig("MqttClient_Checked"));
            }
            else
            {
                ConfigHelper.SetConfig("MqttClient_Checked", DgiotHelper.BoolTostr(radioButtonMqttClient.Checked));
            }
        }
예제 #8
0
        private void RestoreCommonConfig()
        {
            if (ConfigHelper.Check("DtuAddr"))
            {
                var tmp = ConfigHelper.GetConfig("DtuAddr");
                comboBoxDtuAddr.SelectedIndex = comboBoxDtuAddr.Items.IndexOf(tmp);
            }
            else
            {
                ConfigHelper.SetConfig("DtuAddr", comboBoxDtuAddr.Text);
            }

            if (ConfigHelper.Check("DgiotSever"))
            {
                textBoxDgiotSever.Text = ConfigHelper.GetConfig("DgiotSever");
            }
            else
            {
                ConfigHelper.SetConfig("DgiotSever", textBoxDgiotSever.Text);
            }

            if (ConfigHelper.Check("DgiotPort"))
            {
                textBoxDgiotPort.Text = ConfigHelper.GetConfig("DgiotPort");
            }
            else
            {
                ConfigHelper.SetConfig("DgiotPort", textBoxDgiotPort.Text);
            }

            if (ConfigHelper.Check("BridgePort"))
            {
                textBoxBridgePort.Text = ConfigHelper.GetConfig("BridgePort");
            }
            else
            {
                ConfigHelper.SetConfig("BridgePort", textBoxBridgePort.Text);
            }

            if (ConfigHelper.Check("ReconnectChecked"))
            {
                checkBoxReconnect.Checked = DgiotHelper.StrTobool(ConfigHelper.GetConfig("ReconnectChecked"));
            }
            else
            {
                ConfigHelper.SetConfig("ReconnectChecked", DgiotHelper.BoolTostr(checkBoxReconnect.Checked));
            }

            if (ConfigHelper.Check("LogLevel"))
            {
                var tmp = ConfigHelper.GetConfig("LogLevel");
                comboBoxLogLevel.SelectedIndex = comboBoxLogLevel.Items.IndexOf(tmp);
            }
            else
            {
                ConfigHelper.SetConfig("LogLevel", comboBoxLogLevel.Text);
            }

            if (ConfigHelper.Check("ToPayload"))
            {
                textToPayload.Text = ConfigHelper.GetConfig("ToPayload");
            }
            else
            {
                ConfigHelper.SetConfig("ToPayload", textToPayload.Text);
            }

            if (ConfigHelper.Check("DisplayHex"))
            {
                checkBoxDisplayHex.Checked = DgiotHelper.StrTobool(ConfigHelper.GetConfig("DisplayHex"));
            }
            else
            {
                ConfigHelper.SetConfig("DisplayHex", DgiotHelper.BoolTostr(checkBoxDisplayHex.Checked));
            }

            if (ConfigHelper.Check("Bridge_Checked"))
            {
                checkBoxBridge.Checked = DgiotHelper.StrTobool(ConfigHelper.GetConfig("Bridge_Checked"));
            }
            else
            {
                ConfigHelper.SetConfig("Bridge_Checked", DgiotHelper.BoolTostr(checkBoxBridge.Checked));
            }
        }