代码拉取完成,页面将自动刷新
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using LTP.TextEditor;
using System.IO;
namespace AtfutureCodeMachine
{
public partial class FormShowCode : Form
{
public FormShowCode()
{
InitializeComponent();
this.Shown += new EventHandler(FormShowCode_Shown);
this.tabControl1.DoubleClick += new EventHandler(tabControl1_DoubleClick);
}
void tabControl1_DoubleClick(object sender, EventArgs e)
{
if (tabControl1.SelectedIndex != tabControl1.TabCount - 1)
{
TextEditorControl codeview = this.tabControl1.SelectedTab.Controls[0] as TextEditorControl;
string vm = this.tabControl1.SelectedTab.Tag.ToString();
FormMain.g_code[vm] = ViewTemplate.ParseVm(vm);
codeview.Text = FormMain.g_code[vm];
}
}
void FormShowCode_Shown(object sender, EventArgs e)
{
//移除默认的
this.tabControl1.TabPages.RemoveAt(0);
this.tabControl1.TabPages.RemoveAt(0);
foreach (string s in FormMain.g_code.Keys)
{
this.tabControl1.TabPages.Add(s.ToUpper());
TextEditorControl codeview = new TextEditorControl();
codeview.Dock = DockStyle.Fill;
this.tabControl1.TabPages[this.tabControl1.TabCount - 1].Controls.Add(codeview);
this.tabControl1.TabPages[this.tabControl1.TabCount - 1].Tag = s.ToUpper();
string strExt = s.Split('.')[1].ToLower();
if (strExt == "vm" || strExt == "htm" || strExt == "html" || strExt == "aspx" || strExt == "ashx") codeview.Language = TextEditorControlBase.Languages.HTML;
if (strExt == "hbm" || strExt == "xml") codeview.Language = TextEditorControlBase.Languages.XML;
if (strExt == "sql") codeview.Language = TextEditorControlBase.Languages.SQL;
if (strExt == "vb") codeview.Language = TextEditorControlBase.Languages.VBNET;
if (strExt == "js") codeview.Language = TextEditorControlBase.Languages.JavaScript;
if (strExt == "java") codeview.Language = TextEditorControlBase.Languages.Java;
if (strExt == "cs") codeview.Language = TextEditorControlBase.Languages.CSHARP;
codeview.Text = FormMain.g_code[s.ToUpper()];
}
//加载说明
TextEditorControl te = new TextEditorControl();
te.Dock = DockStyle.Fill;
this.tabControl1.TabPages.Add("Help");
this.tabControl1.TabPages[this.tabControl1.TabCount - 1].Controls.Add(te);
te.Language = TextEditorControlBase.Languages.CSHARP;
using (StreamReader sr = new StreamReader(Path.Combine(Application.StartupPath, "help.vm"),
Encoding.GetEncoding("gb2312")))
{
te.Text = sr.ReadToEnd();
}
}
/// <summary>
/// 返回值
/// </summary>
public string Value
{
set
{
//this.richTextBox1.Text = value;
}
}
private void button1_Click(object sender, EventArgs e)
{
this.Close();
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。