Class BrainLogViewModel
The view model for the brain log panel.
Inherited Members
Namespace: Phoenix.BotBrain.Logging
Assembly: Phoenix.Plugin.BotBrain.Logging.dll
Syntax
public class BrainLogViewModel : ViewModelBase, INotifyPropertyChanged, IDisposable
Constructors
View SourceBrainLogViewModel(IEnumerable<LogEvent>, IServiceProvider)
Initializes a new instance of the BrainLogViewModel class.
Declaration
public BrainLogViewModel(IEnumerable<LogEvent> events, IServiceProvider services)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<LogEvent> | events | The initial list of events. |
| IServiceProvider | services | The export provider. |
BrainLogViewModel(IServiceProvider)
Initializes a new instance of the BrainLogViewModel class.
Declaration
[ActivatorUtilitiesConstructor]
public BrainLogViewModel(IServiceProvider services)
Parameters
| Type | Name | Description |
|---|---|---|
| IServiceProvider | services | The service provider. |
Properties
View SourceClearLogCommand
Gets the command to clear all events.
Declaration
public DelegateCommand ClearLogCommand { get; }
Property Value
| Type | Description |
|---|---|
| DelegateCommand |
Columns
Gets the columns.
Declaration
public ObservableCollection<LogColumn> Columns { get; }
Property Value
| Type | Description |
|---|---|
| ObservableCollection<LogColumn> |
EventsView
Gets the events view.
Declaration
public ICollectionView EventsView { get; }
Property Value
| Type | Description |
|---|---|
| ICollectionView |
FilterGroups
Gets the filter groups.
Declaration
public ObservableCollection<LogFilterGroupBase> FilterGroups { get; }
Property Value
| Type | Description |
|---|---|
| ObservableCollection<LogFilterGroupBase> |
Filters
Gets the filters.
Declaration
public ObservableCollection<LogFilterBase> Filters { get; }
Property Value
| Type | Description |
|---|---|
| ObservableCollection<LogFilterBase> |
IsConnected
Gets or sets a value indicating whether or not the log is connected to a brain.
Declaration
public bool IsConnected { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
LoadLogCommand
Gets the command to load a log from a file.
Declaration
public DelegateCommand LoadLogCommand { get; }
Property Value
| Type | Description |
|---|---|
| DelegateCommand |
SaveLogCommand
Gets the command to save the log to a JSON file.
Declaration
public DelegateCommand SaveLogCommand { get; }
Property Value
| Type | Description |
|---|---|
| DelegateCommand |
SerializerSettings
Gets the JSON serializer settings.
Declaration
protected Lazy<JsonSerializerSettings> SerializerSettings { get; }
Property Value
| Type | Description |
|---|---|
| Lazy<JsonSerializerSettings> |
ToggleSelectAllFiltersCommand
Gets the command to select all filters in a group.
Declaration
public DelegateCommand<LogFilterBase> ToggleSelectAllFiltersCommand { get; }
Property Value
| Type | Description |
|---|---|
| DelegateCommand<LogFilterBase> |
Methods
View SourceAddEvents(IEnumerable<LogEvent>)
Adds an enumeration of events.
Declaration
public void AddEvents(IEnumerable<LogEvent> events)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<LogEvent> | events | The events. |
AddFilter(LogFilterBase)
Adds the filter to the view.
Declaration
public void AddFilter(LogFilterBase vm)
Parameters
| Type | Name | Description |
|---|---|---|
| LogFilterBase | vm | The filter. |
AddFilterGroup<T>(string)
Adds a filter group to the view.
Declaration
public void AddFilterGroup<T>(string name) where T : LogFilterBase
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The group name. |
Type Parameters
| Name | Description |
|---|---|
| T | The filter type. |
Clone()
Clones this brain log view model including events.
Declaration
public BrainLogViewModel Clone()
Returns
| Type | Description |
|---|---|
| BrainLogViewModel | The new brain log view model. |
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()
IsEventVisible(LogEvent?)
Determines if an event is visible given the current filters.
Declaration
public bool IsEventVisible(LogEvent? e)
Parameters
| Type | Name | Description |
|---|---|---|
| LogEvent | e | The event. |
Returns
| Type | Description |
|---|---|
| bool | True if it is visible. |
OnEventReceived(object?, LogEvent)
Handles when an event is received from this brain.
Declaration
public void OnEventReceived(object? sender, LogEvent e)
Parameters
| Type | Name | Description |
|---|---|---|
| object | sender | The brain. |
| LogEvent | e | The event. |
Events
View SourceOnCleared
Occurs when all events are cleared.
Declaration
public event EventHandler? OnCleared
Event Type
| Type | Description |
|---|---|
| EventHandler |
OnFilterChanged
Occurs when a filter is enabled or disabled.
Declaration
public event EventHandler? OnFilterChanged
Event Type
| Type | Description |
|---|---|
| EventHandler |
VisibleEventAdded
Occurs when a visible event is added.
Declaration
public event EventHandler? VisibleEventAdded
Event Type
| Type | Description |
|---|---|
| EventHandler |