private static void About_Click(object sender, EventArgs e) { AboutView aboutView = AboutView.GetInstance(); aboutView.Focus(); aboutView.Show(); }
public static AboutView GetInstance() { if (AboutViewSingleton == null) //双重锁定只需要一句判断就可以了 { lock (locker) //线程锁 { if (AboutViewSingleton == null) //判断类是否已经实例化 { AboutViewSingleton = new AboutView(); } } } return(AboutViewSingleton); }
private void AboutView_Closed(object sender, EventArgs e) { AboutViewSingleton = null; }