當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。