Exemple #1
0
        //Constructor
        public CurrencyViewModel(SQLiteCurrencyStore currencyStore, SQLiteAppStateStore appStateStore)
        {
            _currencyStore = currencyStore;
            _appStateStore = appStateStore;

            //Set the property to a new Command containing the method I want to call
            SwapCommand             = new Command(execute: () => { SwapCurrencies(); });
            LoadDataCommand         = new Command(async() => await LoadData());
            SaveAppStateDataCommand = new Command(async() => await SaveAppStateData());
        }
        public MainView()
        {
            //Get the tables
            var database      = DependencyService.Get <ISQLiteDb>();
            var currencyStore = new SQLiteCurrencyStore(database);
            var appStateStore = new SQLiteAppStateStore(database);

            ViewModel = new CurrencyViewModel(currencyStore, appStateStore);

            InitializeComponent();
        }