📄 sendrequestform.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.Pc.Utils;
using Imps.Client.Pc.WndlessControls;
using Imps.Client.Pc.XControls;
using Imps.Client.Resource;
using Imps.Client.Utils;
using Imps.Common;
using Imps.Utils;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows.Forms;
public class SendRequestForm : XIMDialog
{
private bool _allowSendRequestAgain;
private bool _checkSID;
private Imps.Common.ContactType _contactType;
private WndlessControlCollection _controlCollection;
private IFrameworkWindow _frameworkWindow;
private bool _hasDisplayTip;
private string _initDesc;
private string _initMobileNo;
private long? _initSid;
private int? _initTargetGroupId;
private int? _initTargetGroupIdV;
private Imps.Client.Core.Contact _lastContact;
private Imps.Client.Core.Contact _lastContactVodafone;
private DateTime _textCheckedTime;
private Imps.Client.Core.User _user;
private XButton buttonCancel;
private XButton buttonOK;
private EventHandler checkEventHandler;
private XComboBox comboBoxGroup;
private XComboBox comboBoxGroupV;
private IContainer components;
private GroupBox groupBox1;
private GroupBox groupBoxPreview;
private XLabel label15;
private Label label3;
private Label label4;
private XLabel label5;
private XLabel labelAlert;
private XLabel lbIAm;
private LinkLabel linkLabelDetail;
private LinkLabel linkLabelMobileNoHint;
private UButton linkLabelNewGroup;
private LinkLabel linkLabelNewGroupV;
private LinkLabel linkLabelNicknameMobileNoV;
private LinkLabel linkLabelNicknameSIDV;
private static object locker = new object();
private Panel panel1;
private Panel panelAddBuddy;
private Panel panelTop;
private WndlessPortrait pictureBoxPortrait;
private RadioButton radioButtonMobileNo;
private RadioButton radioButtonMobileNoV;
private RadioButton radioButtonSID;
private RadioButton radioButtonSIDV;
private XTabControl tabControlAddBuddy;
private XTabPage tabPageImps;
private XTabPage tabPageVodafone;
private XTextBox textBoxMobileNo;
private XTextBox textBoxMyName;
private XTextBox textBoxSID;
private XTextBox xTextBoxMobileNoV;
private XTextBox xTextBoxNickname;
private XTextBox xTextBoxNicknameV;
private XTextBox xTextBoxSIDV;
public SendRequestForm(IFrameworkWindow frameworkWindow) : this(frameworkWindow, null, null, string.Empty, null, Imps.Common.ContactType.ImpsContact)
{
}
public SendRequestForm(IFrameworkWindow frameworkWindow, string mobileNo, long? sid, string desc, int? targetGroupId, Imps.Common.ContactType contactType)
{
this._textCheckedTime = DateTime.Now;
this.InitializeComponent();
this.InitializeWndlessControl();
this._frameworkWindow = frameworkWindow;
this._user = this._frameworkWindow.AccountManager.CurrentUser;
this._user.StatusChanged += new EventHandler<UserSatusChangedEventArgs>(this, (IntPtr) this._user_StatusChanged);
this._user.ContactList.ContactGroupChanged += new EventHandler<ContactGroupChangedEventArgs>(this, (IntPtr) this.ContactList_ContactGroupChanged);
this._initMobileNo = mobileNo;
this._initDesc = desc;
this._initSid = sid;
this._initTargetGroupId = targetGroupId;
this._initTargetGroupIdV = targetGroupId;
this._contactType = contactType;
this.checkEventHandler = new EventHandler(this.checkSID);
}
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
{
string text6;
long sid;
string text8;
string text11;
string text13;
int? nullable = null;
if (this.comboBoxGroup.Items.Count > 0)
{
ComboBoxItem selectedItem = (ComboBoxItem) this.comboBoxGroup.SelectedItem;
if (selectedItem == null)
{
this._frameworkWindow.UnifiedMessageBox.ShowWarning(this, StringTable.Contact.PlsSelectGroup);
return;
}
if (Convert.ToInt32(selectedItem.Value) == -1)
{
this._frameworkWindow.UnifiedMessageBox.ShowWarning(this, StringTable.Contact.PlsSelectGroup);
return;
}
nullable = new int?(Convert.ToInt32(selectedItem.Value));
}
bool isByMobileNo = false;
string id = string.Empty;
string domain = string.Empty;
int? targetGroupId = null;
string localName = string.Empty;
Imps.Client.Core.ContactList.AddBuddyExtraData extraData = new Imps.Client.Core.ContactList.AddBuddyExtraData();
bool sendRequestAgain = false;
bool copyWhenExist = false;
bool? invite = null;
AsyncBizOperation op = new AsyncBizOperation();
if (this.tabControlAddBuddy.SelectedIndex != 0)
{
goto Label_064D;
}
domain = "fetion";
if (!this.radioButtonMobileNo.Checked)
{
goto Label_036B;
}
if (this.textBoxMobileNo.Text.Trim().Length == 0)
{
this._frameworkWindow.UnifiedMessageBox.ShowWarning(this, StringTable.Contact.AddBuddy_MobileNoEmpty);
this.textBoxMobileNo.Focus();
return;
}
if (this.textBoxMobileNo.Text.Trim().Length != 11)
{
this._frameworkWindow.UnifiedMessageBox.ShowWarning(this, StringTable.Contact.InvalidMobileNo);
this.textBoxMobileNo.Focus();
return;
}
if (this.textBoxMyName.Text.Trim().Length == 0)
{
BalloonHelper.ShowBallon(this.textBoxMyName, StringTable.Contact.AddBuddy_MyNameEmptyMobileNo, "请注意!", 1, 0xbb8);
this.textBoxMyName.Focus();
return;
}
if (Encoding.GetEncoding(0x3a8).GetByteCount(this.textBoxMyName.Text) > 10)
{
BalloonHelper.ShowBallon(this.textBoxMyName, StringTable.Contact.AddBuddy_MyNameTooLong, "请注意!", 1, 0xbb8);
this.textBoxMyName.Focus();
return;
}
string telNo = this.textBoxMobileNo.Text.Trim();
if (telNo == this._user.PersonalInfo.MobileNo)
{
this._frameworkWindow.UnifiedMessageBox.ShowWarning(this, StringTable.Contact.CannotAddYouself);
return;
}
IicUri uri = IicUri.CreateTelUri(telNo);
Imps.Client.Core.Contact contact = this._user.ContactList.FindContactByMsisdnEx(uri.MobileNo);
if (contact == null)
{
goto Label_035C;
}
int? relationStatus = contact.RelationStatus;
if (!((relationStatus.GetValueOrDefault() == 1) && relationStatus.get_HasValue()))
{
goto Label_035C;
}
string paddingStringEndEllipsis = string.Empty;
using (IEnumerator<int> enumerator = contact.BelongToGroups.GetEnumerator())
{
while (enumerator.MoveNext())
{
int num = enumerator.get_Current();
Imps.Client.Core.ContactGroup group = this._user.ContactList.Groups[new int?(num)] as Imps.Client.Core.ContactGroup;
if (group != null)
{
paddingStringEndEllipsis = StringHelper.GetPaddingStringEndEllipsis(group.Name, 20);
goto Label_02F2;
}
}
}
Label_02F2:
if (paddingStringEndEllipsis.Length > 0)
{
text6 = string.Format(StringTable.Contact.ContactAlreadyExistInBuddy_WithGroup, contact.DisplayName.Replace("&", "&&"), paddingStringEndEllipsis);
}
else
{
text6 = string.Format(StringTable.Contact.ContactAlreadyExistInBuddy, contact.DisplayName.Replace("&", "&&"));
}
this._frameworkWindow.UnifiedMessageBox.ShowWarning(this, text6);
return;
Label_035C:
isByMobileNo = true;
id = uri.MobileNo;
goto Label_05C3;
Label_036B:
if (!this.radioButtonSID.Checked)
{
goto Label_05C3;
}
if (this.textBoxSID.Text.Trim().Length == 0)
{
this._frameworkWindow.UnifiedMessageBox.ShowWarning(this, StringTable.Contact.PlsInputSID);
this.textBoxSID.Focus();
return;
}
if (this.textBoxMyName.Text.Trim().Length == 0)
{
BalloonHelper.ShowBallon(this.textBoxMyName, StringTable.Contact.AddBuddy_MyNameEmptySID, "请注意!", 1, 0xbb8);
this.textBoxMyName.Focus();
return;
}
if (Encoding.GetEncoding(0x3a8).GetByteCount(this.textBoxMyName.Text) > 10)
{
BalloonHelper.ShowBallon(this.textBoxMyName, StringTable.Contact.AddBuddy_MyNameTooLong, "请注意!", 1, 0xbb8);
this.textBoxMyName.Focus();
return;
}
long.TryParse(this.textBoxSID.Text, ref sid);
this.textBoxSID.Text = sid.ToString();
if (sid == this._user.Sid)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -