Пример #1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Main);

            Button start = FindViewById<Button>(Resource.Id.startButton);
            Button stop = FindViewById<Button>(Resource.Id.stopButton);

            ProgressDialog pd = new ProgressDialog(this)
            {
                Indeterminate = true,
            };

            pd.SetMessage("Waiting");

            pd.SetButton("cancel", (s, e) => Stop(pd));
            pd.SetIcon(Resource.Drawable.Icon);

            //pd.SetCancelable(false);

            Drawable myIcon = Resources.GetDrawable(Resource.Animation.progress_dialog_icon_drawable_animation);
            pd.SetIndeterminateDrawable(myIcon);

            start.Click += delegate { Start(pd); };
            stop.Click += delegate { Stop(pd); };
        }
Пример #2
0
        public ProgressDialog DownloadingProgressDialog(string title, string message)
        {
            ProgressDialog progress = new ProgressDialog(context);
            progress.SetMessage(message);
            progress.SetTitle(title);
            progress.SetIcon(Resource.Drawable.Icon);
            progress.SetButton("Cancel", (sender, args) =>
            {
                // Close progress dialog
                progress.Dismiss();

                // Stop all downloads
                client.CancelAsync();

                // Remove any language folders that were to be downloaded
                for (var i = 0; i < downloadQueue.Count; i++)
                {
                    DeleteLanguagePack(downloadQueue[i]);
                }

                // No downloads to be downloaded
                downloadQueue = new List<string>();
                // No files to be download
                FilesCoutner = 0;
                // They didn't all download, but set to true anyways
                allDownloaded = true;

                if (DownloadedLanguages.Count > 0)
                {
                    Language = Language;
                }
            });
            progress.SetProgressStyle(ProgressDialogStyle.Horizontal);
            progress.SetCancelable(false);
            progress.SetCanceledOnTouchOutside(false);

            return progress;
        }