void Loader_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e) { if (ISenseRect != null) { ISenseRect.Close(); ISenseRect.Dispose(); } if (LoadDialog != null) { LoadDialog.Dispose(); LoadDialog = null; } LoadTime = DateTime.Now; if (OnEndedLoad != null) { OnEndedLoad(); } }
public void Initialize() { if (LoadTime == new DateTime(1900, 1, 1)) { try { Conx.Open(); Conx.Close(); } catch (Exception) { if (Conx.State == ConnectionState.Open) { Conx.Close(); } MessageBox.Show("Fallo Conexion a la Base de Datos", "Base de Datos", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } BD = Conx.Database; Loader = new BackgroundWorker(); Loader.WorkerReportsProgress = true; Loader.WorkerSupportsCancellation = true; Loader.ProgressChanged += Loader_ProgressChanged; Loader.RunWorkerCompleted += Loader_RunWorkerCompleted; Loader.DoWork += Loader_DoWork; //Inicio de Carga ISenseRect = new PopupControl.Popup(LoadDialog = new LoadingInfo()); ISenseRect.AutoClose = false; ISenseRect.FocusOnOpen = false; ISenseRect.Opacity = 0.65; ISenseRect.ShowingAnimation = PopupControl.PopupAnimations.TopToBottom | PopupControl.PopupAnimations.Slide; ISenseRect.HidingAnimation = PopupControl.PopupAnimations.Blend; ISenseRect.AnimationDuration = 100; LoadDialog.SetInfo(BD, "Abriendo Conexion a BD"); ISenseRect.Show(new System.Drawing.Point(200, 200)); Loader.RunWorkerAsync(); } }