Class BotBrainClient
The view model for a bot automated by a brain.
Implements
Inherited Members
Namespace: Phoenix.BotBrain
Assembly: Phoenix.Plugin.BotBrain.BrainEditor.dll
Syntax
public class BotBrainClient : BotViewModel, ICanMoveItemsTo, IBotBrainClient, IBotViewModelWithActions, IBotViewModelWithBrain, IBotViewModel, INotifyPropertyChanged, IOnSelected, IDisposable
Constructors
View SourceBotBrainClient(IServiceProvider)
Initializes a new instance of the BotBrainClient class.
Declaration
public BotBrainClient(IServiceProvider services)
Parameters
| Type | Name | Description |
|---|---|---|
| IServiceProvider | services | The service provider. |
Properties
View SourceAvailableUpdateTicks
Gets the valid bot brain iteration numbers.
Declaration
protected List<uint> AvailableUpdateTicks { get; }
Property Value
| Type | Description |
|---|---|
| List<uint> |
Brain
Gets or sets the brain.
Declaration
public virtual IBotBrain? Brain { get; set; }
Property Value
| Type | Description |
|---|---|
| IBotBrain |
BrainView
Gets or sets the bot brain view model.
Declaration
public BotBrainViewModel? BrainView { get; set; }
Property Value
| Type | Description |
|---|---|
| BotBrainViewModel |
CurrentAction
Gets the current action, if one is running.
Declaration
public object? CurrentAction { get; }
Property Value
| Type | Description |
|---|---|
| object |
CurrentUpdateNumber
Gets or sets the current bot brain update number.
Declaration
public uint CurrentUpdateNumber { get; set; }
Property Value
| Type | Description |
|---|---|
| uint |
IsRunning
Gets a value indicating whether or not the bot brain is running.
Declaration
public override bool IsRunning { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Overrides
View SourceLatestAction
Gets the latest action added to the view, if one is running.
Declaration
public object? LatestAction { get; }
Property Value
| Type | Description |
|---|---|
| object |
ModifySelectedUpdateIndexCommand
Gets the command to modify the selected update index.
Declaration
public DelegateCommand<int?> ModifySelectedUpdateIndexCommand { get; }
Property Value
| Type | Description |
|---|---|
| DelegateCommand<int?> |
RecommendedActions
Gets the history of recommended actions.
Declaration
public ICollectionView RecommendedActions { get; }
Property Value
| Type | Description |
|---|---|
| ICollectionView |
SelectedUpdateNumber
Gets or sets the selected bot brain update number.
Declaration
public uint SelectedUpdateNumber { get; set; }
Property Value
| Type | Description |
|---|---|
| uint |
StartTime
Gets the time this brain was started, if it is running.
Declaration
public DateTime? StartTime { get; }
Property Value
| Type | Description |
|---|---|
| DateTime? |
Methods
View SourceCanAppendItems(object)
Determines if the given items can be moved or copied into this object.
Declaration
public override bool CanAppendItems(object dragData)
Parameters
| Type | Name | Description |
|---|---|---|
| object | dragData | The items. |
Returns
| Type | Description |
|---|---|
| bool | A boolean. |
Overrides
View SourceCheckAreActionsEditable()
Updates whether or not the actions are not editable.
Declaration
protected override void CheckAreActionsEditable()
Overrides
Remarks
Leave IsClearable = true to allow the user to clear the action queue.
ClearData()
Clears the history of recommended actions.
Declaration
protected virtual void ClearData()
Dispose()
Disposes the bot brain client.
Declaration
public override void Dispose()
Overrides
View SourceHandleBotUpdatedWithoutEventsAvailable(IBrainBotData)
Handles updating UI when a bot is updated by the brain, and it doesn't have events available to notify us of actions it starts or stops.
Declaration
protected virtual void HandleBotUpdatedWithoutEventsAvailable(IBrainBotData data)
Parameters
| Type | Name | Description |
|---|---|---|
| IBrainBotData | data | The brain bot data. |
HasActionChanged(object?, object)
Determines whether or not an action is new.
Declaration
protected virtual bool HasActionChanged(object? currentAction, object newAction)
Parameters
| Type | Name | Description |
|---|---|---|
| object | currentAction | The current action. |
| object | newAction | The action which may be new. |
Returns
| Type | Description |
|---|---|
| bool | True if the action is new. |
OnBotActionFinished(object?, BotActionEventArgs)
Called when a bot action finishes.
Declaration
protected override void OnBotActionFinished(object? sender, BotActionEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| object | sender | The sender. |
| BotActionEventArgs | e | Not used. |
Overrides
View SourceOnBotActionStarted(object?, BotActionEventArgs)
Called when a bot action starts.
Declaration
protected override void OnBotActionStarted(object? sender, BotActionEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| object | sender | The sender. |
| BotActionEventArgs | e | Not used. |
Overrides
View SourceOnBotUpdated(IBrainBotData)
Called when the brain updates this bot.
Declaration
public virtual void OnBotUpdated(IBrainBotData data)
Parameters
| Type | Name | Description |
|---|---|---|
| IBrainBotData | data | The brain bot data. |
StartAsync()
Starts the bot.
Declaration
public override Task StartAsync()
Returns
| Type | Description |
|---|---|
| Task | A task. |
Overrides
View SourceStopAsync()
Stops the bot.
Declaration
public override Task StopAsync()
Returns
| Type | Description |
|---|---|
| Task | A task. |