private void PrimerPlugin_EventHandler(DbgPluginPrimer.TPrimeEvent aEvent, object aData)
        {
            switch (aEvent)
            {
            case DbgPluginPrimer.TPrimeEvent.EEventPrimingStarted:
                OnPrimeStart();
                break;

            case DbgPluginPrimer.TPrimeEvent.EEventPrimingProgress:
                if (aData != null && (aData is int))
                {
                    int prog = (int)aData;
                    OnPrimeProgress(prog);
                }
                break;

            case DbgPluginPrimer.TPrimeEvent.EEventPrimingComplete:
                OnPrimeComplete();
                break;
            }
        }
        private void PrimerPlugin_EventHandler(DbgPluginPrimer.TPrimeEvent aEvent, object aData)
        {
            System.Diagnostics.Debug.WriteLine(string.Format("PrimerPlugin - event handler - {0} - {1}", aEvent, aData));
            if (InvokeRequired)
            {
                DbgPluginPrimer.PrimeEventHandler callback = new DbgPluginPrimer.PrimeEventHandler(PrimerPlugin_EventHandler);
                this.BeginInvoke(callback, new object[] { aEvent, aData });
            }
            else
            {
                switch (aEvent)
                {
                case DbgPluginPrimer.TPrimeEvent.EEventPrimingStarted:
                    iProgressBar.Maximum = 100; //%
                    iProgressBar.Minimum = 0;   //%
                    iProgressBar.Value   = 0;
                    OnPrimeStart();
                    break;

                case DbgPluginPrimer.TPrimeEvent.EEventPrimingProgress:
                    if (aData != null && (aData is int))
                    {
                        int prog = (int)aData;
                        OnPrimeProgress(prog);
                        iProgressBar.Value = prog;
                    }
                    break;

                case DbgPluginPrimer.TPrimeEvent.EEventPrimingComplete:
                    iProgressBar.Value = 100;
                    OnPrimeComplete();
                    Close();
                    break;
                }
            }
            //
            Application.DoEvents();
        }