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

            if (item != null)
            {
                this.BlazorAlerts.Remove(item);
            }
        }
コード例 #4
0
        public void AlertConfirmed(BlazorAlertsModel model, bool confirmed)
        {
            dynamic obj = new ExpandoObject();

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

            this.OnAlertConfirmed.Invoke(this, obj);
        }
コード例 #5
0
        public void RemoveAlert(string id)
        {
            BlazorAlertsModel item = this.BlazorAlerts.FirstOrDefault(item => item.Id == id);

            if (item != null)
            {
                this.BlazorAlerts.Remove(item);
            }
        }
コード例 #6
0
        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();
            });
        }
コード例 #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();
            });
        }