예제 #1
0
        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);
                }
            }
        }
예제 #2
0
        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);
                }
            }
        }
예제 #3
0
        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}");
                    }
                }
            }
        }