private void BtnCreateSelected_Click(object sender, EventArgs e) { if (this.lbApi.SelectedIndex < 0) { MessageBox.Show("请选择需要生成的接口"); return; } thread = new System.Threading.Thread(new System.Threading.ThreadStart(() => { List <ApiInterfaceInfo> list = new List <ApiInterfaceInfo>(); foreach (ApiInterfaceInfo item in this.lbApi.SelectedItems) { list.Add(item); } CreateCSharpCodeCallback cb = new CreateCSharpCodeCallback(BuildCSharpCode); this.Invoke(cb, list); thread.Abort(); })); thread.IsBackground = true; thread.Start(); }
private void BtnCreateAll_Click(object sender, EventArgs e) { thread = new System.Threading.Thread(new System.Threading.ThreadStart(() => { CreateCSharpCodeCallback cb = new CreateCSharpCodeCallback(BuildCSharpCode); this.Invoke(cb, this.Project.ApiInterfaces); thread.Abort(); })); thread.IsBackground = true; thread.Start(); }