private void NativeSignatureInputHelper_Load(object sender, EventArgs e) { comboBoxNativeType.Items.Clear(); List <string> tlbSimpleTypeStrings = TlbType2String.TlbSimpleTypes; foreach (string tlbSimpleType in tlbSimpleTypeStrings) { comboBoxNativeType.Items.Add(tlbSimpleType); } List <string> tlbUserDefinedTypeStrings = TlbType2String.TlbUserDefinedTypes; foreach (string tlbUserDefinedType in tlbUserDefinedTypeStrings) { comboBoxNativeType.Items.Add(tlbUserDefinedType); } // ... for UserDefined comboBoxNativeType.Items.Add("..."); if (m_fixedTypeString != null) { string tlbType = m_fixedTypeString.Split(' ')[0]; if (!comboBoxNativeType.Items.Contains(tlbType)) { TlbType2String.AddTlbUserDefinedType(tlbType); comboBoxNativeType.Items.Insert(comboBoxNativeType.Items.Count - 1, tlbType); } comboBoxNativeType.SelectedItem = tlbType; string remain = m_fixedTypeString.Substring(tlbType.Length); int indirections = 0; while (remain.StartsWith(" *", StringComparison.InvariantCulture)) { remain = remain.Substring(2); indirections++; } numericUpDownIndirection.Value = indirections; if (remain.StartsWith(" [", StringComparison.InvariantCulture)) { checkBoxMakeArray.Checked = true; remain = remain.Substring(2, remain.Length - 3); numericUpDownArraySize.Value = Int32.Parse(remain, CultureInfo.InvariantCulture); } } else { if (comboBoxNativeType.Items.Count != 0) { comboBoxNativeType.SelectedIndex = 0; } } }
private void DoAddTlbType() { TlbTypeSelectDialog dlg = new TlbTypeSelectDialog(); if (dlg.ShowDialog() == DialogResult.OK) { string typeLibName = dlg.TypeLib.GetDocumentation(); string typeName = dlg.TypeInfoMatchTarget.Name; string typeFullName = "[" + typeLibName + "]" + typeName; if (!comboBoxNativeType.Items.Contains(typeFullName)) { TlbType2String.AddTlbUserDefinedType(typeFullName); comboBoxNativeType.Items.Insert(comboBoxNativeType.Items.Count - 1, typeFullName); } comboBoxNativeType.SelectedItem = typeFullName; } else { comboBoxNativeType.SelectedIndex = -1; } }