//private void Button_Clicked(object sender, EventArgs e) //{ // try // { // var btn = (Button)sender; // string btnTxt = btn.Text; // _categoryLyt.Children.Clear(); // foreach (var item in homeCategories) // { // if (btnTxt == item.name) // { // catId = item.id; // Button button = new Button() // { // Text = item.name, // FontAttributes = FontAttributes.Bold, // FontSize = 16, // FontFamily = "CALIBRI", // StyleId = "CALIBRI", // CornerRadius = 30, // TextColor = Color.White, // BackgroundColor = Color.FromHex("#FE1F78"), // WidthRequest = 150 // }; // button.Clicked += Button_Clicked; // _categoryLyt.Children.Add(button); // } // else // { // Button button = new Button() // { // Text = item.name, // FontFamily = "CALIBRI", // StyleId = "CALIBRI", // CornerRadius = 30, // TextColor = Color.FromHex("#A3989C"), // BackgroundColor = Color.FromHex("#FFEFF5"), // WidthRequest = 150 // }; // button.Clicked += Button_Clicked; // _categoryLyt.Children.Add(button); // } // } // HomePageProductService.loaderCheck = true; // HomePageProductViewModel model = new HomePageProductViewModel(catId); // productListView.BindingContext = model; // } // catch (Exception) // { // } //} private void ProductListView_Refreshing(object sender, EventArgs e) { HomePageProductViewModel model = new HomePageProductViewModel(catId); productListView.BindingContext = model; productListView.EndRefresh(); }
public async Task <IActionResult> Index() { var tree = await httpHandler.GetCategoryTree(); var suppliers = await httpHandler.GetSuppliers(); var products = await httpHandler.GetProducts(15);//TODO : bunu kullan var vm = new MainViewModel { Products = HomePageProductViewModel.GetFromDto(products).ToList(), Categories = HomePageCategoryViewModel.FromHierachicalTemplate(tree).ToList(), Suppliers = HomePageSupplierViewModel.GetFromDto(suppliers).ToList(), Title = "ANA SAYFA" }; return(View(vm)); }
public async void loadLatLng() { try { var timeout = TimeSpan.FromSeconds(1); var locator = CrossGeolocator.Current; if (locator.IsGeolocationEnabled) { locator.DesiredAccuracy = 50; int tm = 1000; if (Device.OS == TargetPlatform.Android) { tm = 100000; } var position = await locator.GetPositionAsync(tm); if (position != null) { Lat = position.Latitude.ToString(); Lng = position.Longitude.ToString(); if (Device.RuntimePlatform == Device.iOS) { //firstBtn.CornerRadius = 20; //secondBtn.CornerRadius = 20; //thirdBtn.CornerRadius = 20; //fourthBtn.CornerRadius = 20; } //HomePageProductService.loaderCheck = true; HomePageProductViewModel model = new HomePageProductViewModel(catId); productListView.BindingContext = model; } } } catch (Exception ex) { } }
public async Task <IActionResult> Supplier(string Id) { var supplierId = Guid.Parse(Id); var tree = await httpHandler.GetCategoryTree(); var suppliers = await httpHandler.GetSuppliers(); var products = await httpHandler.GetProductsBySupplier(10, supplierId); var supplier = await httpHandler.GetSupplierNameById(supplierId); var vm = new MainViewModel() { Categories = HomePageCategoryViewModel.FromHierachicalTemplate(tree).ToList(), Suppliers = HomePageSupplierViewModel.GetFromDto(suppliers).ToList(), Products = HomePageProductViewModel.GetFromDto(products).ToList(), Title = supplier }; ViewData["Title"] = $"{supplier} Ürünleri"; return(View("/Views/Home/Index.cshtml", vm)); }
private void LblClose_tgr_Tapped(object sender, EventArgs e) { string ID = ""; var s = sender as StackLayout; var aa = s.Children; foreach (var item in aa) { var cn = item as Label; ID = cn.Text; break; } try { _categoryLyt.Children.Clear(); foreach (var item in homeCategories) { if (ID == item.id) { catId = item.id; // Label idlbl = new Label() { Text = item.id, IsVisible = false }; CachedImage img = new CachedImage() { Source = CommonLib.img_MainUrl + item.logo, HorizontalOptions = LayoutOptions.Center, HeightRequest = 60, WidthRequest = 60, Aspect = Aspect.AspectFit, LoadingPlaceholder = "product_Placeholder.png", Transformations = new List <ITransformation>() { new FFImageLoading.Transformations.CircleTransformation() { BorderSize = 20, BorderHexColor = "#FE1F78" } }, }; Label namelbl = new Label() { Text = item.name, TextColor = Color.FromHex("#FE1F78"), FontSize = 14, FontAttributes = FontAttributes.Bold, HorizontalTextAlignment = TextAlignment.Center, FontFamily = "CALIBRI", StyleId = "CALIBRI", }; StackLayout _imglayout = new StackLayout() { Orientation = StackOrientation.Vertical, HeightRequest = 120, BackgroundColor = Color.Transparent, // Padding = new Thickness(5, 5, 5, 5), Children = { idlbl, img, namelbl } }; var lblClose_tgr = new TapGestureRecognizer(); lblClose_tgr.Tapped += LblClose_tgr_Tapped; _imglayout.GestureRecognizers.Add(lblClose_tgr); _categoryLyt.Children.Add(_imglayout); // } else { // Label idlbl = new Label() { Text = item.id, IsVisible = false }; CachedImage img = new CachedImage() { Source = CommonLib.img_MainUrl + item.logo, HorizontalOptions = LayoutOptions.Center, HeightRequest = 60, WidthRequest = 60, Aspect = Aspect.AspectFit, LoadingPlaceholder = "product_Placeholder.png", Transformations = new List <ITransformation>() { new FFImageLoading.Transformations.CircleTransformation() { BorderSize = 20, BorderHexColor = "#68696b" } }, }; Label namelbl = new Label() { Text = item.name, TextColor = Color.FromHex("#68696b"), FontSize = 14, FontAttributes = FontAttributes.Bold, HorizontalTextAlignment = TextAlignment.Center, FontFamily = "CALIBRI", StyleId = "CALIBRI", }; StackLayout _imglayout = new StackLayout() { Orientation = StackOrientation.Vertical, HeightRequest = 120, BackgroundColor = Color.Transparent, // Padding = new Thickness(5, 5, 5, 5), Children = { idlbl, img, namelbl } }; var lblClose_tgr = new TapGestureRecognizer(); lblClose_tgr.Tapped += LblClose_tgr_Tapped; _imglayout.GestureRecognizers.Add(lblClose_tgr); _categoryLyt.Children.Add(_imglayout); // } } HomePageProductService.loaderCheck = true; HomePageProductViewModel model = new HomePageProductViewModel(catId); productListView.BindingContext = model; } catch (Exception) { } }