public void Disconnect() { if (pIOPCServer != null) { Marshal.ReleaseComObject(pIOPCServer); pIOPCServer = null; } if (OnlyTaskGorup1 != null) { OnlyTaskGorup1.Release(); } if (OnlyTaskGorup2 != null) { OnlyTaskGorup2.Release(); } if (FinishOnlyGoroup1 != null) { FinishOnlyGoroup1.Release(); } if (FinishOnlyGoroup2 != null) { FinishOnlyGoroup2.Release(); } if (SpyBiaozhiGroup != null) { SpyBiaozhiGroup.Release(); } }
private void button12_Click(object sender, EventArgs e) { DialogResult MsgBoxResult = MessageBox.Show("确定要退出程序?", //对话框的显示内容 "操作提示", //对话框的标题 MessageBoxButtons.YesNo, //定义对话框的按钮,这里定义了YSE和NO两个按钮 MessageBoxIcon.Question, //定义对话框内的图表式样,这里是一个黄色三角型内加一个感叹号 MessageBoxDefaultButton.Button2); //定义对话框的按钮式样 if (MsgBoxResult == DialogResult.Yes) { if (pIOPCServer != null) { Marshal.ReleaseComObject(pIOPCServer); pIOPCServer = null; } if (OnlyTaskGorup != null) { OnlyTaskGorup.Release(); } if (FinishOnlyGoroup != null) { FinishOnlyGoroup.Release(); } if (SpyBiaozhiGroup != null) { SpyBiaozhiGroup.Release(); } if (SpecialSmokeGroup1 != null) { SpecialSmokeGroup1.Release(); } if (SpecialSmokeGroup2 != null) { SpecialSmokeGroup2.Release(); } list_data.Items.Clear(); updateListBox("任务停止发送!"); writeLog.Write("任务停止发送!"); updateControlEnable(true, button10); } else { return; } // updateControlEnable(true, button10); }