예제 #1
0
 private void CreateCells()
 {
     rowModel.Cells.Clear();
     foreach (string studyUnitId in studyUnitGuids)
     {
         CompareCell cell = new CompareCell();
         rowModel.Cells.Add(cell);
         cell.ColumnStudyUnitId = studyUnitId;
     }
 }
예제 #2
0
        public void UpdateModel(ObservableCollection <CompareRowVM> rows)
        {
            //Update the information of model
            int i = 0;

            foreach (DiffOption diffOption in selectedDiffOptions)
            {
                CompareCell cell = rowModel.Cells[i++];
                UpdateCell(cell, diffOption, rows);
            }
        }
예제 #3
0
        private DiffOption FindDiffOption(ObservableCollection <CompareRowVM> rows, CompareCell cell)
        {
            //Search in DiffOption from the contents of existent cells
            if (cell == null)
            {
                return(null);
            }
            DiffOption diffOption = null;

            if (Options.IsPartialMatch(cell.CompareValue))
            {
                diffOption = FindDiffOptionByTitle(rows, cell.TargetTitle);
            }
            else
            {
                diffOption = FindDiffOptionByCode(cell.CompareValue);
            }
            return(diffOption);
        }
예제 #4
0
 private static void UpdateCell(CompareCell cell, DiffOption diffOption, ObservableCollection <CompareRowVM> rows)
 {
     if (diffOption == null)
     {
         return;
     }
     if (diffOption.IsPartialMatch)
     {
         //Get and save the list of GroupId when matches partially Code contains ROWID
         cell.CompareValue = Options.COMPARE_VALUE_PARTIALMATCH_CODE;
         CompareRowVM targetRow = FindByStringId(rows, diffOption.Code);
         cell.TargetTitle = targetRow.Title;
     }
     else
     {
         //In the case of ○ or ×, save as is.
         cell.CompareValue = diffOption.Code;
         cell.TargetTitle  = null;
     }
 }
예제 #5
0
 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);
     }
 }