ITextProvider
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using BS.Shared;
|
||||
using BS.Shared.Interface;
|
||||
using DevExpress.Mvvm;
|
||||
using DevExpress.XtraPrinting;
|
||||
using System;
|
||||
@@ -11,15 +12,16 @@ namespace BeWo.ViewModel.Controls.AI
|
||||
{
|
||||
public class AiChatButtonWithHistoryViewModel : AiChatButtonViewModel
|
||||
{
|
||||
private string currentValue;
|
||||
private readonly ITextProvider _provider;
|
||||
private readonly string _key;
|
||||
|
||||
public int CurrentIndex { get; set; }
|
||||
public List<string> History { get; set; }
|
||||
|
||||
public string CurrentValue
|
||||
{
|
||||
get => currentValue;
|
||||
set => SetProperty(ref currentValue, value, nameof(CurrentValue));
|
||||
get => _provider.GetText(_key);
|
||||
set => _provider.SetText(_key, value);
|
||||
}
|
||||
|
||||
public override bool IsHistoryEnabled => true;
|
||||
@@ -30,7 +32,7 @@ namespace BeWo.ViewModel.Controls.AI
|
||||
public DelegateCommand UndoAiActionCommand { get; protected set; }
|
||||
public DelegateCommand RedoAiActionCommand { get; protected set; }
|
||||
|
||||
public AiChatButtonWithHistoryViewModel(AiActionType aiActionType) : base(aiActionType)
|
||||
public AiChatButtonWithHistoryViewModel(AiActionType aiActionType, ITextProvider provider, string key) : base(aiActionType)
|
||||
{
|
||||
History = new List<string>();
|
||||
CurrentIndex = 0;
|
||||
@@ -51,6 +53,9 @@ namespace BeWo.ViewModel.Controls.AI
|
||||
};
|
||||
UndoAiActionCommand= new DelegateCommand(UndoAiAction);
|
||||
RedoAiActionCommand= new DelegateCommand(RedoAiAction);
|
||||
|
||||
_provider = provider;
|
||||
_key = key;
|
||||
}
|
||||
|
||||
public override bool CanSendNewMessage => base.CanSendNewMessage && !string.IsNullOrEmpty(CurrentValue);
|
||||
|
||||
Reference in New Issue
Block a user