void ReportTask(SchdType type) { var current_type = (from x in type_fields where x.Name == type.ToString() select x).Single(); action(string.Format("选择调度算法 = {0} | {1}", (Attribute.GetCustomAttribute(current_type, typeof(DescriptionAttribute)) as DescriptionAttribute).Description, current_type.Name)); StringBuilder sb = new StringBuilder(); sb.Append('-', 50); var split = sb.ToString(); action(split); tasks.ToList().ForEach(a => { sb.Clear(); task_fields.ToList().ForEach(b => { sb.AppendFormat("{0} = {1} ", b.ConvertTo <DescriptionAttribute>().Description, b.GetValue(a, null).ToString().PadRight(3)); }); action(sb.ToString()); }); action(split); }
public Bitmap GetSchdBitmap(SchdType type, Action <string> action) { this.action = action; tasks = ConvertTableToTask(); if (tasks.Count() == 0) { throw new Exception("任务为空!"); } ReportTask(type); var schd = SchdFactory.CreateSchdInstance(type); schd.ImportData(tasks); schd.SetCallback(action); var result = schd.Simulate(); var visual = ConvertResultToVisual(result); ReportStat(visual); var bitmap = DrawSchd(visual); return(bitmap); }
public static IProcessSchd CreateSchdInstance(SchdType type) { return Assembly.GetExecutingAssembly().CreateInstance("SimuProcessSchd.Schd" + type.ToString()) as IProcessSchd; }
static public IProcessSchd CreateSchdInstance(SchdType type) { return(Assembly.GetExecutingAssembly().CreateInstance("SimuProcessSchd.Schd" + type.ToString()) as IProcessSchd); }