private void _timer_Elapsed(object sender, ElapsedEventArgs e) { //Lets check for permission. if (CheckSelfPermission(PermissionsNeeded.First()) != Permission.Granted) { _timer.Stop(); RunOnUiThread(() => { AndroidX.AppCompat.App.AlertDialog.Builder builder = new AndroidX.AppCompat.App.AlertDialog.Builder(this); builder.SetTitle(Resource.String.dialog_title) .SetIcon(GetDrawable(Resource.Drawable.ic_home_black_24dp)) .SetMessage(Resource.String.dialog_message) .SetPositiveButton(Resource.String.dialog_postive, PositiveButtonSelected) .SetNegativeButton(Resource.String.dialog_negative, NegativeButtonSelected) .Show(); }); } else { GetOnToMainActivity(); } //Whatever happens.... dispose the timer. _timer.Dispose(); }
private async void Adapter_ItemClick(object sender, int e) { string pvFileName = pvList[e]; try { if (!File.Exists(Path.Combine(pvPath, $"{pvFileName}.mp4"))) { var builder = new AndroidX.AppCompat.App.AlertDialog.Builder(this, ETC.dialogBG); builder.SetTitle(Resource.String.GFPVActivity_DownloadRequireDialog_Title); builder.SetMessage(Resource.String.GFPVActivity_DownloadRequireDialog_Message); builder.SetCancelable(true); builder.SetPositiveButton(Resource.String.AlertDialog_Download, async delegate { await PVDownload(pvFileName, e); }); builder.SetNegativeButton(Resource.String.AlertDialog_Cancel, delegate { }); builder.Show(); } else { await RunPV(Path.Combine(pvPath, $"{pvFileName}.mp4")); } } catch (Exception ex) { ETC.LogError(ex, this); } }
private void InviteDevices(object sender, EventArgs e) { #pragma warning disable 0618 var progress = new Android.App.ProgressDialog(Context); progress.SetCancelable(false); progress.SetMessage(GetString(Resource.String.sending_invites)); progress.Show(); #pragma warning restore 0618 Task.Run(async() => { try { var inviteCode = Globals.CloudManager.SharePersonalCloud(Globals.CloudManager.PersonalClouds[0]); Activity?.RunOnUiThread(() => { progress.Dismiss(); var dialog = new AndroidX.AppCompat.App.AlertDialog.Builder(Context, Resource.Style.AlertDialogTheme) .SetIcon(Resource.Mipmap.ic_launcher_round).SetCancelable(false) .SetTitle(Resource.String.invited_title) .SetMessage(GetString(Resource.String.invited_message, inviteCode)) .SetPositiveButton(Resource.String.void_invites, (o, e) => { try { Globals.CloudManager.StopSharePersonalCloud(Globals.CloudManager.PersonalClouds[0]); } catch { } }).Show(); }); } catch { Activity.RunOnUiThread(() => { progress.Dismiss(); Activity.ShowAlert(GetString(Resource.String.error_invite), GetString(Resource.String.cannot_send_invites)); }); } }); }
private void InitShowDialog() { dialog_ShowBuilder = new AndroidX.AppCompat.App.AlertDialog.Builder(this, Resource.Style.Theme_Dialog_FullScreen); dialog_Show = dialog_ShowBuilder.Create(); dialog_Show.Show(); dialog_Show.Dismiss(); }
private void InitFilterBox() { var inflater = LayoutInflater; try { View v = inflater.Inflate(Resource.Layout.FSTFilterLayout, null); for (int i = 0; i < typeFilters.Length; ++i) { v.FindViewById <CheckBox>(typeFilters[i]).Checked = filterType[i]; } var filterBox = new AndroidX.AppCompat.App.AlertDialog.Builder(this, ETC.dialogBGVertical); filterBox.SetTitle(Resource.String.DBList_FilterBoxTitle); filterBox.SetView(v); filterBox.SetPositiveButton(Resource.String.AlertDialog_Set, delegate { ApplyFilter(v); }); filterBox.SetNegativeButton(Resource.String.AlertDialog_Cancel, delegate { }); filterBox.SetNeutralButton(Resource.String.AlertDialog_Reset, delegate { ResetFilter(); }); filterBox.Show(); } catch (Exception ex) { ETC.LogError(ex, this); ETC.ShowSnackbar(snackbarLayout, Resource.String.FilterBox_InitError, Snackbar.LengthLong); } }
public override void OnBackPressed() { if (IsBooting == true) { return; } var ad = new AndroidX.AppCompat.App.AlertDialog.Builder(this, Resource.Style.GFD_Dialog); ad.SetTitle("ShutDown Zina OS"); ad.SetMessage("Do you want to shutdown Zina OS?"); ad.SetPositiveButton("Shutdown", delegate { IsBooting = true; _ = ShutdownZinaOS(); }); ad.SetNegativeButton("Cancel", delegate { }); ad.SetCancelable(true); try { ad.Show(); } catch (Exception ex) { ETC.LogError(ex, this); } }
private void ShowDialog(string title, string message) { var alert = new AndroidX.AppCompat.App.AlertDialog.Builder(this); alert.SetTitle(title); alert.SetMessage(message); alert.SetPositiveButton("OK", (s, e) => { }); alert.Create().Show(); }
private async Task LoadRestaurantList() { var current = Connectivity.NetworkAccess; if (current == NetworkAccess.Internet) { try { var result = await restaurantRecommenderPayLoad.RestaurantList(); var user_result = await restaurantRecommenderPayLoad.UserList(); RunOnUiThread(() => { progressBar.Visibility = ViewStates.Gone; if (result.Count() > 0 && user_result.Count() > 0) { Intent intent = new Intent(this, typeof(UserActivity)); var restraunt_group = result.GroupBy(x => x.RestaurantType) .Select(group => new RestaurantSection(group.Select(x => x.RestaurantName).ToList()) { SectionName = group.Key, }).OrderBy(x => x.SectionName).ToList(); intent.PutExtra("User_List", JsonConvert.SerializeObject(user_result)); intent.PutExtra("Restaurant_List", JsonConvert.SerializeObject(restraunt_group)); this.StartActivity(intent); } }); } catch (Exception ex) { RunOnUiThread(() => { AndroidX.AppCompat.App.AlertDialog.Builder dialog = new AndroidX.AppCompat.App.AlertDialog.Builder(this); AndroidX.AppCompat.App.AlertDialog alert = dialog.Create(); alert.SetTitle("Error"); alert.SetMessage(ex.Message.ToString()); alert.SetCancelable(true); alert.Show(); }); } } else { RunOnUiThread(() => { AndroidX.AppCompat.App.AlertDialog.Builder dialog = new AndroidX.AppCompat.App.AlertDialog.Builder(this); AndroidX.AppCompat.App.AlertDialog alert = dialog.Create(); alert.SetTitle("Error"); alert.SetMessage("Please connect to the internet"); alert.SetCancelable(true); alert.Show(); }); } }
public void ShowSuccess(string message = null) { AndroidX.AppCompat.App.AlertDialog.Builder builder = new AndroidX.AppCompat.App.AlertDialog.Builder(this.Context); builder.SetTitle("Success") .SetMessage(message ?? "We exported your file successfully. Please go to the history tab to have a look.") .SetIcon(Context.GetDrawable(Resource.Drawable.abc_ab_share_pack_mtrl_alpha)) .SetCancelable(false) .SetNeutralButton("Okay", (s, e) => { return; }) .Show(); }
private async Task CheckUpdate() { await Task.Delay(100); bool isMissing = false; try { isMissing = CheckImage(); if (!isMissing) { using (WebClient wc = new WebClient()) { string LocalVerPath = Path.Combine(ETC.systemPath, "ShortGuideVer.txt"); if (!File.Exists(LocalVerPath)) { hasUpdate = true; } else { int serverVer = int.Parse(await wc.DownloadStringTaskAsync(Path.Combine(ETC.server, "ShortGuideVer.txt"))); int localVer = 0; using (StreamReader sr = new StreamReader(new FileStream(LocalVerPath, FileMode.Open, FileAccess.Read))) { localVer = int.Parse(sr.ReadToEnd()); } hasUpdate = localVer < serverVer; } } } if (hasUpdate || isMissing) { var builder = new AndroidX.AppCompat.App.AlertDialog.Builder(Activity); builder.SetTitle(Resource.String.UpdateDialog_Title); builder.SetMessage(Resource.String.UpdateDialog_Message); builder.SetCancelable(true); builder.SetPositiveButton(Resource.String.AlertDialog_Confirm, async delegate { await DownloadShortGuideImage(); }); builder.SetNegativeButton(Resource.String.AlertDialog_Cancel, delegate { }); var dialog = builder.Create(); dialog.Show(); } } catch (Exception ex) { ETC.LogError(ex, Activity); ETC.ShowSnackbar(snackbarLayoutF, Resource.String.UpdateCheck_Fail, Snackbar.LengthLong, Android.Graphics.Color.DarkRed); } }
private void ShowFailureToSave() { AndroidX.AppCompat.App.AlertDialog.Builder builder = new AndroidX.AppCompat.App.AlertDialog.Builder(this.Context); builder.SetTitle("Export Failed") .SetMessage("ExtractR is sadly unable to save your file right now. Please try again.") .SetIcon(Context.GetDrawable(Resource.Drawable.abc_ab_share_pack_mtrl_alpha)) .SetCancelable(false) .SetNeutralButton("Let me try again", (s, e) => { return; }) .Show(); }
internal void ShowDownloadCheckMessage <T>(List <T> downloadList, string serverPath, string targetPath) { var ad = new AndroidX.AppCompat.App.AlertDialog.Builder(this, ETC.dialogBG); ad.SetTitle(Resource.String.DBList_DownloadCropImageCheckTitle); ad.SetMessage(Resource.String.DBList_DownloadCropImageCheckMessage); ad.SetCancelable(true); ad.SetPositiveButton(Resource.String.AlertDialog_Download, delegate { _ = CropImageDownloadProcess(downloadList, serverPath, targetPath); }); ad.SetNegativeButton(Resource.String.AlertDialog_Cancel, delegate { }); ad.Show(); }
/// <summary> /// 显示Android提示框 /// </summary> /// <param name="title">标题</param> /// <param name="msg">内容消息</param> /// <param name="onSureClick">确定事件</param> /// <param name="onCancelClick">取消事件</param> /// <param name="sureText">确定文字</param> /// <param name="cancelText">取消文字</param> public void ShowAndroidPromptBox(string title, string msg, Action onSureClick, Action onCancelClick, bool isCancelable = false, string sureText = "确定", string cancelText = "取消") { AndroidX.AppCompat.App.AlertDialog jk = null; jk = new AndroidX.AppCompat.App.AlertDialog.Builder(this) .SetTitle(title) .SetMessage(msg) .SetCancelable(isCancelable) .SetPositiveButton(sureText, (object sender, DialogClickEventArgs eve) => { jk.Dismiss(); jk = null; onSureClick?.Invoke(); }) .SetNegativeButton(cancelText, (object sender, DialogClickEventArgs eve) => { jk.Dismiss(); jk = null; onCancelClick?.Invoke(); }) .Show(); }
private void InitSortBox() { string[] sortTypeList = { Resources.GetString(Resource.String.Sort_SortMethod_Name), Resources.GetString(Resource.String.Sort_SortMethod_Number), Resources.GetString(Resource.String.Sort_SortMethod_ProductTime), Resources.GetString(Resource.String.Sort_SortMethod_HP), Resources.GetString(Resource.String.Sort_SortMethod_FR), Resources.GetString(Resource.String.Sort_SortMethod_EV), Resources.GetString(Resource.String.Sort_SortMethod_AC), Resources.GetString(Resource.String.Sort_SortMethod_AS), }; try { View v = LayoutInflater.Inflate(Resource.Layout.CommonSorterLayout, null); var adapter = new ArrayAdapter(this, Resource.Layout.SpinnerListLayout, sortTypeList); adapter.SetDropDownViewResource(Resource.Layout.SpinnerListLayout); var sortSpinner = v.FindViewById <Spinner>(Resource.Id.CommonSortSpinner); sortSpinner.Adapter = adapter; sortSpinner.SetSelection((int)sortType); switch (sortOrder) { default: case SortOrder.Ascending: v.FindViewById <RadioButton>(Resource.Id.CommonSortOrderAscending).Checked = true; break; case SortOrder.Descending: v.FindViewById <RadioButton>(Resource.Id.CommonSortOrderDescending).Checked = true; break; } var filterBox = new AndroidX.AppCompat.App.AlertDialog.Builder(this, ETC.dialogBGVertical); filterBox.SetTitle(Resource.String.DBList_SortBoxTitle); filterBox.SetView(v); filterBox.SetPositiveButton(Resource.String.AlertDialog_Set, delegate { ApplySort(v); }); filterBox.SetNegativeButton(Resource.String.AlertDialog_Cancel, delegate { }); filterBox.SetNeutralButton(Resource.String.AlertDialog_Reset, delegate { ResetSort(); }); filterBox.Show(); } catch (Exception ex) { ETC.LogError(ex, this); ETC.ShowSnackbar(snackbarLayout, Resource.String.SortBox_InitError, Snackbar.LengthLong); } }
/** * Display a dialog prompting the user to pick a favorite food from a list, then record * the answer. */ void AskFavoriteFood() { var choices = Resources.GetStringArray(Resource.Array.food_items); var ad = new AndroidX.AppCompat.App.AlertDialog.Builder(this) .SetCancelable(false) .SetTitle(Resource.String.food_dialog_title) .SetItems(choices, (sender, e) => { var food = choices[e.Which]; SetUserFavoriteFood(food); }).Create(); ad.Show(); }
public void RefreshTaskFragment(NewTaskFragment fragment) { AndroidX.AppCompat.App.AlertDialog.Builder builder = new AndroidX.AppCompat.App.AlertDialog.Builder(this); builder.SetTitle("Reset Work Space") .SetMessage("Would you like to start all over again?") .SetPositiveButton("Yes", (s, e) => { ResetView(fragment); }) .SetNegativeButton("Quit", (s, e) => { ResetView(fragment); QuitApplication(); }) .Show(); }
private void Pickwallpaper_Click(object sender, EventArgs e) { var button = sender as Button; using (AndroidX.AppCompat.App.AlertDialog.Builder builder = new AndroidX.AppCompat.App.AlertDialog.Builder(button.Context)) { int currentwallpapersetted = int.Parse(configurationManager.RetrieveAValue(ConfigurationParameters.ChangeWallpaper, "0")); builder.SetTitle(Resources.GetString(Resource.String.changewallpaper)); builder.SetSingleChoiceItems(new string[] { button.Context.GetString(Resource.String.blackwallpaper), button.Context.GetString(Resource.String.defaultwallpaper), button.Context.GetString(Resource.String.pickwallpaper) }, currentwallpapersetted, OnDialogClickEventArgs); builder.Create(); builder.Show(); } }
protected void ShowSingleChoseDialog(string[] items, Action <int> chosePosition, bool isCanCancel = true, bool isOutSideTouch = true) { var builder = new AndroidX.AppCompat.App.AlertDialog.Builder(this, Android.Resource.Style.ThemeDeviceDefaultLightDialogNoActionBarMinWidth); builder.SetItems(items, (object sender, DialogClickEventArgs e) => { chosePosition?.Invoke(e.Which); }); var dialog_Show = builder.Create(); dialog_Show.SetCancelable(isCanCancel); dialog_Show.SetCanceledOnTouchOutside(isOutSideTouch); dialog_Show.Show(); }
private void PromptForPermission() { AndroidX.AppCompat.App.AlertDialog.Builder builder = new AndroidX.AppCompat.App.AlertDialog.Builder(this); builder.SetTitle(Resource.String.dialog_quit_title) .SetIcon(GetDrawable(Resource.Drawable.ic_home_black_24dp)) .SetPositiveButton(Resource.String.dialog_quit_positive, PositiveButtonSelected) .SetNegativeButton(Resource.String.dialog_quit, (s, e) => { MoveTaskToBack(true); Android.OS.Process.KillProcess(Android.OS.Process.MyPid()); Java.Lang.JavaSystem.Exit(1); }).Show(); }
public override void OnBackPressed() { var exitDialog = new AndroidX.AppCompat.App.AlertDialog.Builder(this, Resource.Style.GFD_Dialog); exitDialog.SetTitle(Resource.String.Main_CheckExitTitle); exitDialog.SetMessage(Resource.String.Main_CheckExit); exitDialog.SetCancelable(true); exitDialog.SetPositiveButton(Resource.String.AlertDialog_Exit, delegate { FinishAffinity(); Process.KillProcess(Process.MyPid()); }); exitDialog.SetNegativeButton(Resource.String.AlertDialog_Cancel, delegate { }); exitDialog.Show(); }
private void ReportNothingFound() { AndroidX.AppCompat.App.AlertDialog.Builder builder = new AndroidX.AppCompat.App.AlertDialog.Builder(this.Context); builder.SetTitle("No image found") .SetMessage("Unfortunately, EtxractR couldn't find any image to process. Try again with another file, perhaps?") .SetIcon(this.Context.GetDrawable(Resource.Drawable.notification_template_icon_bg)) .SetNeutralButton("Understood", (s, e) => { //Call refresh mainActivity.RefreshTaskFragment(this); }) .SetCancelable(false) .Show(); CouldBeRefreshed = true; }
private async Task LoadVisitedRestaurant(int id) { var current = Connectivity.NetworkAccess; if (current == NetworkAccess.Internet) { try { restaurantItemModel = await restaurantRecommenderPayLoad.Restaurants_Visited_By_User(id); if (restaurantItemModel.Count() > 0) { Activity.RunOnUiThread(() => { restaurantlayoutManager = new LinearLayoutManager(restaurant_recyclerView.Context); restaurant_recyclerView.SetLayoutManager(restaurantlayoutManager); restaurantrecommendationAdapter = new VisitedRestaurantListAdapter(restaurantItemModel); restaurant_recyclerView.SetAdapter(restaurantrecommendationAdapter); }); } } catch (Exception ex) { Activity.RunOnUiThread(() => { AndroidX.AppCompat.App.AlertDialog.Builder dialog = new AndroidX.AppCompat.App.AlertDialog.Builder(Context); AndroidX.AppCompat.App.AlertDialog alert = dialog.Create(); alert.SetTitle("Error"); alert.SetMessage(ex.Message.ToString()); alert.SetCancelable(true); alert.Show(); }); } } else { Activity.RunOnUiThread(() => { AndroidX.AppCompat.App.AlertDialog.Builder dialog = new AndroidX.AppCompat.App.AlertDialog.Builder(Context); AndroidX.AppCompat.App.AlertDialog alert = dialog.Create(); alert.SetTitle("Error"); alert.SetMessage("Please connect to the internet"); alert.SetCancelable(true); alert.Show(); }); } }
private void SelectCache() { string freeText = Resources.GetString(Resource.String.SelectCache_FreeSpace); string requireText = Resources.GetString(Resource.String.SelectCache_RequireSpace); if (categoryCheck == null) { categoryCheck = new Dictionary <CacheCategory, bool>(); } categoryCheck.Clear(); cacheSelectView = LayoutInflater.Inflate(Resource.Layout.CacheSelectLayout, null); cacheSelectView.FindViewById <XTextView>(Resource.Id.CacheSelectNowFreeSpace).Text = $"{freeText} : {freeSize}MB"; cacheSelectView.FindViewById <XTextView>(Resource.Id.CacheSelectRequireSpace).Text = $"{requireText} : {expectSize}MB"; cacheSelectView.FindViewById <XCheckBox>(Resource.Id.CacheSelectCategoryDic).CheckedChange += CacheSelectCategory_CheckedChange; cacheSelectView.FindViewById <XCheckBox>(Resource.Id.CacheSelectCategoryOldGFD).CheckedChange += CacheSelectCategory_CheckedChange; cacheSelectView.FindViewById <XCheckBox>(Resource.Id.CacheSelectCategoryGuideBook).CheckedChange += CacheSelectCategory_CheckedChange; cacheSelectView.FindViewById <XCheckBox>(Resource.Id.CacheSelectCategoryStory).CheckedChange += CacheSelectCategory_CheckedChange; cacheSelectView.FindViewById <XCheckBox>(Resource.Id.CacheSelectCategoryPV).CheckedChange += CacheSelectCategory_CheckedChange; cacheSelectView.FindViewById <XCheckBox>(Resource.Id.CacheSelectCategoryOST).CheckedChange += CacheSelectCategory_CheckedChange; //cacheSelectView.FindViewById<XCheckBox>(Resource.Id.CacheSelectCategoryCartoon).CheckedChange += CacheSelectCategory_CheckedChange; var ad = new AndroidX.AppCompat.App.AlertDialog.Builder(Activity, ETC.dialogBG); ad.SetTitle(Resource.String.SelectCache_Dialog_Title); ad.SetCancelable(true); ad.SetNegativeButton(Resource.String.AlertDialog_Cancel, delegate { }); ad.SetPositiveButton(Resource.String.AlertDialog_Confirm, async delegate { categoryCheck.Add(CacheCategory.Dic, cacheSelectView.FindViewById <XCheckBox>(Resource.Id.CacheSelectCategoryDic).Checked); categoryCheck.Add(CacheCategory.OldGFD, cacheSelectView.FindViewById <XCheckBox>(Resource.Id.CacheSelectCategoryOldGFD).Checked); categoryCheck.Add(CacheCategory.GuideBook, cacheSelectView.FindViewById <XCheckBox>(Resource.Id.CacheSelectCategoryGuideBook).Checked); categoryCheck.Add(CacheCategory.Story, cacheSelectView.FindViewById <XCheckBox>(Resource.Id.CacheSelectCategoryStory).Checked); categoryCheck.Add(CacheCategory.PV, cacheSelectView.FindViewById <XCheckBox>(Resource.Id.CacheSelectCategoryPV).Checked); categoryCheck.Add(CacheCategory.OST, cacheSelectView.FindViewById <XCheckBox>(Resource.Id.CacheSelectCategoryOST).Checked); //categoryCheck.Add(CacheCategory.Cartoon, cacheSelectView.FindViewById<XCheckBox>(Resource.Id.CacheSelectCategoryCartoon).Checked); await DownloadAllCache(); }); ad.SetView(cacheSelectView); var dialog = ad.Show(); }
public static void ShowDialog(Context context, Action positive, Action negative, string question, string positiveAns, string negativeAns) { var dialog = new AndroidX.AppCompat.App.AlertDialog.Builder(context, Resource.Style.AppCompatAlertDialogStyle); dialog.SetMessage(question); dialog.SetNegativeButton(negativeAns, (thisalert, args) => { negative(); }); dialog.SetPositiveButton(positiveAns, (thisalert, args) => { positive(); }); dialog.Show(); }
public static void ShowEditorAlert(this Android.App.Activity activity, string title, string placeholder, string text, string positiveAction, Action <string> onConfirmation, string neutralAction, Action onDismiss) { var view = activity.LayoutInflater.Inflate(Resource.Layout.alert_editor, null); var editor = view.FindViewById <Android.Widget.EditText>(Resource.Id.editor); editor.Hint = placeholder; editor.Text = text; editor.SetSelection(0, editor.Text.Length); var dialog = new AndroidX.AppCompat.App.AlertDialog.Builder(activity).SetCancelable(false) .SetIcon(Resource.Mipmap.ic_launcher) .SetTitle(title) .SetView(view) .SetPositiveButton(positiveAction, (o, e) => onConfirmation?.Invoke(editor.Text)) .SetNeutralButton(neutralAction, (o, e) => onDismiss?.Invoke()) .Create(); dialog.Window.SetSoftInputMode(Android.Views.SoftInput.StateVisible); dialog.Show(); editor.RequestFocus(); }
private void InitFilterBox() { try { View v = LayoutInflater.Inflate(Resource.Layout.DollFilterLayout, null); v.FindViewById <NumberPicker>(Resource.Id.DollFilterProductHour).MaxValue = 12; v.FindViewById <NumberPicker>(Resource.Id.DollFilterProductMinute).MaxValue = 59; v.FindViewById <NumberPicker>(Resource.Id.DollFilterProductNearRange).MaxValue = 20; for (int i = 0; i < gradeFilters.Length; ++i) { v.FindViewById <CheckBox>(gradeFilters[i]).Checked = filterGrade[i]; } for (int i = 0; i < typeFilters.Length; ++i) { v.FindViewById <CheckBox>(typeFilters[i]).Checked = filterType[i]; } for (int i = 0; i < productTimeFilters.Length; ++i) { v.FindViewById <NumberPicker>(productTimeFilters[i]).Value = filterProductTime[i]; } v.FindViewById <CheckBox>(modFilter).Checked = filterMod; var FilterBox = new AndroidX.AppCompat.App.AlertDialog.Builder(this, ETC.dialogBGVertical); FilterBox.SetTitle(Resource.String.DBList_FilterBoxTitle); FilterBox.SetView(v); FilterBox.SetPositiveButton(Resource.String.AlertDialog_Set, delegate { ApplyFilter(v); }); FilterBox.SetNegativeButton(Resource.String.AlertDialog_Cancel, delegate { }); FilterBox.SetNeutralButton(Resource.String.AlertDialog_Reset, delegate { ResetFilter(); }); FilterBox.Show(); } catch (Exception ex) { ETC.LogError(ex, this); ETC.ShowSnackbar(snackbarLayout, Resource.String.FilterBox_InitError, Snackbar.LengthLong); } }
private void OnLogoLongClick(object sender, EventArgs e) { try { var versionName = PackageManager.GetPackageInfo(PackageName, 0).VersionName; if (!string.IsNullOrEmpty(versionName)) { var dialog = new AndroidX.AppCompat.App.AlertDialog.Builder(this) .SetTitle("About") .SetMessage($"Version {versionName}") .SetIcon(Android.Resource.Drawable.IcDialogInfo) .SetCancelable(true) .Show(); } } catch (Exception ex) { Log.Warn(TAG, $"Could not get package info: {ex.Message}"); Log.Debug(TAG, ex.ToString()); } }
public static void ShowAlert(this Android.App.Activity activity, string title, string message, string positiveAction, Action onPositive, string negativeAction, Action onNegative, bool negativeActionIsNeutral = true) { var dialog = new AndroidX.AppCompat.App.AlertDialog.Builder(activity) .SetIcon(Resource.Mipmap.ic_launcher_round) .SetCancelable(false) .SetTitle(title) .SetMessage(message) .SetPositiveButton(positiveAction, (o, e) => onPositive?.Invoke()); if (negativeActionIsNeutral) { dialog.SetNeutralButton(negativeAction, (o, e) => onNegative?.Invoke()); } else { dialog.SetNegativeButton(negativeAction, (o, e) => onNegative?.Invoke()); } dialog.Show(); }
internal async Task DownloadGFDImage() { View v = LayoutInflater.Inflate(Resource.Layout.ProgressDialogLayout, null); ProgressBar totalProgressBar = v.FindViewById <ProgressBar>(Resource.Id.TotalProgressBar); TextView totalProgress = v.FindViewById <TextView>(Resource.Id.TotalProgressPercentage); ProgressBar nowProgressBar = v.FindViewById <ProgressBar>(Resource.Id.NowProgressBar); TextView nowProgress = v.FindViewById <TextView>(Resource.Id.NowProgressPercentage); var builder = new AndroidX.AppCompat.App.AlertDialog.Builder(Activity, ETC.dialogBGDownload); builder.SetTitle(Resource.String.UpdateDownloadDialog_Title); builder.SetView(v); builder.SetCancelable(false); Dialog dialog = builder.Create(); dialog.Show(); await Task.Delay(100); try { totalProgressBar.Max = imageName.Length; totalProgressBar.Progress = 0; using (WebClient wc = new WebClient()) { wc.DownloadFileCompleted += (object sender, System.ComponentModel.AsyncCompletedEventArgs e) => { totalProgressBar.Progress += 1; totalProgress.Text = $"{totalProgressBar.Progress} / {totalProgressBar.Max}"; }; wc.DownloadProgressChanged += (object sender, DownloadProgressChangedEventArgs e) => { nowProgressBar.Progress = e.ProgressPercentage; nowProgress.Text = $"{e.BytesReceived / 1024}KB"; }; foreach (string s in imageName) { string url = Path.Combine(ETC.server, "Data", "Images", "OldGFD", "Images", lang, $"{s}.png"); string target = Path.Combine(ETC.cachePath, "OldGFD", "Images", $"{lang}_{s}.gfdcache"); await wc.DownloadFileTaskAsync(url, target); } wc.DownloadFile(Path.Combine(ETC.server, "OldGFDVer.txt"), Path.Combine(ETC.systemPath, "OldGFDVer.txt")); } ETC.ShowSnackbar(snackbarLayout_F, Resource.String.UpdateDownload_Complete, Snackbar.LengthLong, Android.Graphics.Color.DarkOliveGreen); } catch (Exception ex) { ETC.LogError(ex, Activity); ETC.ShowSnackbar(snackbarLayout_F, Resource.String.UpdateDownload_Fail, Snackbar.LengthLong, Android.Graphics.Color.DarkRed); } finally { dialog.Dismiss(); } await Task.Delay(100); }
private void InitShowDialogBulider() { dialog_ShowBuilder = new AndroidX.AppCompat.App.AlertDialog.Builder(this, Resource.Style.Theme_Dialog_FullScreen); }