📄 contactlistcontrol.cs
字号:
this.m_buddytree_widget.add_group(group, false);
}
}
}
lock (this.ContactList.Contacts.SyncRoot)
{
using (IEnumerator<Imps.Client.Core.Contact> enumerator2 = this.ContactList.Contacts.GetEnumerator())
{
while (enumerator2.MoveNext())
{
Imps.Client.Core.Contact contact = enumerator2.get_Current();
this.contactNodes_Add(contact);
}
}
goto Label_029C;
}
break;
case ContactTreeGroupByType.Terminal:
goto Label_0200;
case ContactTreeGroupByType.Presence:
break;
default:
goto Label_029C;
}
using (IEnumerator<SystemFixedContactGroup> enumerator3 = this.GroupsByPresence.GetEnumerator())
{
while (enumerator3.MoveNext())
{
SystemFixedContactGroup group2 = enumerator3.get_Current();
this.m_buddytree_widget.add_group(group2, false);
}
}
lock (this.ContactList.Contacts.SyncRoot)
{
using (IEnumerator<Imps.Client.Core.Contact> enumerator4 = this.ContactList.Contacts.GetEnumerator())
{
while (enumerator4.MoveNext())
{
Imps.Client.Core.Contact contact2 = enumerator4.get_Current();
this.contactNodes_Add(contact2);
}
}
goto Label_029C;
}
Label_0200:
enumerator5 = this.GroupsByTerminal.GetEnumerator();
try
{
while (enumerator5.MoveNext())
{
SystemFixedContactGroup group3 = enumerator5.get_Current();
this.m_buddytree_widget.add_group(group3, false);
}
}
finally
{
if (enumerator5 != null)
{
enumerator5.Dispose();
}
}
lock (this.ContactList.Contacts.SyncRoot)
{
using (IEnumerator<Imps.Client.Core.Contact> enumerator6 = this.ContactList.Contacts.GetEnumerator())
{
while (enumerator6.MoveNext())
{
Imps.Client.Core.Contact contact3 = enumerator6.get_Current();
this.contactNodes_Add(contact3);
}
}
}
Label_029C:
this.loadGroupCollapse();
this.m_buddytree_widget.sort_allitems(true);
}
catch (Exception exception)
{
this.m_buddytree_widget.sort_allitems(true);
ClientLogger.WriteGeneral("ContactListControl", exception.ToString(), 20);
this._iFrameworkWnd.UnifiedMessageBox.ShowError(StringTable.Contact.ContactList_LoadError);
}
}
public void SetWizardForceDisplayGroup(bool value)
{
this._forceDisplayGroup = new bool?(value);
if (this.CurrentUser.ContactList.Contacts.Count <= 0)
{
bool? nullable = this._forceDisplayGroup;
if (nullable.GetValueOrDefault() && nullable.get_HasValue())
{
this.setWizardUiOnNoneContact(false);
}
}
}
private void setWizardUiOnNoneContact(bool state)
{
this.lblId.Visible = this.m_buddytree_widget.searching;
if (this.m_buddytree_widget.searching)
{
this.panelEmpty.Visible = false;
this._isWizardVisible = false;
}
if (state)
{
this.panelEmpty.Dock = DockStyle.Fill;
this.panelEmpty.Visible = true;
this._isWizardVisible = true;
bool matchingEnabled = this._iFrameworkWnd.AccountManager.CurrentUser.Configuration.SystemSetting.ServerUriSetting.MatchingEnabled;
this.lblMatch.Visible = matchingEnabled;
this.pbMatch.Visible = matchingEnabled;
this.InitializeLinkLabel();
}
else
{
this.panelEmpty.Visible = false;
this._isWizardVisible = false;
}
}
private void stbtnAddBuddy_Click(object sender, EventArgs e)
{
try
{
this._iFrameworkWnd.ContactManager.ShowAddBuddyWindow(null, string.Empty, null, string.Empty, null, ContactType.ImpsContact);
}
catch (Exception exception)
{
this._iFrameworkWnd.UnifiedMessageBox.ShowException(exception);
}
}
private void tstbSearch_KeyDown(object sender, KeyEventArgs e)
{
Keys keyCode = e.KeyCode;
if (keyCode != Keys.Return)
{
if (keyCode != Keys.Escape)
{
if (keyCode == Keys.Down)
{
this.m_buddytree_widget.SetFocus();
}
return;
}
}
else
{
tree<tree_widget.item_type>.iterator item = this.m_buddytree_widget.first_item;
if (!this.m_buddytree_widget.end.is_equal(item))
{
if (!(item.data is tree_widget_buddy))
{
return;
}
this._iFrameworkWnd.ConversationManager.StartConversation(this._iFrameworkWnd.MainWindow, ConversationOperation.ImChat, new string[] { (item.data as tree_widget_buddy).contact.Uri.Raw });
this.tstbSearch.Text = string.Empty;
}
return;
}
this.tstbSearch.Text = string.Empty;
}
private void tstbSearch_TextChanged(object sender, EventArgs e)
{
try
{
string keyWord = ((TextBox) sender).Text.Trim();
if (keyWord.Length == 0)
{
this.m_buddytree_widget.searching = false;
this.m_buddytree_widget.Visible = true;
this.refreshContactList();
this.mr_d_Presence.set_Enabled(true);
this.mr_d_Terminal.set_Enabled(true);
this.mr_d_Group.set_Enabled(true);
this.MatchHelper.Clear();
this._searchResult.Clear();
}
else
{
this._searchResult = this.MatchHelper.GetMatchContacts(keyWord);
this.m_buddytree_widget.searching = true;
this.m_buddytree_widget.Visible = true;
this.setWizardUiOnNoneContact(false);
this.mr_d_Presence.set_Enabled(false);
this.mr_d_Terminal.set_Enabled(false);
this.mr_d_Group.set_Enabled(false);
this.bindSearchResult();
}
}
catch (Exception exception)
{
this.m_buddytree_widget.sort_allitems(true);
ClientLogger.WriteGeneral("ContactListControl", exception.ToString(), 10);
}
}
private Imps.Client.Core.ContactList ContactList
{
get
{
return this.CurrentUser.ContactList;
}
}
internal ContactTreeGroupByType CurrentTreeGroupByType
{
get
{
return this._currentTreeGroupByType;
}
}
private Imps.Client.Core.User CurrentUser
{
get
{
return this._iFrameworkWnd.AccountManager.CurrentUser;
}
}
public menu_widget DisplayMenu
{
get
{
return this.mw_DisplayMenu;
}
}
private SystemFixedContactGroupCollection GroupsByPresence
{
get
{
if (this._groupsByPresence == null)
{
this._groupsByPresence = new SystemFixedContactGroupHelper(this.CurrentUser).GetContactGroup(SystemFixContactGroupType.Presence);
}
return this._groupsByPresence;
}
}
private SystemFixedContactGroupCollection GroupsByTerminal
{
get
{
if (this._gorupsByTerminal == null)
{
this._gorupsByTerminal = new SystemFixedContactGroupHelper(this.CurrentUser).GetContactGroup(SystemFixContactGroupType.Terminal);
}
return this._gorupsByTerminal;
}
}
private ContactMatchHelper MatchHelper
{
get
{
if (this._matchHelper == null)
{
this._matchHelper = new ContactMatchHelper(this.CurrentUser);
}
return this._matchHelper;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -