Exemplo n.º 1
0
 public void AddAlert(BlazorAlertsModel model)
 {
     if (!this.BlazorAlerts.Any(item => item.Guid == model.Guid))
     {
         this.BlazorAlerts.Add(model);
     }
 }
Exemplo n.º 2
0
 public void DenyAlert_OnClicked(BlazorAlertsModel model)
 {
     this.BlazorAlertsService.RemoveAlert(model.Id);
     if (model.ConfirmDialog)
     {
         this.BlazorAlertsService.AlertConfirmed(model, false);
     }
 }
Exemplo n.º 3
0
        public void RemoveAlert(Guid guid)
        {
            BlazorAlertsModel item = this.BlazorAlerts.FirstOrDefault(item => item.Guid == guid);

            if (item != null)
            {
                this.BlazorAlerts.Remove(item);
            }
        }
Exemplo n.º 4
0
        public void AlertConfirmed(BlazorAlertsModel model, bool confirmed)
        {
            dynamic obj = new ExpandoObject();

            obj.confirmed = confirmed;
            obj.model     = model;

            this.OnAlertConfirmed.Invoke(this, obj);
        }
Exemplo n.º 5
0
        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();
            });
        }
Exemplo n.º 7
0
        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();
            });
        }