📄 personalgroup.cs
字号:
namespace Imps.Client.Core
{
using Imps.Client.Utils;
using Imps.Common;
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
public class PersonalGroup : UserItemBase, IComparable<PersonalGroup>, IDisposable
{
private string _attributeVersion;
private Conversation _groupConv;
private PersonalGroupInfo _groupInfo;
private PersonalGroupLoadStatus _memberLoadStatus;
private PersonalGroupMemberCollection _members;
private IicUri _uri;
private PersonalGroupUserInfo _userInfo;
public event EventHandler<GroupLoadStatusChangedEventArgs> MemberLoadStatusChanged;
internal PersonalGroup(User owner, string uri) : base(owner)
{
this._attributeVersion = string.Empty;
this._uri = new IicUri(uri);
}
public int CompareTo(PersonalGroup other)
{
if (other == null)
{
return 1;
}
if (this.UserInfo.GroupUserIdentity.Value == other.UserInfo.GroupUserIdentity.Value)
{
return string.Compare((string) this.GroupInfo.Name, (string) other.GroupInfo.Name);
}
return (this.UserInfo.GroupUserIdentity.Value - other.UserInfo.GroupUserIdentity.Value);
}
public void Dispose()
{
try
{
if (this.GroupConversation != null)
{
this.GroupConversation.Close();
}
if (this.Members != null)
{
this.Members.Clear();
}
if (this.MemberLoadStatusChanged != null)
{
this.MemberLoadStatusChanged = null;
}
this.GroupInfo = null;
this.UserInfo = null;
}
catch (Exception exception)
{
ClientLogger.WriteException(exception);
}
}
internal void OnMemberLoadStatusChanged(GroupLoadStatusChangedEventArgs e)
{
if (this.MemberLoadStatusChanged != null)
{
FuncDispatcher.InvokeEventHandlerInUiThread<GroupLoadStatusChangedEventArgs>(this, this.MemberLoadStatusChanged, e);
}
}
internal string AttributeVersion
{
get
{
return this._attributeVersion;
}
set
{
this._attributeVersion = value;
}
}
public Conversation GroupConversation
{
get
{
return this._groupConv;
}
internal set
{
this._groupConv = value;
}
}
public PersonalGroupInfo GroupInfo
{
get
{
if (this._groupInfo == null)
{
this._groupInfo = new PersonalGroupInfo(this);
}
return this._groupInfo;
}
internal set
{
this._groupInfo = value;
if (this._groupInfo != null)
{
this._groupInfo.Owner = this;
}
}
}
public PersonalGroupLoadStatus MemberLoadStatus
{
get
{
return this._memberLoadStatus;
}
internal set
{
this._memberLoadStatus = value;
}
}
public PersonalGroupMemberCollection Members
{
get
{
if (this._members == null)
{
this._members = new PersonalGroupMemberCollection(base.Owner);
}
return this._members;
}
}
public PersonalGroupMember SuperManger
{
get
{
lock (this.Members.SyncObject)
{
using (IEnumerator<PersonalGroupMember> enumerator = this.Members.GetEnumerator())
{
while (enumerator.MoveNext())
{
PersonalGroupMember member = enumerator.get_Current();
if (((UserIdentity) member.GroupMemeberInfo.GroupUserIdentity.Value) == UserIdentity.SuperManager)
{
return member;
}
}
}
return null;
}
}
}
public IicUri Uri
{
get
{
return this._uri;
}
}
public PersonalGroupUserInfo UserInfo
{
get
{
if (this._userInfo == null)
{
this._userInfo = new PersonalGroupUserInfo(this);
}
return this._userInfo;
}
internal set
{
this._userInfo = value;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -