Example #1
0
        public async void ShowProgressDialog()
        {
            RootView progress   = new RootView();
            var      controller = await progress.ShowProgressAsync("Please wait...", "We are baking some cupcakes!");

            await Task.Delay(50);

            //  controller.SetCancelable(true);

            double i = 0.0;

            while (i < 6.0)
            {
                double val = (i / 100.0) * 20.0;
                controller.SetProgress(val);
                controller.SetMessage("Baking cupcake: " + i + "...");

                if (controller.IsCanceled)
                {
                    break; //canceled progressdialog auto closes.
                }
                i += 1.0;

                await Task.Delay(20);
            }

            await controller.CloseAsync();

            if (controller.IsCanceled)
            {
                await progress.ShowMessageAsync("No cupcakes!", "You stopped baking!");
            }
            else
            {
                await progress.ShowMessageAsync("Cupcakes!", "Your cupcakes are finished! Enjoy!");
            }
        }