/// <summary> /// 检测端口 /// </summary> /// /// <returns></returns> public bool CheckPortisAvailable() { lblAuthTips.Text = resourceManager.GetString("Check_Database_Service", cultureInfo); bool connFlag = false; connFlag = MySqlHelpers.ConnectionTest(MySqlHelpers.ConnectionString); if (connFlag) { ConfigsBLL bll = new ConfigsBLL(); Configs configs = bll.GetAllData(); if (configs != null) { if (configs.Lang == 1) { cultureInfo = CultureInfo.CreateSpecificCulture("zh-cn"); } else if (configs.Lang == 2) { cultureInfo = CultureInfo.CreateSpecificCulture("en-us"); } } } Title = resourceManager.GetString("Authentication", cultureInfo); lblAuthTips.Text = resourceManager.GetString("Authenticating", cultureInfo); btnRetry.Content = resourceManager.GetString("Retry", cultureInfo); return(connFlag); }
/// <summary> /// 初始化配置数据 /// </summary> private void bandInitData() { ConfigsBLL bll = new ConfigsBLL(); Configs configs = bll.GetAllData(); if (configs != null) { text_groupnums.Text = configs.Groupnums.ToString(); text_rownums.Text = configs.Rownums.ToString(); if (configs.Lang == 2) { rad_langenglish.Checked = true; ConfigVals.Lang = 2; } else { rad_langchina.Checked = true; ConfigVals.Lang = 1; } } else { text_groupnums.Text = "12"; text_rownums.Text = "6"; rad_langchina.Checked = true; ConfigVals.Lang = 1; } //初始化数据 ConfigVals.GroupNums = Int32.Parse(text_groupnums.Text); ConfigVals.RowNums = Int32.Parse(text_rownums.Text); VmManager.Instance.Initialize(ConfigVals.MaxNums, ConfigVals.GroupNums); }
public void SetupCultureInfo() { ConfigsBLL bll = new ConfigsBLL(); Configs configs = bll.GetAllData(); if (configs.Lang == 1) { CultureInfo = CultureInfo.CreateSpecificCulture("zh-cn"); } else if (configs.Lang == 2) { CultureInfo = CultureInfo.CreateSpecificCulture("en-us"); } }
/// <summary> /// 初始化配置数据 /// </summary> private void bandInitData() { resourceManager = new ResourceManager("Wx.Qunkong360.Wpf.Languages.Res", typeof(StartUpView).Assembly); ConfigsBLL bll = new ConfigsBLL(); Configs configs = bll.GetAllData(); if (configs != null) { var groupCapacityItem = cbGroupCapacity.Items.Cast <ComboBoxItem>().FirstOrDefault(item => item.Content.ToString() == configs.Groupnums.ToString()); int groupCapacityIndex = cbGroupCapacity.Items.IndexOf(groupCapacityItem); cbGroupCapacity.SelectedIndex = groupCapacityIndex; var rowCapacityItem = cbRowCapacity.Items.Cast <ComboBoxItem>().FirstOrDefault(item => item.Content.ToString() == configs.Rownums.ToString()); int rowCapacityIndex = cbRowCapacity.Items.IndexOf(rowCapacityItem); cbRowCapacity.SelectedIndex = rowCapacityIndex; if (configs.Lang == 2) { rbEnglish.IsChecked = true; ConfigVals.Lang = 2; } else { rbChinese.IsChecked = true; ConfigVals.Lang = 1; } } else { cbGroupCapacity.SelectedIndex = 0; cbRowCapacity.SelectedIndex = 0; rbChinese.IsChecked = true; ConfigVals.Lang = 1; } //初始化数据 ConfigVals.GroupNums = Int32.Parse(cbGroupCapacity.SelectionBoxItem.ToString()); ConfigVals.RowNums = Int32.Parse(cbRowCapacity.SelectionBoxItem.ToString()); VmManager.Instance.Initialize(ConfigVals.MaxNums, ConfigVals.GroupNums); }
private void btnSavePaameters_Click(object sender, System.Windows.RoutedEventArgs e) { int groupCapacity = int.Parse(cbGroupCapacity.SelectionBoxItem.ToString()); int rowCapacity = int.Parse(cbRowCapacity.SelectionBoxItem.ToString()); VmManager.Instance.Initialize(ConfigVals.MaxNums, groupCapacity); ConfigsBLL bll = new ConfigsBLL(); int lang = (rbEnglish.IsChecked == true) ? 2 : 1; int flag = bll.SaveConfigs(lang, groupCapacity, rowCapacity); if (flag > 0) { ConfigVals.Lang = lang; ConfigVals.GroupNums = groupCapacity; ConfigVals.RowNums = rowCapacity; MessageBox.Show(resourceManager.GetString("Save_Success", cultureInfo)); } }
//保存配置参数 private void btn_saveparameter_Click(object sender, EventArgs e) { int groupCapacity = int.Parse(text_groupnums.Text.Trim()); int rowCapacity = int.Parse(text_rownums.Text.Trim()); VmManager.Instance.Initialize(ConfigVals.MaxNums, groupCapacity); ConfigsBLL bll = new ConfigsBLL(); int lang = (rad_langenglish.Checked == true) ? 2 : 1; int flag = bll.SaveConfigs(lang, groupCapacity, rowCapacity); if (flag > 0) { ConfigVals.Lang = lang; ConfigVals.GroupNums = groupCapacity; ConfigVals.RowNums = rowCapacity; MessageBox.Show(resourceManager.GetString("Save_Success", cultureInfo)); } }