/// <summary> /// Initializes a new instance of the MainViewModel class. /// </summary> public HomePageViewModel(IMyNavigationService navigationService) { this.navigationService = navigationService; ////if (IsInDesignMode) ////{ //// // Code runs in Blend --> create design time data. ////} ////else ////{ //// // Code runs "for real" ////} LogOutFunction = new Command (() => { App.LoggedIn = false; this.navigationService.NavigateToModal(ViewModelLocator.HomePageKey); }); GoToLoginPage = new Command (param => { var x = param as String; this.navigationService.NavigateTo (ViewModelLocator.LoginPageKey); }); GoToBuylistPage = new Command (() => { this.navigationService.NavigateTo (ViewModelLocator.BuylistPageKey); }); GoToCartPage = new Command (() => { this.navigationService.NavigateTo (ViewModelLocator.CartPageKey); }); GoToConnectPage = new Command (() => { this.navigationService.NavigateTo(ViewModelLocator.ConnectPageKey); }); GoToReceivePage = new Command (() => { this.navigationService.NavigateTo(ViewModelLocator.ReceivePageKey); }); GoToMapPage = new Command (() => { this.navigationService.NavigateTo(ViewModelLocator.MapPageKey); }); GoToScannerPage = new Command (async() => { var data = await DependencyService.Get<IScanner> ().Scan (); if(data != null){ var database = new ECOdatabase(); List<WoolworthsItem> resultSet = database.SearchWoolWorthsItem(data); } }); }
public ScannerPageViewModel (IMyNavigationService navigationService) { this.navigationService = navigationService; ScanItemToCart = new Command (() => { var database = new ECOdatabase(); CartItem item1 = new CartItem ("Apple", 4.00); database.InsertItemToCart(item1); }); }
/// <summary> /// Initializes a new instance of the MainViewModel class. /// </summary> public HomePageViewModel (IMyNavigationService navigationService) { this.navigationService = navigationService; ////if (IsInDesignMode) ////{ //// // Code runs in Blend --> create design time data. ////} ////else ////{ //// // Code runs "for real" ////} /// LogOutFunction = new Command (() => { App.LoggedIn = false; var database = new ECOdatabase (); database.DeleteAllInBuyList (); this.navigationService.NavigateToModal (ViewModelLocator.HomePageKey); }); GoToLoginPage = new Command (param => { var x = param as String; this.navigationService.NavigateTo (ViewModelLocator.LoginPageKey); }); GoToBuylistPage = new Command (() => { this.navigationService.NavigateTo (ViewModelLocator.BuylistPageKey); }); GoToCartPage = new Command (() => { this.navigationService.NavigateTo (ViewModelLocator.CartPageKey); }); GoToConnectPage = new Command (() => { this.navigationService.NavigateTo (ViewModelLocator.ConnectPageKey); }); GoToReceivePage = new Command (() => { this.navigationService.NavigateTo (ViewModelLocator.ReceivePageKey); }); GoToMapPage = new Command (() => { this.navigationService.NavigateTo (ViewModelLocator.MapPageKey); }); GoToScannerPage = new Command (() => { }); }
public void OnApperaing() { var database = new ECOdatabase (); ItemList = new ObservableCollection<CartItem> (database.GetCartItemAll ()); }