using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using Caliburn.Micro.Core; using FurnaceUI.Models; namespace FurnaceUI.Views.Editors { public class RecipeLoopSetViewModel : FurnaceModuleUIViewModelBase { public ObservableCollection StepNames { get; set; } public string SelectedText { get; set; } public int SelectedIndex { get; set; } private string loopCounts = "1"; public string LoopCounts { get { return loopCounts; } set { loopCounts = value; } } public Visibility LoopCountVisibility { get; set; } = Visibility.Hidden; public void Save() { if (LoopCountVisibility == Visibility.Visible) SelectedText = $"[{LoopCounts}]*[{StepNames[SelectedIndex].StepName}]"; else { SelectedText = $"[{StepNames[SelectedIndex].StepName}]"; } ((Window)GetView()).DialogResult = true; } public void Close() { ((Window)GetView()).DialogResult = false; } } public class ShowStep : PropertyChangedBase { private int _stepNo; public int StepNo { get => _stepNo; set { _stepNo = value; NotifyOfPropertyChange("StepNo"); } } private string _stepName; public string StepName { get => _stepName; set { _stepName = value; NotifyOfPropertyChange("StepName"); } } } }