private void linkLabel3_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { MessageDetail f = new MessageDetail(); f.Show(); this.Hide(); }
public void MessageDetail_Load(object sender, EventArgs e) { TabPage TabPageCity10 = new TabPage("通知详情"); TabPageCity10.Name = "通知详情"; this.tabControl1.TabPages.Add(TabPageCity10); MessageDetail md = new MessageDetail(); //MessageDetail:From md.TopLevel = false; md.Parent = TabPageCity10; md.ControlBox = false; md.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; md.Text = null; md.Dock = System.Windows.Forms.DockStyle.Fill; md.Show(); }
private void linkLabel_12_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { string fileName = null; string path = null; // 通知标题对应的url string url; // 判断现在在哪个通知页面 fileName = judgeNotifications(); path = "../../" + "Properties\\Get_Notifications\\dist\\" + fileName; // 使用Encoding.GetEncording("utf-8")解决中文读取乱码的问题 string[] allLines = File.ReadAllLines(path, Encoding.GetEncoding("utf-8")); // 获取url并转化为Uri url = allLines[(externPageindex - 1) * 36 + 35]; Uri uri = new Uri(url); MessageDetail messageDetail = new MessageDetail(); // 设置url messageDetail.webBrowser1.Url = uri; // 显示页面 messageDetail.Show(); LogHelper.WriteLog(typeof(MainInterface), "用户点击" + fileName + "中第12条通知"); }
private void searchResultList_SelectedIndexChanged(object sender, EventArgs e) { ListView.SelectedIndexCollection indexes = searchResultList.SelectedIndices; string complexIndex = ""; string notificationIndex = ""; string locationIndex = ""; // 打开网站的url string url; foreach (int index in indexes) { complexIndex = searchResultList.Items[index].Text; } if (complexIndex != "") { notificationIndex = complexIndex.Substring(0, complexIndex.IndexOf("-")); locationIndex = complexIndex.Substring(complexIndex.Length - 1, 1); string fileName = ""; if (int.Parse(notificationIndex) == 1) { fileName = "Campus_notification.txt"; } if (int.Parse(notificationIndex) == 2) { fileName = "Educational_Department_notification.txt"; } if (int.Parse(notificationIndex) == 3) { fileName = "Humanity_news.txt"; } if (int.Parse(notificationIndex) == 4) { fileName = "Humanity_notification.txt"; } if (int.Parse(notificationIndex) == 5) { fileName = "Global_Business_news.txt"; } if (int.Parse(notificationIndex) == 6) { fileName = "Global_Business_notification.txt"; } if (int.Parse(notificationIndex) == 7) { fileName = "Package_Engineering_news.txt"; } if (int.Parse(notificationIndex) == 8) { fileName = "Package_Engineering_notification.txt"; } if (int.Parse(notificationIndex) == 9) { fileName = "Translation_news.txt"; } if (int.Parse(notificationIndex) == 10) { fileName = "Translation_notification.txt"; } int location = int.Parse(locationIndex); // 读取文件 string path = Application.StartupPath.Substring(0, Application.StartupPath.Length - 10) + "\\Properties\\Get_Notifications\\dist\\" + fileName; // 使用Encoding.GetEncording("utf-8")解决中文读取乱码的问题 string[] allLines = File.ReadAllLines(path, Encoding.GetEncoding("utf-8")); // 获取url并转化为Uri url = allLines[location * 3 - 1]; Uri uri = new Uri(url); MessageDetail messageDetail = new MessageDetail(); // 设置url messageDetail.webBrowser1.Url = uri; // 显示页面 messageDetail.Show(); LogHelper.WriteLog(typeof(SearchResults), "用户点击搜索结果,索引为" + fileName + "中的" + "第" + locationIndex + "条通知"); } }