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


C# ContentDialogButtonClickEventArgs.GetDeferral方法代码示例

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


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

示例1: ContentDialog_PrimaryButtonClick

        //Sign in button
        private void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
        {
            // Ensure the user name and password fields aren't empty. If a required field
            // is empty, set args.Cancel = true to keep the dialog open.
            if (string.IsNullOrEmpty(userNameTextBox.Text))
            {
                args.Cancel = true;
                errorTextBlock.Text = "User name is required.";
            }
            else if (string.IsNullOrEmpty(passwordTextBox.Password))
            {
                args.Cancel = true;
                errorTextBlock.Text = "Password is required.";
            }

            // If you're performing async operations in the button click handler,
            // get a deferral before you await the operation. Then, complete the
            // deferral when the async operation is complete.

            ContentDialogButtonClickDeferral deferral = args.GetDeferral();
            //if (await SomeAsyncSignInOperation())
            //{
            this.Result = SignInResult.SignInOK;
            //}
            //else
            //{
            //    this.Result = SignInResult.SignInFail;
            //}
            deferral.Complete();
        }
开发者ID:Eltabu,项目名称:Logins-Management-System,代码行数:31,代码来源:SignIn.xaml.cs

示例2: ContentDialog_PrimaryButtonClick

        private async void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
        {
            // Ensure the user name and password fields aren't empty. If a required field
            // is empty, set args.Cancel = true to keep the dialog open.
            if (string.IsNullOrEmpty(txtUsername.Text))
            {
                args.Cancel = true;
                txtError.Text = "User name is required";
                return;
            }
            else if (string.IsNullOrEmpty(txtPassword.Password))
            {
                args.Cancel = true;
                txtError.Text = "Password is required";
                return;
            }

            // If you're performing async operations in the button click handler,
            // get a deferral before you await the operation. Then, complete the
            // deferral when the async operation is complete.

            ContentDialogButtonClickDeferral deferral = args.GetDeferral();

            var rememberMe = chkRememberMe.IsChecked.Value;
            if( !await dataAccess.Login(txtUsername.Text, txtPassword.Password, rememberMe) )
            {
                args.Cancel = true;
                txtError.Text = "Login Failed";
            }

            deferral.Complete();
        }
开发者ID:ChrisBallard,项目名称:langtutor,代码行数:32,代码来源:LoginDialog.xaml.cs

示例3: OkButtonClick

        private async void OkButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
        {
            // Get the deferral because we need to await the
            // category creation.
            var deferral = args.GetDeferral();

            // Get creation status and if failed, let's
            // keep the dialog opened.
            var success = await ViewModel.CreateCategory();
            args.Cancel = !success;

            // Complete deferral to close the dialog.
            deferral.Complete();
        }
开发者ID:Microsoft,项目名称:Appsample-Photosharing,代码行数:14,代码来源:CreateCategoryDialog.xaml.cs

示例4: ContentDialog_PrimaryButtonClick

		private async void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
		{
			var deferral = args.GetDeferral();
			var command = TemperatureEditViewModel.SaveTemperatureSettingCommand;
			if (command.CanExecute(null))
			{
				await command.ExecuteAsync(null);
			}
			if (TemperatureEditViewModel.HasErrors)
			{
				args.Cancel = true;
			}
			deferral.Complete();
		}
开发者ID:holtsoftware,项目名称:House,代码行数:14,代码来源:TemperatureEditControl.xaml.cs

示例5: GiveGoldDialog_OnPrimaryButtonClick

        private async void GiveGoldDialog_OnPrimaryButtonClick(ContentDialog sender,
            ContentDialogButtonClickEventArgs args)
        {
            // Get the deferral because we need to await the
            // annotation to post.
            var deferral = args.GetDeferral();

            // Get creation status and if failed, let's
            // keep the dialog opened.
            var success = await ViewModel.PostAnnotationToService();
            args.Cancel = !success;

            // Complete deferral to close the dialog.
            deferral.Complete();
        }
开发者ID:Microsoft,项目名称:Appsample-Photosharing,代码行数:15,代码来源:GiveGoldDialog.xaml.cs

示例6: ContentDialog_PrimaryButtonClick

        private async void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
        {
            var deferral = args.GetDeferral();

            try
            {
                if (ViewModel.SaveCommand.CanExecute(null))
                    await ViewModel.SaveCommand.Execute();
                else
                    args.Cancel = true;
            }
            finally
            {
                deferral.Complete();
            }
        }
开发者ID:danpadmore,项目名称:homebased,代码行数:16,代码来源:SetHomeLocationDialog.xaml.cs

示例7: ContentDialog_PrimaryButtonClick

        private void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
        {
            var deferral = args.GetDeferral();
             args.Cancel = false;
             NewEntry = new PasswordEntry
             {
            Id = -1,
            Domain = Domain.Text,
            Username = Username.Text,
            PasswordLength = SettingsProvider.DefaultPasswordLength,
            UseCapitalLetters = SettingsProvider.IncludeCapitalsByDefault,
            UseDigits = SettingsProvider.IncludeDigitsByDefault,
            UseSpecialCharacters = SettingsProvider.IncludeSpecialsByDefault,
             };
             PasswordStorage.Entries.Add(NewEntry);

             deferral.Complete();
        }
开发者ID:sceeter89,项目名称:password-generator,代码行数:18,代码来源:AddNewPasswordDialog.xaml.cs

示例8: ContentDialog_PrimaryButtonClick

        private void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
        {
            // Ensure the user name and password fields aren't empty. If a required field
            // is empty, set args.Cancel = true to keep the dialog open.
            if (string.IsNullOrEmpty(UserNameTextBox.Text))
            {
                args.Cancel = true;
                ErrorTextBlock.Text = "User name is required.";
                return;
            }
            else if (string.IsNullOrEmpty(PasswordTextBox.Password))
            {
                args.Cancel = true;
                ErrorTextBlock.Text = "Password is required.";
                return;
            }

            // If you're performing async operations in the button click handler,
            // get a deferral before you await the operation. Then, complete the
            // deferral when the async operation is complete.

            var deferral = args.GetDeferral();

            var mobileCredentials = new MobileCredentials(UserNameTextBox.Text, PasswordTextBox.Password);
            var resultTask = Task.Run(async () => await PorabaViewModel.TryLogin(mobileCredentials));
            var result = resultTask.Result;

            if (result == LoginResult.Success)
            {
                this.Result = LoginResult.Success;
                Credentials.SaveCredentialToLocker(mobileCredentials);
            }
            else
            {
                Result = result;
                args.Cancel = true;
            }
            deferral.Complete();
        }
开发者ID:davidvidmar,项目名称:MobilnaPoraba,代码行数:39,代码来源:LoginDialog.xaml.cs

示例9: OnPrimaryClick

            private void OnPrimaryClick( object sender, ContentDialogButtonClickEventArgs e )
            {
                Contract.Requires( e != null );

                if ( primary == null )
                    return;

                var parameter = dialog.PrimaryButtonCommandParameter;
                deferral = e.GetDeferral();

                if ( secondary != null )
                    secondary.RaiseCanExecuteChanged();

                primary.RaiseCanExecuteChanged();

                if ( primary.CanExecute( parameter ) )
                    primary.Execute( parameter );
            }
开发者ID:WaffleSquirrel,项目名称:More,代码行数:18,代码来源:ContentDialogAction.cs


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