本文整理汇总了C#中ContentDialog类的典型用法代码示例。如果您正苦于以下问题:C# ContentDialog类的具体用法?C# ContentDialog怎么用?C# ContentDialog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ContentDialog类属于命名空间,在下文中一共展示了ContentDialog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TeamOneName
private async void TeamOneName()
{
TextBox txtName = new TextBox();
Grid contentGrid = new Grid();
contentGrid.Children.Add(txtName);
ContentDialog nameDialog = new ContentDialog()
{
Title = "Enter Team One Name",
Content = contentGrid,
PrimaryButtonText = "Submit"
};
await nameDialog.ShowAsync();
if (txtName.Text!="") {
team1Name= txtName.Text;
}
else
{
team1Name = "Team One";
}
teamOneName.Text = team1Name;
}
示例2: buttonConnect_Click
private async void buttonConnect_Click(object sender, RoutedEventArgs e)
{
if (!App.serialPort.IsConnected())
{
int selection = listbox1.SelectedIndex;
if (selection < 0) return;
await App.serialPort.Connect(selection);
if (!App.serialPort.IsConnected())
{
ContentDialog dialog = new ContentDialog();
dialog.Title = "Connection failed";
dialog.Content = "Try to select another device";
dialog.PrimaryButtonText = "OK";
await dialog.ShowAsync();
return;
}
App.ledStripController.Connect();
Frame.Navigate(typeof(ControlPage));
}
else
{
App.ledStripController.Disconnect();
App.serialPort.Disconnect();
}
// RefrashInterface();
}
示例3: ContentDialog_SecondaryButtonClick
private void ContentDialog_SecondaryButtonClick( ContentDialog sender, ContentDialogButtonClickEventArgs args )
{
if ( Member.WillLogin || Member.IsLoggedIn )
{
args.Cancel = true;
}
}
示例4: StartRecognizing_Click
} // end void
private async void StartRecognizing_Click(object sender, RoutedEventArgs e)
{
// Create an instance of SpeechRecognizer.
var speechRecognizer = new Windows.Media.SpeechRecognition.SpeechRecognizer();
// Compile the dictation grammar by default.
await speechRecognizer.CompileConstraintsAsync();
// Start recognition.
Windows.Media.SpeechRecognition.SpeechRecognitionResult speechRecognitionResult = await speechRecognizer.RecognizeWithUIAsync();
ContentDialog notifyDelete = new ContentDialog()
{
Title = "Confirm delete?",
Content = speechRecognitionResult.Text,
PrimaryButtonText = "Save Note",
SecondaryButtonText = "Cancel"
};
ContentDialogResult result = await notifyDelete.ShowAsync();
if (result == ContentDialogResult.Primary)
{
tbNote.Text = speechRecognitionResult.Text;
}
else
{
// User pressed Cancel or the back arrow.
// Terms of use were not accepted.
}
// Do something with the recognition result.
//var messageDialog = new Windows.UI.Popups.MessageDialog(speechRecognitionResult.Text, "Text spoken");
//await messageDialog.ShowAsync();
} // end StartRecognizing_Click
示例5: ContentDialog_PrimaryButtonClick
private void ContentDialog_PrimaryButtonClick( ContentDialog sender, ContentDialogButtonClickEventArgs args )
{
args.Cancel = true;
if ( Keys.SelectedItem == null )
{
StringResources stx = new StringResources();
ServerMessage.Text = "Please Select a key";
return;
}
string PubKey = RSA.SelectedItem.GenPublicKey();
string Remarks = RemarksInput.Text.Trim();
if ( string.IsNullOrEmpty( Remarks ) )
{
Remarks = RemarksPlaceholder;
}
RCache.POST(
Shared.ShRequest.Server
, Shared.ShRequest.PlaceRequest( Target, PubKey, BindItem.Id, Remarks )
, PlaceSuccess
, ( c, Id, ex ) => { Error( ex.Message ); }
, false
);
}
示例6: ContentDialog_PrimaryButtonClick
private void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
{
if(Windows.Storage.ApplicationData.Current.LocalSettings.Values.Any(m => m.Key.Equals("username")))
Windows.Storage.ApplicationData.Current.LocalSettings.Values.Remove("username");
Windows.Storage.ApplicationData.Current.LocalSettings.Values.Add(new KeyValuePair<string, object>("username", this.name.Text));
this.Username = this.name.Text;
}
示例7: ContentDialog_PrimaryButtonClick
private void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
{
Dokument.statusBean = (Model.Status)statusi.SelectedItem;
Dokument.vrstaDokumenta = (Model.VrstaDokumenta)vrsteDokumenata.SelectedItem;
Dokument.kreiran = DateTime.Now;
Dokument.istice = istice.Date.Date;
}
示例8: OnDialogOpened
private void OnDialogOpened(ContentDialog sender, ContentDialogOpenedEventArgs args)
{
username.ClearValue(TextBox.TextProperty);
pwd.ClearValue(PasswordBox.PasswordProperty);
pwd2.ClearValue(PasswordBox.PasswordProperty);
msg.ClearValue(TextBlock.TextProperty);
}
示例9: Tela_PrimaryButtonClick
private async static void Tela_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
{
var tela = sender.Content as MyUserControl1;
var readDataa = await ReadWrite.readStringFromLocalFile("data");
Profile profile = JsonSerilizer.ToProfile(readDataa);
if (tela.passwordBoxSenha.Password == profile.Password)
{
}
else
{
var acessar = new MyUserControl1();
ContentDialog dialogo = new ContentDialog();
dialogo.PrimaryButtonText = "Войти";
dialogo.PrimaryButtonClick += Tela_PrimaryButtonClick;
dialogo.Content = acessar;
await dialogo.ShowAsync();
}
}
示例10: ContentDialog_PrimaryButtonClick
/// <summary>
/// 确定
/// </summary>
/// <param name="sender"></param>
/// <param name="args"></param>
private async void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
{
args.Cancel = true;
UpLoading.Visibility = Visibility.Visible;
IsPrimaryButtonEnabled = false;
object[] result = await UserService.AddWZ(WZUrl.Text, WZTitle.Text, WZTags.Text, WZSummary.Text);
if (result != null)
{
if ((bool)result[0])
{
Hide();
}
else
{
Tips.Text = result[1].ToString();
UpLoading.Visibility = Visibility.Collapsed;
IsPrimaryButtonEnabled = true;
}
}
else
{
Tips.Text = "操作失败!";
UpLoading.Visibility = Visibility.Collapsed;
IsPrimaryButtonEnabled = true;
}
}
示例11: ContentDialog_PrimaryButtonClick
private void ContentDialog_PrimaryButtonClick( ContentDialog sender, ContentDialogButtonClickEventArgs args )
{
args.Cancel = true;
DetectInputLogin();
Canceled = false;
}
示例12: CallWebApiAsync
async Task CallWebApiAsync()
{
HttpClient client = new HttpClient();
HttpResponseMessage response = await client.GetAsync("http://forecastlabo2.azurewebsites.net/api/Forecast");
if (response.StatusCode == System.Net.HttpStatusCode.OK) {
string json = await response.Content.ReadAsStringAsync();
var forecasts = Newtonsoft.Json.JsonConvert.DeserializeObject<Forecasts[]>(json);
ForeCastListView.ItemsSource = forecasts;
}else
{
var dialog = new ContentDialog()
{
Title = "Ooooops",
MaxWidth = this.ActualWidth
};
var panel = new StackPanel();
panel.Children.Add(new TextBlock {
Text = "Une erreur s'est produite lors de la récupération des prévisions météo",
TextWrapping = TextWrapping.Wrap,
});
dialog.Content = panel;
await dialog.ShowAsync();
//try catch et appeler une méthode qui gère l'erreur
//recherche google mot clé UWP / WPF Universal App/ faire les recherches en anglais
}
}
示例13: SignInContentDialog_Closing
void SignInContentDialog_Closing(ContentDialog sender, ContentDialogClosingEventArgs args)
{
// If sign in was successful, save or clear the user name based on the user choice.
if (this.Result == SignInResult.SignInOK)
{
if (saveUserNameCheckBox.IsChecked == true)
{
SaveUserName();
}
else
{
ClearUserName();
}
}
// If the user entered a name and checked or cleared the 'save user name' checkbox, then clicked the back arrow,
// confirm if it was their intention to save or clear the user name without signing in.
if (this.Result == SignInResult.Nothing && !string.IsNullOrEmpty(userNameTextBox.Text))
{
if (saveUserNameCheckBox.IsChecked == false)
{
args.Cancel = true;
FlyoutBase.SetAttachedFlyout(this, (FlyoutBase)this.Resources["DiscardNameFlyout"]);
FlyoutBase.ShowAttachedFlyout(this);
}
else if (saveUserNameCheckBox.IsChecked == true && !string.IsNullOrEmpty(userNameTextBox.Text))
{
args.Cancel = true;
FlyoutBase.SetAttachedFlyout(this, (FlyoutBase)this.Resources["SaveNameFlyout"]);
FlyoutBase.ShowAttachedFlyout(this);
}
}
}
示例14: CancelPreviousAndShowDialog
protected void CancelPreviousAndShowDialog(ContentDialog dialog)
{
if (previous == null)
previous = dialog;
CancelPreviousDialog();
LastDialogControl = dialog.ShowAsync();
}
示例15: buttonAddPerson_Click
private async void buttonAddPerson_Click(object sender, RoutedEventArgs e)
{
var dialog = new ContentDialog();
dialog.Title = "Add a person to your list";
dialog.Content = new TextBox();
dialog.PrimaryButtonText = "Add";
dialog.IsPrimaryButtonEnabled = true;
var result = await dialog.ShowAsync();
if (ContentDialogResult.Primary == result)
{
try
{
var textBox = (TextBox)dialog.Content;
string text = textBox.Text;
if (text != "")
{
Person person = new Person(text);
ListViewItem item = new ListViewItem
{
Content = person.Name,
Tag = person
};
listViewPerson.Items.Add(item);
person.Save();
}
}
catch (NullReferenceException)
{
}
}
}