public EffectViewModel(IEffect model) { Model = model ?? throw new ArgumentNullException(nameof(model)); DisplayName = NameFormatting.FormatEffectDisplayName(model.GetType().Name); if (Model is ICustomizableEffect customEffect) { var paramObject = customEffect.ParameterObject; foreach (var prop in paramObject.GetType().GetProperties()) { var value = prop.GetValue(paramObject); EffectParameterViewModel paramVm; if (prop.PropertyType == typeof(IEffect)) { paramVm = new NestedEffectParameterViewModel(prop.Name, prop.PropertyType, null, value); } else { paramVm = new EffectParameterViewModel(prop.Name, prop.PropertyType, null, value); } paramVm.PropertyChanged += ParamVm_PropertyChanged; Parameters.Add(paramVm); } } }
static void Main(string[] args) { string[] names = new[] { "Hanna", "Trudy", "Steve" }; //NamePrintingHelper.Printer(names); Console.WriteLine(NameFormatting.GetShortName("John", "Doe")); Console.ReadLine(); }
public ClothingItemViewModel(T id) { Id = id ?? throw new ArgumentNullException(nameof(id)); DisplayName = NameFormatting.FormatClosingItemName(id?.ToString() ?? ""); // TODO EffectRoot.PropertyChanged += EffectRoot_PropertyChanged; AddEffectCommand = ReactiveCommand.Create(() => { }); }
public string GetShortName() { return(NameFormatting.GetShortName(Name, Surname)); }