Exemplo n.º 1
0
        void CountAlerts(Entity entity)
        {
            var func = CustomFilter.TryGetValue(DataContext.GetType());

            DynamicQueryServer.QueryGroupBatch(new QueryGroupOptions(typeof(AlertEntity))
            {
                FilterOptions = new List <FilterOption>
                {
                    func != null ?  func((Entity)DataContext) : new FilterOption("Target", DataContext)
                    {
                        Frozen = true
                    },
                },
                ColumnOptions = new List <ColumnOption>
                {
                    new ColumnOption("Entity.CurrentState"),
                    new ColumnOption("Count")
                },
                OrderOptions = new List <OrderOption>
                {
                    new OrderOption("Entity.CurrentState"),
                }
            },
                                               resultTable =>
            {
                if (resultTable.Rows.Length == 0)
                {
                    icAlerts.Visibility = Visibility.Collapsed;
                }
                else
                {
                    icAlerts.Visibility  = Visibility.Visible;
                    icAlerts.ItemsSource = resultTable.Rows;

                    tbAlerts.FontWeight = FontWeights.Bold;

                    ForceShow?.Invoke();
                }
            }, () => { });
        }
Exemplo n.º 2
0
        void EntidadSistemaWidget_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            if (e.NewValue is Entity ident)
            {
                var isolation = ident.Isolation();

                if (isolation == null)
                {
                    this.Visibility = System.Windows.Visibility.Collapsed;
                }
                else
                {
                    if (IsolationEntity.Default == null && !IsolationEntity.Default.Is(isolation))
                    {
                        ForceShow?.Invoke();
                    }

                    img.Source = IsolationClient.GetIsolationIcon(isolation);

                    tb.Text = img.Source != null ? null :
                              isolation.ToString();
                }
            }
        }