📄 invitecontrol.cs
字号:
this.flowPanlContacts.Dock = DockStyle.Fill;
this.flowPanlContacts.Location = new System.Drawing.Point(3, 3);
this.flowPanlContacts.Name = "flowPanlContacts";
this.flowPanlContacts.Size = new Size(0x108, 80);
this.flowPanlContacts.TabIndex = 2;
this.flowPanlContacts.TabStop = true;
this.flowPanlContacts.add_PreviewKeyDown(new PreviewKeyDownEventHandler(this, (IntPtr) this.flowPanlContacts_PreviewKeyDown));
this.lbSpace.Dock = DockStyle.Top;
this.lbSpace.Location = new System.Drawing.Point(0, 0x10);
this.lbSpace.Name = "lbSpace";
this.lbSpace.Size = new Size(0x10d, 5);
this.lbSpace.TabIndex = 5;
this.lbSpace.TextAlign = ContentAlignment.MiddleLeft;
this.lblSelectInfo.Dock = DockStyle.Top;
this.lblSelectInfo.Location = new System.Drawing.Point(0, 0);
this.lblSelectInfo.Name = "lblSelectInfo";
this.lblSelectInfo.Size = new Size(0x10d, 0x10);
this.lblSelectInfo.TabIndex = 2;
this.lblSelectInfo.Text = "已选中[{0}]人,还能再邀请{0}人";
this.lblSelectInfo.TextAlign = ContentAlignment.MiddleLeft;
base.set_AutoScaleDimensions(new SizeF(6f, 12f));
base.set_AutoScaleMode(1);
this.BackColor = Color.Transparent;
base.Controls.Add(this.xSplitContainer);
base.Name = "InviteControl";
base.Size = new Size(0x10d, 0x17e);
this.menuOperation.ResumeLayout(false);
this.xSplitContainer.get_Panel1().ResumeLayout(false);
this.xSplitContainer.get_Panel2().ResumeLayout(false);
this.xSplitContainer.ResumeLayout(false);
this.pnlOnlyForBorderShit.ResumeLayout(false);
this.pnlOnlyForBorderShit.PerformLayout();
this.panel1.ResumeLayout(false);
this.panel2.ResumeLayout(false);
base.ResumeLayout(false);
}
private void InviteControl_GotFocus(object sender, EventArgs e)
{
this.txtSearch.Focus();
}
private void InviteControl_Shown(object sender, EventArgs e)
{
this.bindList();
for (int i = this._selectedContacts.get_Count() - 1; i >= 0; i--)
{
if (!this.IsContactCanShow(this._selectedContacts.get_Item(i)))
{
this._selectedContacts.Remove(this._selectedContacts.get_Item(i));
}
}
this._selectedContacts.Sort();
this.ReSelectNodes();
bool flag = false;
if (this._selectedContacts.get_Count() > this._maxSelectedCount)
{
for (int j = this._selectedContacts.get_Count() - 1; j >= this._maxSelectedCount; j--)
{
this._selectedContacts.Remove(this._selectedContacts.get_Item(j));
}
flag = true;
}
this.FormatSelectInfo();
if (flag)
{
this._framework.UnifiedMessageBox.ShowWarning(this, string.Format(StringTable.Conversation.MsgSelectLimit, this._maxSelectedCount));
}
}
private bool IsCheckedLabel(Label lbl)
{
return (lbl.ForeColor == Color.White);
}
private bool IsContactCanShow(Imps.Client.Core.Contact contact)
{
if (contact.Uri.Raw != this.CurrentUser.Uri.Raw)
{
if ((this._excludeContacts != null) && this._excludeContacts.Contains(contact))
{
return false;
}
switch (this.SelectType)
{
case SelectContactsType.MultiConversation:
return contact.EnableMultiIM;
case SelectContactsType.GroupSms:
return contact.EnableSMS;
case SelectContactsType.Ivr:
return contact.EnableIvr;
case SelectContactsType.InviteJoinGroup:
return contact.EnableInviteJoinGroup;
}
int? relationStatus = contact.RelationStatus;
if ((relationStatus.GetValueOrDefault() != 1) || !relationStatus.get_HasValue())
{
return false;
}
if (contact.Type == ContactType.Vodafone)
{
return false;
}
if (contact.IsBlocked)
{
return false;
}
if (!this.ShowSMSOffline)
{
if (contact.Presence.IsSmsOffline)
{
return false;
}
}
else if (contact.PersonalInfo.Provision != 1)
{
return false;
}
if (!this.ShowSymbianR1 && (contact.Presence.ClientTypeType == ClientType.SymbianR1))
{
return false;
}
if (!this.ShowJ2MER1 && (contact.Presence.ClientTypeType == ClientType.J2MER1))
{
return false;
}
if (this.OnlyShowOnline && (contact.Presence.MainPresence == MainPresence.Offline))
{
return false;
}
if (!this.ShowSMSOnline && (contact.Presence.MainPresence == MainPresence.SmsOnline))
{
return false;
}
if ((contact is Imps.Client.Core.MobileBuddy) && !this.ShowMobileBuddy)
{
return false;
}
}
return true;
}
private void lblContact_DoubleClick(object sender, EventArgs e)
{
this.RemoveCheckedLabels();
}
private void lblContact_MouseClick(object sender, MouseEventArgs e)
{
bool flag = (Imps.Client.Utils.Win32.NativeMethods.GetKeyState(0x11) & 0x8000) != 0;
bool flag2 = (Imps.Client.Utils.Win32.NativeMethods.GetKeyState(0x10) & 0x8000) != 0;
if (!flag && !flag2)
{
this.UnCheckAllLable();
}
this.flowPanlContacts.Focus();
Label lbl = sender as Label;
Console.WriteLine(lbl.ForeColor);
if (this.IsCheckedLabel(lbl))
{
this.UnCheckLabel(lbl);
}
else
{
this.CheckLabel(lbl);
if ((!flag && !flag2) || (this.lastCheckIndex == -1))
{
this.lastCheckIndex = this.GetLabelIndex(lbl);
}
if (e.Button == MouseButtons.Right)
{
this.menuOperation.Show(Control.MousePosition);
}
}
if (flag2 && (this.lastCheckIndex != -1))
{
int labelIndex = this.GetLabelIndex(lbl);
int num2 = (labelIndex > this.lastCheckIndex) ? this.lastCheckIndex : labelIndex;
int num3 = (labelIndex > this.lastCheckIndex) ? labelIndex : this.lastCheckIndex;
for (int i = num2; i <= num3; i++)
{
this.CheckLabel(this.flowPanlContacts.Controls[i] as Label);
}
for (int j = 0; j < num2; j++)
{
this.UnCheckLabel(this.flowPanlContacts.Controls[j] as Label);
}
if (num3 < this.flowPanlContacts.Controls.get_Count())
{
for (int k = num3 + 1; k < this.flowPanlContacts.Controls.get_Count(); k++)
{
this.UnCheckLabel(this.flowPanlContacts.Controls[k] as Label);
}
}
}
}
private void menuDelete_Click(object sender, EventArgs e)
{
this.RemoveCheckedLabels();
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
if (this._selectedContacts == null)
{
this._selectedContacts = new List<Imps.Client.Core.Contact>();
}
this.lblNoneContacts.Text = StringTable.ContactTree.FoundNone;
this.txtSearch.MaxLength = 0x40;
this.txtSearch.EmptyTextTip = this.emptyText;
this.txtSearch.TextChanged += new EventHandler(this.txtSearch_TextChanged);
this.txtSearch.KeyDown += new KeyEventHandler(this.txtSearch_KeyDown);
this.flowPanlContacts.LostFocus += delegate {
this.UnCheckAllLable();
};
vscroll_widget _widget = scroll_maker.instance.vscroll();
_widget.host = this.treeContacts;
this.treeContacts.Parent.Controls.Add(_widget);
vscroll_widget _widget2 = scroll_maker.instance.vscroll();
_widget2.sensitive = true;
_widget2.for_pane = true;
_widget2.stylized_mode = true;
_widget2.host = this.flowPanlContacts;
this.flowPanlContacts.Parent.Controls.Add(_widget2);
hscroll_widget _widget3 = scroll_maker.instance.hscroll();
_widget3.sensitive = true;
_widget3.for_pane = true;
_widget3.stylized_mode = true;
_widget3.host = this.flowPanlContacts;
this.flowPanlContacts.Parent.Controls.Add(_widget3);
this.treeContacts.NodeAferCheck += new NodeAfterCheck(this.treeContacts_NodeAferCheck);
base.FindForm().add_Shown(new EventHandler(this.InviteControl_Shown));
}
private void PersonalInfo_PropertiesChanged(object sender, PropertiesChangedEventArgs e)
{
if ((e.ContainsProperty("Portrait") && (this.treeContacts.Nodes[0] is BuddySelectionBuddyNode)) && (((this.treeContacts.Nodes[0] as BuddySelectionBuddyNode).Tag as Imps.Client.Core.Contact).Uri.Raw == this.CurrentUser.Uri.Raw))
{
(this.treeContacts.Nodes[0] as BuddySelectionBuddyNode).StatusImage = new AmigoImage(ImageHelper.GetThumbnailImage(this.CurrentUser.PersonalInfo.Portrait, 0x10, 0x10));
}
}
private void RemoveCheckedLabels()
{
try
{
for (int i = this.flowPanlContacts.Controls.get_Count() - 1; i >= 0; i--)
{
if (this.flowPanlContacts.Controls[i].ForeColor == Color.White)
{
Imps.Client.Core.Contact contact = this.flowPanlContacts.Controls[i].Tag as Imps.Client.Core.Contact;
this._selectedContacts.Remove(contact);
this.flowPanlContacts.Controls.Remove(this.flowPanlContacts.Controls[i]);
this.RemoveTreeNodeSelect(contact);
}
}
this.FormatSelectInfo();
}
catch (Exception exception)
{
ClientLogger.WriteException(exception);
}
}
private void RemoveLable(object tag)
{
try
{
for (int i = 0; i < this.flowPanlContacts.Controls.get_Count(); i++)
{
if ((this.flowPanlContacts.Controls[i] as Label).Tag == tag)
{
this.flowPanlContacts.Controls.Remove(this.flowPanlContacts.Controls[i]);
break;
}
}
this.FormatSelectInfo();
}
catch (Exception exception)
{
ClientLogger.WriteException(exception);
}
}
private void RemoveTreeNodeSelect(Imps.Client.Core.Contact contact)
{
try
{
for (int i = 0; i < this.treeContacts.Nodes.Count; i++)
{
PaintTreeNode node = this.treeContacts.Nodes[i] as PaintTreeNode;
if ((node.Tag is Imps.Client.Core.Contact) && ((node.Tag as Imps.Client.Core.Contact) == contact))
{
(node as BuddySelectionBuddyNode).CheckState = CheckState.Unchecked;
}
foreach (TreeNode node2 in this.treeContacts.Nodes[i].Nodes)
{
if ((node2.Tag as Imps.Client.Core.Contact) == contact)
{
(node2 as BuddySelectionBuddyNode).CheckState = CheckState.Unchecked;
FormatGroupCheckState(node2 as BuddySelectionBuddyNode);
}
}
}
}
catch (Exception exception)
{
ClientLogger.WriteException(exception);
}
}
private void ReSelectNodes()
{
for (int i = 0; i < this._selectedContacts.get_Count(); i++)
{
if (i < this._maxSelectedCount)
{
this.CheckContactNode(this._selectedContacts.get_Item(i));
}
if (i >= this._maxSelectedCount)
{
return;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -