示例#1
0
        public void CreateFormsGrid()
        {
            // Remove excessive underlines from Form and Test links.
            ((DataGridViewLinkColumn)MainWindow.FormsGrid.Columns[0]).LinkBehavior = LinkBehavior.NeverUnderline;
            ((DataGridViewLinkColumn)MainWindow.FormsGrid.Columns[1]).LinkBehavior = LinkBehavior.NeverUnderline;

            var skylinePath      = Path.Combine(MainWindow.ExeDir, "Skyline.exe");
            var skylineDailyPath = Path.Combine(MainWindow.ExeDir, "Skyline-daily.exe");

            skylinePath = File.Exists(skylinePath) ? skylinePath : skylineDailyPath;
            var assembly   = Assembly.LoadFrom(skylinePath);
            var types      = assembly.GetTypes();
            var formLookup = new FormLookup();

            foreach (var type in types)
            {
                if (IsForm(type) && !HasSubclasses(types, type))
                {
                    var typeName = SkylineTesterWindow.Implements(type, "IFormView") && type.DeclaringType != null
                        ? type.DeclaringType.Name + "." + type.Name
                        : type.Name;
                    var test = formLookup.GetTest(typeName);
                    if (test == "*")
                    {
                        continue;
                    }
                    MainWindow.FormsGrid.Rows.Add(typeName, test, 0);
                }
            }

            MainWindow.FormsGrid.Sort(MainWindow.FormsGrid.Columns[0], ListSortDirection.Ascending);
            MainWindow.FormsGrid.ClearSelection();
            MainWindow.FormsGrid.Rows[0].Selected = true;
            UpdateForms();
        }
示例#2
0
 private static bool IsForm(Type type)
 {
     if (type.IsAbstract)
     {
         return(false);
     }
     if (type.IsSubclassOf(typeof(Form)))
     {
         return(!SkylineTesterWindow.Implements(type, "IMultipleViewProvider"));
     }
     return(SkylineTesterWindow.Implements(type, "IFormView"));
 }