protected override void OnAttached() { mDropdown = mBlock.GetField("PROPERTY") as FieldDropdown; if (mDropdown == null) { throw new Exception("FieldDropDown \"PROPERTY\" not found."); } UpdateInternal(mDropdown.GetValue().Equals(DIVISIBLE_BY)); //register observer mObserver = new MemorySafeMutatorObserver(this); mDropdown.AddObserver(mObserver); }
protected override void OnAttached() { if (mBlock.GetField("WHERE") != null) { AtData data = new AtData(); data.whereDropdown = mBlock.GetField("WHERE") as FieldDropdown; data.atInputIndex = mBlock.InputList.FindIndex(input => "AT".Equals(input.Name)); data.xmlAttr = "at"; data.inputName = "AT"; mAtDatas.Add(data); mIsOnly = true; } else if (mBlock.GetField("WHERE1") != null) { int i = 1; while (true) { FieldDropdown dropdown = mBlock.GetField("WHERE" + i) as FieldDropdown; if (dropdown == null) { break; } AtData data = new AtData(); data.whereDropdown = dropdown; data.atInputIndex = mBlock.InputList.FindIndex(input => ("AT" + i).Equals(input.Name)); data.xmlAttr = "at" + i; data.inputName = "AT" + i; mAtDatas.Add(data); i++; } mIsOnly = false; } else { throw new Exception("FieldDropDown \"WHERE\" not found."); } UpdateInternal(); //register observer mObserver = new MemorySafeMutatorObserver(this); foreach (AtData atData in mAtDatas) { atData.whereDropdown.AddObserver(mObserver); } }