Exemple #1
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();
        }
 //Alternative method
 public string GetValueFromEuropeanCentralBank(Options.Currency currency,
     Currencies.ExchangeType exchangeType)
 {
     if (_rateList.Count == 0 || _lastUpdateTime.AddHours(6) < DateTime.Now)
     {
         var oEuropeanCentralBank = new XmlEuropeanCentralBank();
         oEuropeanCentralBank.DeserializeXml();
         return PrepareJsonResponseForRecalculation(oEuropeanCentralBank.curreniesList, exchangeType, currency);
     }
     return PrepareJsonResponseForRecalculation(_rateList, exchangeType, currency);
 }