private GeneralSettings ToGeneralSettings() { var generalSettings = new GeneralSettings { CountOfCallsFrequency = int.Parse( numericUpDownCountOfCallsFrequency.Value.ToString( CultureInfo.InvariantCulture)), DefineFrequency = checkBoxDefineFrequency.Checked, DefineMaxCallsCount = checkBoxDefineMaxCallsCount.Checked, LocalIp = textBoxLocalIP.Text.Trim(), LocalPort = (int)numericUpDownLocalPort.Value, LocalTerminal = textBoxLocalTerminal.Text.Trim(), MaxCallCount = int.Parse( numericUpDownMaxCallCount.Value.ToString(CultureInfo.InvariantCulture)), RemoteIp = textBoxRemoteIp.Text.Trim(), RemotePort = (int)numericUpDownRemotePort.Value, RemoteTerminal = textBoxRemoteTerminal.Text.Trim(), TimeOfCallFrequency = int.Parse( numericUpDownTimeOfCallFrequency.Value.ToString( CultureInfo.InvariantCulture)), Transport = comboBoxTransport.Text }; return generalSettings; }
private void ToolStripMenuItemOpenOwnFormatClick(object sender, EventArgs e) { var dialogResult = openFileDialogFromOwnFileFormat.ShowDialog(this); if (dialogResult == DialogResult.OK) { var generalSettings = new GeneralSettings(); var fileName = openFileDialogFromOwnFileFormat.FileName; Logic.IO.FileSystem.Load(generalSettings, _actions, fileName); comboBoxTransport.Text = generalSettings.Transport; checkBoxDefineMaxCallsCount.Checked = generalSettings.DefineMaxCallsCount; numericUpDownMaxCallCount.Value = generalSettings.MaxCallCount; checkBoxDefineFrequency.Checked = generalSettings.DefineFrequency; numericUpDownCountOfCallsFrequency.Value = generalSettings.CountOfCallsFrequency; numericUpDownTimeOfCallFrequency.Value = generalSettings.TimeOfCallFrequency; textBoxLocalIP.Text = generalSettings.LocalIp; numericUpDownLocalPort.Value = generalSettings.LocalPort; textBoxLocalTerminal.Text = generalSettings.LocalTerminal; textBoxRemoteIp.Text = generalSettings.RemoteIp; numericUpDownRemotePort.Value = generalSettings.RemotePort; textBoxRemoteTerminal.Text = generalSettings.RemoteTerminal; _isSavedToFile = true; _savedFileName = openFileDialogFromOwnFileFormat.FileName; SetWindowText(openFileDialogFromOwnFileFormat.FileName); } }