예제 #1
0
        private void AddRow()
        {
            RandomTableRowModel rowModel = new RandomTableRowModel();

            _randomTableModel.Rows.Add(rowModel);

            RandomTableRowViewModel randomTableRowViewModel = new RandomTableRowViewModel(rowModel);

            if (Int32.TryParse(_die.Replace("d", String.Empty), out int die))
            {
                randomTableRowViewModel.DieMax = die;
            }

            if (_rows.Any())
            {
                randomTableRowViewModel.Min = _rows.Last().Max + 1;
                randomTableRowViewModel.Max = randomTableRowViewModel.Min;
            }
            else
            {
                randomTableRowViewModel.Min = 1;
                randomTableRowViewModel.Max = 1;
            }

            randomTableRowViewModel.PropertyChanged += Row_PropertyChanged;

            _rows.Add(randomTableRowViewModel);

            OnPropertyChanged(nameof(Rows));
        }
        /// <summary>
        /// Creates a new instance of <see cref="RandomTableRowViewModel"/>
        /// </summary>
        public RandomTableRowViewModel(RandomTableRowModel rowModel)
        {
            _rowModel = rowModel;

            _min   = _rowModel.Min;
            _max   = _rowModel.Max;
            _value = _rowModel.Value;
        }
예제 #3
0
 /// <summary>
 /// Creates a copy of <see cref="RandomTableRowModel"/>
 /// </summary>
 public RandomTableRowModel(RandomTableRowModel randomTableRowModel)
 {
     _min   = randomTableRowModel.Min;
     _max   = randomTableRowModel.Max;
     _value = randomTableRowModel.Value;
 }