📄 personalinfobase.cs
字号:
namespace Imps.Client.Core
{
using Imps.Common;
using Imps.Utils;
using System;
using System.Drawing;
public abstract class PersonalInfoBase : PropertyDictionary, ICommittable
{
private string _localPortraitCrc;
private Image _portraitMedium;
private Image _portraitSmall;
private Image _portraitSmallMedium;
private object _syncObjPortrait = new object();
private string _version = string.Empty;
public static DateTime NullBirthDate = new DateTime(0x76c, 1, 1);
protected PersonalInfoBase()
{
}
internal override void Clear()
{
base.Clear();
this._version = string.Empty;
this._portraitMedium = null;
this._portraitSmall = null;
this._portraitSmallMedium = null;
}
public bool CommitChanges(AsyncBizOperation op)
{
this.CommitProposedProperties(op);
return true;
}
internal void SetPortrait(Image portrait, string crc)
{
lock (this._syncObjPortrait)
{
this._portraitMedium = null;
this._portraitSmall = null;
this._portraitSmallMedium = null;
base.InnerSetPropertyValue<Image>("Portrait", portrait);
this._localPortraitCrc = crc;
Contact contact = this.OwnerUser.ContactList.Contacts.FindContact(this.OwnerUri.Raw);
if ((contact != null) && (contact is ImpsContact))
{
((ImpsContact) contact).InnerOnPortaitChanged(EventArgs.Empty);
}
}
}
public abstract Gender InnerGender { get; }
public string LocalPortraitCrc
{
get
{
return this._localPortraitCrc;
}
}
public string MobileNo
{
get
{
return base.InnerGetPropertyValue<string>("MobileNo", string.Empty);
}
internal set
{
base.InnerSetPropertyValue<string>("MobileNo", value);
}
}
protected abstract IicUri OwnerUri { get; }
protected abstract User OwnerUser { get; }
public Image Portrait
{
get
{
lock (this._syncObjPortrait)
{
Image portrait = base.InnerGetPropertyValue<Image>("Portrait");
if (portrait == null)
{
portrait = this.OwnerUser.PortraitDownloader.GetPortrait(this, DownloadPortraitPriority.Normal);
this.SetPortrait(portrait, string.Empty);
}
return portrait;
}
}
}
public string PortraitCrc
{
get
{
return base.InnerGetPropertyValue<string>("portrait-crc");
}
internal set
{
base.InnerSetPropertyValue<string>("portrait-crc", value);
}
}
public Image PortraitMedium
{
get
{
if (this._portraitMedium == null)
{
int size = 0x40;
this._portraitMedium = ImageHelper.TryGetSquareThumbnailImage(this.Portrait, size);
}
return this._portraitMedium;
}
}
public Image PortraitSamll
{
get
{
if (this._portraitSmall == null)
{
int size = 0x18;
this._portraitSmall = ImageHelper.TryGetSquareThumbnailImage(this.Portrait, size);
}
return this._portraitSmall;
}
}
public Image PortraitSamllMedium
{
get
{
if (this._portraitSmallMedium == null)
{
int size = 0x30;
this._portraitSmallMedium = ImageHelper.TryGetSquareThumbnailImage(this.Portrait, size);
}
return this._portraitSmallMedium;
}
}
internal string Version
{
get
{
return this._version;
}
set
{
this._version = value;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -