Ejemplo n.º 1
0
 private void RestoreAccess()
 {
     if (ConfigHelper.Check("AccessTopic"))
     {
         textBoxAccessTopic.Text = ConfigHelper.GetConfig("AccessTopic");
     }
     else
     {
         ConfigHelper.SetConfig("AccessTopic", textBoxAccessTopic.Text);
     }
 }
Ejemplo n.º 2
0
 private void RestoreBACnet()
 {
     if (ConfigHelper.Check("BACnetTopic"))
     {
         textBoxBACnetTopic.Text = ConfigHelper.GetConfig("BACnetTopic");
     }
     else
     {
         ConfigHelper.SetConfig("BACnetTopic", textBoxBACnetTopic.Text);
     }
 }
Ejemplo n.º 3
0
 private void RestoreControl()
 {
     if (ConfigHelper.Check("ControlTopic"))
     {
         textBoxControlTopic.Text = ConfigHelper.GetConfig("ControlTopic");
     }
     else
     {
         ConfigHelper.SetConfig("ControlTopic", textBoxControlTopic.Text);
     }
 }
Ejemplo n.º 4
0
 private void RestorePLC()
 {
     if (ConfigHelper.Check("PLCTopic"))
     {
         textBoxPLCTopic.Text = ConfigHelper.GetConfig("PLCTopic");
     }
     else
     {
         ConfigHelper.SetConfig("PLCTopic", textBoxPLCTopic.Text);
     }
 }
Ejemplo n.º 5
0
 private void RestoreOPCUA()
 {
     if (ConfigHelper.Check("OPCUATopic"))
     {
         textBoxOPCUATopic.Text = ConfigHelper.GetConfig("OPCUATopic");
     }
     else
     {
         ConfigHelper.SetConfig("OPCUATopic", textBoxOPCUATopic.Text);
     }
 }
Ejemplo n.º 6
0
        private void RestoreSerialPort()
        {
            if (ConfigHelper.Check("SerialPort"))
            {
                var tmp = ConfigHelper.GetConfig("SerialPort");
                comboBoxSerialPort.SelectedIndex = comboBoxSerialPort.Items.IndexOf(tmp);
            }
            else
            {
                ConfigHelper.SetConfig("SerialPort", comboBoxSerialPort.Text);
            }

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

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

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

            if (ConfigHelper.Check("StopBits"))
            {
                var tmp = ConfigHelper.GetConfig("StopBits");
                comboBoxStopBits.SelectedIndex = comboBoxStopBits.Items.IndexOf(tmp);
            }
            else
            {
                ConfigHelper.SetConfig("StopBits", comboBoxStopBits.Text);
            }
        }
Ejemplo n.º 7
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));
            }
        }
Ejemplo n.º 8
0
        private void RestoreOPCDA()
        {
            if (ConfigHelper.Check("OPCDAHost"))
            {
                textBoxOPCDAHost.Text = ConfigHelper.GetConfig("OPCDAHost");
            }
            else
            {
                ConfigHelper.SetConfig("OPCDAHost", textBoxOPCDAHost.Text);
            }

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

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

            if (ConfigHelper.Check("OPCDACheck"))
            {
                checkBoxOPCDA.Text = ConfigHelper.GetConfig("OPCDACheck");
            }
            else
            {
                ConfigHelper.SetConfig("OPCDACheck", checkBoxOPCDA.Text);
            }
        }
Ejemplo n.º 9
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));
            }
        }
Ejemplo n.º 10
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));
            }
        }