Example #1
0
        //public  object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        //{
        //    var result  = Task.Run(() => itemUnit.GetItemUnits(int.Parse(value.ToString()))).Result;
        //    return  result;
        //}
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            //var result = Task.Run(() => itemUnit.GetItemUnits(int.Parse(value.ToString()))).Result;

            if (MainWindow.mainWindow.GlobalItemUnitsList.Count == 0)
            {
                MainWindow.mainWindow.GlobalItemUnitsList = Task.Run(() => MainWindow.mainWindow.GlobalItemUnit.GetIU()).Result;
            }
            if (MainWindow.mainWindow.GlobalUnitsList.Count == 0)
            {
                MainWindow.mainWindow.GlobalUnitsList = Task.Run(() => MainWindow.mainWindow.GlobalUnit.GetU()).Result;
            }
            var result = itemUnit.GetIUbyItem(int.Parse(value.ToString()),
                                              MainWindow.mainWindow.GlobalItemUnitsList,
                                              MainWindow.mainWindow.GlobalUnitsList);

            return(result);
        }