×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Mar 2013
    Posts
    14

    Problem with SystemTray.ProgressIndicator and MessageBox

    Hi everyone,
    I am facing a problem on WP 8, using the Progress indicator and a message box. The code is pretty simple. What i want to do is, after doing some async work with an indefinite progress indicator running, hide the indicator and show a message box to the user, showing some info and an ok buton to continue.

    What i do, then, is, after initializing the indicator:

    Code:
    ProgressIndicator prog = new ProgressIndicator();
    prog.IsVisible = true;
    prog.IsIndeterminate = true;
    prog.Text = "Provo il login...";
    SystemTray.SetProgressIndicator(this, prog);
    Try to hide it and show box after doing some async stuff:

    Code:
    SystemTray.ProgressIndicator.IsVisible = false;
    MessageBox.Show("Here is the information");
    On WP7.8 it works good: the indicator is hidden, and the box is popped up. On WP8, instead, the message box is shown, thus locking the thread, BEFORE the progress indicator is hidden...

    I know XNA allows a non blocking Message Box, but i wouldn't go that far.... I would just need to show the message after the hiding animation (OS managed) is over.... Is there any way to do that? Any better way to approach the problem?

    Thank you very much!

  2. #2
    Nokia Developer Champion
    Join Date
    Sep 2012
    Location
    Morocco
    Posts
    292

    Re: Problem with SystemTray.ProgressIndicator and MessageBox

    How about using a custom MessageBox (One that will not lock the thread).
    You can make your own (UserControl+PopUp), or use one of these :
    -http://shawnoster.com/2012/10/welcome-custommessagebox-to-the-windows-phone-toolkit/
    -http://coding4fun.codeplex.com/

  3. #3
    Registered User
    Join Date
    Mar 2013
    Posts
    14

    Re: Problem with SystemTray.ProgressIndicator and MessageBox

    Hey Loukt,
    thanks for the links! Actually yeah, i also thought i could have used the XNA message box, but was thinking there could have been a different solution for this problem....

    If there is no such solution, yeah i guess i'll use one custom message box!

    Thanks,
    Iacopo

  4. #4
    Registered User
    Join Date
    Jul 2012
    Posts
    20

    Re: Problem with SystemTray.ProgressIndicator and MessageBox

    please try with below code snippet i assume worker_RunWorkerCompleted gets called after completing background operation.

    void worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
    {
    SystemTray.ProgressIndicator.IsVisible = false;
    Deployment.Current.Dispatcher.BeginInvoke(() =>
    {
    MessageBox.Show("Here is the information");
    });
    }

  5. #5
    Registered User
    Join Date
    Mar 2013
    Posts
    14

    Re: Problem with SystemTray.ProgressIndicator and MessageBox

    Hi Mehul!
    Thanks for the hint: it looks like it's working!

    I though i had tried already running the message on the UI Thread, but probably not!

    Thanks once more!
    Cheers,
    Iacopo

Similar Threads

  1. Suppress unexpected MessageBox
    By smashrod in forum Nokia N9
    Replies: 11
    Last Post: 2012-02-11, 20:04
  2. link in MessageBox
    By jhnns in forum Mobile Java General
    Replies: 1
    Last Post: 2010-01-27, 10:10
  3. MessageBox with scrollbar
    By StasV in forum Symbian
    Replies: 5
    Last Post: 2008-07-04, 07:47
  4. MessageBox API (JSR 266) [inbox, outbox access]
    By stuaxo in forum Tools and SDK Feedback (Closed)
    Replies: 2
    Last Post: 2008-03-31, 13:50
  5. How can i get javax.microedition.messagebox
    By lovett0128 in forum Mobile Java Tools & SDKs
    Replies: 1
    Last Post: 2007-01-29, 09:27

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •