コード例 #1
0
		public virtual Task AlertAsync(AlertConfig config)
		{
			var tcs = new TaskCompletionSource<object>();
			config.OnOk = () => tcs.TrySetResult(null);
			this.Alert(config);
			return tcs.Task;
		}
コード例 #2
0
ファイル: UserDialogService.cs プロジェクト: Surfoo/WF.Player
		public override void Alert(AlertConfig config)
		{
			Xamarin.Forms.Device.BeginInvokeOnMainThread(() =>
				new AlertDialog
				.Builder(this.getTopActivity())
				.SetCancelable(false)
				.SetMessage(config.Message)
				.SetTitle(config.Title)
				.SetPositiveButton(config.OkText, (o, e) => config.OnOk.TryExecute())
				.Show()
			);
		}
コード例 #3
0
ファイル: UserDialogService.cs プロジェクト: Surfoo/WF.Player
		public override void Alert(AlertConfig config)
		{
			UIApplication.SharedApplication.InvokeOnMainThread(() =>
				{
					if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0))
					{
						var alert = UIAlertController.Create(config.Title ?? String.Empty, config.Message, UIAlertControllerStyle.Alert);
						alert.AddAction(UIAlertAction.Create(Catalog.GetString("Ok"), UIAlertActionStyle.Default, x =>
								{
									if (config.OnOk != null)
										config.OnOk();
								}));
						this.Present(alert);
					}
					else
					{
						var dlg = new UIAlertView(config.Title ?? String.Empty, config.Message, null, null, config.OkText);
						if (config.OnOk != null)
							dlg.Clicked += (s, e) => config.OnOk();
						dlg.Show();
					}
				});
		}
コード例 #4
0
		public abstract void Alert(AlertConfig config);