public ComponentTemplateAbilitySD CreateSD() { ComponentTemplateAbilitySD sd = new ComponentTemplateAbilitySD(); sd.Name = Name; sd.Description = Description; sd.AbilityDataBlobType = AbilityDataBlobType; sd.GuiHint = SelectedGuiHint.GetKey(); sd.AbilityFormula = AbilityFormula; sd.MinFormula = MinFormula; sd.MaxFormula = MaxFormula; sd.StepFormula = StepFormula; if (GuidDict != null) { Dictionary <object, string> guidict = new Dictionary <object, string>(); foreach (var item in GuidDict.SelectedItems) { guidict.Add(item.Key, item.Value); } sd.GuidDictionary = guidict; } if (ItemDict != null) { Dictionary <object, string> guidict = new Dictionary <object, string>(); foreach (var item in ItemDict) { if (item.Items.SelectedIndex >= 0 && !string.IsNullOrWhiteSpace(item.Formula)) { guidict.Add(item.Items.SelectedKey, item.Formula); } } sd.GuidDictionary = guidict; } return(sd); }
/// <summary> /// Constructor for filled /// </summary> /// <param name="parent"></param> /// <param name="abilitySD"></param> /// <param name="parentList"></param> /// <param name="staticData"></param> public ComponentAbilityTemplateVM(ComponentTemplateParentVM parent, ComponentTemplateAbilitySD abilitySD, ObservableCollection <ComponentAbilityTemplateVM> parentList, StaticDataStore staticData) : this(parent, parentList, staticData) { Name = abilitySD.Name; Description = abilitySD.Description; SelectedGuiHint.SelectedIndex = (int)abilitySD.GuiHint; if (abilitySD.AbilityDataBlobType != null) { AbilityDataBlobType = abilitySD.AbilityDataBlobType; } AbilityFormula = abilitySD.AbilityFormula; MinFormula = abilitySD.MinFormula; MaxFormula = abilitySD.MaxFormula; StepFormula = abilitySD.StepFormula; //GuidDictionary = abilitySD.GuidDictionary; DictionaryVM <Guid, string> techSelected = new DictionaryVM <Guid, string>(); if (abilitySD.GuiHint == GuiHint.GuiTechSelectionList) { foreach (var item in abilitySD.GuidDictionary) { techSelected.Add(Guid.Parse(item.Key.ToString()), _staticData.Techs[Guid.Parse(item.Key.ToString())].Name); } GuidDict = new TechListVM(techSelected, _staticData); } }