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

📄 receiverequestvodafoneform.cs

📁 破解的飞信源代码
💻 CS
📖 第 1 页 / 共 3 页
字号:
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.Utils;
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Drawing;
    using System.Windows.Forms;

    public class ReceiveRequestVodafoneForm : XIMDialog
    {
        private Imps.Client.Core.Contact _contact;
        private bool _hasHandleRequest;
        private IFrameworkWindow _iFarmeworkWindow;
        private int? _initTargetGroupId;
        private bool _isServiceSubscribed;
        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 labelAlert;
        private XLabel labelHello;
        private XLabel labelNickname;
        private LinkLabel linkLabelDetail;
        private LinkLabel linkLabelNewGroup;
        private Panel panel1;
        private Panel panel2;
        private Panel panelAlert;
        private Panel panelContact;
        private Panel panelLine;
        private Panel panelReject;
        private Panel panelRequest;
        private DisplayPortrait pictureBoxPortrait;
        private RadioButton radioButtonAgree;
        private RadioButton radioButtonReject;
        private RadioButton radioButtonServiceAccept;
        private RadioButton radioButtonServiceReject;

        public ReceiveRequestVodafoneForm(IFrameworkWindow iFrameworkWnd, Imps.Client.Core.Contact contact)
        {
            this.InitializeComponent();
            this._iFarmeworkWindow = iFrameworkWnd;
            this._user = this._iFarmeworkWindow.AccountManager.CurrentUser;
            this._contact = contact;
            this._user.StatusChanged += new EventHandler<UserSatusChangedEventArgs>(this, (IntPtr) this._user_StatusChanged);
            this._contact.PersonalInfo.PropertiesChanged += new EventHandler<PropertiesChangedEventArgs>(this, (IntPtr) this.contactPersonalInfo_PropertiesChanged);
            this._user.ContactList.ContactGroupChanged += new EventHandler<ContactGroupChangedEventArgs>(this, (IntPtr) this.ContactList_ContactGroupChanged);
            this._isServiceSubscribed = this._user.IsServiceSubscribed("VodafoneFederation");
        }

        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._isServiceSubscribed)
                {
                    if (this.radioButtonServiceAccept.Checked)
                    {
                        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;
                            if (((int) selectedItem.Value) <= 0)
                            {
                                this._iFarmeworkWindow.UnifiedMessageBox.ShowInfo(StringTable.FormAddBuddy.MustSelectGroup);
                                return;
                            }
                        }
                        AsyncBizOperation op = new AsyncBizOperation();
                        op.Successed += new EventHandler(this.vodafoneServiceSubscribe_Successed);
                        this._user.AsyncSubscribeService("VodafoneFederation", op);
                    }
                    else
                    {
                        base.Close();
                    }
                }
                else 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 item2 = (ComboBoxItem) this.comboBoxGroup.SelectedItem;
                        targetGroupId = new int?((int) item2.Value);
                        if (((int) item2.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 operation2 = new AsyncBizOperation();
                    this._user.ContactList.AsyncHandleContactRequest(this._contact.Uri.ToString(), result, isBlock, targetGroupId, true, string.Empty, operation2);
                    if (this.checkBoxBlock.Checked)
                    {
                        this._user.ContactList.AsyncAddToBlackList(this._contact.Uri, operation2);
                    }
                    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)
            {
                int? nullable = this._initTargetGroupId;
                if ((e.ContactGroup.Id == nullable.GetValueOrDefault()) && nullable.get_HasValue())
                {
                    this._initTargetGroupId = null;
                }
            }
            this.InitGroup();
        }

        private void contactPersonalInfo_PropertiesChanged(object sender, PropertiesChangedEventArgs e)
        {
            if (e.ContainsAnyOfProperties(new string[] { "Portrait", "nickname" }))
            {
                this.setUI();
            }
        }

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

        private void InitGroup()
        {
            this.comboBoxGroup.Items.Clear();
            lock (this._user.ContactList.Groups.SyncRoot)
            {
                using (IEnumerator<ContactGroupBase> enumerator = this._user.ContactList.Groups.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        Imps.Client.Core.ContactGroup group = (Imps.Client.Core.ContactGroup) enumerator.get_Current();
                        if (group.Id != -1)
                        {
                            ComboBoxItem item = new ComboBoxItem(group.Name, group.Id);
                            this.comboBoxGroup.Items.Add(item);
                            if (this._initTargetGroupId.get_HasValue())
                            {
                                int? nullable = this._initTargetGroupId;
                                if ((nullable.GetValueOrDefault() == group.Id) && nullable.get_HasValue())
                                {
                                    this.comboBoxGroup.SelectedItem = item;
                                }
                            }
                        }
                    }
                }
            }
            if (this._initTargetGroupId.get_HasValue())
            {
                int? nullable2 = this._initTargetGroupId;
                if (!((nullable2.GetValueOrDefault() == -1) && nullable2.get_HasValue()))
                {
                    return;
                }
            }
            if (this.comboBoxGroup.Items.Count > 0)
            {
                this.comboBoxGroup.SelectedIndex = 0;
            }
        }

        private void InitializeComponent()
        {
            ComponentResourceManager manager = new ComponentResourceManager(typeof(ReceiveRequestVodafoneForm));
            this.panelContact = 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();

⌨️ 快捷键说明

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