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

📄 profileform.cs

📁 飞信的收发使用csharp进行开发
💻 CS
📖 第 1 页 / 共 2 页
字号:
namespace Imps.Client.Pc.UIContactList
{
    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.Client.Utils;
    using Imps.Common;
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Drawing;
    using System.Windows.Forms;

    public class ProfileForm : XIMDialog
    {
        private Imps.Client.Core.Contact _contact;
        private IFrameworkWindow _host;
        private ProfileManager _manager;
        private Dictionary<int, ProfileNavItem> _profileNavItems;
        private Imps.Client.Core.User _user;
        private XButton btnCancel;
        private XButton btnOk;
        private IContainer components;
        private XLabel labelMobileNo;
        private XLabel labelSID;
        private headiconlist_drawer m_headicon_list_drawer = new headiconlist_drawer();
        private listbox_widget_t<headicon> m_personal_options = new listbox_widget_t<headicon>();
        private Panel pnlContainer;
        private Panel pnlOptions;
        private Panel pnlTop;
        private XTextBox tbMobileNo;
        private XTextBox tbSid;

        public ProfileForm(IFrameworkWindow host, Imps.Client.Core.Contact contact)
        {
            this._host = host;
            this._contact = contact;
            this._user = this._host.AccountManager.CurrentUser;
            this.m_headicon_list_drawer.show_focus = false;
            this.m_headicon_list_drawer.stretch_textarea = true;
            this.m_personal_options.Anchor = AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top;
            this.m_personal_options.Location = new Point(5, 8);
            this.m_personal_options.Name = "m_personal_options";
            this.m_personal_options.Size = new Size(0x70, 440);
            this.m_personal_options.TabIndex = 4;
            this.m_personal_options.SelectedIndexChanged += new EventHandler(this.lbItems_SelectedIndexChanged);
            this.m_personal_options.SelectedIndexChanging += new listbox_widget.cancel_select_event_handler(this.OnSelectingOption);
            this.m_personal_options.drawer = this.m_headicon_list_drawer;
            this.m_personal_options.BorderStyle = BorderStyle.FixedSingle;
            this.InitializeComponent();
            this.pnlContainer.Controls.Add(this.m_personal_options);
            if (((this._contact is Imps.Client.Core.ChatFriend) || (this._contact is Stranger)) || !this._user.ContactList.Contacts.Contains(this._contact))
            {
                this.btnOk.Visible = false;
                this.btnCancel.Text = StringTable.Common.Button_Close;
            }
            this._manager = new ProfileManager(host, contact);
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            base.Close();
        }

        private void btnOk_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.InnerUpdateOptionsControl(true))
                {
                    base.Close();
                }
            }
            catch (Exception exception)
            {
                this._host.UnifiedMessageBox.ShowError(this, exception.Message);
            }
        }

        private void CurrentUser_StatusChanged(object sender, UserSatusChangedEventArgs e)
        {
            UiErrorHelper.HandEventSafely(this._host, delegate {
                if (this.Visible)
                {
                    switch (e.NewStatus)
                    {
                        case UserAccountStatus.Logon:
                        case UserAccountStatus.Logoff:
                            this.Close();
                            return;

                        case UserAccountStatus.Logouting:
                            return;
                    }
                }
            });
        }

        private void displayContactInfo()
        {
            if (string.IsNullOrEmpty(this._contact.PersonalInfo.MobileNo))
            {
                this.tbMobileNo.Text = string.Empty;
            }
            else
            {
                this.tbMobileNo.Text = this._contact.PersonalInfo.MobileNo.ToString();
            }
            if (this._contact.Uri.Belongs(IicUriType.Sip))
            {
                this.tbSid.Text = this._contact.Uri.Sid.ToString();
            }
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void InitializeComponent()
        {
            this.components = new Container();
            ComponentResourceManager manager = new ComponentResourceManager(typeof(ProfileForm));
            this.pnlOptions = new Panel();
            this.btnCancel = new XButton();
            this.btnOk = new XButton();
            this.pnlTop = new Panel();
            this.tbMobileNo = new XTextBox();
            this.tbSid = new XTextBox();
            this.labelSID = new XLabel();
            this.labelMobileNo = new XLabel();
            this.pnlContainer = new Panel();
            this.pnlTop.SuspendLayout();
            this.pnlContainer.SuspendLayout();
            base.SuspendLayout();
            base.menubar.Location = new Point(3, 0x17);
            this.pnlOptions.Anchor = AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top;
            this.pnlOptions.BackColor = Color.Transparent;
            this.pnlOptions.Location = new Point(0x81, 0x22);
            this.pnlOptions.Name = "pnlOptions";
            this.pnlOptions.Size = new Size(370, 400);
            this.pnlOptions.TabIndex = 1;
            this.btnCancel.Anchor = AnchorStyles.Right | AnchorStyles.Bottom;
            this.btnCancel.DialogResult = DialogResult.Cancel;
            this.btnCancel.Location = new Point(420, 0x1bd);
            this.btnCancel.Name = "btnCancel";
            this.btnCancel.Size = new Size(0x4b, 0x17);
            this.btnCancel.TabIndex = 3;
            this.btnCancel.Text = "取消";
            this.btnCancel.Click += new EventHandler(this.btnCancel_Click);
            this.btnOk.Anchor = AnchorStyles.Right | AnchorStyles.Bottom;
            this.btnOk.DialogResult = DialogResult.OK;
            this.btnOk.Location = new Point(0x14d, 0x1bd);
            this.btnOk.Name = "btnOk";
            this.btnOk.Size = new Size(0x4b, 0x17);
            this.btnOk.TabIndex = 2;
            this.btnOk.Text = "确定";
            this.btnOk.Click += new EventHandler(this.btnOk_Click);
            this.pnlTop.BackColor = Color.Transparent;
            this.pnlTop.Controls.Add(this.tbMobileNo);
            this.pnlTop.Controls.Add(this.tbSid);
            this.pnlTop.Controls.Add(this.labelSID);
            this.pnlTop.Controls.Add(this.labelMobileNo);
            this.pnlTop.Location = new Point(0x81, 3);
            this.pnlTop.Name = "pnlTop";
            this.pnlTop.Size = new Size(370, 30);
            this.pnlTop.TabIndex = 0;
            this.tbMobileNo.Anchor = AnchorStyles.None;
            this.tbMobileNo.BackColor = Color.FromArgb(240, 240, 240);
            this.tbMobileNo.BorderStyle = BorderStyle.FixedSingle;
            this.tbMobileNo.Location = new Point(0x48, 6);
            this.tbMobileNo.Name = "tbMobileNo";
            this.tbMobileNo.Size = new Size(100, 20);
            this.tbMobileNo.TabIndex = 1;
            this.tbSid.Anchor = AnchorStyles.None;
            this.tbSid.BackColor = Color.FromArgb(240, 240, 240);
            this.tbSid.BorderStyle = BorderStyle.FixedSingle;
            this.tbSid.Location = new Point(0x105, 6);
            this.tbSid.Name = "tbSid";
            this.tbSid.Size = new Size(0x57, 20);
            this.tbSid.TabIndex = 3;
            this.labelSID.AutoSize = true;
            this.labelSID.Location = new Point(0xc9, 10);
            this.labelSID.Name = "labelSID";
            this.labelSID.Size = new Size(60, 13);
            this.labelSID.TabIndex = 2;
            this.labelSID.Text = "Fetion号:";
            this.labelMobileNo.Anchor = AnchorStyles.None;
            this.labelMobileNo.AutoSize = true;
            this.labelMobileNo.Location = new Point(8, 10);
            this.labelMobileNo.Name = "labelMobileNo";
            this.labelMobileNo.Size = new Size(0x43, 13);
            this.labelMobileNo.TabIndex = 0;
            this.labelMobileNo.Text = "手机号码:";
            this.pnlContainer.BackColor = Color.Transparent;
            this.pnlContainer.Controls.Add(this.btnOk);
            this.pnlContainer.Controls.Add(this.btnCancel);
            this.pnlContainer.Controls.Add(this.pnlOptions);
            this.pnlContainer.Controls.Add(this.pnlTop);
            this.pnlContainer.Dock = DockStyle.Fill;
            this.pnlContainer.Location = new Point(3, 3);
            this.pnlContainer.Name = "pnlContainer";
            this.pnlContainer.Size = new Size(0x203, 0x1df);
            this.pnlContainer.TabIndex = 0;
            base.AcceptButton = this.btnOk;
            base.AutoScaleDimensions = new SizeF(6f, 13f);
            base.AutoScaleMode = AutoScaleMode.Font;
            base.CancelButton = this.btnCancel;
            base.ClientSize = new Size(0x209, 0x1e5);
            base.Controls.Add(this.pnlContainer);
            base.Icon = (Icon) manager.GetObject("$this.Icon");
            base.MinimizeBox = false;
            base.Name = "ProfileForm";
            base.Padding = new Padding(3);
            base.ShowInTaskbar = false;
            base.StartPosition = FormStartPosition.Manual;
            base.Load += new EventHandler(this.ProfileForm_Load);
            base.Controls.SetChildIndex(base.menubar, 0);
            base.Controls.SetChildIndex(this.pnlContainer, 0);
            this.pnlTop.ResumeLayout(false);
            this.pnlTop.PerformLayout();
            this.pnlContainer.ResumeLayout(false);
            base.ResumeLayout(false);
        }

        private int InnerFindOcpByName(string name)
        {
            foreach (KeyValuePair<int, ProfileNavItem> pair in this._profileNavItems)
            {
                if (pair.Value.Name == name)
                {
                    return pair.Key;
                }
            }
            return -1;
        }

        private bool InnerUpdateOptionsControl(bool update)
        {
            if (update)
            {
                Dictionary<int, ProfileNavItem>.Enumerator enumerator = this._profileNavItems.GetEnumerator();

⌨️ 快捷键说明

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