/// <summary> /// 资源释放 /// //2011-9-6 dengqiong 增加释放动态资源引用 /// </summary> public void DisposeTwain() { loadAndUnloadLogger.Debug("资源释放处理开始: " + DateTime.Now); string name = GetSelectedScannerName(); if (name != null) { userConfig.SaveDefaultScannerName(name); } if (twSession.State >= TwState.OpenDS) { twSession.DisableDS(); } twSession.CloseDSM(); EndingScan(); loadAndUnloadLogger.Debug("资源释放处理结束: " + DateTime.Now); initFlag = false; hwndWindow = IntPtr.Zero; this.ClearValue(BackgroundProperty); }