//BTN Buscar + TextBox Buscar private void BuscarBTN_Click(object sender, EventArgs e) { DataInf.Text = "Loading..."; DataInf.ForeColor = Color.DarkGray; DataInf.Refresh(); this.Cursor = Cursors.WaitCursor; this.IdView = Buscar.Text; if (IdView == "") { this.IdView = "All"; } DataBlocksDGV_Act(); TargetShow_Act(); this.Cursor = Cursors.Default; DataInf.Text = "Data loaded"; DataInf.ForeColor = Color.Green; }
//Actualització de DGV DataBlocks private void DataBlocksDGV_Act() { DataInf.Text = "Loading..."; DataInf.ForeColor = Color.DarkGray; DataInf.Refresh(); DataView Filtrada = FiltrarCatSour(); if (IdView != "All") { Filtrada = FiltrarID(); } this.Cursor = Cursors.WaitCursor; DataBlocksAll.DataSource = Filtrada.ToTable(); DataBlocksAll.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; this.Cursor = Cursors.Default; DataInf.Text = "Data loaded"; DataInf.ForeColor = Color.Green; DataInf.Refresh(); }
private void TargetGroup() { //Creem targets i poblem datagrid targets PGB1.Value = 1; PGB1.Refresh(); DataInf.Text = "Grouping Targets..."; DataInf.Refresh(); List <DataBlock> Copia = DataBlockList.ToList(); PGB1.Maximum = Copia.Count(); //Bucle ADS-B bool adsb_fin = false; int i = 0; List <DataBlock> ADSB = Copia.Where(x => x.From == "ADS-B").ToList(); while ((Copia.Count != 0) && (adsb_fin == false) && (ADSB.Count != 0)) { DataBlock Evaluat = ADSB.First(); List <DataBlock> Filtrados = new List <DataBlock>(); if (Evaluat.T_ID != "-") { Filtrados = Copia.Where(x => x.T_ID == Evaluat.T_ID).ToList(); Copia.RemoveAll(x => x.T_ID == Evaluat.T_ID); ADSB.RemoveAll(x => x.T_ID == Evaluat.T_ID); } else { Filtrados = Copia.Where(x => x.T_Number == Evaluat.T_Number).ToList(); Copia.RemoveAll(x => x.T_Number == Evaluat.T_Number); ADSB.RemoveAll(x => x.T_Number == Evaluat.T_Number); } TargetList.Add(new Target(Filtrados)); PGB1.Step = Filtrados.Count(); PGB1.PerformStep(); TargetTable.Rows.Add(TargetList.Last().StringLin()); i++; if (ADSB.Count == 0) { adsb_fin = true; } } //Bucle SMR List <DataBlock> SMR = Copia.Where(x => x.From == "SMR").ToList(); bool smr = false; while ((smr == false) && (SMR.Count() != 0)) { DataBlock Evaluat = SMR.First(); List <DataBlock> Filtrados = SMR.Where(x => x.T_Number == Evaluat.T_Number).ToList(); TargetList.Add(new Target(Filtrados)); SMR.RemoveAll(x => x.T_Number == Evaluat.T_Number); PGB1.Step = Filtrados.Count(); PGB1.PerformStep(); TargetTable.Rows.Add(TargetList.Last().StringLin()); if (SMR.Count == 0) { smr = true; } } //Bucle Multi bool multi_fin = false; List <DataBlock> Multi = Copia.Where(x => x.From == "Multi.").ToList(); while ((multi_fin == false) && (Multi.Count() != 0)) { DataBlock Evaluat = Multi.First(); List <DataBlock> Filtrados = new List <DataBlock>(); if (Evaluat.T_ID != "-") { Filtrados = Multi.Where(x => x.T_ID == Evaluat.T_ID).ToList(); Multi.RemoveAll(x => x.T_ID == Evaluat.T_ID); } else { Filtrados = Multi.Where(x => x.T_Number == Evaluat.T_Number).ToList(); Multi.RemoveAll(x => x.T_Number == Evaluat.T_Number); } TargetList.Add(new Target(Filtrados)); PGB1.Step = Filtrados.Count(); PGB1.PerformStep(); TargetTable.Rows.Add(TargetList.Last().StringLin()); if (Multi.Count == 0) { multi_fin = true; } } TargetShow_Act(); }