public void RemoveDescendant(GroupInfo group) { if (group != null && Childs.Remove(group)) { group.Parent = null; } }
/// <summary> /// Child <see cref="IPanel.Closed"/> event handler. /// </summary> /// <param name="sender">Event sender.</param> /// <param name="e">Event params.</param> private void OnChildClose(object sender, EventArgs e) { var panel = sender as IPanel; if (Childs.Contains(panel)) { int panelIndex = Childs.IndexOf(panel); Childs.Remove(panel); if (Active == panel && Childs.Count > 0) { // Todo: Make this configurable - after child panel is closed, make next OR prev child panel active. int newActiveIndex = panelIndex < Childs.Count ? panelIndex : Childs.Count - 1; Active = Childs[newActiveIndex]; } } if (Childs.Count == 0 && !isClosing) { active = null; RequestClose(); } }
public override Result OnUpdate(float deltaTime) { if (Childs.Count == 0) { return(Result.Succ); } if (Curr == null) { Curr = Childs[0]; Curr.Start(Data); } var r = Curr.Update(deltaTime); if (r == Result.Fail) { Childs.Remove(Curr); Curr = null; return(Result.Fail); } if (r == Result.Succ) { Childs.Remove(Curr); Curr = null; } return(base.OnUpdate(deltaTime)); }
public void DeleteNode(TreeNode <T> _node) { if (Childs.Contains(_node)) { Childs.Remove(_node); _node = null; } }
public bool Delete(string key) { PatriciaTrieNode child; if (!Childs.TryGetValue(key[Key.Length], out child)) { return(false); } key = key.Substring(Key.Length); if (!key.StartsWith(child.Key)) { return(false); } if (key.Length != child.Key.Length) { return(child.Delete(key)); } if (!child.Value.HasValue) { return(false); } if (child.Childs.Count > 1) { child.Value = null; } else if (child.Childs.Count == 0) { Childs.Remove(key[0]); } else if (child.Childs.Count == 1) { var k = child.Childs.First().Key; child.Childs[k].Key = child.Key + child.Childs[k].Key; Childs.Clear(); Childs.Add(child.Key[0], child.Childs[k]); } return(true); }
public Node this[string key] { get { var res = Childs.FirstOrDefault(item => item.Name == key); return(res); } set { var node = Childs.FirstOrDefault(item => item.Name == key); if (value == node) { return; } if (node != null) { Childs.Remove(node); } Childs.Add(value); } }
public void RemoveChild(Node child) { Childs.Remove(child); child.Parent = null; }
internal void RemoveChild(UIElement node) { Childs.Remove(node); }
/// <summary> /// Creates a root node view model /// </summary> private JMXStructure(string Name, Type ChildType = null) : base(Name, ChildType != null) { // Make sure the type is specified if (ChildType == null) { CommandAddChild = new RelayCommand(() => { /* Do Nothing... */ }); CommandRemoveChild = new RelayCommand(() => { /* Do Nothing... */ }); return; } /// Commands setup CommandAddChild = new RelayCommand(() => { /// Create and add a default instance to nodes queue string name = "[" + Childs.Count.ToString() + "]"; // default value types if (ChildType == typeof(byte)) { Childs.Add(new JMXAttribute(name, default(byte))); } else if (ChildType == typeof(uint)) { Childs.Add(new JMXAttribute(name, default(uint))); } else { // default classes types var nodeClass = new JMXStructure(name); if (ChildType == typeof(JMXVRES_0109.Material)) { var material = new JMXVRES_0109.Material(); nodeClass.Childs.Add(new JMXAttribute("Index", material.Index)); nodeClass.Childs.Add(new JMXAttribute("Path", material.Path)); } else if (ChildType == typeof(JMXVRES_0109.Mesh)) { var mesh = new JMXVRES_0109.Mesh(); nodeClass.Childs.Add(new JMXAttribute("Path", mesh.Path)); nodeClass.Childs.Add(new JMXAttribute("UnkUInt01", mesh.UnkUInt01)); } else if (ChildType == typeof(JMXVRES_0109.Animation)) { var animation = new JMXVRES_0109.Animation(); nodeClass.Childs.Add(new JMXAttribute("Path", animation.Path)); } else if (ChildType == typeof(JMXVRES_0109.Skeleton)) { var skeleton = new JMXVRES_0109.Skeleton(); nodeClass.Childs.Add(new JMXAttribute("Path", skeleton.Path)); nodeClass.Childs.Add(new JMXAttribute("ExtraBone", skeleton.ExtraBone)); } else if (ChildType == typeof(JMXVRES_0109.MeshGroup)) { var meshGroup = new JMXVRES_0109.MeshGroup(); nodeClass.Childs.Add(new JMXAttribute("Name", meshGroup.Name)); nodeClass.Childs.Add(new JMXStructure("FileIndexes", typeof(uint))); } else if (ChildType == typeof(JMXVRES_0109.AnimationGroup)) { var animationGroup = new JMXVRES_0109.AnimationGroup(); nodeClass.Childs.Add(new JMXAttribute("Name", animationGroup.Name)); nodeClass.Childs.Add(new JMXStructure("Entries", typeof(JMXVRES_0109.AnimationGroup.Entry))); } else if (ChildType == typeof(JMXVRES_0109.AnimationGroup.Entry)) { var animationGroupEntry = new JMXVRES_0109.AnimationGroup.Entry(); nodeClass.Childs.Add(new JMXOption("Type", animationGroupEntry.Type, GetValues <object>(typeof(ResourceAnimationType)))); nodeClass.Childs.Add(new JMXAttribute("FileIndex", animationGroupEntry.FileIndex)); nodeClass.Childs.Add(new JMXStructure("Events", typeof(JMXVRES_0109.AnimationGroup.Entry.Event))); nodeClass.Childs.Add(new JMXAttribute("WalkingLength", animationGroupEntry.WalkingLength)); nodeClass.Childs.Add(new JMXStructure("WalkPoints", typeof(JMXVRES_0109.AnimationGroup.Entry.Point))); } else if (ChildType == typeof(JMXVRES_0109.AnimationGroup.Entry.Event)) { var animationGroupEntryEvent = new JMXVRES_0109.AnimationGroup.Entry.Event(); nodeClass.Childs.Add(new JMXAttribute("KeyTime", animationGroupEntryEvent.KeyTime)); nodeClass.Childs.Add(new JMXAttribute("Type", animationGroupEntryEvent.Type)); nodeClass.Childs.Add(new JMXAttribute("UnkUInt01", animationGroupEntryEvent.UnkUInt01)); nodeClass.Childs.Add(new JMXAttribute("UnkUInt02", animationGroupEntryEvent.UnkUInt02)); } else if (ChildType == typeof(JMXVRES_0109.AnimationGroup.Entry.Point)) { var animationGroupEntryEventPoint = new JMXVRES_0109.AnimationGroup.Entry.Point(); nodeClass.Childs.Add(new JMXAttribute("X", animationGroupEntryEventPoint.X)); nodeClass.Childs.Add(new JMXAttribute("Y", animationGroupEntryEventPoint.Y)); } else { // type not found return; } Childs.Add(nodeClass); } }); CommandRemoveChild = new RelayParameterizedCommand((object parameter) => { // Make sure the item to remove is a correct value if (parameter is JMXProperty property) { // Try to remove it Childs.Remove(property); } }); }
private async void SubDelete(object obj) { if (SelectedChild?.FId != null) { var VaccineData = await DataService.Get($"Vaccine/{SelectedChild.Id}"); if (VaccineData == "ConnectionError") { StandardMessagesDisplay.NoConnectionToast(); } else if (VaccineData == "null") { var isDeleteAccepted = await StandardMessagesDisplay.DeleteDisplayMessage(SelectedChild.FullName); if (isDeleteAccepted) { if (Family?.Id != Guid.Empty) { var deleteResponse = await DataService.Delete($"Child/{Family?.Id}/{SelectedChild.FId}"); if (deleteResponse == "ConnectionError") { StandardMessagesDisplay.NoConnectionToast(); } else if (deleteResponse == "Error") { StandardMessagesDisplay.Error(); } else if (deleteResponse == "ErrorTracked") { StandardMessagesDisplay.ErrorTracked(); } else if (deleteResponse == "null") { _ = await DataService.Put((--StaticDataStore.TeamStats.TotalChilds).ToString(), $"Team/{Preferences.Get("ClusterId", "")}/{Preferences.Get("TeamId", "")}/TotalChilds"); StandardMessagesDisplay.ItemDeletedToast(); Childs?.Remove(SelectedChild); } } } else { return; } } else { try { var num = JsonConvert.DeserializeObject <Dictionary <string, VaccineModel> >(VaccineData); if (num != null) { StandardMessagesDisplay.ChildRecursiveDeletionNotAllowed(SelectedChild?.FullName, num.Values.Count); } } catch (Exception ex) { Crashes.TrackError(ex); StandardMessagesDisplay.InputToast(ex.Message); } } } }
public void RemoveChild(int p_index) { Childs.Remove(p_index); }
public void RemoveChild(IType p_type) { Childs.Remove(p_type); }
public void RemoveLayer(CALayer layer) { Childs.Remove(layer); }
public void removeChild(Node child) { Childs.Remove(child); }