Show() public method

Reveals the message box by inserting it into a popup and opening it.
public Show ( ) : void
return void
Esempio n. 1
0
        public Task <InputResponse> InputAsync(string message, string placeholder = null, string title = null, string okButton = "OK",
                                               string cancelButton = "Cancel", string initialText      = null)
        {
            var textBox = new PhoneTextBox {
                Hint = placeholder
            };

            var box = new Microsoft.Phone.Controls.CustomMessageBox()
            {
                Caption            = title,
                Message            = message,
                LeftButtonContent  = okButton,
                RightButtonContent = cancelButton,
                Content            = textBox
            };

            var response = new TaskCompletionSource <InputResponse>();

            box.Dismissed += (sender, args) => response.TrySetResult(new InputResponse()
            {
                Ok   = args.Result == CustomMessageBoxResult.LeftButton,
                Text = textBox.Text
            });
            box.Show();
            return(response.Task);
        }
        /// <summary>
        /// Shows a message in the dialog.
        /// </summary>
		/// <param name="message">The message to show.</param>
        public void Show(string message)
        {
            CustomMessageBox messageBox = new CustomMessageBox()
            {
                Message = message
            };

            messageBox.Show();
        }
        /// <summary>
        /// Shows a message with a caption in the dialog.
        /// </summary>
        /// <param name="message">The message to show.</param>
        /// <param name="caption">The caption of the dialog.</param>
        public void Show(string message, string caption)
        {
            CustomMessageBox messageBox = new CustomMessageBox()
            {
                Caption = caption,
                Message = message
            };

            messageBox.Show();
        }
Esempio n. 4
0
        public Task <ConfirmThreeButtonsResponse> ConfirmThreeButtonsAsync(string message, string title = null, string positive = "Yes", string negative = "No", string neutral = "Maybe")
        {
            StackPanel contents = new StackPanel();

            contents.Orientation = Orientation.Vertical;
            var positiveButton = new Button()
            {
                Content = positive
            };
            var neutralButton = new Button()
            {
                Content = neutral
            };
            var negativeButton = new Button()
            {
                Content = negative
            };

            contents.Children.Add(positiveButton);
            contents.Children.Add(neutralButton);
            contents.Children.Add(negativeButton);

            var box = new Microsoft.Phone.Controls.CustomMessageBox()
            {
                Caption              = title,
                Message              = message,
                IsLeftButtonEnabled  = false,
                IsRightButtonEnabled = false,
                Content              = contents
            };

            var response = new TaskCompletionSource <ConfirmThreeButtonsResponse>();

            positiveButton.Click += (sender, args) =>
            {
                response.TrySetResult(ConfirmThreeButtonsResponse.Positive);
                box.Dismiss();
            };
            neutralButton.Click += (sender, args) =>
            {
                response.TrySetResult(ConfirmThreeButtonsResponse.Neutral);
                box.Dismiss();
            };
            negativeButton.Click += (sender, args) =>
            {
                response.TrySetResult(ConfirmThreeButtonsResponse.Negative);
                box.Dismiss();
            };
            box.Show();
            return(response.Task);
        }
 public Task AlertAsync(string message, string title = "", string okButton = "OK")
 {
     var box = new Microsoft.Phone.Controls.CustomMessageBox()
     {
         Caption = title,
         Message = message,
         LeftButtonContent = okButton,
         IsRightButtonEnabled = false
     };
     var complete = new TaskCompletionSource<bool>();
     box.Dismissed += (sender, args) => complete.TrySetResult(true);
     box.Show();
     return complete.Task;
 }
 public Task<bool> ConfirmAsync(string message, string title = "", string okButton = "OK", string cancelButton = "Cancel")
 {
     var box = new Microsoft.Phone.Controls.CustomMessageBox()
     {
         Caption = title,
         Message = message,
         LeftButtonContent = okButton,
         RightButtonContent = cancelButton
     };
     var complete = new TaskCompletionSource<bool>();
     box.Dismissed += (sender, args) => complete.TrySetResult(args.Result == CustomMessageBoxResult.LeftButton);
     box.Show();
     return complete.Task;
 }
Esempio n. 7
0
        public Task AlertAsync(string message, string title = "", string okButton = "OK")
        {
            var box = new Microsoft.Phone.Controls.CustomMessageBox()
            {
                Caption              = title,
                Message              = message,
                LeftButtonContent    = okButton,
                IsRightButtonEnabled = false
            };
            var complete = new TaskCompletionSource <bool>();

            box.Dismissed += (sender, args) => complete.TrySetResult(true);
            box.Show();
            return(complete.Task);
        }
Esempio n. 8
0
        public Task <bool> ConfirmAsync(string message, string title = "", string okButton = "OK", string cancelButton = "Cancel")
        {
            var box = new Microsoft.Phone.Controls.CustomMessageBox()
            {
                Caption            = title,
                Message            = message,
                LeftButtonContent  = okButton,
                RightButtonContent = cancelButton
            };
            var complete = new TaskCompletionSource <bool>();

            box.Dismissed += (sender, args) => complete.TrySetResult(args.Result == CustomMessageBoxResult.LeftButton);
            box.Show();
            return(complete.Task);
        }
Esempio n. 9
0
        public override Task Execute(object option)
        {
            var messageBox = new CustomMessageBox
            {
                Caption = Service.Current.Messages["Delete"],
                Message = Service.Current.Messages["AskForDeleteItems"],
                LeftButtonContent = Service.Current.Messages["Delete"],
                RightButtonContent = Service.Current.Messages["Cancel"]
            };

            var waiter = new AutoResetEvent(false);
            messageBox.Dismissed += async (s1, e1) =>
            {
                if (e1.Result == CustomMessageBoxResult.LeftButton)
                    await base.Execute(option);

                waiter.Set();
            };

            messageBox.Show();

            return Task.Factory.StartNew(() => waiter.WaitOne());
        }
Esempio n. 10
0
		private async void check_click(object sender, RoutedEventArgs e)
		{
			bool isNetwork = NetworkInterface.GetIsNetworkAvailable();

			if (isNetwork)
			{
				try
				{
					WorldBuilding worldbuildings1 = await CustomPushpinWp8APIClient.GetWorldBuildings();
					if (worldbuildings1.buildings.Count > Helper.worldbuildings.buildings.Count)
					{
						CustomMessageBox messageBox = new CustomMessageBox()
						{
							Caption = "Buildings",
							Message = "New Buildings found. Do you want to download them?",
							LeftButtonContent = "yes",
							RightButtonContent = "no"
						};
						messageBox.Dismissed += (s1, e1) =>
						{
							switch (e1.Result)
							{
								case CustomMessageBoxResult.LeftButton:
									downloading.Visibility = Visibility.Visible;
									downloaded = true;
                                    downloadData();
									break;
								case CustomMessageBoxResult.RightButton:
									// Do something.
									break;
								case CustomMessageBoxResult.None:
									// Do something.
									break;
								default:
									break;
							}
						};

						messageBox.Show();
					}
					else
						MessageBox.Show("No new Buildings found!");
				}
				catch
				{
					MessageBox.Show("Can not check for update. Please check your connection and try again!");
				}
			}
			else
				MessageBox.Show("No internet connection found. Please check your internet connection and try again later!", "No Internet Connection", MessageBoxButton.OK);

		}
       public Task<InputResponse> InputAsync(string message, string placeholder = null, string title = null, string okButton = "OK",
            string cancelButton = "Cancel", string initialText = null)
        {
            var textBox = new PhoneTextBox { Hint = placeholder };

            var box = new Microsoft.Phone.Controls.CustomMessageBox()
            {
                Caption = title,
                Message = message,
                LeftButtonContent = okButton,
                RightButtonContent = cancelButton,
                Content = textBox
            };

            var response = new TaskCompletionSource<InputResponse>();
            box.Dismissed += (sender, args) => response.TrySetResult(new InputResponse()
            {
                Ok = args.Result == CustomMessageBoxResult.LeftButton,
                Text = textBox.Text
            });
            box.Show();
            return response.Task;
        }
        public Task<ConfirmThreeButtonsResponse> ConfirmThreeButtonsAsync(string message, string title = null, string positive = "Yes", string negative = "No", string neutral = "Maybe")
        {
            StackPanel contents = new StackPanel();
            contents.Orientation = Orientation.Vertical;
            var positiveButton = new Button() { Content = positive };
            var neutralButton = new Button() { Content = neutral };
            var negativeButton = new Button() { Content = negative };
            contents.Children.Add(positiveButton);
            contents.Children.Add(neutralButton);
            contents.Children.Add(negativeButton);

            var box = new Microsoft.Phone.Controls.CustomMessageBox()
            {
                Caption = title,
                Message = message,
                IsLeftButtonEnabled = false,
                IsRightButtonEnabled = false,
                Content = contents
            };

            var response = new TaskCompletionSource<ConfirmThreeButtonsResponse>();
            positiveButton.Click += (sender, args) =>
            {
                response.TrySetResult(ConfirmThreeButtonsResponse.Positive);
                box.Dismiss();
            };
            neutralButton.Click += (sender, args) =>
            {
                response.TrySetResult(ConfirmThreeButtonsResponse.Neutral);
                box.Dismiss();
            };
            negativeButton.Click += (sender, args) =>
            {
                response.TrySetResult(ConfirmThreeButtonsResponse.Negative);
                box.Dismiss();
            };
            box.Show();
            return response.Task;


        }