Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
PropertyViewModel.cs
Go to the documentation of this file.
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 using System.Reflection;
6 using System.Configuration;
7 using System.Xml;
8 
9 using SiliconStudio.Presentation.ViewModel;
10 
11 namespace SiliconStudio.Paradox.ConfigEditor.ViewModels
12 {
14  {
15  public SectionViewModel Parent { get; private set; }
16  public PropertyInfo Property { get; private set; }
17  public ConfigurationPropertyAttribute Attribute { get; private set; }
18 
19  public PropertyViewModel(SectionViewModel parent, PropertyInfo property, ConfigurationPropertyAttribute attribute)
20  {
21  if (parent == null)
22  throw new ArgumentNullException("parent");
23  if (property == null)
24  throw new ArgumentNullException("property");
25  if (attribute == null)
26  throw new ArgumentNullException("attribute");
27 
28  Parent = parent;
29 
30  Property = property;
31  Attribute = attribute;
32 
33  DefaultValue = Attribute.DefaultValue;
34  Value = DefaultValue;
35  }
36 
37  private bool isUsed;
38  public bool IsUsed
39  {
40  get { return isUsed; }
41  set { SetValue(ref isUsed, value, "IsUsed"); }
42  }
43 
44  public string PropertyName { get { return Property.Name; } }
45  public string PropertyTypeName { get { return Property.PropertyType.FullName; } }
46 
47  public object DefaultValue { get; private set; }
48 
49  private object value;
50  public object Value
51  {
52  get { return value; }
53  set { SetValue(ref this.value, value, "Value"); }
54  }
55 
56  public bool IsRequired { get { return Attribute.IsRequired; } }
57  }
58 }
This abstract class represents a basic view model, implementing INotifyPropertyChanging and INotifyPr...
PropertyViewModel(SectionViewModel parent, PropertyInfo property, ConfigurationPropertyAttribute attribute)