Beispiel #1
0
        Task INotificationHandler <OnShowDialogCommand <EditProductComponentViewModel> > .Handle(OnShowDialogCommand <EditProductComponentViewModel> notification, CancellationToken cancellationToken)
        {
            notification.OnInvokeAction.Invoke((editProductComponentViewModel, OnStateHasChanged) =>
            {
                editProductComponentViewModel.IsDisplay = true;
                OnStateHasChanged.Invoke();
            });

            return(Task.CompletedTask);
        }
        Task INotificationHandler <OnCloselDialogCommand <DeleteProductComponentViewModel> > .Handle(OnCloselDialogCommand <DeleteProductComponentViewModel> notification, CancellationToken cancellationToken)
        {
            notification.OnInvokeAction.Invoke((deleteProductComponentViewModel, OnStateHasChanged) =>
            {
                deleteProductComponentViewModel.IsDisplay = false;
                OnStateHasChanged.Invoke();
                deleteProductComponentViewModel.RefreshEvent.InvokeAsync("Refresh");
            });

            return(Task.CompletedTask);
        }
        Task INotificationHandler <OnShowDialogCommand <AddProductComponentViewModel> > .Handle(OnShowDialogCommand <AddProductComponentViewModel> notification, CancellationToken cancellationToken)
        {
            notification.OnInvokeAction.Invoke((addProductViewModel, OnStateHasChanged) =>
            {
                addProductViewModel.IsDisplay = true;
                addProductViewModel.Product   = addProductViewModel.Product ?? new ProductModel();
                OnStateHasChanged?.Invoke();
            });

            return(Task.CompletedTask);
        }
        Task INotificationHandler <OnCloselDialogCommand <AddProductComponentViewModel> > .Handle(OnCloselDialogCommand <AddProductComponentViewModel> notification, CancellationToken cancellationToken)
        {
            //notification.OnBaseInvoke.Invoke(() =>
            //{
            //    notification.ViewModel.IsDisplay = false;
            //    notification.ViewModel.Product = null;
            //    notification?.OnStateHasChanged?.Invoke();
            //    notification.ViewModel.RefreshEvent.InvokeAsync("Refresh Event");
            //});

            notification.OnInvokeAction.Invoke((addProductViewModel, OnStateHasChanged) =>
            {
                addProductViewModel.IsDisplay = false;
                addProductViewModel.Product   = null;
                OnStateHasChanged.Invoke();
                addProductViewModel.RefreshEvent.InvokeAsync("Refresh Event");
            });

            return(Task.CompletedTask);
        }
Beispiel #5
0
 protected virtual void StateHasChanging()
 {
     OnStateHasChanged?.Invoke(this, EventArgs.Empty);
 }