private void InitRows() { foreach (CompareRowVM row in rows) { CompareRow rowModel = compareTable.FindRowByTitle(row.Title); row.Init(rows, rowModel); } }
public void Init(ObservableCollection <CompareRowVM> rows, CompareRow existRowModel) { //Create Category CreateDiffOptions(rows); //Create cell CreateCells(); //Update ViewModel using the value of existsing model UpdateViewModel(rows, existRowModel); }
public CompareRowVM(List <string> studyUnitGuids) { rowModel = new CompareRow(); this.studyUnitGuids = studyUnitGuids; diffOptions = new ObservableCollection <DiffOption>(); selectedDiffOptions = new ObservableCollection <DiffOption>(); foreach (string guid in studyUnitGuids) { selectedDiffOptions.Add(null); } backSelectedDiffOptions = new List <DiffOption>(); }
private void UpdateViewModel(ObservableCollection <CompareRowVM> rows, CompareRow existRowModel) { if (existRowModel == null) { return; } //always use an up-to-date title //Use an existing memo Memo = existRowModel.Memo; //Update the value of the cell. there may be a variable of the same variable name in the same StudyUnit selectedDiffOptions.Clear(); foreach (CompareCell cell in rowModel.Cells) { //Get an existing cell that corresponds to the cell CompareCell existCell = existRowModel.FindCell(cell.ColumnStudyUnitId); //if the cell is existent, convert to DiffOption corresponding to it DiffOption diffOption = FindDiffOption(rows, existCell); //Add to DiffOption(Onthe screen selectedDiffOptions will be updated) selectedDiffOptions.Add(diffOption); } }