private static void AuthorizationMethod()
        {
            try
            {
                Auth authorization = new Auth();
                Auth.ServerPackage package = authorization.ValidateUser();
                if (package == null)
                {
                    HandleError.NoInternetConnection();
                    return;
                }
                if (package.validationResult == Auth.ValidationResult.expired)
                {
                    splashThread.Abort();
                    Application.Run(new PaymentWindow(out package));
                }

                else if (package.validationResult == Auth.ValidationResult.actual)
                {
                    splashThread.Abort();
                    Application.Run(new CryptoDelivery(package));
                }
                else //temporary
                {
                    splashThread.Abort();
                    Application.Run(new CryptoDelivery(package));
                }
            }
            catch (Exception  error)
            {
                Log.Error(error);
                HandleError.CloseProgram();
            }
        }
 public PaymentWindow(out Auth.ServerPackage receivedPackage)
 {
     //Auth auth = new Auth();
     InitializeComponent();
     button1_Click(new object(), new EventArgs());
     receivedPackage = package;
 }
Exemple #3
0
 public CryptoDelivery(Auth.ServerPackage package)
 {
     _authPackage = package;
     InitializeComponent();
     _background = new Logic();
     _oldbackground = new Logic();
     _options = new Options();
     toolStripStatusInfo.Text = "Ready";
     notifyIcon.Visible = true;
     Worker1.WorkerSupportsCancellation = true;
     LoadOptions();
     UpdateToolStripStatusCurrency();
     btn_GetValues_Click(new object(),new EventArgs());
     InitTimerValidation();
 }
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         this.Enabled = false;
         button1.Enabled = false;
         Auth auth = new Auth();
         var serverpackage = auth.ValidateUser();
         if (serverpackage.validationResult == Auth.ValidationResult.actual)
         {
             lb_accountHasExpired.Text = String.Format("Account active for {0} day(s)",
                 serverpackage.GetDaysToExpire());
             serverpackage.locked = false;
         }
         else if(serverpackage.validationResult == Auth.ValidationResult.expired)
         {
             lb_accountHasExpired.Text = String.Format("Your account has expired!");
             serverpackage.locked = true;
         }
         else if (serverpackage.validationResult == Auth.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 = button1.Visible = false;
         }
         package = serverpackage;
         lb_addressBtc.Text = package.wallet;
         this.Enabled = true;
         button1.Enabled = true;
     }
     catch (Exception ee)
     {
         Log.Error(ee);
         HandleError.CloseProgram();
     }
 }
Exemple #5
0
        public void InvokeValidation(object o, EventArgs arg)
        {
            var auth = new Auth();
            _authPackage = auth.ValidateUser();
            if (_authPackage == null)
            {
                HandleError.NoInternetConnection();
                Application.Exit();
                return;
            }
            if (_authPackage.validationResult == Auth.ValidationResult.expired)
            {
                MessageBox.Show(
                    @"Your account has expired. Please Upgrade your account.\nNow, program will be closed immediately.",
                    @"CryptoDelivery",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Warning);
                Application.Exit();
            }

            var ecb = new XmlEuropeanCentralBank();
            ecb.DeserializeXml();
        }