private void Page_Loaded(object sender, RoutedEventArgs e) { //webHandler.POS_Order_ProductCompleted += (x, y) => { resultout = y.got; CheckResult(); }; //webHandler.POS_Order_OptionsCompleted += (x, y) => { resultout1 = y.got; CheckResult(); }; POS_ProductOptions(); this.productSold = new SalesOrder().Sold; total.DataContext = _ItemViewModel; fly.DataContext = _ItemViewModel; }
private async void remove_TouchDown(object sender, TouchEventArgs e) { var win = (MetroWindow)Application.Current.MainWindow; var res = await win.ShowMessageAsync("Remove Item", "Are you sure you want to remove this item from cart?", MessageDialogStyle.AffirmativeAndNegative); if (res == MessageDialogResult.Affirmative) { var _id = ((Button)sender).Tag; foreach (var item in productSold.ProductCollection) { if (item.Productid.Equals(_id)) { listBoxwithitems.SelectedItem = item; } } SaleModelProducts selected = (SaleModelProducts)listBoxwithitems.SelectedItem; productSold.ProductCollection.Remove(selected); Sum(); } }
private void Tile_TouchDown(object sender, TouchEventArgs e) { try { var _id = ((Button)sender).Tag; foreach (var item in allProducts.ProductCollection) { if (item.Productid.Equals(_id)) { listBox.SelectedItem = item; } } SaleModelProducts selected = (SaleModelProducts)listBox.SelectedItem; var totalQuantity = int.Parse(selected.ProductTotalQuantity); totalQuantity++; var totalPrice = double.Parse(selected.ProductPrice) * totalQuantity; selected.ProductTotalQuantity = totalQuantity.ToString(); selected.ProductTotalPrice = totalPrice.ToString(); } catch (Exception e1) { Debug.WriteLine(e1.Message); } }