private void Window_Closed(object sender, EventArgs e) { if (_arg != "plugin" && _wxSerivice != null) { WXService.LoginOut(); } Environment.Exit(0); }
private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { if (e.IsTerminating) { MessageBox.Show("严重错误,这会导致程序退出!"); Console.WriteLine("sorry! there have been some exceptions, but no handle, the program has crashed!"); Console.WriteLine("if you aleady login in wechat, we will loginout it"); // loginout wechat WXService.LoginOut(); Environment.Exit(0); } }
public override void WillTerminate(NSNotification notification) { // Config.PICSAVEDIRECTORY一定存在,在程序初始化时就已经创建 foreach (var item in Directory.GetFiles(Config.PICSAVEDIRECTORY)) { File.Delete(item); } try { WXService.LoginOut(); } catch { // 当用户未登录时候的退出 } }