public static void Switch(ShopEnum shop) { foreach (ShopProfile sp in Shops) { if (sp.Shop == shop) { _current = sp; break; } } }
private void cboShops_SelectedIndexChanged(object sender, EventArgs e) { ShopProfile sp = (ShopProfile)cboShops.SelectedItem; User u = User.GetUser(Settings.Operator); if (null == u) { rdoWw.Text = "<Failed to get operator>"; rdoWw.ForeColor = Color.Red; return; } string ww = u.GetWW(cboShops.SelectedIndex); if (!string.IsNullOrEmpty(ww)) { sp.SubAccount = ww; } ; sp.Pw = u.GetWWPW(cboShops.SelectedIndex); rdoWw.Text = sp.Account + (string.IsNullOrEmpty(ww) ? string.Empty : ":" + sp.SubAccount); rdoWw.ForeColor = Color.FromArgb(0xff, 0x80, 0x80, 0x80); }
private void btnOK_Click(object sender, EventArgs e) { ShopProfile.Switch(((ShopProfile)cboShops.SelectedItem).Shop); this.DialogResult = DialogResult.OK; this.Close(); }