// Установка выбранной записи
 public static void SetSelectedRecord(string componentName, string recordId)
 {
     if (AllSelectedRecords == null)
     {
         AllSelectedRecords = new Dictionary <string, string>();
     }
     if (SelectedRecords == null)
     {
         SelectedRecords = new Dictionary <string, string>();
     }
     if (!SelectedRecords.ContainsKey(componentName))
     {
         SelectedRecords.Add(componentName, recordId);
     }
     else
     {
         SelectedRecords[componentName] = recordId;
     }
     if (!AllSelectedRecords.ContainsKey(componentName))
     {
         AllSelectedRecords.Add(componentName, recordId);
     }
     else
     {
         AllSelectedRecords[componentName] = recordId;
     }
 }
示例#2
0
 public virtual Task SelectRecord(T selectedRecord)
 {
     if (RecordsSelectionMode == RecordsSelectionMode.Single)
     {
         OnSelectedRecord?.Invoke(selectedRecord);
     }
     else if (RecordsSelectionMode == RecordsSelectionMode.Multiple)
     {
         if (SelectedRecords.Contains(selectedRecord))
         {
             SelectedRecords.Remove(selectedRecord);
         }
         else if (MaximumRecordSelections <= 0 || (MaximumRecordSelections > 0 && SelectedRecords.Count < MaximumRecordSelections))
         {
             SelectedRecords.Add(selectedRecord);
         }
         MinimunRecordSelectionsReached = SelectedRecords.Count >= MinimunRecordSelections;
         OnMinimunRecordSelectionsReached?.Invoke(MinimunRecordSelectionsReached);
         MaximumRecordSelectionsReached = SelectedRecords.Count >= MaximumRecordSelections;
         OnMaximumRecordSelectionsReached?.Invoke(MaximumRecordSelectionsReached);
         OnSelectedRecords?.Invoke(SelectedRecords, MinimunRecordSelectionsReached, MaximumRecordSelectionsReached);
     }
     return(Task.CompletedTask);
 }