📄 contactdelete.cs
字号:
namespace Imps.Client.Pc.UIContactList
{
using Imps.Client.Core;
using Imps.Client.Pc;
using Imps.Client.Pc.BizControls;
using Imps.Client.Pc.Controls;
using Imps.Client.Resource;
using Imps.Client.Utils;
using Imps.Common;
using Imps.Common.Permission;
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
public class ContactDelete : XIMDialog
{
private Imps.Client.Core.Contact _contact;
private IFrameworkWindow _iFramework;
private Imps.Client.Core.User _user;
private XButton buttonCancel;
private XButton buttonOK;
private CheckBox checkBoxBlock;
private IContainer components;
private XLabel labelAlert;
private Panel panel1;
public ContactDelete(IFrameworkWindow iFrameworkWindow, string uri)
{
this.InitializeComponent();
this._iFramework = iFrameworkWindow;
this._user = this._iFramework.AccountManager.CurrentUser;
this._contact = this._user.ContactList.Contacts[uri];
if (this._contact == null)
{
}
}
private void buttonCancel_Click(object sender, EventArgs e)
{
base.Close();
}
private void buttonOK_Click(object sender, EventArgs e)
{
try
{
if (this._contact == null)
{
this._user.ContactList.AsyncReGetContactList(new AsyncBizOperation(), false);
}
else
{
AsyncBizOperation op = new AsyncBizOperation();
op.ImpsError += new EventHandler<ImpsErrorEventArgs>(this, (IntPtr) this.op_ImpsError);
if (this.checkBoxBlock.Checked)
{
if (!this._user.BlackList.Contains(this._contact.Uri))
{
this._user.ContactList.AsyncAddToBlackList(this._contact.Uri, op);
}
if (this._contact.Type == ContactType.ChatFriend)
{
return;
}
}
else if (this._user.BlackList.Contains(this._contact.Uri))
{
this._user.ContactList.AsyncRemoveFromBlackList(this._contact.Uri, op);
}
this._contact.AsyncDelete(op);
}
}
catch (Exception exception)
{
ClientLogger.WriteException(exception);
}
}
private void ContactDelete_Load(object sender, EventArgs e)
{
base.Text = StringTable.Contact.DeleteTitleText;
this.labelAlert.Text = StringTable.Contact.DeleteAlert;
this.checkBoxBlock.Text = StringTable.Contact.DeleteBlock;
if (this._user.BlackList.Contains(this._contact.Uri))
{
this.checkBoxBlock.Text = StringTable.Contact.DeleteBlock_Blocked;
this.checkBoxBlock.Checked = true;
}
else if (this._contact.Permissions[PermissionPointName.Contact].FinalValue == 2)
{
this.checkBoxBlock.Text = StringTable.Contact.DeleteBlock_Reject;
this.checkBoxBlock.Checked = true;
}
else
{
this.checkBoxBlock.Checked = false;
}
}
protected override void Dispose(bool disposing)
{
if (disposing && (this.components != null))
{
this.components.Dispose();
}
base.Dispose(disposing);
}
private void InitializeComponent()
{
this.labelAlert = new XLabel();
this.checkBoxBlock = new CheckBox();
this.buttonCancel = new XButton();
this.buttonOK = new XButton();
this.panel1 = new Panel();
this.panel1.SuspendLayout();
base.SuspendLayout();
this.labelAlert.BackColor = Color.Transparent;
this.labelAlert.BorderColor = Color.Empty;
this.labelAlert.ButtonBorderStyle = ButtonBorderStyle.None;
this.labelAlert.Location = new System.Drawing.Point(13, 0x29);
this.labelAlert.Name = "labelAlert";
this.labelAlert.Size = new Size(0x135, 0x22);
this.labelAlert.TabIndex = 0;
this.labelAlert.Text = " 删除此人会将其从您的联系人名单中移除。但并不能阻止他/她看到您的在线状态或向您发送消息。";
this.checkBoxBlock.set_AutoSize(true);
this.checkBoxBlock.BackColor = Color.Transparent;
this.checkBoxBlock.Location = new System.Drawing.Point(0x26, 0x51);
this.checkBoxBlock.Name = "checkBoxBlock";
this.checkBoxBlock.Size = new Size(0x9e, 0x11);
this.checkBoxBlock.TabIndex = 5;
this.checkBoxBlock.Text = "我还想将此人加入黑名单";
this.checkBoxBlock.set_UseVisualStyleBackColor(false);
this.buttonCancel.AutoArrangementX = false;
this.buttonCancel.AutoSizeToImage = false;
this.buttonCancel.BackColor = Color.Transparent;
this.buttonCancel.BackgroundImageDisable = null;
this.buttonCancel.BackgroundImageDown = null;
this.buttonCancel.BackgroundImageHover = null;
this.buttonCancel.ChangeSkin = true;
this.buttonCancel.DialogResult = DialogResult.Cancel;
this.buttonCancel.Location = new System.Drawing.Point(0xff, 0x9a);
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new Size(0x4b, 0x17);
this.buttonCancel.TabIndex = 15;
this.buttonCancel.Text = "取消";
this.buttonCancel.set_UseVisualStyleBackColor(false);
this.buttonCancel.Click += new EventHandler(this.buttonCancel_Click);
this.buttonOK.AutoArrangementX = false;
this.buttonOK.AutoSizeToImage = false;
this.buttonOK.BackColor = Color.Transparent;
this.buttonOK.BackgroundImageDisable = null;
this.buttonOK.BackgroundImageDown = null;
this.buttonOK.BackgroundImageHover = null;
this.buttonOK.ChangeSkin = true;
this.buttonOK.DialogResult = DialogResult.OK;
this.buttonOK.Location = new System.Drawing.Point(0xae, 0x9a);
this.buttonOK.Name = "buttonOK";
this.buttonOK.Size = new Size(0x4b, 0x17);
this.buttonOK.TabIndex = 10;
this.buttonOK.Text = "确定";
this.buttonOK.set_UseVisualStyleBackColor(false);
this.buttonOK.Click += new EventHandler(this.buttonOK_Click);
this.panel1.BackColor = Color.Transparent;
this.panel1.Controls.Add(this.labelAlert);
this.panel1.Controls.Add(this.checkBoxBlock);
this.panel1.Location = new System.Drawing.Point(8, 8);
this.panel1.Name = "panel1";
this.panel1.Size = new Size(0x150, 140);
this.panel1.TabIndex = 0x2c;
base.AcceptButton = this.buttonCancel;
base.set_AutoScaleDimensions(new SizeF(6f, 13f));
base.set_AutoScaleMode(1);
base.BaseHeight = 0xd4;
base.BaseWidth = 360;
base.CancelButton = this.buttonCancel;
base.ClientSize = new Size(0x162, 0xba);
base.Controls.Add(this.panel1);
base.Controls.Add(this.buttonCancel);
base.Controls.Add(this.buttonOK);
base.DisplayLocation = new System.Drawing.Point(0x12, 0x26);
base.MinimizeBox = false;
base.Name = "ContactDelete";
base.set_Padding(new Padding(8));
base.ShowInTaskbar = false;
base.StartPosition = FormStartPosition.CenterParent;
base.Text = "删除联系人";
base.Load += new EventHandler(this.ContactDelete_Load);
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
base.ResumeLayout(false);
}
private void op_ImpsError(object sender, ImpsErrorEventArgs e)
{
try
{
if (base.IsHandleCreated)
{
this._iFramework.UnifiedMessageBox.ShowError(this, e.Summary);
}
}
catch
{
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -