private async void PostPicture() { try { if (IsVideo) { await ExecuteAsync(new ClaimVideoRequest() { VideoUri = mediaUri, Title = this.Title, Tags = this.TagArray, Categories = this.CategoryArray, Location = location }); } else { await ExecuteAsync(new ClaimPictureRequest() { PictureUri = mediaUri, Title = this.Title, Tags = this.TagArray, Categories = this.CategoryArray, Location = location }); } NavigationService.GoBack(); } catch (JsonRpcException e) { await AlertMessageService.ShowAsync(e.Message, ResourceLoader.GetString("ErrorCannotPost")); } }
public override void Load() { IAlertMessageService alertMessageService = new AlertMessageService(); ILogService logService = new LogService(); IDataExchangeService dataService = new DataExchangeService(); Bind <MainViewModel>().ToSelf(); Bind <DrinkList>().ToSelf().InSingletonScope(); Bind <DrinksViewModel>().ToSelf(); Bind <NewDrinkViewModel>().ToSelf(); Bind <DrinkDetailViewModel>().ToSelf(); Bind <EditDrinkViewModel>().ToSelf(); Bind <RecipeDetailViewModel>().ToSelf(); Bind <RecipesViewModel>().ToSelf(); Bind <NewRecipeViewModel>().ToSelf(); Bind <EditRecipeViewModel>().ToSelf(); Bind <ConfigurationDetailViewModel>().ToSelf(); Bind <ConfigurationsViewModel>().ToSelf(); Bind <EditConfigurationViewModel>().ToSelf(); Bind <NewConfigurationViewModel>().ToSelf(); Bind <CocktailModeViewModel>().ToSelf(); Bind <SelectConfigurationViewModel>().ToSelf(); Bind <IAlertMessageService>().ToMethod(x => alertMessageService).InSingletonScope(); Bind <ILogService>().ToMethod(x => logService).InSingletonScope(); Bind <IDataExchangeService>().ToMethod(x => dataService).InSingletonScope(); }
private async void ShowError(String technicalMessage) { ResetUpload(); var errorMessage = string.Format(CultureInfo.CurrentCulture, ResourceLoader.GetString("GeneralServiceErrorMessage"), Environment.NewLine, technicalMessage); await AlertMessageService.ShowAsync(errorMessage, ResourceLoader.GetString("ErrorServiceUnreachable")); }
public async Task CancelDownloadAction() { await AlertMessageService.ShowAsync( ResourceLoader.GetString("CancelDownloadMsg"), ResourceLoader.GetString("CancelDownloadTitle"), new UICommand( ResourceLoader.GetString("CancelText")), new UICommand(ResourceLoader.GetString("ConfirmText"), _ => { CancelDownload(true); })); }
private async Task Delete() { await AlertMessageService.ShowAsync( ResourceLoader.GetString("DeletePublicationAlertMsg"), ResourceLoader.GetString("DeletePublicationAlertTitle"), new UICommand(ResourceLoader.GetString("CancelText")), new UICommand(ResourceLoader.GetString("ConfirmText"), async c => { EventAggregator.GetEvent <PublicationDeletedEvent>().Publish(BookId); await PublicationUtil.Instance.DeletePublicationByUser(BookId); })); }
private void ClearAlert(int alertNotificationId) { RockContext rockContext = new RockContext(); AlertNotificationService alertNotificationService = new AlertNotificationService(rockContext); AlertMessageService alertMessageService = new AlertMessageService(rockContext); var alert = alertNotificationService .Get(alertNotificationId); alert.IsActive = false; rockContext.SaveChanges(); }
protected async Task <T> ExecuteAsync <T>(JsonRpcRequest <T> request) { T result = default(T); JsonRpcException rpcException = null; Exception exception = null; try { LoadingData = true; if (loadDelay > 0) { await Task.Delay(TimeSpan.FromSeconds(loadDelay)); } result = await JsonRpcClient.InvokeAsync <T>(request); } catch (AggregateException ex) { exception = ex; rpcException = ex.InnerException as JsonRpcException; } catch (JsonRpcException ex) { rpcException = ex; } catch (Exception ex) { exception = ex; } finally { LoadingData = false; } if (rpcException != null) { throw rpcException; } else if (exception != null) { var errorMessage = string.Format(CultureInfo.CurrentCulture, ResourceLoader.GetString("GeneralServiceErrorMessage"), Environment.NewLine, exception.Message); await AlertMessageService.ShowAsync(errorMessage, ResourceLoader.GetString("ErrorServiceUnreachable")); throw exception; } return(result); }
private async Task SignOut() { NavigationService = IoCContainer.Instance.ResolveInterface <INavigationService>(); await AlertMessageService.ShowAsync(ResourceLoader.GetString("SignOutAlertMsg"), ResourceLoader.GetString("SignOutAlertTitle"), new UICommand(ResourceLoader.GetString("CancelText")), new UICommand(ResourceLoader.GetString("ConfirmText"), u => { EventAggregator.GetEvent <LogoutEvent>().Publish(true); LoginUtil.Instance.Logout(); SessionService.SessionState.Clear(); NavigationService.ClearHistory(); NavigationService.Navigate("Login", null); })); }
private void CreateAlert(DefinedValueCache audience) { if (audience == null) { maPopup.Show("The audience is not defined.", ModalAlertType.Information); return; } RockContext rockContext = new RockContext(); AlertNotificationService alertNotificationService = new AlertNotificationService(rockContext); AlertMessageService alertMessageService = new AlertMessageService(rockContext); int alertTypeId = 31480; var alertnotification = new AlertNotification { Title = lAlertTitle.Text, AlertNotificationTypeValueId = alertTypeId, AudienceValueId = audience.Id, IsActive = true, }; alertNotificationService.Add(alertnotification); rockContext.SaveChanges(); var alertMessage = new AlertMessage { AlertNotificationId = alertnotification.Id, Message = lMessage.Text, }; alertMessageService.Add(alertMessage); rockContext.SaveChanges(); alertMessage.SendCommunication(GetAttributeValue("From").AsGuid()); mdCustomMessage.Hide(); mdLockdownAlert.Hide(); maPopup.Show("The LockDown message has been sent.", ModalAlertType.Information); }
private void BindRepeater() { RockContext rockContext = new RockContext(); AlertNotificationService alertNotificationService = new AlertNotificationService(rockContext); AlertMessageService alertMessageService = new AlertMessageService(rockContext); var alerts = alertNotificationService .Queryable() .Where(a => a.IsActive) .OrderBy(a => a.CreatedDateTime) .ToList(); rNotifications.DataSource = alerts; rNotifications.DataBind(); }
private async Task ChangePassword() { var result = await LoginUtil.Instance.ChangePassword(NewPassword, PasswordConfirm); switch (result) { case PasswordChangeEnum.LengthInvalid: ErrorMessageForChangePwd = ResourceLoader.GetString("PasswordToShortErrorMsg"); break; case PasswordChangeEnum.NotMatch: ErrorMessageForChangePwd = ResourceLoader.GetString("PasswordNotMatchErrorMsg"); break; case PasswordChangeEnum.ChangeFailure: await AlertMessageService.ShowAsync(ResourceLoader.GetString("UnExpectedError"), "", new UICommand { Label = "OK" }); break; case PasswordChangeEnum.ChangeSuccess: ShowChangePasswordPopup = false; await AlertMessageService.ShowAsync(ResourceLoader.GetString("PasswordChangedMsg"), "", new UICommand { Label = "OK", Invoked = c => { GotoMainPage(); } }); break; } }
protected void mdSendUpdate_SendClick(object sender, EventArgs e) { RockContext rockContext = new RockContext(); AlertMessageService alertMessageService = new AlertMessageService(rockContext); string message = tbAlertMessage.Text.Trim(); int AlertID = Int32.Parse(hfAlertID.Value); alertMessageService.Add(new AlertMessage { AlertNotificationId = AlertID, Message = message, CommunicationId = 40558, }); rockContext.SaveChanges(); mdSendUpdate.Hide(); BindRepeater(); }
protected void ItemBound(object sender, RepeaterItemEventArgs args) { if (args.Item.ItemType == ListItemType.Item || args.Item.ItemType == ListItemType.AlternatingItem) { var alertNotification = ( AlertNotification )args.Item.DataItem; RockContext rockContext = new RockContext(); AlertMessageService alertMessageService = new AlertMessageService(rockContext); var alertMessages = alertMessageService .Queryable() .Where(a => a.AlertNotificationId == alertNotification.Id) .OrderByDescending(a => a.Id) .ToList(); Repeater rNotificationsMessages = ( Repeater )args.Item.FindControl("rNotificationsMessages"); rNotificationsMessages.DataSource = alertMessages; rNotificationsMessages.DataBind(); } }
protected void AllClear_Click(object sender, CommandEventArgs e) { if (e.CommandName == "AllClear_Click") { int index; bool bIsConverted = int.TryParse(e.CommandArgument.ToString(), out index); RockContext rockContext = new RockContext(); AlertNotificationService alertNotificationService = new AlertNotificationService(rockContext); AlertMessageService alertMessageService = new AlertMessageService(rockContext); var alert = alertNotificationService .Get(index); alert.IsActive = false; rockContext.SaveChanges(); BindRepeater(); } }
protected void btnStaff_Click(object sender, EventArgs e) { GetStaff(); RockContext rockContext = new RockContext(); AlertNotificationService alertNotificationService = new AlertNotificationService(rockContext); AlertMessageService alertMessageService = new AlertMessageService(rockContext); int alertTypeId = 31480; int alertAudienceId = 31476; var alertnotification = new AlertNotification { Title = lAlertTitle.Text, AlertNotificationTypeValueId = alertTypeId, AudienceValueId = alertAudienceId, IsActive = true, }; alertNotificationService.Add(alertnotification); rockContext.SaveChanges(); alertMessageService.Add(new AlertMessage { AlertNotificationId = alertnotification.Id, Message = lMessage.Text, CommunicationId = 40558, }); rockContext.SaveChanges(); }
protected void mdSendUpdate_SendClick(object sender, EventArgs e) { int alertID = hfAlertID.Value.AsInteger(); if (tbAlertMessage.Text.IsNotNullOrWhiteSpace()) { RockContext rockContext = new RockContext(); AlertMessageService alertMessageService = new AlertMessageService(rockContext); AlertNotificationService alertNotificationService = new AlertNotificationService(rockContext); var alert = alertNotificationService .Get(alertID); var alertMessage = new AlertMessage { AlertNotification = alert, Message = tbAlertMessage.Text, }; alertMessageService.Add(alertMessage); rockContext.SaveChanges(); alertMessage.SendCommunication(GlobalAttributesCache.Value("DefaultSMSFromNumber").AsGuid()); } if (hfAllClear.Value.AsBoolean()) { ClearAlert(alertID); } mdSendUpdate.Hide(); BindRepeater(); }
public RoleController(RoleManager <CustomIdentityRole> roleManager, AlertMessageService alertMessageService) { _roleManager = roleManager; _alertMessageService = alertMessageService; }
public HomeController(AlertMessageService alertMessageService) { _alertMessageService = alertMessageService; }
private async Task SignIn() { LoadingData = true; var result = await LoginUtil.Instance.ValidateUserLogin(Email, Password, SelectedCountry); LoadingData = false; // result.LoginStatus= LoginStatusEnum.NetDisconnected; switch (result) { case LoginStatusEnum.LoginSuccess: if (GlobalAccess.Instance.CurrentUserInfo.NeedChangePassword) { ShowChangePasswordPopup = true; NewPassword = null; PasswordConfirm = null; } else { GotoMainPage(); } break; case LoginStatusEnum.NetDisconnected: await AlertMessageService.ShowAsync( ResourceLoader.GetString("NetworkDisconnectPopupMessage"), ResourceLoader.GetString("NetworkDisconnectPopupTitle"), new UICommand { Label = "OK" } ); break; case LoginStatusEnum.InvalidemailAndValidPwd: await AlertMessageService.ShowAsync(ResourceLoader.GetString("InvalidemailAndValidPwdMsg"), "", new UICommand("OK")); //ErrorMessage = ResourceLoader.GetString("InvalidemailAndValidPwdMsg"); InvalidEmail = true; InvalidPassword = true; break; case LoginStatusEnum.ValidemailAndInvalidPwd: await AlertMessageService.ShowAsync(ResourceLoader.GetString("ValidemailAndInvalidPwdMsg"), "", new UICommand("OK")); //ErrorMessage = ResourceLoader.GetString("ValidemailAndInvalidPwdMsg"); InvalidEmail = true; InvalidPassword = true; break; case LoginStatusEnum.InvalidemailAndInvalidPwd: await AlertMessageService.ShowAsync(ResourceLoader.GetString("InvalidemailAndInvalidPwdMsg"), "", new UICommand("OK")); //ErrorMessage = ResourceLoader.GetString("InvalidemailAndInvalidPwdMsg"); InvalidEmail = true; InvalidPassword = true; break; case LoginStatusEnum.ValidemailAndEmptyPwd: await AlertMessageService.ShowAsync(ResourceLoader.GetString("ValidemailAndEmptyPwdMsg"), "", new UICommand("OK")); //ErrorMessage = ResourceLoader.GetString("ValidemailAndEmptyPwdMsg"); InvalidPassword = true; break; case LoginStatusEnum.EmptyemailAndValidPwd: await AlertMessageService.ShowAsync(ResourceLoader.GetString("EmptyemailAndValidPwdMsg"), "", new UICommand("OK")); //ErrorMessage = ResourceLoader.GetString("EmptyemailAndValidPwdMsg"); InvalidEmail = true; break; case LoginStatusEnum.InvalidemailAndEmptyPwd: await AlertMessageService.ShowAsync(ResourceLoader.GetString("InvalidemailAndEmptyPwdMsg"), "", new UICommand("OK")); //ErrorMessage = ResourceLoader.GetString("InvalidemailAndEmptyPwdMsg"); InvalidEmail = true; InvalidPassword = true; break; case LoginStatusEnum.SelectCountry: await AlertMessageService.ShowAsync(ResourceLoader.GetString("NotSelectCountryMsg"), "", new UICommand("OK")); //ErrorMessage = ResourceLoader.GetString("NotSelectCountryMsg"); NoCountry = true; break; case LoginStatusEnum.AccountNotExist: await AlertMessageService.ShowAsync( ResourceLoader.GetString("AccountNotExistErrorMsg"), ResourceLoader.GetString("ErrorMsgHeader"), new UICommand { Label = "OK" } ); break; case LoginStatusEnum.EmailOrPwdError: await AlertMessageService.ShowAsync(ResourceLoader.GetString("EmailOrPwdErrorMsg"), "", new UICommand("OK")); //ErrorMessage = ResourceLoader.GetString("EmailOrPwdErrorMsg"); InvalidEmail = true; InvalidPassword = true; break; case LoginStatusEnum.EmptyEmailAndEmptyPwd: await AlertMessageService.ShowAsync(ResourceLoader.GetString("EmptyEmailAndEmptyPwdMsg"), "", new UICommand("OK")); //ErrorMessage = ResourceLoader.GetString("EmptyEmailAndEmptyPwdMsg"); InvalidEmail = true; InvalidPassword = true; break; case LoginStatusEnum.DeviceLimit: await AlertMessageService.ShowAsync(ResourceLoader.GetString("DeviceLimitMsg"), "", new UICommand("OK")); break; default: await AlertMessageService.ShowAsync(ResourceLoader.GetString("UnExpectedError"), "", new UICommand("OK")); break; } }
public async Task Download(bool checkLimitation) { IsDownloading = true; DownloadProgress = 0; //DownloadingLabel = GetSizeLabel(0) + " of " + SizeInfo; DownloadingLabel = "Waiting download"; ShowBookStatus = false; DownloadFailed = false; ShowDownloadBtn = false; ShowUpdateBtn = false; tokenSource = new CancellationTokenSource(); var token = tokenSource.Token; SubscribeLogoutEvent(); DownloadTask = PublicationUtil.Instance.DownloadPublicationByBookId(BookId, token, (p, s) => { DownloadProgress = p; if (p < 90) { DownloadingLabel = GetSizeLabel(s) + " of " + SizeInfo; } else { DownloadingLabel = "Installing"; } }, checkLimitation); // Task.Run() var result = await DownloadTask; UnsubscribeLogoutEvent(); IsDownloading = false; switch (result.DownloadStatus) { case DownLoadEnum.Success: { PublicationStatus = PublicationStatusEnum.Downloaded; UpdateData(result.Publication); break; } case DownLoadEnum.OverLimitation: { UpdateStatus(); await AlertMessageService.ShowAsync(ResourceLoader.GetString("DownloadOverLimitMsg"), ResourceLoader.GetString("DownloadOverLimitTitle"), new UICommand { Label = ResourceLoader.GetString("CancelText") }, new UICommand { Label = ResourceLoader.GetString("DownloadText"), Invoked = async _ => { await Download(false); } } ); break; } case DownLoadEnum.Canceled: { DownloadFailed = true; UpdateStatus(); DownloadFailedLabel = PublicationStatus == PublicationStatusEnum.NotDownloaded ? ResourceLoader.GetString("DownloadFailedMsg") : ResourceLoader.GetString("UpdateFailedMsg"); break; } case DownLoadEnum.Failure: { DownloadFailed = true; UpdateStatus(); DownloadFailedLabel = PublicationStatus == PublicationStatusEnum.NotDownloaded ? ResourceLoader.GetString("DownloadFailedMsg") : ResourceLoader.GetString("UpdateFailedMsg"); await AlertMessageService.ShowAsync(ResourceLoader.GetString("InstallationErrorMsg"), ResourceLoader.GetString("InstallationErrorHeader"), new UICommand(ResourceLoader.GetString("OKMsg"))); break; } case DownLoadEnum.NetDisconnected: { DownloadFailed = true; UpdateStatus(); DownloadFailedLabel = PublicationStatus == PublicationStatusEnum.NotDownloaded ? ResourceLoader.GetString("DownloadFailedMsg") : ResourceLoader.GetString("UpdateFailedMsg"); await AlertMessageService.ShowAsync(ResourceLoader.GetString("MissingConnectionMsg"), ResourceLoader.GetString("MissingConnectionHeader"), new UICommand(ResourceLoader.GetString("OKMsg"))); break; //break; } } }
public SystemParametersController(ISystemParameterService systemParameterService, AlertMessageService alertMessageService) { _systemParameterService = systemParameterService; _alertMessageService = alertMessageService; }
private async Task SendPassowrdReminder() { LoadingData = true; var result = await LoginUtil.Instance.ResetPassword(Email, SelectedCountry); LoadingData = false; switch (result) { case PasswordResetEnum.NetDisconnected: await AlertMessageService.ShowAsync( ResourceLoader.GetString("NetworkDisconnectPopupMessage"), ResourceLoader.GetString("NetworkDisconnectPopupTitle"), new UICommand { Label = "OK" } ); break; case PasswordResetEnum.EmailNotExist: await AlertMessageService.ShowAsync( ResourceLoader.GetString("AccountNotExistErrorMsg"), ResourceLoader.GetString("ErrorMsgHeader"), new UICommand { Label = "OK" } ); break; case PasswordResetEnum.InvalidEmail: await AlertMessageService.ShowAsync( ResourceLoader.GetString("InValidEmailMsg"), "Error Message", new UICommand { Label = "OK" } ); break; case PasswordResetEnum.DeviceIdNotMatched: await AlertMessageService.ShowAsync( ResourceLoader.GetString("DeviceIdNotMatchedMsg"), "Error !!", new UICommand { Label = "OK" } ); break; case PasswordResetEnum.SelectCountry: //ErrorMessage = ResourceLoader.GetString("NotSelectCountryMsg"); NoCountry = true; break; case PasswordResetEnum.ResetSuccess: await AlertMessageService.ShowAsync(ResourceLoader.GetString("ResetPwdSentMsg"), "", new UICommand { Label = "OK", Invoked = x => BackToLogin() }); break; } }
public UserController(UserManager <CustomIdentityUser> userManager, RoleManager <CustomIdentityRole> roleManager, AlertMessageService alertMessageService) { _userManager = userManager; _roleManager = roleManager; _alertMessageService = alertMessageService; }