mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-06-19 21:38:16 +08:00

committed by
Patrik Svensson

parent
63bae278a9
commit
913a7b1e37
@ -23,6 +23,11 @@ namespace Spectre.Console
|
||||
/// </summary>
|
||||
public List<T> Choices { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the initially selected choices.
|
||||
/// </summary>
|
||||
public HashSet<int> Selected { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the converter to get the display string for a choice. By default
|
||||
/// the corresponding <see cref="TypeConverter"/> is used.
|
||||
@ -52,6 +57,7 @@ namespace Spectre.Console
|
||||
public MultiSelectionPrompt()
|
||||
{
|
||||
Choices = new List<T>();
|
||||
Selected = new HashSet<int>();
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
@ -73,7 +79,7 @@ namespace Spectre.Console
|
||||
|
||||
var converter = Converter ?? TypeConverterHelper.ConvertToString;
|
||||
|
||||
var list = new RenderableMultiSelectionList<T>(console, Title, PageSize, Choices, converter, HighlightStyle);
|
||||
var list = new RenderableMultiSelectionList<T>(console, Title, PageSize, Choices, Selected, converter, HighlightStyle);
|
||||
using (new RenderHookScope(console, list))
|
||||
{
|
||||
console.Cursor.Hide();
|
||||
@ -114,4 +120,4 @@ namespace Spectre.Console
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user