private async void ButtonShowContentDialog3_Click(object sender, RoutedEventArgs e) { var btn = sender as Button; var result = await MyContentDialog.ShowAsync(); btn.Content = "Result: " + result; }
private async Task ShowLoading() { MyContentDialog.ShowAsync(); await Task.Delay(2000); cdtb.Text = "登陆成功"; await Task.Delay(1000); MyContentDialog.Hide(); }
private async Task verify() { string info = null; var succeed = false; var result = await UserConsentVerifier.RequestVerificationAsync(Strings.Resources.Verify.Dialog.Content); switch (result) { case UserConsentVerificationResult.Verified: succeed = true; break; case UserConsentVerificationResult.DeviceNotPresent: info = Strings.Resources.Verify.DeviceNotPresent; break; case UserConsentVerificationResult.NotConfiguredForUser: info = Strings.Resources.Verify.NotConfigured; break; case UserConsentVerificationResult.DisabledByPolicy: info = Strings.Resources.Verify.Disabled; break; case UserConsentVerificationResult.DeviceBusy: info = Strings.Resources.Verify.DeviceBusy; break; case UserConsentVerificationResult.RetriesExhausted: info = Strings.Resources.Verify.RetriesExhausted; break; case UserConsentVerificationResult.Canceled: info = Strings.Resources.Verify.Canceled; break; default: info = Strings.Resources.Verify.OtherFailure; break; } if (!succeed) { if (info != null) { var dialog = new MyContentDialog { Title = Strings.Resources.Verify.FailedDialogTitle, Content = info, CloseButtonText = Strings.Resources.General.Exit, }; await dialog.ShowAsync(); } Application.Current.Exit(); } }
public string str; //用于记录输入的车牌号 private async void UseBicycleButton_Click(object sender, RoutedEventArgs e) { var button = sender as ToggleButton; //点击之后为ischecked==true //button.IsChecked string bicycleId = ""; if (button.IsChecked == true) { var content = new MyContentDialog(); ContentDialog con = new ContentDialog() { Content = content, PrimaryButtonText = "确定", SecondaryButtonText = "取消", }; con.PrimaryButtonClick += (s, a) => { button.Content = "结束用车"; //获取输入 str = content.Text; }; con.SecondaryButtonClick += (s, a) => { button.IsChecked = false; }; await con.ShowAsync(); useflag = true; } if (button.IsChecked == false) //结束用车时的点击 { button.Content = "用车"; map.Routes.Clear(); using (SQLiteConnection conn = BicycleDatabase.GetDbConnection()) { TableQuery <Bicycle> t = conn.Table <Bicycle>(); var q = (from p in t where p.bicycle_id == str select p).SingleOrDefault(); //Debug.WriteLine(goalpoint.Position); q.current_location = goalpoint.Position.Latitude.ToString() + "," + goalpoint.Position.Longitude.ToString(); conn.Update(q); } Bicycletest(); } //Simulation.bicycleuse(this_account, bicycleId); }
private async void AppBarButton_Click_3(object sender, RoutedEventArgs e) { var btn = sender as Button; var result = await MyContentDialog.ShowAsync(); }
private async void BackgroundList_ItemClick(Object sender, ItemClickEventArgs e) { await MyContentDialog.ShowAsync(); }