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(name, out var choice)) Plan.ChooseAll(choice); }); } public UndoTreePlan Plan { get; } public IReadOnlyList 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; } }