Show / Hide Table of Contents

Class BotBrainViewModel

The view model for a bot brain.

Inheritance
object
BindableBase
ViewModelBase
BotViewModelBase
BotBrainViewModel
TestBotBrainViewModel
Implements
IBotBrainViewModel
IBotViewModelWithBrain
IBotViewModel
INotifyPropertyChanged
IOnSelected
IDisposable
Inherited Members
BotViewModelBase.IsRunningChanged
BotViewModelBase.CanResume
BotViewModelBase.CanSave
BotViewModelBase.ListViewContext
BotViewModelBase.ListViewTitle
BotViewModelBase.StartCommand
BotViewModelBase.StopCommand
BotViewModelBase.ResumeCommand
BotViewModelBase.SaveCommand
BotViewModelBase.ModifyListViewTitleIndexCommand
BotViewModelBase.Name
BotViewModelBase.FilePath
BotViewModelBase.DeviceManager
BotViewModelBase.BotScriptTelemetryClient
BotViewModelBase.ResumeAsync()
BotViewModelBase.Save()
BotViewModelBase.OnDeviceSelected(DeviceCollectionChangeInfo)
BotViewModelBase.TryRunTask(string, Func<Task>)
ViewModelBase.Services
ViewModelBase.Logger
ViewModelBase.LogVerboseException(Exception, string, string)
BindableBase.SetProperty<T>(ref T, T, string)
BindableBase.SetProperty<T>(ref T, T, Action, string)
BindableBase.RaisePropertyChanged(string)
BindableBase.OnPropertyChanged(PropertyChangedEventArgs)
BindableBase.PropertyChanged
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Phoenix.BotBrain
Assembly: Phoenix.Plugin.BotBrain.BrainEditor.dll
Syntax
public class BotBrainViewModel : BotViewModelBase, IBotBrainViewModel, IBotViewModelWithBrain, IBotViewModel, INotifyPropertyChanged, IOnSelected, IDisposable

Constructors

View Source

BotBrainViewModel(IServiceProvider, BotBrainLogForwarder?, Transient<BrainLogViewModel>?)

Initializes a new instance of the BotBrainViewModel class.

Declaration
public BotBrainViewModel(IServiceProvider services, BotBrainLogForwarder? logForwarder = null, Transient<BrainLogViewModel>? logViewModel = null)
Parameters
Type Name Description
IServiceProvider services

The service provider.

BotBrainLogForwarder logForwarder

A log event forwarder.

Transient<BrainLogViewModel> logViewModel

The log view model.

Properties

View Source

AllConsiderations

Gets the set of all possible considerations.

Declaration
protected virtual IEnumerable<ConsiderationInfo> AllConsiderations { get; }
Property Value
Type Description
IEnumerable<ConsiderationInfo>
View Source

AllListViewChoices

Gets all possible titles for the list view, if the bot has many component types, such as actions, urges, and/or considerations.

Declaration
public override IEnumerable<string> AllListViewChoices { get; }
Property Value
Type Description
IEnumerable<string>
Overrides
BotViewModelBase.AllListViewChoices
View Source

AllUrges

Gets the set of all possible urges.

Declaration
protected virtual IEnumerable<UrgeInfo> AllUrges { get; }
Property Value
Type Description
IEnumerable<UrgeInfo>
View Source

BotBrainTelemetryClient

Gets the bot brain telemetry client.

Declaration
protected IBotBrainTelemetryClient? BotBrainTelemetryClient { get; }
Property Value
Type Description
IBotBrainTelemetryClient
View Source

Bots

Gets the bots controlled by this brain.

Declaration
public ObservableCollection<IBotBrainClient> Bots { get; }
Property Value
Type Description
ObservableCollection<IBotBrainClient>
View Source

Brain

Gets or sets the brain.

Declaration
public virtual IBotBrain? Brain { get; set; }
Property Value
Type Description
IBotBrain
View Source

CanStart

Gets a value indicating whether or not the brain can start the selected devices.

Declaration
public override bool CanStart { get; }
Property Value
Type Description
bool
Overrides
BotViewModelBase.CanStart
View Source

CanStop

Gets a value indicating whether or not the brain can stop the selected devices.

Declaration
public override bool CanStop { get; }
Property Value
Type Description
bool
Overrides
BotViewModelBase.CanStop
View Source

Considerations

Gets the considerations.

Declaration
public ListViewModel<IConsiderationViewModel> Considerations { get; }
Property Value
Type Description
ListViewModel<IConsiderationViewModel>
View Source

DetailsTitle

Gets the title of the primary view for controlling this bot.

Declaration
public override string DetailsTitle { get; }
Property Value
Type Description
string
Overrides
BotViewModelBase.DetailsTitle
View Source

IsRunning

Gets a value indicating whether or not the bot is running.

Declaration
public override bool IsRunning { get; }
Property Value
Type Description
bool
Overrides
BotViewModelBase.IsRunning
View Source

ListDetailsTitle

Gets the title for presenting details about the selected list view item.

Declaration
public override string ListDetailsTitle { get; }
Property Value
Type Description
string
Overrides
BotViewModelBase.ListDetailsTitle
View Source

LogViewModel

Gets the brain log view model.

Declaration
public BrainLogViewModel LogViewModel { get; }
Property Value
Type Description
BrainLogViewModel
View Source

Status

Gets the brain status.

Declaration
public override string Status { get; }
Property Value
Type Description
string
Overrides
BotViewModelBase.Status
View Source

TelemetryClient

Gets the telemetry client.

Declaration
protected override ITelemetryClient? TelemetryClient { get; }
Property Value
Type Description
ITelemetryClient
Overrides
BotViewModelBase.TelemetryClient
View Source

Urges

Gets the urges.

Declaration
public ListViewModel<IUrgeViewModel> Urges { get; }
Property Value
Type Description
ListViewModel<IUrgeViewModel>

Methods

View Source

CanCreateBot(IDevice)

Determines whether or not a bot can be created for a device.

Declaration
protected virtual bool CanCreateBot(IDevice device)
Parameters
Type Name Description
IDevice device

The device.

Returns
Type Description
bool

True if a bot can be created.

View Source

CanCreateConsideration(ConsiderationInfo?)

Determines if the given consideration can be added to the brain.

Declaration
protected virtual bool CanCreateConsideration(ConsiderationInfo? info)
Parameters
Type Name Description
ConsiderationInfo info

The consideration info.

Returns
Type Description
bool

True if the consideration can be added.

View Source

CanCreateUrge(UrgeInfo?)

Determines if the given urge can be added to the brain.

Declaration
protected virtual bool CanCreateUrge(UrgeInfo? info)
Parameters
Type Name Description
UrgeInfo info

The urge info.

Returns
Type Description
bool

True if the urge can be added.

View Source

CreateBot(IDevice)

Creates a bot for a device.

Declaration
protected virtual IBotBrainClient CreateBot(IDevice device)
Parameters
Type Name Description
IDevice device

The device.

Returns
Type Description
IBotBrainClient

The bot.

View Source

CreateConsideration(object?)

Creates a consideration.

Declaration
public IConsideration? CreateConsideration(object? i)
Parameters
Type Name Description
object i

The consideration info.

Returns
Type Description
IConsideration

The consideration.

View Source

CreateConsiderationViewModel(IConsideration)

Creates a consideration view model.

Declaration
public IConsiderationViewModel? CreateConsiderationViewModel(IConsideration consideration)
Parameters
Type Name Description
IConsideration consideration

The consideration.

Returns
Type Description
IConsiderationViewModel

The consideration view model.

View Source

CreateUrge(object?)

Creates an urge.

Declaration
public IUrge? CreateUrge(object? i)
Parameters
Type Name Description
object i

The urge info.

Returns
Type Description
IUrge

The urge.

View Source

CreateUrgeViewModel(IUrge)

Creates an urge view model.

Declaration
public IUrgeViewModel? CreateUrgeViewModel(IUrge urge)
Parameters
Type Name Description
IUrge urge

The urge.

Returns
Type Description
IUrgeViewModel

The urge view model.

View Source

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Declaration
public virtual void Dispose()
View Source

GetBot(IDevice)

Gets the bot for a device.

Declaration
public IBotBrainClient? GetBot(IDevice device)
Parameters
Type Name Description
IDevice device

The device.

Returns
Type Description
IBotBrainClient

The bot.

View Source

IsRunningOn(IDevice)

Gets a value indicating whether or not the bot is running on the device.

Declaration
public override bool IsRunningOn(IDevice device)
Parameters
Type Name Description
IDevice device

The device.

Returns
Type Description
bool

True if it is running on the device.

Overrides
BotViewModelBase.IsRunningOn(IDevice)
View Source

Load(string)

Loads a serialized representation of a bot.

Declaration
public override void Load(string data)
Parameters
Type Name Description
string data

The data to load.

Overrides
BotViewModelBase.Load(string)
View Source

OnCanExecuteChanged()

Handles UI updates when the bot's status changes.

Declaration
public override void OnCanExecuteChanged()
Overrides
BotViewModelBase.OnCanExecuteChanged()
View Source

OnSelected(object?)

Occurs when the item is selected.

Declaration
public override void OnSelected(object? sender)
Parameters
Type Name Description
object sender

The sender.

Overrides
BotViewModelBase.OnSelected(object?)
View Source

RefreshConsiderations()

Updates the consideration view models.

Declaration
protected virtual void RefreshConsiderations()
View Source

RefreshUrges()

Updates the urge view models.

Declaration
protected virtual void RefreshUrges()
View Source

ReinitializeBrain()

Re-initializes the bot brain based on the UI choices.

Declaration
protected void ReinitializeBrain()
View Source

SaveToString()

Saves the bot brain to a string.

Declaration
protected override string SaveToString()
Returns
Type Description
string

A string.

Overrides
BotViewModelBase.SaveToString()
View Source

StartAsync()

Starts the bot.

Declaration
public override Task StartAsync()
Returns
Type Description
Task

A task.

Overrides
BotViewModelBase.StartAsync()
View Source

Stop(IEnumerable<IDevice>)

Stops the brain on the given devices.

Declaration
public Task Stop(IEnumerable<IDevice> devices)
Parameters
Type Name Description
IEnumerable<IDevice> devices

The devices.

Returns
Type Description
Task

A task.

View Source

StopAll()

Stops the brain on all devices.

Declaration
public void StopAll()
View Source

StopAsync()

Stops the bot.

Declaration
public override Task StopAsync()
Returns
Type Description
Task

A task.

Overrides
BotViewModelBase.StopAsync()

Implements

IBotBrainViewModel
IBotViewModelWithBrain
IBotViewModel
INotifyPropertyChanged
IOnSelected
IDisposable

Extension Methods

INotifyPropertyChangedExtensions.OnPropertyChanged(INotifyPropertyChanged, string, Action)
INotifyPropertyChangedExtensions.OnPropertyChanged(INotifyPropertyChanged, string, Action<object?, string>)
INotifyPropertyChangedExtensions.OnPropertyChangedUntil(INotifyPropertyChanged, string, Func<bool>)
INotifyPropertyChangedExtensions.OnPropertyChangedUntil(INotifyPropertyChanged, string, Func<object?, string, bool>)
  • View Source
In this article
Back to top Generated by DocFX