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


C# Popups.MessageDialog类代码示例

本文整理汇总了C#中Windows.UI.Popups.MessageDialog的典型用法代码示例。如果您正苦于以下问题:C# MessageDialog类的具体用法?C# MessageDialog怎么用?C# MessageDialog使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MessageDialog类属于Windows.UI.Popups命名空间,在下文中一共展示了MessageDialog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Button_Click

        private async void Button_Click(object sender, RoutedEventArgs e)
        {
            if (CountryPhoneCode.SelectedItem != null)
            {
                var _id = Guid.NewGuid().ToString("N");
                var _countryPhoneCode = (CountryPhoneCode.SelectedItem as Country).PhoneCode;
                var _countryName = (CountryPhoneCode.SelectedItem as Country).CountryName;
                var _name = FullName.Text;
                var _phoneNumber = PhoneNumber.Text;
                var _password = Password.Password;

                var client = new HttpClient()
                {
                    BaseAddress = new Uri("http://yochat.azurewebsites.net/chat/")
                };

                var json = await client.GetStringAsync("createuser?id=" + _id + "&fullName=" + _name + "&password=" + _password + "&phoneNumber=" + _phoneNumber + "&countryPhoneCode=" + _countryPhoneCode);

                var serializer = new DataContractJsonSerializer(typeof(User));
                var ms = new MemoryStream();
                var user = serializer.ReadObject(ms) as User;

                Frame.Navigate(typeof(MainPage), user);
            }
            else
            {
                MessageDialog dialog = new MessageDialog("Lütfen Ülkenizi Seçiniz!");
                await dialog.ShowAsync();
            }
        }
开发者ID:yavuzgedik,项目名称:Windows10_UWP,代码行数:30,代码来源:LoginPage.xaml.cs

示例2: saveConf_Click

        private async void saveConf_Click(object sender, RoutedEventArgs e)
        {
            if(serverExt.Text == "" && token.Text == "" && port.Text == "" && serverInt.Text == "")
            {
                MessageDialog msgbox = new MessageDialog("Un ou plusieurs champs sont vide...");
                await msgbox.ShowAsync(); 
            }
            else
            {
                localSettings.Values["savedServerExt"] = serverExt.Text;
                localSettings.Values["savedServerInt"] = serverInt.Text;
                localSettings.Values["savedToken"] = token.Text;
                localSettings.Values["savedPort"] = port.Text;

                if (tts.IsOn)
                {
                    localSettings.Values["tts"] = true;
                }
                else localSettings.Values["tts"] = false;

                Frame.Navigate(typeof(PageAction));
            }
            
           
        }
开发者ID:gwenoleR,项目名称:yana_for_WP8.1,代码行数:25,代码来源:configPage.xaml.cs

示例3: ButtonRequestToken_Click

        private async void ButtonRequestToken_Click(object sender, RoutedEventArgs e)
        {
            var error = string.Empty;

            try
            {
                var response = await WebAuthentication.DoImplicitFlowAsync(
                    endpoint: new Uri(Constants.AS.OAuth2AuthorizeEndpoint),
                    clientId: Constants.Clients.ImplicitClient,
                    scope: "read");

                TokenVault.StoreToken(_resourceName, response);
                RetrieveStoredToken();

            }
            catch (Exception ex)
            {
                error = ex.Message;
            }

            if (!string.IsNullOrEmpty(error))
            {
                var dialog = new MessageDialog(error);
                await dialog.ShowAsync();
            }
        }
开发者ID:nanderto,项目名称:Thinktecture.AuthorizationServer,代码行数:26,代码来源:MainPage.xaml.cs

示例4: RetriveUserInfo

        private async System.Threading.Tasks.Task RetriveUserInfo(AccessTokenData accessToken)
        {
            var client = new Facebook.FacebookClient(accessToken.AccessToken);

			dynamic result = null;
			bool failed = false;
			try
			{
				result = await client.GetTaskAsync("me?fields=id,birthday,first_name,last_name,middle_name,gender");
			}
			catch(Exception e)
			{
				failed = true;
			}
			if(failed)
			{
				MessageDialog dialog = new MessageDialog("Facebook is not responding to our authentication request. Sorry.");
				await dialog.ShowAsync();

				throw new Exception("Windows phone does not provide an exit function, so we have to crash the app.");
			}
            string fullName = string.Join(" ", new[] { result.first_name, result.middle_name, result.last_name });
            string preferredName = result.last_name;
            bool? gender = null;
            if (result.gender == "female")
            {
                gender = true;
            }
            else if (result.gender == "male")
            {
                gender = false;
            }
            DateTime birthdate = DateTime.UtcNow - TimeSpan.FromDays(365 * 30);
            if (result.birthday != null)
            {
                birthdate = DateTime.Parse(result.birthday);
            }

            var currentUser = new Facebook.Client.GraphUser(result);

            long facebookId = long.Parse(result.id);

            UserState.ActiveAccount = await Api.Do.AccountFacebook(facebookId);
            if (UserState.ActiveAccount == null)
            {
                Frame.Navigate(typeof(CreatePage), new CreatePage.AutofillInfo
                    {
                        SocialId = facebookId,
						Authenticator = Authenticator.Facebook,
                        Birthdate = birthdate,
                        FullName = fullName,
                        Gender = gender,
                        PreferredName = preferredName
                    });
            }
            else
            {
                Frame.Navigate(typeof(MainPage), UserState.CurrentId);
            }
        }
开发者ID:tblue1994,项目名称:SoftwareEngineeringProject2015,代码行数:60,代码来源:FacebookAuthentication.xaml.cs

示例5: CreateGraphics

        // Create three List<Graphic> objects with random graphics to serve as layer GraphicsSources
        private async void CreateGraphics()
        {
			try
			{
				await MyMapView.LayersLoadedAsync();

				_graphicsSources = new List<List<Graphic>>()
				{
					new List<Graphic>(),
					new List<Graphic>(),
					new List<Graphic>()
				};

				foreach (var graphicList in _graphicsSources)
				{
					for (int n = 0; n < 10; ++n)
					{
						graphicList.Add(CreateRandomGraphic());
					}
				}

				_graphicSourceIndex = 0;
				_graphicsLayer.GraphicsSource = _graphicsSources[_graphicSourceIndex];
			}
			catch (Exception ex)
			{
				var _x = new MessageDialog("Exception occurred : " + ex.ToString(), "Sample error").ShowAsync();
			}
        }
开发者ID:jordanparfitt,项目名称:arcgis-runtime-samples-dotnet,代码行数:30,代码来源:GraphicsSourceSample.xaml.cs

示例6: LogoutAsync

        // Define a method that performs the authentication process
        // using a Facebook sign-in. 
        //private async System.Threading.Tasks.Task AuthenticateAsync()
        //{
        //    while (user == null)
        //    {
        //        string message;
        //        try
        //        {
        //            // Change 'MobileService' to the name of your MobileServiceClient instance.
        //            // Sign-in using Facebook authentication.
        //            user = await App.MobileService
        //                .LoginAsync(MobileServiceAuthenticationProvider.WindowsAzureActiveDirectory);
        //            message =
        //                string.Format("You are now signed in - {0}", user.UserId);
        //        }
        //        catch (InvalidOperationException)
        //        {
        //            message = "You must log in. Login Required";
        //        }

        //        var dialog = new MessageDialog(message);
        //        dialog.Commands.Add(new UICommand("OK"));
        //        await dialog.ShowAsync();
        //    }
        //}

        public override async void LogoutAsync()
        {
            App.MobileService.Logout();

            string message;
            // This sample uses the Facebook provider.
            var provider = "AAD";

            // Use the PasswordVault to securely store and access credentials.
            PasswordVault vault = new PasswordVault();
            PasswordCredential credential = null;
            try
            {
                // Try to get an existing credential from the vault.
                credential = vault.FindAllByResource(provider).FirstOrDefault();
                vault.Remove(credential);
            }
            catch (Exception)
            {
                // When there is no matching resource an error occurs, which we ignore.
            }
            message = string.Format("You are now logged out!");
            var dialog = new MessageDialog(message);
            dialog.Commands.Add(new UICommand("OK"));
            await dialog.ShowAsync();
            IsLoggedIn = false;

        }
开发者ID:karolzak,项目名称:XAML-Blend-Tutorial,代码行数:55,代码来源:MainPageViewModel.cs

示例7: JePropose1_Click

        private async void JePropose1_Click(object sender, RoutedEventArgs e)
        {
            string message = "";
            var dialog = new MessageDialog("");
            dialog.Title = "Proposition d'évenement :";
            dialog.Commands.Add(new UICommand("OK"));
            var eventSending = new EventGest();
            if (await verifForm())
            {
                var NewEvent = new Event();

                NewEvent.TitreEvent = TextBoxTitre.Text;
                NewEvent.NbParticipEvent = int.Parse(TextBoxNbrPartMax.Text);
                NewEvent.ThemeEvent = ThemeCombo.SelectedItem.ToString();
                NewEvent.AdresseEvent = adressSugest.Text;
                NewEvent.DateEvent = CalendarStart.Date.ToString();
                NewEvent.DescripEvent = DescriptionTextboxTitre.Text;
                NewEvent.PhotoEvent = ImageTextBox.Text;
                NewEvent.IdUser = App.MobileService.CurrentUser.UserId.ToString();
                NewEvent.TimeEvent = TimePicker.Time.Hours.ToString();
                NewEvent.Duration = DurationPicker.Time.ToString();
                eventSending.sendEvent(NewEvent);
                Frame.GoBack();
                message = "Envoyé avec succé :D";
            }
            else
            {
                message = "Champs invalide :(";
            }
            dialog.Content = message;
            await dialog.ShowAsync();
        }
开发者ID:StartupMobilite,项目名称:Apero,代码行数:32,代码来源:IPropEvent.xaml.cs

示例8: GetMyInfoAsync

        /// <summary>
        /// Restituisce i dati dell'utente
        /// </summary>
        public static async Task<Microsoft.Graph.User> GetMyInfoAsync()
        {
            //JObject jResult = null;

            try
            {
                HttpClient client = new HttpClient();
                var token = await OfficeHelper.GetTokenAsync();
                client.DefaultRequestHeaders.Add("Authorization", $"Bearer {token}");

                // Endpoint dell'utente loggato
                Uri usersEndpoint = new Uri($"{serviceEndpoint}me");

                HttpResponseMessage response = await client.GetAsync(usersEndpoint);

                if (response.IsSuccessStatusCode)
                {
                    string responseContent = await response.Content.ReadAsStringAsync();
                    return Newtonsoft.Json.JsonConvert.DeserializeObject<Microsoft.Graph.User>(responseContent);                    
                }
                else
                {
                    var msg = new MessageDialog("Non è stato possibile recuperare i dati dell'utente. Risposta del server: " + response.StatusCode);
                    await msg.ShowAsync();
                    return null;
                }
            }
            catch (Exception e)
            {
                var msg = new MessageDialog("Si è verificato il seguente errore: " + e.Message);
                await msg.ShowAsync();
                return null;
            }
        }
开发者ID:mamarche,项目名称:MyUniversalInfo,代码行数:37,代码来源:OfficeHelper.cs

示例9: MyMapView_MapViewTapped

		private async void MyMapView_MapViewTapped(object sender, MapViewInputEventArgs e)
		{
			try
			{
				_trafficOverlay.Visibility = Visibility.Collapsed;
				_trafficOverlay.DataContext = null;

				var identifyTask = new IdentifyTask(new Uri(_trafficLayer.ServiceUri));
				// Get current viewpoints extent from the MapView
				var currentViewpoint = MyMapView.GetCurrentViewpoint(ViewpointType.BoundingGeometry);
				var viewpointExtent = currentViewpoint.TargetGeometry.Extent;

				IdentifyParameters identifyParams = new IdentifyParameters(e.Location, viewpointExtent, 5, (int)MyMapView.ActualHeight, (int)MyMapView.ActualWidth)
				{
					LayerIDs = new int[] { 2, 3, 4 },
					LayerOption = LayerOption.Top,
					SpatialReference = MyMapView.SpatialReference,
				};

				var result = await identifyTask.ExecuteAsync(identifyParams);

				if (result != null && result.Results != null && result.Results.Count > 0)
				{
					_trafficOverlay.DataContext = result.Results.First();
					_trafficOverlay.Visibility = Visibility.Visible;
				}
			}
			catch (Exception ex)
			{
				var _x = new MessageDialog(ex.Message, "Sample Error").ShowAsync();
			}
		}
开发者ID:MagicWang,项目名称:arcgis-runtime-samples-dotnet,代码行数:32,代码来源:Traffic.xaml.cs

示例10: StartDrawingButton_Click

        // Accepts two user shapes and adds them to the graphics layer
        private async void StartDrawingButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                btnDraw.IsEnabled = false;
                btnTest.IsEnabled = false;
                resultPanel.Visibility = Visibility.Collapsed;

                _graphicsOverlay.Graphics.Clear();

                // Shape One
                Esri.ArcGISRuntime.Geometry.Geometry shapeOne = await MyMapView.Editor.RequestShapeAsync(
                    (DrawShape)comboShapeOne.SelectedValue, _symbols[comboShapeOne.SelectedIndex]);

                _graphicsOverlay.Graphics.Add(new Graphic(shapeOne, _symbols[comboShapeOne.SelectedIndex]));

                // Shape Two
                Esri.ArcGISRuntime.Geometry.Geometry shapeTwo = await MyMapView.Editor.RequestShapeAsync(
                    (DrawShape)comboShapeTwo.SelectedValue, _symbols[comboShapeTwo.SelectedIndex]);

                _graphicsOverlay.Graphics.Add(new Graphic(shapeTwo, _symbols[comboShapeTwo.SelectedIndex]));
            }
            catch (TaskCanceledException)
            {
            }
            catch (Exception ex)
            {
                var _x = new MessageDialog(ex.Message, "Sample Error").ShowAsync();
            }
            finally
            {
                btnDraw.IsEnabled = true;
                btnTest.IsEnabled = (_graphicsOverlay.Graphics.Count >= 2);
            }
        }
开发者ID:MagicWang,项目名称:arcgis-runtime-samples-dotnet,代码行数:36,代码来源:Relate.xaml.cs

示例11: ShowYesNoMessage

        /// <summary>
        /// Shows a yes no dialog with a message.
        /// MUST BE CALLED FROM THE UI THREAD!
        /// </summary>
        /// <param name="title"></param>
        /// <param name="content"></param>
        /// <returns></returns>
        public async Task<bool?> ShowYesNoMessage(string title, string content, string postiveButton = "Yes", string negativeButton = "No")
        {
            // Don't show messages if we are in the background.
            if (m_baconMan.IsBackgroundTask)
            {
                return null;
            }

            bool? response = null;

            // Add the buttons
            MessageDialog message = new MessageDialog(content, title);
            message.Commands.Add(new UICommand(
                postiveButton,
                (IUICommand command)=> {
                    response = true; }));
            message.Commands.Add(new UICommand(
                negativeButton,
                (IUICommand command) => { response = false; }));
            message.DefaultCommandIndex = 0;
            message.CancelCommandIndex = 1;

            // Show the dialog
            await message.ShowAsync();

            return response;
        }
开发者ID:EricYan1,项目名称:Baconit,代码行数:34,代码来源:MessageManager.cs

示例12: checkInput

        private async void checkInput()
        {
            int numCard = 0;
            Int32.TryParse(numCardBox.Text, out numCard);
            if (Int32.TryParse(numCardBox.Text, out numCard) != false && numCard <= 1000)   //if input is valid 
            {
                if (CardReturn.IsChecked == true)
                {
                    //reset all drawned card list
                    drawned = new bool[4, 13];
                    numDrawned = 0;
                    cardDrawReturn(numCard);
                }
                else
                    cardDrawNoReturn(numCard);
            }

            else if (Int32.TryParse(numCardBox.Text, out numCard) != false && (numCard > 1000 || numCard < 0))  //if input is out of bound
            {
                var messageDialog = new MessageDialog("Please enter a number between 0 and 1000.");
                messageDialog.Title = "Invalid Input";

                // Show the message dialog and wait
                await messageDialog.ShowAsync();
            }
            else
            {
                var messageDialog = new MessageDialog("Please enter a real number.");   //if input is not an integer
                messageDialog.Title = "Invalid Input";

                // Show the message dialog and wait
                await messageDialog.ShowAsync();
            }
        }
开发者ID:vtquan,项目名称:Collection,代码行数:34,代码来源:MainPage.xaml.cs

示例13: CheckIn

        private async void CheckIn(int roomId)
        {
            if (string.IsNullOrWhiteSpace(FirstName) || string.IsNullOrWhiteSpace(LastName) || SelectedRoom == null)
            {
                MessageDialog dialog = new MessageDialog("You must enter first and last name and select a room", "Error");
                await dialog.ShowAsync();
                return;
            }

            var sensor = new Sensor
            {
                FirstName = FirstName,
                LastName = LastName,
                SensorId = 5,
                SensorMac = "1"
            };

            var presence = new SensorPresence
            {
                RoomId = roomId,
                SensorId = sensor.SensorId,
                TimeStamp = DateTime.Now
            };

            await serverHubProxy.Invoke("RecordLocation", presence, sensor);
            navigationService.NavigateTo("checkedInList");
        }
开发者ID:vtesin,项目名称:Levi9-GeoTagging,代码行数:27,代码来源:CheckInPageViewModel.cs

示例14: NavigateToRightPage

        private async Task NavigateToRightPage(bool loginContextPresent, bool projectContextPresent)
        {
            bool loginSuccess = false; ;
            if(loginContextPresent && projectContextPresent)
            {
                Action executeAction = () =>
                {
                    loginSuccess = LoginService.VSTSLogin();
                };

                executeAction();

                if (loginSuccess == false)
                {
                    
                    MessageDialog msgBox = new MessageDialog("Failed to login. Check internet connectivity and try again!");
                    var res = await msgBox.ShowAsync();

                    if(Frame != null)
                    {
                        Frame.Navigate(typeof(LoginPage));
                    }

                }
                else
                {
                    Frame.Navigate(typeof(ServiceSelectionPage));
                }
            }
            else
            {
                Frame.Navigate(typeof(LoginPage));
            }
        }
开发者ID:openalm,项目名称:DevOpsNinjaWindowsUniversal,代码行数:34,代码来源:MainPage.xaml.cs

示例15: ShowAsync

		public static async Task<MessageBoxResult> ShowAsync ( string messageBoxText,
															 string caption,
															 MessageBoxButton button )
		{

			MessageDialog md = new MessageDialog ( messageBoxText, caption );
			MessageBoxResult result = MessageBoxResult.None;
			if ( button.HasFlag ( MessageBoxButton.OK ) )
			{
				md.Commands.Add ( new UICommand ( "OK",
					new UICommandInvokedHandler ( ( cmd ) => result = MessageBoxResult.OK ) ) );
			}
			if ( button.HasFlag ( MessageBoxButton.Yes ) )
			{
				md.Commands.Add ( new UICommand ( "Yes",
					new UICommandInvokedHandler ( ( cmd ) => result = MessageBoxResult.Yes ) ) );
			}
			if ( button.HasFlag ( MessageBoxButton.No ) )
			{
				md.Commands.Add ( new UICommand ( "No",
					new UICommandInvokedHandler ( ( cmd ) => result = MessageBoxResult.No ) ) );
			}
			if ( button.HasFlag ( MessageBoxButton.Cancel ) )
			{
				md.Commands.Add ( new UICommand ( "Cancel",
					new UICommandInvokedHandler ( ( cmd ) => result = MessageBoxResult.Cancel ) ) );
				md.CancelCommandIndex = ( uint ) md.Commands.Count - 1;
			}
			var op = await md.ShowAsync ();
			return result;
		}
开发者ID:Daramkun,项目名称:LangTrans,代码行数:31,代码来源:Helper.cs


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