//nunca se puede acceder a elementos de la interfaz directamente desde este metodo, acceder a la interfaz desde otro thread //bloquea la aplicacion private void BackGround_Work(object sender, DoWorkEventArgs e) { #if DEBUG int porc = 0; var totalTimer = new Stopwatch(); totalTimer.Start(); var timer = new Stopwatch(); timer.Start(); #endif bgwBlnOffArgument args = (bgwBlnOffArgument)e.Argument; bgwBlnOffResult results = new bgwBlnOffResult(); if (args.BLnOffEnabled) { //Se crean objetos que contienen las tablas de datos que se necesitan en esta herramienta Colindancias colindancias = new Colindancias(); RSLTE31 R31 = new RSLTE31(args.lnBtsInputs, args.pathR31); R31.completeR31(args.pathSRAN, args.pathFL18, args.pathSRAN2, args.srandividio, args.conFL18); #if DEBUG timer.Stop(); Console.WriteLine("Completar consulta31: " + timer.Elapsed.ToString(@"m\:ss\.fff")); timer.Reset(); timer.Start(); #endif TimingAdvance TA = new TimingAdvance(args.lnBtsInputs, args.pathTA); #if DEBUG timer.Stop(); Console.WriteLine("Sacar Timing Advance: " + timer.Elapsed.ToString(@"m\:ss\.fff")); timer.Reset(); timer.Start(); #endif Exports export = new Exports(TA.GetColumn("LNCEL name"), args.pathSRAN, args.pathFL18, args.pathSRAN2, args.srandividio, args.conFL18); #if DEBUG timer.Stop(); Console.WriteLine("Sacar Exports: " + timer.Elapsed.ToString(@"m\:ss\.fff")); timer.Reset(); timer.Start(); porc = 5; worker.ReportProgress(porc); #endif foreach (DataRow dataRow in export.data.Rows) { colindancias.CheckColin(dataRow, R31); } int a = 0; foreach (DataRow dataRow in R31.NotInExports()) { colindancias.CheckColinsNotInExports(dataRow); } colindancias.AddENBID(); if (args.rellenarLabel) { colindancias.rellenarLabelUnknown(args.pathSRAN, args.pathSRAN2, args.srandividio); } porc = 15; worker.ReportProgress(porc); //Dibujar tablas DataView dv = colindancias.data.DefaultView; dv.Sort = "[HO errores SR] DESC"; colindancias.data = dv.ToTable(); results.colindancias = colindancias.data; results.siteCoordErrors = colindancias.GetSiteCoordErr(); porc = 25; #if DEBUG timer.Stop(); Console.WriteLine("Calcular Colindancias: " + timer.Elapsed.ToString(@"m\:ss\.fff")); timer.Reset(); timer.Start(); #endif //Se calculan las candidatas para BlackListing y para Offset, que quedaran disponibles para la edicion manual del usuario en la interfaz grafica CandidatesBL candBL = new CandidatesBL(colindancias); dv = candBL.data.DefaultView; dv.Sort = "[HO errores SR] DESC"; candBL.data = dv.ToTable(); results.candBl = candBL.data; porc = 50; #if DEBUG timer.Stop(); Console.WriteLine("Calcular candidatas de blacklisting: " + timer.Elapsed.ToString(@"m\:ss\.fff")); timer.Reset(); timer.Start(); #endif CandidatesOFF candOFF = new CandidatesOFF(TA, colindancias, candBL); dv = candOFF.data.DefaultView; dv.Sort = "[HO errores SR] DESC"; candOFF.data = dv.ToTable(); results.candOff = candOFF.data; porc = 75; worker.ReportProgress(porc); #if DEBUG timer.Stop(); Console.WriteLine("Calcular candidatas de offset: " + timer.Elapsed.ToString(@"m\:ss\.fff")); timer.Reset(); timer.Start(); #endif } if (args.prevAnalisysEnabled) { NIR48H nir = new NIR48H(args.lnBtsInputs, args.pathNIR48); results.error = nir.errors; results.nirPlotData = nir.data; #if DEBUG timer.Stop(); Console.WriteLine("Analisis Previo: " + timer.Elapsed.ToString(@"m\:ss\.fff")); #endif } e.Result = results; porc = 100; worker.ReportProgress(porc); #if DEBUG timer.Stop(); totalTimer.Stop(); Console.WriteLine("Tiempo Total: " + totalTimer.Elapsed.ToString(@"m\:ss\.fff")); #endif }
private void Launch(object sender, RoutedEventArgs e) { //Ocultamos las demas pestañas tabColindancias.Visibility = Visibility.Collapsed; tabCandidatasBL.Visibility = Visibility.Collapsed; tabCandidatasOFF.Visibility = Visibility.Collapsed; tabErrores.Visibility = Visibility.Collapsed; plotNodo.Visibility = Visibility.Collapsed; plotceldas.Visibility = Visibility.Collapsed; //Empieza a girar el cursor Cursor = Cursors.Wait; // Progress_Bar.Value = Progress_Bar.Minimum; String[] aux = new String[lnBtsInputGrid.Count]; int n = 0; for (int i = 0; i < lnBtsInputGrid.Count; i++) { if (lnBtsInputGrid[i].LnBtsName != "") { aux[i] = lnBtsInputGrid[i].LnBtsName; n++; } } string[] lnBtsInputs = new string[n]; for (int i = 0; i < n; i++) { lnBtsInputs[i] = aux[i]; } aux = null; if (lnBtsInputs.Length == 0) { WPFForms.ShowError("No hay nodos de entrada", "Rellena la tabla de INPUT SITES"); return; } //se preparan los inputs para pasarlos como argumento al background worker bgwBlnOffArgument args = new bgwBlnOffArgument(); args.lnBtsInputs = lnBtsInputs; args.pathR31 = RSLTE31_path.Text; args.pathTA = TA_path.Text; args.pathSRAN = SRAN_path.Text; args.pathFL18 = FL18_path.Text; args.pathNIR48 = NIR_path.Text; args.BLnOffEnabled = (bool)Is_BlnOFF_Enabled.IsChecked; args.prevAnalisysEnabled = (bool)Is_PrevAnalysis_Enabled.IsChecked; args.pathSRAN2 = SRAN2_path.Text; if (estaSranDividido.IsChecked == true) { args.srandividio = true; } else { args.srandividio = false; } if (conFL18.IsChecked == true) { args.conFL18 = true; } else { args.conFL18 = false; } if (cbRellenarLabels.IsChecked == true) { args.rellenarLabel = true; } else { args.rellenarLabel = false; } worker.WorkerReportsProgress = true; worker.DoWork += BackGround_Work; worker.ProgressChanged += BackGround_Progress; worker.RunWorkerCompleted += BackGround_Completed; worker.RunWorkerAsync(args); //Task<ProgressDialogController> progressBar = WPFForms.ShowProgress("Ejecutando BlackListing y Offset","Procesando consulta 31"); //Guardar el path de los ultimos archivos en un fichero de texto string[] storePaths = new string[6] { RSLTE31_path.Text, TA_path.Text, SRAN_path.Text, FL18_path.Text, NIR_path.Text, SRAN2_path.Text }; System.IO.File.WriteAllLines(Path.Combine(Environment.CurrentDirectory, @"BlnOFF\Data\", "RememberPaths.txt"), storePaths); }