Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Option Strict On
- Option Explicit On
- Imports Microsoft.VisualBasic
- Imports System
- Imports System.Globalization
- Imports System.Net
- Imports System.Xml
- Imports System.IO
- Public Class Form1
- Dim myRequest As WebRequest
- Dim myResponse As WebResponse
- Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- 'link cần thay đổi để lấy dữ liệu của trang blog bạn cần.
- Dim url As String = "http://www.hungcoder.com/feeds/posts/default"
- Dim rssFeed As HttpWebRequest = DirectCast(WebRequest.Create(url), HttpWebRequest)
- Dim response = rssFeed.GetResponse()
- Dim rssStream = response.GetResponseStream()
- Dim rssDoc As New XmlDocument()
- rssDoc.Load(rssStream)
- Dim rssItems As XmlNodeList = rssDoc.SelectNodes("rss/channel/item")
- Dim i As Integer = 0
- Dim dt As DataTable = New DataTable("table")
- dt.Columns.Add("title", Type.GetType("System.String"))
- dt.Columns.Add("link", Type.GetType("System.String"))
- While i < rssItems.Count
- Dim node As XmlNode = rssItems.Item(i).SelectSingleNode("title")
- Dim title As String
- Dim link As String
- If node IsNot Nothing Then
- title = node.InnerText
- Else
- title = ""
- End If
- node = rssItems.Item(i).SelectSingleNode("link")
- If node IsNot Nothing Then
- link = node.InnerText
- Else
- link = ""
- End If
- Dim dr As DataRow = dt.NewRow()
- dr("title") = title
- dr("link") = link
- dt.Rows.Add(dr)
- i += 1
- End While
- DataGridView1.DataSource = dt
- DataGridView1.Columns(1).Width = 900
- DataGridView1.Columns(0).Width = 420
- End Sub
- Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
- Try
- If Me.WindowState = FormWindowState.Minimized Then
- Me.Visible = False
- NotifyIcon1.Visible = True
- NotifyIcon1.ShowBalloonTip(1, "Thông Báo", "HungCoder.Com Đang Ẩn Nấp Tại Đây.", ToolTipIcon.Info)
- End If
- Catch ex As Exception
- MsgBox(ex.Message)
- End Try
- End Sub
- Private Sub NotifyIcon1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles NotifyIcon1.MouseClick
- Me.Show()
- NotifyIcon1.ShowBalloonTip(500, "Thông Báo", "HungCoder.Com Đã Có Mặt.", ToolTipIcon.Info)
- End Sub
- Private Sub NotifyIcon1_MouseDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
- Try
- Me.Visible = True
- Me.WindowState = FormWindowState.Normal
- NotifyIcon1.Visible = False
- Catch ex As Exception
- MsgBox(ex.Message)
- End Try
- End Sub
- Private Sub AuthorToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AuthorToolStripMenuItem.Click
- Process.Start("https://www.hungcoder.com/p/about.html")
- End Sub
- Private Sub MyBlogToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBlogToolStripMenuItem.Click
- Process.Start("https://link.hungcoder.com/")
- End Sub
- Private Sub FacebookToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FacebookToolStripMenuItem.Click
- Process.Start("https://link.hungcoder.com/go/facebook")
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement