
نوشته شده توسط
mazoolagh
سلام و روز خوش
زیباست!
البته برنامه شما رو دانلود نکردم،
ولی با توجه به پست های اخیر فکر کنم از فایلهای html/css/javascript به صورت embedded resource استفاده کردین.
که در این صورت فکر کنم مجبورین از system.reflection استفاده کنین،
و این هم فکر کنم برنامه های obfuscatorها باهاش مشکل دارن.
نمیدونم چک کردین این مطلب رو یا نه،
ولی خوبه اگر تجربه ای دارین در میون بگذارین.
سلام
برای embedded resource یک Class Library ساختم که توی پروژه ها استفاده می کنم: (ضمیمه شد)
Imports EmbedRes.EmbeddedResource
Namespace EmbeddedResources
Friend Structure StyleSheets
Friend Const About As String = "AboutPage.css"
Friend Const [Default] As String = "StyleSheet1.css"
End Structure
Friend Structure HTMLDocuments
Friend Shared ReadOnly Property About() As String
Get
Return Document("AboutPage.html")
End Get
End Property
Friend Shared ReadOnly Property Details() As String
Get
Return Document("DetailsPage.html")
End Get
End Property
End Structure
End Namespace
With Me.WebBrowser
.DocumentText = HTMLDocuments.StartPage
End With
برای دسترسی به اشیاء برای هرکدوم یک متغیر می سازیم و:
Protected Friend WithEvents LoginButton, usernamebox, _
LoginEmailBox, ResetPasswordButton, LoginPasswordBox, emailbox, passwordbox, EditItemButton,
DeleteItemButton, DiscardItemButton, _
ConfirmPasswordBox, SignUpButton As HtmlElement
و متغیرها با اشیاء مرتبط مقدار دهی می شه
Private Sub WebBrowser_DocumentCompleted(sender As Object, e As System.Windows.Forms.WebBrowserDocumentCompletedEv entArgs) Handles WebBrowser.DocumentCompleted
With Me.WebBrowser
LoginButton = .Document.GetElementById("loginbutton")
SignUpButton = .Document.GetElementById("signupbutton")
usernamebox = .Document.GetElementById("username")
emailbox = .Document.GetElementById("email")
passwordbox = .Document.GetElementById("password")
ConfirmPasswordBox = .Document.GetElementById("confirmpassword")
LoginEmailBox = .Document.GetElementById("loginemail")
LoginEmailBox.SetAttribute("value", My.Settings.LastLoginName)
LoginPasswordBox = .Document.GetElementById("loginpassword")
ResetPasswordButton = .Document.GetElementById("resetpassword")
End With
End Sub
که می شه از رویداد هاشون استفاده کرد:
Private Sub ChangePasswordButton_Click(sender As Object, e As System.Windows.Forms.HtmlElementEventArgs) Handles ChangePasswordButton.Click
End Sub
سورسش دسترسم نیست الآن،ان شاء الله ارسال خواهم کرد