示例#1
0
        private void EditParameter()
        {
            if (lstParameters.SelectedItems.Count > 0)
            {
                string    paramName    = lstParameters.SelectedItems[0].SubItems[0].Text;
                ParamInfo currentParam = null;

                foreach (ParamInfo p in frmFunctionWizard.CurrentFunction.Parameters)
                {
                    if (p.Name == paramName)
                    {
                        currentParam = new ParamInfo(p.Name, p.DataType);
                        break;
                    }
                }
                bool canEditType = frmFunctionWizard.CurrentFunction.IsExtensionMethod == false ||
                                   lstParameters.SelectedItems[0].Index > 0;
                var form = new frmParameterEdit(currentParam, canEditType);

                if (form.ShowDialog(this) == DialogResult.OK)
                {
                    var item = new ListViewItem(new[] { form.CurrentParameter.Name, form.CurrentParameter.DataType.Name });
                    item.Tag = form.CurrentParameter.DataType;
                    lstParameters.Items[lstParameters.SelectedItems[0].Index] = item;
                    return;
                }
            }
        }
示例#2
0
        private bool AddParameter()
        {
            var form = new frmParameterEdit();

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                string demangledTypeName = Utility.GetDemangledGenericTypeName(form.CurrentParameter.DataType, Project.Instance.Namespaces);
                var    item = new ListViewItem(new string[2] {
                    form.CurrentParameter.Name, demangledTypeName
                });
                item.Tag = form.CurrentParameter.DataType;
                lstParameters.Items.Add(item);
                return(true);
            }
            return(false);
        }