Пример #1
0
        /// <summary>
        /// Called when the main form is shown.
        /// </summary>
        /// <param name="sender">Sender of the event.</param>
        /// <param name="e">The event arguments.</param>
        private async void MainForm_Shown(object sender, EventArgs e)
        {
            var signerKey = await CryptoUtil.ReadFirstRsaPublicKey(Properties.Settings.Default.SignerKey, new HttpClient());

            OAuthConfig.SignerKey = signerKey.RSAKey;
            EntClient             = new EntClient()
            {
                OAuthConfig = OAuthConfig
            };

            // This sample application always requires sign-on / authorization against the 10Duke entitlement service.
            EnsureAuthorization();
            if (EntClient.IsAuthorized())
            {
                ShowWelcomeMessage();
                ShowComputerId();
                StoreAuthorization();
            }
            else
            {
                // If the authorization process was cancelled, close this form. This will cause the whole application
                // to be closed.
                Close();
            }
        }
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     // This sample application always requires sign-on / authorization against the 10Duke entitlement service.
     EnsureAuthorization();
     if (EntClient.IsAuthorized())
     {
         ShowWelcomeMessage();
         ShowComputerId();
         StoreAuthorization();
     }
     else
     {
         // If the authorization process was cancelled, close this form. This will cause the whole application
         // to be closed.
         Close();
     }
 }