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

📄 psexcontrol.cs

📁 飞信的收发使用csharp进行开发
💻 CS
📖 第 1 页 / 共 3 页
字号:
                    finally
                    {
                        this._duringAgeOrBirthdayChanging = false;
                    }
                }
            });
        }

        private void numericUpDownAge_ValueChanged(object sender, EventArgs e)
        {
            UiErrorHelper.HandEventSafely(this._iFrameworkWindow, delegate {
                if (!this._duringAgeOrBirthdayChanging)
                {
                    this._duringAgeOrBirthdayChanging = true;
                    try
                    {
                        int age = Convert.ToInt32(this.numericUpDownAge.Value);
                        if (age != 0)
                        {
                            DateTime time;
                            if ((this.ctlBirthdate.SelectedMonth != 0) && (this.ctlBirthdate.SelectedDay != 0))
                            {
                                time = ImpsHelper.AgeToBirthday(age, this.ctlBirthdate.SelectedMonth, this.ctlBirthdate.SelectedDay);
                            }
                            else
                            {
                                time = ImpsHelper.AgeToBirthday(age, 1, 1);
                            }
                            this.ctlBirthdate.SelectedYearText = time.Year.ToString();
                        }
                        else
                        {
                            this.ctlBirthdate.SelectedYearText = string.Empty;
                        }
                    }
                    finally
                    {
                        this._duringAgeOrBirthdayChanging = false;
                    }
                }
            });
        }

        private void PsExControl_TextChanged(object sender, EventArgs e)
        {
            try
            {
                if (!this._duringAgeOrBirthdayChanging)
                {
                    if (((Control) sender).Text.Trim() == "0")
                    {
                        ((Control) sender).Text = string.Empty;
                    }
                    if (((Control) sender).Text.Trim().Length == 0)
                    {
                        this.ctlBirthdate.SelectedYearText = string.Empty;
                        this.numericUpDownAge.Value = 0M;
                    }
                }
            }
            catch
            {
            }
        }

        private void SetBirthDate(DateTime? birthday)
        {
            this.textBoxHoroscope.Text = IMPSEnums.GetEnumDescription<Horoscope>(this.ctlBirthdate.Horoscope);
            this.textBoxLunarAnimal.Text = this.ctlBirthdate.LunalAnimal;
            if (!this._duringAgeOrBirthdayChanging)
            {
                this._duringAgeOrBirthdayChanging = true;
                try
                {
                    int num = 0;
                    birthday = this.ctlBirthdate.SelectedDateTime;
                    if (birthday.HasValue && birthday.HasValue)
                    {
                        num = ImpsHelper.BirthdayToAge(birthday.Value, Imps.Client.Core.User.ServerTime);
                    }
                    if (birthday == new DateTime(0x76c, 1, 1))
                    {
                        this.numericUpDownAge.Text = string.Empty;
                    }
                    else if ((num < 1) || (num > 0x63))
                    {
                        this.numericUpDownAge.ResetText();
                    }
                    else
                    {
                        if (this.numericUpDownAge.Text.Length <= 0)
                        {
                            this.numericUpDownAge.Text = num.ToString();
                        }
                        this.numericUpDownAge.Value = num;
                    }
                }
                finally
                {
                    this._duringAgeOrBirthdayChanging = false;
                }
            }
        }

        private void SetLimitation()
        {
            this.textBoxPersonalEmail.MaxLength = 0x40;
            this.textBoxWorkEmail.MaxLength = 0x40;
            this.textBoxOtherEmail.MaxLength = 0x40;
            ControlHelper.ForceControlImeDisable(this.textBoxPersonalEmail);
            ControlHelper.ForceControlImeDisable(this.textBoxWorkEmail);
            ControlHelper.ForceControlImeDisable(this.textBoxOtherEmail);
            ControlHelper.ForceControlImeDisable(this.numericUpDownAge);
        }

        private void uiData_Changed(object sender, EventArgs e)
        {
            UiErrorHelper.HandEventSafely(this._iFrameworkWindow, delegate {
                base.Modified = true;
            });
        }

        public override bool UpdateData(bool update)
        {
            if (update)
            {
                if (!this.CheckUserInput())
                {
                    return false;
                }
                try
                {
                    DateTime? selectedDateTime = this.ctlBirthdate.SelectedDateTime;
                    DateTime date = selectedDateTime.HasValue ? selectedDateTime.GetValueOrDefault() : new DateTime(0x76c, 1, 1);
                    this._user.PersonalInfo.BirthDate.ProposedValue = date;
                    this._user.PersonalInfo.Horoscope.ProposedValue = calHoroscope(date);
                    this._user.PersonalInfo.LunarAnimal.ProposedValue = calLunarAnimal(date);
                    this._user.PersonalInfo.IsBirthdayValid.ProposedValue = this.ctlBirthdate.SelectedDay != 0;
                    if (this.comboBoxBloodType.SelectedValue != null)
                    {
                        this._user.PersonalInfo.BloodType.ProposedValue = (BloodType) this.comboBoxBloodType.SelectedValue;
                    }
                    this._user.PersonalInfo.PersonalEmail.ProposedValue = this.textBoxPersonalEmail.Text.Trim();
                    this._user.PersonalInfo.WorkEmail.ProposedValue = this.textBoxWorkEmail.Text.Trim();
                    this._user.PersonalInfo.OtherEmail.ProposedValue = this.textBoxOtherEmail.Text.Trim();
                    if (this.comboBoxEmail.SelectedValue != null)
                    {
                        this._user.PersonalInfo.PrimaryEmail.ProposedValue = (short) this.comboBoxEmail.SelectedValue;
                    }
                    if (this.xcbPerBirthday.SelectedValue != null)
                    {
                        this._user.GlobalPermission.PermissionPointBirthday.Value.ProposedValue = (int) this.xcbPerBirthday.SelectedValue;
                    }
                    if (this.xcbPerEmail.SelectedValue != null)
                    {
                        this._user.GlobalPermission.PermissionPointEmail.Value.ProposedValue = (int) this.xcbPerEmail.SelectedValue;
                    }
                    base.Modified = false;
                }
                catch (Exception exception)
                {
                    this._iFrameworkWindow.UnifiedMessageBox.ShowError(this, exception.ToString());
                }
            }
            else
            {
                try
                {
                    if (this._user.PersonalInfo.BirthDate != null)
                    {
                        this.ctlBirthdate.SelectedDateTime = new DateTime?(this._user.PersonalInfo.BirthDate.Value);
                        if (this.ctlBirthdate.SelectedDateTime.Value.Year == 0x76c)
                        {
                            this.ctlBirthdate.SelectedYearText = string.Empty;
                        }
                        if (this._user.PersonalInfo.IsBirthdayValid == null)
                        {
                            this.ctlBirthdate.SelectedMonth = 0;
                            this.ctlBirthdate.SelectedDay = 0;
                        }
                    }
                    this.comboBoxBloodType.SelectedValue = this._user.PersonalInfo.BloodType.Value;
                    this.textBoxPersonalEmail.Text = this._user.PersonalInfo.PersonalEmail.Value;
                    this.textBoxWorkEmail.Text = this._user.PersonalInfo.WorkEmail.Value;
                    this.textBoxOtherEmail.Text = this._user.PersonalInfo.OtherEmail.Value;
                    this.comboBoxEmail.SelectedValue = EnumHelper.Int32ToEnum<EmailUseType>(this._user.PersonalInfo.PrimaryEmail.Value, EmailUseType.PersonalEmail);
                    this.xcbPerBirthday.SelectedValue = this._user.GlobalPermission.PermissionPointBirthday.Value.Value;
                    this.xcbPerEmail.SelectedValue = this._user.GlobalPermission.PermissionPointEmail.Value.Value;
                }
                catch (Exception exception2)
                {
                    ClientLogger.WriteException(exception2);
                    return false;
                }
                finally
                {
                    base.Modified = false;
                }
            }
            return true;
        }

        private void xcbPerBirthday_MouseHover(object sender, EventArgs e)
        {
            BalloonHelper.ShowBallon(this.xcbPerBirthday, "您的年龄默认是公开的!", "温馨提示", ToolTipIcon.Info, 0x5dc);
        }

        private Imps.Client.Core.User _user
        {
            get
            {
                return this._iFrameworkWindow.AccountManager.CurrentUser;
            }
        }
    }
}

⌨️ 快捷键说明

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