public override void Alert(AlertConfig config) { var alert = UIAlertController.Create(config.Title ?? String.Empty, config.Message, UIAlertControllerStyle.Alert); alert.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, x => { if (config.OnOk != null) config.OnOk(); })); this.Present(alert); }
public override void Alert(AlertConfig config) { Device.BeginInvokeOnMainThread(() => { var dlg = new UIAlertView(config.Title ?? String.Empty, config.Message, null, null, config.OkText); if (config.OnOk != null) dlg.Clicked += (s, e) => config.OnOk(); dlg.Show(); }); }
public override void Alert(AlertConfig config) { this.Dispatch(() => { var dlg = new UIAlertView(config.Title ?? String.Empty, config.Message, null, null, config.OkText); if (config.OnOk != null) dlg.Clicked += (s, e) => config.OnOk(); dlg.Show(); }); }
public override void Alert(AlertConfig config) { Utils.RequestMainThread(() => new AlertDialog .Builder(Utils.GetActivityContext()) .SetMessage(config.Message) .SetTitle(config.Title) .SetPositiveButton(config.OkText, (o, e) => { if (config.OnOk != null) config.OnOk(); }) .Show() ); }
public override void Alert(AlertConfig config) { this.Dispatch(() => { var alert = new CustomMessageBox { Caption = config.Title, Message = config.Message, LeftButtonContent = config.OkText, IsRightButtonEnabled = false }; if (config.OnOk != null) alert.Dismissed += (sender, args) => config.OnOk(); alert.Show(); }); }
private async Task DelNumber() { var cfg = new AlertConfig(); cfg.Message = "Debe existir al menos un numero"; cfg.OkText = "Ok"; if (contact.PhoneNumbers.Count <= 1) { await Diag.AlertAsync(cfg); } if (contact.PhoneNumbers.Count > 1) { contact.PhoneNumbers.Remove(contact.PhoneNumbers.LastOrDefault()); } }
public override void LocalInvitationAccepted(AgoraRtmCallKit callKit, AgoraRtmLocalInvitation localInvitation, string response) { var config = new AlertConfig() { Message = $"User {localInvitation.CalleeId} accept your invitation", OkText = "Go to chat" }; config.OnAction += () => { ViewController.PerformSegue("peerToChat", NSObject.FromObject(localInvitation.CalleeId)); }; UserDialogs.Instance.Alert(config); }
/// <summary> /// Renders an Mvc Core Bootstrap alert. /// </summary> /// <param name="htmlHelper">Html helper instance.</param> /// <param name="text">Alert text.</param> /// <param name="state">Alert contextual state.</param> /// <param name="configAction">Action that implements alert configuration.</param> /// <returns>Alert html markup.</returns> public static IHtmlContent MvcCoreBootstrapAlert(this IHtmlHelper htmlHelper, string text, ContextualState state, Action <MvcCoreBootstrapAlertBuilder> configAction = null) { AlertConfig config = new AlertConfig { Text = text, State = state }; if (state == ContextualState.Default) { throw new ArgumentException(@"""Default"" is not a valid state for the alert."); } configAction?.Invoke(new MvcCoreBootstrapAlertBuilder(config)); return(new AlertRenderer().Render(config)); }
public void MessageDialog(string message, string title, int styleId, Action okAction = null) { AlertConfig config = new AlertConfig(); config.Title = title; config.Message = message; config.OnAction = okAction; if (styleId > 0) { config.AndroidStyleId = styleId; } UserDialogs.Instance.Alert(config); }
public async Task <ActionResult> AlertConfig_Partial(Model model) { using (AlertConfigDataProvider dataProvider = new AlertConfigDataProvider()) { AlertConfig data = await dataProvider.GetItemAsync();// get the original item if (!ModelState.IsValid) { return(PartialView(model)); } data = model.GetData(data); // merge new data into original model.SetData(data); // and all the data back into model for final display await dataProvider.UpdateConfigAsync(data); return(FormProcessed(model, this.__ResStr("okSaved", "Alert settings saved"), NextPage: Manager.ReturnToUrl)); } }
private async Task ExecuteCancelCommand() { var res = await donationRep.CancelDonationAsync(Item.Id); if (!res) { var alertConfig = new AlertConfig(); alertConfig.Title = "Unable to Cancel Donation"; alertConfig.Message = "Please try again later."; await UserDialogs.Instance.AlertAsync(alertConfig); } else { await Page.Navigation.PopAsync(); } }
public override void Alert(AlertConfig config) { Utils.RequestMainThread(() => new AlertDialog .Builder(Utils.GetActivityContext()) .SetMessage(config.Message) .SetTitle(config.Title) .SetPositiveButton(config.OkText, (o, e) => { if (config.OnOk != null) { config.OnOk(); } }) .Show() ); }
public override IDisposable Alert(AlertConfig config) { Dispatch(() => { FormsContentDialog dialog = new FormsContentDialog() { Title = config.Title, Content = config.Message, IsPrimaryButtonEnabled = true, PrimaryButtonText = config.OkText }; dialog.PrimaryButtonClick += (s, e) => { HideContentDialog(); e.Cancel = true; }; ShowContentDialog(dialog); }); return(new DisposableAction(HideContentDialog)); }
private void UpdateConfigurationProperties(Dictionary <string, ConfigProperty> configurationProperties) { SalvageConfig.UpdateConfigurationProperties(configurationProperties); MaxRuntimeConfig.UpdateConfigurationProperties(configurationProperties); ShipHubConfig.UpdateConfigurationProperties(configurationProperties); RattingConfig.UpdateConfigurationProperties(configurationProperties); AlertConfig.UpdateConfigurationProperties(configurationProperties); HaulingConfig.UpdateConfigurationProperties(configurationProperties); CargoConfig.UpdateConfigurationProperties(configurationProperties); FleetConfig.UpdateConfigurationProperties(configurationProperties); MainConfig.UpdateConfigurationProperties(configurationProperties); MovementConfig.UpdateConfigurationProperties(configurationProperties); MiningConfig.UpdateConfigurationProperties(configurationProperties); MissionConfig.UpdateConfigurationProperties(configurationProperties); DefenseConfig.UpdateConfigurationProperties(configurationProperties); SocialConfig.UpdateConfigurationProperties(configurationProperties); }
public override void Alert(AlertConfig config) { this.Dispatch(() => { var alert = new CustomMessageBox { Caption = config.Title, Message = config.Message, LeftButtonContent = config.OkText, IsRightButtonEnabled = false }; if (config.OnOk != null) { alert.Dismissed += (sender, args) => config.OnOk(); } alert.Show(); }); }
protected void ShowMessageBox(string title, string message) //, Action onOKAction) { IUserDialogs dlg = Mvx.Resolve <IUserDialogs> (); if (dlg == null) { return; } InvokeOnMainThread(() => { AlertConfig cfg = new AlertConfig(); cfg.SetTitle(title); cfg.SetMessage(message); //cfg.OnAction = onOKAction; dlg.Alert(cfg); }); }
public async Task UpdateRecord(WorkingLog workingLog) { #region 進行工作日誌清單更新 APIResult fooResult; IsRefreshing = true; var fooProgressDialogConfig = new ProgressDialogConfig() { Title = "請稍後,正在進行工作日誌清單更新中...", IsDeterministic = false, }; using (Acr.UserDialogs.UserDialogs.Instance.Progress(fooProgressDialogConfig)) { var fooWorkingLog = new WorkingLogRepository(); fooResult = await fooWorkingLog.PutAsync(workingLog); if (fooResult.Success == false) { if (await MainHelper.CheckAccessToken(fooResult) == false) { return; } try { var fooAlertConfig = new AlertConfig() { Title = "警告", Message = $"更新資料發生了錯誤 {Environment.NewLine}{fooResult.Message}", OkText = "確定" }; CancellationTokenSource fooCancelSrc = new CancellationTokenSource(10000); await Acr.UserDialogs.UserDialogs.Instance.AlertAsync(fooAlertConfig, fooCancelSrc.Token); } catch (OperationCanceledException) { } } } if (fooResult.Success == true) { await RetriveRecords(); } IsRefreshing = false; #endregion }
public static void ShowAlertMessage <T>(T response, Page page) where T : BaseResponse { if (!string.IsNullOrWhiteSpace(response.ApiMessage)) { var aConfi = new AlertConfig(); aConfi.SetMessage(response.ApiMessage); aConfi.SetTitle("Помилка"); aConfi.SetOkText("Ок"); UserDialogs.Instance.Alert(aConfi); } if (!string.IsNullOrWhiteSpace(response.BaseMessage)) { var aConfi = new AlertConfig(); aConfi.SetMessage(response.BaseMessage); aConfi.SetTitle("Помилка"); aConfi.SetOkText("Ок"); UserDialogs.Instance.Alert(aConfi); } }
private async Task Register() { SaveProgress = 0; for (int i = 0; i < 5; i++) { await Task.Delay(1000); SaveProgress += 20; } var alert = new AlertConfig() { Message = $"Name: {ProductName} \nCategory: {(IsFood ? "Food" : IsTechnology ? "Technology" : "N/A" )} \nStock: {ProductStock} \nDiscontinued? {Discontinued}", Title = "Product Details", OkText = "Great!" }; await UserDialogs.Instance.AlertAsync(alert); }
private async void OnSaveButtonClick(object sender, EventArgs e) { if (string.IsNullOrEmpty(Dto.Title) && string.IsNullOrEmpty(Dto.Isbn)) { var config = new AlertConfig { Title = "Hiányzó cím vagy ISBN", Message = "A könyv cím vagy ISBN megadása kötelező!", OkText = "Ok", }; await UserDialogs.Instance.AlertAsync(config); return; } var returnIntent = new Intent(); if (!string.IsNullOrEmpty(Dto.Isbn)) { var config = new ConfirmConfig { Title = "ISBN!", Message = "Megadott Isbn azonosítót, szeretné, hogy ez alapján legyenek a könyv adatai kitöltve?", OkText = "Igen", CancelText = "Next" }; var result = await UserDialogs.Instance.ConfirmAsync(config); returnIntent.PutExtra("autoComplete", result); } SetResult(Result.Ok, returnIntent); XmlSerializer xmlSerializer = new XmlSerializer(typeof(ClientBookDto)); StringWriter sw = new StringWriter(); xmlSerializer.Serialize(sw, Dto); returnIntent.PutExtra("book", sw.ToString()); Finish(); }
public async void OnMore(object sender, EventArgs e) { var mi = (MenuItem)sender; var sc = (Card)mi.CommandParameter; if (sc.IsBlock) { var config = new AlertConfig(); config.Message = "Карта заблокирована, изменение лимитов невозможно"; config.OkText = "OK"; UserDialogs.Instance.Alert(config); } else { DictionaryLimits dic = await _viewModel.GetLimitsFromProvider(sc.Supplier); List <Limits> li = sc.CardLimits; _ = Navigation.PushAsync(new ChangeLimitsPage(dic, li, sc.Country, sc.Stations, sc.Number)); } }
public static UIAlertController AlertBuild(AlertConfig config) { var controller = UIAlertController.Create(config.Title, config.Message, UIAlertControllerStyle.Alert); if (config.OkButton != null) { controller.AddAction(UIAlertAction.Create(config.OkButton.Text, UIAlertActionStyle.Default, (_) => config.OkButton.Action?.Invoke())); } if (config.CancelButton != null) { controller.AddAction(UIAlertAction.Create(config.CancelButton.Text, UIAlertActionStyle.Cancel, (_) => config.CancelButton.Action?.Invoke())); } if (config.DestructiveButton != null) { controller.AddAction(UIAlertAction.Create(config.DestructiveButton.Text, UIAlertActionStyle.Default, (_) => config.DestructiveButton.Action?.Invoke())); } return(controller); }
public async Task <ActionResult> AlertDisplay() { if (Manager.EditMode) { return(new EmptyResult()); } if (Manager.IsInPopup) { return(new EmptyResult()); } bool done = Manager.SessionSettings.SiteSettings.GetValue <bool>("YetaWF_Basics_AlertDone", false); if (done) { return(new EmptyResult()); } using (AlertConfigDataProvider dataProvider = new AlertConfigDataProvider()) { AlertConfig config = await dataProvider.GetItemAsync(); if (config == null || !config.Enabled) { return(new EmptyResult()); } if (config.MessageHandling == AlertConfig.MessageHandlingEnum.DisplayOnce) { Manager.SessionSettings.SiteSettings.SetValue <bool>("YetaWF_Basics_AlertDone", true); Manager.SessionSettings.SiteSettings.Save(); } DisplayModel model = new DisplayModel() { MessageHandling = config.MessageHandling, Message = config.Message, }; return(View(model)); } }
private void initData(string text) { XEReaderCollectionItemConfig cfg = parse(text); // XE Session textBox1.Text = cfg.SessionName; textBox2.Text = Regex.Replace(cfg.SessionDefinition, @"\r\n?|\n", "\r\n"); textBox3.Text = cfg.OutputTable; textBox5.Text = cfg.Filter; textBox4.Text = String.Join(",", cfg.Columns.ToArray()); // Alert if (cfg.Alerts.Count > 0) { AlertConfig ac = cfg.Alerts[0]; textBox6.Text = ac.Sender; textBox7.Text = ac.Recipient; textBox8.Text = ac.Subject; foreach (string itm in comboBox2.Items) { if (itm.Equals(ac.Importance.ToString(), StringComparison.CurrentCultureIgnoreCase)) { comboBox2.SelectedItem = itm; } } textBox10.Text = String.Join(",", ac.Columns.ToArray()); textBox11.Text = ac.Filter; checkBox1.Checked = ac.Enabled; checkBox2.Checked = ac.WriteToErrorLog; checkBox3.Checked = ac.WriteToWindowsLog; foreach (string itm in comboBox1.Items) { if (itm.Equals(ac.Mode.ToString(), StringComparison.CurrentCultureIgnoreCase)) { comboBox1.SelectedItem = itm; } } textBox12.Text = ac.Delay.ToString(); } }
public MainPageModel() { ShowAlert = ReactiveCommand.Create(() => { AlertMessage = "This is a sample Allert message!"; }); ShowAlertConfig = ReactiveCommand.Create(() => { Alert = new AlertConfig() { Message = "This is a sample Allert message!", Title = "This is a TestAlert", OkText = "Cool!" }; }); ShowToast = ReactiveCommand.Create(() => { ToastMessage = "This is a sample Toast message!"; }); ShowSpinner = ReactiveCommand.CreateFromObservable(() => Observable.Timer(TimeSpan.FromSeconds(5))); ShowSpinner.Subscribe(); ShowSpinnerDispose = ReactiveCommand.CreateFromObservable(() => Observable.Timer(TimeSpan.FromSeconds(5))); ShowSpinnerDispose.Subscribe(l => DisposeSpinner = true); }
public async Task <int> UpdateWarningStatus(AlertConfig alertConfig) { try { var spName = "dbo.usp_AlertConfig_UpdateWarningStatus"; var parameterValues = new object[3] { alertConfig.Id, alertConfig.PauseStatus, alertConfig.PausePeriod }; var thisTask = Task.Run(() => SqlHelper.ExecuteNonQueryAsync(_connString, spName, parameterValues)); var result = await thisTask; return(result); } catch (Exception ex) { throw ex; } }
private async void orderAsync(object obj) { UserDialogs.Instance.ShowLoading(); Request x = new Request() { CarId = SelectedCar.Id, UserId = App.ActiveUser.Id, Price = 50.0 }; if (WithDriver) { x.DriverId = SelectedDriver.Id; x.Price = 78.5; SelectedDriver.IsAvailable = false; await DriverRepo.UpdateAsync(SelectedDriver); } var l = Requestrepo.InsertAsync(x); SelectedCar.IsAvailable = false; await Carrepository.UpdateAsync(SelectedCar); UserDialogs.Instance.HideLoading(); AlertConfig alert = new AlertConfig(); alert.Title = "Payment Confirmation"; alert.Message = "Just Confirming You are Paying " + x.Price + "with your CreditCard"; alert.OkText = "Pay"; UserDialogs.Instance.Alert(alert); UserDialogs.Instance.ShowLoading(); var cardrepo = new CreditcardRepository(App.DbPath); await cardrepo.UpdateAsync(App.ActiveUser.CrieditCard); UserDialogs.Instance.HideLoading(); alert.Title = "Sucess"; alert.Message = "Done , Your Balance is " + (App.ActiveUser.CrieditCard.Balance - x.Price); UserDialogs.Instance.Alert(alert); }
/// <summary> /// 异步设置壁纸 /// </summary> /// <param name="forceFromWeb">强制从网络获取</param> public void SetWallpaperAsync(bool forceFromWeb = false) { Current.Logger.Info($"设置桌面壁纸(异步)"); var locker = new object(); var isSuccess = false; using (var work = new BackgroundWorker()) { work.RunWorkerCompleted += new RunWorkerCompletedEventHandler((object work_sender, RunWorkerCompletedEventArgs work_e) => { var alertConfig = new AlertConfig() { OnlyOneWindowAllowed = true }; if (isSuccess) { Alert.Show("", "设置成功", AlertTheme.Success, alertConfig); Current.Logger.Info($"设置桌面壁纸(异步)成功"); } else { Alert.Show("", "设置失败", AlertTheme.Error, alertConfig); Current.Logger.Info($"设置桌面壁纸(异步)失败"); } }); work.DoWork += new DoWorkEventHandler((object work_sender, DoWorkEventArgs work_e) => { lock (locker) { isSuccess = new WallpaperManager().SetWallpaper(forceFromWeb); } }); work.RunWorkerAsync(); } }
public Dialog Build(AppCompatActivity activity, AlertConfig config) { var builder = new AppCompatAlertDialog.Builder(activity, config.AndroidStyleId ?? 0) .SetCancelable(false) .SetMessage(config.Message) .SetTitle(config.Title); if (config.OkButton != null) { builder.SetPositiveButton(config.OkButton.Text, (o, e) => config.OkButton.Action?.Invoke()); } if (config.CancelButton != null) { builder.SetNegativeButton(config.CancelButton.Text, (o, e) => config.CancelButton.Action?.Invoke()); } if (config.DestructiveButton != null) { builder.SetNeutralButton(config.DestructiveButton.Text, (o, e) => config.DestructiveButton.Action?.Invoke()); } return(builder.Create()); }
public IHtmlContent Render(AlertConfig config) { Element = new TagBuilder("div"); this.BaseConfig(config, "alert", "alert-"); Element.Attributes.Add("role", "alert"); if (config.Dismissable) { TagBuilder button = new TagBuilder("button"); TagBuilder x = new TagBuilder("span"); Element.AddCssClass("alert-dismissible"); button.AddCssClass("close"); button.Attributes.Add("data-dismiss", "alert"); button.Attributes.Add("aria-label", "Close"); x.InnerHtml.AppendHtml("×"); x.Attributes.Add("aria-hidden", "true"); button.InnerHtml.AppendHtml(x); Element.InnerHtml.AppendHtml(button); } Element.InnerHtml.AppendHtml(config.Text); return(Element); }
/// <summary> /// TODO: To define Payment Complete Command... /// </summary> /// <param name="obj"></param> private async void PaymentCommandAsync(object obj) { //Apply LoginValidations... if (!await PaymentValidate()) { return; } //Call api.. try { UserDialogs.Instance.ShowLoading(); if (CrossConnectivity.Current.IsConnected) { await Task.Run(async() => { if (_businessCode != null) { await _businessCode.PaymentCreateApi(new PaymentCreateRequestModel() { usertoken = Helpers.Settings.GeneralAccessToken, loannumber = LoanNumber, loanschedulenumber = LoanSchedule, amount = Amount, paymentmethodcode = "CARD" }, async(objj) => { Device.BeginInvokeOnMainThread(async() => { var requestList = (objj as PaymentCreateResponseModel); if (requestList != null) { UserDialogs.Instance.HideLoading(); var alertConfig = new AlertConfig { Title = "", Message = "Payment created successfully!", OkText = "OK", OnAction = () => { App.Current.MainPage = new Views.Payments.PaymentListPage(); } }; UserDialogs.Instance.Alert(alertConfig); } else { UserDialogs.Instance.HideLoading(); UserDialogs.Instance.Alert("Something went wrong please try again.", "", "OK"); } UserDialog.HideLoading(); }); }, (objj) => { Device.BeginInvokeOnMainThread(async() => { UserDialog.HideLoading(); UserDialog.Alert("Something went wrong. Please try again later.", "", "Ok"); }); }); } }).ConfigureAwait(false); } else { UserDialogs.Instance.Loading().Hide(); await UserDialogs.Instance.AlertAsync("No Network Connection found, Please try again!", "", "Okay"); } } catch (Exception ex) { UserDialog.HideLoading(); } //UserDialog.Alert("Payment Complete successfully.!", "Success", "Ok"); //App.Current.MainPage = new Views.Payments.PaymentListPage(); }
public Task AlertAsync(AlertConfig config, CancellationToken?cancelToken = null) { return(UserDialogs.Instance.AlertAsync(config, cancelToken)); }
public AlertConfig GetData(AlertConfig data) { ObjectSupport.CopyData(this, data); return(data); }
//public override void Prepare(string parameter) //{ // companyName = parameter; //} #endregion #region Methods private async Task OnSave() { //var accts = await DataManager.GetBankAccounts(); //var acct = accts.Where(x => x.Nickname.Equals(SelectedAccount)).Single(); //var acct = SelectedAccount; var acctId = await DataManager.GetBankAccountID(SelectedAccount); var payee = IsNewPayee ? NewPayee : SelectedPayee; if (string.IsNullOrWhiteSpace(payee)) { var config = new AlertConfig().SetMessage("Payee needs a name"); Mvx.IoCProvider.Resolve <IUserDialogs>().Alert(config); return; } if (AddMultiple) { var tempBills = new List <Bill>(); foreach (var item in NewBills) { var bill = new Bill(payee, Amount, item.Date); bill.AccountID = acctId; //bill.BankAccount = acct; tempBills.Add(bill); } await DataManager.InsertBills(tempBills); } else { var newBill = new Bill(payee, Amount, StartDate) { AccountID = acctId, //BankAccount = acct, IsPaid = IsPaid }; await DataManager.SaveBill(newBill); } Messenger.Instance.Send(new ChangeBillMessage()); await navigationService.Close(this); //if (IsNewPayee) //{ // Bill.Payee = NewPayee; //} //else //{ // Bill.Payee = SelectedPayee; //} ////await navigationService.Close(this, Bill); ////var accts = await BudgetDatabase.Instance.GetBankAccounts(); //var accts = await DataManager.GetBankAccounts(); //var acct = accts.Where(x => x.Nickname.Equals(SelectedAccount)).First(); //Bill.BankAccount = acct; ////Bill.AccountID = acct.AccountID; ////await BudgetDatabase.Instance.SaveBill(Bill); //await DataManager.SaveBill(Bill); //Messenger.Instance.Send(new ChangeBillMessage(Bill.AccountID)); //await DataManager.UpdatePayeeNames(); //await navigationService.Close(this, true); }
public void SetData(AlertConfig data) { ObjectSupport.CopyData(data, this); }