예제 #1
0
        public Day1()
        {
            InitializeComponent();

            _viewModel = Util.GetDayViewModel();
            Util.LoadTextBoxWithInput(_viewModel, InputBox);
        }
예제 #2
0
        private void ChangeViewModel(DayViewModel viewModel)
        {
            if (!DayViewModels.Contains(viewModel))
            {
                DayViewModels.Add(viewModel);
            }

            CurrentDayViewModel = DayViewModels
                                  .FirstOrDefault(vm => vm == viewModel);
        }
예제 #3
0
        public static void LoadTextBoxWithInput(DayViewModel viewModel, TextBox inputBox)
        {
            inputBox.Clear();
            int numberOfLines = viewModel.InputLines.Length;

            for (int lineIndex = 0; lineIndex < numberOfLines; ++lineIndex)
            {
                string line = viewModel.InputLines[lineIndex];

                if (lineIndex < numberOfLines - 1)
                {
                    line += Environment.NewLine;
                }

                inputBox.AppendText(line);
            }
        }