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(); } }
void Loader_ProgressChanged(object sender, System.ComponentModel.ProgressChangedEventArgs e) { string[] Data = e.UserState.ToString().Split(new char[] { '|' }); LoadDialog.SetInfo(Data[0], Data[1]); LoadDialog.Refresh(); }