📄 personalgroupmanager.cs
字号:
}
if (description != null)
{
XIMDialog form = null;
switch (num)
{
case 1:
form = new AgreementForm(this._framework, description);
form.WindowState = FormWindowState.Minimized;
form.Show(this._framework.MainWindow);
ControlHelper.FlashWindow(form);
break;
case -1:
form = new ImpsMessageBox(this._framework.MainWindow, description, MessageBoxButtons.OK, MessageBoxIcon.Question);
form.ShowInTaskbar = true;
form.WindowState = FormWindowState.Minimized;
form.Show();
ControlHelper.FlashWindow(form);
break;
}
if ((form != null) && !this.CurrentUser.Presence.IsBusy)
{
try
{
SystemInfoNotify _notifyWnd = new SystemInfoNotify("系统消息", description);
_notifyWnd.Click += delegate {
form.Activate();
form.WindowState = FormWindowState.Normal;
_notifyWnd.Close();
};
NotifyWindowManager.Add(_notifyWnd);
}
catch (Exception exception)
{
ClientLogger.WriteException(exception);
}
}
}
}
public void PersonalGroupManager_MemberDestroyed(object sender, MemberDestroyedEventArgs e)
{
string content = null;
string details = null;
if (this.CurrentUser.PersonalGroups[e.GroupUri] != null)
{
try
{
string id = string.Empty;
IicUri uri = new IicUri(e.MemberUri);
id = uri.Id;
if (((UserIdentity) e.Member.GroupMemeberInfo.GroupUserIdentity.Value) == UserIdentity.SuperManager)
{
content = string.Format("群{1}({0})将于{2}删除!", this.CurrentUser.PersonalGroups[e.GroupUri].GroupInfo.Id, this.CurrentUser.PersonalGroups[e.GroupUri].GroupInfo.Name, e.EndDate.ToShortDateString());
details = string.Format("群{1}({0})中的超级管理员{3}({2})于{4}年{5}月{6}日注销该服务,群{1}({0})将在{7}年{8}月{9}日自动删除,特此通知。", new object[] { this.CurrentUser.PersonalGroups[e.GroupUri].GroupInfo.Id, this.CurrentUser.PersonalGroups[e.GroupUri].GroupInfo.Name, id, e.MemberNickname, e.BeginDate.Year.ToString(), e.BeginDate.Month.ToString(), e.BeginDate.Day.ToString(), e.EndDate.Year.ToString(), e.EndDate.Month.ToString(), e.EndDate.Day.ToString() });
}
if ((((UserIdentity) e.Member.GroupMemeberInfo.GroupUserIdentity.Value) == UserIdentity.Manager) && (e.Member.OwnerGroup.SuperManger.Uri.Raw == this.CurrentUser.Uri.Raw))
{
content = string.Format("群{1}({0})的管理员{2}({3})已注销服务!", new object[] { this.CurrentUser.PersonalGroups[e.GroupUri].GroupInfo.Id, this.CurrentUser.PersonalGroups[e.GroupUri].GroupInfo.Name, e.MemberNickname, id });
details = string.Format("群{1}({0})的管理员{2}({3})已注销服务!", new object[] { this.CurrentUser.PersonalGroups[e.GroupUri].GroupInfo.Id, this.CurrentUser.PersonalGroups[e.GroupUri].GroupInfo.Name, e.MemberNickname, id });
}
}
catch (Exception exception)
{
ClientLogger.WriteException(exception);
}
if ((content != null) && (details != null))
{
ImpsMessageBox form = new ImpsMessageBox(this._framework.MainWindow, details, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
form.ShowInTaskbar = true;
form.WindowState = FormWindowState.Minimized;
form.Show();
ControlHelper.FlashWindow(form);
if (!this.CurrentUser.Presence.IsBusy)
{
try
{
SystemInfoNotify _notifyWnd = new SystemInfoNotify("系统消息", content);
_notifyWnd.Click += delegate {
form.Activate();
form.WindowState = FormWindowState.Normal;
_notifyWnd.Close();
};
NotifyWindowManager.Add(_notifyWnd);
}
catch (Exception exception2)
{
ClientLogger.WriteException(exception2);
}
}
}
}
}
public void PersonalGroupManager_MemberExited(object sender, PersonalGroupMemberEventArgs e)
{
string details = null;
string content = null;
if (this.CurrentUser.PersonalGroups[e.Member.OwnerGroup.Uri] != null)
{
if (((((UserIdentity) e.Member.GroupMemeberInfo.GroupUserIdentity.Value) == UserIdentity.Manager) && (e.Member.OwnerGroup.SuperManger != null)) && (e.Member.OwnerGroup.SuperManger.Uri.Id == this.CurrentUser.Uri.Id))
{
details = string.Format("管理员{0}({1})退出了群{2}({3})!", new object[] { e.Member.GroupMemeberInfo.GroupNickName, e.Member.Uri.Id, e.Member.OwnerGroup.GroupInfo.Name.Value, e.Member.OwnerGroup.Uri.Id });
content = "管理员退出了群!";
}
if ((content != null) && (details != null))
{
ImpsMessageBox form = new ImpsMessageBox(this._framework.MainWindow, details, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
form.ShowInTaskbar = true;
form.WindowState = FormWindowState.Minimized;
form.Show();
ControlHelper.FlashWindow(form);
if (!this.CurrentUser.Presence.IsBusy)
{
try
{
SystemInfoNotify _notifyWnd = new SystemInfoNotify("系统消息", content);
_notifyWnd.Click += delegate {
form.Activate();
form.WindowState = FormWindowState.Normal;
_notifyWnd.Close();
};
NotifyWindowManager.Add(_notifyWnd);
}
catch (Exception exception)
{
ClientLogger.WriteException(exception);
}
}
}
}
}
public void PersonalGroupManager_ReplyResult(object sender, PersonalGroupReplyResultEventArgs e)
{
string details;
ImpsMessageBox form;
if (((UserIdentity) e.Group.UserInfo.GroupUserIdentity.Value) == UserIdentity.Rejct)
{
details = string.Format("您加入群{0}({1})的请求被拒绝!", e.Group.GroupInfo.Name.Value, e.Group.GroupInfo.Id);
form = new ImpsMessageBox(this._framework.MainWindow, details, MessageBoxButtons.OK, MessageBoxIcon.Hand);
}
else
{
if (((UserIdentity) e.Group.UserInfo.GroupUserIdentity.Value) != UserIdentity.Member)
{
return;
}
if (!e.IsReplyByManager)
{
details = string.Format("欢迎加入群{0}({1})!", e.Group.GroupInfo.Name.Value, e.Group.GroupInfo.Id);
}
else
{
details = string.Format("您的请求已被批准,欢迎加入群{0}({1})!", e.Group.GroupInfo.Name.Value, e.Group.GroupInfo.Id);
}
form = new ImpsMessageBox(this._framework.MainWindow, details, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
}
form.ShowInTaskbar = true;
form.WindowState = FormWindowState.Minimized;
form.Show();
ControlHelper.FlashWindow(form);
if (!this.CurrentUser.Presence.IsBusy)
{
try
{
SystemInfoNotify _notifyWnd = new SystemInfoNotify("系统消息", details);
_notifyWnd.Click += delegate {
form.Activate();
form.WindowState = FormWindowState.Normal;
_notifyWnd.Close();
};
NotifyWindowManager.Add(_notifyWnd);
}
catch (Exception exception)
{
ClientLogger.WriteException(exception);
}
}
}
private void PersonalGroupManager_WebJoinGroup(object sender, PersonalGroupEventArgs e)
{
if ((e.PersonalGroup != null) && !this.CurrentUser.Presence.IsBusy)
{
try
{
NotifyWindowGroupMessage notifyWindow = new NotifyWindowGroupMessage(e.PersonalGroup, null, NotifyWindowGroupMessage.MessageType.WebJoinGroup);
NotifyWindowManager.Add(notifyWindow);
}
catch (Exception exception)
{
ClientLogger.WriteException(exception);
}
}
}
public void SearchGroup(IWin32Window owner)
{
EventHandler handler = null;
try
{
if ((this._serchGroupForm == null) || this._serchGroupForm.IsDisposed)
{
this._serchGroupForm = new SearchPersonalGroupForm(this._framework);
ControlHelper.ShowFormCenterOnParent(this._serchGroupForm, owner);
if (handler == null)
{
handler = delegate {
this._serchGroupForm = null;
};
}
this._serchGroupForm.Disposed += handler;
}
else
{
Imps.Client.Utils.Win32.NativeMethods.ShowWindow(this._serchGroupForm.Handle, 9);
this._serchGroupForm.Activate();
}
}
catch (Exception exception)
{
ClientLogger.WriteException(exception);
}
}
public void SetGroupManager(IWin32Window owner, PersonalGroupMember member)
{
EventHandler<ImpsErrorEventArgs> handler = null;
try
{
if (this._framework.UnifiedMessageBox.ShowConfirmation(owner, string.Format("确认设置{0}为管理员吗?", member.DisplayName)) == DialogResult.Yes)
{
member.GroupMemeberInfo.GroupUserIdentity.ProposedValue = UserIdentity.Manager;
AsyncBizOperation op = new AsyncBizOperation(owner);
if (handler == null)
{
handler = new EventHandler<ImpsErrorEventArgs>(this, (IntPtr) this.<SetGroupManager>b__4);
}
op.ImpsError += handler;
this.CurrentUser.PersonalGroupManager.AsyncSetMemberPermission(member, op);
}
}
catch (Exception exception)
{
ClientLogger.WriteException(exception);
}
}
public void SetGroupSuperManager(IWin32Window owner, PersonalGroupMember member)
{
EventHandler<ImpsErrorEventArgs> handler = null;
try
{
if (this._framework.UnifiedMessageBox.ShowConfirmation(owner, string.Format("是否确认{0}({1})为超级管理员,如确认后,您将成为该群的普通群用户。", member.DisplayName, member.Uri.Sid)) == DialogResult.Yes)
{
member.GroupMemeberInfo.GroupUserIdentity.ProposedValue = UserIdentity.SuperManager;
AsyncBizOperation op = new AsyncBizOperation(owner);
if (handler == null)
{
handler = new EventHandler<ImpsErrorEventArgs>(this, (IntPtr) this.<SetGroupSuperManager>b__8);
}
op.ImpsError += handler;
this.CurrentUser.PersonalGroupManager.AsyncSetMemberPermission(member, op);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -