/// <summary> /// 启动和结束任务 /// </summary> /// <param name="v"></param> public void OnClick(View v) { if (vh.publication.Value.PublicationStatus == PublicationStatusEnum.Downloaded) { SimpleDialogFragment.Create(new SimpleDialogProvider { TitleResId = Resource.String.StartTask_Title, MessageResId = Resource.String.EndTaskConfirm_Message, PositiveButtonResId = Resource.String.Confirm, NegativeButtonResId = Resource.String.Cancel, ExtTagKey = "EndTask", ExtTag = vh.publication.Value.DpsiCode.ToString(), CanceledOnTouchOutside = false, }).Show(vh.adaptor.Activity.SupportFragmentManager); } else { SimpleDialogFragment.Create(new SimpleDialogProvider { TitleResId = Resource.String.StartTask_Title, MessageResId = Resource.String.StartTaskConfirm_Message, PositiveButtonResId = Resource.String.Confirm, NegativeButtonResId = Resource.String.Cancel, ExtTagKey = "StartTask", ExtTag = vh.publication.Value.DpsiCode.ToString(), CanceledOnTouchOutside = false, }).Show(vh.adaptor.Activity.SupportFragmentManager); } }
private async void BtnLogin_Click() { // Call Business Api ILoginActivity loginActivity = Activity as ILoginActivity; if (loginActivity == null) { return; } var dialogTag = DialogGenerator.ShowWaitDialog(FragmentManager); LoginStatusEnum result = LoginStatusEnum.LoginFailure; try { result = await LoginUtil.Instance.ValidateUserLogin( etEmail.Text, etPassword.Text, ConfigurationService.GetAllCountryMap()[selectCountryIndex].CountryCode); } catch (Exception ee) { // force app exit // The common api should not throw any exception! throw ee; } AsyncUIOperationRepeater.INSTATNCE.SubmitAsyncUIOperation( (IAsyncTaskActivity)Activity, a => { SimpleDialogFragment.DismissDialog(((FragmentActivity)a), dialogTag); ProcessLoginResult(result); }); }
private void GetPublicationListOnline(bool showWaitDialog) { var runningTask = AsyncTaskManager.INSTATNCE.FindTaskByType(typeof(Task <OnlinePublicationResult>)); if (runningTask == null) { var task = PublicationUtil.Instance.GetPublicationOnline(); AsyncTaskManager.INSTATNCE.RegisterTask(task); string dialogTag = null; if (showWaitDialog) { dialogTag = DialogGenerator.ShowWaitDialog(Activity.SupportFragmentManager); } Application.SynchronizationContext.Post(async delegate { var result = await task; if (!AsyncTaskManager.INSTATNCE.UnregisterTask(task)) { // User has logged off return; } if (result.RequestStatus == RequestStatusEnum.Success) { DataCache.INSTATNCE.PublicationManager.SetPublicationList(result.Publications); } AsyncUIOperationRepeater.INSTATNCE.SubmitAsyncUIOperation( (IAsyncTaskActivity)Activity, a => { if (dialogTag != null) { SimpleDialogFragment.DismissDialog(((FragmentActivity)a), dialogTag); } if (DataCache.INSTATNCE.PublicationManager.PublicationList == null || DataCache.INSTATNCE.PublicationManager.PublicationList.Count == 0) { tvNoTitleMessage.Visibility = ViewStates.Visible; } else { tvNoTitleMessage.Visibility = ViewStates.Gone; } if (result.RequestStatus == RequestStatusEnum.Success) { SetFilter(); } }); }, null); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.main); SupportActionBar.SetDisplayShowHomeEnabled(true); SupportActionBar.SetIcon(Resource.Drawable.img_avast_logo_small); FindViewById(Resource.Id.message_dialog).Click += (sender, e) => { SimpleDialogFragment.CreateBuilder(this, SupportFragmentManager).SetMessage("Love. Can know all the math in the \'verse but take a boat in the air that you don\'t " + "love? She\'ll shake you off just as sure as a turn in the worlds. Love keeps her in the air when " + "she oughtta fall down...tell you she\'s hurtin\' \'fore she keens...makes her a home.").Show(); }; FindViewById(Resource.Id.message_title_dialog).Click += (sender, e) => { SimpleDialogFragment.CreateBuilder(this, SupportFragmentManager).SetTitle("More Firefly quotes:").SetMessage("Wash: \"Psychic, though? That sounds like something out of science fiction.\"\n\nZoe: \"We live" + " " + "in a space ship, dear.\"\nWash: \"Here lies my beloved Zoe, " + ("my autumn flower ... somewhat less attractive now that she's all corpsified and gross" + ".\"\n\nRiver Tam: \"Also? I can kill you with my brain.\"\n\nKayle: \"Going on a year now, nothins twixed my neathers not run on batteries.\" \n" + "Mal: \"I can't know that.\" \n" + "Jayne: \"I can stand to hear a little more.\"\n\nWash: \"I've been under fire before. " + "Well ... I've been in a fire. Actually, I was fired. I can handle myself.\"")).SetNegativeButtonText("Close").Show(); }; FindViewById(Resource.Id.message_title_buttons_dialog).Click += (sender, e) => { SimpleDialogFragment.CreateBuilder(this, SupportFragmentManager).SetTitle("Do you like this quote?").SetMessage("Jayne: \"Shiny. Let's be bad guys.\"").SetPositiveButtonText("Love").SetNegativeButtonText("Hate").SetNeutralButtonText("WTF?").SetRequestCode(REQUEST_SIMPLE_DIALOG).Show(); }; FindViewById(Resource.Id.long_buttons).Click += (sender, e) => { SimpleDialogFragment.CreateBuilder(this, SupportFragmentManager).SetMessage("How will you decide?").SetPositiveButtonText("Time for some thrillin' heroics!").SetNegativeButtonText("Misbehave").SetNeutralButtonText("Keep flying").Show(); }; FindViewById(Resource.Id.progress_dialog).Click += (sender, e) => { ProgressDialogFragment.CreateBuilder(this, SupportFragmentManager).SetMessage("Mal: I\'m just waiting to see if I pass out. Long story.").SetRequestCode(REQUEST_PROGRESS).Show(); }; FindViewById(Resource.Id.list_dialog_simple).Click += (sender, e) => { ListDialogFragment.CreateBuilder(this, SupportFragmentManager).SetTitle("Your favorite character:").SetItems(new string[] { "Jayne", "Malcolm", "Kaylee", "Wash", "Zoe", "River" }).SetRequestCode(REQUEST_LIST_SIMPLE).Show(); }; FindViewById(Resource.Id.list_dialog_single).Click += (sender, e) => { ListDialogFragment.CreateBuilder(this, SupportFragmentManager).SetTitle("Your favorite character:").SetItems(new string[] { "Jayne", "Malcolm", "Kaylee", "Wash", "Zoe", "River" }).SetRequestCode(REQUEST_LIST_SINGLE).SetChoiceMode(AbsListViewChoiceMode.Single).Show(); }; FindViewById(Resource.Id.list_dialog_multiple).Click += (sender, e) => { ListDialogFragment.CreateBuilder(this, SupportFragmentManager).SetTitle("Your favorite character:").SetItems(new string[] { "Jayne", "Malcolm", "Kaylee", "Wash", "Zoe", "River" }).SetRequestCode(REQUEST_LIST_MULTIPLE).SetChoiceMode(AbsListViewChoiceMode.Multiple).SetCheckedItems(new int[] { 1, 3 }).Show(); }; FindViewById(Resource.Id.custom_dialog).Click += (sender, e) => { JayneHatDialogFragment.Show(this); }; FindViewById(Resource.Id.time_picker).Click += (sender, e) => { TimePickerDialogFragment.CreateBuilder(this, SupportFragmentManager).SetDate(new Date()).SetPositiveButtonText(Android.Resource.String.Ok).SetNegativeButtonText(Android.Resource.String.Cancel).SetRequestCode(REQUEST_TIME_PICKER).Show(); }; FindViewById(Resource.Id.date_picker).Click += (sender, e) => { DatePickerDialogFragment.CreateBuilder(this, SupportFragmentManager).SetDate(new Date()).SetPositiveButtonText(Android.Resource.String.Ok).SetNegativeButtonText(Android.Resource.String.Cancel).SetRequestCode(REQUEST_DATE_PICKER).Show(); }; }
private void OnLogoutClicked() { SimpleDialogFragment.Create(new SimpleDialogProvider { TitleResId = Resource.String.LogoutConfirm_Title, MessageResId = Resource.String.LogoutConfirm_Message, PositiveButtonResId = Resource.String.Confirm, NegativeButtonResId = Resource.String.Cancel, ExtTagKey = LogoutDialog, CanceledOnTouchOutside = false, }).Show(SupportFragmentManager); }
public void ProcessDownloadResult(DownloadResult result, int bookId) { var dialogTag = SimpleDialogFragment.FindFragmentTagByExtraTag( this, (extTagKey, extTag) => extTagKey == PublicationExtInfo.CANCELDOWNLOAD_CONFIRM_DIALOG_EXTRATAG && Int32.Parse(extTag) == bookId); if (dialogTag != null) { SimpleDialogFragment.DismissDialog(this, dialogTag); } switch (result.DownloadStatus) { case DownLoadEnum.Success: // need not do any thing. break; case DownLoadEnum.Canceled: // need not do any thing. break; case DownLoadEnum.Failure: DialogGenerator.ShowMessageDialog( SupportFragmentManager, Resource.String.DetailInfo_InstallError_Title, Resource.String.DetailInfo_InstallError_Message); break; case DownLoadEnum.OverLimitation: // raise a dialog; DialogGenerator.ShowMessageDialog( this.SupportFragmentManager, Resource.String.NetworkFlow_Warning_Title, Resource.String.NetworkFlow_Warning_Message, Resource.String.NetworkFlow_Warning_Download, 0, NetworkFlowOverLimitationDialog); break; case DownLoadEnum.NetDisconnected: DialogGenerator.ShowMessageDialog( SupportFragmentManager, Resource.String.DownloadFailded_NetDisconnected_Title, Resource.String.DownloadFailded_NetDisconnected_Message); break; } this.UpdatePublicationDownloadingProgress(bookId); this.UpdatePublicationDetailInfo(bookId); }
public void ClosePleaseWaitPageLoadDialog() { LogHelper.Debug("dbg", "RotateWait::Try to find Wait"); var dialogTag = SimpleDialogFragment.FindFragmentTagByExtraTag( this, (extTagKey, extTag) => extTagKey == WebViewManager.PleaseWaitPageLoadDialogExtTagKey); if (dialogTag != null) { LogHelper.Debug("dbg", "RotateWait::Fount Wait, and close it"); SimpleDialogFragment.DismissDialog(this, dialogTag); } LogHelper.Debug("dbg", "RotateWait::Wait should be closed here."); }
public void ShowPleaseWaitDialog() { LogHelper.Debug("dbg", "RotateWait::Try to find wait"); var dialogTag = SimpleDialogFragment.FindFragmentTagByExtraTag( this, (extTagKey, extTag) => extTagKey == WebViewManager.PleaseWaitPageLoadDialogExtTagKey); if (dialogTag == null) { LogHelper.Debug("dbg", "RotateWait::Not found Wait"); DialogGenerator.ShowWaitDialog( SupportFragmentManager, 0, WebViewManager.PleaseWaitPageLoadDialogExtTagKey); } LogHelper.Debug("dbg", "RotateWait::The Wait is shown here."); }
private async void ProcessSend() { ILoginActivity loginActivity = Activity as ILoginActivity; if (loginActivity == null) { return; } var dialogTag = DialogGenerator.ShowWaitDialog(FragmentManager); var result = await LoginUtil.Instance.ChangePassword(etNewPassword.Text, etRetypeNewPassword.Text); AsyncUIOperationRepeater.INSTATNCE.SubmitAsyncUIOperation( (IAsyncTaskActivity)Activity, a => { SimpleDialogFragment.DismissDialog(((FragmentActivity)a), dialogTag); ProcessResetPasswordResult(result); }); }
private async void processReminderPassword() { ILoginActivity loginActivity = Activity as ILoginActivity; if (loginActivity == null) { return; } var dialogTag = DialogGenerator.ShowWaitDialog(FragmentManager); var result = await LoginUtil.Instance.ResetPassword( etEmail.Text, ConfigurationService.GetAllCountryMap()[selectCountryIndex].CountryCode); AsyncUIOperationRepeater.INSTATNCE.SubmitAsyncUIOperation( (IAsyncTaskActivity)Activity, a => { SimpleDialogFragment.DismissDialog(((FragmentActivity)a), dialogTag); ProcessResetPasswordResult(result); }); }
public override bool OnOptionsItemSelected(IMenuItem item) { switch (item.ItemId) { case Android.Resource.Id.Home: { ((ContentActivity)Activity).CloseContent(); } break; case Resource.Id.action_organisepublications: { Intent intent = new Intent(Activity, typeof(SettingsBoardActivity)); intent.PutExtra( SettingsBoardActivity.FunctionKey, SettingsBoardActivity.OrganisePublications); StartActivity(intent); } break; case Resource.Id.action_termsconditions: { Intent intent = new Intent(Activity, typeof(SettingsBoardActivity)); intent.PutExtra( SettingsBoardActivity.FunctionKey, SettingsBoardActivity.TermsAndConditions); StartActivity(intent); } break; case Resource.Id.action_publicationtext: { var publicationTextDialogFragment = new PublicationTextDialogFragment(); publicationTextDialogFragment.Show(FragmentManager.BeginTransaction(), "publicationTextDialogFragment"); } break; case Resource.Id.action_about_lnlegalprofessional: { Intent intent = new Intent(Activity, typeof(SettingsBoardActivity)); intent.PutExtra( SettingsBoardActivity.FunctionKey, SettingsBoardActivity.LNLegalAndProfessional); StartActivity(intent); } break; case Resource.Id.action_about_lnred: { Intent intent = new Intent(Activity, typeof(SettingsBoardActivity)); intent.PutExtra( SettingsBoardActivity.FunctionKey, SettingsBoardActivity.LNRed); StartActivity(intent); } break; case Resource.Id.action_faq: { Intent intent = new Intent(Activity, typeof(SettingsBoardActivity)); intent.PutExtra( SettingsBoardActivity.FunctionKey, SettingsBoardActivity.FAQs); StartActivity(intent); } break; case Resource.Id.action_contactus: { Intent intent = new Intent(Activity, typeof(SettingsBoardActivity)); intent.PutExtra( SettingsBoardActivity.FunctionKey, SettingsBoardActivity.Contact); StartActivity(intent); } break; case Resource.Id.action_logout: { SimpleDialogFragment.Create(new SimpleDialogProvider() { TitleResId = Resource.String.LogoutConfirm_Title, MessageResId = Resource.String.LogoutConfirm_Message, PositiveButtonResId = Resource.String.Confirm, NegativeButtonResId = Resource.String.Cancel, ExtTagKey = LogoutDialog, CanceledOnTouchOutside = false, }).Show(Activity.SupportFragmentManager); } break; default: return(base.OnOptionsItemSelected(item)); } return(true); }
public void LoadUrl(Hyperlink url) { var bookId = ((ContentActivity)Activity).Publication.Value.BookId; switch (url.LinkType) { case HyperLinkType.IntraHyperlink: { var intralink = url as IntraHyperlink; NavigationManager.Instance.AddRecord( new ContentBrowserRecord( bookId, intralink.TOCID, 0, 0, intralink.Refpt)); NavigateTo(bookId); } break; case HyperLinkType.InternalHyperlink: { var internallink = url as InternalHyperlink; NavigationManager.Instance.AddRecord( new ContentBrowserRecord( internallink.BookID, internallink.TOCID, 0, 0, internallink.Refpt)); NavigateTo(bookId); } break; case HyperLinkType.ExternalHyperlink: { var exterlink = url as ExternalHyperlink; Uri uri = Uri.Parse(exterlink.Url.Replace("file:///android_asset/html/", "http://")); var intent = new Intent(Intent.ActionView, uri); intent.PutExtra(Browser.ExtraApplicationId, Activity.PackageName); Activity.StartActivity(intent); } break; case HyperLinkType.AttachmentHyperlink: { var attachmentlink = url as AttachmentHyperlink; var fullPath = System.IO.Path.Combine( FileDirectory.AppExternalStorage, attachmentlink.TargetFileName); var intent = new Intent(Intent.ActionView); intent.AddCategory(Intent.CategoryDefault); intent.AddFlags(ActivityFlags.NewTask); var file = new Java.IO.File(fullPath); if (attachmentlink.FileType == FileType.PDF) { intent.SetDataAndType(Uri.FromFile(file), "application/pdf"); } else if (attachmentlink.FileType == FileType.Word) { intent.SetDataAndType(Uri.FromFile(file), "application/msword"); } try { Activity.StartActivity(intent); } catch (ActivityNotFoundException) { SimpleDialogFragment.Create(new SimpleDialogProvider { TitleResId = Resource.String.InstallOfficeDialog_Title, MessageResId = Resource.String.InstallOfficeDialog_Message, PositiveButtonResId = Resource.String.OK, NegativeButtonResId = 0, ExtTagKey = ContentActivity.InstallOfficeAppDialog, DismissAfterProcessRestore = true, CanceledOnTouchOutside = false, Cancelable = false, }).Show(Activity.SupportFragmentManager); } } break; default: throw new InvalidProgramException("Unknown link type."); } }