private void Generate_Click(object sender, RoutedEventArgs e)
        {
            DateTime dt = DateTime.Now;

            txtKey.Text = SerialKeyManager.GetKey(txtUserId.Text, dtStart.SelectedDate.Value, dtTo.SelectedDate.Value);
            var isLicenseActive = SerialKeyManager.IsLicenseActive(txtKey.Text, txtUserId.Text, DateTime.Now, out dt);
        }
        private void ValidateLicenseKey(UserInfo userInfo)
        {
            bool     isActiveLicense = false;
            DateTime validTill       = default(DateTime);

            if (!string.IsNullOrEmpty(userInfo.UserId))
            {
                try
                {
                    isActiveLicense = SerialKeyManager.IsLicenseActive(userInfo.Key, userInfo.UserId, DateTime.Now, out validTill);
                }
                catch (Exception)
                {
                    isActiveLicense = false;
                }
            }
            if (isActiveLicense)
            {
                userInfo.IsValidKey = true;
                txtinfo.Text        = string.Format(validLicense, validTill.ToShortDateString());
                txtinfo.Foreground  = Brushes.Green;
            }
            else
            {
                userInfo.IsValidKey = false;
                txtinfo.Text        = invalidLicense;
                txtinfo.Foreground  = Brushes.Red;
            }
        }