/// <summary>
        /// Shows the license summary dialog to the user as their license has expired.
        /// </summary>
        /// <param name="host"></param>
        /// <param name="now"></param>
        /// <param name="expiryDate">Should be expressed in local time.</param>
        /// <param name="createAlert"></param>
        /// <param name="popupLicenseMgr"></param>
        private void showLicenseSummaryExpired(Host host, DateTime now, DateTime expiryDate, bool createAlert, bool popupLicenseMgr)
        {
            Program.AssertOnEventThread();

            log.InfoFormat("Server {0} has expired ({1}). Show License Summary if needed",
                           host.Name(),
                           HelpersGUI.DateTimeToString(expiryDate, Messages.DATEFORMAT_DMY_HMS, true));

            if (createAlert)
            {
                var alert = new LicenseAlert(host.Name(), now, expiryDate)
                {
                    LicenseManagerLauncher = licenseManagerLauncher
                };
                Alert.AddAlert(alert);
            }

            if (!popupLicenseMgr)
            {
                return;
            }

            if (Program.RunInAutomatedTestMode)
            {
                log.Debug("In automated test mode: quashing license expiry warning");
            }
            else
            {
                licenseManagerLauncher.LaunchIfRequired(true, ConnectionsManager.XenConnections);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Shows the license summary dialog to the user as their license will soon expire.
        /// </summary>
        private void showLicenseSummaryWarning(String hostname, DateTime now, DateTime expiryDate)
        {
            Program.AssertOnEventThread();

            log.InfoFormat("Server {0} is within 30 days of expiry ({1}). Show License Summary if needed",
                           hostname,
                           HelpersGUI.DateTimeToString(expiryDate, Messages.DATEFORMAT_DMY_HMS, true));

            var alert = new LicenseAlert(hostname, now, expiryDate)
            {
                LicenseManagerLauncher = licenseManagerLauncher
            };

            Alert.AddAlert(alert);

            if (Program.RunInAutomatedTestMode)
            {
                log.DebugFormat("In automated test mode: quashing license expiry warning '{0}'", alert.Description);
            }
            else
            {
                licenseManagerLauncher.Parent = Program.MainWindow;
                licenseManagerLauncher.LaunchIfRequired(true, ConnectionsManager.XenConnections);
            }
        }
        private void CheckTimeSpanToTextConversions(int expectedNumberOfValuesToCheck, Dictionary <TimeSpan, string> valuesToCheck, bool capped)
        {
            Assert.AreEqual(expectedNumberOfValuesToCheck, valuesToCheck.Count);

            foreach (KeyValuePair <TimeSpan, string> value in valuesToCheck)
            {
                Assert.AreEqual(value.Value, LicenseAlert.GetLicenseTimeLeftString(value.Key, capped));
            }
        }
Beispiel #4
0
 public void CappedTimeToStringConversion(KeyValuePair <TimeSpan, string> kvp)
 {
     Assert.AreEqual(kvp.Value, LicenseAlert.GetLicenseTimeLeftString(kvp.Key, true));
 }