public static void LoadTemplates( string DirPath, ToolStripMenuItem Menu, EventHandler OnClick, OnAddItemHandler OnAdd ) { List<string> files = new List<string>( Directory.GetFiles( DirPath, "*.tpl" ) ); ITemplate tpl; files.Sort(); Menu.DropDownItems.Clear(); for( int i = 0; i < files.Count; i++ ) { string fileName = Path.GetFileNameWithoutExtension( files[ i ] ); using( FileStream fs = File.OpenRead( files[ i ] ) ) tpl = (ITemplate)mXml.Deserialize( fs ); if( tpl == null ) { // Error Message? continue; } CacheTemplate( tpl ); ToolStripMenuItem item = BuildMenuItem( fileName, tpl, OnClick ); if( OnAdd != null ) item = OnAdd( tpl, item ); Menu.DropDownItems.Add( item ); } }
public static void LoadTemplates( EventHandler OnClick, OnAddItemHandler OnAdd, ToolStripMenuItem Weapon, ToolStripMenuItem Armor, ToolStripMenuItem Lapi, ToolStripMenuItem APItem, ToolStripMenuItem ETCItem ) { LoadTemplates( DirWeapon, Weapon, OnClick, OnAdd ); LoadTemplates( DirArmor, Armor, OnClick, OnAdd ); LoadTemplates( DirLapis, Lapi, OnClick, OnAdd ); LoadTemplates( DirApItem, APItem, OnClick, OnAdd ); LoadTemplates( DirEtc, ETCItem, OnClick, OnAdd ); }
public static void LoadTemplates(EventHandler OnClick, OnAddItemHandler OnAdd, ToolStripMenuItem Weapon, ToolStripMenuItem Armor, ToolStripMenuItem Lapi, ToolStripMenuItem APItem, ToolStripMenuItem ETCItem) { LoadTemplates(DirWeapon, Weapon, OnClick, OnAdd); LoadTemplates(DirArmor, Armor, OnClick, OnAdd); LoadTemplates(DirLapis, Lapi, OnClick, OnAdd); LoadTemplates(DirApItem, APItem, OnClick, OnAdd); LoadTemplates(DirEtc, ETCItem, OnClick, OnAdd); }
public static InventoryBrowserModel GetModel(Array components, OnAddItemHandler onAddItem) { InventoryBrowserModel model = new InventoryBrowserModel(); foreach (BaseWrapper component in components) { if (onAddItem(component)) { model.Roots.Add(component.GetTreeNode(null)); } } return(model); }
private static RootNode GetComponentsRoot(InventoryBrowserModel owner, string name, Array items, OnAddItemHandler onAddItem) { return(new RootNode(owner, name, items, onAddItem)); }
public static void LoadTemplates(string DirPath, ToolStripMenuItem Menu, EventHandler OnClick, OnAddItemHandler OnAdd) { List <string> files = new List <string>(Directory.GetFiles(DirPath, "*.tpl")); ITemplate tpl; files.Sort(); Menu.DropDownItems.Clear(); for (int i = 0; i < files.Count; i++) { string fileName = Path.GetFileNameWithoutExtension(files[i]); using (FileStream fs = File.OpenRead(files[i])) tpl = (ITemplate)mXml.Deserialize(fs); if (tpl == null) { // Error Message? continue; } CacheTemplate(tpl); ToolStripMenuItem item = BuildMenuItem(fileName, tpl, OnClick); if (OnAdd != null) { item = OnAdd(tpl, item); } Menu.DropDownItems.Add(item); } }
public ComponentRealizationNode(ComponentWrapper content, BaseNode parent, ReferenceInfo RefInfo, OnAddItemHandler OnAddItem) : base(content, parent, RefInfo, OnAddItem) { }
public ComponentReferencesNode(ComponentWrapper content, BaseNode parent, ReferenceInfo RefInfo, OnAddItemHandler OnAddItem) : base(content, parent, OnAddItem) { this.RefData = RefInfo[content]; }
public ComponentNode(ComponentWrapper content, BaseNode parent, OnAddItemHandler OnAddItem) : base(content, parent, GetIcon(content)) { this.OnAddItem = OnAddItem; }
public RootNode(InventoryBrowserModel owner, string text, Array items, OnAddItemHandler onAddItem) : this(owner, text, items, Resources.CompFolder, onAddItem) { }
public RootNode(InventoryBrowserModel owner, string text, Array items, Image icon, OnAddItemHandler onAddItem) : base(items, onAddItem) { this.Name = text; this.Icon = icon; this.Model = owner; }
protected ItemsNode(Array wrappers, OnAddItemHandler onAddItem) { this.Wrappers = wrappers; this.OnAddItem = onAddItem; }