⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 permissioncontrol.cs

📁 飞信的收发使用csharp进行开发
💻 CS
📖 第 1 页 / 共 2 页
字号:
            this.chkAllowContact.Location = new Point(20, 0x8a);
            this.chkAllowContact.Name = "chkAllowContact";
            this.chkAllowContact.Size = new Size(0x7a, 0x11);
            this.chkAllowContact.TabIndex = 13;
            this.chkAllowContact.Text = "允许对方和我联系";
            this.chkAllowContact.UseVisualStyleBackColor = true;
            this.chkAllowContact.CheckedChanged += new EventHandler(this.chkAllowContact_CheckedChanged);
            this.chkPresence.AutoSize = true;
            this.chkPresence.CheckAlign = ContentAlignment.TopLeft;
            this.chkPresence.Location = new Point(20, 0x42);
            this.chkPresence.Name = "chkPresence";
            this.chkPresence.Size = new Size(0x10a, 30);
            this.chkPresence.TabIndex = 14;
            this.chkPresence.Text = "允许对方看到我的在线状态以及其它状态信息\r\n(例如:我的彩铃)";
            this.chkPresence.UseVisualStyleBackColor = true;
            this.lbIvr.AutoSize = true;
            this.lbIvr.BorderColor = Color.Empty;
            this.lbIvr.ButtonBorderStyle = ButtonBorderStyle.None;
            this.lbIvr.Location = new Point(40, 0xa9);
            this.lbIvr.Name = "lbIvr";
            this.lbIvr.Size = new Size(0x37, 13);
            this.lbIvr.TabIndex = 15;
            this.lbIvr.Text = "手机语聊";
            base.AutoScaleDimensions = new SizeF(6f, 13f);
            base.AutoScaleMode = AutoScaleMode.Font;
            this.BackColor = Color.Transparent;
            base.Controls.Add(label6);
            base.Controls.Add(this.lbIvr);
            base.Controls.Add(this.chkPresence);
            base.Controls.Add(this.chkAllowContact);
            base.Controls.Add(label5);
            base.Controls.Add(this.label5);
            base.Controls.Add(this.checkBoxBlock);
            base.Controls.Add(this.xcbIvr);
            base.Controls.Add(this.xbtnBlackList);
            base.Controls.Add(label3);
            base.Controls.Add(label4);
            base.Controls.Add(this.xbtnMore);
            base.Controls.Add(this.cbShareInfo);
            base.Controls.Add(label);
            base.Controls.Add(label2);
            base.Name = "PermissionControl";
            base.Size = new Size(380, 0x141);
            base.Load += new EventHandler(this.PermissionControl_Load);
            base.ResumeLayout(false);
            base.PerformLayout();
        }

        private void initIvrBuddyComboBox()
        {
            ValueNameDescList<int> list = new ValueNameDescList<int>();
            list.Add(1, StringTable.Permission.Ivr_Permit);
            list.Add(4, StringTable.Permission.Ivr_NeedApply);
            list.Add(0, StringTable.Permission.Ivr_Reject);
            this.xcbIvr.DataSource = list;
            this.xcbIvr.DisplayMember = "Name";
            this.xcbIvr.ValueMember = "Value";
        }

        private void PermissionControl_Load(object sender, EventArgs e)
        {
            if (!this._user.ContactList.Contacts.Contains(this._contact))
            {
                this.cbShareInfo.Enabled = false;
                this.xcbIvr.Enabled = false;
                this.xbtnMore.Enabled = false;
                this.xbtnBlackList.Enabled = false;
                this.checkBoxBlock.Enabled = false;
            }
            if (this._contact.Type == ContactType.MobileBuddy)
            {
                this.cbShareInfo.Enabled = false;
                this.xcbIvr.Enabled = false;
                this.xbtnMore.Enabled = false;
            }
        }

        protected override void UIData_Changed(object sender, EventArgs e)
        {
            UiErrorHelper.HandEventSafely(this._iFrameworkWindow, delegate {
                base.Modified = true;
            });
        }

        public override bool UpdateData(bool update)
        {
            try
            {
                AsyncBizOperation op = new AsyncBizOperation();
                if (update)
                {
                    if (!this.CheckUserInput())
                    {
                        return false;
                    }
                    if (this.cbShareInfo.Checked)
                    {
                        this._contact.Permissions[PermissionPointName.Identity].SetProposedValueSafely(1);
                    }
                    else
                    {
                        this._contact.Permissions[PermissionPointName.Identity].SetProposedValueSafely(0);
                    }
                    if (this.chkPresence.Checked)
                    {
                        this._contact.Permissions[PermissionPointName.Presence].SetProposedValueSafely(1);
                    }
                    else
                    {
                        this._contact.Permissions[PermissionPointName.Presence].SetProposedValueSafely(0);
                    }
                    if (this.chkAllowContact.Checked)
                    {
                        this._contact.Permissions[PermissionPointName.Contact].SetProposedValueSafely(1);
                        this._contact.Permissions[PermissionPointName.Ivr].SetProposedValueSafely(this.getIvrValue());
                    }
                    else
                    {
                        this._contact.Permissions[PermissionPointName.Contact].SetProposedValueSafely(2);
                    }
                    if (this.checkBoxBlock.Checked)
                    {
                        if (!this._user.BlackList.Contains(this._contact.Uri))
                        {
                            this._user.ContactList.AsyncAddToBlackList(this._contact.Uri, op);
                        }
                    }
                    else if (this._user.BlackList.Contains(this._contact.Uri))
                    {
                        this._user.ContactList.AsyncRemoveFromBlackList(this._contact.Uri, op);
                    }
                }
                else
                {
                    this.cbShareInfo.Checked = this._contact.Permissions.PermissionPointIdentity.FinalValue == 1;
                    this.checkBoxBlock.Checked = this._user.BlackList.Contains(this._contact.Uri);
                    this.chkPresence.Checked = this._contact.Permissions.PermissionPointPresence.FinalValue == 1;
                    this.chkAllowContact.Checked = this._contact.Permissions.PermissionPointContact.FinalValue == 1;
                    if (!this.checkBoxBlock.Checked && this.chkAllowContact.Checked)
                    {
                        this.xcbIvr.SelectedValue = this._contact.Permissions.PermissionPointIvr.FinalValue;
                        this.xcbIvr.Enabled = true;
                    }
                    else
                    {
                        this.xcbIvr.Enabled = false;
                        this.xcbIvr.SelectedValue = 0;
                    }
                }
                base.Modified = false;
                return true;
            }
            catch (Exception exception)
            {
                ClientLogger.WriteException(exception);
                return false;
            }
        }

        private void xbtnBlackList_Click(object sender, EventArgs e)
        {
            UiErrorHelper.HandEventSafely(this._iFrameworkWindow, delegate {
                this._iFrameworkWindow.ShowOptions(this, "PsBlackList");
            });
        }

        private void xbtnMore_Click(object sender, EventArgs e)
        {
            if (this.InnerMyInfoFrom.Visible)
            {
                this.InnerMyInfoFrom.BringToFront();
                this.InnerMyInfoFrom.Activate();
            }
            else
            {
                ControlHelper.ShowDialogCenterOnParent(this.InnerMyInfoFrom, base.FindForm());
                this.InnerMyInfoFrom.BringToFront();
                this.InnerMyInfoFrom.Activate();
            }
        }

        private void xcbIvr_MouseHover(object sender, EventArgs e)
        {
            BalloonHelper.ShowBallon(this.xcbIvr, StringTable.Permission.Ivr_Tooltip);
        }

        private MyInfoForm InnerMyInfoFrom
        {
            get
            {
                if ((this._myInfoForm == null) || this._myInfoForm.IsDisposed)
                {
                    this._myInfoForm = new MyInfoForm(this._iFrameworkWindow, this._contact);
                }
                return this._myInfoForm;
            }
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -