void listBox1_DoubleClick(object sender, EventArgs e) { if (listBox1.SelectedItems.Count == 0) { return; } CodeFolder _codeFolder = null; if (treeView1.SelectedNode != null) { _codeFolder = treeView1.SelectedNode.Tag as CodeFolder; if (_codeFolder != null) { this.SelectedFolder = _codeFolder; } } if (this.SelectedFolder == null) { MessageBox.Show("没有选中的文件夹"); return; } _codeFolder = SelectedFolder; var _selectCode = listBox1.SelectedItem as Code; var list = listBox1.DataSource as List <Code>; if (_selectCode != null) { this.SelectedCode = _selectCode; IDockContent content = FindDocument(_selectCode.Title); if (content == null) { var frm = new FormCodeEditor(this.m_dbName); frm.code = _selectCode; frm.Text = _selectCode.Title; if (_codeFolder != null) { frm.TreeId = _codeFolder.Id; frm.TreeText = _codeFolder.Text; } //frm.Show(); if (this.DockPanel != null) { frm.Show(this.DockPanel); } } else { content.DockHandler.Activate(); } } var newCode = db.GetCode(_selectCode.Id); if (newCode != null) { this.toolStripStatusLabel1.Text = string.Empty; if (newCode.Content.Length > 3 * 1024 * 1024) { this.toolStripStatusLabel1.Text = "文件太大,无法显示"; // MessageBox.Show("文件太大,无法显示"); return; } if (this.splitContainer3.Panel2Collapsed == false) { syntaxBoxControl1.Document.Text = newCode.Content; // this.textBox1.Text = newCode.Content; webBrowser1.DocumentText = newCode.Content; } } else { //updateTreeNode(treeView1.SelectedNode); list.Remove(_selectCode); listBox1.DataSource = null; listBox1.DataSource = list; listBox1.DisplayMember = "Title"; syntaxBoxControl1.Document.Text = string.Empty; // this.textBox1.Text = string.Empty; webBrowser1.DocumentText = string.Empty; } }
public Code GetLatestCode(Code _code) { return(db.GetCode(_code.Id)); }