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

📄 profileform.cs

📁 破解的飞信源代码
💻 CS
📖 第 1 页 / 共 2 页
字号:
                    KeyValuePair<int, ProfileNavItem> pair = enumerator.get_Current();
                    if (pair.get_Value().Name == name)
                    {
                        return pair.get_Key();
                    }
                }
            }
            finally
            {
                enumerator.Dispose();
            }
            return -1;
        }

        private bool InnerUpdateOptionsControl(bool update)
        {
            if (update)
            {
                Dictionary<int, ProfileNavItem>.Enumerator enumerator = this._profileNavItems.GetEnumerator();
                try
                {
                    while (enumerator.MoveNext())
                    {
                        ProfileNavItem item = enumerator.get_Current().get_Value();
                        if ((item.ControlAvailable && item.ProfileNavControl.Modified) && !item.ProfileNavControl.CheckUserInput())
                        {
                            return false;
                        }
                    }
                }
                finally
                {
                    enumerator.Dispose();
                }
                Dictionary<int, ProfileNavItem>.Enumerator enumerator2 = this._profileNavItems.GetEnumerator();
                try
                {
                    while (enumerator2.MoveNext())
                    {
                        ProfileNavItem item2 = enumerator2.get_Current().get_Value();
                        if ((item2.ControlAvailable && item2.ProfileNavControl.Modified) && !item2.ProfileNavControl.UpdateData(update))
                        {
                            return false;
                        }
                    }
                }
                finally
                {
                    enumerator2.Dispose();
                }
                AsyncBizOperation op = new AsyncBizOperation();
                this._host.AccountManager.CurrentUser.PermissionManager.AsyncSetContactPermission(this._contact, op);
                this._contact.PersonalInfo.CommitChanges(op);
            }
            return true;
        }

        private void lbItems_SelectedIndexChanged(object sender, EventArgs e)
        {
            UiErrorHelper.HandEventSafely(this._host, delegate {
                if (-1 != this.m_personal_options.get_selected_index())
                {
                    ProfileNavItem item = this._profileNavItems.get_Item(this.m_personal_options.get_selected_index());
                    item.ProfileNavControl.ModifiedChanged += new EventHandler(this.oc_ModifiedStateChanged);
                    this.pnlOptions.SuspendLayout();
                    this.pnlOptions.Controls.Clear();
                    this.pnlOptions.Controls.Add(item.ProfileNavControl.Control);
                    this.pnlOptions.ResumeLayout();
                }
            });
        }

        private void oc_ModifiedStateChanged(object sender, EventArgs e)
        {
            try
            {
                Dictionary<int, ProfileNavItem>.ValueCollection.Enumerator enumerator = this._profileNavItems.get_Values().GetEnumerator();
                try
                {
                    while (enumerator.MoveNext())
                    {
                        ProfileNavItem item = enumerator.get_Current();
                        if (item.ControlAvailable && item.ProfileNavControl.Modified)
                        {
                            return;
                        }
                    }
                }
                finally
                {
                    enumerator.Dispose();
                }
            }
            catch (Exception exception)
            {
                this._host.UnifiedMessageBox.ShowException(this, exception);
            }
        }

        protected override void OnCreateControl()
        {
            this.m_personal_options.Location = new System.Drawing.Point(7, 12);
            this.m_personal_options.Size = new Size(0x75, this.pnlContainer.ClientRectangle.Height - 0x1d);
            this.xRectLabel1.Location = new System.Drawing.Point(6, 11);
            this.xRectLabel1.Size = new Size(0x77, this.pnlContainer.ClientRectangle.Height - 0x1b);
            base.OnCreateControl();
        }

        protected override void OnFormClosed(FormClosedEventArgs e)
        {
            try
            {
                this._user.StatusChanged -= new EventHandler<UserSatusChangedEventArgs>(this, (IntPtr) this.CurrentUser_StatusChanged);
                this._contact.PersonalInfo.PropertiesChanged -= new EventHandler<PropertiesChangedEventArgs>(this, (IntPtr) this.PersonalInfo_PropertiesChanged);
                this.pnlOptions.Controls.Clear();
                Dictionary<int, ProfileNavItem>.ValueCollection.Enumerator enumerator = this._profileNavItems.get_Values().GetEnumerator();
                try
                {
                    while (enumerator.MoveNext())
                    {
                        ProfileNavItem item = enumerator.get_Current();
                        if (item.ControlAvailable)
                        {
                            item.ProfileNavControl.ModifiedChanged -= new EventHandler(this.oc_ModifiedStateChanged);
                            item.ProfileNavControl.ControlUnload();
                        }
                    }
                }
                finally
                {
                    enumerator.Dispose();
                }
            }
            catch (Exception exception)
            {
                ClientLogger.WriteException(exception);
            }
            base.OnFormClosed(e);
        }

        private void OnSelectingOption(object sender, listbox_widget.cancel_select_event_args args)
        {
            UiErrorHelper.HandEventSafely(this._host, delegate {
                if ((this.pnlOptions.Controls.get_Count() == 1) && (this.pnlOptions.Controls[0] is IProfileControl))
                {
                    IProfileControl control = (IProfileControl) this.pnlOptions.Controls[0];
                    if (control.Modified && !control.CheckUserInput())
                    {
                        args.Cancel = true;
                    }
                }
            });
        }

        private void op_ImpsError(object sender, ImpsErrorEventArgs e)
        {
            try
            {
                if (base.IsHandleCreated)
                {
                    this._host.UnifiedMessageBox.ShowError(this, e.Summary);
                }
            }
            catch
            {
            }
        }

        private void PersonalInfo_PropertiesChanged(object sender, PropertiesChangedEventArgs e)
        {
            if (e.ContainsAnyOfProperties(new string[] { "MobileNo", "sid", "nickname", "DisplayName", "name" }))
            {
                this.displayContactInfo();
            }
        }

        private void ProfileForm_Load(object sender, EventArgs e)
        {
            this._user.StatusChanged += new EventHandler<UserSatusChangedEventArgs>(this, (IntPtr) this.CurrentUser_StatusChanged);
            this._contact.PersonalInfo.PropertiesChanged += new EventHandler<PropertiesChangedEventArgs>(this, (IntPtr) this.PersonalInfo_PropertiesChanged);
            AsyncBizOperation op = new AsyncBizOperation();
            op.ImpsError += new EventHandler<ImpsErrorEventArgs>(this, (IntPtr) this.op_ImpsError);
            this._user.ContactList.AsyncGetContactsInfo(this._contact, op, null, false, new string[] { string.Empty });
            if (this._contact.Type != ContactType.Stranger)
            {
                this._user.PermissionManager.AsyncGetContactPermission(this._contact, op);
                this._contact.Presence.AsyncGetPresence(op);
            }
            string displayName = StringHelper.GetPaddingStringEndEllipsis(this._contact.DisplayName, 13);
            this.updateText(displayName);
            this.displayContactInfo();
            this.tbSid.ReadOnly = true;
            this.tbMobileNo.ReadOnly = true;
        }

        private void Reset()
        {
            this._profileNavItems = new Dictionary<int, ProfileNavItem>();
            this.m_personal_options.Items.Clear();
            ProfileNavCategory[] categories = this._manager.Categories;
            if (categories.Length == 1)
            {
                foreach (ProfileNavItem item in categories[0].Items)
                {
                    if ((item != null) && (((this._contact.Type == ContactType.Buddy) || (this._contact.Type == ContactType.MobileBuddy)) || (item.ControlType != typeof(PermissionControl))))
                    {
                        int num = this.m_personal_options.add(new headicon(null, item.Text));
                        this._profileNavItems.Add(num, item);
                    }
                }
                this.m_personal_options.SelectedIndex = 0;
            }
            else
            {
                foreach (ProfileNavCategory category in categories)
                {
                    foreach (ProfileNavItem item2 in category.Items)
                    {
                    }
                }
            }
        }

        public void ShowProfile()
        {
            this.ShowProfile(null, string.Empty);
        }

        public void ShowProfile(string name)
        {
            this.ShowProfile(null, name);
        }

        public void ShowProfile(IWin32Window owner)
        {
            this.ShowProfile(owner, string.Empty);
        }

        public void ShowProfile(IWin32Window owner, string name)
        {
            if (!base.Visible)
            {
                this.Reset();
            }
            int num = this.InnerFindOcpByName(name);
            if ((0 <= num) && (this.m_personal_options.Items.Count > num))
            {
                this.m_personal_options.SelectedIndex = num;
            }
            else
            {
                this.m_personal_options.SelectedIndex = 0;
            }
            if (base.Visible)
            {
                base.BringToFront();
                base.Activate();
            }
            else
            {
                if (owner == null)
                {
                    owner = this._host.MainWindow;
                }
                ControlHelper.ShowFormCenterOnParent(this, owner);
            }
        }

        private void tbMobileNo_TextChanged(object sender, EventArgs e)
        {
        }

        private void updateText(string displayName)
        {
            base.Text = string.Format("个人资料 - {0}", displayName);
        }
    }
}

⌨️ 快捷键说明

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