示例#1
0
        /// <summary>
        /// Runs all selected style cops.
        /// </summary>
        private void btnRun_Click(object sender, EventArgs e)
        {
            InitRunContext();

            var selectedHandlerNames = dgvStyleCops.Rows
                                       .Cast <DataGridViewRow>()
                                       .Where(r => (bool)r.Cells[1].Value == true)
                                       .Select(r1 => r1.Cells[0].Value.ToString())
                                       .ToArray();

            StyleCopRunManager.ContextExecuted += (man, args) =>
            {
                this.Invoke((MethodInvoker)(() =>
                {
                    // Report Progress
                    pgbHandling.Value = (int)((float)(Contexts.Where(c => c.HasRun).Count()) / Contexts.Count * 100);
                    // Display the first log
                    if (Contexts.IndexOf(args) == 0)
                    {
                        DisplayRunLog();
                    }
                }));
            };
            StyleCopRunManager.Run(Contexts, selectedHandlerNames);
        }
示例#2
0
 public MainWindow()
 {
     InitializeComponent();
     Contexts           = new List <StyleCopContext>();
     LogLevel           = 7;
     StyleCopRunManager = new StyleCopRunManager();
     FileNames          = new List <string>();
 }
示例#3
0
        private void LoadAllStyleCops()
        {
            var cops = StyleCopRunManager.GetStyleCopInformation();

            cops.ForEach(h =>
            {
                dgvStyleCops.Rows.Add(new object[] { h.TypeName, true, h.Description });
            });
            dgvStyleCops.RowHeadersVisible = false;
        }
示例#4
0
 static void Main(string[] args)
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     Application.ThreadException += Application_ThreadException;
     if (args == null || args.Length == 0)
     {
         Application.Run(new MainWindow());
     }
     else
     {
         if (args.Length < 2)
         {
             throw new ArgumentException("Incorrect arguments.");
         }
         var copNames   = args.Skip(2).Select(a => a.ToString()).ToArray();
         var runManager = new StyleCopRunManager();
         runManager.Run(args[0].ToString(), args[1].ToString(), copNames);
     }
 }