Пример #1
0
        public theBankLoader()
        {
            var theBankVievModel = new theBankVievModel();

            theBankVievModel                    = JsonConvert.DeserializeObject <theBankVievModel>(File.ReadAllText("ClientAllData.json"));
            theBankVievModel.newTransfer        = new Transfer();
            theBankVievModel.newDeposit         = new SingleDeposit();
            theBankVievModel.CurrencyRatesEURO  = Methods.LoadRates <CurrencyClass <CurrencyRates> >("http://api.nbp.pl/api/exchangerates/rates/a/eur/");
            theBankVievModel.CurrencyRatesUSD   = Methods.LoadRates <CurrencyClass <CurrencyRates> >("http://api.nbp.pl/api/exchangerates/rates/a/usd/");
            theBankVievModel.CurrencyRatesCHF   = Methods.LoadRates <CurrencyClass <CurrencyRates> >("http://api.nbp.pl/api/exchangerates/rates/a/chf/");
            theBankVievModel.CurrencyRatesGBP   = Methods.LoadRates <CurrencyClass <CurrencyRates> >("http://api.nbp.pl/api/exchangerates/rates/a/gbp/");
            theBankVievModel.CurrencyPricesEURO = Methods.Load <CurrencyClass <CurrencyPrice> >("https://api.nbp.pl/api/exchangerates/rates/c/eur/?format=json");
            theBankVievModel.CurrencyPricesUSD  = Methods.Load <CurrencyClass <CurrencyPrice> >("https://api.nbp.pl/api/exchangerates/rates/c/usd/?format=json");
            theBankVievModel.CurrencyPricesCHF  = Methods.Load <CurrencyClass <CurrencyPrice> >("https://api.nbp.pl/api/exchangerates/rates/c/chf/?format=json");
            theBankVievModel.CurrencyPricesGBP  = Methods.Load <CurrencyClass <CurrencyPrice> >("https://api.nbp.pl/api/exchangerates/rates/c/gbp/?format=json");
            theBankVievModel.SelectedCurrency   = theBankVievModel.CurrencyRatesEURO;
            _theBankVievModel                   = theBankVievModel;
        }
Пример #2
0
        public MainWindow(theBankVievModel theBankVievModel)
        {
            InitializeComponent();

            // Dodanie wszystkich kursów do słownika
            _courses = new Dictionary <string, CurrencyClass <CurrencyRates> >();
            _courses.Add("btnEuro", theBankVievModel.CurrencyRatesEURO);
            _courses.Add("btnUSD", theBankVievModel.CurrencyRatesUSD);
            _courses.Add("btnCHF", theBankVievModel.CurrencyRatesCHF);
            _courses.Add("btnGBP", theBankVievModel.CurrencyRatesGBP);

            _myControls = new Dictionary <string, UserControl>();

            _theBankVievModel = theBankVievModel;
            DataContext       = _theBankVievModel;

            InitializeAllControls();
            InitializeAllButtonsClicks();
            ChangeControl("btnMojBank");
        }
Пример #3
0
        /// <summary>
        /// Aktualizacja JSONa na którym działa bank, żeby miał zawsze zapisane aktualne dane.
        /// </summary>
        /// <param name="client"></param>
        private void SaveJSONFile(theBankVievModel client)
        {
            var saveFile = JsonConvert.SerializeObject(client, Formatting.Indented);

            File.WriteAllText("ClientAllData.json", saveFile);
        }
Пример #4
0
 public LoginWindow(theBankVievModel theBankVievModel)
 {
     InitializeComponent();
     _theBankVievModel = theBankVievModel;
     DataContext       = _theBankVievModel;
 }