示例#1
0
        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);
                }
            }
        }
示例#2
0
        static void Main(string[] args)
        {
            string[] names = new[] { "Hanna", "Trudy", "Steve" };
            //NamePrintingHelper.Printer(names);
            Console.WriteLine(NameFormatting.GetShortName("John", "Doe"));

            Console.ReadLine();
        }
示例#3
0
        public ClothingItemViewModel(T id)
        {
            Id          = id ?? throw new ArgumentNullException(nameof(id));
            DisplayName = NameFormatting.FormatClosingItemName(id?.ToString() ?? "");

            // TODO
            EffectRoot.PropertyChanged += EffectRoot_PropertyChanged;

            AddEffectCommand = ReactiveCommand.Create(() =>
            {
            });
        }
示例#4
0
 public string GetShortName()
 {
     return(NameFormatting.GetShortName(Name, Surname));
 }