private void tItem_MoveUpRequest(OrderListItem tItem) { if (null == tItem) { return; } Int32 tIndex = m_SortedList.Values.IndexOf(tItem); if (0 == tIndex) { //! already the top most return; } Int32 tKey = m_SortedList.Keys[tIndex]; Int32 tTempKey = m_SortedList.Keys[tIndex - 1]; OrderListItem tTempItemA = m_SortedList.Values[tIndex - 1]; m_SortedList.Remove(tTempKey); //!< remove lower item m_SortedList.Remove(tKey); //!< remove target m_SortedList.Add(tKey, tTempItemA); m_SortedList.Add(tTempKey, tItem); RefreshOrderList(); }
private void tItem_MoveDownRequest(OrderListItem tItem) { if (null == tItem) { return; } Int32 tIndex = m_SortedList.Values.IndexOf(tItem); if (tIndex == (m_SortedList.Keys.Count - 1)) { //! already at the bottom return; } Int32 tKey = m_SortedList.Keys[tIndex]; Int32 tTempKey = m_SortedList.Keys[tIndex + 1]; OrderListItem tTempItemA = m_SortedList.Values[tIndex + 1]; m_SortedList.Remove(tTempKey); //!< remove lower item m_SortedList.Remove(tKey); //!< remove target m_SortedList.Add(tKey, tTempItemA); m_SortedList.Add(tTempKey, tItem); RefreshOrderList(); }
private void tItem_RemoveRequest(OrderListItem tItem) { if (null == tItem) { return; } Int32 tIndex = m_SortedList.Values.IndexOf(tItem); m_SortedList.Remove(m_SortedList.Keys[tIndex]); //!< remove target tItem.RemoveRequest -= new OrderChangeReport(tItem_RemoveRequest); tItem.SendToBottomRequest -= new OrderChangeReport(tItem_SendToBottomRequest); tItem.MoveUpRequest -= new OrderChangeReport(tItem_MoveUpRequest); tItem.MoveDownRequest -= new OrderChangeReport(tItem_MoveDownRequest); tItem.BringToTopRequest -= new OrderChangeReport(tItem_BringToTopRequest); RefreshOrderList(); }
private void tItem_BringToTopRequest(OrderListItem tItem) { if (null == tItem) { return; } Int32 tIndex = m_SortedList.Values.IndexOf(tItem); if (0 == tIndex) { //! already the top most return; } Int32 tTempKey = m_SortedList.Keys[0] - 1; m_SortedList.Remove(m_SortedList.Keys[tIndex]); //!< remove target m_SortedList.Add(tTempKey, tItem); //!< add it to the top RefreshOrderList(); }
public Boolean Add(Control[] tControls, ORDERLIST_ORDER tOrder) { OrderListItem tItem = new OrderListItem(tControls); if (0 == m_SortedList.Count) { m_SortedList.Add(0, tItem); //!< first item //flpOrderList.Controls.Add(tItem.TargetPanel); } else { Int32 tKey = 0; switch (tOrder) { case ORDERLIST_ORDER.ORDERLIST_TOP: tKey = m_SortedList.Keys[0] - 1; //!< top item //RefreshOrderList(); break; case ORDERLIST_ORDER.ORDERLIST_BOTTOM: default: //! bottom item tKey = m_SortedList.Keys[m_SortedList.Keys.Count - 1] + 1; //flpOrderList.Controls.Add(tItem.TargetPanel); break; } m_SortedList.Add(tKey, tItem); } tItem.RemoveRequest += new OrderChangeReport(tItem_RemoveRequest); tItem.SendToBottomRequest += new OrderChangeReport(tItem_SendToBottomRequest); tItem.MoveUpRequest += new OrderChangeReport(tItem_MoveUpRequest); tItem.MoveDownRequest += new OrderChangeReport(tItem_MoveDownRequest); tItem.BringToTopRequest += new OrderChangeReport(tItem_BringToTopRequest); RefreshOrderList(); return(true); }
private void tItem_SendToBottomRequest(OrderListItem tItem) { if (null == tItem) { return; } Int32 tIndex = m_SortedList.Values.IndexOf(tItem); if (tIndex == (m_SortedList.Keys.Count - 1)) { //! already at the bottom return; } Int32 tTempKey = m_SortedList.Keys[(m_SortedList.Keys.Count - 1)] + 1; m_SortedList.Remove(m_SortedList.Keys[tIndex]); //!< remove target m_SortedList.Add(tTempKey, tItem); //!< add it to the top //flpOrderList.Controls.Remove(tItem.TargetPanel); //flpOrderList.Controls.Add(tItem.TargetPanel); RefreshOrderList(); }
public OrderListItemPanel(OrderListItem tParent) { m_Tag = tParent; this.ResizeRedraw = true; Initialize(); }