?? invitecontrol.cs
字號:
this.panel2.Dock = DockStyle.Fill;
this.panel2.Location = new Point(1, 1);
this.panel2.Name = "panel2";
this.panel2.Padding = new Padding(3, 3, 0, 0);
this.panel2.Size = new Size(0x10b, 0x4f);
this.panel2.TabIndex = 0;
this.flowPanlContacts.AutoScroll = true;
this.flowPanlContacts.BackColor = Color.White;
this.flowPanlContacts.Dock = DockStyle.Fill;
this.flowPanlContacts.Location = new Point(3, 3);
this.flowPanlContacts.Name = "flowPanlContacts";
this.flowPanlContacts.Size = new Size(0x108, 0x4c);
this.flowPanlContacts.TabIndex = 2;
this.flowPanlContacts.TabStop = true;
this.flowPanlContacts.PreviewKeyDown += new PreviewKeyDownEventHandler(this.flowPanlContacts_PreviewKeyDown);
this.lblSelectInfo.Dock = DockStyle.Top;
this.lblSelectInfo.Location = new Point(0, 0);
this.lblSelectInfo.Name = "lblSelectInfo";
this.lblSelectInfo.Size = new Size(0x10d, 0x11);
this.lblSelectInfo.TabIndex = 2;
this.lblSelectInfo.Text = "已選中[{0}]人,還能再邀請{0}人";
this.lblSelectInfo.TextAlign = ContentAlignment.MiddleLeft;
base.AutoScaleDimensions = new SizeF(6f, 13f);
base.AutoScaleMode = AutoScaleMode.Font;
this.BackColor = Color.Transparent;
base.Controls.Add(this.xSplitContainer);
base.Name = "InviteControl";
base.Size = new Size(0x10d, 0x19e);
this.menuOperation.ResumeLayout(false);
this.xSplitContainer.Panel1.ResumeLayout(false);
this.xSplitContainer.Panel1.PerformLayout();
this.xSplitContainer.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_Shown(object sender, EventArgs e)
{
this.bindList();
for (int i = this._selectedContacts.Count - 1; i >= 0; i--)
{
if (!this.IsContactCanShow(this._selectedContacts[i]))
{
this._selectedContacts.Remove(this._selectedContacts[i]);
}
}
this._selectedContacts.Sort();
this.ReSelectNodes();
bool flag = false;
if (this._selectedContacts.Count > this._maxSelectedCount)
{
for (int j = this._selectedContacts.Count - 1; j >= this._maxSelectedCount; j--)
{
this._selectedContacts.Remove(this._selectedContacts[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 (contact.RelationStatus != 1)
{
return false;
}
if (contact.Type == ContactType.Vodafone)
{
return false;
}
if ((this._excludeContacts != null) && this._excludeContacts.Contains(contact))
{
return false;
}
if (contact.IsBlocked)
{
return false;
}
if (!this.ShowSMSOffline && contact.Presence.IsSmsOffline)
{
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.Count)
{
for (int k = num3 + 1; k < this.flowPanlContacts.Controls.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.txtSearch.MouseHover += delegate {
this.searchTip.SetToolTip(this.txtSearch, string.Format(StringTable.Contact.ContactSearchTip, AppDictionary.ShortEnglishName));
};
this.txtSearch.MouseLeave += delegate {
this.searchTip.Hide(this.txtSearch);
};
this.lblNoneContacts.Text = StringTable.ContactTree.FoundNone;
this.txtSearch.MaxLength = 0x40;
this.txtSearch.Text = this.emptyText;
this.txtSearch.GotFocus += new EventHandler(this.txtSearch_GotFocus);
this.txtSearch.LostFocus += new EventHandler(this.txtSearch_LostFocus);
this.txtSearch.TextChanged += new EventHandler(this.txtSearch_TextChanged);
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.host = this.flowPanlContacts;
this.flowPanlContacts.Parent.Controls.Add(_widget2);
hscroll_widget _widget3 = scroll_maker.instance.hscroll();
_widget3.sensitive = true;
_widget3.for_pane = true;
_widget3.host = this.flowPanlContacts;
this.flowPanlContacts.Parent.Controls.Add(_widget3);
this.treeContacts.NodeAferCheck += new NodeAfterCheck(this.treeContacts_NodeAferCheck);
base.FindForm().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.Count - 1; i >= 0; i--)
{
if (this.flowPanlContacts.Controls[i].ForeColor == Color.White)
{
Imps.Client.Core.Contact tag = this.flowPanlContacts.Controls[i].Tag as Imps.Client.Core.Contact;
this._selectedContacts.Remove(tag);
this.flowPanlContacts.Controls.Remove(this.flowPanlContacts.Controls[i]);
this.RemoveTreeNodeSelect(tag);
}
}
this.FormatSelectInfo();
}
catch (Exception exception)
{
ClientLogger.WriteException(exception);
}
}
private void RemoveLable(object tag)
{
try
{
for (int i = 0; i < this.flowPanlContacts.Controls.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.Count; i++)
{
if (i < this._maxSelectedCount)
{
this.CheckContactNode(this._selectedContacts[i]);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -