📄 buserinfocontrol.cs
字号:
namespace Imps.Client.Pc
{
using Imps.Client;
using Imps.Client.Core;
using Imps.Client.Pc.BizControls;
using Imps.Client.Resource;
using Imps.Utils;
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
public class BUserInfoControl : Control
{
private UserAccountManager _manager;
private menu_widget cmMoodPhrases;
private menu_widget cmStatus;
private IContainer components;
public BUserInfoControl(UserAccountManager manager)
{
this._manager = manager;
this.InitializeComponent();
this.DoLocalize();
}
private void cmMoodPhrases_Opening(object sender, CancelEventArgs e)
{
UiErrorHelper.HandEventSafely(this._manager.FrameworkWnd, delegate {
string b = this._manager.CurrentUser.Presence.MoodPhrase.Value;
this.cmMoodPhrases.get_Items().Clear();
MoodPhraseCollection moodPhrases = this._manager.CurrentUser.Configuration.UserSetting.MoodPhrases;
for (int j = 0; i < moodPhrases.Count; i++)
{
menu_radioitem _radioitem = new menu_radioitem(StringHelper.GetPaddingStringEndEllipsis(StringHelper.ReplaceCrLfToSpace(moodPhrases[i]), 0x10));
this.cmMoodPhrases.get_Items().Add(_radioitem);
_radioitem.set_ToolTipText(moodPhrases[i]);
if (string.Equals(moodPhrases[i], b))
{
_radioitem.Radioed = true;
}
else
{
_radioitem.add_Click(new EventHandler(this.tiMoodPhrase_Click));
}
}
if (moodPhrases.Count > 0)
{
ToolStripSeparator separator = new ToolStripSeparator();
separator.set_Enabled(false);
this.cmMoodPhrases.get_Items().Add(separator);
}
ToolStripItem item = this.cmMoodPhrases.get_Items().Add(StringTable.User.UI_EraseMoodPhrase);
item.set_ToolTipText(string.Empty);
item.set_Enabled(!string.IsNullOrEmpty(b));
item.add_Click(new EventHandler(this.tiMoodPhrase_Click));
});
}
private void cmStatus_Opening(object sender, CancelEventArgs e)
{
UiErrorHelper.HandEventSafely(this._manager.FrameworkWnd, delegate {
this._manager.DoPresenceMenuItemsOpening(this.cmStatus.get_Items());
});
}
protected override void Dispose(bool disposing)
{
if (disposing && (this.components != null))
{
this.components.Dispose();
}
base.Dispose(disposing);
}
private void DoLocalize()
{
this.cmStatus.get_Items().AddRange(this._manager.GetPresenceMenuItems(false, false));
this.cmStatus.add_Opening(new CancelEventHandler(this._manager.OnStatusMenuOpening));
}
private void InitializeComponent()
{
this.components = new Container();
this.cmMoodPhrases = new menu_widget(this.components);
this.cmStatus = new menu_widget(this.components);
this.cmMoodPhrases.UseMnemonic = false;
this.cmMoodPhrases.Name = "cmMoodPhrases";
this.cmMoodPhrases.Size = new Size(0x3d, 4);
this.cmMoodPhrases.add_Opening(new CancelEventHandler(this.cmMoodPhrases_Opening));
this.cmStatus.Name = "cmStatus";
this.cmStatus.Size = new Size(0x3d, 4);
this.cmStatus.add_Opening(new CancelEventHandler(this.cmStatus_Opening));
}
private void tiMoodPhrase_Click(object sender, EventArgs e)
{
if (sender is ToolStripItem)
{
this.TryChangeMoodPhrase(((ToolStripItem) sender).get_ToolTipText());
}
}
public void toolIm_Click(object sender, EventArgs e)
{
UiErrorHelper.HandEventSafely(this._manager.FrameworkWnd, delegate {
this._manager.FrameworkWnd.ConversationManager.StartConversation(this._manager.FrameworkWnd.MainWindow, ConversationOperation.ImChat, null);
});
}
public void toolIVR_Click(object sender, EventArgs e)
{
UiErrorHelper.HandEventSafely(this._manager.FrameworkWnd, delegate {
this._manager.FrameworkWnd.IVRManager.StartIVR(this._manager.FrameworkWnd.MainWindow, null);
});
}
public void toolSms_Click(object sender, EventArgs e)
{
UiErrorHelper.HandEventSafely(this._manager.FrameworkWnd, delegate {
this._manager.FrameworkWnd.ConversationManager.StartConversation(this._manager.FrameworkWnd.MainWindow, ConversationOperation.SmsChat, null);
});
}
private void TryChangeMoodPhrase(string phrase)
{
try
{
phrase = phrase.Trim();
AsyncBizOperation op = new AsyncBizOperation();
this._manager.CurrentUser.Presence.AsyncChangeMoodPhrase(phrase, op);
}
catch
{
}
}
public menu_widget MoodPhraseMenu
{
get
{
return this.cmMoodPhrases;
}
}
public menu_widget StatusMenu
{
get
{
return this.cmStatus;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -