27 Ekim 2012 Cumartesi

Portable Application Menu for Flash Drives – SharpDevelop VB.NET – Source Code


I wanted a very simple Non Bloated Portable Apps Menu which as I found out it is not as easy to find as one would expect, All the free menu’s out there were just way over the top and also totally consume your flash drive. So here I have written a nasty, rough as guts menu download the Flash Drive Menu Source Code don’t expect quality coding though it ain’t going to happen.
To use this menu compile it using SharpDevelop (that’s what I used to write it in), to add application’s to the menu just click the “Add App” button and place the portable application in a folder that is named EXACTLY the same name as the portable app, e.g “notepad.exe” goes in a folder called “notepad”
'
' Created by SharpDevelop.
' User: Wazza
' Date: 19/09/2011
' Time: 12:38 AM
' 
' To change this template use Tools | Options | Coding | Edit Standard Headers.
'
Public Partial Class MainForm

 Public Sub New()
  ' The Me.InitializeComponent call is required for Windows Forms designer support.
  Me.InitializeComponent()

  '
  ' TODO : Add constructor code after InitializeComponents
  '
 End Sub

 Sub MainFormLoad(sender As Object, e As EventArgs)

  notifyIcon.Visible = True

  Dim x As Integer
        Dim y As Integer
        x = Screen.PrimaryScreen.WorkingArea.Width - 230
        y = Screen.PrimaryScreen.WorkingArea.Height - 370
        Me.Location = New Point(x, y)

  GetDIR()
 End Sub

 Sub GetDIR()
       ListBox1.Items.Clear() 

    Dim LocalDIR As String = Application.StartupPath & "/applications/"
       Dim basedir As New IO.DirectoryInfo(localDIR) 
       Dim dir1 As IO.DirectoryInfo() = basedir.GetDirectories() 
       Dim dir As IO.DirectoryInfo 
       'list the names of all files in the specified directory 
       For Each dir In dir1 
           ListBox1.Items.Add(dir) 
       Next 
 End Sub

 Sub ListBox1SelectedIndexChanged(sender As Object, e As EventArgs)

 End Sub

 Sub NotifyIconMouseDoubleClick(sender As Object, e As MouseEventArgs)
  Me.WindowState = WindowState.Normal
 End Sub

 Sub BtnLaunchClick(sender As Object, e As EventArgs)
  Try
  Dim LocalDIR As String = Application.StartupPath & "\applications\" & listBox1.SelectedItem.ToString & "\" & listBox1.SelectedItem.ToString & ".exe"
   Process.Start(LocalDIR)
  Catch
   MsgBox("Select an application.")
  End Try
 End Sub

 Sub BtnAddAppClick(sender As Object, e As EventArgs)
  MsgBox("Place new portable application(s) in folder(s) named EXACTLY the same as the portable exe." & vbNewLine & vbNewLine & "e.g notepad.exe in folder named notepad.", MsgBoxStyle.Information, "Remember When Adding New Apps")
  Process.Start(Application.StartupPath & "\applications\")
 End Sub
End Class

Hiç yorum yok: