📄 addmobilebuddyfeedbackform.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.WndlessControls;
using Imps.Client.Resource;
using Imps.Client.Utils;
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
public class AddMobileBuddyFeedbackForm : XIMDialog
{
private WndlessControlCollection _controlCollection;
private IFrameworkWindow _iFrameworkWindow;
private Imps.Client.Core.MobileBuddy _mobileBuddy;
private WndlessPortrait _pictureBoxPortrait;
private Imps.Client.Core.User _user;
private XButton buttonCancel;
private XButton buttonOK;
private CheckBox checkBoxOpenIIC;
private IContainer components;
private XLabel labelIIC;
private XLabel labelNickname;
private LinkLabel linkLabelDetail;
private Panel panel1;
private XTextBox textBoxLocalName;
public AddMobileBuddyFeedbackForm(IFrameworkWindow iFrameworkWindow, Imps.Client.Core.MobileBuddy mobileBuddy)
{
this.InitializeComponent();
this.initComponentRegion();
this.InitializeWndlessControl();
this._iFrameworkWindow = iFrameworkWindow;
this._mobileBuddy = mobileBuddy;
this._user = this._iFrameworkWindow.AccountManager.CurrentUser;
this._user.StatusChanged += new EventHandler<UserSatusChangedEventArgs>(this, (IntPtr) this._user_StatusChanged);
}
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 AddMobileBuddyFeedbackForm_Load(object sender, EventArgs e)
{
this._pictureBoxPortrait.Image = ImpsPortrait.GetMobilePortrait(0x30, 0x30);
this.labelIIC.Text = string.Format(StringTable.FormAddBuddy.OpenIIC, this._mobileBuddy.PersonalInfo.MobileNo);
string userSetDataProposedValue = string.Empty;
if (this._mobileBuddy.PersonalInfo.Name.HasUserSetData && !string.IsNullOrEmpty(this._mobileBuddy.PersonalInfo.Name.UserSetDataProposedValue))
{
userSetDataProposedValue = this._mobileBuddy.PersonalInfo.Name.UserSetDataProposedValue;
}
this.textBoxLocalName.MaxLength = 0x40;
if (userSetDataProposedValue.Length <= this.textBoxLocalName.MaxLength)
{
this.textBoxLocalName.Text = userSetDataProposedValue;
}
else
{
this.textBoxLocalName.Text = userSetDataProposedValue.Substring(0, this.textBoxLocalName.MaxLength);
}
}
private void buttonCancel_Click(object sender, EventArgs e)
{
base.Close();
}
private void buttonOK_Click(object sender, EventArgs e)
{
try
{
AsyncBizOperation op = new AsyncBizOperation();
if (this.textBoxLocalName.Text.Trim().Length > 0)
{
this._mobileBuddy.PersonalInfo.Name.UserSetDataProposedValue = this.textBoxLocalName.Text;
this._mobileBuddy.PersonalInfo.CommitChanges(op);
}
if (this.checkBoxOpenIIC.Checked)
{
this._user.ContactList.AsyncInviteMobileOpenIMPSService(this._mobileBuddy.PersonalInfo.MobileNo, string.Empty, op);
}
base.Close();
}
catch (Exception exception)
{
ClientLogger.WriteException(exception);
}
}
protected override void Dispose(bool disposing)
{
if (disposing && (this.components != null))
{
this.components.Dispose();
}
base.Dispose(disposing);
}
private void InitializeComponent()
{
this.labelNickname = new XLabel();
this.labelIIC = new XLabel();
this.textBoxLocalName = new XTextBox();
this.checkBoxOpenIIC = new CheckBox();
this.buttonCancel = new XButton();
this.buttonOK = new XButton();
this.panel1 = new Panel();
this.linkLabelDetail = new LinkLabel();
XLabel label = new XLabel();
XLabel label2 = new XLabel();
this.panel1.SuspendLayout();
base.SuspendLayout();
label.set_AutoSize(true);
label.BackColor = Color.Transparent;
label.BorderColor = Color.Empty;
label.ButtonBorderStyle = ButtonBorderStyle.None;
label.Font = new Font("Microsoft Sans Serif", 9f, FontStyle.Bold, GraphicsUnit.Point, 0);
label.ForeColor = Color.RoyalBlue;
label.Location = new System.Drawing.Point(3, 0x3b);
label.Name = "label1";
label.Size = new Size(0x3b, 15);
label.TabIndex = 3;
label.Text = "后续操作";
label.UseMnemonic = false;
label2.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top;
label2.BorderColor = Color.Empty;
label2.BorderStyle = BorderStyle.Fixed3D;
label2.ButtonBorderStyle = ButtonBorderStyle.None;
label2.Location = new System.Drawing.Point(0x3a, 0x42);
label2.Name = "label2";
label2.Size = new Size(0x10b, 2);
label2.TabIndex = 4;
label2.Text = "label2";
label2.UseMnemonic = false;
this.labelNickname.set_AutoSize(true);
this.labelNickname.BackColor = Color.Transparent;
this.labelNickname.BorderColor = Color.Empty;
this.labelNickname.ButtonBorderStyle = ButtonBorderStyle.None;
this.labelNickname.Location = new System.Drawing.Point(0x6b, 0x5f);
this.labelNickname.Name = "labelNickname";
this.labelNickname.Size = new Size(0x73, 13);
this.labelNickname.TabIndex = 5;
this.labelNickname.Text = "设置对方的屏显名称";
this.labelNickname.UseMnemonic = false;
this.labelIIC.BackColor = Color.Transparent;
this.labelIIC.BorderColor = Color.Empty;
this.labelIIC.ButtonBorderStyle = ButtonBorderStyle.None;
this.labelIIC.Location = new System.Drawing.Point(0x13, 0x15);
this.labelIIC.Name = "labelIIC";
this.labelIIC.Size = new Size(310, 0x21);
this.labelIIC.TabIndex = 2;
this.labelIIC.Text = "{0}已经同意了添加好友申请,成为您的手机好友。";
this.labelIIC.UseMnemonic = false;
this.textBoxLocalName.BackColor = Color.White;
this.textBoxLocalName.BorderStyle = BorderStyle.FixedSingle;
this.textBoxLocalName.EmptyTextTip = "";
this.textBoxLocalName.EmptyTextTipColor = Color.DarkGray;
this.textBoxLocalName.Location = new System.Drawing.Point(110, 0x72);
this.textBoxLocalName.MaxLength = 0x40;
this.textBoxLocalName.Name = "textBoxLocalName";
this.textBoxLocalName.Size = new Size(0xb6, 20);
this.textBoxLocalName.TabIndex = 6;
this.checkBoxOpenIIC.set_AutoSize(true);
this.checkBoxOpenIIC.BackColor = Color.Transparent;
this.checkBoxOpenIIC.Location = new System.Drawing.Point(0x20, 0xb0);
this.checkBoxOpenIIC.Name = "checkBoxOpenIIC";
this.checkBoxOpenIIC.Size = new Size(0x7a, 0x11);
this.checkBoxOpenIIC.TabIndex = 7;
this.checkBoxOpenIIC.Text = "邀请对方开通飞信";
this.checkBoxOpenIIC.set_UseVisualStyleBackColor(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, 0xe1);
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new Size(0x4b, 0x17);
this.buttonCancel.TabIndex = 9;
this.buttonCancel.Text = "取消";
this.buttonCancel.set_UseVisualStyleBackColor(false);
this.buttonCancel.Click += new EventHandler(this.buttonCancel_Click);
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.Location = new System.Drawing.Point(0xae, 0xe1);
this.buttonOK.Name = "buttonOK";
this.buttonOK.Size = new Size(0x4b, 0x17);
this.buttonOK.TabIndex = 8;
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.linkLabelDetail);
this.panel1.Controls.Add(label);
this.panel1.Controls.Add(this.checkBoxOpenIIC);
this.panel1.Controls.Add(this.textBoxLocalName);
this.panel1.Controls.Add(this.labelIIC);
this.panel1.Controls.Add(this.labelNickname);
this.panel1.Controls.Add(label2);
this.panel1.Location = new System.Drawing.Point(2, 6);
this.panel1.Name = "panel1";
this.panel1.Size = new Size(0x14f, 0xd5);
this.panel1.TabIndex = 0;
this.linkLabelDetail.set_AutoSize(true);
this.linkLabelDetail.LinkColor = Color.FromArgb(0, 0xc0, 0);
this.linkLabelDetail.Location = new System.Drawing.Point(0x13, 0x95);
this.linkLabelDetail.Name = "linkLabelDetail";
this.linkLabelDetail.Size = new Size(0x37, 13);
this.linkLabelDetail.TabIndex = 8;
this.linkLabelDetail.TabStop = true;
this.linkLabelDetail.Text = "查看资料";
this.linkLabelDetail.LinkClicked += new LinkLabelLinkClickedEventHandler(this.linkLabelDetail_LinkClicked);
base.AcceptButton = this.buttonOK;
base.set_AutoScaleDimensions(new SizeF(6f, 13f));
base.set_AutoScaleMode(1);
base.BaseHeight = 0x11e;
base.BaseWidth = 0x15b;
base.CancelButton = this.buttonCancel;
base.ClientSize = new Size(0x155, 260);
base.Controls.Add(this.panel1);
base.Controls.Add(this.buttonCancel);
base.Controls.Add(this.buttonOK);
base.DisplayLocation = new System.Drawing.Point(0x12, 0x26);
base.FormBorderStyle = FormBorderStyle.FixedSingle;
base.MinimizeBox = false;
base.Name = "AddMobileBuddyFeedbackForm";
base.set_Padding(new Padding(8));
base.Text = "添加手机好友反馈";
base.Load += new EventHandler(this.AddMobileBuddyFeedbackForm_Load);
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
base.ResumeLayout(false);
}
private void InitializeWndlessControl()
{
this._controlCollection = new WndlessControlCollection(this.panel1);
this._pictureBoxPortrait = new WndlessPortrait();
this._pictureBoxPortrait.Cursor = Cursors.Hand;
this._pictureBoxPortrait.Location = new System.Drawing.Point(0x12, 0x55);
this._pictureBoxPortrait.Size = new Size(0x40, 0x40);
this._pictureBoxPortrait.PortraitSize = 0x30;
this._pictureBoxPortrait.ToolTipText = "";
this._pictureBoxPortrait.Click += new EventHandler(this.pictureBoxPortrait_Click);
this._controlCollection.Add(this._pictureBoxPortrait);
}
private void linkLabelDetail_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
this._iFrameworkWindow.ContactManager.ShowContactDetail(this._mobileBuddy.Uri.Raw);
}
protected override void OnFormClosed(FormClosedEventArgs e)
{
this._user.StatusChanged -= new EventHandler<UserSatusChangedEventArgs>(this, (IntPtr) this._user_StatusChanged);
base.OnFormClosed(e);
}
private void pictureBoxPortrait_Click(object sender, EventArgs e)
{
this._iFrameworkWindow.ContactManager.ShowContactDetail(this._mobileBuddy.Uri.Raw);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -