Ejemplo n.º 1
0
        /// <summary>
        /// 初始化代码
        /// </summary>
        public void InitializeCode()
        {
            // 一些初始化任务
            Application.Current.Dispatcher.BeginInvoke(new Action(() =>
            {
                // 读取插件
                this._iUcWindowPlugins          = UCWindowHelp.ReadPlugin(_pluginPath);
                this.plugincomboBox.ItemsSource = UCWindowHelp.CreatButtons(this._iUcWindowPlugins);

                this._ucLogin = new UCLogin();
                UCHelp.BinaryDeserializeCookieContainer(SerializePath, ref this._ucLogin);
                if (this._ucLogin.IsLogin)
                {
                    // cookiecontaniner赋值后已经登录
                    this.lblogininfo.Content     = this._ucLogin.LoginResultMsg.Name + "用户已经成功登录!";
                    this.logincontrol.Visibility = Visibility.Hidden;
                    this.maincontrol.Visibility  = Visibility.Visible;
                    this._ucDownload             = new UCDownload(this._ucLogin.HttpWeb);
                    UCWindowHelp.InitializeIUCWindowPlugin(this._iUcWindowPlugins, this._ucLogin.HttpWeb);
                    return;
                }
                this.logincontrol.IsEnabled = true;
                byte[] bytes = this._ucLogin.GetCaptchaBytes();
                this.SetBytesToImageAsyn(bytes);
            }));
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 窗体关闭事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void mianwindow_Closed(object sender, EventArgs e)
 {
     if (this._ucLogin?.IsLogin == true)
     {
         UCHelp.BinarySerializeCookieContainer(SerializePath, this._ucLogin.HttpWeb.HttpCookieContainer);
     }
     Environment.Exit(0);
 }