public static DataTable GetTableByStragList(List <StragClass> Strags) { DataTable dt = new DataTable(); string strcols = "策略ID,策略描述,按车号视图,策略参数,策略名称,策略类名"; string[] cols = strcols.Split(','); for (int i = 0; i < cols.Length; i++) { dt.Columns.Add(cols[i]); } for (int i = 0; i < Strags.Count; i++) { StragClass jcls = Strags[i]; DataRow dr = dt.NewRow(); dr[0] = jcls.GUID; dr[1] = jcls.StragScript; dr[2] = jcls.BySer; dr[3] = jcls.StagSetting.ToString(); dr[4] = jcls.StragClassName; dr[5] = jcls.StragTypeName; dt.Rows.Add(dr); } return(dt); }
public static StragClass getStragByName(string className) { Assembly asmb = typeof(StragClass).Assembly;// Assembly.LoadFrom("EnterpriseServerBase.dll"); Type sct = asmb.GetType(className); StragClass sc = Activator.CreateInstance(sct) as StragClass; return(sc); }
public StragPicker(List <StragClass> strags) { InitializeComponent(); AllList = strags.ToDictionary(t => t.GUID, t => t); DataTable dt = StragClass.GetTableByStragList(strags); this.dataGridView1.DataSource = dt; this.dataGridView1.Refresh(); }
private void dataGridView1_DoubleClick(object sender, EventArgs e) { if (this.dataGridView1.CurrentRow.Index < 0) { return; } string guid = this.dataGridView1.CurrentRow.Cells[0].Value.ToString(); if (!AllList.ContainsKey(guid)) { return; } this._SelectStrag = AllList[guid]; this.Visible = false; }
public StragChance(StragClass _Strag, ChanceClass _Chance) { Strag = _Strag; Chance = _Chance; }