/// <summary> /// Loads Component on a dobule mouse click event /// </summary> private void MouseDbClick_LoadComponent(object sender, MouseButtonEventArgs e) { ComponentInfo selectedItems = (ComponentInfo)CompCollection.SelectedItem; string name = selectedItems.Name; Grid customGrid = new GridContentReflection(name); customGrid.Style = Resources["GridStyle"] as Style; var current = this.TCcomp.Items; bool doesNotHaveTab = true; foreach (TabItem item in TCcomp.Items) { if (item.Header.ToString().Equals(name)) { doesNotHaveTab = false; break; } } if (doesNotHaveTab) { TCcomp.Items.Add(new TabItemVM(name, customGrid)); TCcomp.SelectedIndex = TCcomp.Items.Count - 1; } }
/// <summary> /// Event that browses for an xml file, then creates the neccesary tabs /// </summary> private void browse_xml(object sender, RoutedEventArgs e) { if (!EC.insert(ref xml_filename)) { return; } EC.getPropertyValue(xml_filename); var spritePrevier = SpriteTab; TCcomp.Items.Clear(); TCcomp.Items.Add(spritePrevier); _Animations.Clear(); foreach (Component com in EC.getEntity(xml_filename).Components) { Grid customGrid = new GridContentReflection(com); customGrid.Style = Resources["GridStyle"] as Style; TCcomp.Items.Add(new TabItemVM(com.Name, customGrid)); } PlayerEntityBrowseFileTextBox.Text = System.IO.Path.GetFileNameWithoutExtension(xml_filename); SizeBx.Text = FileManagement.size.ToString(); OpenPngOnBrowse(); }