?? receiverequestbymobilenoform.cs
字號:
?namespace Imps.Client.Pc.UIContactList.AddBuddy
{
using Imps.Client;
using Imps.Client.Core;
using Imps.Client.Pc;
using Imps.Client.Pc.BizControls;
using Imps.Client.Pc.Controls;
using Imps.Client.Resource;
using Imps.Common;
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
public class ReceiveRequestByMobileNoForm : XIMDialog
{
private Imps.Client.Core.Contact _contact;
private string _desc;
private bool _hasHandleRequest;
private IFrameworkWindow _iFarmeworkWindow;
private int? _initTargetGroupId;
private Imps.Client.Core.User _user;
private XButton buttonCancel;
private XButton buttonOK;
private CheckBox checkBoxBlock;
private XComboBox comboBoxGroup;
private IContainer components;
private XLabel label1;
private XLabel labelHello;
private XLabel labelNickname;
private XLabel labelRemind;
private LinkLabel linkLabelDetail;
private LinkLabel linkLabelNewGroup;
private Panel panel1;
private Panel panel2;
private Panel panel3;
private Panel panelInfo;
private PictureBox pictureBoxAlert;
private DisplayPortrait pictureBoxPortrait;
private RadioButton radioButtonAgree;
private RadioButton radioButtonReject;
public ReceiveRequestByMobileNoForm(IFrameworkWindow iFrameworkWindow, Imps.Client.Core.Contact contact, string desc)
{
this.InitializeComponent();
this._iFarmeworkWindow = iFrameworkWindow;
this._user = iFrameworkWindow.AccountManager.CurrentUser;
this._contact = contact;
this._desc = desc;
this.initComponentRegion();
this._user.StatusChanged += new EventHandler<UserSatusChangedEventArgs>(this._user_StatusChanged);
this._user.ContactList.ContactGroupChanged += new EventHandler<ContactGroupChangedEventArgs>(this.ContactList_ContactGroupChanged);
}
private void _user_StatusChanged(object sender, UserSatusChangedEventArgs e)
{
if (((e.NewStatus == UserAccountStatus.Disconnected) || (e.NewStatus == UserAccountStatus.Logoff)) || (e.NewStatus == UserAccountStatus.Logouting))
{
base.Close();
}
}
private void buttonCancel_Click(object sender, EventArgs e)
{
try
{
base.Close();
}
catch
{
}
}
private void buttonOK_Click(object sender, EventArgs e)
{
try
{
if (!this.radioButtonAgree.Checked && !this.radioButtonReject.Checked)
{
this._iFarmeworkWindow.UnifiedMessageBox.ShowInfo(StringTable.FormAddBuddy.MustCheckOne);
}
else
{
int? targetGroupId = null;
if (this.radioButtonAgree.Checked && (this.comboBoxGroup.Items.Count > 0))
{
if ((this.comboBoxGroup.SelectedIndex == -1) || (this.comboBoxGroup.SelectedItem == null))
{
this._iFarmeworkWindow.UnifiedMessageBox.ShowInfo(StringTable.FormAddBuddy.MustSelectGroup);
return;
}
ComboBoxItem selectedItem = (ComboBoxItem) this.comboBoxGroup.SelectedItem;
targetGroupId = new int?((int) selectedItem.Value);
if (((int) selectedItem.Value) <= 0)
{
this._iFarmeworkWindow.UnifiedMessageBox.ShowInfo(StringTable.FormAddBuddy.MustSelectGroup);
return;
}
}
int result = this.radioButtonAgree.Checked ? 1 : 0;
this._hasHandleRequest = true;
bool? isBlock = null;
if (result == 0)
{
isBlock = new bool?(this.checkBoxBlock.Checked);
}
AsyncBizOperation op = new AsyncBizOperation();
this._user.ContactList.AsyncHandleContactRequest(this._contact.Uri.ToString(), result, isBlock, targetGroupId, true, string.Empty, op);
if (this.checkBoxBlock.Checked)
{
this._user.ContactList.AsyncAddToBlackList(this._contact.Uri, op);
}
base.Close();
}
}
catch
{
}
}
private void ContactList_ContactGroupChanged(object sender, ContactGroupChangedEventArgs e)
{
if (e.Type == ContactGroupEventType.Added)
{
this._initTargetGroupId = new int?(e.ContactGroup.Id);
}
else if ((e.Type == ContactGroupEventType.Deleted) && (e.ContactGroup.Id == this._initTargetGroupId))
{
this._initTargetGroupId = null;
}
this.InitGroup();
}
protected override void Dispose(bool disposing)
{
if (disposing && (this.components != null))
{
this.components.Dispose();
}
base.Dispose(disposing);
}
private void InitGroup()
{
this.comboBoxGroup.DropDownStyle = ComboBoxStyle.DropDownList;
this.comboBoxGroup.Items.Clear();
lock (this._user.ContactList.Groups.SyncRoot)
{
foreach (Imps.Client.Core.ContactGroup group in this._user.ContactList.Groups)
{
if (group.Id != -1)
{
ComboBoxItem item = new ComboBoxItem(group.Name, group.Id);
this.comboBoxGroup.Items.Add(item);
if (this._initTargetGroupId.HasValue && (this._initTargetGroupId == group.Id))
{
this.comboBoxGroup.SelectedItem = item;
}
}
}
}
if ((!this._initTargetGroupId.HasValue || (this._initTargetGroupId == -1)) && (this.comboBoxGroup.Items.Count > 0))
{
this.comboBoxGroup.SelectedIndex = 0;
}
}
private void InitializeComponent()
{
this.components = new Container();
ComponentResourceManager manager = new ComponentResourceManager(typeof(ReceiveRequestByMobileNoForm));
this.buttonCancel = new XButton();
this.buttonOK = new XButton();
this.checkBoxBlock = new CheckBox();
this.radioButtonReject = new RadioButton();
this.radioButtonAgree = new RadioButton();
this.labelRemind = new XLabel();
this.panel1 = new Panel();
this.label1 = new XLabel();
this.panel2 = new Panel();
this.pictureBoxPortrait = new DisplayPortrait();
this.labelNickname = new XLabel();
this.linkLabelDetail = new LinkLabel();
this.labelHello = new XLabel();
this.pictureBoxAlert = new PictureBox();
this.panelInfo = new Panel();
this.comboBoxGroup = new XComboBox();
this.panel3 = new Panel();
this.linkLabelNewGroup = new LinkLabel();
XLabel label = new XLabel();
XLabel label2 = new XLabel();
this.panel1.SuspendLayout();
this.panel2.SuspendLayout();
((ISupportInitialize) this.pictureBoxAlert).BeginInit();
this.panelInfo.SuspendLayout();
this.panel3.SuspendLayout();
base.SuspendLayout();
base.menubar.Location = new Point(3, 0x19);
label.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top;
label.BorderColor = Color.Empty;
label.BorderStyle = BorderStyle.Fixed3D;
label.ButtonBorderStyle = ButtonBorderStyle.None;
label.Location = new Point(40, 0x9c);
label.Name = "label4";
label.Size = new Size(460, 2);
label.TabIndex = 2;
label.Text = "label4";
label.UseMnemonic = false;
label2.AutoSize = true;
label2.BackColor = Color.Transparent;
label2.BorderColor = Color.Empty;
label2.ButtonBorderStyle = ButtonBorderStyle.None;
label2.Font = new Font("Microsoft Sans Serif", 9f, FontStyle.Bold, GraphicsUnit.Point, 0);
label2.ForeColor = Color.RoyalBlue;
label2.Location = new Point(2, 0x93);
label2.Name = "label6";
label2.Size = new Size(0x21, 15);
label2.TabIndex = 1;
label2.Text = "回應";
label2.UseMnemonic = false;
this.buttonCancel.DialogResult = DialogResult.Cancel;
this.buttonCancel.Location = new Point(0x16e, 0x12e);
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new Size(0x4b, 0x17);
this.buttonCancel.TabIndex = 9;
this.buttonCancel.Text = "取消";
this.buttonCancel.UseVisualStyleBackColor = true;
this.buttonCancel.Click += new EventHandler(this.buttonCancel_Click);
this.buttonOK.Location = new Point(0x11d, 0x12e);
this.buttonOK.Name = "buttonOK";
this.buttonOK.Size = new Size(0x4b, 0x17);
this.buttonOK.TabIndex = 8;
this.buttonOK.Text = "確定";
this.buttonOK.UseVisualStyleBackColor = true;
this.buttonOK.Click += new EventHandler(this.buttonOK_Click);
this.checkBoxBlock.AutoSize = true;
this.checkBoxBlock.BackColor = Color.Transparent;
this.checkBoxBlock.Location = new Point(0x67, 0x114);
this.checkBoxBlock.Name = "checkBoxBlock";
this.checkBoxBlock.Size = new Size(0x86, 0x11);
this.checkBoxBlock.TabIndex = 7;
this.checkBoxBlock.Text = "拒絕此人再和我聯系";
this.checkBoxBlock.UseVisualStyleBackColor = false;
this.radioButtonReject.AutoSize = true;
this.radioButtonReject.BackColor = Color.Transparent;
this.radioButtonReject.Location = new Point(0x49, 0xff);
this.radioButtonReject.Name = "radioButtonReject";
this.radioButtonReject.Size = new Size(0x3d, 0x11);
this.radioButtonReject.TabIndex = 6;
this.radioButtonReject.TabStop = true;
this.radioButtonReject.Text = "不同意";
this.radioButtonReject.UseVisualStyleBackColor = false;
this.radioButtonReject.CheckedChanged += new EventHandler(this.radioButtonReject_CheckedChanged);
this.radioButtonAgree.AutoSize = true;
this.radioButtonAgree.BackColor = Color.Transparent;
this.radioButtonAgree.Location = new Point(0x49, 0xe4);
this.radioButtonAgree.Name = "radioButtonAgree";
this.radioButtonAgree.Size = new Size(0x79, 0x11);
this.radioButtonAgree.TabIndex = 4;
this.radioButtonAgree.TabStop = true;
this.radioButtonAgree.Text = "同意,添加到該組";
this.radioButtonAgree.UseVisualStyleBackColor = false;
this.radioButtonAgree.CheckedChanged += new EventHandler(this.radioButtonAgree_CheckedChanged);
this.labelRemind.BorderColor = Color.Empty;
this.labelRemind.ButtonBorderStyle = ButtonBorderStyle.None;
this.labelRemind.Font = new Font("Microsoft Sans Serif", 8.25f, FontStyle.Bold, GraphicsUnit.Point, 0x86);
this.labelRemind.Location = new Point(0x57, 4);
this.labelRemind.Name = "labelRemind";
this.labelRemind.Size = new Size(0x157, 0x34);
this.labelRemind.TabIndex = 0;
this.labelRemind.Text = "提醒:";
this.labelRemind.UseMnemonic = false;
this.panel1.BackColor = Color.Transparent;
this.panel1.Controls.Add(this.label1);
this.panel1.Controls.Add(this.panel2);
this.panel1.Controls.Add(this.labelHello);
this.panel1.Dock = DockStyle.Top;
this.panel1.Location = new Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new Size(0x1d0, 150);
this.panel1.TabIndex = 0;
this.label1.AutoSize = true;
this.label1.BorderColor = Color.Empty;
this.label1.ButtonBorderStyle = ButtonBorderStyle.None;
this.label1.Location = new Point(0x41, 10);
this.label1.Name = "label1";
this.label1.Size = new Size(0x2b, 13);
this.label1.TabIndex = 0;
this.label1.Text = "您好:";
this.label1.UseMnemonic = false;
this.panel2.Controls.Add(this.pictureBoxPortrait);
this.panel2.Controls.Add(this.labelNickname);
this.panel2.Controls.Add(this.linkLabelDetail);
this.panel2.Location = new Point(0xd9, 0x49);
this.panel2.Name = "panel2";
this.panel2.Size = new Size(0xe4, 0x4b);
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -