예제 #1
0
 private void btn_checkStatus_Click(object sender, EventArgs e)
 {
     try
     {
         this.Enabled            = false;
         btn_checkStatus.Enabled = false;
         AuthUser auth          = new AuthUser();
         var      serverpackage = auth.ValidateUser();
         if (serverpackage.validationResult == ValidationResult.actual)
         {
             lb_accountHasExpired.Text = String.Format("Account active for {0} day(s)",
                                                       serverpackage.GetDaysToExpire());
             serverpackage.locked = false;
         }
         else if (serverpackage.validationResult == ValidationResult.expired)
         {
             lb_accountHasExpired.Text = String.Format("Your account has expired!");
             serverpackage.locked      = true;
         }
         else if (serverpackage.validationResult == ValidationResult.temporary)
         {
             lb_accountHasExpired.Text     = String.Format("Right now, you use it for free!");
             serverpackage.locked          = false;
             label9.Visible                = true;
             button2.Visible               = true;
             lb_accountHasExpired.Location = new System.Drawing.Point(36, 9);
             label1.Visible                = label2.Visible = label3.Visible = label4.Visible =
                 label5.Visible            = label6.Visible = label7.Visible =
                     label8.Visible        = btn_checkStatus.Visible = false;
         }
         package                 = serverpackage;
         lb_addressBtc.Text      = package.wallet;
         this.Enabled            = true;
         btn_checkStatus.Enabled = true;
     }
     catch (Exception ee)
     {
         //Log.Error(ee);
         //HandleError.CloseProgram();
     }
 }
예제 #2
0
        public void InvokeValidation(object o, EventArgs arg)
        {
            bool shouldClose = false;
            var  auth        = new AuthUser();

            _authPackage = auth.ValidateUser();
            if (_authPackage == null)
            {
                MessageBox.Show("Could not connect to server. Application will be closed immediately.");
                Application.Exit();
                shouldClose = true;
            }
            if (_authPackage != null && _authPackage.validationResult == ValidationResult.expired)
            {
                MessageBox.Show(
                    @"Your account has expired. Please Upgrade your account.\nNow, program will be closed immediately.",
                    @"CryptoDelivery",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Warning);
                shouldClose = true;
            }

            if (shouldClose)
            {
                try
                {
                    Process[] proc = Process.GetProcessesByName("CryptoTriangular");
                    foreach (Process prog in proc)
                    {
                        prog.Kill();
                    }
                }
                catch (Exception)
                {
                    Environment.Exit(0);
                }
            }

            UpdateToolStripUpdates(_authPackage);
        }
예제 #3
0
        private static void AuthorizationMethod()
        {
            bool shouldClose = false;

            try
            {
                var           authorization = new AuthUser();
                ServerPackage package       = null;
                package = authorization.ValidateUser();

                if (package == null)
                {
                    return;
                }
                if (package.validationResult == ValidationResult.expired)
                {
                    splashThread.Abort();
                    Application.Run(new PaymentWindow(package));
                }

                else if (package.validationResult == ValidationResult.actual)
                {
                    splashThread.Abort();
                    Application.Run(new MainWindow(package));
                }
                else //temporary
                {
                    splashThread.Abort();
                    Application.Run(new MainWindow(package));
                }
            }
            catch (Exception error)
            {
                //Log.Error(error);
                //HandleError.CloseProgram();
            }
        }