Пример #1
0
        private async Task SearchDiagnoses(string value, bool isCode = false) //эксперементальная функция горячего поиска, нужно прерывание и задержка
        {
            if (value.Length > (isCode ? 1 : 2))
            {
                if (CurrentDiagnosis == null)
                {
                    IsLoadingDiagnosis = true;
                    try
                    {
                        var result = await _therapyDataService.GetDiagnoses(value, isCode);

                        Diagnoses.Clear();
                        foreach (Diagnosis diagnosis in result)
                        {
                            Diagnoses.Add(diagnosis);
                            //if (diagnosis.Title == value) CurrentDiagnosis = diagnosis;
                        }
                    }
                    catch (Exception ex)
                    {
                        NotificationManager.AddItem(new NotificationItem(NotificationType.Error, TimeSpan.FromSeconds(3), ex.Message, true));
                    }
                    IsLoadingDiagnosis = false;
                }
            }
            else
            {
                CurrentDiagnosisGroup = null;
                CurrentDiagnosis      = null;
            }
        }