how to regulate the appearance of a window in wpf c# using month change & date change

KwebenaAcquah-9104 306 Reputation points
2021-07-09T17:02:59.497+00:00

please can some one help me fix this issue;
i am having a windows called registration window; is supposed to show up each time a month in a year is up to its last date;
but i don't actually know how to code this calculated event from my head in into c#;
i want to be able to show the registration window every time any month in a year comes to an end; please can some one help me fix this

here is what i have tried; to do;
DateTime dateTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 28, 6, 16, 00);
private void loadingevent method
{
if (DateTime.Now - dateTime > TimeSpan.FromDays(1))
{
frmPRODUCT frm = new frmPRODUCT();
frm.Show();

            }
            else
            {
                SignUpPage signUpPage = new SignUpPage();
                signUpPage.Show();
            }

this actually is working but if the month is changed the user happens to have a free use of my software from the subtraction of date in the above code (this is what i don't want; i want each month to be paid for) please help me

the basic sense here is to regulate the monthly licensing of my software to end users each month; i have arealdy built he license key generator to generate trial and full license keys (for the trial this follows the number of days i decide to license this software to end users;

here is my registration button found in the registration window;
try
{
KeyManager km = new KeyManager(txtproductid.Text);
string productkey = txtproductkey.Text;
if (km.ValidKey(ref productkey))
{
KeyValuesClass kv = new KeyValuesClass();
if (km.DisassembleKey(productkey, ref kv))
{
LicenseInfo lic = new LicenseInfo();
lic.ProductKey = productkey;
lic.FullName = "KSMS LICENSE GRANT";
if (kv.Type == LicenseType.TRIAL)
{
lic.Day = kv.Expiration.Day;
lic.Month = kv.Expiration.Month;
lic.Year = kv.Expiration.Year;
}
km.SaveSuretyFile(string.Format(@"{0}\kryo.lic", Application.Current.StartupUri), lic);
MessageBox.Show("You Have Been Successfully Registered", "MESSAGE", MessageBoxButton.OK, MessageBoxImage.Information);
IsRegestered = true;
Close();
}
}
else
{
MessageBox.Show("The Applied Product Key is Invalid", "MESSAGE", MessageBoxButton.OK, MessageBoxImage.Information);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}

the user will say there computer id and i will generate any of the type of key i want eigther trial or full key; (from below code loaded event) please help me regulate the loading of this registration window at every month 1st - 31st or 30th

 try
            {
                txtproductid.Text = ComputerInfo.GetComputerId();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,660 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,162 questions
{count} votes