예제 #1
0
        public NewOrderDialog(Gtk.Window parent, string food, List <string> customerList)
        {
            this.Build();
            this.TransientFor = parent;
            this.SetPosition(WindowPosition.CenterAlways);

            entry_tip.Text           = "1";
            entry_waittime.Text      = "0";
            entry_consider_time.Text = "1";

            m_curFood = food;
            string imgPath = Utils.GetFoodImagePath(food);

            image_food.Pixbuf    = new Pixbuf(imgPath).ScaleSimple(100, 100, InterpType.Bilinear);
            label_food_name.Text = _foodMgr.GetFood(food).GetDisplayName("cn");

            m_customerList = new List <CustomerData>();
            for (int i = 0; i < customerList.Count; ++i)
            {
                m_customerList.Add(_custMgr.GetCustomer(customerList[i]));
            }

            if (m_customerList.Count > 0)
            {
                for (int i = 0; i < m_customerList.Count; ++i)
                {
                    CustomerData cust = m_customerList[i];
                    string       name = cust.GetDisplayName("cn");
                    combobox_customer.AppendText(name);
                }

                combobox_customer.Active = 0;
                SelectCustomer(0);
            }
        }
예제 #2
0
        void ShowFoodOrders(string food)
        {
            float     iconSize       = 50.0f;
            ListStore orderListStore = new ListStore(typeof(Pixbuf), typeof(Pixbuf),
                                                     typeof(string), typeof(string), typeof(string), typeof(int));

            for (int i = 0; i < m_allOrders.Count; ++i)
            {
                OrderData ord = m_allOrders[i];
                // 只显示本卡中出现的顾客
                if (ord.food.Equals(food) && m_customerList.Contains(ord.customer))
                {
                    FoodData     fd   = _foodMgr.GetFood(ord.food);
                    CustomerData cust = _custMgr.GetCustomer(ord.customer);

                    Pixbuf pixBuf = new Pixbuf(Utils.GetFoodImagePath(ord.food));
                    float  scalex = iconSize / pixBuf.Width;
                    float  scaley = iconSize / pixBuf.Height;
                    if (scalex > scaley)
                    {
                        scalex = scaley;
                    }

                    Pixbuf foodPixBuf = pixBuf.ScaleSimple((int)(pixBuf.Width * scalex),
                                                           (int)(pixBuf.Height * scalex), InterpType.Bilinear);

                    pixBuf = new Pixbuf(Utils.GetCustomerImagePath(ord.customer));
                    scalex = iconSize / pixBuf.Width;
                    scaley = iconSize / pixBuf.Height;
                    if (scalex > scaley)
                    {
                        scalex = scaley;
                    }

                    Pixbuf customerPixBuf = pixBuf.ScaleSimple((int)(pixBuf.Width * scalex),
                                                               (int)(pixBuf.Height * scalex), InterpType.Bilinear);
                    orderListStore.AppendValues(customerPixBuf, foodPixBuf, ord.wait_time.ToString(),
                                                ord.tip.ToString(), ord.consider_time.ToString(), i);
                }
            }
            treeview_orderlist.Model = orderListStore;
            Utils.SelectTreeRow(treeview_orderlist, 0);
        }
예제 #3
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;
        }