Commit 7e616e6e authored by Michael Alexander's avatar Michael Alexander
Browse files

offer page final and functional

parent 51f81e40
......@@ -47,8 +47,12 @@ Partial Class Offer
Me.Label12 = New System.Windows.Forms.Label()
Me.Button1 = New System.Windows.Forms.Button()
Me.Button2 = New System.Windows.Forms.Button()
Me.NumericUpDown1 = New System.Windows.Forms.NumericUpDown()
Me.NumericUpDown2 = New System.Windows.Forms.NumericUpDown()
Me.OfferedNum = New System.Windows.Forms.NumericUpDown()
Me.DemandedNum = New System.Windows.Forms.NumericUpDown()
Me.OfferedPic = New System.Windows.Forms.PictureBox()
Me.DropdownOffer = New System.Windows.Forms.ComboBox()
Me.DropdownDemand = New System.Windows.Forms.ComboBox()
Me.DemandedPic = New System.Windows.Forms.PictureBox()
CType(Me.PictureBox11, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.PictureBox12, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.PictureBox13, System.ComponentModel.ISupportInitialize).BeginInit()
......@@ -59,8 +63,10 @@ Partial Class Offer
CType(Me.PictureBox2, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.PictureBox8, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.NumericUpDown1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.NumericUpDown2, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.OfferedNum, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.DemandedNum, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.OfferedPic, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.DemandedPic, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'LabelPhilosopherStone
......@@ -289,27 +295,69 @@ Partial Class Offer
Me.Button2.Text = "Back"
Me.Button2.UseVisualStyleBackColor = True
'
'NumericUpDown1
'OfferedNum
'
Me.NumericUpDown1.Location = New System.Drawing.Point(169, 359)
Me.NumericUpDown1.Name = "NumericUpDown1"
Me.NumericUpDown1.Size = New System.Drawing.Size(90, 20)
Me.NumericUpDown1.TabIndex = 53
Me.OfferedNum.Location = New System.Drawing.Point(169, 359)
Me.OfferedNum.Name = "OfferedNum"
Me.OfferedNum.Size = New System.Drawing.Size(90, 20)
Me.OfferedNum.TabIndex = 53
'
'NumericUpDown2
'DemandedNum
'
Me.NumericUpDown2.Location = New System.Drawing.Point(396, 359)
Me.NumericUpDown2.Name = "NumericUpDown2"
Me.NumericUpDown2.Size = New System.Drawing.Size(90, 20)
Me.NumericUpDown2.TabIndex = 54
Me.DemandedNum.Location = New System.Drawing.Point(396, 359)
Me.DemandedNum.Name = "DemandedNum"
Me.DemandedNum.Size = New System.Drawing.Size(90, 20)
Me.DemandedNum.TabIndex = 54
'
'OfferedPic
'
Me.OfferedPic.Location = New System.Drawing.Point(169, 412)
Me.OfferedPic.Name = "OfferedPic"
Me.OfferedPic.Size = New System.Drawing.Size(90, 90)
Me.OfferedPic.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage
Me.OfferedPic.TabIndex = 55
Me.OfferedPic.TabStop = False
'
'DropdownOffer
'
Me.DropdownOffer.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
Me.DropdownOffer.FormattingEnabled = True
Me.DropdownOffer.Items.AddRange(New Object() {"Honey", "Herbs", "Clay", "Mineral", "Potion", "Incense", "Gems", "Life Elixir", "Mana Crystal", "Philosopher Stone"})
Me.DropdownOffer.Location = New System.Drawing.Point(158, 385)
Me.DropdownOffer.Name = "DropdownOffer"
Me.DropdownOffer.Size = New System.Drawing.Size(112, 21)
Me.DropdownOffer.TabIndex = 56
'
'DropdownDemand
'
Me.DropdownDemand.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
Me.DropdownDemand.FormattingEnabled = True
Me.DropdownDemand.Items.AddRange(New Object() {"Honey", "Herbs", "Clay", "Mineral", "Potion", "Incense", "Gems", "Life Elixir", "Mana Crystal", "Philosopher Stone"})
Me.DropdownDemand.Location = New System.Drawing.Point(387, 385)
Me.DropdownDemand.Name = "DropdownDemand"
Me.DropdownDemand.Size = New System.Drawing.Size(112, 21)
Me.DropdownDemand.TabIndex = 57
'
'DemandedPic
'
Me.DemandedPic.Location = New System.Drawing.Point(396, 412)
Me.DemandedPic.Name = "DemandedPic"
Me.DemandedPic.Size = New System.Drawing.Size(90, 90)
Me.DemandedPic.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage
Me.DemandedPic.TabIndex = 58
Me.DemandedPic.TabStop = False
'
'Offer
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(649, 561)
Me.Controls.Add(Me.NumericUpDown2)
Me.Controls.Add(Me.NumericUpDown1)
Me.Controls.Add(Me.DemandedPic)
Me.Controls.Add(Me.DropdownDemand)
Me.Controls.Add(Me.DropdownOffer)
Me.Controls.Add(Me.OfferedPic)
Me.Controls.Add(Me.DemandedNum)
Me.Controls.Add(Me.OfferedNum)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.Label12)
......@@ -346,8 +394,10 @@ Partial Class Offer
CType(Me.PictureBox2, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.PictureBox8, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.NumericUpDown1, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.NumericUpDown2, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.OfferedNum, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.DemandedNum, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.OfferedPic, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.DemandedPic, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
Me.PerformLayout()
......@@ -376,6 +426,10 @@ Partial Class Offer
Friend WithEvents Label12 As System.Windows.Forms.Label
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Button2 As System.Windows.Forms.Button
Friend WithEvents NumericUpDown1 As System.Windows.Forms.NumericUpDown
Friend WithEvents NumericUpDown2 As System.Windows.Forms.NumericUpDown
Friend WithEvents OfferedNum As System.Windows.Forms.NumericUpDown
Friend WithEvents DemandedNum As System.Windows.Forms.NumericUpDown
Friend WithEvents OfferedPic As System.Windows.Forms.PictureBox
Friend WithEvents DropdownOffer As System.Windows.Forms.ComboBox
Friend WithEvents DropdownDemand As System.Windows.Forms.ComboBox
Friend WithEvents DemandedPic As System.Windows.Forms.PictureBox
End Class
Imports Newtonsoft.Json
Public Class Offer
Private selectedOffered As Integer
Private selectedDemanded As Integer
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Me.Close()
End Sub
Private Sub Offer_Load(sender As Object, e As EventArgs) Handles MyBase.Load
RefreshInventory()
End Sub
Private Sub RefreshInventory()
GlobalVariables.NETWORK = New NetIO
Dim request As New InventoryJSONSend
Dim recv As String
......@@ -28,4 +35,100 @@ Public Class Offer
LabelPhilosopherStone.Text = recvjson.inventory(9) 'Philosoper Stone
End If
End Sub
Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DropdownOffer.SelectedIndexChanged
Select Case DropdownOffer.SelectedItem.ToString()
Case "Honey"
OfferedPic.Image = PictureBox1.Image
selectedOffered = 0
Case "Herbs"
OfferedPic.Image = PictureBox2.Image
selectedOffered = 1
Case "Clay"
OfferedPic.Image = PictureBox3.Image
selectedOffered = 2
Case "Mineral"
OfferedPic.Image = PictureBox4.Image
selectedOffered = 3
Case "Potion"
OfferedPic.Image = PictureBox8.Image
selectedOffered = 4
Case "Incense"
OfferedPic.Image = PictureBox9.Image
selectedOffered = 5
Case "Gems"
OfferedPic.Image = PictureBox5.Image
selectedOffered = 6
Case "Life Elixir"
OfferedPic.Image = PictureBox13.Image
selectedOffered = 7
Case "Mana Crystal"
OfferedPic.Image = PictureBox12.Image
selectedOffered = 8
Case "Philosopher Stone"
OfferedPic.Image = PictureBox11.Image
selectedOffered = 9
End Select
End Sub
Private Sub DropdownDemand_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DropdownDemand.SelectedIndexChanged
Select Case DropdownDemand.SelectedItem.ToString()
Case "Honey"
DemandedPic.Image = PictureBox1.Image
selectedDemanded = 0
Case "Herbs"
DemandedPic.Image = PictureBox2.Image
selectedDemanded = 1
Case "Clay"
DemandedPic.Image = PictureBox3.Image
selectedDemanded = 2
Case "Mineral"
DemandedPic.Image = PictureBox4.Image
selectedDemanded = 3
Case "Potion"
DemandedPic.Image = PictureBox8.Image
selectedDemanded = 4
Case "Incense"
DemandedPic.Image = PictureBox9.Image
selectedDemanded = 5
Case "Gems"
DemandedPic.Image = PictureBox5.Image
selectedDemanded = 6
Case "Life Elixir"
DemandedPic.Image = PictureBox13.Image
selectedDemanded = 7
Case "Mana Crystal"
DemandedPic.Image = PictureBox12.Image
selectedDemanded = 8
Case "Philosopher Stone"
DemandedPic.Image = PictureBox11.Image
selectedDemanded = 9
End Select
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
GlobalVariables.NETWORK = New NetIO
Dim request As New OfferJSONSend
Dim recv As String
request.offered_item = selectedOffered
request.n1 = OfferedNum.Value
request.demanded_item = selectedDemanded
request.n2 = DemandedNum.Value
recv = NETWORK.SendRecv(request)
Dim recvjson As New OfferJSONRecv
recvjson = JsonConvert.DeserializeObject(Of OfferJSONRecv)(recv)
If (recvjson.status = "ok") Then
MsgBox(recv)
RefreshInventory()
ElseIf (recvjson.status = "fail") Then
MsgBox(recvjson.description)
Else
MsgBox("Unknown error occured!")
End If
End Sub
End Class
\ No newline at end of file
......@@ -41,7 +41,7 @@ Partial Class Tradebox
Me.TableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 49.47917!))
Me.TableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 99.0!))
Me.TableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 113.0!))
Me.TableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 166.0!))
Me.TableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 168.0!))
Me.TableLayoutPanel1.Controls.Add(Me.Label5, 4, 0)
Me.TableLayoutPanel1.Controls.Add(Me.Label4, 3, 0)
Me.TableLayoutPanel1.Controls.Add(Me.Label3, 2, 0)
......@@ -50,15 +50,15 @@ Partial Class Tradebox
Me.TableLayoutPanel1.Location = New System.Drawing.Point(12, 12)
Me.TableLayoutPanel1.Name = "TableLayoutPanel1"
Me.TableLayoutPanel1.RowCount = 2
Me.TableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 3.652968!))
Me.TableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 96.34703!))
Me.TableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20.0!))
Me.TableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100.0!))
Me.TableLayoutPanel1.Size = New System.Drawing.Size(573, 439)
Me.TableLayoutPanel1.TabIndex = 0
'
'Label5
'
Me.Label5.AutoSize = True
Me.Label5.Location = New System.Drawing.Point(408, 1)
Me.Label5.Location = New System.Drawing.Point(406, 1)
Me.Label5.Name = "Label5"
Me.Label5.Size = New System.Drawing.Size(23, 13)
Me.Label5.TabIndex = 6
......@@ -67,7 +67,7 @@ Partial Class Tradebox
'Label4
'
Me.Label4.AutoSize = True
Me.Label4.Location = New System.Drawing.Point(294, 1)
Me.Label4.Location = New System.Drawing.Point(292, 1)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(99, 13)
Me.Label4.TabIndex = 4
......@@ -76,7 +76,7 @@ Partial Class Tradebox
'Label3
'
Me.Label3.AutoSize = True
Me.Label3.Location = New System.Drawing.Point(194, 1)
Me.Label3.Location = New System.Drawing.Point(192, 1)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(82, 13)
Me.Label3.TabIndex = 3
......@@ -85,7 +85,7 @@ Partial Class Tradebox
'Label2
'
Me.Label2.AutoSize = True
Me.Label2.Location = New System.Drawing.Point(100, 1)
Me.Label2.Location = New System.Drawing.Point(99, 1)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(82, 13)
Me.Label2.TabIndex = 1
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment