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

📄 extendprofilecontrol.cs

📁 飞信的收发使用csharp进行开发
💻 CS
📖 第 1 页 / 共 3 页
字号:
            this.lblPersonalEmail_Nav.UseMnemonic = false;
            this.label1.AutoSize = true;
            this.label1.BorderColor = Color.Empty;
            this.label1.ButtonBorderStyle = ButtonBorderStyle.None;
            this.label1.Location = new Point(0xb1, 0x130);
            this.label1.Name = "label1";
            this.label1.Size = new Size(0x4f, 13);
            this.label1.TabIndex = 50;
            this.label1.Text = "首选电子邮件";
            this.label1.UseMnemonic = false;
            this.lblOtherPhone_Nav.AutoSize = true;
            this.lblOtherPhone_Nav.BorderColor = Color.Empty;
            this.lblOtherPhone_Nav.ButtonBorderStyle = ButtonBorderStyle.None;
            this.lblOtherPhone_Nav.Location = new Point(0x13, 0x100);
            this.lblOtherPhone_Nav.Name = "lblOtherPhone_Nav";
            this.lblOtherPhone_Nav.Size = new Size(0x37, 13);
            this.lblOtherPhone_Nav.TabIndex = 0x2e;
            this.lblOtherPhone_Nav.Text = "其他电话";
            this.lblOtherPhone_Nav.UseMnemonic = false;
            this.lblWorkPhone_Nav.AutoSize = true;
            this.lblWorkPhone_Nav.BorderColor = Color.Empty;
            this.lblWorkPhone_Nav.ButtonBorderStyle = ButtonBorderStyle.None;
            this.lblWorkPhone_Nav.Location = new Point(0x13, 0xcf);
            this.lblWorkPhone_Nav.Name = "lblWorkPhone_Nav";
            this.lblWorkPhone_Nav.Size = new Size(0x37, 13);
            this.lblWorkPhone_Nav.TabIndex = 0x2a;
            this.lblWorkPhone_Nav.Text = "工作电话";
            this.lblWorkPhone_Nav.UseMnemonic = false;
            this.lblHomePhone_Nav.AutoSize = true;
            this.lblHomePhone_Nav.BorderColor = Color.Empty;
            this.lblHomePhone_Nav.ButtonBorderStyle = ButtonBorderStyle.None;
            this.lblHomePhone_Nav.Location = new Point(0x13, 0x9e);
            this.lblHomePhone_Nav.Name = "lblHomePhone_Nav";
            this.lblHomePhone_Nav.Size = new Size(0x37, 13);
            this.lblHomePhone_Nav.TabIndex = 0x26;
            this.lblHomePhone_Nav.Text = "家庭电话";
            this.lblHomePhone_Nav.UseMnemonic = false;
            this.cboBloodType.BackColor = Color.White;
            this.cboBloodType.DropDownStyle = ComboBoxStyle.DropDownList;
            this.cboBloodType.Enabled = false;
            this.cboBloodType.FormattingEnabled = true;
            this.cboBloodType.Location = new Point(0x16, 100);
            this.cboBloodType.Name = "cboBloodType";
            this.cboBloodType.Size = new Size(0xa7, 0x15);
            this.cboBloodType.TabIndex = 0x21;
            this.txtLunarAnimal.BackColor = Color.FromArgb(240, 240, 240);
            this.txtLunarAnimal.BorderStyle = BorderStyle.FixedSingle;
            this.txtLunarAnimal.Location = new Point(0xdd, 0x39);
            this.txtLunarAnimal.Name = "txtLunarAnimal";
            this.txtLunarAnimal.ReadOnly = true;
            this.txtLunarAnimal.Size = new Size(100, 20);
            this.txtLunarAnimal.TabIndex = 0x23;
            this.txtHoroscope.BackColor = Color.FromArgb(240, 240, 240);
            this.txtHoroscope.BorderStyle = BorderStyle.FixedSingle;
            this.txtHoroscope.Location = new Point(0xdd, 100);
            this.txtHoroscope.Name = "txtHoroscope";
            this.txtHoroscope.ReadOnly = true;
            this.txtHoroscope.Size = new Size(100, 20);
            this.txtHoroscope.TabIndex = 0x1f;
            this.ctlDateTime.AutoSize = true;
            this.ctlDateTime.AutoSizeMode = AutoSizeMode.GrowAndShrink;
            this.ctlDateTime.BackColor = Color.Transparent;
            this.ctlDateTime.Enabled = false;
            this.ctlDateTime.Location = new Point(0x16, 0x39);
            this.ctlDateTime.MaxDateTime = new DateTime(0x7d6, 5, 0x1d, 0, 0, 0, 0);
            this.ctlDateTime.MinDateTime = new DateTime(0x76c, 1, 1, 0, 0, 0, 0);
            this.ctlDateTime.Name = "ctlDateTime";
            this.ctlDateTime.NullYear = 0x76c;
            this.ctlDateTime.SelectedDateTime = new DateTime(0x76c, 1, 1, 0, 0, 0, 0);
            this.ctlDateTime.SelectedDay = 1;
            this.ctlDateTime.SelectedMonth = 1;
            this.ctlDateTime.SelectedYearText = "";
            this.ctlDateTime.Size = new Size(0xa7, 0x18);
            this.ctlDateTime.TabIndex = 0x1d;
            base.AutoScaleDimensions = new SizeF(6f, 13f);
            base.AutoScaleMode = AutoScaleMode.Font;
            this.BackColor = Color.Transparent;
            base.Controls.Add(this.panel1);
            base.Name = "ExtendProfileControl";
            base.Size = new Size(380, 0x167);
            this.panel1.ResumeLayout(false);
            this.panel1.PerformLayout();
            base.ResumeLayout(false);
        }

        private void InitListBoxes()
        {
            this.cboBloodType.DataSource = IMPSEnums.GetEnumDescriptionList<BloodType>();
            this.cboBloodType.DisplayMember = "Description";
            this.cboBloodType.ValueMember = "Value";
            this.cboPrimaryEmail.DataSource = IMPSEnums.GetEnumDescriptionList<EmailUseType>();
            this.cboPrimaryEmail.DisplayMember = "Description";
            this.cboPrimaryEmail.ValueMember = "Value";
        }

        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            if (!this._iFrameworkWindow.AccountManager.CurrentUser.ContactList.Contacts.Contains(this._contact))
            {
                this.ctlDateTime.Enabled = false;
                this.cboBloodType.Enabled = false;
                this.txtHomePhone.ReadOnly = true;
                this.txtOtherEmail.ReadOnly = true;
                this.txtOtherPhone.ReadOnly = true;
                this.txtPersonalEmail.ReadOnly = true;
                this.txtWorkEmail.ReadOnly = true;
                this.txtWorkPhone.ReadOnly = true;
                this.cboPrimaryEmail.Enabled = false;
            }
            this.AddStar();
            this.HandleUiChanged();
        }

        private void PersonalInfo_PropertiesChanged(object sender, PropertiesChangedEventArgs e)
        {
            UiErrorHelper.HandEventSafely(this._iFrameworkWindow, delegate {
                if (e.ContainsAnyOfProperties(new string[] { "birth-date", "blood-type", "lunar-animal", "home-phone", "other-email", "other-phone", "personal-email", "work-email", "work-phone", "primary-email" }))
                {
                    this.UpdateData(false);
                }
            });
        }

        protected override 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;
                }
                if (this.txtHomePhone.Text.Trim() != this._contact.PersonalInfo.HomePhone.Value)
                {
                    this._contact.PersonalInfo.HomePhone.UserSetDataProposedValue = this.txtHomePhone.Text;
                }
                if (this.txtOtherEmail.Text.Trim() != this._contact.PersonalInfo.OtherEmail.Value)
                {
                    this._contact.PersonalInfo.OtherEmail.UserSetDataProposedValue = this.txtOtherEmail.Text;
                }
                if (this.txtOtherPhone.Text.Trim() != this._contact.PersonalInfo.OtherPhone.Value)
                {
                    this._contact.PersonalInfo.OtherPhone.UserSetDataProposedValue = this.txtOtherPhone.Text;
                }
                if (this.txtPersonalEmail.Text.Trim() != this._contact.PersonalInfo.PersonalEmail.Value)
                {
                    this._contact.PersonalInfo.PersonalEmail.UserSetDataProposedValue = this.txtPersonalEmail.Text;
                }
                if (this.txtWorkEmail.Text.Trim() != this._contact.PersonalInfo.WorkEmail.Value)
                {
                    this._contact.PersonalInfo.WorkEmail.UserSetDataProposedValue = this.txtWorkEmail.Text;
                }
                if (this.txtWorkPhone.Text.Trim() != this._contact.PersonalInfo.WorkPhone.Value)
                {
                    this._contact.PersonalInfo.WorkPhone.UserSetDataProposedValue = this.txtWorkPhone.Text;
                }
                if ((this.cboPrimaryEmail.SelectedIndex != -1) && (((short) this.cboPrimaryEmail.SelectedValue) != this._contact.PersonalInfo.PrimaryEmail.Value))
                {
                    this._contact.PersonalInfo.PrimaryEmail.UserSetDataProposedValue = (short) this.cboPrimaryEmail.SelectedValue;
                }
                if ((this.cboBloodType.SelectedIndex != -1) && (((BloodType) this.cboBloodType.SelectedValue) != ((BloodType) this._contact.PersonalInfo.BloodType.Value)))
                {
                    this._contact.PersonalInfo.BloodType.UserSetDataProposedValue = (BloodType) this.cboBloodType.SelectedValue;
                }
                DateTime? selectedDateTime = this.ctlDateTime.SelectedDateTime;
                if (selectedDateTime != this._contact.PersonalInfo.BirthDate.Value)
                {
                    if (selectedDateTime.HasValue)
                    {
                        if (!this._contact.PersonalInfo.IsBirthdayValid.Value)
                        {
                            this._contact.PersonalInfo.IsBirthdayValid.UserSetDataProposedValue = true;
                        }
                        this._contact.PersonalInfo.BirthDate.UserSetDataProposedValue = selectedDateTime.Value;
                    }
                    else if (this._contact.PersonalInfo.IsBirthdayValid.Value)
                    {
                        this._contact.PersonalInfo.IsBirthdayValid.UserSetDataProposedValue = false;
                    }
                }
            }
            else
            {
                if (this._contact.PersonalInfo.BirthDate.Value.Year > PersonalInfoBase.NullBirthDate.Year)
                {
                    this.ctlDateTime.SelectedDateTime = new DateTime?(this._contact.PersonalInfo.BirthDate.Value);
                }
                else
                {
                    this.ctlDateTime.SelectedYearText = string.Empty;
                }
                if (this._contact.PersonalInfo.IsBirthdayValid != null)
                {
                    this.ctlDateTime.SelectedMonth = this._contact.PersonalInfo.BirthDate.Value.Month;
                    this.ctlDateTime.SelectedDay = this._contact.PersonalInfo.BirthDate.Value.Day;
                    this.FormatHoroscopeAndLunarAnimal();
                }
                else
                {
                    this.ctlDateTime.SelectedMonth = 0;
                    this.ctlDateTime.SelectedDay = 0;
                    this.txtHoroscope.Text = IMPSEnums.GetEnumDescription<Horoscope>(this._contact.PersonalInfo.Horoscope);
                    this.txtLunarAnimal.Text = IMPSEnums.GetEnumDescription<LunarAnimal>(this._contact.PersonalInfo.LunarAnimal);
                }
                this.cboBloodType.SelectedValue = this._contact.PersonalInfo.BloodType.Value;
                this.ctlDateTime.SelectedDateTimeChange += new EventHandler(this.ctlDateTime_DateTimeChange);
                this.txtHomePhone.Text = this._contact.PersonalInfo.HomePhone.Value;
                this.txtOtherEmail.Text = this._contact.PersonalInfo.OtherEmail.Value;
                this.cboPrimaryEmail.SelectedValue = EnumHelper.Int32ToEnum<EmailUseType>(this._contact.PersonalInfo.PrimaryEmail.Value, EmailUseType.PersonalEmail);
                this.txtOtherPhone.Text = this._contact.PersonalInfo.OtherPhone.Value;
                this.txtPersonalEmail.Text = this._contact.PersonalInfo.PersonalEmail.Value;
                this.txtWorkEmail.Text = this._contact.PersonalInfo.WorkEmail.Value;
                this.txtWorkPhone.Text = this._contact.PersonalInfo.WorkPhone.Value;
            }
            base.Modified = false;
            return true;
        }
    }
}

⌨️ 快捷键说明

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