/**************************************************************************************************/ public void FillControls() { if (loadingCircle1.InvokeRequired) { fillControlsCallback fcc = new fillControlsCallback(FillControls); this.Invoke(fcc, null); } else { loadingCircle1.Active = false; loadingCircle1.Visible = false; flowLayoutPanel1.Controls.Clear(); flowLayoutPanel2.Controls.Clear(); foreach (Order order in orders.ToList()) { OrderRow newRow = new OrderRow(order, this); if (order.Order_finalized == 1) { newRow.hideDeleteButton(); flowLayoutPanel2.Controls.Add(newRow); } else { flowLayoutPanel1.Controls.Add(newRow); } //Application.DoEvents(); } } }
private void OrdersListChanged(HraListChangedEventArgs e) { if (e.hraOperand != null) { Order order = (Order)e.hraOperand; switch (e.hraListChangeType) { case HraListChangedEventArgs.HraListChangeType.ADD: OrderRow newRow = new OrderRow(order, this); if (order.Order_finalized == 0) { ////if there aren't too many existing orders, use animation to add a new row //noExistingOrdersLabel.Visible = false; //if (((countOfOrderRows() + 1) * (newRow.Margin.Top + newRow.Margin.Bottom + newRow.Height)) < flowLayoutPanel1.Height) //{ // int origNewRowMarginTop = newRow.Margin.Top; // newRow.MarginTop = flowLayoutPanel1.Height - ((countOfOrderRows() + 1) * (newRow.Margin.Top + newRow.Margin.Bottom + newRow.Height)); // flowLayoutPanel1.Controls.Add(newRow); // Transition t = new Transition(new TransitionType_Acceleration(100)); // t.add(newRow, "MarginTop", origNewRowMarginTop); // t.run(); //} //else //{ flowLayoutPanel1.Controls.Add(newRow); setNoOrdersLabels(); //} } else { newRow.hideDeleteButton(); flowLayoutPanel2.Controls.Add(newRow); } break; case HraListChangedEventArgs.HraListChangeType.DELETE: Control doomed = null; foreach (Control c in flowLayoutPanel1.Controls) { if (c is OrderRow) { OrderRow targetRow = (OrderRow)c; if (targetRow.getOrder() == order) { doomed = c; break; //presumes only one deleted } } } if (doomed != null) { flowLayoutPanel1.Controls.Remove(doomed); break; } foreach (Control c in flowLayoutPanel2.Controls) { if (c is OrderRow) { OrderRow targetRow = (OrderRow)c; if (targetRow.getOrder() == order) { doomed = c; break; //presumes only one deleted } } } if (doomed != null) { flowLayoutPanel2.Controls.Remove(doomed); } break; } setNoOrdersLabels(); } }
private void OrdersListChanged(HraListChangedEventArgs e) { if (e.hraOperand != null) { Order order = (Order)e.hraOperand; switch (e.hraListChangeType) { case HraListChangedEventArgs.HraListChangeType.ADD: OrderRow newRow = new OrderRow(order, this); if (order.Order_finalized == 0) { ////if there aren't too many existing orders, use animation to add a new row //noExistingOrdersLabel.Visible = false; //if (((countOfOrderRows() + 1) * (newRow.Margin.Top + newRow.Margin.Bottom + newRow.Height)) < flowLayoutPanel1.Height) //{ // int origNewRowMarginTop = newRow.Margin.Top; // newRow.MarginTop = flowLayoutPanel1.Height - ((countOfOrderRows() + 1) * (newRow.Margin.Top + newRow.Margin.Bottom + newRow.Height)); // flowLayoutPanel1.Controls.Add(newRow); // Transition t = new Transition(new TransitionType_Acceleration(100)); // t.add(newRow, "MarginTop", origNewRowMarginTop); // t.run(); //} //else //{ flowLayoutPanel1.Controls.Add(newRow); setNoOrdersLabels(); //} } else { newRow.hideDeleteButton(); flowLayoutPanel2.Controls.Add(newRow); } break; case HraListChangedEventArgs.HraListChangeType.DELETE: Control doomed = null; foreach (Control c in flowLayoutPanel1.Controls) { if (c is OrderRow) { OrderRow targetRow = (OrderRow)c; if (targetRow.getOrder() == order) { doomed = c; break; //presumes only one deleted } } } if (doomed != null) { flowLayoutPanel1.Controls.Remove(doomed); break; } foreach (Control c in flowLayoutPanel2.Controls) { if (c is OrderRow) { OrderRow targetRow = (OrderRow)c; if (targetRow.getOrder() == order) { doomed = c; break; //presumes only one deleted } } } if (doomed != null) flowLayoutPanel2.Controls.Remove(doomed); break; } setNoOrdersLabels(); } }