Exemple #1
0
        internal void Initialize(Point Location, bool FullLoad = false)
        {
            try
            {
                Connection.Open();
                Connection.Close();
            }
            catch (Exception ex)
            {
                if (Connection.State == ConnectionState.Open)
                    Connection.Close();
                MessageBox.Show("Error on database connection: " + ex.Message, "Database connection", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            Loader = new BackgroundWorker();
            Loader.WorkerReportsProgress = true;
            Loader.WorkerSupportsCancellation = true;
            Loader.ProgressChanged += Loader_ProgressChanged;
            if (!FullLoad)
            {
                Loader.DoWork += Loader_DoWork;
                Loader.RunWorkerCompleted += Loader_RunWorkerCompleted;
            }
            else
            {
                Loader.DoWork += Loader_DoWork2;
                Loader.RunWorkerCompleted += Loader_RunWorkerCompleted2;
            }

            //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(this.Server, "Connecting to database...");
            ISenseRect.Show(Location);

            Loader.RunWorkerAsync();
        }
Exemple #2
0
 private void Loader_RunWorkerCompleted2(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
 {
     if (ISenseRect != null)
     {
         ISenseRect.Close();
         ISenseRect.Dispose();
     }
     if (LoadDialog != null)
     {
         LoadDialog.Dispose();
         LoadDialog = null;
     }
     _Loaded = true;
     _FullLoaded = true;
     if (OnEndedLoad != null)
         OnEndedLoad();
 }