void OnClick(Context context, int position)
        {
            if (position < 0)
            {
                return;
            }
            this.context  = context;
            this.position = position;

            var uri = new Uri(items[position].AudioBoomUrl);

            string filename = System.IO.Path.GetFileName(uri.LocalPath);

            ISaveAndLoadFiles saveFile = new SaveAndLoadFiles_Android();

            if (saveFile.FileExists(filename))
            {
                new AlertDialog.Builder(context)
                .SetTitle(Resource.String.app_name)
                .SetMessage(context.GetString(Resource.String.download_manual_file_exists))
                .SetIcon(Resource.Drawable.baseline_warning_24)
                .SetPositiveButton(Resource.String.download_error_ok_button, DialogPositiveButtonClick)
                .SetNegativeButton(Resource.String.download_error_cancel_button, DialogNegativeButtonClick)
                .Show();
            }
            else
            {
                StartDownload();
            }
        }
예제 #2
0
        public void UpdateList()
        {
            ISaveAndLoadFiles saveFile = new SaveAndLoadFiles_Android();

            Loading(true);
            enCasoFiles = LocalDatabase <EnCasoFile> .GetEnCasoFileDb().GetAll();

            SaveAndLoadFiles_Android saveAndLoadFiles_Android = new SaveAndLoadFiles_Android();

            foreach (EnCasoFile enCasoFile in enCasoFiles)
            {
                if (!saveAndLoadFiles_Android.FileExists(enCasoFile.SavedFile))
                {
                    LocalDatabase <EnCasoFile> .GetEnCasoFileDb().Delete(enCasoFile);
                }
            }
            enCasoFiles = LocalDatabase <EnCasoFile> .GetEnCasoFileDb().GetAll().OrderByDescending(t => t.PubDate).ToArray();

            if (listRecyclerAdapter != null)
            {
                listRecyclerAdapter.UpdateData(enCasoFiles);
            }
            Loading(false);
        }