📄 frmkeepitup.cs
字号:
using System;
using System.Windows.Forms;
using System.Threading;
namespace CodeForChapter11cs
{
// Only run this from within the IDE with F5
public partial class frmKeepItUp : Form
{
public frmKeepItUp()
{
InitializeComponent();
}
// start thread that will block
private void menuItem1_Click(object sender, EventArgs e)
{
Thread t = new Thread(new ThreadStart(this.KeepTheProcessUp));
//t.IsBackground = true;
t.Start();
MessageBox.Show("Hit the Exit button. Is VS still debugging");
}
private void KeepTheProcessUp()
{
ManualResetEvent mre = new ManualResetEvent(false);
mre.WaitOne();
MessageBox.Show("Never shown!");
// imagine more code
}
//Exit
private void menuItem2_Click(object sender, EventArgs e)
{
this.Close();
Application.Exit(); // utterly superfluous but just to emphasize the point!
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -