private void addMember_Click(object sender, RoutedEventArgs e) { var dialog = new EditMember("nouveau_membre", GenericType.Int, structtype, false); dialog.Owner = this; if (dialog.ShowDialog() == true) { structtype.Members.Add(dialog.memberName.Text, (dialog.memberType.SelectedItem as ToStringOverrider).Content as VarType); membersList.Children.Clear(); foreach (var item in structtype.Members) { membersList.Children.Add(new StructMember(structtype, item.Key)); } } }
private void editMember_Click(object sender, RoutedEventArgs e) { StackPanel parent = Parent as StackPanel; var dialog = new EditMember(Member, Type.Members[Member], Type, true); if (dialog.ShowDialog() == true) { Type.Members.Remove(Member); Type.Members.Add(dialog.memberName.Text, (dialog.memberType.SelectedItem as ToStringOverrider).Content as VarType); while (parent.Children[0] is StructMember) { parent.Children.RemoveAt(0); } foreach (var item in Type.Members) { parent.Children.Insert(parent.Children.Count - 1, new StructMember(Type, item.Key)); } Member = dialog.memberName.Text; } }