Exemple #1
0
    public void Initialize(BXCustomField currentField, BXCustomProperty currentValue)
    {
        field = currentField;
        value = currentValue;

		if (field == null)
			return;

		BXParamsBag<object> settings = new BXParamsBag<object>(field.Settings);

		MultiView1.ActiveViewIndex = settings.ContainsKey("view") ? (int)settings["view"] : 0;

		//BIND VALUE
		if (value != null)
		{
			if (value.Value != null && value.Value is bool)
			{
				bool flag = (bool)value.Value;
				chValue.Checked = flag;
				ddValue.SelectedIndex = flag ? 0 : 1;
				No.Checked = !flag;
				Yes.Checked = flag;

				return; //Skip default setup
			}
		}

		//BIND DEFAULT
		int defVal;
		if(settings.TryGetInt("default", out defVal))
			switch (defVal)
			{
				case 0: //True
					chValue.Checked = true;
					ddValue.SelectedIndex = 0;
					Yes.Checked = true;
					break;
				case 1: //False
					chValue.Checked = false;
					ddValue.SelectedIndex = 1;
					No.Checked = true;
					break;
			}
    }