public static SortedBlocksFrm CreateInstance(List <SortedBlocksParas> list) { if (frm == null || frm.IsDisposed) { frm = new SortedBlocksFrm(list); } return(frm); }
public static SortedBlocksFrm CreateInstance(double[] scores, string[] names) { if (frm == null || frm.IsDisposed) { frm = new SortedBlocksFrm(scores, names); } return(frm); }
public static SortedBlocksFrm CreateInstance() { if (frm == null || frm.IsDisposed) { frm = new SortedBlocksFrm(); } return(frm); }
/// <summary> /// 对计算结果进行排序 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_Sort_Click(object sender, EventArgs e) { double[] arr_Scores = null; string[] arr_TgtName = null; //SortedBlocksFrm sBf = new SortedBlocksFrm(); int counterFlag = 0; //***********************************************************// PublicValues.GeoParas = ""; PublicValues.EngParas = ""; PublicValues.EcoParas = ""; PublicValues.ArrGeoParas = new string[lstBx_Selected_GeoPara.Items.Count]; //***********************************************************// foreach (string str in lstBx_Selected_GeoPara.Items) { PublicValues.ArrGeoParas[counterFlag] = str; counterFlag++; if (counterFlag != lstBx_Selected_GeoPara.Items.Count) { PublicValues.GeoParas += str + ","; } else { PublicValues.GeoParas += str + ";"; } } //将所有参数对应的权重值赋值给对应的参数,并形成一个字典变量,以供后面绘图时调用 //此目的是为了绘制柱状图时,所用参数对应 相应的权重值 PublicValues.DicGeoP_W = new Dictionary <string, double>(); PublicValues.DicEngP_W = new Dictionary <string, double>(); PublicValues.DicEcoP_W = new Dictionary <string, double>(); for (int i = 0; i < geoParasAll.Length; i++) { PublicValues.DicGeoP_W.Add(geoParasAll[i], (double)PublicValues.ArrGeoWgt[i]); if (i < engParasAll.Length) { PublicValues.DicEngP_W.Add(engParasAll[i], (double)PublicValues.ArrEngWgt[i]); } if (i < ecoParasAll.Length) { PublicValues.DicEcoP_W.Add(ecoParasAll[i], (double)PublicValues.ArrEcoWgt[i]); } } counterFlag = 0; PublicValues.ArrEngParas = new string[lstBx_Selected_EngPara.Items.Count]; foreach (string str in lstBx_Selected_EngPara.Items) { PublicValues.ArrEngParas[counterFlag] = str; counterFlag++; if (counterFlag != lstBx_Selected_EngPara.Items.Count) { PublicValues.EngParas += str + ","; } else { PublicValues.EngParas += str + ";"; } } counterFlag = 0; PublicValues.ArrEcoParas = new string[lstBx_Selected_EcoPara.Items.Count]; foreach (string str in lstBx_Selected_EcoPara.Items) { PublicValues.ArrEcoParas[counterFlag] = str; counterFlag++; if (counterFlag != lstBx_Selected_EcoPara.Items.Count) { PublicValues.EcoParas += str + ","; } else { PublicValues.EcoParas += str + ";"; } } //***********************************************************// if (chkFlag) { List <SortedBlocksParas> lst_SBP = BlockGrade(lst_Blk); int counter = lst_SBP.Count; arr_Scores = new double[counter]; arr_TgtName = new string[counter]; lst_SBP.Sort((x, y) => x.para_TotalScores.CompareTo(y.para_TotalScores)); foreach (SortedBlocksParas sBp in lst_SBP) { sBp.para_Rank = counter; counter--; } lst_SBP.Sort((x, y) => x.para_Rank.CompareTo(y.para_Rank)); arr_Scores = lst_SBP.Select(x => x.para_TotalScores).ToArray(); arr_TgtName = lst_SBP.Select(x => x.para_Tgt).ToArray(); SortedBlocksFrm sbf = SortedBlocksFrm.CreateInstance(arr_Scores, arr_TgtName); sbf.dgv_Blk_Sorted.DataSource = DataSourceToDataTable.GetListToDataTable(lst_SBP); sbf.Show(); //btn_GenerateReport.Enabled = true; } else { MessageBox.Show("尚未进行参数矩阵的检验计算操作,所有参数的权重值为 0 .", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information); } }