示例#1
0
        private async void btnLogout_Click(object sender, RoutedEventArgs e)
        {
            if (MessageBox.Show("确定要注销吗?", "提示", MessageBoxButton.OKCancel) == MessageBoxResult.Cancel)
            {
                return;
            }
            using (new WaitPopup("正在注销中", this))
            {
                await Task.Run(() =>
                {
                    try
                    {
                        clearNotebooks();

                        clearNotes();

                        clearPicCache();

                        clearLocalLog();

                        ConstantPool.AccessToken = "";
                        Util.SaveLastSelectedNotebook(null);

                        MyDataContext.DeleteDatabaseIfExists();
                    }
                    catch (Exception ex)
                    {
                        LoggerFactory.GetLogger().Error("注销发生错误", ex);
                        Toast.Prompt("额,注销发生错误,请稍后重试!");
                    }
                });
            }
            showCacheSize();
            navigateAuth();
        }