




免费预览已结束,剩余2页可下载查看
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
Desktop桌面程序源代码添加资源窗体:Public Class FrmAddResourcesPrivate Sub BtAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtAdd.Click If Me.TbResourcesKind.Text = Or Me.TbResourcesName.Text = Or Me.TbResourcesPosition.Text = Or Me.TbUsername.Text = Or Me.TbResourcesDescription.Text = Then MsgBox(请输入完整的信息,谢谢!, MsgBoxStyle.Exclamation) 判断是否输入完整,否则给出提示 Else Me.Close() End If End Sub 添加按钮End Class登陆窗体:Public Class FrmLogin Dim WebService1 As New localhost.Service Private Sub BtReset_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtReset.Click TbUserName.Text = TbPassword.Text = TbUserName.Focus() End Sub 重置按钮 Private Sub BtLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtLogin.Click If WebService1.UserLogin(Me.TbUserName.Text, Me.TbPassword.Text) = LoginOK Then 判断,如果SERVICE返回的信息正确时,进入系统 FrmMain.TbResourcesUrl.Text = WebService1.GetResourcesList() FrmMain.Show() Me.Finalize() Else MsgBox(您输入的帐号,密码有误,请重新输入!, MsgBoxStyle.Exclamation) 错误时,给出错误提示 End If End Sub 登陆按钮 Private Sub TbWebService_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TbWebService.TextChanged On Error Resume Next ServiceUrl = Me.TbWebService.Text WebService1.Url = ServiceUrl End Sub 即时更新Service的地址 Private Sub BtRegister_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtRegister.Click Dim NewFrmReg As New FrmRegister NewFrmReg.ShowDialog(Me) If WebService1.AddUsers(NewFrmReg.TbUsername.Text, NewFrmReg.TbPassword.Text, NewFrmReg.TbEmail.Text) = RegisterOK Then MsgBox(注册成功,请您使用刚才的帐户登陆系统,谢谢!, MsgBoxStyle.Information) Else MsgBox(注册失败,可能存在已有的帐户,请重新输入,谢谢, MsgBoxStyle.Information) End If End Sub 注册按钮End Class主窗体代码Public Class FrmMain Dim Service2 As New localhost.Service 建立一个新的WebService Private feedItems As ArrayList Private Sub BtFresh_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtFresh.Click RefreshChannel() End Sub 刷新按钮 Private Sub RefreshChannel() If TbResourcesUrl.Text Then Dim channel As New RSSChannel(TbResourcesUrl.Text) feedItems = channel.GetChannelItems() LbResourcesName.DisplayMember = ResNames LbResourcesName.ValueMember = ResNames LbResourcesName.DataSource = feedItems End If End Sub 刷新资源信息 Private Sub LbResourcesName_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LbResourcesName.SelectedIndexChanged If LbResourcesName.Items.Count 0 Then Dim currentItem As RSSItem currentItem = feedItems(LbResourcesName.SelectedIndex) LbResourcesKind.Text = currentItem.Kinds LLbResourcesURL.Text = currentItem.Positions LLbResourcesURL.Links(0).Start = 0 LLbResourcesURL.Links(0).Length = currentItem.Positions.Length LLbResourcesURL.Links(0).LinkData = currentItem.Positions WbResourcesDescript.DocumentText = currentItem.Description End If End Sub 显示详细信息 Private Sub LLbResourcesURL_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LLbResourcesURL.LinkClicked System.Diagnostics.Process.Start(LLbResourcesURL.Links(0).LinkData) End Sub 弹开连接网站 Private Sub FrmMain_Disposed(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Disposed End End Sub 关闭按钮 Private Sub FrmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Service2.Url = ServiceUrl End Sub 窗体初始化 Private Sub BtAddResources_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtAddResources.Click Dim NewFrmAddRes As New FrmAddResources NewFrmAddRes.ShowDialog(Me) If Service2.AddResources(NewFrmAddRes.TbUsername.Text, NewFrmAddRes.TbResourcesPosition.Text, NewFrmAddRes.TbResourcesKind.Text, NewFrmAddRes.TbResourcesName.Text, NewFrmAddRes.TbResourcesDescription.Text) = AddResourcesOK Then MsgBox(添加资源成功,感谢您为本系统的建设出了一份力!, MsgBoxStyle.Information) Else MsgBox(由于某些原因,添加资源未成功,请重新操作,谢谢!, MsgBoxStyle.Exclamation) End If End SubEnd Class注册窗体代码:Public Class FrmRegister Private Sub BtRegister_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtRegister.Click If Me.TbEmail.Text = Or Me.TbPassword.Text = Or Me.TbUsername.Text = Then MsgBox(请输入完整的信息,谢谢!, MsgBoxStyle.Exclamation) 判断信息输入是否完整,否则给出提示 Else Me.Close() End If End Sub 注册按钮End Class全局变量模块:Module ModPublicVar Public ServiceUrl As StringEnd ModuleRSSChennel类:Imports System.IOImports System.NetImports System.XmlPublic Class RSSChannel Private m_FeedURL As String 定义相关变量用于储存临时信息 Private m_ResNames As String Private m_Positions As String Private m_Kind As String Private m_Description As String#Region 属性 Public Property FeedURL() As String Get Return m_FeedURL End Get Set(ByVal value As String) m_FeedURL = value End Set End Property Public Property ResNames() As String Get Return m_ResNames End Get Set(ByVal value As String) m_ResNames = value End Set End Property Public Property Positions() As String Get Return m_Positions End Get Set(ByVal value As String) m_Positions = value End Set End Property Public Property Kinds() As String Get Return m_Kind End Get Set(ByVal value As String) m_Kind = value End Set End Property Public Property Description() As String Get Return m_Description End Get Set(ByVal value As String) m_Description = value End Set End Property#End Region 对以上属性进行定义#Region 方法 Public Sub New(ByVal url As String) FeedURL = url ResNames = Positions = Kinds = Description = End Sub 实例化一个新对象的方法 Private Function GetXMLDoc(ByVal node As String) As XmlNodeList Dim tempNodeList As System.Xml.XmlNodeList = Nothing Dim request As WebRequest = WebRequest.Create(Me.FeedURL) Dim response As WebResponse = request.GetResponse() Dim rssStream As Stream = response.GetResponseStream() Dim rssDoc As XmlDocument = New XmlDocument() rssDoc.Load(rssStream) tempNodeList = rssDoc.SelectNodes(node) Return tempNodeList End Function 获取节点信息的过程 Public Function GetChannelItems() As ArrayList On Error Resume Next Dim tempArrayList As New ArrayList Dim rssItems As XmlNodeList = GetXMLDoc(ResourceRss/Resource) Dim item As XmlNode For Each item In rssItems Dim newItem As New RSSItem If item.Attributes(Name).InnerText Then With newItem .ResNames = item.Attributes(Name).InnerText .Positions = item.Attributes(Position).InnerText .Kinds = item.SelectSingleNode(Kind).InnerText .Description = item.SelectSingleNode(Description).InnerText End With tempArrayList.Add(newItem) End If Next Return tempArrayList End Function 获取详细信息的过程#End Region 实例化一个新对象的方法End ClassRSSItem代码:Public Class RSSItem Private m_ResNames As String 定义相关变量 Private m_Posit
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年度办公用房租赁合同范本(含租赁地点条款)
- 房产转让合同样本:房地产买卖协议
- 建设项目设备供货及安装合同范例
- 2024海伦市职业技术教育中心学校工作人员招聘考试及答案
- 白内障手术相关知识
- 大型公共工程项目HSE履约合同
- 商业建筑维修施工合同模板
- 教育辅导中心合作合同协议书范本
- 电工劳务分包合同模板正式版
- 粉尘防爆知识培训
- 拖拉机驾驶员用工合同
- 2024无孩无共同财产离婚协议书模板
- 胆囊息肉临床路径标准住院流程
- 起诉闲鱼起诉书
- 2021修订《城市规划设计计费指导意见》
- 2023年油库生产试运行方案
- 睾丸肿瘤的护理查房
- 《水电工程运行调度规程编制导则》(NB-T 10084-2018)
- 《光伏发电工程工程量清单计价规范》
- 三年级数学认识面积(全国一等奖)
- 2024年政工职称考试题库附含答案
评论
0/150
提交评论