当前位置: 首页>>代码示例>>C#>>正文


C# Page.DisplayAlert方法代码示例

本文整理汇总了C#中Xamarin.Forms.Page.DisplayAlert方法的典型用法代码示例。如果您正苦于以下问题:C# Page.DisplayAlert方法的具体用法?C# Page.DisplayAlert怎么用?C# Page.DisplayAlert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Xamarin.Forms.Page的用法示例。


在下文中一共展示了Page.DisplayAlert方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GuardarUser

 private async void GuardarUser()
 {
     _user.Avatar = "";
     var page = new Page();
     try
     {
         IsBusy = true;
         var r = await _servicio.AddUsuario(_user);
         if (r != null)
         {
             await page.DisplayAlert(Strings.UserCreatedTitle, 
                 Strings.UserCreatedText, Strings.Ok);
             await _navigator.PushModalAsync<LoginViewModel>();
         }
         else
         {
             var a = "";
         }
     }
     catch (Exception e)
     {
         
         await page.DisplayAlert(Strings.Error, Strings.UserAlreadyText, Strings.Ok);
     }
     finally
     {
         IsBusy = false;
     }
 }
开发者ID:AlvaroDama,项目名称:RedSocial,代码行数:29,代码来源:RegistroViewModel.cs

示例2: IniciarSesion

        private async void IniciarSesion()
        {
            var page = new Page();
            try
            {
                IsBusy = true;
                var us = await _servicio.ValidarUsuario(_login);

                if (us != null)
                {
                    await _navigator.PopToRootAsync();
                    await _navigator.PushAsync<ContactosViewModel>(viewModel =>
                    {
                        Titulo = "Inicio de sesión";
                    });
                }
                else
                {
                    var xx = ""; //para comprobar que se haga bien.
                }

                //TODO: aquí navegaríamos a la pantalla principal o daríamos error
                await page.DisplayAlert(Strings.Error, Strings.UserDoesNotExist, Strings.Ok);
            }
            catch (Exception e)
            {
                await page.DisplayAlert(Strings.Error, e.Message, Strings.Ok);
            }
            finally
            {
                IsBusy = false;
            }
        }
开发者ID:AlvaroDama,项目名称:RedSocial,代码行数:33,代码来源:LoginViewModel.cs

示例3: FundsTransferViewModel

		public FundsTransferViewModel (INavigation navigation, Page currentPage)
		{
			Navigation = navigation;
			CancelCommand = new Command(async () => await Navigation.PopAsync());
			TransferCommand = new Command(async () => await currentPage.DisplayAlert("Transfer", "Success", "Ok"));

		}
开发者ID:nishanil,项目名称:MobileBanking-Forms,代码行数:7,代码来源:FundsTransferViewModel.cs

示例4: Show

        public async void Show(Page callingPage)
        {
            RateFeedbackResult result = RateFeedbackResult.None;

            await Task.Delay(1);
     
           // var rateAnswer = await callingPage.DisplayAlert(RateMessageTitle, RateMessage, RateButtonLabel, RateCancelLabel);

            callingPage.DisplayAlert(RateMessageTitle, RateMessage, RateButtonLabel, RateCancelLabel).ContinueWith(r =>
            {
                if (r.Result)
                {
                    IAppRater rater = DependencyService.Get<IAppRater>();
                    rater.RateApp(this.AppId);
                    result = RateFeedbackResult.Rate;

                    this.RateFeedbackCompleted(callingPage, new RateFeedbackEventArgs(result));
                }
                else
                {
                  //  var feedbackAnswer = await callingPage.DisplayAlert(FeebackMessageTitle, FeebackMessage, FeebackButtonLabel, FeebackCancelLabel);
                    callingPage.DisplayAlert(FeebackMessageTitle, FeebackMessage, FeebackButtonLabel, FeebackCancelLabel).ContinueWith(f =>
                    {
                        if (f.Result)
                        {
                            IEmailComposer emailer = DependencyService.Get<IEmailComposer>();
                            emailer.SendEmail(FeedbackEmail, FeedbackSubject, FeedbackBody);
                            result = RateFeedbackResult.Feedback;

                            this.RateFeedbackCompleted(callingPage, new RateFeedbackEventArgs(result));
                        }
                        else
                        {
                            this.RateFeedbackCompleted(callingPage, new RateFeedbackEventArgs(result));
                        }
                    }, TaskScheduler.FromCurrentSynchronizationContext()
                    );
                }
            }, TaskScheduler.FromCurrentSynchronizationContext()
            ); 

        }
开发者ID:pedroccrl,项目名称:Xamarin.Plugins-1,代码行数:42,代码来源:RateFeedbackDialog.cs

示例5: ListenerBindView

        public ListenerBindView(int defaultPort, Page parentPage)
        {
            _parentPage = parentPage;

            var portEntry = new Entry()
            {
                Placeholder = "Listen Port",
                Text = defaultPort.ToString(),
                HorizontalOptions = LayoutOptions.Start
            };

            var listenButton = new Button
            {
                Text = "Start Listening",
            };


            // listen / stop listening 
            listenButton.Clicked += async (sender, args) => 
            {
                // if not already listening
                if (!_listening)
                {
                    if (StartListeningTapped == null) return;

                    // check valid port
                    var port = -1;
                    var isNumeric = Int32.TryParse(portEntry.Text, out port);

                    if (!isNumeric || ((port < 1001 || port > 65535)))
                    {
                        await _parentPage.DisplayAlert("Invalid Port", "Port must be numeric value between 1001 & 65535", "My bad");
                        return;
                    }

                    // callback
                    if (await StartListeningTapped(port))
                    {
                        _listening = true;
                        listenButton.Text = "Stop Listening";
                    };
                }
                else
                {
                    if (StopListeningTapped == null) return;

                    // callback
                    await StopListeningTapped();
                    _listening = false;
                    listenButton.Text = "Start Listening";
                }
                
            };

            Content = new StackLayout
            {
                Orientation = StackOrientation.Horizontal,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Children =
                {
                    new Label { 
                        Text = "Listen port:", 
                        VerticalOptions = LayoutOptions.CenterAndExpand 
                    },
                    portEntry, 
                    listenButton
                }
            };
        }
开发者ID:Elecstrap,项目名称:sockets-for-pcl,代码行数:69,代码来源:ListenerBindView.cs

示例6: InformUser

		public static void InformUser(Page page, string message)
		{
			page.DisplayAlert ("Information", message, "OK");
		}
开发者ID:instantiator,项目名称:BAASBox.CRUD.UI,代码行数:4,代码来源:UIHelper.cs

示例7: WarnUser

		public static void WarnUser(Page page, string warning)
		{
			page.DisplayAlert ("Warning", warning, "OK");
		}
开发者ID:instantiator,项目名称:BAASBox.CRUD.UI,代码行数:4,代码来源:UIHelper.cs

示例8: ClientConnectView

        public ClientConnectView(string defaultAddress, int defaultPort, Page parentPage)
        {
            _parentPage = parentPage;

            var addressEntry = new Entry
            {
                Placeholder = "Address",
                Text = defaultAddress,
                HorizontalOptions = LayoutOptions.StartAndExpand
            };

            var portEntry = new Entry()
            {
                Placeholder = "Port",
                Text = defaultPort.ToString(),
                HorizontalOptions = LayoutOptions.Start
            };

            var connectButton = new Button
            {
                Text = "Connect",
            };


            // connect / disconnect
            connectButton.Clicked += async (sender, args) => 
            {
                // if not already connected
                if (!_connected)
                {
                    if (ConnectTapped == null) return;

                    var address = addressEntry.Text;
                    // check valid port
                    var port = -1;
                    var isNumeric = Int32.TryParse(portEntry.Text, out port);

                    if (!isNumeric || ((port < 1001 || port > 65535)))
                    {
                        await _parentPage.DisplayAlert("Invalid Port", "Port must be numeric value between 1001 & 65535", "My bad");
                        return;
                    }

                    // callback
                    if (await ConnectTapped(address, port))
                    {
                        _connected = true;
                        connectButton.Text = "Disconnect";
                    };
                }
                else
                {
                    if (DisconnectTapped == null) return;

                    // callback
                    await DisconnectTapped();
                    _connected = false;
                    connectButton.Text = "Start Listening";
                }
                
            };

            Content = new StackLayout
            {
                Orientation = StackOrientation.Horizontal,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Children =
                {
                    new Label { 
                        Text = "Connect to:", 
                        VerticalOptions = LayoutOptions.CenterAndExpand 
                    },
                    addressEntry,
                    portEntry, 
                    connectButton
                }
            };
        }
开发者ID:Elecstrap,项目名称:sockets-for-pcl,代码行数:78,代码来源:ClientConnectView.cs


注:本文中的Xamarin.Forms.Page.DisplayAlert方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。