我完全遵循这个:
http://msdn.microsoft.com/en-us/library/ms185301.aspx
但无法让它工作。当我尝试添加我的新项目时,表单会出现,但是当我输入文本并单击按钮时,没有任何反应。
为了后代的缘故,这是我的代码:
扩展的 Wizard 类中的非空方法IWizard
public void RunStarted(object automationObject,
Dictionary<string, string> replacementsDictionary,
WizardRunKind runKind, object[] customParams)
{
try
{
// Display a form to the user. The form collects
// input for the custom message.
inputForm = new UserInputForm();
inputForm.ShowDialog();
customMessage = inputForm.get_CustomMessage();
// Add custom parameters.
replacementsDictionary.Add("$custommessage$",
customMessage);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
// This method is only called for item templates,
// not for project templates.
public bool ShouldAddProjectItem(string filePath)
{
return true;
}
用户输入表单代码:
public partial class UserInputForm : Form
{
private string customMessage;
public UserInputForm()
{
InitializeComponent();
}
public string get_CustomMessage()
{
return customMessage;
}
private void button1_Click(object sender, EventArgs e)
{
customMessage = textBox1.Text;
this.Dispose();
}
}
该按钮确实被命名为按钮 1:
this.button1.Location = new System.Drawing.Point(200, 180);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(100, 40);
this.button1.TabIndex = 0;
this.button1.Text = "Click Me";
this.button1.UseVisualStyleBackColor = true;
所以我在 Windows 窗体(做网络应用程序)方面没有太多经验,但我按照 MSDN 上的指示进行操作,而且非常明确。有什么建议么?其他人可以让它工作吗?