Class BotViewModelBase
The view model for a bot, which may be controlled by a script or by a brain.
Inherited Members
Namespace: Phoenix.BotBrain
Assembly: Phoenix.Plugin.BotBrain.BotScripting.dll
Syntax
public abstract class BotViewModelBase : ViewModelBase, IBotViewModel, INotifyPropertyChanged, IOnSelected
Constructors
View SourceBotViewModelBase(IServiceProvider)
Initializes a new instance of the BotViewModelBase class.
Declaration
protected BotViewModelBase(IServiceProvider services)
Parameters
Type | Name | Description |
---|---|---|
IServiceProvider | services | The service provider. |
Properties
View SourceAllListViewChoices
Gets all possible titles for the list view, if the bot has many component types, such as actions, urges, and/or considerations.
Declaration
public virtual IEnumerable<string>? AllListViewChoices { get; }
Property Value
Type | Description |
---|---|
IEnumerable<string> |
BotScriptTelemetryClient
Gets the bot script telemetry client.
Declaration
protected IBotScriptTelemetryClient? BotScriptTelemetryClient { get; }
Property Value
Type | Description |
---|---|
IBotScriptTelemetryClient |
CanResume
Gets a value indicating whether or not the bot can be resumed.
Declaration
public virtual bool CanResume { get; }
Property Value
Type | Description |
---|---|
bool |
CanSave
Gets a value indicating whether or not the bot can be saved to its current location.
Declaration
public virtual bool CanSave { get; }
Property Value
Type | Description |
---|---|
bool |
CanStart
Gets a value indicating whether or not the bot can be started.
Declaration
public virtual bool CanStart { get; }
Property Value
Type | Description |
---|---|
bool |
CanStop
Gets a value indicating whether or not the bot can be stopped.
Declaration
public virtual bool CanStop { get; }
Property Value
Type | Description |
---|---|
bool |
DetailsTitle
Gets the title of the primary view for controlling this bot.
Declaration
public virtual string DetailsTitle { get; }
Property Value
Type | Description |
---|---|
string |
DeviceManager
Gets the device manager.
Declaration
protected IDeviceManager DeviceManager { get; }
Property Value
Type | Description |
---|---|
IDeviceManager |
FilePath
Gets or sets the bot's file path.
Declaration
public string? FilePath { get; set; }
Property Value
Type | Description |
---|---|
string |
IsRunning
Gets a value indicating whether or not the bot is running.
Declaration
public abstract bool IsRunning { get; }
Property Value
Type | Description |
---|---|
bool |
ListDetailsTitle
Gets the title for presenting details about the selected list view item.
Declaration
public virtual string ListDetailsTitle { get; }
Property Value
Type | Description |
---|---|
string |
ListViewContext
Gets the data context for the list view presenting actions, urges, or other components.
Declaration
public virtual IListViewModel? ListViewContext { get; protected set; }
Property Value
Type | Description |
---|---|
IListViewModel |
ListViewTitle
Gets the title for the list view.
Declaration
public virtual string? ListViewTitle { get; protected set; }
Property Value
Type | Description |
---|---|
string |
ModifyListViewTitleIndexCommand
Gets the command to change the selected list view type.
Declaration
public DelegateCommand<int?> ModifyListViewTitleIndexCommand { get; }
Property Value
Type | Description |
---|---|
DelegateCommand<int?> |
Name
Gets or sets the bot's name.
Declaration
public virtual string? Name { get; set; }
Property Value
Type | Description |
---|---|
string |
ResumeCommand
Gets the command to resume the bot.
Declaration
public DelegateCommand ResumeCommand { get; }
Property Value
Type | Description |
---|---|
DelegateCommand |
SaveCommand
Gets the command to save the bot.
Declaration
public DelegateCommand SaveCommand { get; }
Property Value
Type | Description |
---|---|
DelegateCommand |
StartCommand
Gets the command to start the bot.
Declaration
public DelegateCommand StartCommand { get; }
Property Value
Type | Description |
---|---|
DelegateCommand |
Status
Gets the bot's status.
Declaration
public virtual string Status { get; }
Property Value
Type | Description |
---|---|
string |
StopCommand
Gets the command to stop the bot.
Declaration
public DelegateCommand StopCommand { get; }
Property Value
Type | Description |
---|---|
DelegateCommand |
TelemetryClient
Gets the telemetry client.
Declaration
protected override ITelemetryClient? TelemetryClient { get; }
Property Value
Type | Description |
---|---|
ITelemetryClient |
Overrides
Methods
View SourceIsRunningOn(IDevice)
Gets a value indicating whether or not the bot is running on the device.
Declaration
public abstract bool IsRunningOn(IDevice device)
Parameters
Type | Name | Description |
---|---|---|
IDevice | device | The device. |
Returns
Type | Description |
---|---|
bool | True if it is running on the device. |
Load(string)
Loads a serialized representation of a bot.
Declaration
public abstract void Load(string data)
Parameters
Type | Name | Description |
---|---|---|
string | data | The data to load. |
OnCanExecuteChanged()
Handles UI updates when the bot's status changes.
Declaration
public virtual void OnCanExecuteChanged()
OnDeviceSelected(DeviceCollectionChangeInfo)
Handles when the user's device selection changes.
Declaration
public void OnDeviceSelected(DeviceCollectionChangeInfo changeInfo)
Parameters
Type | Name | Description |
---|---|---|
DeviceCollectionChangeInfo | changeInfo | The change information. |
OnSelected(object?)
Occurs when the item is selected.
Declaration
public virtual void OnSelected(object? sender)
Parameters
Type | Name | Description |
---|---|---|
object | sender | The sender. |
ResumeAsync()
Resumes the bot.
Declaration
public virtual Task ResumeAsync()
Returns
Type | Description |
---|---|
Task | A task. |
Save()
Saves the bot.
Declaration
public virtual void Save()
SaveToString()
Saves the bot to a string.
Declaration
protected abstract string SaveToString()
Returns
Type | Description |
---|---|
string | A string representation of the bot. |
StartAsync()
Starts the bot.
Declaration
public abstract Task StartAsync()
Returns
Type | Description |
---|---|
Task | A task. |
StopAsync()
Stops the bot.
Declaration
public abstract Task StopAsync()
Returns
Type | Description |
---|---|
Task | A task. |
TryRunTask(string, Func<Task>)
Attempts to run a task, and logs a message if an exception is encountered.
Declaration
protected virtual Task TryRunTask(string name, Func<Task> action)
Parameters
Type | Name | Description |
---|---|---|
string | name | The action description. |
Func<Task> | action | A function that provides the task to run. |
Returns
Type | Description |
---|---|
Task | A task. |
Events
View SourceIsRunningChanged
Occurs when the IsRunning property changes.
Declaration
public event EventHandler? IsRunningChanged
Event Type
Type | Description |
---|---|
EventHandler |