コード例 #1
0
 /// <summary>
 /// Removes a developer license.
 /// </summary>
 /// <returns>Indicator of success</returns>
 public Task <bool> RemoveDeveloperLicenseAsync()
 {
     return(Task.Factory.StartNew <bool>(() =>
     {
         int hResult = DeveloperLicenseAgent.RemoveDeveloperLicense(IntPtr.Zero);
         return true;
     }));
 }
コード例 #2
0
 /// <summary>
 /// Acquires a developer license.
 /// </summary>
 /// <returns>Date of license expiration</returns>
 public Task <DateTime> AcquireDeveloperLicenseAsync()
 {
     return(Task.Factory.StartNew <DateTime>(() =>
     {
         DateTime dateOfExpiration = DateTime.MinValue;
         System.Runtime.InteropServices.ComTypes.FILETIME fileTime;
         int hResult = DeveloperLicenseAgent.AcquireDeveloperLicense(IntPtr.Zero, out fileTime);
         long adjustedFileTime = (((long)fileTime.dwHighDateTime) << 32) + fileTime.dwLowDateTime;
         dateOfExpiration = DateTime.FromFileTime(adjustedFileTime);
         return dateOfExpiration;
     }));
 }