📄 startpageform.cs
字号:
this.imageList1.TransparentColor = Color.Transparent;
this.imageList1.Images.SetKeyName(0, "rss1.gif");
this.pictureBox9.Image = Resources.about;
this.pictureBox9.InitialImage = Resources.about;
this.pictureBox9.Location = new Point(20, 0x12);
this.pictureBox9.Name = "pictureBox9";
this.pictureBox9.Size = new Size(0x30, 0x30);
this.pictureBox9.SizeMode = PictureBoxSizeMode.AutoSize;
this.pictureBox9.TabIndex = 5;
this.pictureBox9.TabStop = false;
base.AutoScaleDimensions = new SizeF(6f, 12f);
base.AutoScaleMode = AutoScaleMode.Font;
this.BackColor = SystemColors.InactiveCaptionText;
this.BackgroundImage = (Image) manager.GetObject("$this.BackgroundImage");
base.ClientSize = new Size(0x200, 0x1c8);
base.Controls.Add(this.pictureBox9);
base.Controls.Add(this.groupBox2);
base.Controls.Add(this.groupBox1);
base.Name = "StartPageForm";
this.Text = "起始页";
base.Load += new EventHandler(this.StartPageForm_Load);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
((ISupportInitialize) this.pictureBox6).EndInit();
((ISupportInitialize) this.pictureBox7).EndInit();
((ISupportInitialize) this.pictureBox8).EndInit();
((ISupportInitialize) this.pictureBox5).EndInit();
((ISupportInitialize) this.pictureBox4).EndInit();
((ISupportInitialize) this.pictureBox3).EndInit();
((ISupportInitialize) this.pictureBox2).EndInit();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
((ISupportInitialize) this.pictureBox1).EndInit();
((ISupportInitialize) this.pictureBox9).EndInit();
base.ResumeLayout(false);
base.PerformLayout();
}
private bool IsHasLoaded()
{
if (!File.Exists(this.cmcfgfile))
{
return false;
}
this.cfgfile = new INIFile(this.cmcfgfile);
return (this.cfgfile.IniReadValue("updaterss", "today") == DateTime.Today.ToString("yyyyMMdd"));
}
private void lblAddServer_Click(object sender, EventArgs e)
{
new DbView(this.mainfrm).RegServer();
}
private void lblCodeExport_Click(object sender, EventArgs e)
{
string dbViewSelServer = FormCommon.GetDbViewSelServer();
if (dbViewSelServer == "")
{
MessageBox.Show("没有可用的数据库连接,请先连接数据库服务器。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
}
else
{
new CodeExport(dbViewSelServer).ShowDialog(this);
}
}
private void lblCodeMaker_Click(object sender, EventArgs e)
{
this.mainfrm.CheckDbServer();
this.mainfrm.AddSinglePage(new CodeMaker(), "代码生成");
}
private void lblDBBrowser_Click(object sender, EventArgs e)
{
this.mainfrm.AddSinglePage(new DbBrowser(), "摘要");
}
private void lblDBScript_Click(object sender, EventArgs e)
{
string dbViewSelServer = FormCommon.GetDbViewSelServer();
if (dbViewSelServer == "")
{
MessageBox.Show("没有可用的数据库连接,请先连接数据库服务器。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
}
else
{
new DbToScript(dbViewSelServer).ShowDialog(this);
}
}
private void lblNewPro_Click(object sender, EventArgs e)
{
new NewProject().ShowDialog(this.mainfrm);
}
private void lblWord_Click(object sender, EventArgs e)
{
string dbViewSelServer = FormCommon.GetDbViewSelServer();
if (dbViewSelServer == "")
{
MessageBox.Show("没有可用的数据库连接,请先连接数据库服务器。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
}
else
{
new DbToWord(dbViewSelServer).Show();
}
}
private void listView1_DoubleClick(object sender, EventArgs e)
{
if (this.listView1.SelectedItems.Count > 0)
{
string text = this.listView1.SelectedItems[0].Text;
string url = this.listView1.SelectedItems[0].SubItems[2].Text;
Crownwood.Magic.Controls.TabPage page = new Crownwood.Magic.Controls.TabPage();
page.Title = text;
page.Control = new IEView(this.mainfrm, url);
this.mainfrm.tabControlMain.TabPages.Add(page);
this.mainfrm.tabControlMain.SelectedTab = page;
}
}
private void LoadedRssMarker()
{
this.cfgfile.IniWriteValue("updaterss", "today", DateTime.Today.ToString("yyyyMMdd"));
}
private void LoadItem()
{
XmlDocument document = new XmlDocument();
document.Load(this.tempRssfile);
XmlNodeList list = document.SelectNodes("/rss/channel/item");
new XmlNamespaceManager(document.NameTable).AddNamespace("dc", "http://purl.org/dc/elements/1.1/");
this.listView1.Items.Clear();
try
{
foreach (XmlNode node in list)
{
if (node.HasChildNodes)
{
string text = "";
string str2 = "";
string s = DateTime.Now.ToString();
foreach (XmlNode node2 in node.ChildNodes)
{
string name = node2.Name;
if (name != null)
{
if (!(name == "title"))
{
if (name == "link")
{
goto Label_0119;
}
if (name == "dc:creator")
{
goto Label_0124;
}
if (name == "author")
{
goto Label_012E;
}
if (name == "pubDate")
{
goto Label_0138;
}
}
else
{
text = node2.InnerText;
}
}
continue;
Label_0119:
str2 = node2.InnerText;
continue;
Label_0124:
string text1 = node2.InnerText;
continue;
Label_012E:
string text2 = node2.InnerText;
continue;
Label_0138:
s = node2.InnerText;
s = DateTime.Parse(s).ToString();
}
ListViewItem item = new ListViewItem(text, 0);
item.SubItems.Add(s);
item.SubItems.Add(str2);
this.listView1.Items.AddRange(new ListViewItem[] { item });
}
}
this.listView1.Columns[0].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
this.listView1.Dock = DockStyle.Fill;
this.lblTip.Visible = false;
this.pictureBox1.Visible = false;
this.listView1.Visible = true;
}
catch
{
}
}
private void LoadRss()
{
try
{
this.CreatListview();
this.LoadRss(this.RssPath);
}
catch (Exception exception)
{
MessageBox.Show("获取网站信息失败,请检查网络连接是否正常或稍后再试。" + exception.Message);
LogInfo.WriteLog(exception);
}
}
private void LoadRss(string RssPath)
{
if (!this.IsHasLoaded())
{
this.SetText("正在获取网站最新信息,请稍候…");
this.LoadXml2Coach(RssPath, this.tempRssfile);
this.LoadedRssMarker();
}
this.SetText("正在读取内容信息…");
this.SetListText();
this.SetText("完成");
}
private void LoadXml2Coach(string url, string tempfile)
{
try
{
XmlDocument document = new XmlDocument();
document.Load(url);
document.Save(tempfile);
}
catch
{
}
}
private void SetListText()
{
if (this.listView1.InvokeRequired)
{
SetListCallback method = new SetListCallback(this.SetListText);
base.Invoke(method, null);
}
else
{
this.LoadItem();
}
}
private void SetText(string text)
{
if (this.lblTip.InvokeRequired)
{
SetTextCallback method = new SetTextCallback(this.SetText);
base.Invoke(method, new object[] { text });
}
else
{
this.lblTip.Text = text;
}
}
private void StartPageForm_Load(object sender, EventArgs e)
{
try
{
this.thread = new Thread(new ThreadStart(this.LoadRss));
this.thread.Start();
}
catch
{
}
}
private delegate void SetListCallback();
private delegate void SetTextCallback(string text);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -