private void MoblieLoginWindow_LoggedIn(MoblieLoginWindow sender, System.Net.CookieCollection cookies, uint uid) { Dispatcher.Invoke(new Action(async() => { sender.Topmost = false; sender.Hide(); BiliApi.CookieCollection = cookies; ConfigUtil.ConfigManager.SetCookieCollection(cookies); UserInfo userInfo = await UserInfo.GetUserInfoAsync(BiliApi.CookieCollection); if (userInfo != null) { ShowUserInfo(userInfo); LoginBtn.Content = "登出"; } sender.Close(); })); }
private void MoblieLoginWindow_LoggedIn(MoblieLoginWindow sender, CookieCollection cookies, uint uid) { Dispatcher.Invoke(new Action(() => { sender.Topmost = false; sender.Hide(); UserCookieCollection = cookies; ApplyBtn.Content = ApplyString; ApplyBtn.IsEnabled = true; sender.Close(); BinaryFormatter binaryFormatter = new BinaryFormatter(); using (FileStream fileStream = new FileStream("cookies.dat", FileMode.Create, FileAccess.Write, FileShare.None)) { binaryFormatter.Serialize(fileStream, cookies); } ApplyDrawing(); })); }