WPF 单例
public abstract class SingletonApplication : Application { private Mutex _singleTonApp = null; protected SingletonApplication(string appName) { _singleTonApp = new Mutex(true, appName, out var createdNew); if (createdNew) { // ReSharper disable once VirtualMemberCallInConstructor CreatedNewApp(); } else { // ReSharper disable once VirtualMemberCallInConstructor UpdateApp(); } } /// <summary> /// 首次运行app /// </summary> protected abstract void CreatedNewApp(); /// <summary> /// 已经有app在运行 /// </summary> protected abstract void UpdateApp(); }
标签:SingletonApplication,abstract,VirtualMemberCallInConstructor,protected,Metux,单例, From: https://www.cnblogs.com/Koalin/p/17140018.html