hamzabil11
Member
- Joined
- Aug 23, 2014
- Messages
- 9
- Programming Experience
- 1-3
I need some help making a vos in visual basic .net. So far I am very confused. The vos is supposed to read a text file and then get info from it. Every text file will contain 3 lines of information for the vos. The 1st line will be the name of the custom app, the 2nd being the icon, and the 3rd being the executable path. The app is supposed to read all these types of text files in a special folder and then:
In the folder there are 2 text files, one being for a calculator app and the other for a text editor. when the vos starts up, it will find all the text files in that folder, and read them one by one, getting the info for them and creating the controls.
I have sort of got an idea for creating the picturebox, the panel and the label, but i am stuck on the onclick handler for the panel.
I do have some code:
The aim is that anyone can add apps for the vos, even games and stuff like microsoft word and windows media player, and anyone can use or create apps to run in the vos shell environment.
Any help would be very grateful,
hamzabil11
- create a picturebox and then set its picture to the 2nd line of text in the specified text file.
- create a label and place it just under the new picturebox, and then set its text to the 1st line in the text file
- add a panel to the form, and place the newly created picturebox and label into the panel.
- Add a onclick handler to the new panel, and set it to run the executable path specified in the 3rd line of code.
In the folder there are 2 text files, one being for a calculator app and the other for a text editor. when the vos starts up, it will find all the text files in that folder, and read them one by one, getting the info for them and creating the controls.
I have sort of got an idea for creating the picturebox, the panel and the label, but i am stuck on the onclick handler for the panel.
I do have some code:
VB.NET:
[COLOR=#222222][FONT=Verdana]Imports System.IO
[/FONT][/COLOR][COLOR=#222222][FONT=Verdana]Module ReadApplicationsAtBoot[/FONT][/COLOR][/FONT][/COLOR]
Dim AppPath As String = New System.IO.FileInfo(Windows.Forms.Application.ExecutablePath).DirectoryName
Dim dir As New DirectoryInfo(AppPath & "\customapps")
Dim allLines As List(Of String) = New List(Of String)
Sub Checkforapps()
For Each file As FileInfo In Dir.GetFiles()
Dim read As New StreamReader(file.DirectoryName)
Do While Not read.EndOfStream
allLines.Add(read.ReadLine())
Loop
Dim apppic As String = ReadLine(2, allLines)
Dim pan1 As New Panel
Dim pic1 As New PictureBox
pic1.Parent = pan1
pic1.Image = Image.FromFile(apppic)
pan1.Controls.Add(pic1)
Dim lab1 As New Label
lab1.Text = ReadLine(1, allLines)
pan1.Controls.Add(lab1)
Desktop.Controls.Add(pan1)
AddHandler pan1.Click, AddressOf Appclick
Next
End Sub
Public Function ReadLine(lineNumber As Integer, lines As List(Of String)) As String
Return lines(lineNumber - 1)
End Function
Sub Appclick()
'This is where i need some help, the below code does not work...
Try
Shell(ReadLine(3, allLines))
Catch
MessageBox.Show("An error has occured launching the application.")
End Try
'The problem with the code is that it only runs the app whose text file is first in the folder
End Sub
End Module
The aim is that anyone can add apps for the vos, even games and stuff like microsoft word and windows media player, and anyone can use or create apps to run in the vos shell environment.
Any help would be very grateful,
hamzabil11