public CreateCustom(Report.Feature[] features, List <CustomFeature> customFeatures, CustomFeature feature = null) { InitializeComponent(); panelColor.Click += PanelColor_Click; dataGridView.CellMouseUp += DataGridView_CellMouseUp; if (feature != null) { CustomFeature = feature; Text = Text.Replace("Create", "Edit"); btnHide.Enabled = true; } Features = features; ExistingCustomFeatures = customFeatures; ((DataGridViewComboBoxColumn)dataGridView.Columns[0]).DataSource = Features.Select(x => x.Name).Distinct().ToList(); txtName.Text = CustomFeature.Name; panelColor.BackColor = CustomFeature.Color; numSize.Value = CustomFeature.Size; SetLogic(); comboBoxType.SelectedIndex = (int)CustomFeature.Type; numOffsetX.Value = (decimal)CustomFeature.Offset.X; numOffsetY.Value = (decimal)CustomFeature.Offset.Y; foreach ((string, Report.State)filter in CustomFeature.Filters) { dataGridView.Rows.Add(new object[] { filter.Item1, filter.Item2 == Report.State.Pass ? "Pass" : "Fail" }); } CustomFeature.Checked = true; }
private void SetPlottables(ref int size, ref Plottable[] ps, PlotOrderElement element, List <Plottable> nullPlottables) { switch (element.Name) { case "Pass": ps = Plottables.Where(x => string.IsNullOrEmpty(x.CustomTag) && x.Pass && !nullPlottables.Select(y => (y.X, y.Y)).Contains((x.X, x.Y))).ToArray(); if (DataReduction > 0) { ps = ps.Where((x, i) => i % DataReduction == 0).ToArray(); } size = PassPointSize; break; case "Fail": ps = Plottables.Where(x => string.IsNullOrEmpty(x.CustomTag) && !x.Pass && !nullPlottables.Select(y => (y.X, y.Y)).Contains((x.X, x.Y))).ToArray(); if (DataReduction > 0) { ps = ps.Where((x, i) => i % DataReduction == 0).ToArray(); } size = FailPointSize; break; default: CustomFeature customFeature = CustomFeatures.Where(x => x.Name == element.Name).First(); ps = Plottables.Where(x => x.CustomTag == customFeature.Name). Select(x => { x.Color = customFeature.Color; return(x); }).ToArray(); if (customFeature.Type == XferHelper.Report.State.Null) { nullPlottables.AddRange(ps); } else { ps = ps.Where(x => !nullPlottables.Select(y => (y.X, y.Y)).Contains((x.X, x.Y))).ToArray(); size = customFeature.Size; } break; } }