public override void OnViewCreated(View view, Bundle savedInstanceState) { try { base.OnViewCreated(view, savedInstanceState); TypeFilter = Arguments.GetString("TypeFilter"); switch (TypeFilter) { case "Market": ContextMarket = (TabbedMarketActivity)Activity; break; case "NearbyShops": ContextNearbyShops = (NearbyShopsActivity)Activity; break; case "NearbyBusiness": ContextNearbyBusiness = (NearbyBusinessActivity)Activity; break; } InitComponent(view); } catch (Exception exception) { Methods.DisplayReportResultTrack(exception); } }
protected override void OnCreate(Bundle savedInstanceState) { try { base.OnCreate(savedInstanceState); SetTheme(AppSettings.SetTabDarkTheme ? Resource.Style.MyTheme_Dark_Base : Resource.Style.MyTheme_Base); Methods.App.FullScreenApp(this); // Create your application here SetContentView(Resource.Layout.MarketMain_Layout); Instance = this; //Get Value And Set Toolbar InitComponent(); InitToolbar(); SetRecyclerViewAdapters(); LoadDataApi(); AdsGoogle.Ad_Interstitial(this); } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
private void DestroyBasic() { try { ViewPager = null !; TabLayout = null !; MarketTab = null !; MyProductsTab = null !; FloatingActionButtonView = null !; CatRecyclerView = null !; CategoriesAdapter = null !; DiscoverButton = null !; FilterButton = null !; KeySearch = null !; Instance = null !; } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
private void DestroyBasic() { try { ViewPager = null; TabLayout = null; MarketTab = null; MyProductsTab = null; FloatingActionButtonView = null; CatRecyclerView = null; CategoriesAdapter = null; DiscoverButton = null; FilterButton = null; KeySearch = null; Instance = null; } catch (Exception e) { Console.WriteLine(e); } }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { try { Context contextThemeWrapper = AppSettings.SetTabDarkTheme ? new ContextThemeWrapper(Activity, Resource.Style.MyTheme_Dark_Base) : new ContextThemeWrapper(Activity, Resource.Style.MyTheme_Base); // clone the inflater using the ContextThemeWrapper LayoutInflater localInflater = inflater.CloneInContext(contextThemeWrapper); View view = localInflater.Inflate(Resource.Layout.BottomSheetMarketFilter, container, false); TypeFilter = Arguments.GetString("TypeFilter"); switch (TypeFilter) { case "Market": ContextMarket = (TabbedMarketActivity)Activity; break; case "NearbyShops": ContextNearbyShops = (NearbyShopsActivity)Activity; break; case "NearbyBusiness": ContextNearbyBusiness = (NearbyBusinessActivity)Activity; break; } InitComponent(view); return(view); } catch (Exception e) { Console.WriteLine(e); return(null); } }
private async void TxtAddOnClick(object sender, EventArgs e) { try { if (!Methods.CheckConnectivity()) { Toast.MakeText(this, GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show(); } else { if (string.IsNullOrEmpty(TxtTitle.Text)) { Toast.MakeText(this, GetText(Resource.String.Lbl_Please_enter_name), ToastLength.Short).Show(); return; } if (string.IsNullOrEmpty(TxtPrice.Text)) { Toast.MakeText(this, GetText(Resource.String.Lbl_Please_enter_price), ToastLength.Short).Show(); return; } if (string.IsNullOrEmpty(TxtLocation.Text)) { Toast.MakeText(this, GetText(Resource.String.Lbl_Please_select_Location), ToastLength.Short).Show(); return; } if (string.IsNullOrEmpty(TxtAbout.Text)) { Toast.MakeText(this, GetText(Resource.String.Lbl_Please_enter_about), ToastLength.Short).Show(); return; } if (string.IsNullOrEmpty(TxtCurrency.Text)) { Toast.MakeText(this, GetText(Resource.String.Lbl_Please_enter_Currency), ToastLength.Short).Show(); return; } var list = MAdapter.AttachmentList.Where(a => a.TypeAttachment != "Default").ToList(); if (list.Count == 0) { Toast.MakeText(this, GetText(Resource.String.Lbl_Please_select_Image), ToastLength.Short).Show(); } else { //Show a progress AndHUD.Shared.Show(this, GetText(Resource.String.Lbl_Loading) + "..."); if (!string.IsNullOrEmpty(DeletedImagesIds)) { DeletedImagesIds = DeletedImagesIds.Remove(DeletedImagesIds.Length - 1, 1); } var(currency, currencyIcon) = WoWonderTools.GetCurrency(ProductData.Currency); Console.WriteLine(currency); var price = TxtPrice.Text.Replace(currencyIcon, "").Replace(" ", ""); var(apiStatus, respond) = await RequestsAsync.Market.Edit_Product(ProductData.Id, TxtTitle.Text, TxtAbout.Text, TxtLocation.Text, price, CurrencyId, CategoryId, ProductType, list, DeletedImagesIds); if (apiStatus == 200) { if (respond is MessageObject result) { Console.WriteLine(result.Message); var listImage = list.Select(productPathImage => new Images { Id = "", ProductId = ProductData.Id, Image = productPathImage.FileSimple, ImageOrg = productPathImage.FileSimple }).ToList(); //Add new item to my Event list var user = ListUtils.MyProfileList?.FirstOrDefault(); if (TabbedMarketActivity.GetInstance()?.MyProductsTab.MAdapter?.MarketList != null) { var data = TabbedMarketActivity.GetInstance()?.MyProductsTab.MAdapter.MarketList?.FirstOrDefault(a => a.Id == ProductData.Id); if (data != null) { data.Id = ProductData.Id; data.Name = TxtTitle.Text; data.UserId = UserDetails.UserId; data.Location = TxtLocation.Text; data.Description = TxtAbout.Text; data.Category = CategoryId; data.Images = listImage; data.Price = TxtPrice.Text; data.Type = ProductType; data.Seller = user; TabbedMarketActivity.GetInstance()?.MyProductsTab.MAdapter?.NotifyItemChanged(TabbedMarketActivity.GetInstance().MyProductsTab.MAdapter.MarketList.IndexOf(data)); Intent intent = new Intent(); intent.PutExtra("itemData", JsonConvert.SerializeObject(data)); SetResult(Result.Ok, intent); } } AndHUD.Shared.ShowSuccess(this); Toast.MakeText(this, GetString(Resource.String.Lbl_ProductSuccessfullyEdited), ToastLength.Short).Show(); Finish(); } } else { Methods.DisplayReportResult(this, respond); } AndHUD.Shared.Dismiss(this); } } } catch (Exception exception) { Console.WriteLine(exception); AndHUD.Shared.Dismiss(this); } }
private async void TxtAddOnClick(object sender, EventArgs e) { try { if (!Methods.CheckConnectivity()) { Toast.MakeText(this, GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short)?.Show(); } else { if (string.IsNullOrEmpty(TxtTitle.Text)) { Toast.MakeText(this, GetText(Resource.String.Lbl_Please_enter_name), ToastLength.Short)?.Show(); return; } if (string.IsNullOrEmpty(TxtPrice.Text)) { Toast.MakeText(this, GetText(Resource.String.Lbl_Please_enter_price), ToastLength.Short)?.Show(); return; } if (string.IsNullOrEmpty(TxtLocation.Text)) { Toast.MakeText(this, GetText(Resource.String.Lbl_Please_select_Location), ToastLength.Short)?.Show(); return; } if (string.IsNullOrEmpty(TxtAbout.Text)) { Toast.MakeText(this, GetText(Resource.String.Lbl_Please_enter_about), ToastLength.Short)?.Show(); return; } if (string.IsNullOrEmpty(TxtCurrency.Text)) { Toast.MakeText(this, GetText(Resource.String.Lbl_Please_enter_Currency), ToastLength.Short)?.Show(); return; } var list = MAdapter.AttachmentList.Where(a => a.TypeAttachment != "Default").ToList(); if (list.Count == 0) { Toast.MakeText(this, GetText(Resource.String.Lbl_Please_select_Image), ToastLength.Short)?.Show(); } else { //Show a progress AndHUD.Shared.Show(this, GetText(Resource.String.Lbl_Loading) + "..."); var(apiStatus, respond) = await RequestsAsync.Market.Create_Product(TxtTitle.Text, TxtAbout.Text, TxtLocation.Text, TxtPrice.Text, CurrencyId, CategoryId, ProductType, list); if (apiStatus == 200) { if (respond is CreateProductObject result) { AndHUD.Shared.ShowSuccess(this); Toast.MakeText(this, GetText(Resource.String.Lbl_CreatedSuccessfully), ToastLength.Short)?.Show(); var listImage = list.Select(productPathImage => new Images { Id = "", ProductId = result.ProductId.ToString(), Image = productPathImage.FileSimple, ImageOrg = productPathImage.FileSimple }).ToList(); //Add new item to my Event list var user = ListUtils.MyProfileList?.FirstOrDefault(); ProductDataObject data = new ProductDataObject { Name = TxtTitle.Text, UserId = UserDetails.UserId, Id = result.ProductId.ToString(), Location = TxtLocation.Text, Description = TxtAbout.Text, Category = CategoryId, Images = new List <Images>(listImage), Price = TxtPrice.Text, Type = ProductType, Seller = user, Currency = CurrencyId, }; if (TabbedMarketActivity.GetInstance()?.MyProductsTab.MAdapter.MarketList != null) { TabbedMarketActivity.GetInstance()?.MyProductsTab.MAdapter?.MarketList?.Insert(0, data); TabbedMarketActivity.GetInstance()?.MyProductsTab.MAdapter?.NotifyItemInserted(TabbedMarketActivity.GetInstance().MyProductsTab.MAdapter.MarketList.IndexOf(data)); } Intent returnIntent = new Intent(); returnIntent?.PutExtra("product", JsonConvert.SerializeObject(data)); SetResult(Result.Ok, returnIntent); Finish(); } } else { Methods.DisplayAndHudErrorResult(this, respond); } } } } catch (Exception exception) { Methods.DisplayReportResultTrack(exception); AndHUD.Shared.Dismiss(this); } }
public void OnClick(MaterialDialog p0, DialogAction p1) { try { if (TypeDialog == "DeletePost") { try { if (!Methods.CheckConnectivity()) { Toast.MakeText(this, GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short)?.Show(); return; } var adapterGlobal = WRecyclerView.GetInstance()?.NativeFeedAdapter; var diff = adapterGlobal?.ListDiffer; var dataGlobal = diff?.Where(a => a.PostData?.PostId == ProductData?.PostId).ToList(); if (dataGlobal != null) { foreach (var postData in dataGlobal) { WRecyclerView.GetInstance()?.RemoveByRowIndex(postData); } } var recycler = TabbedMainActivity.GetInstance()?.NewsFeedTab?.MainRecyclerView; var dataGlobal2 = recycler?.NativeFeedAdapter.ListDiffer?.Where(a => a.PostData?.PostId == ProductData?.PostId).ToList(); if (dataGlobal2 != null) { foreach (var postData in dataGlobal2) { recycler.RemoveByRowIndex(postData); } } if (TabbedMarketActivity.GetInstance()?.MyProductsTab?.MAdapter?.MarketList != null) { TabbedMarketActivity.GetInstance().MyProductsTab.MAdapter.MarketList?.Remove(ProductData); TabbedMarketActivity.GetInstance().MyProductsTab.MAdapter.NotifyDataSetChanged(); } if (TabbedMarketActivity.GetInstance()?.MarketTab?.MAdapter?.MarketList != null) { TabbedMarketActivity.GetInstance().MarketTab.MAdapter.MarketList?.Remove(ProductData); TabbedMarketActivity.GetInstance().MarketTab.MAdapter.NotifyDataSetChanged(); } Toast.MakeText(this, GetText(Resource.String.Lbl_postSuccessfullyDeleted), ToastLength.Short)?.Show(); PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Global.Post_Actions(ProductData.PostId, "delete") }); Finish(); } catch (Exception e) { Methods.DisplayReportResultTrack(e); } } else { if (p1 == DialogAction.Positive) { } else if (p1 == DialogAction.Negative) { p0.Dismiss(); } } } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }