📄 messagehistoryform.cs
字号:
this.lblNavigatePageInfo.Alignment = ToolStripItemAlignment.Right;
this.lblNavigatePageInfo.ForeColor = Color.Blue;
this.lblNavigatePageInfo.Name = "lblNavigatePageInfo";
this.lblNavigatePageInfo.Size = new Size(0x47, 0x16);
this.lblNavigatePageInfo.Text = "当前第2/2页";
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new Size(6, 0x19);
this.toolStripLabel1.Name = "toolStripLabel1";
this.toolStripLabel1.Size = new Size(0x43, 0x16);
this.toolStripLabel1.Text = "搜索内容:";
this.tsSearchContent.Name = "tsSearchContent";
this.tsSearchContent.Size = new Size(120, 0x19);
this.tsSearchContent.KeyDown += new KeyEventHandler(this.tsSearchContent_KeyDown);
this.tsSearch.DisplayStyle = ToolStripItemDisplayStyle.Text;
this.tsSearch.Image = (Image) manager.GetObject("tsSearch.Image");
this.tsSearch.ImageTransparentColor = Color.Magenta;
this.tsSearch.Name = "tsSearch";
this.tsSearch.Size = new Size(0x23, 0x16);
this.tsSearch.Text = "搜索";
this.tsSearch.Click += new EventHandler(this.tsSearch_Click);
this.pnlMain.BackColor = Color.Transparent;
this.pnlMain.Controls.Add(this.xSplitContainer1);
this.pnlMain.Controls.Add(this.panel1);
this.pnlMain.Dock = DockStyle.Fill;
this.pnlMain.Location = new Point(2, 0x1d);
this.pnlMain.Name = "pnlMain";
this.pnlMain.Size = new Size(0x30e, 0x213);
this.pnlMain.TabIndex = 3;
base.AutoScaleDimensions = new SizeF(6f, 13f);
base.AutoScaleMode = AutoScaleMode.Font;
base.ClientSize = new Size(850, 0x24d);
base.Controls.Add(this.pnlMain);
base.Icon = (Icon) manager.GetObject("$this.Icon");
base.KeyPreview = true;
this.MinimumSize = new Size(600, 0x12d);
base.Name = "MessageHistoryForm";
base.Padding = new Padding(2, 0x1d, 14, 0x1d);
base.Text = "MessageHistory";
base.KeyDown += new KeyEventHandler(this.MessageHistoryForm_KeyDown);
base.Controls.SetChildIndex(this.pnlMain, 0);
base.Controls.SetChildIndex(base.menubar, 0);
this.xSplitContainer1.Panel1.ResumeLayout(false);
this.xSplitContainer1.Panel2.ResumeLayout(false);
this.xSplitContainer1.ResumeLayout(false);
this.xSplitContainer2.Panel1.ResumeLayout(false);
this.xSplitContainer2.Panel2.ResumeLayout(false);
this.xSplitContainer2.ResumeLayout(false);
((ISupportInitialize) this.gdHistory).EndInit();
this.dgMenu.ResumeLayout(false);
((ISupportInitialize) this.sourceMessages).EndInit();
this.panel2.ResumeLayout(false);
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
this.bindingNavigator.EndInit();
this.bindingNavigator.ResumeLayout(false);
this.bindingNavigator.PerformLayout();
this.pnlMain.ResumeLayout(false);
base.ResumeLayout(false);
}
private void Localize()
{
base.Text = StringTable.Conversation.MsgHistoryManage;
this.bindingNavigatorMoveFirstItem.Text = StringTable.Conversation.MsgNavigateFirstPage;
this.bindingNavigatorMovePreviousItem.Text = StringTable.Conversation.MsgNavigatePreviousPage;
this.bindingNavigatorMoveNextItem.Text = StringTable.Conversation.MsgNavigateNextPage;
this.bindingNavigatorMoveLastItem.Text = StringTable.Conversation.MsgNavigateLastPage;
this.treeNavigate.Nodes[1].Text = StringTable.Conversation.MsgContact;
this.fromDataGridViewTextBoxColumn.HeaderText = StringTable.Conversation.MsgMessageFrom;
this.dateDataGridViewTextBoxColumn.HeaderText = StringTable.Conversation.MsgMessageDate;
this.timeDataGridViewTextBoxColumn.HeaderText = StringTable.Conversation.MsgMessageTime;
this.contentDataGridViewTextBoxColumn.HeaderText = StringTable.Conversation.MsgMessageContent;
}
private void MessageHistoryForm_FormClosed(object sender, EventArgs e)
{
this.CurrentUser.StatusChanged -= new EventHandler<UserSatusChangedEventArgs>(this.CurrentUser_StatusChanged);
}
private void MessageHistoryForm_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Escape)
{
base.Close();
}
}
private void messages_DataSourceInit(object sender, EventArgs e)
{
this.sourceMessages.DataSource = (this.gdHistory.Tag as MessageList).DataSource;
this.FormatNavigateInfo(this.gdHistory.Tag as MessageList);
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
this.imageList.Images.Add(this.CurrentUser.Uri.Raw, this.CurrentUser.PersonalInfo.Portrait);
try
{
Imps.Client.Core.Contact contact;
this.CurrentUser.ContactList.TryFindOrCreateContactAndGetContactInfo(this.CurrentUser.Uri.Raw, out contact, new AsyncBizOperation(), ConversationManager.ConversationNeedProperty);
TreeNode node = new TreeNode("我自己");
node.Tag = contact;
this.treeNavigate.Nodes.Insert(0, node);
node.ImageKey = this.CurrentUser.Uri.Raw;
node.SelectedImageKey = this.CurrentUser.Uri.Raw;
}
catch (Exception exception)
{
ClientLogger.WriteException(exception);
}
this.treeNavigate.Nodes[1].ImageKey = this.CurrentUser.Uri.Raw;
this.treeNavigate.Nodes[1].SelectedImageKey = this.CurrentUser.Uri.Raw;
this.bindingNavigatorDeleteItem.Enabled = false;
this.CurrentUser.StatusChanged += new EventHandler<UserSatusChangedEventArgs>(this.CurrentUser_StatusChanged);
base.FormClosed += new FormClosedEventHandler(this.MessageHistoryForm_FormClosed);
this.treeNavigate.ShowNodeToolTips = false;
this.Localize();
this.BindGroups(this.treeNavigate.Nodes[1]);
this.treeNavigate.Nodes[1].Expand();
this.gdHistory.Focus();
if (this._contact == null)
{
this.treeNavigate.SelectedNode = this.treeNavigate.Nodes[0];
}
}
private void Search()
{
if (string.IsNullOrEmpty(this.tsSearchContent.Text))
{
this._framework.UnifiedMessageBox.ShowInfo(this, "请输入搜索的关键词!");
}
else
{
TreeNode selectedNode = this.treeNavigate.SelectedNode;
if (selectedNode != null)
{
this._isSearch = true;
if (selectedNode.Tag is Imps.Client.Core.Contact)
{
this.BindGridView(selectedNode.Tag as Imps.Client.Core.Contact);
}
else if (selectedNode.Tag is Imps.Client.Core.ContactGroup)
{
this.BindGridView((selectedNode.Tag as Imps.Client.Core.ContactGroup).Contacts.ListContacts);
}
else
{
this.BindGridView(this.CurrentUser.ContactList.Contacts.ListContacts);
}
}
}
}
private void SelectNode(TreeNode node)
{
try
{
this.lblMessageInfo.Text = "";
this.rtfContent.Text = "";
if (node.Tag is Imps.Client.Core.Contact)
{
this.btnRefresh.Enabled = true;
this.BindGridView(node.Tag as Imps.Client.Core.Contact);
}
else
{
this.btnRefresh.Enabled = false;
this.gdHistory.Rows.Clear();
this.lblNavigatePageInfo.Text = "";
this.bindingNavigatorMoveFirstItem.Enabled = false;
this.bindingNavigatorMovePreviousItem.Enabled = false;
this.bindingNavigatorMoveLastItem.Enabled = false;
this.bindingNavigatorMoveNextItem.Enabled = false;
this.bindingNavigatorDeleteItem.Enabled = false;
this.btnDeleteAll.Enabled = true;
}
}
catch (Exception exception)
{
ClientLogger.WriteException(exception);
}
}
private void treeNavigate_AfterCollapse(object sender, TreeViewEventArgs e)
{
if (e.Node.Tag is Imps.Client.Core.ContactGroup)
{
e.Node.ImageKey = "NewFolderHS";
e.Node.SelectedImageKey = "NewFolderHS";
}
}
private void treeNavigate_AfterExpand(object sender, TreeViewEventArgs e)
{
if (e.Node.Tag is Imps.Client.Core.ContactGroup)
{
e.Node.ImageKey = "OpenfolderHS";
e.Node.SelectedImageKey = "OpenfolderHS";
}
}
private void treeNavigate_AfterSelect(object sender, TreeViewEventArgs e)
{
this._isSearch = false;
this.SelectNode(e.Node);
}
private void tsSearch_Click(object sender, EventArgs e)
{
this.Search();
}
private void tsSearchContent_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Return)
{
this.Search();
}
}
protected override void WndProc(ref System.Windows.Forms.Message m)
{
if (m.Msg == 0x7e)
{
ControlHelper.RepositionFormOnScreenSizeChanged(this);
}
else
{
base.WndProc(ref m);
}
}
private void xSplitContainer1_SplitterMoved(object sender, SplitterEventArgs e)
{
this.gdHistory.Focus();
}
private void xSplitContainer2_SplitterMoved(object sender, SplitterEventArgs e)
{
this.gdHistory.Focus();
}
private Imps.Client.Core.User CurrentUser
{
get
{
return this._framework.AccountManager.CurrentUser;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -