public void SetDesignSD(ComponentTemplateSD designSD) { Name = designSD.Name; Description = designSD.Description; _ID = designSD.ID; MassFormula = designSD.MassFormula; VolumeFormula = designSD.VolumeFormula; HTKFormula = designSD.HTKFormula; CrewReqFormula = designSD.CrewReqFormula; MineralCostFormula.Clear(); foreach (var item in designSD.ResourceCostFormula) { MineralCostFormula.Add(new MineralFormulaVM(ParentVM, _staticData, item)); } MineralCostFormula.Add(new MineralFormulaVM(ParentVM, _staticData)); ResearchCostFormula = designSD.ResearchCostFormula; CreditCostFormula = designSD.CreditCostFormula; BuildPointCostFormula = designSD.BuildPointCostFormula; foreach (object value in Enum.GetValues(typeof(ComponentMountType))) { var currentValue = (ComponentMountType)value; if ((currentValue & designSD.MountType) != 0) { MountType[currentValue] = true; } } }
private void ComponentTemplateVM_PropertyChanged(object sender, PropertyChangedEventArgs e) { if (MineralCostFormula.Last().Minerals.SelectedIndex >= 0 && MineralCostFormula[0].Minerals.SelectedIndex >= 0) { MineralCostFormula.Add(new MineralFormulaVM(ParentVM, _staticData)); MineralCostFormula.Last().PropertyChanged += ComponentTemplateVM_PropertyChanged; } }
public void ClearSelection() { Name = ""; Description = ""; _ID = Guid.NewGuid(); MassFormula = ""; VolumeFormula = ""; HTKFormula = ""; CrewReqFormula = ""; MineralCostFormula.Clear(); MineralCostFormula.Add(new MineralFormulaVM(ParentVM, _staticData)); MineralCostFormula.Last().PropertyChanged += ComponentTemplateVM_PropertyChanged; ResearchCostFormula = ""; CreditCostFormula = ""; BuildPointCostFormula = ""; //MountType.Clear();// = new ObservableDictionary<ComponentMountType, bool?>(); foreach (var item in MountType.ToArray()) { MountType[item.Key] = false; } }