Esempio n. 1
0
        public static void ShowFoodList(List <string> foodList, TreeView treeview, string foodTexPath = null)
        {
            if (foodTexPath == null)
            {
                foodTexPath = AppConfig.sd_path;
            }
            FoodDataManager _foodMgr      = FoodDataManager.GetInstance();
            ListStore       foodListStore = new ListStore(typeof(Pixbuf), typeof(string), typeof(string));

            for (int i = 0; i < foodList.Count; ++i)
            {
                FoodData fd = _foodMgr.GetFood(foodList[i]);
                if (fd != null)
                {
                    Pixbuf pixBuf = new Pixbuf(foodTexPath + fd.texture);
                    float  scale  = 60.0f / pixBuf.Height;

                    Pixbuf scaledBuf = pixBuf.ScaleSimple((int)(pixBuf.Width * scale),
                                                          (int)(pixBuf.Height * scale), InterpType.Bilinear);
                    foodListStore.AppendValues(scaledBuf, fd.GetDisplayName("cn"), fd.key);
                }
            }
            treeview.Model = foodListStore;
        }