Пример #1
0
        public void InitType()
        {
            Filter result;

            if (typeNames.Count > 0)
            {
                Dispatcher.Invoke(() => typeNames.Clear());
                Dispatcher.Invoke(() => type.IsEnabled = false);
            }
            //result = service.ExecuteFilterName(indexFilter);
            var taskType = Task.Run(() =>
            {
                return(service.ExecuteFilterName(indexFilter));
            }).Result;

            result = taskType;
            switch (indexFilter)
            {
            case 0:
                foreach (var name in result.FilterNames)
                {
                    Dispatcher.Invoke(() => typeNames.Add(name.NameCategory));
                }
                break;

            case 1:
                foreach (var name in result.FilterNames)
                {
                    Dispatcher.Invoke(() => typeNames.Add(name.NameAlcohol));
                }
                break;
            }
            Dispatcher.Invoke(() => type.IsEnabled = true);
        }