internal async void RemoveSortingBox(SortingBox box) { await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { this.Children.Remove(box); }); }
public override void TerminateGesture(object sender, GestureEventArgs e) { base.TerminateGesture(sender, e); SortingBox box = e.Senders[0] as SortingBox; gestureListenerController.RemoveSortingBox(box); }
/// <summary> /// Set the z index of the sorting box /// </summary> /// <param name="card"></param> /// <param name="zindex"></param> internal async void SetZIndex(SortingBox box, int zindex) { await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { Canvas.SetZIndex(box, zindex); }); }
public override void TerminateGesture(object sender, GestureEventArgs e) { base.TerminateGesture(sender, e); SemanticCard card = (SemanticCard)e.Senders[0]; SortingBox box = (SortingBox)e.Senders[1]; box.AddCard(card); System.Diagnostics.Debug.WriteLine("Card Sorted: " + card.Document.GetTitle()); }
/// <summary> /// Update the card zindex in the cardlayer /// </summary> /// <param name="card"></param> internal void MoveSortingBoxToTop(SortingBox box) { if (zIndexList.Keys.Contains(box)) { int currentIndex = zIndexList[box]; foreach (SortingBox bx in zIndexList.Keys.ToList()) { if (zIndexList[bx] > currentIndex) { zIndexList[bx]--; sortingBoxLayer.SetZIndex(bx, zIndexList[bx]); } } zIndexList[box] = zIndexList.Count - 1; sortingBoxLayer.SetZIndex(box, zIndexList[box]); } }
/// <summary> /// Detect the sortingbox deleting gesture (Drag and drop the box to the delete box on the menubar). /// The touches in the sorting gesture will be removed from the touchList /// </summary> /// <param name="touchList"></param> /// <returns></returns> internal static async Task Detect(List <Touch> touchList, CentralControllers controllers) { List <Touch> usedTouches = new List <Touch>(); DeletingBoxGesture gesture = null; foreach (Touch touch in touchList) { if (touch.Type == typeof(SortingBox) && !usedTouches.Contains(touch)) { SortingBox box = touch.Sender as SortingBox; MenuBar[] bars = controllers.MenuLayerController.GetAllMenuBars(); foreach (MenuBar bar in bars) { bool isIntersect = await bar.IsIntersectWithDelete(box.Position); if (isIntersect) { foreach (Touch otherTouches in touchList) { if (touch.Sender == otherTouches.Sender && !usedTouches.Contains(otherTouches)) { usedTouches.Add(otherTouches); } } gesture = new DeletingBoxGesture(controllers.GestureController); gesture.AssociatedTouches = usedTouches; gesture.AssociatedObjects = new List <object>() { box, bar }; gesture.AssociatedObjectTypes = new List <Type>() { typeof(SortingBox), typeof(MenuBar) }; DeletingBoxListener listener = controllers.ListenerController.GetListener(typeof(DeletingBoxListener)) as DeletingBoxListener; RegisterListener(gesture, listener);// Register the gesture and add the gesture to the gesture list. } } } } foreach (Touch touch in usedTouches) { touchList.Remove(touch); } }
/// <summary> /// Remove a sorting box from the sorting box layer /// </summary> /// <param name="box"></param> internal void RemoveSortingBox(SortingBox box) { MoveSortingBoxToTop(box); zIndexList.Remove(box); sortingBoxLayer.RemoveSortingBox(box); }
/// <summary> /// Remove the sorting box. /// </summary> /// <param name="box"></param> internal void RemoveSortingBox(SortingBox box) { controllers.SortingBoxController.DestroyBox(box); }