public HomePage() { InitializeComponent(); BindingContext = viewModel = new HomePageViewModel(); ModalOverlay.BackgroundColor = Color.FromRgba(0, 0, 0, 0.5); _liquidationCategoryService = DependencyService.Get <ILiquidationCategoryService>(); MessagingCenter.Subscribe <AddLiquidationPage>(this, "OnSaveItem", async(sender) => await viewModel.LoadLiquidationList()); MessagingCenter.Subscribe <LiquidationDetailPage, Guid>(this, "OnDeleted", async(sender, liquidationId) => { if (viewModel.Type0List.Any(x => x.Id == liquidationId)) { await viewModel.LoadLiquidationList(); } }); MessagingCenter.Subscribe <AddToDayPage>(this, "OnSaveItem", async(sender) => await viewModel.LoadLiquidationToDayList()); MessagingCenter.Subscribe <PickerLiquidationPage>(this, "OnSaveItem", async(sender) => await viewModel.LoadLiquidationToDayList()); MessagingCenter.Subscribe <ToDayDetailPage, Guid>(this, "OnDeleted", async(sender, todayId) => { if (viewModel.LiquidationToDayList.Any(x => x.Id == todayId)) { await viewModel.LoadLiquidationToDayList(); } }); Init(); }
public async void Init() { await Task.WhenAll(viewModel.LoadLiquidationList(), viewModel.LoadLiquidationToDayList(), viewModel.LoadSlideList(), viewModel.LoadAdvertise()); SetUpSlideImages(); LoadCategories(); loadingPopup.IsVisible = false; }