[LogWindow.vb]
[SIZE=1][COLOR=#0000ff]Imports[/COLOR][/SIZE][SIZE=1] System.Drawing[/SIZE]
[SIZE=1][COLOR=#0000ff]Imports[/COLOR][/SIZE][SIZE=1] System.Windows.Forms[/SIZE]
[SIZE=1][COLOR=#0000ff]Public[/COLOR][/SIZE][SIZE=1][COLOR=#0000ff]Class[/COLOR][/SIZE][SIZE=1] LogWindow[/SIZE]
[SIZE=1][COLOR=#0000ff]Public[/COLOR][/SIZE][SIZE=1][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=1][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=1]()[/SIZE]
[SIZE=1][COLOR=#008000]' This call is required by the Windows Form Designer.[/COLOR][/SIZE]
[SIZE=1]InitializeComponent()[/SIZE]
[SIZE=1][COLOR=#008000]' Change the text of the form[/COLOR][/SIZE]
[SIZE=1][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=1].Text = [/SIZE][SIZE=1][COLOR=#800000]"Log Window"[/COLOR][/SIZE]
[SIZE=1][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=1] applicationContext [/SIZE][SIZE=1][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=1] LogWindowContext = [/SIZE][SIZE=1][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=1] LogWindowContext[/SIZE]
[SIZE=1]Application.Run(applicationContext)[/SIZE]
[SIZE=1][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=1][COLOR=#0000ff]Sub[/COLOR][/SIZE]
[SIZE=1][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=1][COLOR=#0000ff]Class[/COLOR][/SIZE]
[LogWindowContext.vb]
[SIZE=1][COLOR=#0000ff]Imports[/COLOR][/SIZE][SIZE=1] System.Windows.Forms[/SIZE]
[SIZE=1][COLOR=#0000ff]Imports[/COLOR][/SIZE][SIZE=1] System.Drawing[/SIZE]
[SIZE=1][COLOR=#0000ff]Public[/COLOR][/SIZE][SIZE=1][COLOR=#0000ff]Class[/COLOR][/SIZE][SIZE=1] LogWindowContext[/SIZE]
[SIZE=1][COLOR=#0000ff]Inherits[/COLOR][/SIZE][SIZE=1] ApplicationContext[/SIZE]
[SIZE=1][COLOR=#0000ff]Private[/COLOR][/SIZE][SIZE=1] components [/SIZE][SIZE=1][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=1] System.ComponentModel.IContainer[/SIZE]
[SIZE=1][COLOR=#0000ff]Private[/COLOR][/SIZE][SIZE=1][COLOR=#0000ff]WithEvents[/COLOR][/SIZE][SIZE=1] logIcon [/SIZE][SIZE=1][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=1] System.Windows.Forms.NotifyIcon[/SIZE]
[SIZE=1][COLOR=#0000ff]Private[/COLOR][/SIZE][SIZE=1] logMenu [/SIZE][SIZE=1][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=1] System.Windows.Forms.ContextMenu[/SIZE]
[SIZE=1][COLOR=#0000ff]Private[/COLOR][/SIZE][SIZE=1][COLOR=#0000ff]WithEvents[/COLOR][/SIZE][SIZE=1] exitMenu [/SIZE][SIZE=1][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=1] System.Windows.Forms.MenuItem[/SIZE]
[SIZE=1][COLOR=#0000ff]Private[/COLOR][/SIZE][SIZE=1][COLOR=#0000ff]WithEvents[/COLOR][/SIZE][SIZE=1] showMenu [/SIZE][SIZE=1][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=1] System.Windows.Forms.MenuItem[/SIZE]
[SIZE=1][COLOR=#0000ff]Private[/COLOR][/SIZE][SIZE=1][COLOR=#0000ff]WithEvents[/COLOR][/SIZE][SIZE=1] logForm [/SIZE][SIZE=1][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=1] System.Windows.Forms.Form[/SIZE]
[SIZE=1][COLOR=#0000ff]Public[/COLOR][/SIZE][SIZE=1][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=1] LogApplicationContext()[/SIZE]
[SIZE=1]InitializeContext()[/SIZE]
[SIZE=1][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=1][COLOR=#0000ff]Sub[/COLOR][/SIZE]
[SIZE=1][COLOR=#0000ff]Private[/COLOR][/SIZE][SIZE=1][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=1] InitializeContext()[/SIZE]
[SIZE=1][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=1].components = [/SIZE][SIZE=1][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=1] System.ComponentModel.Container()[/SIZE]
[SIZE=1][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=1].logIcon = [/SIZE][SIZE=1][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=1] System.Windows.Forms.NotifyIcon([/SIZE][SIZE=1][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=1].components)[/SIZE]
[SIZE=1][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=1].logMenu = [/SIZE][SIZE=1][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=1] System.Windows.Forms.ContextMenu[/SIZE]
[SIZE=1][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=1].showMenu = [/SIZE][SIZE=1][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=1] System.Windows.Forms.MenuItem[/SIZE]
[SIZE=1][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=1].exitMenu = [/SIZE][SIZE=1][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=1] System.Windows.Forms.MenuItem[/SIZE]
[SIZE=1][COLOR=#008000]' Log Notify Icon[/COLOR][/SIZE]
[SIZE=1][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=1].logIcon.ContextMenu = [/SIZE][SIZE=1][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=1].logMenu[/SIZE]
[SIZE=1][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=1].logIcon.Icon = [/SIZE][SIZE=1][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=1] Icon([/SIZE][SIZE=1][COLOR=#800000]"import_itinerary_icon.ico"[/COLOR][/SIZE][SIZE=1])[/SIZE]
[SIZE=1][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=1].logIcon.Text = [/SIZE][SIZE=1][COLOR=#800000]"Importing Itineraries..."[/COLOR][/SIZE]
[SIZE=1][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=1].logIcon.Visible = [/SIZE][SIZE=1][COLOR=#0000ff]True[/COLOR][/SIZE]
[SIZE=1][COLOR=#008000]' Log Notify Context Menu[/COLOR][/SIZE]
[SIZE=1][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=1].logMenu.MenuItems.AddRange([/SIZE][SIZE=1][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=1] MenuItem() {showMenu, exitMenu})[/SIZE]
[SIZE=1][COLOR=#008000]' showMenu Context Item[/COLOR][/SIZE]
[SIZE=1][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=1].showMenu.Index = 0[/SIZE]
[SIZE=1][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=1].showMenu.Text = [/SIZE][SIZE=1][COLOR=#800000]"&Show Log Window"[/COLOR][/SIZE]
[SIZE=1][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=1].showMenu.DefaultItem = [/SIZE][SIZE=1][COLOR=#0000ff]True[/COLOR][/SIZE]
[SIZE=1][COLOR=#008000]' exitMenu Context Item[/COLOR][/SIZE]
[SIZE=1][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=1].exitMenu.Index = 1[/SIZE]
[SIZE=1][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=1].exitMenu.Text = [/SIZE][SIZE=1][COLOR=#800000]"E&xit"[/COLOR][/SIZE]
[SIZE=1][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=1][COLOR=#0000ff]Sub[/COLOR][/SIZE]
[SIZE=1][COLOR=#0000ff]Protected[/COLOR][/SIZE][SIZE=1][COLOR=#0000ff]Overrides[/COLOR][/SIZE][SIZE=1][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=1] Dispose([/SIZE][SIZE=1][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=1] disposing [/SIZE][SIZE=1][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=1][COLOR=#0000ff]Boolean[/COLOR][/SIZE][SIZE=1])[/SIZE]
[SIZE=1][COLOR=#0000ff]If[/COLOR][/SIZE][SIZE=1] disposing [/SIZE][SIZE=1][COLOR=#0000ff]AndAlso[/COLOR][/SIZE][SIZE=1] components [/SIZE][SIZE=1][COLOR=#0000ff]IsNot[/COLOR][/SIZE][SIZE=1][COLOR=#0000ff]Nothing[/COLOR][/SIZE][SIZE=1][COLOR=#0000ff]Then[/COLOR][/SIZE]
[SIZE=1]components.Dispose()[/SIZE]
[SIZE=1][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=1][COLOR=#0000ff]If[/COLOR][/SIZE]
[SIZE=1][COLOR=#0000ff]MyBase[/COLOR][/SIZE][SIZE=1].Dispose(disposing)[/SIZE]
[SIZE=1][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=1][COLOR=#0000ff]Sub[/COLOR][/SIZE]
[SIZE=1][COLOR=#0000ff]Private[/COLOR][/SIZE][SIZE=1][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=1] logIcon_DoubleClick([/SIZE][SIZE=1][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=1] sender [/SIZE][SIZE=1][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=1][COLOR=#0000ff]Object[/COLOR][/SIZE][SIZE=1], [/SIZE][SIZE=1][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=1] e [/SIZE][SIZE=1][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=1] System.EventArgs) [/SIZE][SIZE=1][COLOR=#0000ff]Handles[/COLOR][/SIZE][SIZE=1] logIcon.DoubleClick[/SIZE]
[SIZE=1]ShowForm()[/SIZE]
[SIZE=1][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=1][COLOR=#0000ff]Sub[/COLOR][/SIZE]
[SIZE=1][COLOR=#0000ff]Private[/COLOR][/SIZE][SIZE=1][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=1] showMenu_Click([/SIZE][SIZE=1][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=1] sender [/SIZE][SIZE=1][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=1][COLOR=#0000ff]Object[/COLOR][/SIZE][SIZE=1], [/SIZE][SIZE=1][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=1] e [/SIZE][SIZE=1][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=1] System.EventArgs) [/SIZE][SIZE=1][COLOR=#0000ff]Handles[/COLOR][/SIZE][SIZE=1] showMenu.Click[/SIZE]
[SIZE=1]ShowForm()[/SIZE]
[SIZE=1][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=1][COLOR=#0000ff]Sub[/COLOR][/SIZE]
[SIZE=1][COLOR=#0000ff]Private[/COLOR][/SIZE][SIZE=1][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=1] exitMenu_Click([/SIZE][SIZE=1][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=1] sender [/SIZE][SIZE=1][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=1][COLOR=#0000ff]Object[/COLOR][/SIZE][SIZE=1], [/SIZE][SIZE=1][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=1] e [/SIZE][SIZE=1][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=1] System.EventArgs) [/SIZE][SIZE=1][COLOR=#0000ff]Handles[/COLOR][/SIZE][SIZE=1] exitMenu.Click[/SIZE]
[SIZE=1]ExitThread()[/SIZE]
[SIZE=1][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=1][COLOR=#0000ff]Sub[/COLOR][/SIZE]
[SIZE=1][COLOR=#0000ff]Private[/COLOR][/SIZE][SIZE=1][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=1] ShowForm()[/SIZE]
[SIZE=1][COLOR=#0000ff]If[/COLOR][/SIZE][SIZE=1] logForm [/SIZE][SIZE=1][COLOR=#0000ff]Is[/COLOR][/SIZE][SIZE=1][COLOR=#0000ff]Nothing[/COLOR][/SIZE][SIZE=1][COLOR=#0000ff]Then[/COLOR][/SIZE]
[SIZE=1]logForm = [/SIZE][SIZE=1][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=1] LogWindow[/SIZE]
[SIZE=1]logForm.Show()[/SIZE]
[SIZE=1][COLOR=#0000ff]Else[/COLOR][/SIZE]
[SIZE=1]logForm.Activate()[/SIZE]
[SIZE=1][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=1][COLOR=#0000ff]If[/COLOR][/SIZE]
[SIZE=1][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=1][COLOR=#0000ff]Sub[/COLOR][/SIZE]
[SIZE=1][COLOR=#0000ff]Private[/COLOR][/SIZE][SIZE=1][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=1] logForm_FormClosed([/SIZE][SIZE=1][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=1] sender [/SIZE][SIZE=1][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=1][COLOR=#0000ff]Object[/COLOR][/SIZE][SIZE=1], [/SIZE][SIZE=1][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=1] e [/SIZE][SIZE=1][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=1] System.Windows.Forms.FormClosedEventArgs) [/SIZE][SIZE=1][COLOR=#0000ff]Handles[/COLOR][/SIZE][SIZE=1] logForm.FormClosed[/SIZE]
[SIZE=1][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=1].logForm = [/SIZE][SIZE=1][COLOR=#0000ff]Nothing[/COLOR][/SIZE]
[SIZE=1][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=1][COLOR=#0000ff]Sub[/COLOR][/SIZE]
[SIZE=1][COLOR=#0000ff]Protected[/COLOR][/SIZE][SIZE=1][COLOR=#0000ff]Overrides[/COLOR][/SIZE][SIZE=1][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=1] ExitThreadCore()[/SIZE]
[SIZE=1][COLOR=#0000ff]If[/COLOR][/SIZE][SIZE=1] logForm [/SIZE][SIZE=1][COLOR=#0000ff]IsNot[/COLOR][/SIZE][SIZE=1][COLOR=#0000ff]Nothing[/COLOR][/SIZE][SIZE=1][COLOR=#0000ff]Then[/COLOR][/SIZE]
[SIZE=1]logForm.Close()[/SIZE]
[SIZE=1][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=1][COLOR=#0000ff]If[/COLOR][/SIZE]
[SIZE=1][COLOR=#0000ff]MyBase[/COLOR][/SIZE][SIZE=1].ExitThreadCore()[/SIZE]
[SIZE=1][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=1][COLOR=#0000ff]Sub[/COLOR][/SIZE]
[SIZE=1][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=1][COLOR=#0000ff]Class[/COLOR][/SIZE]