private static List <MaterialParameterViewModel> GetNameSection(Material material) { var titleSection = new List <MaterialParameterViewModel>(); var titleField = new MaterialParameterViewModel <string>(ParameterType.Name) { Value = material.Name }; titleField.PropertyChanged += (sender, e) => material.Name = titleField.Value; titleSection.Add(titleField); return(titleSection); }
private static List <MaterialParameterViewModel> GetPlotColorSection(Material material) { var plotColorSection = new List <MaterialParameterViewModel>(); var plotColorField = new MaterialParameterViewModel <Color>(ParameterType.PlotColor) { Value = material.FillColor }; plotColorField.PropertyChanged += (sender, e) => material.FillColor = plotColorField.Value; plotColorSection.Add(plotColorField); return(plotColorSection); }
private static List <MaterialParameterViewModel> GetNotesSection(Material material) { var notesSection = new List <MaterialParameterViewModel>(); var notesField = new MaterialParameterViewModel <string>(ParameterType.Notes) { Value = material.Notes }; notesField.PropertyChanged += (sender, e) => material.Notes = notesField.Value; notesSection.Add(notesField); return(notesSection); }
private static List <MaterialParameterViewModel> GetSemiconductorParameterSection(Semiconductor material) { var semiconductorSection = new List <MaterialParameterViewModel>(); var bgField = new MaterialParameterViewModel <string>(ParameterType.SemiconductorBandGap) { Value = material.BandGap?.Expression }; bgField.PropertyChanged += (sender, e) => { if (e.PropertyName != "Value") { return; } material.BandGap = new MathExpression <Energy>(bgField.Value); }; semiconductorSection.Add(bgField); var eaField = new NumericMaterialParameterViewModel(ParameterType.ElectronAffinity) { Minimum = 0, Maximum = 5, StepSize = 0.05, Value = material.ElectronAffinity?.ElectronVolts ?? 0.0 }; eaField.PropertyChanged += (sender, e) => { if (e.PropertyName != "Value") { return; } material.ElectronAffinity = Energy.FromElectronVolts(eaField.Value); }; semiconductorSection.Add(eaField); var dcField = new NumericMaterialParameterViewModel(ParameterType.DielectricConstant) { Minimum = 0, Maximum = 30, StepSize = 1, Value = material.DielectricConstant }; dcField.PropertyChanged += (sender, e) => { if (e.PropertyName != "Value") { return; } material.DielectricConstant = dcField.Value; }; semiconductorSection.Add(dcField); var iccField = new MaterialParameterViewModel <string>(ParameterType.IntrinsicCarrierConcentration) { Value = material.IntrinsicCarrierConcentration?.Expression }; iccField.PropertyChanged += (sender, e) => { if (e.PropertyName != "Value") { return; } material.IntrinsicCarrierConcentration = new MathExpression <Concentration>(iccField.Value); }; semiconductorSection.Add(iccField); var dtField = new MaterialParameterViewModel <DopingType>(ParameterType.DopingType) { Value = material.DopingType }; dtField.PropertyChanged += (sender, e) => { if (e.PropertyName != "Value") { return; } material.DopingType = dtField.Value; }; semiconductorSection.Add(dtField); var dopCField = new MaterialParameterViewModel <string>(ParameterType.DopantConcentration) { Value = material.DopantConcentration?.Expression }; dopCField.PropertyChanged += (sender, e) => { if (e.PropertyName != "Value") { return; } material.DopantConcentration = new MathExpression <Concentration>(dopCField.Value); }; semiconductorSection.Add(dopCField); var tempField = new NumericMaterialParameterViewModel(ParameterType.Temperature) { Minimum = 100.0, Maximum = 500.0, StepSize = 25.0, Value = material.Temperature?.Kelvin ?? 0.0 }; tempField.PropertyChanged += (sender, e) => { if (e.PropertyName != "Value") { return; } material.Temperature = new Temperature(tempField.Value); }; semiconductorSection.Add(tempField); return(semiconductorSection); }