public UCAdapterSetting(SharpAcquirerFactory adpts) { this.InitializeComponent(); this.AdaptsFactory = adpts; //this.comboBox1.DataSource = adpts.Acqs.Values.Select<IFileAcquirer>(o => new { o.Name, o.CnName }).ToList(); this.comboBox1.DataSource = adpts.Acqs.Values.Select(o => new { o.Name, o.CnName }).ToList(); this.comboBox1.DisplayMember = "CnName"; this.comboBox1.ValueMember = "Name"; string configParamValue = AppContext.GetInstance().Config.GetConfigParamValue("AdapterSetting", "DefaultAdapter"); bool flag = !string.IsNullOrEmpty(configParamValue); if (flag) { this.comboBox1.SelectedValue = configParamValue; } bool flag2 = this.comboBox1.SelectedValue == null; if (flag2) { this.comboBox1.SelectedIndex = 0; } this.comboBox1.SelectedValueChanged += new EventHandler(this.comboBox1_SelectedValueChanged); this.comboBox1.Refresh(); this.comboBox1_SelectedValueChanged(this, EventArgs.Empty); }
public static void ShowSetting(SharpAcquirerFactory aptf) { FormContainer formContainer = new FormContainer(); UCAdapterSetting control = new UCAdapterSetting(aptf); formContainer.SetControl(control); formContainer.TopLevel = true; formContainer.SetKeyEscCloseForm(true); formContainer.ShowDialog(); }