1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- 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<ShowStep> 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");
- }
- }
- }
- }
|