Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

How to use ProgressDialog?

$
0
0

Hi guys! I'm trying to use the ProgressDialog, but I"m having difficulties with the Thread and Runnable thing.

I saw that example:

final ProgressDialog myPd_ring=ProgressDialog.show(MyProgressDialog.this, "Please wait", "Loading please wait..", true);
                        myPd_ring.setCancelable(true);
                        new Thread(new Runnable() {  
                              @Override
                              public void run() {
                                    // TODO Auto-generated method stub
                                    try
                                    {
                                          Thread.sleep(5000);
                                    }catch(Exception e){}
                                    myPd_ring.dismiss();
                              }
                        }).start();    

But how can I reproduce that example using Mono?

I tried something like that:

button.Click += delegate
            {
                progress = ProgressDialog.Show(this, "dialog title", "dialog message", true);

                var tredi = new Thread(fivesec);

                tredi.Start();
                tredi.Join();

            };
        }

        public void fivesec()
        {
            Thread.Sleep(5000);
            cancelbar();

        }

        public void cancelbar()
        {
            progress.Hide();
        }

But didn't worked...

Someone tried that before? Thank you!


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>