Esempio n. 1
0
        /// <summary>
        /// Print the license codes and expiration dates in string
        /// </summary>
        /// <returns></returns>
        string printLicenseCodes()
        {
            string printLine = "";

            foreach (LicenseCodes lc in Enum.GetValues(typeof(LicenseCodes)))
            {
                bool avail = LicenseInformation.IsAvailable(lc);
                if (avail)
                {
                    printLine += lc.ToString() + "\t" + LicenseInformation.GetExpirationDate(lc);
                    DateTime expDate = LicenseInformation.GetExpirationDate(lc) ?? DateTime.Now;
                    TimeSpan remain  = expDate.Subtract(DateTime.Now);
                    printLine += "\t\tTime remaining till expiration: " + remain.Days + " day(s), " + remain.Hours + " hrs(s), " + remain.Minutes + " min(s)\n";
                }
                else
                {
                    printLine += lc.ToString() + "\t" + "License not available\n";
                }
            }
            return(printLine);
        }