Ejemplo n.º 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();
        }
Ejemplo n.º 2
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;
        }
Ejemplo n.º 3
0
        public static string GetCustomerImagePath(string customer)
        {
            CustomerData cust = CustomerDataManager.GetInstance().GetCustomer(customer);

            return(AppConfig.sd_path + cust.icon_texture);
        }