/// <summary> /// 拖拽工具插头 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Plugitem_PreviewMouseMove(object sender,MouseEventArgs e) { if(e.LeftButton == MouseButtonState.Pressed) { try { AbstractCableKit drogKit = Kits_ListBox.SelectedItem as AbstractCableKit; AbstractCableKit kit = (AbstractCableKit)drogKit.Clone(); Grid grid = sender as Grid; var dragData = new DataObject(typeof(AbstractCableKit), kit); Point pos = e.GetPosition(Kits_ListBox); HitTestResult result = VisualTreeHelper.HitTest(Kits_ListBox, pos); if (result == null) return; ListBoxItem listBoxItem = EquipmentUtils.FindVisualParent<ListBoxItem>(result.VisualHit); // Find your actual visual you want to drag DragDropAdorner adorner = new DragDropAdorner(listBoxItem); adornerLayer = AdornerLayer.GetAdornerLayer(this); adornerLayer.Add(adorner); DragDrop.DoDragDrop(grid, dragData, DragDropEffects.Copy); adornerLayer.Remove(adorner); adornerLayer = null; } catch { } } }
private static void ClearAdorner(AdornerLayer layer, LightBoxAdorner adorner) { // null条件演算子でいいかも。 if (layer != null && adorner != null) { layer.Remove(adorner); } }
/// <summary> /// Unload overlay /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void UnloadedHandler(object sender, RoutedEventArgs e) { if (_adorner != null) { AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(this); adornerLayer?.Remove(_adorner); _adorner = null; } }
private void DesignerItemDecorator_Unloaded(object sender, RoutedEventArgs e) { if (adorner == null) { return; } AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(this); adornerLayer?.Remove(adorner); adorner = null; }
/// <summary> /// Handles mouse up event sent from adorner /// </summary> /// <param name="sender">The adorner</param> /// <param name="e">The event args</param> private void AdornerMouseUp(object sender, MouseButtonEventArgs e) { RubberbandAdorner adorner = (RubberbandAdorner)sender; // remove adorner from adorner layer AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(this); adornerLayer?.Remove(adorner); if (this.mode != SelectionRectnagleModes.Selection) { TemplateViewModel context = (TemplateViewModel)this.DataContext; context.AddQuestion(adorner.Rectangle); } }
protected override void OnMouseUp(MouseButtonEventArgs e) { // release mouse capture if (IsMouseCaptured) { ReleaseMouseCapture(); } // remove this adorner from adorner layer AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(this._designerCanvasBehavior.DesignerCanvas); adornerLayer?.Remove(this); _schemeTabViewModel.OnSelectChanged(); e.Handled = true; }
private void ResizeThumb_DragCompleted(object sender, DragCompletedEventArgs e) { if (Adorner != null) { AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(ParentItem); adornerLayer?.Remove(Adorner); Adorner = null; if (!e.Canceled) { Messenger.Default.Send(new DragMessage(this, false)); } } e.Handled = true; }
private void ApplyContentAdorner(bool show) { if (show) { if (_adornerLayer == null) { _adornerLayer = AdornerLayer.GetAdornerLayer(AdornedElement); SetBinding(VisibilityProperty, new Binding { Source = AdornedElement, Path = new PropertyPath(AdornerVisibilityProperty) }); } _adornerLayer?.Add(this); } else { _adornerLayer?.Remove(this); } }
void Toggle() { try { if (IsAdornerVisible) { AddLogicalChild(Content); AddVisualChild(Content); AdornerLayer?.Add(this); } else { AdornerLayer?.Remove(this); RemoveLogicalChild(Content); RemoveVisualChild(Content); } } catch (Exception e) { Dev2Logger.Error("Error toggling adorner: ", e); } }
/// <summary> /// Remove the watermark from the specified element /// </summary> /// <param name="control">Element to remove the watermark from</param> private static void RemoveWatermark(UIElement control) { AdornerLayer layer = AdornerLayer.GetAdornerLayer(control); // layer could be null if control is no longer in the visual tree if (layer != null) { Adorner[] adorners = layer.GetAdorners(control); if (adorners == null) { return; } foreach (Adorner adorner in adorners) { if (adorner is WatermarkAdorner) { adorner.Visibility = Visibility.Hidden; layer.Remove(adorner); } } } }
private async void Close() { IsHitTestVisible = false; _window.PreviewMouseDown -= OnWindowMouseDown; _window.PreviewKeyDown -= OnWindowMouseDown; if (_hint.CloseOnResize) { _window.SizeChanged -= OnWindowSizeChanged; } var cell = GetByName("PART_Cell"); if (cell != null) { VisibilityAnimation.SetVisible(cell, false); await Task.Delay(300); } _layer.Remove(this); IsAnyShown = false; }
static IEnumerable <Adorner> RemoveAdorner(UIElement adornedElement, Type adornerType) { Fx.Assert(adornedElement != null, "Invalid argument"); Fx.Assert(typeof(Adorner).IsAssignableFrom(adornerType), "Invalid argument"); List <Adorner> adornersRemoved = new List <Adorner>(); AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(adornedElement); if (adornerLayer != null) { Adorner[] adorners = adornerLayer.GetAdorners(adornedElement); if (adorners != null) { foreach (Adorner adorner in adorners) { if (adornerType.IsAssignableFrom(adorner.GetType())) { adornerLayer.Remove(adorner); adornersRemoved.Add(adorner); } } } } return(adornersRemoved); }
protected override void OnMouseUp(MouseButtonEventArgs e) { if (HitConnector != null && HitConnector.IsSinkConnector && (!HitConnector.OnlyOneConnectionCanEnd || !HitConnector.Connections.Any(x => Equals(x.Sink, HitConnector)))) { Connector sourceConnector = this.sourceConnector; Connector sinkConnector = this.HitConnector; Connection newConnection = designerCanvas.ConnectionGenerator(sourceConnector, sinkConnector, designerCanvas.PathFinder); if (designerCanvas.ConnectionStyle != null) { newConnection.Style = designerCanvas.ConnectionStyle; } this.designerCanvas.setZIndex(newConnection, designerCanvas.Children.Count); this.designerCanvas.Children.Add(newConnection); } if (HitDesignerItem != null) { this.HitDesignerItem.IsDragConnectionOver = false; } if (this.IsMouseCaptured) { this.ReleaseMouseCapture(); } AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(this.designerCanvas); if (adornerLayer != null) { adornerLayer.Remove(this); } }
private void DesignerItemDecorator_Unloaded(object sender, RoutedEventArgs e) { if (this.adorner != null) { _backupAdorner = this.adorner; AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(this); if (adornerLayer != null) { adornerLayer.Remove(this.adorner); } //this.adorner = null; // _isLoadRender = true; } if (ShowDecorator == true) { _isLoadRender = true; } else { _isLoadRender = false; } }
void RemoveBorderAdorner(UIElement adornedElement) { if (adornedElement != null) { AdornerLayer layr = AdornerLayer.GetAdornerLayer(adornedElement); if (layr != null) { Adorner[] adorners = layr.GetAdorners(adornedElement); if (adorners != null) { foreach (Adorner adr in adorners) { BorderAdorner badr = adr as BorderAdorner; if (badr != null) { layr.Remove(badr); badr.DisposeDragging(); } } } } } }
void FinishDragOperation(ListViewItem draggedItem, AdornerLayer adornerLayer, bool isDragFullyFinished) { // Let the ListViewItem know that it is not being dragged anymore. ListViewItemDragState.SetIsBeingDragged(draggedItem, false); this.IsDragInProgress = false; if (this.ItemUnderDragCursor != null) { this.ItemUnderDragCursor = null; } // Remove the drag adorner from the adorner layer. if (adornerLayer != null) { adornerLayer.Remove(this.dragAdorner); this.dragAdorner = null; } if (IsDeleteSourceItem && isDragFullyFinished && this.listView.ItemsSource is ObservableCollection <ItemType> collection) { collection.RemoveAt(this.listView.SelectedIndex); } }
private static void OnShowContextPanelChanged(DependencyObject d, DependencyPropertyChangedEventArgs args) { ItemSkimmingPanel skimmingPanel = d as ItemSkimmingPanel; if ((bool)args.NewValue) { AdornerLayer layer = AdornerLayer.GetAdornerLayer(skimmingPanel); skimmingPanel._contextAdorner = new SkimmingContextAdorner(skimmingPanel); layer.Add(skimmingPanel._contextAdorner); skimmingPanel._contextAdorner.SelectItem(skimmingPanel._selectedIndex, skimmingPanel._previousIndex); } else { AdornerLayer layer = AdornerLayer.GetAdornerLayer(skimmingPanel); if (skimmingPanel._contextAdorner != null) { layer.Remove(skimmingPanel._contextAdorner); } skimmingPanel._contextAdorner = null; } }
private static void RemoveCueBanner(UIElement control) { AdornerLayer layer = AdornerLayer.GetAdornerLayer(control); if (layer == null) { return; } Adorner[] adorners = layer.GetAdorners(control); if (adorners == null) { return; } foreach (Adorner adorner in adorners) { if (adorner is CueBannerContentAdorner) { adorner.Visibility = Visibility.Hidden; layer.Remove(adorner); } } }
/// <summary> /// Dragging has ended, see if VM is IDiagramDesignerItem and notify of moving end. /// </summary> void DragThumb_DragCompleted(object sender, DragCompletedEventArgs e) { if (!dragStarted) { return; } else { dragStarted = false; } DiagramItemsMovementInfo movementInfo = diagramDesignerVM.CalcMovementInfo(this.selectedItemsVM, e.HorizontalChange, e.VerticalChange); diagramDesignerVM.MoveElements(selectedItemsVM, movementInfo); List <DiagramDesignerCanvas> selectionParentCanvases = new List <DiagramDesignerCanvas>(); foreach (DiagramDesignerItem item in selectedItems) { /* * IDiagramItemViewModel designerItem = item.DataContext as IDiagramItemViewModel; * if (designerItem == null) * continue; * * // apply change * double left = designerItem.Left + dragAdorner.LeftOffset; * double top = designerItem.Top + dragAdorner.TopOffset; * designerItem.Location = new PointD(left, top); */ DiagramDesignerCanvas canvas = (item as DiagramDesignerItem).ParentCanvas; if (canvas != null) { if (!selectionParentCanvases.Contains(canvas)) { selectionParentCanvases.Add(canvas); } } } // update diagram surfaces foreach (DiagramDesignerCanvas canvas in selectionParentCanvases) { if (canvas != null) { canvas.InvalidateMeasure(); } } // remove drag adorner if (this.IsMouseCaptured) { this.ReleaseMouseCapture(); } AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(this.diagramDesigner); if (adornerLayer != null) { adornerLayer.Remove(this.dragAdorner); } e.Handled = false; }
protected void DragCardCompleted() { // Release the card and its group foreach (Card c in DraggedCards) { if (c != null) { c.ReleaseControl(); } } Card.Group.ReleaseControl(); // Remove the visual feedback var mwc = _mainWin.Content as Visual; if (mwc != null) { AdornerLayer layer = AdornerLayer.GetAdornerLayer(mwc); foreach (CardDragAdorner overlay in OverlayElements) { layer.Remove(overlay); overlay.Dispose(); } } OverlayElements.Clear(); // Raise CardOutEvent if (_lastDragTarget != null) { _lastDragTarget.RaiseEvent(new CardsEventArgs(Card, DraggedCards, CardOutEvent, this)); _lastDragTarget = null; } // Raise CardDroppedEvent IInputElement res = Mouse.DirectlyOver; if (res != null) { var args = new CardsEventArgs(Card, DraggedCards, CardDroppedEvent, this) { MouseOffset = _mouseOffset, FaceUp = !(Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift)) }; res.RaiseEvent(args); } // Restore full opacity // FIX (jods): if the cards have been moved to another group, groupCtrl is null. // But in this case nothing has to be done opacity-wise since // the CardControls have been unloaded. GroupControl groupCtrl = GroupControl; if (groupCtrl != null) { foreach (CardControl cardCtrl in Selection.GetCardControls(groupCtrl, this)) { cardCtrl.Opacity = 1; } } DraggedCards.Clear(); }
private void RemoveCropFromCur() { AdornerLayer aly = AdornerLayer.GetAdornerLayer(_felCur); aly.Remove(_clp); }
private static void RemoveAdorner(UIElement rec) { adornerLayer = AdornerLayer.GetAdornerLayer(rec); System.Diagnostics.Debug.Assert(adornerLayer != null, "Oops, you have not defined an AdornerDecorator in the template, check the generic.xaml file."); if (adornerLayer!=null && adornerLayer.GetAdorners(rec) != null) adornerLayer.Remove(adornerLayer.GetAdorners(rec)[0]); }
/// <summary> /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. /// </summary> public void Dispose() { _adornerLayer.Remove(this); }
public void PreviewClickControl(string controlType, string controlName) { string childString; string temp2 = "test"; foreach (UIElementInfo temp in ucaVM.UI_Element_List) { if (temp.UIELEMENT_ID.Equals(controlName)) { if (controlName == "MyCanvas") { temp2 = "MyCanvas"; } if (temp2.Equals(controlName)) { temp3 = MyCanvas; } else { foreach (UIElement child in MyCanvas.Children) { childString = child.ToString(); if (childString.Contains("RadioButton")) { temp2 = (child as RadioButton).Name; } else if (childString.Contains("TextBox")) { temp2 = (child as TextBox).Name; } else if (childString.Contains("PasswordBox")) { temp2 = (child as PasswordBox).Name; } else if (childString.Contains("ListBox")) { temp2 = (child as ListBox).Name; } else if (childString.Contains("ComboBox")) { temp2 = (child as ComboBox).Name; } else if (childString.Contains("Menu")) { temp2 = (child as Menu).Name; } else if (childString.Contains("Button")) { temp2 = (child as Button).Name; } else if (childString.Contains("Slider")) { temp2 = (child as Slider).Name; } if (temp2.Equals(controlName)) { temp3 = child; } } } } } if (selectedElement != null) { aLayer = AdornerLayer.GetAdornerLayer(selectedElement); bLayer = AdornerLayer.GetAdornerLayer(selectedElement); aLayer.Remove(preResizeAorner); bLayer.Remove(_rotateAdorner); } selectedElement = temp3; aLayer = AdornerLayer.GetAdornerLayer(selectedElement); preResizeAorner = new ResizingAdorner(selectedElement, this); aLayer.Add(preResizeAorner); bLayer = AdornerLayer.GetAdornerLayer(selectedElement); _rotateAdorner = new RotateAdorner(selectedElement, this); bLayer.Add(_rotateAdorner); string tempString = temp3.ToString(); ctrVM.LeftButtonMakeTempListItem(temp3, tempString); }
private void ReloadingFrame() { var model = this.DataContext as ShellViewModel; canvas.Children.Clear(); if (model.CurrentPage != null) { foreach (var frame in model.CurrentPage.Frames) { label = InitLabel( Math.Abs(ToOriginal(frame.Coordinates.TopLeft, model.CurrentPage.Zoom).X - ToOriginal(frame.Coordinates.TopRight, model.CurrentPage.Zoom).X), Math.Abs(ToOriginal(frame.Coordinates.TopLeft, model.CurrentPage.Zoom).Y - ToOriginal(frame.Coordinates.BottomLeft, model.CurrentPage.Zoom).Y), frame.Id); Canvas.SetLeft(label, ToOriginal(frame.Coordinates.TopLeft, model.CurrentPage.Zoom).X); Canvas.SetTop(label, ToOriginal(frame.Coordinates.TopLeft, model.CurrentPage.Zoom).Y); Console.WriteLine(ToOriginal(frame.Coordinates.TopLeft, model.CurrentPage.Zoom).X + ";" + ToOriginal(frame.Coordinates.TopLeft, model.CurrentPage.Zoom).Y + ";" + frame.Angle); label.RenderTransform = new RotateTransform(frame.Angle); canvas.Children.Add(label); label.Content = canvas.Children.Count; aLayer = AdornerLayer.GetAdornerLayer(label); aLayer.Add(new HelperAdorner(label)); aLayer.Remove(aLayer.GetAdorners(label).First()); } } model.NotifyZoom(); }
public void Detatch() { _adornerLayer.Remove(this); }
void SearchCompleted(SearchInfo? result, AdornerLayer layer, OverlayAdorner ad) { if (!result.HasValue) return; CallTreeNodeViewModel item = GetViewModelFromPath(result.Value.Result.GetPathRelativeTo(result.Value.ResultRoot), result.Value); if (item != null) { item.IsSelected = true; if (oldSearchResult != null) oldSearchResult.IsSelected = false; oldSearchResult = item; } layer.Remove(ad); }
private void uiAudioList_MouseMove(object sender, MouseEventArgs e) { if (ShouldStartDrag(e)) { this.isDragging = true; var item = this.draggedItem.DataContext as IAudioListItemViewModel; Debug.Assert(item != null); if (item.ShowLyrics) { item.SwitchLyricsStateCommand.Execute(null); } var capturePoint = e.GetPosition(this.draggedItem); this.draggedItemAdorner = new DragAdorner(this.dragScope, this.draggedItem, true, capturePoint, 0.7); layer = AdornerLayer.GetAdornerLayer(this.dragScope); layer.Add(this.draggedItemAdorner); this.draggedItem.Visibility = System.Windows.Visibility.Collapsed; DragDrop.AddPreviewDragOverHandler(this.dragScope, DragScopeDragOver); DragDrop.AddGiveFeedbackHandler(this.dragScope, DragScopeGiveFeedback); try { DragDrop.DoDragDrop(this.draggedItem, item, DragDropEffects.Move); this.draggedItem.CaptureMouse(); } finally { DragDrop.RemovePreviewDragOverHandler(this.dragScope, DragScopeDragOver); DragDrop.RemoveGiveFeedbackHandler(this.dragScope, DragScopeGiveFeedback); this.draggedItem.Visibility = System.Windows.Visibility.Visible; if (layer != null && this.draggedItemAdorner != null) layer.Remove(this.draggedItemAdorner); this.draggedItemAdorner = null; this.draggedItem = null; this.isDragging = false; } } }
public void Destroy() { _adornerLayer.Remove(this); }
public void Detach() { //AdornedElement.LayoutUpdated -= AdornedElementLayoutUpdated; _adornerLayer.Remove(this); }
private void RemoveCropFromCur() { AdornerLayer aly = AdornerLayer.GetAdornerLayer(_frameworkElement); aly.Remove(_croppingAdorner); }
public void _PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { string _typeName = null; if (agoSelectedElement != null) { _draggedElementToString = agoSelectedElement.ToString(); _typeName = ctrVM.UIelementCheckTypeName(agoSelectedElement, _draggedElementToString); string xmlTag = ctrVM.fileTabV.scriptV.getBlocks(); ctrVM.hiddenfileSave(_typeName, xmlTag); string jsCode = ctrVM.fileTabV.scriptV.getJSCode(); ctrVM.JSFileSave(jsCode); ctrVM._ucaVM.DomtreeVM.importScriptSrc_To_HTMLDocument(ctrVM.current_Scene + "_" + ctrVM.current_typeName + ".js"); } _draggedElementToString = (e.Source as UIElement).ToString(); _tabControls.TabContols.SelectedIndex = 0; if (e.Source == MyCanvas || _draggedElementToString == "System.Windows.Controls.Grid") { if (selectedElement != null) { aLayer = AdornerLayer.GetAdornerLayer(selectedElement); bLayer = AdornerLayer.GetAdornerLayer(selectedElement); if (aLayer != null && bLayer != null) { aLayer.Remove(preResizeAorner); bLayer.Remove(_rotateAdorner); } } _draggedElementToString = MyCanvas.ToString(); selectedElement = MyCanvas; object canvasObject = MyCanvas; aLayer = AdornerLayer.GetAdornerLayer(selectedElement); preResizeAorner = new ResizingAdorner(selectedElement, this); aLayer.Add(preResizeAorner); bLayer = AdornerLayer.GetAdornerLayer(selectedElement); _rotateAdorner = new RotateAdorner(selectedElement, this); bLayer.Add(_rotateAdorner); //여기오류 ctrVM._ucaVM.currentUIInfo = ctrVM._ucaVM.UI_Element_List[0]; ctrVM._ucaVM.preview.clickedControl("MyCanvas"); ctrVM.LeftButtonMakeTempListItem(canvasObject, _draggedElementToString); string pathJS = Environment.GetEnvironmentVariable("USERPROFILE") + "\\MisengWorkSpace\\" + ctrVM.current_projectName + "\\Tizen\\" + ctrVM.current_projectName + "\\js\\" + ctrVM.current_Scene + "_" + ctrVM.current_typeName + ".js"; ctrVM.SrcCodeVM.GetSrcOfPathJS(pathJS); ctrVM.CURRENT_JS = ctrVM.current_Scene + "_" + ctrVM.current_typeName + ".js"; } else { _isPreMouseDown = true; _dragStartPoint = e.GetPosition(MyCanvas); _draggedElement = e.Source as UIElement; MyCanvas.CaptureMouse(); e.Handled = true; if (selectedElement != null) { aLayer = AdornerLayer.GetAdornerLayer(selectedElement); bLayer = AdornerLayer.GetAdornerLayer(selectedElement); aLayer.Remove(preResizeAorner); bLayer.Remove(_rotateAdorner); } ctrVM._ucaVM.currentUIInfo = search_UIinfo(e.Source.ToString().Split(new char[] { ':', ' ' }).Last()); selectedElement = e.Source as UIElement; aLayer = AdornerLayer.GetAdornerLayer(selectedElement); preResizeAorner = new ResizingAdorner(selectedElement, this); aLayer.Add(preResizeAorner); bLayer = AdornerLayer.GetAdornerLayer(selectedElement); _rotateAdorner = new RotateAdorner(selectedElement, this); bLayer.Add(_rotateAdorner); //ctrVM._ucaVM.preview 자꾸 널.. 버튼 눌렀다가 캔버스 눌렀다가 버튼누르면 널 .. 널죽이겠다.. ctrVM._ucaVM.preview.clickedControl(e.Source); ctrVM.LeftButtonMakeTempListItem(e.Source, _draggedElementToString); string pathJS = Environment.GetEnvironmentVariable("USERPROFILE") + "\\MisengWorkSpace\\" + ctrVM.current_projectName + "\\Tizen\\" + ctrVM.current_projectName + "\\js\\" + ctrVM.current_Scene + "_" + ctrVM.current_typeName + ".js"; ctrVM.SrcCodeVM.GetSrcOfPathJS(pathJS); ctrVM.CURRENT_JS = ctrVM.current_Scene + "_" + ctrVM.current_typeName + ".js"; } agoSelectedElement = selectedElement; }
protected override void OnMouseUp(MouseButtonEventArgs e) { if (sourceItem != null) { ModelTreeViewModel vm = this.diagramDesigner.DataContext as ModelTreeViewModel; if (sourceItem.SelectedData is TreeNodeViewModel) { if ((sourceItem.SelectedData as TreeNodeViewModel).Element is DomainClass) { List <DomainClass> domainClassesSrc = new List <DomainClass>(); domainClassesSrc.Add((sourceItem.SelectedData as TreeNodeViewModel).Element as DomainClass); bool bDone = false; if (hitItem != null) { if (hitItem.SelectedData is TreeNodeViewModel) { if ((hitItem.SelectedData as TreeNodeViewModel).Element is DomainClass) { bDone = true; // reference or embedding? if (Keyboard.Modifiers == ModifierKeys.Shift) { ModelTreeOperations.AddNewEmbeddingRelationship(domainClassesSrc, (hitItem.SelectedData as TreeNodeViewModel).Element as DomainClass); } else if (Keyboard.Modifiers == ModifierKeys.Control) { ModelTreeOperations.AddNewReferenceRelationship(domainClassesSrc, (hitItem.SelectedData as TreeNodeViewModel).Element as DomainClass); } else { Forms.RelationshipTypeSelector dlg = new Forms.RelationshipTypeSelector(); if (dlg.ShowDialog() == true) { if (dlg.EmbeddedRelationshipSelected == true) { ModelTreeOperations.AddNewEmbeddingRelationship(domainClassesSrc, (hitItem.SelectedData as TreeNodeViewModel).Element as DomainClass); } else if (dlg.EmbeddedRelationshipSelected == false) { ModelTreeOperations.AddNewReferenceRelationship(domainClassesSrc, (hitItem.SelectedData as TreeNodeViewModel).Element as DomainClass); } } } } } } if (!bDone) { ModelTreeOperations.AddNewEmbeddingRelationship(domainClassesSrc); } } } } if (this.IsMouseCaptured) { this.ReleaseMouseCapture(); } AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(this.diagramDesigner); if (adornerLayer != null) { adornerLayer.Remove(this); } }
private void Pin_MouseLeave(object sender, MouseEventArgs e) { _adornerLayer.Remove(_adorner); _adorner = null; }
//public static void ShowLoading(this UIElement element, bool isAutoClose=false) //{ // ShowLoading(element, string.Empty, string.Empty, 60, HorizontalAlignment.Center, VerticalAlignment.Center, null, null, false, Brushes.Gray, null); // Task.Factory.StartNew(() => // { // Task.Delay(10 * 1000); // if (element == null || element.Dispatcher == null) return; // element.Dispatcher.BeginInvoke(new Action(() => { element.HideLoading(); })); // }); //} //public static void UpdateLoading(this UIElement element, string Percent = "", string LoadingName = "") //{ // ShowLoading(element, Percent, LoadingName, 60, HorizontalAlignment.Center, VerticalAlignment.Center, null, null, false, Brushes.Gray, null); //} public static void HideLoading(this UIElement element, bool disableElement = false) { if (element == null || element.Dispatcher == null) { return; } if (element.Dispatcher.CheckAccess()) { element.IsEnabled = !disableElement; element.IsHitTestVisible = true; AdornerLayer layer = AdornerLayer.GetAdornerLayer(element); if (layer == null) { var win = element as Window; if (win != null && win.Content != null && win.Content is UIElement) { element = win.Content as UIElement; layer = AdornerLayer.GetAdornerLayer(element); } else if (element is FrameworkElement) { FrameworkElement fe = element as FrameworkElement; if (!fe.IsLoaded) { lock (list) { ShowLoadingContext target = null; foreach (var p in list) { if (p.Target == fe) { target = p; break; } } if (target != null) { list.Remove(target); } } fe.Loaded -= OnFrameworkElementLoaded; return; } } } if (layer != null) { LoadingAdorner target = null; var items = layer.GetAdorners(element); if (items != null) { foreach (var item in items) { if (item is LoadingAdorner) { target = item as LoadingAdorner; if (target != null) { layer.Remove(target); target.Dispose(); } } } } } } else { Action <UIElement, Boolean> action = HideLoading; element.Dispatcher.BeginInvoke(action, element, disableElement); } }
public static void RemoveScaleAdorner(ref AdornerLayer aLayer,ref Viewbox vb) { aLayer = AdornerLayer.GetAdornerLayer(vb); aLayer.Remove(new ScaleAdorner(vb)); }
void LoadCompleted(HierarchyList<CallTreeNodeViewModel> list, AdornerLayer layer, OverlayAdorner ad) { layer.Remove(ad); treeView.ItemsSource = this.list = list; if (list != null && list.Count > 0) { ringDiagram.SelectedRoot = this.list[0]; foreach (var item in list) { var currentItem = item; currentItem.RequestBringIntoView += (sender, e) => treeView.ScrollIntoView(e.Node); } } }
/// <summary> /// 分离装饰器。 /// </summary> public void Detatch() { _layer.Remove(this); }
public void Dispose() { layer.Remove(this); Helpers.DebugHelper.debugWrite(this, "OverlayAdorner Dispose"); }
protected override void EndDragCore() { AdornerLayer layer = AdornerLayer.GetAdornerLayer(Target); layer.Remove(_adorner); }