private void ChatStateSwitch_Click(object sender, EventArgs e) { Action actionAfterSwitch = () => { if (!chatStateSwitch.Checked) { appSettings.ChatDisabled = true; activity.StopService(new Intent(activity.ApplicationContext, typeof(MessengerService))); } else { appSettings.ChatDisabled = false; activity.StartService(new Intent(activity.ApplicationContext, typeof(MessengerService))); } SetAppSettings(appSettings); this.textViewChatState.Text = chatStateSwitch.Checked ? "W³¹czony" : "Wy³¹czony"; }; if (chatStateSwitch.Checked) { actionAfterSwitch(); } else { var confirmMessage = "Czy na pewno chcesz wy³¹czyæ czat?"; AlertsService.ShowConfirmDialog(activity, confirmMessage, actionAfterSwitch, () => { this.chatStateSwitch.Checked = !chatStateSwitch.Checked; }); } }
private void NotificationsStateSwitch_Click(object sender, EventArgs e) { Action actionAfterSwitch = () => { if (!notificationsStateSwitch.Checked) { appSettings.NotificationsDisabled = true; } else { appSettings.NotificationsDisabled = false; } SetAppSettings(appSettings); this.textViewNotificationsState.Text = notificationsStateSwitch.Checked ? "W³¹czone" : "Wy³¹czone"; }; if (notificationsStateSwitch.Checked) { actionAfterSwitch(); } else { var confirmMessage = String.Format("Czy na pewno chcesz wy³¹czyæ powiadomienia o nowoœciach?"); AlertsService.ShowConfirmDialog(activity, confirmMessage, actionAfterSwitch, () => { this.notificationsStateSwitch.Checked = !notificationsStateSwitch.Checked; }); } }
private void UserProfilePhoto_Click(object sender, EventArgs e) { Action changeProfilePiuctureAction = () => { TakePhoto(); }; AlertsService.ShowConfirmDialog(activity, "Czy chcesz zmieniæ zdjêcie profilowe?", changeProfilePiuctureAction); }
private void AddToFavourites() { AlertsService.ShowConfirmDialog(this, "Czy na pewno dodaæ to og³oszenie do ulubionych?", async() => { var idApiModel = new SingleIdModelForPostRequests { Id = this.advertisement.Id }; var responseMessage = await this.advertisementItemService.AddToUserFavouritesAdvertisements(idApiModel); AlertsService.ShowLongToast(this, responseMessage); }); }
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)); }
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 ReportWrongAdvert() { Action reportActionConfirmed = () => { Action <string> actionOnReasonSelected = async(reason) => { this.progress.ShowProgressDialog("Zg³aszanie og³oszenia naruszaj¹cego regulamin"); await this.feedbackService.ReportWrongAdvertisement(this.advertisement.Id, reason); this.progress.CloseProgressDialog(); AlertsService.ShowShortToast(this, "Og³oszenie zosta³o zg³oszone adminom"); }; string[] itemList = Resources.GetStringArray(Resource.Array.report_wrong_advert_reasons); AlertsService.ShowSingleSelectListString(this, itemList, actionOnReasonSelected, dialogTitle: "Wybierz powód"); }; AlertsService.ShowConfirmDialog(this, "Czy na pewno chcesz zg³osiæ to og³oszenie jako naruszenie regulaminu?", reportActionConfirmed); }
private void DeleteConversation() { Action actionOnConfirm = async() => { this.progress.ShowProgressDialog("Trwa oznaczanie rozmowy jako usuniêtej..."); var result = await messagesService.DeleteConversation(this.conversationInfoModel.ConversationId); this.progress.CloseProgressDialog(); if (result) { AlertsService.ShowShortToast(this, "Rozmowa zosta³a oznaczona jako usuniêta."); this.Finish(); } else { AlertsService.ShowShortToast(this, "Nie uda³o siê usun¹æ rozmowy. Spróbuj ponownie póŸniej."); } }; AlertsService.ShowConfirmDialog(this, "Czy chcesz usun¹æ tê rozmowê? Nie bêdzie ona widoczna na liœcie rozmów dopóki Ty i Twój rozmówca nie skontaktujecie siê ponownie.", actionOnConfirm); }
private void ImgBtnHomeLocalization_Click(object sender, EventArgs e) { var confirmMessage = "Czy na pewno chcesz ustaliæ aktualn¹ lokalizacjê i ustawiæ j¹ jako domow¹?"; AlertsService.ShowConfirmDialog(activity, confirmMessage, async() => { this.progressDialogHelper.ShowProgressDialog("Trwa ustalanie Twojej aktualnej lokalizacji"); try { if (!this.gpsService.CanGetLocation) { AlertsService.ShowLongToast(activity, "W³¹cz gps w ustawieniach"); } else { var location = this.gpsService.GetLocation(); var address = await this.googleMapsAPIService.GetAddress(location.Latitude, location.Longitude); appSettings.LocationSettings.Latitude = location.Latitude; appSettings.LocationSettings.Longitude = location.Longitude; appSettings.LocationSettings.LocationAddress = address; SetAppSettings(appSettings); SetHomeLocationSettings(appSettings); if (address != string.Empty) { var infoMessage = String.Format("Adres lokalizacji to w przybli¿eniu: {0}. Na odczyt lokalizacji wp³ywa wiele czynników dlatego wiemy, ¿e adres mo¿e nie byæ w 100% idealny. Twoja lokalizacja wraz z adresem nie bêdzie nikomu udostêpniona.", address); AlertsService.ShowAlertDialog(activity, infoMessage); } } } catch (Exception) { AlertsService.ShowLongToast(activity, "Wyst¹pi³ problem z okreœleniem Twojej lokalizacji. Spróbuj ponownie póŸniej"); } finally { this.progressDialogHelper.CloseProgressDialog(); } }); }
private void SendMessage() { if (editTextMessage.Text != null & editTextMessage.Text != string.Empty) { if (chatHubClientService != null && chatHubClientService.IsConnected()) { var date = DateTime.Now; var message = new ConversationMessage(); message.MessageContent = editTextMessage.Text; message.UserWasSender = true; message.ConversationId = this.conversationInfoModel.ConversationId; message.MessageHeader = String.Format("ja, {0} {1}", date.GetDateDottedStringFormat(), date.GetTimeColonStringFormat()); this.conversationMessagesListAdapter.AddReceivedMessage(message); chatHubClientService.SendMessage(editTextMessage.Text, this.conversationInfoModel.InterlocutorId.ToString(), this.conversationInfoModel.ConversationId); editTextMessage.Text = string.Empty; } else { if (appSettings.ChatDisabled) { Action actionOnConfirm = () => { appSettings.ChatDisabled = false; SharedPreferencesHelper.SetAppSettings(this, appSettings); StartService(new Intent(this.ApplicationContext, typeof(MessengerService))); this.chatHubClientService = ChatHubClientService.GetServiceInstance(bearerToken); }; AlertsService.ShowConfirmDialog(this, "Masz wy³¹czon¹ us³ugê czatu. Czy chcesz j¹ teraz w³¹czyæ?", actionOnConfirm); } else { AlertsService.ShowLongToast(this, "Nie mogê po³¹czyæ siê z serwerem. Upewnij siê czy masz dostêp do internetu."); } } } }
public override void OnBackPressed() { if (IsDrawerOpen()) { base.OnBackPressed(); } else if (sortingOptionsLayout.Visibility != ViewStates.Visible) { if (this.advertisementsSearchModel.AdvertisementsKind != AdvertisementsKind.AdvertisementsAroundUserCurrentLocation) { ShowAdvertisementList(AdvertisementsKind.AdvertisementsAroundUserCurrentLocation); } else { base.OnBackPressed(); } } else { Action actionOnConfirm = ApplyFilterOptions; Action actionOnDismiss = () => { this.advertisementsSearchModel = searchModelCopier.RestorePreviousValues(); SetupSortingViews(); ChangeFabOpenFilterOptionsDependsOnSelectedOptions(); TogleLayouts(); }; if (searchModelCopier.IsSearchModelChanged()) { AlertsService.ShowConfirmDialog(this, "Czy uwzglêdniæ dokonane zmiany w filtrach?", actionOnConfirm, actionOnDismiss); } else { TogleLayouts(); } } }