private void Form1_Load(object sender, EventArgs e) { try { timerTime.Start(); TodayPanel.Height = dropHieght; pantodayicon.Visible = false; lbltime.Text = DateTime.Now.ToShortTimeString(); new Thread(() => { //PREPARE THE DEBTORS LIST AT THE BACKGROUND var ground = new GroundWorker(); var eventList = new EvenPayList(); AppStarted += ground.OnAppStarted; AppStarted += eventList.OnAppStarted; OnAppStarted(); }).Start(); lblLogin.Text = AdminLog.Admin; if (string.IsNullOrEmpty(AppActivation.isActivated())) { notifyTime = 15; Notify(); timer1.Enabled = true; timer1.Start(); } } catch (Exception Ex) { } }
private void ActivationForm_Load(object sender, EventArgs e) { using (IsolatedStorageFile isolatedStorageFile = IsolatedStorageFile.GetStore(IsolatedStorageScope.User | IsolatedStorageScope.Assembly, null, null)) { try { using (IsolatedStorageFileStream isolatedStorageFileStream = new IsolatedStorageFileStream("apps.txt", System.IO.FileMode.Open, isolatedStorageFile)) { using (System.IO.StreamReader sr = new System.IO.StreamReader(isolatedStorageFileStream)) { var activation = sr.ReadLine(); //if the there is an activation Key check if it is valid if (AppActivation.isActivated() == activation) { MessageBox.Show("Software is already Activated", "Cash Desk", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } } } } catch (Exception) { } } }
//Activation #region /// <summary> /// CHECK THE ACTIVATION OF THE APPLICATION /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void timer1_Tick(object sender, EventArgs e) { //CHANGE BACKGROUND CODE GOES IN HERE LATER notifyTime -= 1; if (notifyTime <= 0) { if (string.IsNullOrEmpty(AppActivation.isActivated()) && AppActivation.CheckLimit() != true) { notifyTime = 35; Notify(); } else if (string.IsNullOrEmpty(AppActivation.isActivated()) && AppActivation.CheckLimit() != false)//when the limit is reachee { timer1.Stop(); var Activate = new DueActivationForm(); Activate.ShowDialog(); } else if (string.IsNullOrEmpty(AppActivation.isActivated()) == false && AppActivation.CheckLimit() != false) { //check Activation using (IsolatedStorageFile isolatedStorageFile = IsolatedStorageFile.GetStore(IsolatedStorageScope.User | IsolatedStorageScope.Assembly, null, null)) { try { using (IsolatedStorageFileStream isolatedStorageFileStream = new IsolatedStorageFileStream("apps.txt", System.IO.FileMode.Open, isolatedStorageFile)) { using (System.IO.StreamReader sr = new System.IO.StreamReader(isolatedStorageFileStream)) { var activation = sr.ReadLine(); //if the there is an activation Key check if it is valid if (AppActivation.isActivated() != activation) { timer1.Stop(); var Activate = new DueActivationForm(); Activate.ShowDialog(); } else { timer1.Stop(); } } } } catch (Exception) { } } } } }