예제 #1
0
        private void btnTop_Click(object sender, EventArgs e)
        {
            var sel = SelectedOrders.ToArray();

            foreach (var item in sel.Select(o => new { Order = o, OldIndex = ConstructionQueue.Orders.IndexOf(o), NewIndex = sel.IndexOf(o) }))
            {
                var cmd = new RearrangeOrdersCommand <ConstructionQueue>(ConstructionQueue, item.Order, item.NewIndex - item.OldIndex);
                newCommands.Add(cmd);
                cmd.Execute();
            }
            BindQueueListView(sel);
        }
예제 #2
0
파일: FleetReport.cs 프로젝트: code32/FrEee
        private void btnOrderToTop_Click(object sender, System.EventArgs e)
        {
            var order = (IOrder)lstOrdersDetail.SelectedItem;

            if (order != null)
            {
                var cmd = new RearrangeOrdersCommand <Fleet>(
                    Fleet, order, -fleet.Orders.IndexOf(order));
                Empire.Current.Commands.Add(cmd);
                cmd.Execute();                 // show change locally
                Bind();

                if (OrdersChanged != null)
                {
                    OrdersChanged();
                }
            }
        }
예제 #3
0
        private void btnUp_Click(object sender, EventArgs e)
        {
            var sel = SelectedOrders.ToArray();
            int delta;

            if (chkExpanded.Checked)
            {
                delta = -1;
            }
            else
            {
                delta = -FindSameItemsCountAbove(sel.First());
            }
            foreach (var order in sel)
            {
                var cmd = new RearrangeOrdersCommand <ConstructionQueue>(ConstructionQueue, order, delta);
                newCommands.Add(cmd);
                cmd.Execute();
            }
            BindQueueListView(sel);
        }