Commit 86a0936b by Liv Haapala

update

1 parent 21017ed4
......@@ -58,6 +58,11 @@
this.searchTimer = new System.Windows.Forms.Timer(this.components);
this.ImageRefreshTimer = new System.Windows.Forms.Timer(this.components);
this.panel2 = new System.Windows.Forms.Panel();
this.label1 = new System.Windows.Forms.Label();
this.reservedPlacesCountTextBox = new System.Windows.Forms.TextBox();
this.freePlacesCountTextBox = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.placesCountTimer = new System.Windows.Forms.Timer(this.components);
((System.ComponentModel.ISupportInitialize)(this.MapPictureBox)).BeginInit();
this.toolStrip1.SuspendLayout();
this.TopPanel.SuspendLayout();
......@@ -265,6 +270,10 @@
//
// TopPanel
//
this.TopPanel.Controls.Add(this.freePlacesCountTextBox);
this.TopPanel.Controls.Add(this.label2);
this.TopPanel.Controls.Add(this.reservedPlacesCountTextBox);
this.TopPanel.Controls.Add(this.label1);
this.TopPanel.Controls.Add(this.label3);
this.TopPanel.Controls.Add(this.MapsComboBox);
this.TopPanel.Dock = System.Windows.Forms.DockStyle.Top;
......@@ -332,6 +341,45 @@
this.panel2.Size = new System.Drawing.Size(752, 471);
this.panel2.TabIndex = 17;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(204, 21);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(41, 13);
this.label1.TabIndex = 7;
this.label1.Text = "Varattu";
//
// reservedPlacesCountTextBox
//
this.reservedPlacesCountTextBox.Location = new System.Drawing.Point(251, 18);
this.reservedPlacesCountTextBox.Name = "reservedPlacesCountTextBox";
this.reservedPlacesCountTextBox.ReadOnly = true;
this.reservedPlacesCountTextBox.Size = new System.Drawing.Size(100, 20);
this.reservedPlacesCountTextBox.TabIndex = 8;
//
// freePlacesCountTextBox
//
this.freePlacesCountTextBox.Location = new System.Drawing.Point(418, 18);
this.freePlacesCountTextBox.Name = "freePlacesCountTextBox";
this.freePlacesCountTextBox.ReadOnly = true;
this.freePlacesCountTextBox.Size = new System.Drawing.Size(100, 20);
this.freePlacesCountTextBox.TabIndex = 10;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(362, 21);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(50, 13);
this.label2.TabIndex = 9;
this.label2.Text = "Vapaana";
//
// placesCountTimer
//
this.placesCountTimer.Interval = 60000;
this.placesCountTimer.Tick += new System.EventHandler(this.placesCountTimer_Tick);
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
......@@ -389,6 +437,11 @@
private System.Windows.Forms.Timer ImageRefreshTimer;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.ToolStripButton orgMealToolStripButton;
private System.Windows.Forms.TextBox freePlacesCountTextBox;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox reservedPlacesCountTextBox;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Timer placesCountTimer;
}
}
......@@ -10,6 +10,7 @@ using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
......@@ -51,7 +52,8 @@ namespace MoyaAdminUI
{
MessageBox.Show(ex.Message + "\r\nCannot connect to Moya.\r\nCheck Api url and key");
}
refreshPlacesCountTexBoxes();
placesCountTimer.Start();
}
private void loadPlacemap()
......@@ -779,6 +781,7 @@ namespace MoyaAdminUI
}
}
}
placesCountTimer.Stop();
}
......@@ -1184,6 +1187,41 @@ namespace MoyaAdminUI
{
ImageRefreshTimer.Stop();
this.MapPictureBox.Refresh();
//refreshPlacesCountTexBoxes();
}
private void refreshPlacesCountTexBoxes()
{
int free = 0;
int reserved = 0;
foreach (ListViewItem lvi in PlacesListView.Items)
{
if (lvi.Tag != null && lvi.Tag is ComputerPlace)
{
ComputerPlace place = (ComputerPlace)lvi.Tag;
if (place.Taken)
reserved += 1;
else if (place.Buyable)
free += 1;
}
}
if (freePlacesCountTextBox.Text != free.ToString())
{
freePlacesCountTextBox.Text = free.ToString();
Color color = freePlacesCountTextBox.BackColor;
freePlacesCountTextBox.BackColor = Color.Yellow;
Thread.Sleep(500);
freePlacesCountTextBox.BackColor = color;
Thread.Sleep(500);
freePlacesCountTextBox.BackColor = Color.Yellow;
Thread.Sleep(500);
freePlacesCountTextBox.BackColor = color;
}
if(reservedPlacesCountTextBox.Text != reserved.ToString())
{
reservedPlacesCountTextBox.Text = reserved.ToString();
}
}
private void MainForm_SizeChanged(object sender, EventArgs e)
......@@ -1205,6 +1243,11 @@ namespace MoyaAdminUI
}
private void placesCountTimer_Tick(object sender, EventArgs e)
{
refreshPlacesCountTexBoxes();
}
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!