protected override void OnVisualChildrenChanged(DependencyObject visualAdded, DependencyObject visualRemoved) { base.OnVisualChildrenChanged(visualAdded, visualRemoved); var element = visualAdded as UIElement; if (element != null) { element.MouseLeave -= ReleaseQuickInfo; element.MouseLeave += ReleaseQuickInfo; element.MouseEnter -= SuppressQuickInfo; element.MouseEnter += SuppressQuickInfo; element.MouseLeftButtonDown -= BringToFront; element.MouseLeftButtonDown += BringToFront; SetZIndex(element, ++_LayerZIndex); } element = visualRemoved as UIElement; if (element != null) { element.MouseLeave -= ReleaseQuickInfo; element.MouseEnter -= SuppressQuickInfo; element.MouseLeftButtonDown -= BringToFront; ChildRemoved?.Invoke(this, new AdornmentChildRemovedEventArgs(element)); _View.Properties.RemoveProperty(QuickInfoSuppressionId); for (int i = Children.Count - 1; i >= 0; i--) { var f = Children[i].GetFirstVisualChild <TextBox>(); if (f != null && f.Focus()) { return; } } FocusOnTextView(); } }
public void RemoveChildItem(StoryBlockBase item) { ChildItemList.Remove(item); item.ParentItem = null; ChildRemoved?.Invoke(item, this); }
public void RemoveChild(MotionItemBase child) { childList.Remove(child); child.Parent = null; ChildRemoved?.Invoke(child); }
public void RemoveChildItem(UiItem item) { ChildItemList.Remove(item); item.ParentItem = null; ChildRemoved?.Invoke(item, this); }
private void RemoveChildButton_Click(object sender, RoutedEventArgs e) { string child = string.Empty; string partner = string.Empty; if (Regex.Split(this.ChildCombobox.SelectedItem.ToString(), " & ").Length == 1) { child = this.ChildCombobox.SelectedItem.ToString(); } else if (Regex.Split(this.ChildCombobox.SelectedItem.ToString(), " & ").Length == 2) { child = Regex.Split(this.ChildCombobox.SelectedItem.ToString(), " & ")[0]; partner = Regex.Split(this.ChildCombobox.SelectedItem.ToString(), " & ")[1]; } Node <Person> childNode = PersonTree.GetNodeByName(PersonTree.Tree, child, partner); ChildRemovedEventArgs eventArgs = new ChildRemovedEventArgs() { person = childNode, name = child }; ChildRemoved?.Invoke(this, eventArgs); this.Close(); }
protected virtual void OnChildRemoved(Element child) { child.Parent = null; ChildRemoved?.Invoke(child, new ElementEventArgs(child)); OnDescendantRemoved(child); foreach (Element element in child.Descendants()) { OnDescendantRemoved(element); } }
private void HandlePut(ServerEvent serverEvent) { lock (CacheLock) { var token = Cache.SelectToken(serverEvent.ChildKey, false); if (token != null && token.Parent == null) { var newChildren = serverEvent.Data.Children().Except(Cache.Children()); foreach (var child in newChildren) { ChildAdded?.Invoke(child.GetType() == typeof(JValue) ? child : child.First); } var removedChildren = Cache.Children().Except(serverEvent.Data.Children()); foreach (var child in removedChildren) { ChildRemoved?.Invoke(child.First); } Cache = serverEvent.Data as JObject ?? new JObject(); } else { if (token == null) { Cache[serverEvent.Path] = serverEvent.Data as JToken; ChildAdded?.Invoke(Cache[serverEvent.Path]); } else { if (serverEvent.Data.ToObject <object>() == null) { var removedChild = Cache.SelectToken(serverEvent.Path, false); Cache.SelectToken(serverEvent.Path, false)?.Parent?.Remove(); ChildRemoved?.Invoke(removedChild); } else { var subChildPath = string.Join(".", serverEvent.Path.Split('.').Skip(1)); token[subChildPath] = serverEvent.Data as JToken; ChildChanged?.Invoke(Cache.SelectToken(serverEvent.ChildKey, false)); } } } ValueChanged?.Invoke(Cache); } }
protected virtual void OnChildRemoved(Element child) { if (child == null) { throw new ArgumentNullException(nameof(child)); } child.Parent = null; ChildRemoved?.Invoke(child, new ElementEventArgs(child)); OnDescendantRemoved(child); foreach (Element element in child.Descendants()) { OnDescendantRemoved(element); } }
public bool RemoveEntityTemplate(Guid id) { bool result = false; var template = GetEntityTemplate(id); if (template != null) { result = _entityTemplates.Remove(template); if (result) { Dirty.IsDirty = true; ChildRemoved?.Invoke(template); } } return(result); }
public bool RemoveFlowTemplate(Guid id) { bool result = false; var template = GetFlowTemplate(id); if (template != null) { result = _flowTemplates.Remove(template); if (result) { SetDirty(); ChildRemoved?.Invoke(template); } } return(result); }
public bool RemoveDiagram(Guid id) { bool result = false; var diagram = GetDiagram(id); if (diagram != null) { result = _diagrams.Remove(diagram); if (result) { UnregisterEvents(diagram); SetDirty(); ChildRemoved?.Invoke(diagram); } } return(result); }
private bool RemoveSchema([NotNull] IPropertySchema schema, bool force) { bool result = false; if (force || !IsUsed(schema)) { RemoveRelated(schema); result = _schemas.Remove(schema); if (result) { UnregisterEvents(schema); SetDirty(); ChildRemoved?.Invoke(schema); } } return(result); }
public bool RemoveEntity(Guid id) { bool result = false; var entity = GetEntity(id); if (entity != null) { RemoveRelated(entity); result = _entities?.Remove(entity) ?? false; if (result) { UnregisterEvents(entity); Dirty.IsDirty = true; ChildRemoved?.Invoke(entity); } } return(result); }
public bool RemoveGroup(Guid id) { bool result = false; var item = GetGroup(id); if (item != null) { var newParent = (item as IGroupElement)?.Parent; var entities = item.Entities?.ToArray(); if (entities?.Any() ?? false) { foreach (var entity in entities) { entity.SetParent(newParent); } } var groups = item.Groups?.ToArray(); if (groups?.Any() ?? false) { foreach (var group in groups) { (group as IGroupElement)?.SetParent(newParent); } } RemoveRelated(item); result = _groups.Remove(item); if (result) { UnregisterEvents(item); SetDirty(); ChildRemoved?.Invoke(item); } } return(result); }
public bool RemoveThreatActor(Guid id, bool force = false) { bool result = false; var actor = GetThreatActor(id); if (actor != null && (force || !IsUsed(actor))) { RemoveRelated(actor); result = _actors.Remove(actor); if (result) { UnregisterEvents(actor); SetDirty(); ChildRemoved?.Invoke(actor); } } return(result); }
public bool RemoveThreatType(Guid id, bool force = false) { bool result = false; var threatType = GetThreatType(id); if (threatType != null && (force || !IsUsed(threatType))) { RemoveRelated(threatType); result = _threatTypes.Remove(threatType); if (result) { UnregisterEvents(threatType); SetDirty(); ChildRemoved?.Invoke(threatType); } } return(result); }
public bool RemoveMitigation(Guid id, bool force = false) { bool result = false; var mitigation = _mitigations?.FirstOrDefault(x => x.Id == id); if (mitigation != null && (force || !IsUsed(mitigation))) { RemoveRelated(mitigation); result = _mitigations.Remove(mitigation); if (result) { UnregisterEvents(mitigation); SetDirty(); ChildRemoved?.Invoke(mitigation); } } return(result); }
public bool RemoveWeakness(Guid id, bool force = false) { bool result = false; var weakness = GetWeakness(id); if (weakness != null && (force || !IsUsed(weakness))) { RemoveRelated(weakness); result = _weaknesses.Remove(weakness); if (result) { UnregisterEvents(weakness); SetDirty(); ChildRemoved?.Invoke(weakness); } } return(result); }
public bool RemoveDataFlow(Guid id) { bool result = false; var flow = GetDataFlow(id); if (flow != null) { RemoveRelated(flow); flow.ThreatEventAdded += OnThreatEventAddedToDataFlow; flow.ThreatEventRemoved += OnThreatEventRemovedFromDataFlow; result = _dataFlows.Remove(flow); if (result) { UnregisterEvents(flow); Dirty.IsDirty = true; ChildRemoved?.Invoke(flow); } } return(result); }
protected virtual void RaiseChildRemoved(Instance child) { ChildRemoved?.Invoke(this, new ChildRemovedEventArgs(child)); }
private void OnChildRemoved(ExtendedForm parent, ExtendedForm child) { ChildRemoved?.Invoke(parent, child); parentForm?.OnChildRemoved(parent, child); }
private void OnEntityRemoved(Entity child) { ChildRemoved?.Invoke(null, child); }
protected virtual void OnChildRemoved(ControlArgs e) { ChildRemoved?.Invoke(this, e); }
public void RemoveChild(EntityObject child) { Children.Remove(child); ChildRemoved?.Invoke(this, child); }
protected virtual void OnChildRemoved(IDataStructure sender, IDataStructure datastructure) { ChildRemoved?.Invoke(sender, datastructure); }
/// <summary> /// Notifies the <see cref="IRenderer"/> about a child removed from this element. /// </summary> /// <param name="element">The element.</param> protected void NotifyChildRemoved(FrameworkElement element) { ChildRemoved?.Invoke(this, element); }
protected override bool HandleMessage(WidgetMessage message, Widget widget, IntPtr param1, IntPtr param2) { bool handled = false; switch (message) { case WidgetMessage.Create: Created?.Invoke(widget, param1 != default, ref handled); break; case WidgetMessage.Destroy: Destroyed?.Invoke(widget, param1 != default, ref handled); break; case WidgetMessage.Paint: Paint?.Invoke(widget, ref handled); break; case WidgetMessage.Draw: Draw?.Invoke(widget, ref handled); break; case WidgetMessage.KeyPress: KeyPressed?.Invoke(widget, ref AsRef <KeyState>(param1), ref handled); break; case WidgetMessage.KeyTakeFocus: TakingFocus?.Invoke(widget, param1 != default, ref handled); break; case WidgetMessage.KeyLoseFocus: LostFocus?.Invoke(widget, param1 != default, ref handled); break; case WidgetMessage.MouseDown: MouseDown?.Invoke(widget, ref AsRef <MouseState>(param1), ref handled); break; case WidgetMessage.MouseDrag: MouseDrag?.Invoke(widget, ref AsRef <MouseState>(param1), ref handled); break; case WidgetMessage.MouseUp: MouseUp?.Invoke(widget, ref AsRef <MouseState>(param1), ref handled); break; case WidgetMessage.Reshape: Reshape?.Invoke(widget, Widget.GetOrCreate(param1), ref AsRef <WidgetGeometryChange>(param2), ref handled); break; case WidgetMessage.ExposedChanged: ExposedChanged?.Invoke(widget, ref handled); break; case WidgetMessage.AcceptChild: ChildAdded?.Invoke(widget, Widget.GetOrCreate(param1), ref handled); break; case WidgetMessage.LoseChild: ChildRemoved?.Invoke(widget, Widget.GetOrCreate(param1), ref handled); break; case WidgetMessage.AcceptParent: ParentChanged?.Invoke(widget, param1 != default ? Widget.GetOrCreate(param1) : null, ref handled); break; case WidgetMessage.Shown: Shown?.Invoke(widget, Widget.GetOrCreate(param1), ref handled); break; case WidgetMessage.Hidden: Hidden?.Invoke(widget, Widget.GetOrCreate(param1), ref handled); break; case WidgetMessage.DescriptorChanged: DescriptorChanged?.Invoke(widget, ref handled); break; case WidgetMessage.PropertyChanged: PropertyChanged?.Invoke(widget, param1.ToInt32(), param2, ref handled); break; case WidgetMessage.MouseWheel: MouseWheel?.Invoke(widget, ref AsRef <MouseState>(param1), ref handled); break; case WidgetMessage.CursorAdjust: CursorAdjust?.Invoke(widget, ref AsRef <MouseState>(param1), ref AsRef <CursorStatus>(param2), ref handled); break; } return(handled); }