Ejemplo n.º 1
0
        /// <summary>
        /// 执行登录
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnLoginButtonClicked(object sender, EventArgs e)
        {
            //必须保证 NIM.ClientAPI.Init 调用成功
            if (!InitSdk())
            {
                return;
            }
            var ps = ProxySettingForm.GetProxySetting();

            if (ps != null && ps.IsValid)
            {
                NIM.GlobalAPI.SetProxy(ps.Type, ps.Host, ps.Port, ps.UserName, ps.Password);
            }
            _userName = UserNameComboBox.Text;
            _password = textBox2.Text;
            //使用明文密码或者其他加密方式请修改此处代码
            var password = NIM.ToolsAPI.GetMd5(_password);

            if (!string.IsNullOrEmpty(_userName) && !string.IsNullOrEmpty(password))
            {
                toolStripProgressBar1.Value = 0;
                label3.Text = "";
                if (string.IsNullOrEmpty(_appKey))
                {
                    MessageBox.Show("请设置app key");
                    return;
                }
                NIM.ClientAPI.Login(_appKey, _userName, password, HandleLoginResult);
            }
        }
Ejemplo n.º 2
0
        private void OnLoginFormLoaded(object s, EventArgs e)
        {
            OutputForm.Instance.Show();
            var ps = ProxySettingForm.GetProxySetting();

            checkBox1.Checked         = (ps != null && ps.IsValid);
            checkBox1.CheckedChanged += checkBox1_CheckedChanged;
        }
Ejemplo n.º 3
0
 private void tsbSetting_Click(object sender, EventArgs e)
 {
     try
     {
         if (txtUrl.Enabled)
         {
             var formSetting = new ProxySettingForm();
             formSetting.ShowDialog();
         }
     }
     catch (Exception ex)
     {
         MsgBox.ShowExceptionMessage(ex);
     }
 }
Ejemplo n.º 4
0
 private void checkBox1_CheckedChanged(object sender, EventArgs e)
 {
     if (checkBox1.Checked)
     {
         new ProxySettingForm().ShowDialog();
         var ps = ProxySettingForm.GetProxySetting();
         if (ps == null || !ps.IsValid)
         {
             Action action = () => { this.checkBox1.Checked = false; };
             checkBox1.Invoke(action);
         }
     }
     else
     {
         ProxySettingForm.SetSettingStatus(false);
     }
 }
Ejemplo n.º 5
0
        /// <summary>
        /// 执行登录
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnLoginButtonClicked(object sender, EventArgs e)
        {
            var ps = ProxySettingForm.GetProxySetting();

            if (ps != null && ps.IsValid)
            {
                NIM.GlobalAPI.SetProxy(ps.Type, ps.Host, ps.Port, ps.UserName, ps.Password);
            }
            _userName = UserNameComboBox.Text;
            _password = PwdTextBox.Text;
            //使用明文密码或者其他加密方式请修改此处代码
            var password = NIM.ToolsAPI.GetMd5(_password);

            if (!string.IsNullOrEmpty(_userName) && !string.IsNullOrEmpty(password))
            {
                toolStripProgressBar1.Value = 0;
                label3.Text   = "";
                handle_result = HandleLoginResult;
                NIM.ClientAPI.Login(ConfigReader.GetAppKey(), _userName, password, handle_result);
            }
        }