/// <inheritdoc /> public bool TryResolveSimpleContext <TMajor>(FormKey formKey, [MaybeNullWhen(false)] out IModContext <TMajor> majorRec, ResolveTarget target = ResolveTarget.Winner) where TMajor : class, IMajorRecordGetter { if (TryResolveContext(formKey, typeof(TMajor), out var resolve, target)) { majorRec = resolve.AsType <IMajorRecordGetter, TMajor>(); return(true); } majorRec = default; return(false); }
/// <inheritdoc /> public bool TryResolveSimpleContext(FormKey formKey, Type type, [MaybeNullWhen(false)] out IModContext <IMajorRecordGetter> majorRec, ResolveTarget target = ResolveTarget.Winner) { if (TryResolveContext(formKey, type, out var resolve, target)) { majorRec = resolve; return(true); } majorRec = default; return(false); }
/// <inheritdoc /> public bool TryResolve <TMajor>(FormKey formKey, [MaybeNullWhen(false)] out TMajor majorRec, ResolveTarget target = ResolveTarget.Winner) where TMajor : class, IMajorRecordGetter { if (TryResolve(formKey, typeof(TMajor), out var majorRecInner, target)) { majorRec = majorRecInner as TMajor; return(majorRec != null); } majorRec = default; return(false); }
public bool Parse( MutagenFrame reader, out FormKey item) { if (FormKeyBinaryTranslation.Instance.Parse(reader, out FormKey id)) { item = id; return(true); } item = FormKey.Null; return(false); }
public void Comparer_LoadOrder_FallbackGreater() { var loadOrder = new LoadOrder <OblivionMod>() { new OblivionMod(ModKey.FromNameAndExtension("Oblivion.esm")), new OblivionMod(ModKey.FromNameAndExtension("Knights.esm")), }; FormKey k1 = FormKey.Factory("00C51A:Oblivion.esm"); FormKey k2 = FormKey.Factory("00C51B:Oblivion.esm"); var compare = FormKey.LoadOrderComparer(loadOrder); Assert.True(compare.Compare(k2, k1) > 0); }
public void Comparer_LoadOrder_Typical() { var loadOrder = new LoadOrder <OblivionMod>() { new OblivionMod(ModKey.FromNameAndExtension("Oblivion.esm")), new OblivionMod(ModKey.FromNameAndExtension("Knights.esm")), }; FormKey k1 = FormKey.Factory("00C51A:Oblivion.esm"); FormKey k2 = FormKey.Factory("00C51A:Knights.esm"); var compare = FormKey.LoadOrderComparer(loadOrder); Assert.True(compare.Compare(k1, k2) < 0); }
public FormKey CreateLeveledList(ISkyrimMod patchMod, bool forceCreate = false) { LeveledItem ll = null; if (forceCreate || LLFormKey == FormKey.Null) { var items = Armors.Select(a => a.FormKey.AsLink <IItemGetter>()) .Union(Weapons.Select(a => a.AsLink <IItemGetter>()).EmptyIfNull()); ll = OutfitUtils.CreateLeveledList(patchMod, items, Prefix, 1, LeveledItem.Flag.UseAll); LLFormKey = ll.FormKey; } return(LLFormKey); }
public void Comparer_ModKeyList_FallbackGreater() { List <ModKey> modKeys = new List <ModKey>() { ModKey.FromNameAndExtension("Oblivion.esm"), ModKey.FromNameAndExtension("Knights.esm"), }; FormKey k1 = FormKey.Factory("00C51A:Oblivion.esm"); FormKey k2 = FormKey.Factory("00C51B:Oblivion.esm"); var compare = FormKey.LoadOrderComparer(modKeys); Assert.True(compare.Compare(k2, k1) > 0); }
public void Comparer_ModKeyList_Unknown() { List <ModKey> modKeys = new List <ModKey>() { ModKey.FromNameAndExtension("Oblivion.esm"), ModKey.FromNameAndExtension("Knights.esm"), }; FormKey k1 = FormKey.Factory("00C51A:MyMod.esm"); FormKey k2 = FormKey.Factory("00C51B:Oblivion.esm"); var compare = FormKey.LoadOrderComparer(modKeys); Assert.Throws <ArgumentOutOfRangeException>(() => compare.Compare(k1, k2)); }
public static void CleanFormLinkListAPI() { SkyrimMod sourceMod = new SkyrimMod(Utility.PluginModKey, SkyrimRelease.SkyrimSE); FormKey key = sourceMod.GetNextFormKey(); Keyword keyword = sourceMod.Keywords.AddNew(); Armor armor = sourceMod.Armors.AddNew(); armor.Keywords = new ExtendedList <IFormLinkGetter <IKeywordGetter> >(); var test = armor.Keywords; test.Add(key); test.Add(keyword); }
public void Comparer_ModKeyList_Typical() { List <ModKey> modKeys = new List <ModKey>() { ModKey.FromNameAndExtension("Oblivion.esm"), ModKey.FromNameAndExtension("Knights.esm"), }; FormKey k1 = FormKey.Factory("00C51A:Oblivion.esm"); FormKey k2 = FormKey.Factory("00C51A:Knights.esm"); var compare = FormKey.LoadOrderComparer(modKeys); Assert.True(compare.Compare(k1, k2) < 0); }
/// <inheritdoc /> public bool TryResolveSimpleContext <TMajor>(FormKey formKey, [MaybeNullWhen(false)] out IModContext <TMajor> majorRec, ResolveTarget target = ResolveTarget.Winner) where TMajor : class, IMajorRecordGetter { if (target == ResolveTarget.Origin && formKey.ModKey != _sourceMod.ModKey) { majorRec = default; return(false); } return(_formKeyContexts.TryResolveSimpleContext(formKey, out majorRec)); }
public void Write( MutagenWriter writer, FormKey item, RecordType header, bool nullable = false) { using (HeaderExport.Header(writer, header, ObjectType.Subrecord)) { this.Write( writer, item); } }
public void Write( MutagenWriter writer, FormKey item, bool nullable = false) { if (writer.MetaData.CleanNulls && item.IsNull) { item = FormKey.Null; } UInt32BinaryTranslation.Instance.Write( writer: writer, item: writer.MetaData.MasterReferences!.GetFormID(item).Raw); }
public void Comparer_LoadOrder_Unknown() { var loadOrder = new LoadOrder <OblivionMod>() { new OblivionMod(ModKey.FromNameAndExtension("Oblivion.esm")), new OblivionMod(ModKey.FromNameAndExtension("Knights.esm")), }; FormKey k1 = FormKey.Factory("00C51A:MyMod.esm"); FormKey k2 = FormKey.Factory("00C51B:Oblivion.esm"); var compare = FormKey.LoadOrderComparer(loadOrder); Assert.Throws <ArgumentOutOfRangeException>(() => compare.Compare(k1, k2)); }
/// <summary> /// Converts a FormKey to a FormID representation, with its mod index calibrated /// against the contents of the registrar. /// </summary> /// <param name="key">FormKey to convert</param> /// <returns>FormID calibrated to registrar contents</returns> /// <exception cref="ArgumentException">If FormKey's ModKey is not present in registrar</exception> public FormID GetFormID(FormKey key) { if (this._masterIndices.TryGetValue(key.ModKey, out var index)) { return(new FormID( index, key.ID)); } if (key == FormKey.Null) { return(FormID.Null); } throw new ArgumentException($"Could not map FormKey to a master index: {key}"); }
public T this[FormKey key] { get { try { return(ConstructWrapper(this._locs[key])); } catch (Exception ex) { throw RecordException.Factory(ex, key, edid: null); } } }
public static void RunPatch(SynthesisState <ISkyrimMod, ISkyrimModGetter> state) { if (!state.LoadOrder.ContainsKey(ultimateDodgeMod)) { throw new Exception("ERROR: The Ultimate Dodge Mod hasn't been detected in your load order. You need to install TUDM prior to running this patcher!"); } FormKey UDRollNakedLandingSetKey = ultimateDodgeMod.MakeFormKey(0x011591); FormKey UDRollLightLandingSetKey = ultimateDodgeMod.MakeFormKey(0x011590); FormKey UDRollHeavyLandingSetKey = ultimateDodgeMod.MakeFormKey(0x01158F); if (!state.LinkCache.TryResolve <IFootstepSetGetter>(UDRollNakedLandingSetKey, out var UDRollNakedLandingSet) || UDRollNakedLandingSet == null) { throw new Exception("ERROR: UDRollNakedLandingSet FormKey not found! Are you on the latest TUDM x64 version?"); } if (!state.LinkCache.TryResolve <IFootstepSetGetter>(UDRollLightLandingSetKey, out var UDRollLightLandingSet) || UDRollLightLandingSet == null) { throw new Exception("ERROR: UDRollLightLandingSet FormKey not found! Are you on the latest TUDM x64 version?"); } if (!state.LinkCache.TryResolve <IFootstepSetGetter>(UDRollHeavyLandingSetKey, out var UDRollHeavyLandingSet) || UDRollHeavyLandingSet == null) { throw new Exception("ERROR: UDRollHeavyLandingSet FormKey not found! Are you on the latest TUDM x64 version?"); } foreach (var armor in state.LoadOrder.PriorityOrder.WinningOverrides <IArmorGetter>()) { Console.WriteLine("CHECKING ARMOR " + armor.EditorID); if (armor.Keywords == null) { continue; } if (armor.Keywords.Contains(Skyrim.Keyword.ArmorCuirass) || armor.Keywords.Contains(Skyrim.Keyword.ClothingBody)) { foreach (var armature in armor.Armature) { armature.TryResolve(state.LinkCache, out var armorAddonVar); if (armorAddonVar == null) { continue; } else { ArmorAddon armorAddon = armorAddonVar.DeepCopy(); Console.WriteLine("CHECKING ARMATURE " + armorAddon.EditorID); if (HasBodyFlag(armorAddon)) { Console.WriteLine("ARMATURE HAS BODYFLAG"); switch (armor.DeepCopy().BodyTemplate !.ArmorType) {
public static FormLinkSettingsVM Factory(IObservable <ILinkCache> linkCache, FieldMeta fieldMeta, Type targetType, object?defaultVal) { FormKey formKey = FormKey.Null; if (defaultVal != null) { formKey = FormKey.Factory( defaultVal.GetType().GetPublicProperties().FirstOrDefault(m => m.Name == "FormKey") !.GetValue(defaultVal) !.ToString()); } if (!LoquiRegistration.TryGetRegisterByFullName(targetType.GenericTypeArguments[0].FullName !, out var regis)) { throw new ArgumentException($"Can't create a formlink control for type: {targetType}"); } return(new FormLinkSettingsVM(linkCache, fieldMeta, regis.GetterType, formKey)); }
public static EnumerableFormKeySettingsVM Factory(FieldMeta fieldMeta, object?defaultVal) { var defaultKeys = new List <FormKey>(); if (defaultVal is IEnumerable e) { foreach (var item in e) { defaultKeys.Add(FormKey.Factory(item.ToString())); } } return(new EnumerableFormKeySettingsVM( fieldMeta, defaultVal as IEnumerable <FormKey> ?? Enumerable.Empty <FormKey>())); }
public void Write_MasterListSync() { using var tmp = GetFile(); var mod = new SkyrimMod(WriteKey, SkyrimRelease.SkyrimLE); mod.Weapons.RecordCache.Set( new Weapon(FormKey.Factory("012345:Skyrim.esm"), SkyrimRelease.SkyrimLE)); mod.WriteToBinary( tmp.File.Path, new BinaryWriteParameters() { ModKey = BinaryWriteParameters.ModKeyOption.NoCheck, MastersListContent = BinaryWriteParameters.MastersListContentOption.Iterate, }); }
public override void Import(JsonElement property, ILogger logger) { Values.Clear(); foreach (var elem in property.EnumerateArray()) { if (FormKey.TryFactory(elem.GetString(), out var formKey)) { Values.Add(new FormKeyItemViewModel(formKey)); } else { Values.Add(new FormKeyItemViewModel(FormKey.Null)); } } }
public void ParallelWrite_MasterListSync_Throw() { using var tmp = GetFile(); var mod = new SkyrimMod(WriteKey, SkyrimRelease.SkyrimLE); mod.Weapons.RecordCache.Set( new Weapon(FormKey.Factory("012345:Skyrim.esm"), SkyrimRelease.SkyrimLE)); Assert.Throws <AggregateException>( () => mod.WriteToBinaryParallel( tmp.File.Path, new BinaryWriteParameters() { ModKey = BinaryWriteParameters.ModKeyOption.NoCheck, MastersListContent = BinaryWriteParameters.MastersListContentOption.NoCheck, })); }
/// <inheritdoc /> public bool TryResolveIdentifier(string editorId, Type type, [MaybeNullWhen(false)] out FormKey formKey) { if (editorId.IsNullOrWhitespace()) { formKey = default; return(false); } for (int i = _mutableMods.Count - 1; i >= 0; i--) { if (_mutableMods[i].TryResolveIdentifier(editorId, type, out formKey)) { return(true); } } return(WrappedImmutableCache.TryResolveIdentifier(editorId, type, out formKey)); }
/// <inheritdoc /> public bool TryResolveSimpleContext(FormKey formKey, [MaybeNullWhen(false)] out IModContext <IMajorRecordGetter> majorRec, ResolveTarget target = ResolveTarget.Winner) { if (formKey.IsNull) { majorRec = default; return(false); } if (target == ResolveTarget.Origin && formKey.ModKey != _sourceMod.ModKey) { majorRec = default; return(false); } return(_formKeyContexts.TryResolveUntypedSimpleContext(formKey, out majorRec)); }
public override string ToString() { if (Types.Length == 0) { if (Type != null) { return($"{nameof(MissingRecordException)} {FormKey?.ToString() ?? EditorID}<{Type}>: {this.Message} {this.InnerException}{this.StackTrace}"); } else { return($"{nameof(MissingRecordException)} {FormKey?.ToString() ?? EditorID}: {this.Message} {this.InnerException}{this.StackTrace}"); } } else { return($"{nameof(MissingRecordException)} {FormKey?.ToString() ?? EditorID}<{Type} (+{Types.Length - 1})>: {this.Message} {this.InnerException}{this.StackTrace}"); } }
public LateSetPickerVM(MainVM mainVM) { SetCommand = ReactiveCommand.CreateFromTask(async() => { LinkCache = null; ScopedTypes = null; FormKey = FormKey.Null; await Task.Delay(2000); FormKey = FormKey.Factory("0136D4:Skyrim.esm"); await Task.Delay(2000); LinkCache = mainVM.LinkCache; ScopedTypes = mainVM.ScopedTypes; }); }
public void DisableAPI() { // Some calls assuring the Disable() API is accessible and working. SkyrimMod sourceMod = new SkyrimMod(Utility.PluginModKey, SkyrimRelease.SkyrimSE); FormKey key = sourceMod.GetNextFormKey(); PlacedObject placedObject = new PlacedObject(key, SkyrimRelease.SkyrimSE); // Simplistic Disable access and verification. PlacedObject disabledObj = placedObject; disabledObj.Disable(); //_testOutputHelper.WriteLine($"{disabledPlacedObject.MajorRecordFlagsRaw}"); Assert.True(EnumExt.HasFlag(disabledObj.MajorRecordFlagsRaw, Constants.InitiallyDisabled)); MajorRecord majorRecord = placedObject; majorRecord.Disable(); Assert.True(EnumExt.HasFlag(majorRecord.MajorRecordFlagsRaw, Constants.InitiallyDisabled)); IMajorRecordCommon interfaceRecord = placedObject; interfaceRecord.Disable(); Assert.True(EnumExt.HasFlag(interfaceRecord.MajorRecordFlagsRaw, Constants.InitiallyDisabled)); IPlaced interfacePlaced = placedObject; interfacePlaced.Disable(); Assert.True(EnumExt.HasFlag(interfacePlaced.MajorRecordFlagsRaw, Constants.InitiallyDisabled)); // Sanity test both API are invokable under Placed context. PlacedTrap placedTrap = new PlacedTrap(key, SkyrimRelease.SkyrimSE); placedTrap.Disable(IPlaced.DisableType.DisableWithoutZOffset); interfacePlaced = placedTrap; interfacePlaced.Disable(IPlaced.DisableType.JustInitiallyDisabled); IPlaced abstractPlaced = placedTrap; abstractPlaced.Disable(); abstractPlaced.Disable(IPlaced.DisableType.SafeDisable); //Try any other object other than Placed (invoke MajorRecord.Disable() and see if it works) var armor = new Armor(key, SkyrimRelease.SkyrimSE); armor.Disable(); Assert.True(EnumExt.HasFlag(armor.MajorRecordFlagsRaw, Constants.InitiallyDisabled)); }
public static void RunPatch(IPatcherState <ISkyrimMod, ISkyrimModGetter> state) { //Your code here! var keyword_IsAdultRace = FormKey.Factory("045AF7:ImCh.esm"); var keyword_IsChildRace = FormKey.Factory("005901:ImCh.esm"); foreach (var furnitureGetter in state.LoadOrder.PriorityOrder.Furniture().WinningOverrides()) { if (furnitureGetter.InteractionKeyword == Skyrim.Keyword.ActorTypeNPC && !furnitureGetter.MajorFlags.HasFlag(Furniture.MajorFlag.ChildCanUse)) { var furniture = state.PatchMod.Furniture.GetOrAddAsOverride(furnitureGetter); furniture.InteractionKeyword.SetTo(keyword_IsAdultRace); } } foreach (var raceGetter in state.LoadOrder.PriorityOrder.Race().WinningOverrides()) { if (raceGetter.Keywords != null && raceGetter.Keywords.Contains(Skyrim.Keyword.ActorTypeNPC)) { var race = state.PatchMod.Races.GetOrAddAsOverride(raceGetter); if (race.Flags.HasFlag(Race.Flag.Child)) { if (race.Keywords != null) { race.Flags -= Race.Flag.Child; race.Flags |= Race.Flag.AllowPickpocket; race.Keywords.Add(keyword_IsChildRace); } } else { if (race.Keywords != null) { race.Keywords.Add(keyword_IsAdultRace); } } } } }
public void Write( MutagenWriter writer, FormKey item, RecordType header, bool nullable = false) { try { using (HeaderExport.Header(writer, header, ObjectType.Subrecord)) { this.Write( writer, item); } } catch (Exception ex) { throw SubrecordException.Enrich(ex, header); } }
private void toolStripMenuItemTreeViewEdit_Click(object sender, EventArgs e) { Refresh(); Node treeListNode = treeList.SelectedNode; Type type = treeListNode.Tag.GetType(); if (type == typeof(Lookup)) { try { Interfaces.Events.SetCursor(Cursors.WaitCursor); this.Refresh(); FormLookup form = new FormLookup((Lookup)treeListNode.Tag); if (form.ShowDialog(ParentForm) == DialogResult.OK) { treeList.BeginUpdate(); treeListNode.Text = form.Lookup.Alias; treeListNode.Tag = form.Lookup; treeList.EndUpdate(); return; } } finally { Interfaces.Events.UnShadeMainForm(); Interfaces.Events.RaiseRefreshApplicationEvent(); Interfaces.Events.SetCursor(Cursors.Default); this.Refresh(); } } else if (type == typeof (Option)) { IOption option = (IOption) treeListNode.Tag; IUserOption userOption; object parentObject = treeListNode.Parent.Parent.Tag; Type parentType = parentObject.GetType(); Type scriptBaseInterface = typeof (IScriptBaseObject); if (scriptBaseInterface.IsInstanceOfType(parentObject)) { IScriptBaseObject parentScriptObject = (IScriptBaseObject) parentObject; for (int i = 0; i < parentScriptObject.Ex.Count; i++) { if (parentScriptObject.Ex[i].Name == option.VariableName) { userOption = parentScriptObject.Ex[i]; FormVirtualPropertyEdit form = new FormVirtualPropertyEdit(userOption, parentScriptObject); if (form.ShowDialog(ParentForm) == DialogResult.OK) { Interfaces.Events.UnShadeMainForm(); Interfaces.Events.RaiseRefreshApplicationEvent(); Interfaces.Events.SetCursor(Cursors.WaitCursor); treeList.BeginUpdate(); ProcessTreeValidity(treeList.Nodes); treeList.EndUpdate(); Interfaces.Events.SetCursor(Cursors.Default); } break; } } return; } if (parentType == typeof (Column)) { Column parentColumn = (Column) parentObject; for (int i = 0; i < parentColumn.Ex.Count; i++) { if (parentColumn.Ex[i].Name == option.VariableName) { userOption = parentColumn.Ex[i]; FormVirtualPropertyEdit form = new FormVirtualPropertyEdit(userOption, parentColumn); if (form.ShowDialog(ParentForm) == DialogResult.OK) { Interfaces.Events.UnShadeMainForm(); Interfaces.Events.RaiseRefreshApplicationEvent(); Interfaces.Events.SetCursor(Cursors.WaitCursor); treeList.BeginUpdate(); parentColumn.Ex[i].Value = form.VirtualProperty.Value; treeList.SelectedNode.Cells[1].Text = form.VirtualProperty.Value.ToString(); ProcessTreeValidity(treeList.Nodes); treeList.EndUpdate(); Interfaces.Events.SetCursor(Cursors.Default); } break; } } return; } } if (type == typeof (Association)) { frmAssociationWizard.Association = (Association) treeListNode.Tag; frmAssociationWizard form = new frmAssociationWizard(); if (form.ShowDialog(ParentForm) == DialogResult.OK) { Interfaces.Events.UnShadeMainForm(); Interfaces.Events.RaiseRefreshApplicationEvent(); Interfaces.Events.SetCursor(Cursors.WaitCursor); treeList.BeginUpdate(); treeListNode.Cells[1].Text = frmAssociationWizard.Association.Name; treeListNode.Tag = frmAssociationWizard.Association; SetNodeImage(treeListNode, Images.GreenBullet); foreach (Model.Database database in ProviderInfo.TheBllDatabase.Databases) { database.SnapshotMode = true; } ProcessTreeValidity(treeList.Nodes); treeList.EndUpdate(); foreach (Model.Database database in ProviderInfo.TheBllDatabase.Databases) { database.SnapshotMode = false; } Interfaces.Events.RaiseIsDirtyEvent(); Interfaces.Events.SetCursor(Cursors.Default); return; } return; } ScriptBase scriptBase = (ScriptBase) treeListNode.Tag; if (type == typeof (Table) || type == typeof (View) || type == typeof (StoredProcedure)) { FormScriptObject form = new FormScriptObject((ScriptObject) scriptBase, (ScriptObject[]) treeListNode.Parent.Tag); if (form.ShowDialog(ParentForm) == DialogResult.OK) { Interfaces.Events.UnShadeMainForm(); Interfaces.Events.RaiseRefreshApplicationEvent(); Interfaces.Events.SetCursor(Cursors.WaitCursor); treeList.BeginUpdate(); UpdateTreeListNodeText(treeListNode, form.ScriptObject); foreach (Model.Database database in ProviderInfo.TheBllDatabase.Databases) { database.SnapshotMode = true; } ProcessTreeValidity(treeList.Nodes); treeList.EndUpdate(); foreach (Model.Database database in ProviderInfo.TheBllDatabase.Databases) { database.SnapshotMode = false; } Interfaces.Events.SetCursor(Cursors.Default); return; } } else if (type == typeof (Column)) { FormColumn form = new FormColumn((Column) scriptBase); if (form.ShowDialog(ParentForm) == DialogResult.OK) { Interfaces.Events.UnShadeMainForm(); Interfaces.Events.RaiseRefreshApplicationEvent(); Interfaces.Events.SetCursor(Cursors.WaitCursor); treeList.BeginUpdate(); UpdateTreeListNodeText(treeListNode, form.Column); ProcessTreeValidity(treeList.Nodes); treeList.EndUpdate(); Interfaces.Events.SetCursor(Cursors.Default); return; } } else if (ModelTypes.MapColumn == type) { FormMapColumn form = new FormMapColumn((ScriptObject) treeListNode.Parent.Parent.Tag, (MapColumn) scriptBase); if (form.ShowDialog(ParentForm) == DialogResult.OK) { Interfaces.Events.UnShadeMainForm(); Interfaces.Events.RaiseRefreshApplicationEvent(); Interfaces.Events.SetCursor(Cursors.WaitCursor); treeList.BeginUpdate(); UpdateTreeListNodeText(treeListNode, form.MapColumn); ProcessTreeValidity(treeList.Nodes); treeList.EndUpdate(); Interfaces.Events.SetCursor(Cursors.Default); return; } } else if (type.BaseType == typeof (Relationship)) { FormRelationship form = new FormRelationship((Relationship) scriptBase, ProviderInfo.TheBllDatabase.AllScriptObjects); if (form.ShowDialog(ParentForm) == DialogResult.OK) { Interfaces.Events.UnShadeMainForm(); Interfaces.Events.RaiseRefreshApplicationEvent(); Interfaces.Events.SetCursor(Cursors.WaitCursor); treeList.BeginUpdate(); UpdateTreeListNodeText(treeListNode, form.PrimaryRelationship); ProcessTreeValidity(treeList.Nodes); treeList.EndUpdate(); Interfaces.Events.SetCursor(Cursors.Default); return; } } else if (type == typeof (Filter)) { Model.Database database = (Model.Database) treeListNode.Parent.Parent.Parent.Parent.Tag; Filter filter = (Filter) scriptBase; FormFilter2 form; // Stored Procedure Filters can only be created from other Stored Procedures (Enabled or Disabled) if (filter.Parent.GetType() == typeof (StoredProcedure)) { form = new FormFilter2(ParentForm, filter); } else { form = new FormFilter2(ParentForm, filter); } if (form.ShowDialog(ParentForm) == DialogResult.OK) { Interfaces.Events.UnShadeMainForm(); Interfaces.Events.RaiseRefreshApplicationEvent(); Interfaces.Events.SetCursor(Cursors.WaitCursor); treeList.BeginUpdate(); UpdateTreeListNodeText(treeListNode, form.TheFilter); ProcessTreeValidity(treeList.Nodes); treeList.EndUpdate(); Interfaces.Events.SetCursor(Cursors.Default); return; } } else if (type == typeof (Index)) { FormIndex form = new FormIndex((Index) scriptBase); if (form.ShowDialog(ParentForm) == DialogResult.OK) { Interfaces.Events.UnShadeMainForm(); Interfaces.Events.RaiseRefreshApplicationEvent(); Interfaces.Events.SetCursor(Cursors.WaitCursor); treeList.BeginUpdate(); UpdateTreeListNodeText(treeListNode, form.Index); ProcessTreeValidity(treeList.Nodes); treeList.EndUpdate(); Interfaces.Events.SetCursor(Cursors.Default); return; } } else if (type == typeof (Key)) { FormKey form = new FormKey((Key) scriptBase); if (form.ShowDialog(ParentForm) == DialogResult.OK) { Interfaces.Events.UnShadeMainForm(); Interfaces.Events.RaiseRefreshApplicationEvent(); Interfaces.Events.SetCursor(Cursors.WaitCursor); treeList.BeginUpdate(); UpdateTreeListNodeText(treeListNode, form.Key); ProcessTreeValidity(treeList.Nodes); treeList.EndUpdate(); Interfaces.Events.SetCursor(Cursors.Default); return; } } }
private void toolStripMenuItemTreeViewEdit_Click(object sender, EventArgs e) { TreeListNode treeListNode = treeList.FocusedNode; Type type = treeListNode.Tag.GetType(); if (type == typeof(Slyce.TemplateInfo.Option)) { Slyce.ITemplate.IOption option = (Slyce.ITemplate.IOption)treeListNode.Tag; Slyce.ITemplate.IUserOption userOption = null; object parentObject = treeListNode.ParentNode.ParentNode.Tag; Type parentType = parentObject.GetType(); if (parentType == typeof(ArchAngel.Providers.Database.Model.Table) || parentType == typeof(ArchAngel.Providers.Database.Model.View) || parentType == typeof(ArchAngel.Providers.Database.Model.StoredProcedure)) { ArchAngel.Providers.Database.Model.ScriptObject parentScriptObject = (ArchAngel.Providers.Database.Model.ScriptObject)parentObject; for (int i = 0; i < parentScriptObject.UserOptions.Count; i++) { if (parentScriptObject.UserOptions[i].Name == option.VariableName) { userOption = parentScriptObject.UserOptions[i]; FormObjectOptionEdit form = new FormObjectOptionEdit(option, userOption, parentScriptObject); if (form.ShowDialog(this.ParentForm) == DialogResult.OK) { Controller.MainForm.Cursor = Cursors.WaitCursor; parentScriptObject.UserOptions[i].Value = form.UserOption.Value; treeList.Selection[0].Tag = form.CurrentOption; treeList.Selection[0].SetValue(1, form.UserOption.Value); ProcessTreeValidity(treeList.Nodes); Controller.MainForm.Cursor = Cursors.Default; } //((ArchAngel.Providers.Database.Model.ScriptObject)treeList.Selection[0].ParentNode.ParentNode.Tag).UserOptions[i].Value = Convert.ChangeType(form.CurrentOption.DefaultValue, form.CurrentOption.VarType); //parentScriptObject.UserOptions[i].Value = Convert.ChangeType(form.CurrentOption.DefaultValue, form.CurrentOption.VarType); break; } } return; } else if (parentType == typeof(ArchAngel.Providers.Database.Model.Column)) { ArchAngel.Providers.Database.Model.Column parentColumn = (ArchAngel.Providers.Database.Model.Column)parentObject; for (int i = 0; i < parentColumn.UserOptions.Count; i++) { if (parentColumn.UserOptions[i].Name == option.VariableName) { userOption = parentColumn.UserOptions[i]; FormObjectOptionEdit form = new FormObjectOptionEdit(option, userOption, parentColumn); if (form.ShowDialog(this.ParentForm) == DialogResult.OK) { Controller.MainForm.Cursor = Cursors.WaitCursor; parentColumn.UserOptions[i].Value = form.UserOption.Value; treeList.Selection[0].Tag = form.CurrentOption; treeList.Selection[0].SetValue(1, form.UserOption.Value); ProcessTreeValidity(treeList.Nodes); Controller.MainForm.Cursor = Cursors.Default; } break; } } return; } } ScriptBase scriptBase = (ScriptBase)treeListNode.Tag; if (type == typeof(ArchAngel.Providers.Database.Model.Table) || type == typeof(ArchAngel.Providers.Database.Model.View) || type == typeof(ArchAngel.Providers.Database.Model.StoredProcedure)) { FormScriptObject form = new FormScriptObject((ScriptObject)scriptBase, (ScriptObject[])treeListNode.ParentNode.Tag); if (form.ShowDialog(this.ParentForm) == DialogResult.OK) { Controller.MainForm.Cursor = Cursors.WaitCursor; UpdateTreeListNodeText(treeListNode, form.ScriptObject); //TreeListHelper.TreeListNodeValidate(treeListNode); foreach (ArchAngel.Providers.Database.Model.Database database in Controller.Instance.BllDatabase.Databases) { database.SnapshotMode = true; } treeList.BeginUpdate(); //ValidateNode(treeListNode); ProcessTreeValidity(treeList.Nodes); treeList.EndUpdate(); foreach (ArchAngel.Providers.Database.Model.Database database in Controller.Instance.BllDatabase.Databases) { database.SnapshotMode = false; } Controller.MainForm.Cursor = Cursors.Default; return; } } else if (type == typeof(Column)) { FormColumn form = new FormColumn((Column)scriptBase); if (form.ShowDialog(this.ParentForm) == DialogResult.OK) { Controller.MainForm.Cursor = Cursors.WaitCursor; UpdateTreeListNodeText(treeListNode, form.Column); //TreeListHelper.TreeListNodeValidate(treeListNode.ParentNode); ProcessTreeValidity(treeList.Nodes); Controller.MainForm.Cursor = Cursors.Default; return; } } else if (type == typeof(MapColumn)) { FormMapColumn form = new FormMapColumn((ScriptObject)treeListNode.ParentNode.ParentNode.Tag, (MapColumn)scriptBase); if (form.ShowDialog(this.ParentForm) == DialogResult.OK) { Controller.MainForm.Cursor = Cursors.WaitCursor; MapColumn mapColumn = (MapColumn)scriptBase; UpdateTreeListNodeText(treeListNode, form.MapColumn); //TreeListHelper.TreeListNodeValidate(treeListNode.ParentNode); ProcessTreeValidity(treeList.Nodes); Controller.MainForm.Cursor = Cursors.Default; return; } } else if (type.BaseType == typeof(Relationship)) { ArchAngel.Providers.Database.Model.Database database = (ArchAngel.Providers.Database.Model.Database)treeListNode.ParentNode.ParentNode.ParentNode.ParentNode.ParentNode.Tag; FormRelationship form = new FormRelationship((Relationship)scriptBase, Controller.Instance.BllDatabase.ScriptObjects); if (form.ShowDialog(this.ParentForm) == DialogResult.OK) { Controller.MainForm.Cursor = Cursors.WaitCursor; UpdateTreeListNodeText(treeListNode, form.PrimaryRelationship); //TreeListHelper.TreeListNodeValidate(treeListNode.ParentNode.ParentNode); ProcessTreeValidity(treeList.Nodes); Controller.MainForm.Cursor = Cursors.Default; return; } } else if (type == typeof(Filter)) { ArchAngel.Providers.Database.Model.Database database = (ArchAngel.Providers.Database.Model.Database)treeListNode.ParentNode.ParentNode.ParentNode.ParentNode.Tag; Filter filter = (Filter)scriptBase; FormFilter2 form; // Stored Procedure Filters can only be created from other Stored Procedures (Enabled or Disabled) if (filter.Parent.GetType() == typeof(ArchAngel.Providers.Database.Model.StoredProcedure)) { form = new FormFilter2(this.ParentForm, filter, database.StoredProcedures); } else { form = new FormFilter2(this.ParentForm, filter, database.EnabledScriptObjects); } if (form.ShowDialog(this.ParentForm) == DialogResult.OK) { Controller.MainForm.Cursor = Cursors.WaitCursor; UpdateTreeListNodeText(treeListNode, form.Filter); //TreeListHelper.TreeListNodeValidate(treeListNode.ParentNode); ProcessTreeValidity(treeList.Nodes); Controller.MainForm.Cursor = Cursors.Default; return; } } else if (type == typeof(Index)) { FormIndex form = new FormIndex((Index)scriptBase); if (form.ShowDialog(this.ParentForm) == DialogResult.OK) { Controller.MainForm.Cursor = Cursors.WaitCursor; UpdateTreeListNodeText(treeListNode, form.Index); //TreeListHelper.TreeListNodeValidate(treeListNode.ParentNode); ProcessTreeValidity(treeList.Nodes); Controller.MainForm.Cursor = Cursors.Default; return; } } else if (type == typeof(Key)) { FormKey form = new FormKey((Key)scriptBase); if (form.ShowDialog(this.ParentForm) == DialogResult.OK) { Controller.MainForm.Cursor = Cursors.WaitCursor; UpdateTreeListNodeText(treeListNode, form.Key); //TreeListHelper.TreeListNodeValidate(treeListNode.ParentNode); ProcessTreeValidity(treeList.Nodes); Controller.MainForm.Cursor = Cursors.Default; return; } } }
private void toolStripMenuItemTreeViewAdd_Click(object sender, EventArgs e) { treeList.InvalidateNodes(); treeList.BeginUpdate(); TreeListNode treeListNode = treeList.FocusedNode; Type type = treeListNode.Tag.GetType(); if (type == typeof(ArchAngel.Providers.Database.Model.Table[]) || type == typeof(ArchAngel.Providers.Database.Model.View[]) || type == typeof(ArchAngel.Providers.Database.Model.StoredProcedure[])) { ArchAngel.Providers.Database.Model.Database parent = (ArchAngel.Providers.Database.Model.Database)treeListNode.ParentNode.Tag; FormScriptObject form = new FormScriptObject((ScriptObject[])treeListNode.Tag, parent); if (form.ShowDialog(this.ParentForm) == DialogResult.OK) { Controller.MainForm.Cursor = Cursors.WaitCursor; parent.AddScriptObject(form.ScriptObject); TreeListNode newTreeListNode = treeList.AppendNode(GetTreeListNodeText(form.ScriptObject), treeListNode); newTreeListNode.Tag = form.ScriptObject; newTreeListNode.ImageIndex = newTreeListNode.SelectImageIndex = (int)Images.GreenBullet; SetupNewTreeListNode(newTreeListNode, form.ScriptObject); if (type == typeof(ArchAngel.Providers.Database.Model.Table[])) { treeListNode.Tag = parent.Tables; } if (type == typeof(ArchAngel.Providers.Database.Model.View[])) { treeListNode.Tag = parent.Views; } if (type == typeof(ArchAngel.Providers.Database.Model.StoredProcedure[])) { treeListNode.Tag = parent.StoredProcedures; } //TreeListHelper.TreeListNodeValidate(newTreeListNode); ProcessTreeValidity(treeList.Nodes); Controller.MainForm.Cursor = Cursors.Default; } } else if (type == typeof(Column[])) { ScriptObject parent = (ScriptObject)treeListNode.ParentNode.Tag; FormColumn form = new FormColumn(parent); if (form.ShowDialog(this.ParentForm) == DialogResult.OK) { Controller.MainForm.Cursor = Cursors.WaitCursor; parent.AddColumn(form.Column); TreeListNode newTreeListNode = treeList.AppendNode(GetTreeListNodeText(form.Column), treeListNode); newTreeListNode.Tag = form.Column; newTreeListNode.ImageIndex = newTreeListNode.SelectImageIndex = (int)Images.GreenBullet; treeListNode.Tag = parent.Columns; //TreeListHelper.TreeListNodeValidate(treeListNode.ParentNode); ProcessTreeValidity(treeList.Nodes); Controller.MainForm.Cursor = Cursors.Default; } } else if (type == typeof(OneToOneRelationship[]) || type == typeof(OneToManyRelationship[]) || type == typeof(ManyToOneRelationship[]) || type == typeof(ManyToManyRelationship[])) { ScriptObject parent = (ScriptObject)treeListNode.ParentNode.ParentNode.Tag; Type relationshipType = null; if (type == typeof(OneToOneRelationship[])) { relationshipType = typeof(OneToOneRelationship); } if (type == typeof(ManyToOneRelationship[])) { relationshipType = typeof(ManyToOneRelationship); } if (type == typeof(OneToManyRelationship[])) { relationshipType = typeof(OneToManyRelationship); } if (type == typeof(ManyToManyRelationship[])) { relationshipType = typeof(ManyToManyRelationship); } ArchAngel.Providers.Database.Model.Database database = (ArchAngel.Providers.Database.Model.Database)treeListNode.ParentNode.ParentNode.ParentNode.ParentNode.Tag; FormRelationship form = new FormRelationship(relationshipType, (ScriptObject)treeListNode.ParentNode.ParentNode.Tag, Controller.Instance.BllDatabase.EnabledScriptObjects); if (form.ShowDialog(this.ParentForm) == DialogResult.OK) { Controller.MainForm.Cursor = Cursors.WaitCursor; ScriptObject primaryScriptObject = form.PrimaryRelationship.Parent; primaryScriptObject.AddRelationship(form.PrimaryRelationship); ScriptObject foreignScriptObject = form.ForeignRelationship.Parent; foreignScriptObject.AddRelationship(form.ForeignRelationship); TreeListNode newTreeListNode = treeList.AppendNode(GetTreeListNodeText(form.PrimaryRelationship), treeListNode); newTreeListNode.Tag = form.PrimaryRelationship; newTreeListNode.ImageIndex = newTreeListNode.SelectImageIndex = (int)Images.GreenBullet; if (type == typeof(OneToOneRelationship[])) { treeListNode.Tag = parent.OneToOneRelationships; } if (type == typeof(ManyToOneRelationship[])) { treeListNode.Tag = parent.ManyToOneRelationships; } if (type == typeof(OneToManyRelationship[])) { treeListNode.Tag = parent.OneToManyRelationships; } if (type == typeof(ManyToManyRelationship[])) { treeListNode.Tag = parent.ManyToManyRelationships; } LoadTreeListNode(foreignScriptObject); //TreeListHelper.TreeListNodeValidate(treeListNode.ParentNode.ParentNode); ProcessTreeValidity(treeList.Nodes); Controller.MainForm.Cursor = Cursors.Default; } } else if (type == typeof(Filter[])) { ArchAngel.Providers.Database.Model.Database database = (ArchAngel.Providers.Database.Model.Database)treeListNode.ParentNode.ParentNode.ParentNode.Tag; ScriptObject parent = (ScriptObject)treeListNode.ParentNode.Tag; FormFilter2 form; // Stored Procedure Filters can only be created from other Stored Procedures (Enabled or Disabled) if (parent.GetType() == typeof(ArchAngel.Providers.Database.Model.StoredProcedure)) { form = new FormFilter2(this.ParentForm, parent, database.StoredProcedures); } else { form = new FormFilter2(this.ParentForm, parent, database.EnabledScriptObjects); } if (form.ShowDialog(this.ParentForm) == DialogResult.OK) { Controller.MainForm.Cursor = Cursors.WaitCursor; parent.AddFilter(form.Filter); TreeListNode newTreeListNode = treeList.AppendNode(GetTreeListNodeText(form.Filter), treeListNode); newTreeListNode.Tag = form.Filter; newTreeListNode.ImageIndex = newTreeListNode.SelectImageIndex = (int)Images.GreenBullet; treeListNode.Tag = parent.Filters; //TreeListHelper.TreeListNodeValidate(treeListNode.ParentNode); ProcessTreeValidity(treeList.Nodes); Controller.MainForm.Cursor = Cursors.Default; } } else if (type == typeof(Index[])) { ArchAngel.Providers.Database.Model.Table parent = (ArchAngel.Providers.Database.Model.Table)treeListNode.ParentNode.Tag; FormIndex form = new FormIndex((ArchAngel.Providers.Database.Model.Table)treeListNode.ParentNode.Tag); if (form.ShowDialog(this.ParentForm) == DialogResult.OK) { Controller.MainForm.Cursor = Cursors.WaitCursor; parent.AddIndex(form.Index); TreeListNode newTreeListNode = treeList.AppendNode(GetTreeListNodeText(form.Index), treeListNode); newTreeListNode.Tag = form.Index; newTreeListNode.ImageIndex = newTreeListNode.SelectImageIndex = (int)Images.GreenBullet; treeListNode.Tag = parent.Indexes; //TreeListHelper.TreeListNodeValidate(treeListNode.ParentNode); ProcessTreeValidity(treeList.Nodes); Controller.MainForm.Cursor = Cursors.Default; } } else if (type == typeof(Key[])) { ArchAngel.Providers.Database.Model.Table parent = (ArchAngel.Providers.Database.Model.Table)treeListNode.ParentNode.Tag; FormKey form = new FormKey((ArchAngel.Providers.Database.Model.Table)treeListNode.ParentNode.Tag); if (form.ShowDialog(this.ParentForm) == DialogResult.OK) { Controller.MainForm.Cursor = Cursors.WaitCursor; parent.AddKey(form.Key); TreeListNode newTreeListNode = treeList.AppendNode(GetTreeListNodeText(form.Key), treeListNode); newTreeListNode.Tag = form.Key; newTreeListNode.ImageIndex = newTreeListNode.SelectImageIndex = (int)Images.GreenBullet; treeListNode.Tag = parent.Keys; //TreeListHelper.TreeListNodeValidate(treeListNode.ParentNode); ProcessTreeValidity(treeList.Nodes); Controller.MainForm.Cursor = Cursors.Default; } } treeList.EndUpdate(); }
private void toolStripMenuItemTreeViewAdd_Click(object sender, EventArgs e) { Refresh(); treeList.BeginUpdate(); Node treeListNode = treeList.SelectedNode; Type type = treeListNode.Tag.GetType(); if (type == typeof (Table[]) || type == typeof (View[]) || type == typeof (StoredProcedure[])) { Model.Database parent = (Model.Database) treeListNode.Parent.Tag; FormScriptObject form = new FormScriptObject((ScriptObject[]) treeListNode.Tag, parent); if (form.ShowDialog(ParentForm) == DialogResult.OK) { Interfaces.Events.SetCursor(Cursors.WaitCursor); parent.AddScriptObject(form.ScriptObject); Node newTreeListNode = AddNode(treeListNode, "", form.ScriptObject, Images.GreenBullet, true, form.ScriptObject.Enabled); GetTreeListNodeText(form.ScriptObject, newTreeListNode); SetupNewTreeListNode(newTreeListNode, form.ScriptObject); if (type == typeof (Table[])) { treeListNode.Tag = parent.Tables; } if (type == typeof (View[])) { treeListNode.Tag = parent.Views; } if (type == typeof (StoredProcedure[])) { treeListNode.Tag = parent.StoredProcedures; } ProcessTreeValidity(treeList.Nodes); Interfaces.Events.SetCursor(Cursors.Default); } } else if (type == typeof (Column[])) { ScriptObject parent = (ScriptObject) treeListNode.Parent.Tag; FormColumn form = new FormColumn(parent); if (form.ShowDialog(ParentForm) == DialogResult.OK) { Interfaces.Events.SetCursor(Cursors.WaitCursor); parent.AddColumn(form.Column); Node newTreeListNode = AddNode(treeListNode, "", form.Column, Images.GreenBullet, true, form.Column.Enabled); GetTreeListNodeText(form.Column, newTreeListNode); treeListNode.Tag = parent.Columns; ProcessTreeValidity(treeList.Nodes); Interfaces.Events.SetCursor(Cursors.Default); } } else if (type == typeof(Lookup[])) { Model.Database database = (Model.Database)treeListNode.Parent.Tag; FormLookup form = new FormLookup(database); if (form.ShowDialog(ParentForm) == DialogResult.OK) { Interfaces.Events.SetCursor(Cursors.WaitCursor); Node newTreeListNode = AddLookupNode(treeListNode, form.Lookup, Images.GreenBullet); treeListNode.Tag = database.Lookups; Interfaces.Events.SetCursor(Cursors.Default); treeList.SelectNode(newTreeListNode, eTreeAction.Code); } } else if (type == typeof (OneToOneRelationship[]) || type == typeof (OneToManyRelationship[]) || type == typeof (ManyToOneRelationship[]) || type == typeof (ManyToManyRelationship[])) { ScriptObject parent = (ScriptObject) treeListNode.Parent.Parent.Tag; Type relationshipType = null; if (type == typeof (OneToOneRelationship[])) { relationshipType = typeof (OneToOneRelationship); } if (type == typeof (ManyToOneRelationship[])) { relationshipType = typeof (ManyToOneRelationship); } if (type == typeof (OneToManyRelationship[])) { relationshipType = typeof (OneToManyRelationship); } if (type == typeof (ManyToManyRelationship[])) { relationshipType = typeof (ManyToManyRelationship); } FormRelationship form = new FormRelationship(relationshipType, (ScriptObject) treeListNode.Parent.Parent.Tag, ProviderInfo.TheBllDatabase.EnabledScriptObjects); if (form.ShowDialog(ParentForm) == DialogResult.OK) { Interfaces.Events.SetCursor(Cursors.WaitCursor); ScriptObject primaryScriptObject = form.PrimaryRelationship.Parent; primaryScriptObject.AddRelationship(form.PrimaryRelationship); ScriptObject foreignScriptObject = form.ForeignRelationship.Parent; foreignScriptObject.AddRelationship(form.ForeignRelationship); Node newTreeListNode = AddNode(treeListNode, "", form.PrimaryRelationship, Images.GreenBullet, true, form.PrimaryRelationship.Enabled); GetTreeListNodeText(form.PrimaryRelationship, newTreeListNode); if (type == typeof (OneToOneRelationship[])) { treeListNode.Tag = parent.OneToOneRelationships; } if (type == typeof (ManyToOneRelationship[])) { treeListNode.Tag = parent.ManyToOneRelationships; } if (type == typeof (OneToManyRelationship[])) { treeListNode.Tag = parent.OneToManyRelationships; } if (type == typeof (ManyToManyRelationship[])) { treeListNode.Tag = parent.ManyToManyRelationships; } LoadTreeListNode(foreignScriptObject); ProcessTreeValidity(treeList.Nodes); Interfaces.Events.SetCursor(Cursors.Default); } if (form.FilterWasCreated) { LoadTreeView(); } } else if (type == typeof (Filter[])) { Model.Database database = (Model.Database) treeListNode.Parent.Parent.Parent.Tag; ScriptObject parent = (ScriptObject) treeListNode.Parent.Tag; FormFilter2 form; // Stored Procedure Filters can only be created from other Stored Procedures (Enabled or Disabled) if (parent.GetType() == typeof (StoredProcedure)) { form = new FormFilter2(ParentForm, parent); } else { form = new FormFilter2(ParentForm, parent); } if (form.ShowDialog(ParentForm) == DialogResult.OK) { Interfaces.Events.SetCursor(Cursors.WaitCursor); parent.AddFilter(form.TheFilter); Node newTreeListNode = AddNode(treeListNode, "", form.TheFilter, Images.GreenBullet, true, form.TheFilter.Enabled); GetTreeListNodeText(form.TheFilter, newTreeListNode); treeListNode.Tag = parent.Filters; ProcessTreeValidity(treeList.Nodes); Interfaces.Events.SetCursor(Cursors.Default); } } else if (type == typeof (Index[])) { Table parent = (Table) treeListNode.Parent.Tag; FormIndex form = new FormIndex((Table) treeListNode.Parent.Tag); if (form.ShowDialog(ParentForm) == DialogResult.OK) { Interfaces.Events.SetCursor(Cursors.WaitCursor); parent.AddIndex(form.Index); Node newTreeListNode = AddNode(treeListNode, "", form.Index, Images.GreenBullet, true, form.Index.Enabled); GetTreeListNodeText(form.Index, newTreeListNode); treeListNode.Tag = parent.Indexes; ProcessTreeValidity(treeList.Nodes); Interfaces.Events.SetCursor(Cursors.Default); } } else if (type == typeof (Key[])) { Table parent = (Table) treeListNode.Parent.Tag; FormKey form = new FormKey((Table) treeListNode.Parent.Tag); if (form.ShowDialog(ParentForm) == DialogResult.OK) { Interfaces.Events.SetCursor(Cursors.WaitCursor); parent.AddKey(form.Key); Node newTreeListNode = AddNode(treeListNode, "", form.Key, Images.GreenBullet, true, form.Key.Enabled); GetTreeListNodeText(form.Key, newTreeListNode); treeListNode.Tag = parent.Keys; ProcessTreeValidity(treeList.Nodes); Interfaces.Events.SetCursor(Cursors.Default); } } else if (type == typeof (List<Association>)) { ScriptObject parent = (ScriptObject) treeListNode.Parent.Tag; frmAssociationWizard.Association = new Association((ScriptObject) treeListNode.Parent.Tag); frmAssociationWizard.Association.Enabled = true; frmAssociationWizard form = new frmAssociationWizard(); if (form.ShowDialog(ParentForm) == DialogResult.OK) { Interfaces.Events.SetCursor(Cursors.WaitCursor); parent.AddAssociation(frmAssociationWizard.Association); Node newTreeListNode = AddNode(treeListNode, frmAssociationWizard.Association.Name, frmAssociationWizard.Association, Images.GreenBullet, true, frmAssociationWizard.Association.Enabled); treeListNode.Tag = parent.Associations; ProcessTreeValidity(treeList.Nodes); Interfaces.Events.SetCursor(Cursors.Default); treeListNode.Expanded = true; treeList.SelectedNode = newTreeListNode; } } treeList.EndUpdate(); }