예제 #1
0
        // Save config to xml
        private bool SaveConfig()
        {
            bool result = false;
            result = Double.TryParse(txtOffsetY.Text, out _offsetY);
            result &= Double.TryParse(txtOffsetX.Text, out _offsetX);
            result &= Double.TryParse(txtRate.Text, out _rate);
            if (result)
            {
                ConfigHelper ch = new ConfigHelper();
                ch.SaveRelativeData(dgvRelativeSettings);
                ch.SaveOffsetY(_offsetY.ToString());
                ch.SaveOffsetX(_offsetX.ToString());
                ch.SaveRate(_rate.ToString());
                ch.SaveSourceIP(txtSourceIP.Text);
                ch.SaveSourcePort(txtSourcePort.Text);
                ch.SaveDestIP(txtDestIP.Text);
                ch.SaveDestPort(txtDestPort.Text);

                return true;
            }
            return false;
        }
예제 #2
0
 // Load config from xml
 private void LoadConfig()
 {
     ConfigHelper ch = new ConfigHelper();
     //_dtbRelativeData = ch.GetRelativeData();
     dgvRelativeSettings.Rows.Clear();
     ch.GetRelativeData(dgvRelativeSettings);
     _dtbRelativeData = getRelativeGridViewToDictionary(dgvRelativeSettings);
     _offsetY = ch.GetOffsetY();
     _offsetX = ch.GetOffsetX();
     _defaultOffsetY = ch.GetDefaultOffsetY();
     _rate = ch.GetRate();
     // Update UI
     txtOffsetY.Text = _offsetY.ToString();
     txtOffsetX.Text = _offsetX.ToString();
     txtRate.Text = _rate.ToString();
     txtSourceIP.Text = ch.GetSourceIP();
     txtSourcePort.Text = ch.GetSourcePort();
     txtDestIP.Text = ch.GetDestIP();
     txtDestPort.Text = ch.GetDestPort();
 }