예제 #1
0
        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) {
                }
            }
        }
예제 #2
0
 private void btnActivate_Click(object sender, EventArgs e)
 {
     try
     {
         var ID = ProID.Substring(0, ProID.Length - 3);
         if (string.IsNullOrEmpty(txtProID.Text))
         {
             throw new Exception("Enter Product ID");
         }
         if (txtProID.Text != ID.ToUpper())
         {
             throw new Exception("Invalid Product ID");
         }
         if (string.IsNullOrEmpty(txtActivation.Text))
         {
             throw new Exception("Enter Activation Key");
         }
         var key = SecuredPass.Encrypt(txtProID.Text.TrimEnd());
         if (txtActivation.Text == key.Substring(0, 24).ToUpper().TrimEnd())
         {
             AppActivation.activate(txtActivation.Text);
             //MessageBox.Show("Activation Successful", "Cash Desk", MessageBoxButtons.OK, MessageBoxIcon.Information);
             this.Close();
         }
         else
         {
             MessageBox.Show("Invalid Activation Key", "Cash Desk", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     catch (Exception Ex)
     {
         MessageBox.Show(Ex.Message + "\nActivation Failed", "Cash Desk", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
예제 #3
0
 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)
     {
     }
 }
예제 #4
0
        //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) { }
                    }
                }
            }
        }
예제 #5
0
 private void btnActivate_Click(object sender, EventArgs e)
 {
     try
     {
         if (string.IsNullOrEmpty(txtActivation.Text))
         {
             throw new Exception("Enter Activation Key");
         }
         var key = PasswordEncryptor.Encrypt(txtProID.Text.TrimEnd());
         if (txtActivation.Text == key.Substring(0, 24).ToUpper().TrimEnd())
         {
             AppActivation.activate(txtActivation.Text);
             this.Close();
         }
         else
         {
             MessageBox.Show("Invalid Activation Key", "Cash Desk", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message + "\nActivation Failed", "Cash Desk", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }