protected void AppendCustomer(string customer) { float iconSize = 80.0f; CustomerData custData = _custMgr.GetCustomer(customer); Pixbuf pb = new Pixbuf(Utils.GetCustomerImagePath(customer)); float scale = iconSize / pb.Height; Pixbuf custIcon = pb.ScaleSimple((int)(scale * pb.Width), (int)iconSize, InterpType.Hyper); m_customerStore.AppendValues(custIcon, custData.GetDisplayName("cn"), customer); }
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); } }
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); }
public static void ShowCustomerList(List <string> customerList, TreeView treeView, string customerTexPath = null) { if (customerTexPath == null) { customerTexPath = AppConfig.sd_path; } string seperator = System.IO.Path.DirectorySeparatorChar.ToString(); CustomerDataManager _custMgr = CustomerDataManager.GetInstance(); ListStore custListStore = new ListStore(typeof(Pixbuf), typeof(string), typeof(string)); for (int i = 0; i < customerList.Count; ++i) { CustomerData cust = _custMgr.GetCustomer(customerList[i]); if (cust != null) { Pixbuf pixBuf = new Pixbuf(customerTexPath + cust.icon_texture); float scale = 80.0f / pixBuf.Height; Pixbuf scaledBuf = pixBuf.ScaleSimple((int)(pixBuf.Width * scale), (int)(pixBuf.Height * scale), InterpType.Bilinear); custListStore.AppendValues(scaledBuf, cust.GetDisplayName("cn"), cust.key); } } treeView.Model = custListStore; }