public void AddAlert(BlazorAlertsModel model) { if (!this.BlazorAlerts.Any(item => item.Guid == model.Guid)) { this.BlazorAlerts.Add(model); } }
public void DenyAlert_OnClicked(BlazorAlertsModel model) { this.BlazorAlertsService.RemoveAlert(model.Id); if (model.ConfirmDialog) { this.BlazorAlertsService.AlertConfirmed(model, false); } }
public void RemoveAlert(Guid guid) { BlazorAlertsModel item = this.BlazorAlerts.FirstOrDefault(item => item.Guid == guid); if (item != null) { this.BlazorAlerts.Remove(item); } }
public void AlertConfirmed(BlazorAlertsModel model, bool confirmed) { dynamic obj = new ExpandoObject(); obj.confirmed = confirmed; obj.model = model; this.OnAlertConfirmed.Invoke(this, obj); }
public void RemoveAlert(string id) { BlazorAlertsModel item = this.BlazorAlerts.FirstOrDefault(item => item.Id == id); if (item != null) { this.BlazorAlerts.Remove(item); } }
public async void OnAlertExecute(string message, string heading, PositionType position) { await InvokeAsync(() => { BlazorAlertsModel alert = new BlazorAlertsModel() { Guid = Guid.NewGuid(), Message = message, Headline = heading, Position = position, CreatedOn = DateTime.Now }; this.BlazorAlertsService.AddAlert(alert); StateHasChanged(); }); }
public async void OnAlertExecute(string message, string heading, PositionType position, bool confirmDialog, string id) { await InvokeAsync(() => { BlazorAlertsModel alert = new BlazorAlertsModel() { Id = !string.IsNullOrEmpty(id) ? id : Guid.NewGuid().ToString(), Message = message, Headline = heading, Position = position, ConfirmDialog = confirmDialog, CreatedOn = DateTime.Now }; this.BlazorAlertsService.AddAlert(alert); StateHasChanged(); }); }