private async void MoveUserCertificateToAppCertificateStore(object sender, RoutedEventArgs e) { var item = (ListViewItem)UserCertificateListView.SelectedItem; if (item != null) { var certificate = (Certificate)item.Tag; appStore.Add(certificate); if (await userStore.RequestDeleteAsync(certificate)) { MoveItemBetweenListViews(item, UserCertificateListView, AppCertificateListView); } else { appStore.Delete(certificate); } } }
private async void MoveUserCertificateToAppCertificateStore() { var item = (CertificateItem)UserCertificateListView.SelectedItem; if (item != null) { appStore.Add(item.Certificate); if (await userStore.RequestDeleteAsync(item.Certificate)) { UserCertificateListView.Items.Remove(item); AppCertificateListView.Items.Add(item); AppCertificateListView.SelectedItem = item; AppCertificateListView.ScrollIntoView(item); } else { appStore.Delete(item.Certificate); } } }
private async Task EnsureDeleteOldCertificates() { UserCertificateStore certificateStore = CertificateStores.GetUserStoreByName(StandardCertificateStoreNames.Personal); var certificateFinder = await CertificateStores.FindAllAsync(new CertificateQuery() { IncludeDuplicates = true, IncludeExpiredCertificates = true }); foreach (Certificate oldCertificate in certificateFinder) { if (oldCertificate.Issuer.StartsWith("Azure IoT Edison Intermediate")) { try { await certificateStore.RequestDeleteAsync(oldCertificate); } catch (Exception e) { DebugHelper.LogWarning($"An old certificate could not be deleted: {e.Message}"); } } } }