ファイル
YMM4-UndoTree/UndoTree/UndoTreeReviewViewModel.cs
T

35 行
1.1 KiB
C#

using YukkuriMovieMaker.Commons;
namespace UndoTree;
internal sealed class UndoTreeReviewViewModel : Bindable
{
public UndoTreeReviewViewModel(UndoTreePlan plan)
{
Plan = plan;
ChooseAllCommand = new ActionCommand(
_ => HasConflicts,
parameter =>
{
if (parameter is string name && Enum.TryParse<ConflictPolicy>(name, out var choice))
Plan.ChooseAll(choice);
});
}
public UndoTreePlan Plan { get; }
public IReadOnlyList<UndoTreePlanItem> Items => Plan.Items;
public bool HasConflicts => Plan.ConflictCount > 0;
public bool HasMissing => Plan.MissingCount > 0;
public bool CanOffsetAny => Plan.Items.Any(item => item.IsConflict && item.CanOffset);
public string SummaryText => string.Format(Texts.ReviewSummary, Plan.Items.Count(item => item.Kind != UndoTreePlanKind.Missing), Plan.ConflictCount);
public string MissingText => string.Format(Texts.ReviewMissingNote, Plan.MissingCount);
public ActionCommand ChooseAllCommand { get; }
}