public void AddEansAsync(List <Managers.Producte> prod, EanAddProcessTick ean_add_tick, EanAddFinished ean_add_finished, bool succes_message = true) { if (!adding_eans) { if (on_ean_add_tick != null) { foreach (Delegate d in on_ean_add_tick.GetInvocationList()) { on_ean_add_tick -= (EanAddProcessTick)d; } } if (on_ean_add_finished != null) { foreach (Delegate d in on_ean_add_finished.GetInvocationList()) { on_ean_add_finished -= (EanAddFinished)d; } } on_ean_add_tick += ean_add_tick; on_ean_add_finished += ean_add_finished; curr_ean = 0; curr_prod_ean = 0; eans_to_add = prod; ean_succes_msg = succes_message; add_eans_timer = new System.Windows.Forms.Timer(); add_eans_timer.Tick += new EventHandler(AddEansAsyncTimeStep); add_eans_timer.Interval = 5; // in miliseconds add_eans_timer.Start(); adding_eans = true; } }
private void ProductEanAddFinished() { if (product_succes_msg) { string message = "Introducció de Productes finalitzada amb èxit"; MessageBoxResult messageBoxResult = System.Windows.MessageBox.Show(string.Format(message), "Èxit", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Information); on_product_ean_add_finished -= ProductEanAddFinished; } }