Example #1
0
		private void Initialize(){
			LoggedIn = false;
			LoginToolBarIsShow = false;


			//reset
			var database = new ECOdatabase ();
			database.DeleteAllInBuyList ();
			database.DeleteAllInCart ();
			database.DeleteAllInWoolworthsItem ();

			string prefix = Device.OnPlatform("", "", "Images/");

//			database.DeleteAllInWoolworthsItem ();
			if (database.GetWoolWorthsItemAll ().Count == 0) {
				WoolworthsItem item1 = new WoolworthsItem ("50375264", "Kleenex Tissues", 2.50, prefix + "tissue.png");
				WoolworthsItem item2 = new WoolworthsItem ("4001686301562", "Haribo Goldbears", 1.35, prefix + "Haribo-Gold-Bears.png");
				WoolworthsItem item3 = new WoolworthsItem ("4947678649536", "Body Sheet", 2.80, prefix + "bodysheet.png");
				WoolworthsItem item4 = new WoolworthsItem ("9310055101432", "Crunchy Nut", 7.60, prefix + "crunchy_nut.jpg");
				WoolworthsItem item5 = new WoolworthsItem ("9310055537286", "Kellogg's Original", 8.20, prefix + "Kelloggs-Original.png");
				WoolworthsItem item6 = new WoolworthsItem ("9300675011037", "Coke Cola Diet", 3.20, prefix + "cocacola-diet.png");
				database.InsertItemToWoolWorthsItem (item1);
				database.InsertItemToWoolWorthsItem (item2);
				database.InsertItemToWoolWorthsItem (item3);
				database.InsertItemToWoolWorthsItem (item4);
				database.InsertItemToWoolWorthsItem (item5);
				database.InsertItemToWoolWorthsItem (item6);
			}
		}
Example #2
0
		async void Scanner (object sender, EventArgs args)
		{
			var data = await DependencyService.Get<IScanner> ().Scan ();

			if (data != null) {
				var database = new ECOdatabase ();
				List<WoolworthsItem> resultSet = database.SearchWoolWorthsItem (data);

				if (resultSet.Count == 1) {
					CartItem scannedItem = new CartItem (resultSet [0].itemName, resultSet [0].itemPrice, resultSet [0].itemImage);
					database.InsertItemToCart (scannedItem);
					Navigation.PushAsync (new CartPage ());
				} else {
					DisplayAlert ("Scanner", "No item found", "OK");
				}

			}
		}