private void setInstanceLabel() { if (lbInstance != null) { string s = ""; if (inst != null) { List <string> labels = null; if (useFlagNames && dataOwner == 0x07 && flagsFor != null) { labels = BhavWiz.flagNames(flagsFor.DataOwner, flagsFor.Value); if (labels != null) { labels = new List <string>(labels); labels.Insert(0, "[0: " + pjse.Localization.GetString("invalid") + "]"); } } else if (dataOwner == 0x00 || dataOwner == 0x01) { labels = inst.GetAttrNames(Scope.Private); } else if (dataOwner == 0x02 || dataOwner == 0x05) { labels = inst.GetAttrNames(Scope.SemiGlobal); } else if (dataOwner == 0x09 || dataOwner == 0x16 || dataOwner == 0x32) // Param { labels = inst.GetTPRPnames(false); } else if (dataOwner == 0x19) // Local { labels = inst.GetTPRPnames(true); } else if (dataOwner >= 0x29 && dataOwner <= 0x2F) { labels = inst.GetArrayNames(); } else if (BhavWiz.doidGStr[dataOwner] != null) { labels = BhavWiz.readStr((GS.BhavStr)BhavWiz.doidGStr[dataOwner]); } if (labels != null) { if (instance < labels.Count) { s = cbDataOwner.Text + ": " + labels[instance]; } } else if (dataOwner == 0x1a) { ushort[] bcon = BhavWiz.ExpandBCON(instance, false); s = ((BhavWiz)inst).readBcon(bcon[0], bcon[1], false, true); } } lbInstance.Text = s; } }
private void SetDataOwner() { if (internalchg) { return; } internalchg = true; if (cbDataOwner != null && cbDataOwner.SelectedIndex != dataOwner) { dataOwner = (byte)cbDataOwner.SelectedIndex; setTextBoxLength(); tbValue.Text = tbValueConverter(instance); OnDataOwnerControlChanged(this, new EventArgs()); } #region pickerNames List <String> pickerNames = null; if (useInstancePicker && cbPicker != null) { if (useFlagNames && dataOwner == 0x07 && flagsFor != null) { pickerNames = BhavWiz.flagNames(flagsFor.DataOwner, flagsFor.Value); if (pickerNames != null) { pickerNames = new List <string>(pickerNames); pickerNames.Insert(0, "[0: " + pjse.Localization.GetString("invalid") + "]"); } } else if (inst != null && useInstancePicker && (dataOwner == 0x00 || dataOwner == 0x01)) { pickerNames = inst.GetAttrNames(Scope.Private); } else if (inst != null && useInstancePicker && (dataOwner == 0x02 || dataOwner == 0x05)) { pickerNames = inst.GetAttrNames(Scope.SemiGlobal); } else if (inst != null && dataOwner == 0x09 || dataOwner == 0x16 || dataOwner == 0x32) // Param { pickerNames = inst.GetTPRPnames(false); } else if (inst != null && dataOwner == 0x19) // Local { pickerNames = inst.GetTPRPnames(true); } else if (inst != null && useInstancePicker && (dataOwner >= 0x29 && dataOwner <= 0x2F)) { pickerNames = inst.GetArrayNames(); } else if (BhavWiz.doidGStr[dataOwner] != null) { pickerNames = BhavWiz.readStr((GS.BhavStr)BhavWiz.doidGStr[dataOwner]); } } #endregion if (pickerNames != null && pickerNames.Count > 0) { if (tbValue != null) { tbValue.TabStop = tbValue.Visible = false; } cbPicker.TabStop = cbPicker.Visible = true; cbPicker.Items.Clear(); cbPicker.Items.AddRange(pickerNames.ToArray()); cbPicker.SelectedIndex = (cbPicker.Items.Count > instance) ? instance : -1; } else { if (cbPicker != null) { cbPicker.TabStop = cbPicker.Visible = false; } if (tbValue != null) { tbValue.TabStop = tbValue.Visible = true; } } setInstanceLabel(); internalchg = false; }