private void OnEditAdvertisementClick(int positionId) { if (EditAdvertisementItemClick != null) { var clickArgs = new FabOnAdvertisementItemRowClicked(); clickArgs.Id = this.AdvertisementItems[positionId].Id; clickArgs.Action = Models.Enums.ActionKindAfterClickFabOnAdvertisementItemRow.Edit; EditAdvertisementItemClick(this, clickArgs); } }
private void OnDeleteAdvertisementClick(int positionId) { if (DeleteAdvertisementItemClick != null) { var clickArgs = new FabOnAdvertisementItemRowClicked(); clickArgs.Id = this.AdvertisementItems[positionId].Id; if (this.AdvertisementItems[positionId].IsExpired && advertisementsKind == AdvertisementsKind.AdvertisementsCreatedByUser) { clickArgs.Action = Models.Enums.ActionKindAfterClickFabOnAdvertisementItemRow.Restart; } else if (this.AdvertisementItems[positionId].IsExpired || advertisementsKind == AdvertisementsKind.FavouritesAdvertisements) { clickArgs.Action = Models.Enums.ActionKindAfterClickFabOnAdvertisementItemRow.DeleteFromFavourites; } else { clickArgs.Action = Models.Enums.ActionKindAfterClickFabOnAdvertisementItemRow.MarkAsExpired; } DeleteAdvertisementItemClick(this, clickArgs); } }
private void AdvertisementItemListAdapter_DeleteAdvertisementItemClick(object sender, FabOnAdvertisementItemRowClicked clickArgs) { if (clickArgs.Id == 0) { AlertsService.ShowLongToast(this, "Wyst¹pi³ b³¹d"); return; } var message = clickArgs.Action.GetDisplayName(); AlertsService.ShowConfirmDialog(this, message, async() => { var success = false; if (clickArgs.Action == Models.Enums.ActionKindAfterClickFabOnAdvertisementItemRow.Restart) { Action actionOnConfirmEditFirst = () => { GetPrepareToAdvertisementEditAction(clickArgs.Id)(); }; Action actionOnCancelEditFirst = async() => { success = await this.advertisementItemService.RestartAdvertisement(clickArgs.Id); if (success) { AlertsService.ShowLongToast(this, "Pomyœlnie zakoñczono tê operacjê."); RefreshAdvertisementList(true); } else { AlertsService.ShowLongToast(this, "Nie uda³o siê wykonaæ tej operacji."); } }; AlertsService.ShowConfirmDialog(this, "Czy chcesz wczeœniej zaktualizowaæ treœæ lub zdjêcia?", actionOnConfirmEditFirst, actionOnCancelEditFirst); } else { success = await this.advertisementItemService.DeleteAdvertisement(clickArgs.Id, this.advertisementsSearchModel.AdvertisementsKind); if (success) { AlertsService.ShowLongToast(this, "Pomyœlnie zakoñczono tê operacjê."); RefreshAdvertisementList(true); } else { AlertsService.ShowLongToast(this, "Nie uda³o siê wykonaæ tej operacji."); } } }); }
private void AdvertisementItemListAdapter_EditAdvertisementItemClick(object sender, FabOnAdvertisementItemRowClicked clickArgs) { if (clickArgs.Id == 0) { AlertsService.ShowLongToast(this, "Wyst¹pi³ b³¹d"); return; } var message = clickArgs.Action.GetDisplayName(); AlertsService.ShowConfirmDialog(this, message, GetPrepareToAdvertisementEditAction(clickArgs.Id)); }