Пример #1
0
        private void MoblieLoginWindow_LoggedIn(MoblieLoginWindow sender, CookieCollection cookies, uint uid)
        {
            BiliApi.LoginCookies = cookies;
            UserInfo userInfo = UserInfo.GetUserInfo(cookies);

            Dispatcher.Invoke(() =>
            {
                UserInfoBox.Text = userInfo.Uname;
                sender.Close();
            });
            using (FileStream fileStream = new FileStream("login.dat", FileMode.Create, FileAccess.Write, FileShare.None))
            {
                BinaryFormatter binaryFormatter = new BinaryFormatter();
                binaryFormatter.Serialize(fileStream, cookies);
            }
        }
Пример #2
0
        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();
            }));
        }
Пример #3
0
        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();
            }));
        }