Oultook Addin progressBar Form not showing

Add-in Express™ Support Service
That's what is more important than anything else

Oultook Addin progressBar Form not showing
 
franck DAMMANN




Posts: 41
Joined: 2021-01-26
Dear all,

I'm trying to display a ProgressBar dialog when I click on a button from my AddinModule. I can see that code of my progressBar Form is correctly executed but the popup form is not displayed.

Here is the code of the form:


namespace MyAdd_in
{
    public partial class ProgressBarForm : AddinExpress.OL.ADXOlForm
    {
        public ProgressBarForm()
        {
            InitializeComponent();

            TopMost = true;
            Focus();
            BringToFront();
            Visible = true;
            ShowInTaskbar = false;

            BackgroundWorker taskSynch = new BackgroundWorker();
            taskSynch.WorkerReportsProgress = true;
            taskSynch.DoWork += taskSynch_DoWork;
            taskSynch.ProgressChanged += taskSynch_ProgressChanged;
            taskSynch.RunWorkerCompleted += taskSynch_RunWorkerCompleted;
            taskSynch.RunWorkerAsync();
        }
        private void taskSynch_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            Debug.WriteLine("do work stopped");
            this.Close();
        }

        void taskSynch_DoWork(object sender, DoWorkEventArgs e)
        {
            Debug.WriteLine("do work start");
            for (int i = 0; i < 10; i++)
            {
                (sender as BackgroundWorker).ReportProgress(i);
                Thread.Sleep(100);
            }
            Debug.WriteLine("do work ended");
        }
        void taskSynch_ProgressChanged(object sender, ProgressChangedEventArgs e)
        {
            Debug.WriteLine("progress changed");
            progressBar1.Value = e.ProgressPercentage;
        }

    }
}


and here is the code in my Addin:


 private void AdxRibbonButton7_OnClickAsync(object sender, IRibbonControl control, bool pressed)
        {
            ProgressBarForm formProgressBar = new ProgressBarForm();
            formProgressBar.TopMost = true;
            formProgressBar.Focus();
            formProgressBar.BringToFront();
            formProgressBar.Visible = true;
            formProgressBar.ShowInTaskbar = false;
            formProgressBar.ShowDialog();
            formProgressBar.Activate();
            
}


As you can see I tried multiple ways to display the Form but nothing happends...

I can see on the debug console the Form execution:


do work start
progress changed
progress changed
progress changed
progress changed
progress changed
progress changed
progress changed
progress changed
progress changed
progress changed
do work ended
do work stopped


but no display. Do you have any idea why it is not showing my form ?

Thanks,
Franck.
Posted 09 Oct, 2022 02:52:53 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Hello Franck,

franck DAMMANN writes:
TopMost = true;
Focus();
BringToFront();
Visible = true;
ShowInTaskbar = false;


An ADXOlForm is controlled by Add-in Express. The code lines above interfere with what Add-in Express does internally. You can't expect that an ADXOlForm will show up anywhere outside of its dock panel embedded into the corresponding Outlook window.

Regards from Poland (CEST),

Andrei Smolin
Add-in Express Team Leader
Posted 10 Oct, 2022 04:13:21 Top
franck DAMMANN




Posts: 41
Joined: 2021-01-26
Hi Andrei,

ok understood, so How can I show a progressBar popup / form by using Addin Express ?

Thanks !
Posted 10 Oct, 2022 04:24:49 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
I suppose you have two options:
- show a form with a ProgressBar on it
- show a ProgressBar right on the ADXOlForm

Regards from Poland (CEST),

Andrei Smolin
Add-in Express Team Leader
Posted 10 Oct, 2022 05:24:50 Top
franck DAMMANN




Posts: 41
Joined: 2021-01-26
Andrei,

this is exactly what I'm doing, I created an ADXOlFormand integrated a ProgressBar in it, but when I try to perform a ShowDialog() on the Form from my AddinModule, I can see tha execution is working fine (Thread is running) but no display of the form, this is the reason why I tried different ways by adding TopMost, BrginToFront(), etc...
Posted 10 Oct, 2022 07:09:37 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
An ADXOlForm cannot be shown from your code: its visibility is controlled by Add-in Express. For instance, it doesn't react to ShowDialog(), Show(), TopMost etc.

Use a System.Windows.Forms.Form instead.

Regards from Poland (CEST),

Andrei Smolin
Add-in Express Team Leader
Posted 10 Oct, 2022 07:21:39 Top
franck DAMMANN




Posts: 41
Joined: 2021-01-26
ok thanks Andrei,


by changing my Form declaration to
public partial class ProgressBarForm : System.Windows.Forms.Form
I can now display the progressBar popup.

Thanks !
Posted 10 Oct, 2022 08:00:03 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
You are welcome!

Regards from Poland (CEST),

Andrei Smolin
Add-in Express Team Leader
Posted 10 Oct, 2022 08:51:16 Top