예제 #1
0
        // 调用事件
        public void CallAskAccountInfo(object obj,
                                       AskDtlpAccountInfoEventArgs e)
        {
            if (this.AskAccountInfo == null)
            {
                return;
            }

            this.AskAccountInfo(obj, e);
        }
예제 #2
0
        void channelArray_AskAccountInfo(object sender,
            AskDtlpAccountInfoEventArgs e)
        {
            e.Owner = null;
            e.UserName = "";
            e.Password = "";

            LoginDlg dlg = new LoginDlg();
            GuiUtil.SetControlFont(dlg, this.Font);

            AccountItem item = (AccountItem)AccountTable[e.Path];
            if (item == null)
            {
                item = new AccountItem();
                AccountTable.Add(e.Path, item);

                // 从配置文件中得到缺省账户
                item.UserName = MainForm.AppInfo.GetString(
                    "preference",
                    "defaultUserName",
                    "public");
                item.Password = MainForm.AppInfo.GetString(
                    "preference",
                    "defaultPassword",
                    "");
            }

            dlg.textBox_serverAddr.Text = e.Path;
            dlg.textBox_userName.Text = item.UserName;
            dlg.textBox_password.Text = item.Password;

            // 先登录一次再说
            {
                byte[] baResult = null;
                int nRet = e.Channel.API_ChDir(dlg.textBox_userName.Text,
                    dlg.textBox_password.Text,
                    e.Path,
                    out baResult);

                // 登录成功
                if (nRet > 0)
                {
                    e.Result = 2;
                    return;
                }
            }


            dlg.StartPosition = FormStartPosition.CenterScreen;
            dlg.ShowDialog(this);

            if (dlg.DialogResult == DialogResult.OK)
            {
                item.UserName = dlg.textBox_userName.Text;
                item.Password = dlg.textBox_password.Text;

                e.UserName = dlg.textBox_userName.Text;
                e.Password = dlg.textBox_password.Text;
                e.Owner = this;
                e.Result = 1;
                return;
            }

            e.Result = 0;
            return;
        }
예제 #3
0
파일: MainForm.cs 프로젝트: renyh1013/dp2
        void channelArray_AskAccountInfo(object sender, AskDtlpAccountInfoEventArgs e)
        {
            e.Owner = null;
            e.UserName = "";
            e.Password = "";

            LoginDlg dlg = new LoginDlg();

            dlg.textBox_serverAddr.Text = e.Path;
            dlg.textBox_userName.Text = this.textBox_dtlpUserName.Text;
            dlg.textBox_password.Text = this.textBox_dtlpPassword.Text;

            // 先登录一次再说
            {
                byte[] baResult = null;
                int nRet = e.Channel.API_ChDir(this.textBox_dtlpUserName.Text,
                    this.textBox_dtlpPassword.Text,
                    e.Path,
                    out baResult);

                // 登录成功
                if (nRet > 0)
                {
                    e.Result = 2;
                    return;
                }
            }


            dlg.StartPosition = FormStartPosition.CenterScreen;
            dlg.ShowDialog(this);

            if (dlg.DialogResult == DialogResult.OK)
            {
                this.textBox_dtlpUserName.Text = dlg.textBox_userName.Text;
                this.textBox_dtlpPassword.Text = dlg.textBox_password.Text;

                e.UserName = dlg.textBox_userName.Text;
                e.Password = dlg.textBox_password.Text;
                e.Owner = this;
                e.Result = 1;
                return;
            }

            e.Result = 0;
            return;
        }
예제 #4
0
        // 调用事件
        public void CallAskAccountInfo(object obj,
            AskDtlpAccountInfoEventArgs e)
        {
            if (this.AskAccountInfo == null)
                return;

            this.AskAccountInfo(obj, e);
        }