private void RemoveList(DragableList pList) { if (_listCollection.Contains(pList)) { base.Remove(pList); _listCollection.Remove(pList); } }
private void ExecuteChangeList(DragableListSwitchDirection pDirection, int pNewIndex) { int directionSign = pDirection == DragableListSwitchDirection.Back ? -1 : 1; var currentList = _listCollection[_currentListIndex]; var transitionList = _listCollection[pNewIndex]; transitionList.StartRender(); float length = ListOrientation == Orientation.Vertical ? this.Width : this.Height; double j = 1; float listShift = 0; // fast switch while (Math.Abs(_listShiftPx) < length) { if (Math.Abs(_listShiftPx) < length - 200) { _listShiftPx += directionSign * -100; } else { _listShiftPx += directionSign * (int)(-100 / j); j += .5; } if (Math.Abs(_listShiftPx) > length) { _listShiftPx = Math.Sign(_listShiftPx) * length; } //_listShiftPx += directionSign * -10; if (ListOrientation == Orientation.Vertical) { float transitionShift = _listShiftPx - (this.Width * Math.Sign(_listShiftPx)); currentList.Bounds = new Rectangle(_listShiftPx, 0, length, this.Height); transitionList.Bounds = new Rectangle(transitionShift, 0, length, this.Height); } else { float transitionShift = _listShiftPx - (this.Height * Math.Sign(_listShiftPx)); currentList.Bounds = new Rectangle(0, _listShiftPx, this.Width, length); transitionList.Bounds = new Rectangle(0, transitionShift, this.Width, length); } Thread.Sleep(10); } currentList.Bounds = new Rectangle(this.Width, 0, this.Width, this.Height); transitionList.Bounds = new Rectangle(0, 0, this.Width, this.Height); currentList.StopRenderer(); FutureListTransition = null; _currentListIndex = pNewIndex; _listShiftPx = 0; }
private DragableList CreateList() { var newList = new DragableList(); newList.Bounds = Bounds; newList.SelectedItemChanged += OnSelectItem; AddViewControl(newList); newList.ListOrientation = ListOrientation; newList.ItemSize = ItemSize; return(newList); }
/// <summary> /// Clears all dragable list items in list at specified listindex /// /// </summary> /// <param name="pListIndex"></param> public void ClearListAtIndex(int pListIndex, bool pRemoveFutureLists) { if (pListIndex >= _listCollection.Count || pListIndex < 0) { throw new Exception("ListIndex is out of rage"); } // Call dispose on each object for (int i = _listCollection.Count - 1; i >= pListIndex; i--) { if (pRemoveFutureLists || i == pListIndex) { DragableList dragableList = _listCollection[i]; dragableList.ListLocPx = 0; dragableList.ClearList(); //if (i != pListIndex) RemoveList(dragableList); } } }
public MediaShortcut() { _internalList = new DragableList(); _internalList.StartRender(); }