private void SettingsForm_Load(object sender, EventArgs e) { try { txtServerTask.Text = _serverTaskDefault; txtBaseTask.Text = _baseTaskDefault; txtUserTask.Text = _userTaskDefault; txtPasswordTask.Text = _passwordTaskDefault; txtUser1C.Text = _user1CDefault; txtPass1C.Text = _pass1CDefault; tbSelfUpdateFtpServer.Text = _selfUpdateFtpServerDefault; tbSelfUpdateFtpUser.Text = _selfUpdateFtpUserDefault; tbSelfUpdateFtpPassword.Text = _selfUpdateFtpPasswordDefault; var loadFromJsonResult = MainSettings.LoadFromJson(); if (!loadFromJsonResult.IsComplete) { return; } txtServerTask.Text = MainSettings.JsonSettings.ServerTask; txtBaseTask.Text = MainSettings.JsonSettings.BaseTask; txtUserTask.Text = MainSettings.JsonSettings.UserTask; txtPasswordTask.Text = MainSettings.JsonSettings.PasswordTask; } catch (Exception ex) { ConnectionToService?.DisposeAsyncClient(); MessageBox.Show(ex.Message.ToString(), "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); NLogger.LogDebugToHdd(ex.Message.ToString()); Application.Exit(); } }
private void SettingsForm_Load(object sender, EventArgs e) { try { var loadFromJsonResult = MainSettings.LoadFromJson(); if (!loadFromJsonResult.IsComplete) { //NLogger.LogErrorToHdd(res.Message, MainSettings.Constants.MAGIC_UPDATER_SETTINGS); //MessageBox.Show(res.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } //JsonSettings txtServerTask.Text = MainSettings.JsonSettings.ServerTask; txtBaseTask.Text = MainSettings.JsonSettings.BaseTask; txtUserTask.Text = MainSettings.JsonSettings.UserTask; txtPasswordTask.Text = MainSettings.JsonSettings.PasswordTask; var loadSettingsResult = MainSettings.LoadSettings(); if (!loadSettingsResult.IsComplete) { return; } cbShopID.DisplayMember = "ShopId"; cbShopID.ValueMember = "ShopId"; cbShopID.DataSource = SqlWorks.ExecProc("SelectShopsList").Tables[0]; //SqlSettings cbShopID.Text = MainSettings.MainSqlSettings.ShopID; txtServer1C.Text = MainSettings.LocalSqlSettings.Server1C; txtBase1C.Text = MainSettings.LocalSqlSettings.Base1C; txtUser1C.Text = MainSettings.LocalSqlSettings.User1C; txtPass1C.Text = MainSettings.LocalSqlSettings.Pass1C; txtVersion1C.Text = MainSettings.LocalSqlSettings.Version1C; txtTimeOut.Text = MainSettings.LocalSqlSettings.OperationsListCheckTimeout.ToString(); txtSelfUpdatePath.Text = MainSettings.LocalSqlSettings.SelfUpdatePath; cbIsMainCashbox.Checked = MainSettings.MainSqlSettings.IsMainCashbox; cbIsServerLocated.Checked = MainSettings.MainSqlSettings.Is1CServer; cbIsCheck1C.Checked = MainSettings.LocalSqlSettings.IsCheck1C; } catch (Exception ex) { ConnectionToService?.DisposeAsyncClient(); MessageBox.Show(ex.Message.ToString(), "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); NLogger.LogErrorToHdd(ex.Message.ToString(), MainSettings.Constants.MAGIC_UPDATER_SETTINGS); Application.Exit(); } }