'
' Created by SharpDevelop.
' User: Scott
' Date: 29/06/2004
' Time: 00:44
' 
' To change this template use Tools | Options | Coding | Edit Standard Headers.
'
Imports System
Imports System.Drawing
Imports System.Windows.Forms
Imports System.xml
Imports System.io

Namespace DefaultNamespace
	
	Public Class MainForm
		Inherits System.Windows.Forms.Form
		Private DarkBlizzardPassbutton As System.Windows.Forms.Button
		Private MarkerStonecomboBox As System.Windows.Forms.ComboBox
		Private CausewaycomboBox As System.Windows.Forms.ComboBox
		Private PaintscomboBox As System.Windows.Forms.ComboBox
		Private CotleycomboBox As System.Windows.Forms.ComboBox
		Private Ashwoodbutton As System.Windows.Forms.Button
		Private AddQuest As System.Windows.Forms.Button
		Private Cotleybutton As System.Windows.Forms.Button
		Private TowncomboBox As System.Windows.Forms.ComboBox
		Private TokenscomboBox As System.Windows.Forms.ComboBox
		Private Paintsbutton As System.Windows.Forms.Button
		Private MarkerStonesbutton As System.Windows.Forms.Button
		Private label7 As System.Windows.Forms.Label
		Private Darkwellbutton As System.Windows.Forms.Button
		Private DarkBlizzardPasscomboBox As System.Windows.Forms.ComboBox
		Private label3 As System.Windows.Forms.Label
		Private label2 As System.Windows.Forms.Label
		Private label1 As System.Windows.Forms.Label
		Private AshwoodcomboBox As System.Windows.Forms.ComboBox
		Private label6 As System.Windows.Forms.Label
		Private label5 As System.Windows.Forms.Label
		Private label4 As System.Windows.Forms.Label
		Private Tokensbutton As System.Windows.Forms.Button
		Private Townbutton As System.Windows.Forms.Button
		Private label9 As System.Windows.Forms.Label
		Private label8 As System.Windows.Forms.Label
		Private DarkwellcomboBox As System.Windows.Forms.ComboBox
		Private Causewaybutton As System.Windows.Forms.Button
		
		Public Shared Sub Main
			Dim fMainForm As New MainForm
						fMainForm.ShowDialog()
		End Sub
		
		Public Sub New()
			MyBase.New
			'
			' The Me.InitializeComponent call is required for Windows Forms designer support.
			'
			Me.InitializeComponent
			'
			' TODO : Add constructor code after InitializeComponents
			'
		End Sub
		
		#Region " Windows Forms Designer generated code "
		' This method is required for Windows Forms designer support.
		' Do not change the method contents inside the source code editor. The Forms designer might
		' not be able to load this method if it was changed manually.
		Private Sub InitializeComponent()
			Me.Causewaybutton = New System.Windows.Forms.Button
			Me.DarkwellcomboBox = New System.Windows.Forms.ComboBox
			Me.label8 = New System.Windows.Forms.Label
			Me.label9 = New System.Windows.Forms.Label
			Me.Townbutton = New System.Windows.Forms.Button
			Me.Tokensbutton = New System.Windows.Forms.Button
			Me.label4 = New System.Windows.Forms.Label
			Me.label5 = New System.Windows.Forms.Label
			Me.label6 = New System.Windows.Forms.Label
			Me.AshwoodcomboBox = New System.Windows.Forms.ComboBox
			Me.label1 = New System.Windows.Forms.Label
			Me.label2 = New System.Windows.Forms.Label
			Me.label3 = New System.Windows.Forms.Label
			Me.DarkBlizzardPasscomboBox = New System.Windows.Forms.ComboBox
			Me.Darkwellbutton = New System.Windows.Forms.Button
			Me.label7 = New System.Windows.Forms.Label
			Me.MarkerStonesbutton = New System.Windows.Forms.Button
			Me.Paintsbutton = New System.Windows.Forms.Button
			Me.TokenscomboBox = New System.Windows.Forms.ComboBox
			Me.TowncomboBox = New System.Windows.Forms.ComboBox
			Me.Cotleybutton = New System.Windows.Forms.Button
			Me.AddQuest = New System.Windows.Forms.Button
			Me.Ashwoodbutton = New System.Windows.Forms.Button
			Me.CotleycomboBox = New System.Windows.Forms.ComboBox
			Me.PaintscomboBox = New System.Windows.Forms.ComboBox
			Me.CausewaycomboBox = New System.Windows.Forms.ComboBox
			Me.MarkerStonecomboBox = New System.Windows.Forms.ComboBox
			Me.DarkBlizzardPassbutton = New System.Windows.Forms.Button
			Me.SuspendLayout
			'
			'Causewaybutton
			'
			Me.Causewaybutton.Location = New System.Drawing.Point(8, 160)
			Me.Causewaybutton.Name = "Causewaybutton"
			Me.Causewaybutton.Size = New System.Drawing.Size(120, 24)
			Me.Causewaybutton.TabIndex = 32
			Me.Causewaybutton.Text = "Go"
			'
			'DarkwellcomboBox
			'
			Me.DarkwellcomboBox.Location = New System.Drawing.Point(264, 32)
			Me.DarkwellcomboBox.Name = "DarkwellcomboBox"
			Me.DarkwellcomboBox.Size = New System.Drawing.Size(120, 21)
			Me.DarkwellcomboBox.TabIndex = 13
			'
			'label8
			'
			Me.label8.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0,Byte))
			Me.label8.Location = New System.Drawing.Point(136, 104)
			Me.label8.Name = "label8"
			Me.label8.Size = New System.Drawing.Size(120, 16)
			Me.label8.TabIndex = 21
			Me.label8.Text = "Paints"
			Me.label8.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
			'
			'label9
			'
			Me.label9.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0,Byte))
			Me.label9.Location = New System.Drawing.Point(8, 104)
			Me.label9.Name = "label9"
			Me.label9.Size = New System.Drawing.Size(120, 16)
			Me.label9.TabIndex = 22
			Me.label9.Text = "Causeway"
			Me.label9.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
			'
			'Townbutton
			'
			Me.Townbutton.Location = New System.Drawing.Point(8, 64)
			Me.Townbutton.Name = "Townbutton"
			Me.Townbutton.Size = New System.Drawing.Size(120, 24)
			Me.Townbutton.TabIndex = 8
			Me.Townbutton.Text = "Go"
			'
			'Tokensbutton
			'
			Me.Tokensbutton.Location = New System.Drawing.Point(264, 160)
			Me.Tokensbutton.Name = "Tokensbutton"
			Me.Tokensbutton.Size = New System.Drawing.Size(120, 24)
			Me.Tokensbutton.TabIndex = 31
			Me.Tokensbutton.Text = "Go"
			'
			'label4
			'
			Me.label4.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0,Byte))
			Me.label4.Location = New System.Drawing.Point(136, 8)
			Me.label4.Name = "label4"
			Me.label4.Size = New System.Drawing.Size(120, 16)
			Me.label4.TabIndex = 11
			Me.label4.Text = "Ashwood"
			Me.label4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
			'
			'label5
			'
			Me.label5.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0,Byte))
			Me.label5.Location = New System.Drawing.Point(8, 192)
			Me.label5.Name = "label5"
			Me.label5.Size = New System.Drawing.Size(120, 16)
			Me.label5.TabIndex = 18
			Me.label5.Text = "Cotley"
			Me.label5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
			'
			'label6
			'
			Me.label6.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0,Byte))
			Me.label6.Location = New System.Drawing.Point(392, 104)
			Me.label6.Name = "label6"
			Me.label6.Size = New System.Drawing.Size(120, 16)
			Me.label6.TabIndex = 19
			Me.label6.Text = "Marker Stones"
			Me.label6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
			'
			'AshwoodcomboBox
			'
			Me.AshwoodcomboBox.Location = New System.Drawing.Point(136, 32)
			Me.AshwoodcomboBox.Name = "AshwoodcomboBox"
			Me.AshwoodcomboBox.Size = New System.Drawing.Size(120, 21)
			Me.AshwoodcomboBox.TabIndex = 14
			'
			'label1
			'
			Me.label1.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0,Byte))
			Me.label1.Location = New System.Drawing.Point(8, 8)
			Me.label1.Name = "label1"
			Me.label1.Size = New System.Drawing.Size(120, 16)
			Me.label1.TabIndex = 0
			Me.label1.Text = "Town"
			Me.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
			'
			'label2
			'
			Me.label2.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0,Byte))
			Me.label2.Location = New System.Drawing.Point(392, 8)
			Me.label2.Name = "label2"
			Me.label2.Size = New System.Drawing.Size(120, 16)
			Me.label2.TabIndex = 9
			Me.label2.Text = "Dark Blizzard Pass"
			Me.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
			'
			'label3
			'
			Me.label3.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0,Byte))
			Me.label3.Location = New System.Drawing.Point(264, 8)
			Me.label3.Name = "label3"
			Me.label3.Size = New System.Drawing.Size(120, 16)
			Me.label3.TabIndex = 10
			Me.label3.Text = "Darkwell"
			Me.label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
			'
			'DarkBlizzardPasscomboBox
			'
			Me.DarkBlizzardPasscomboBox.Location = New System.Drawing.Point(392, 32)
			Me.DarkBlizzardPasscomboBox.Name = "DarkBlizzardPasscomboBox"
			Me.DarkBlizzardPasscomboBox.Size = New System.Drawing.Size(120, 21)
			Me.DarkBlizzardPasscomboBox.TabIndex = 12
			'
			'Darkwellbutton
			'
			Me.Darkwellbutton.Location = New System.Drawing.Point(264, 64)
			Me.Darkwellbutton.Name = "Darkwellbutton"
			Me.Darkwellbutton.Size = New System.Drawing.Size(120, 24)
			Me.Darkwellbutton.TabIndex = 16
			Me.Darkwellbutton.Text = "Go"
			'
			'label7
			'
			Me.label7.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0,Byte))
			Me.label7.Location = New System.Drawing.Point(264, 104)
			Me.label7.Name = "label7"
			Me.label7.Size = New System.Drawing.Size(120, 16)
			Me.label7.TabIndex = 20
			Me.label7.Text = "Tokens"
			Me.label7.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
			'
			'MarkerStonesbutton
			'
			Me.MarkerStonesbutton.Location = New System.Drawing.Point(392, 160)
			Me.MarkerStonesbutton.Name = "MarkerStonesbutton"
			Me.MarkerStonesbutton.Size = New System.Drawing.Size(120, 24)
			Me.MarkerStonesbutton.TabIndex = 28
			Me.MarkerStonesbutton.Text = "Go"
			'
			'Paintsbutton
			'
			Me.Paintsbutton.Location = New System.Drawing.Point(136, 160)
			Me.Paintsbutton.Name = "Paintsbutton"
			Me.Paintsbutton.Size = New System.Drawing.Size(120, 24)
			Me.Paintsbutton.TabIndex = 29
			Me.Paintsbutton.Text = "Go"
			'
			'TokenscomboBox
			'
			Me.TokenscomboBox.Location = New System.Drawing.Point(264, 128)
			Me.TokenscomboBox.Name = "TokenscomboBox"
			Me.TokenscomboBox.Size = New System.Drawing.Size(120, 21)
			Me.TokenscomboBox.TabIndex = 24
			'
			'TowncomboBox
			'
			Me.TowncomboBox.Location = New System.Drawing.Point(8, 32)
			Me.TowncomboBox.Name = "TowncomboBox"
			Me.TowncomboBox.Size = New System.Drawing.Size(120, 21)
			Me.TowncomboBox.TabIndex = 4
			'
			'Cotleybutton
			'
			Me.Cotleybutton.Location = New System.Drawing.Point(8, 248)
			Me.Cotleybutton.Name = "Cotleybutton"
			Me.Cotleybutton.Size = New System.Drawing.Size(120, 24)
			Me.Cotleybutton.TabIndex = 30
			Me.Cotleybutton.Text = "Go"
			'
			'AddQuest
			'
			Me.AddQuest.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0,Byte))
			Me.AddQuest.Location = New System.Drawing.Point(392, 248)
			Me.AddQuest.Name = "AddQuest"
			Me.AddQuest.Size = New System.Drawing.Size(128, 24)
			Me.AddQuest.TabIndex = 33
			Me.AddQuest.Text = "Add Quest"
			'
			'Ashwoodbutton
			'
			Me.Ashwoodbutton.Location = New System.Drawing.Point(136, 64)
			Me.Ashwoodbutton.Name = "Ashwoodbutton"
			Me.Ashwoodbutton.Size = New System.Drawing.Size(120, 24)
			Me.Ashwoodbutton.TabIndex = 17
			Me.Ashwoodbutton.Text = "Go"
			'
			'CotleycomboBox
			'
			Me.CotleycomboBox.Location = New System.Drawing.Point(8, 216)
			Me.CotleycomboBox.Name = "CotleycomboBox"
			Me.CotleycomboBox.Size = New System.Drawing.Size(120, 21)
			Me.CotleycomboBox.TabIndex = 23
			'
			'PaintscomboBox
			'
			Me.PaintscomboBox.Location = New System.Drawing.Point(136, 128)
			Me.PaintscomboBox.Name = "PaintscomboBox"
			Me.PaintscomboBox.Size = New System.Drawing.Size(120, 21)
			Me.PaintscomboBox.TabIndex = 25
			'
			'CausewaycomboBox
			'
			Me.CausewaycomboBox.Location = New System.Drawing.Point(8, 128)
			Me.CausewaycomboBox.Name = "CausewaycomboBox"
			Me.CausewaycomboBox.Size = New System.Drawing.Size(120, 21)
			Me.CausewaycomboBox.TabIndex = 26
			'
			'MarkerStonecomboBox
			'
			Me.MarkerStonecomboBox.Location = New System.Drawing.Point(392, 128)
			Me.MarkerStonecomboBox.Name = "MarkerStonecomboBox"
			Me.MarkerStonecomboBox.Size = New System.Drawing.Size(120, 21)
			Me.MarkerStonecomboBox.TabIndex = 27
			'
			'DarkBlizzardPassbutton
			'
			Me.DarkBlizzardPassbutton.Location = New System.Drawing.Point(392, 64)
			Me.DarkBlizzardPassbutton.Name = "DarkBlizzardPassbutton"
			Me.DarkBlizzardPassbutton.Size = New System.Drawing.Size(120, 24)
			Me.DarkBlizzardPassbutton.TabIndex = 15
			Me.DarkBlizzardPassbutton.Text = "Go"
			'
			'MainForm
			'
			Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
			Me.ClientSize = New System.Drawing.Size(528, 278)
			Me.Controls.Add(Me.AddQuest)
			Me.Controls.Add(Me.Causewaybutton)
			Me.Controls.Add(Me.Tokensbutton)
			Me.Controls.Add(Me.Cotleybutton)
			Me.Controls.Add(Me.Paintsbutton)
			Me.Controls.Add(Me.MarkerStonesbutton)
			Me.Controls.Add(Me.MarkerStonecomboBox)
			Me.Controls.Add(Me.CausewaycomboBox)
			Me.Controls.Add(Me.PaintscomboBox)
			Me.Controls.Add(Me.TokenscomboBox)
			Me.Controls.Add(Me.CotleycomboBox)
			Me.Controls.Add(Me.label9)
			Me.Controls.Add(Me.label8)
			Me.Controls.Add(Me.label7)
			Me.Controls.Add(Me.label6)
			Me.Controls.Add(Me.label5)
			Me.Controls.Add(Me.Ashwoodbutton)
			Me.Controls.Add(Me.Darkwellbutton)
			Me.Controls.Add(Me.DarkBlizzardPassbutton)
			Me.Controls.Add(Me.AshwoodcomboBox)
			Me.Controls.Add(Me.DarkwellcomboBox)
			Me.Controls.Add(Me.DarkBlizzardPasscomboBox)
			Me.Controls.Add(Me.label4)
			Me.Controls.Add(Me.label3)
			Me.Controls.Add(Me.label2)
			Me.Controls.Add(Me.Townbutton)
			Me.Controls.Add(Me.TowncomboBox)
			Me.Controls.Add(Me.label1)
			Me.Name = "MainForm"
			Me.Text = "Quester"
			AddHandler Load, AddressOf Me.MainFormLoad
			Me.ResumeLayout(false)
		End Sub
		#End Region
		
		Private Sub MainFormLoad(sender As System.Object, e As System.EventArgs)
				end Sub
		
		Public Sub loadQuests()
        loadArea("Town", TowncomboBox)
        loadArea("Ashwood", AshwoodcomboBox)
        loadArea("Darkwell", DarkwellcomboBox)
        loadArea("DarkBlizzardPass", DarkBlizzardPasscomboBox)
        loadArea("Causeway", CausewaycomboBox)
        loadArea("Paints", PaintscomboBox)
        loadArea("MarkerStones", MarkerStonecomboBox)
        loadarea("Cotley", CotleycomboBox)
		End Sub
		
		Private Sub loadArea(ByVal area As String, ByRef combo As ComboBox)
        Dim fStrm As FileStream
        Try
            fStrm = New FileStream(area & ".xml", FileMode.Open, FileAccess.Read)
        Catch ex As Exception
            MessageBox.Show("cannot read from file: " & area & ".xml")
            Exit Sub
        End Try
        combo.Items.Clear()

        Dim xtr As New XmlTextReader(fStrm)

        
        Dim id As Integer
        Try
            Dim storage As QuestStorage
            Do While xtr.Read
                Select Case xtr.NodeType
                    Case XmlNodeType.Element
                        If xtr.Name = "Quest" Then
                            storage = Nothing
                        End If

                    Case XmlNodeType.Text
                        If storage Is Nothing Then
                            storage = New QuestStorage(xtr.Value)
                        Else
                            storage.addCommand(xtr.Value)
                        End If
                    Case XmlNodeType.EndElement
                        If xtr.Name = "Quest" Then
                            combo.Items.Add(storage)
                            storage = Nothing
                        End If
                End Select
            Loop


        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try

        xtr.Close()
    End Sub

    Private Sub AddQuest_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddQuest.Click 
        Dim addq As New AddQuestform(Me)
        addq.ShowDialog()
        loadQuests()
    End Sub

    Private Sub goButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Townbutton.Click, Ashwoodbutton.Click, Darkwellbutton.Click, DarkBlizzardPassbutton.click, Causewaybutton.Click, Paintsbutton.Click, Tokensbutton.Click, MarkerStonesbutton.Click, Cotleybutton.Click
        Dim combo As ComboBox
        If sender Is Townbutton Then
            combo = TowncomboBox
        ElseIf sender Is Ashwoodbutton Then
            combo = AshwoodcomboBox'
        ElseIf sender Is Darkwellbutton Then
            combo = DarkwellcomboBox
        ElseIf sender Is DarkBlizzardPassbutton Then
            combo = DarkBlizzardPasscomboBox
        ElseIf sender Is Causewaybutton Then
            combo = CausewaycomboBox
        ElseIf sender Is Paintsbutton Then
            combo = PaintscomboBox
        ElseIf sender Is Tokensbutton Then
            combo = TokenscomboBox
        ElseIf sender Is MarkerStonesbutton Then
            combo = MarkerStonecomboBox
        ElseIf sender Is Cotleybutton Then
            combo = CotleycomboBox
        End If

        If combo.SelectedIndex > -1 Then
            Dim storage As QuestStorage = CType(combo.SelectedItem, QuestStorage)
            For Each line As String In storage.getCommands()
                microsoft.VisualBasic.appactivate("Legends Of Cosrin")
                'replace this with the app activate, the next command to send is the line variable
                MessageBox.Show(line)
                If line.ToLower = "offer" Then
                    MessageBox.Show("Must wait, we just offered")
                End If
            Next
        End If
    End Sub




    Public Function getComboBoxForArea(ByVal name As String) As ComboBox.ObjectCollection
        If name = "Town" Then
            Return Towncombobox.Items
        ElseIf name = "Ashwood" Then
            Return AshwoodcomboBox.Items
        ElseIf name = "Darkwell" Then
            Return DarkwellcomboBox.Items
        ElseIf name = "DarkBlizzardPass" Then
            Return DarkBlizzardPasscomboBox.Items
        ElseIf name = "Causeway" Then
            Return CausewaycomboBox.Items
        ElseIf name = "Paints" Then
            Return PaintscomboBox.Items
        ElseIf name = "Tokens" Then
            Return TokenscomboBox.Items
        ElseIf name = "MarkerStones" Then
            Return MarkerStonecomboBox.Items
        ElseIf name = "Cotley" Then
            Return CotleycomboBox.Items
        End If
    End Function
		
		
		
	End Class
End Namespace
