예제 #1
0
        public OrderEditor(Gtk.Window parent, List <string> foodList, List <string> customerList, string orderFilePath)
        {
            DIR_SEPRATOR   = System.IO.Path.DirectorySeparatorChar.ToString();
            _foodMgr       = FoodDataManager.GetInstance();
            _custMgr       = CustomerDataManager.GetInstance();
            _orderMgr      = OrderDataManager.GetInstance();
            m_allOrders    = _orderMgr.GetAllOrders();
            m_updateOrders = new List <OrderData>();
            m_deleteOrders = new List <OrderData>();
            m_addOrders    = new List <OrderData>();

            m_foodList      = foodList;
            m_customerList  = customerList;
            m_orderFilePath = orderFilePath;

            this.Build();
            this.TransientFor = parent;
            this.SetPosition(WindowPosition.CenterAlways);

            treeview_foodlist.AppendColumn("图片", new CellRendererPixbuf(), "pixbuf", 0);
            treeview_foodlist.AppendColumn("名称", new CellRendererText(), "text", 1);

            treeview_orderlist.AppendColumn("顾客", new CellRendererPixbuf(), "pixbuf", 0);
            treeview_orderlist.AppendColumn("食物", new CellRendererPixbuf(), "pixbuf", 1);

            CellRendererText cellWaitTime = new CellRendererText();

            cellWaitTime.Editable = true;
            cellWaitTime.Edited  += OnEditedWaitTime;
            treeview_orderlist.AppendColumn("等待时间", cellWaitTime, "text", 2);

            CellRendererText cellTip = new CellRendererText();

            cellTip.Editable = true;
            cellTip.Edited  += OnEditedTip;
            cellTip.Width    = 50;
            treeview_orderlist.AppendColumn("小费", cellTip, "text", 3);

            CellRendererText cellConsiderTime = new CellRendererText();

            cellConsiderTime.Editable = true;
            cellConsiderTime.Edited  += OnEditedConsiderTime;
            treeview_orderlist.AppendColumn("考虑时间", cellConsiderTime, "text", 4);
            //treeview_orderlist.AppendColumn("索引", new CellRendererText(), "text", 5);

            ReloadData();
        }
예제 #2
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;
        }
예제 #3
0
        public static string GetFoodImagePath(string food)
        {
            FoodData fd = FoodDataManager.GetInstance().GetFood(food);

            return(AppConfig.sd_path + fd.texture);
        }