Commit 28931437 by Liv Haapala

adding new feature to set reservable to place

1 parent 24df4f58
......@@ -73,6 +73,22 @@ namespace MoyaAdminLib
}
}
}
[Category("Place map")]
public bool Reservable
{
get
{ return APIreference.reservable; }
set
{
if (value != APIreference.reservable)
{
this.Dirty = true;
APIreference.reservable = value;
}
}
}
public string Details
{
get { return APIreference.details; }
......
......@@ -14,6 +14,7 @@ namespace MoyaAdminUI.MoyaAPI
//public string code;
public string details;
public bool disabled;
public bool reservable;
public int height;
public int width;
public int mapX;
......
......@@ -98,6 +98,10 @@ namespace MoyaAdminLib
{
int timestamp = ConvertToTimestamp(DateTime.Now);
string shaString = "/" + queryPath + "+" + ApiApplicationKey + "+" + ApiUser + "+" + timestamp + "+" + ApiPass;
Console.WriteLine("shaString: " + shaString);
string hash = CalculateSHA1("/" + queryPath + "+" + ApiApplicationKey + "+" + ApiUser + "+" + timestamp + "+" + ApiPass);
if (getparms != null && getparms.Length > 0)
......
......@@ -60,6 +60,7 @@
this.generateBacksidesToolStripButton = new System.Windows.Forms.ToolStripButton();
this.toolStripButton4 = new System.Windows.Forms.ToolStripButton();
this.toolStripButton3 = new System.Windows.Forms.ToolStripButton();
this.toolStripButton5 = new System.Windows.Forms.ToolStripButton();
this.TopPanel = new System.Windows.Forms.Panel();
this.allPlacesCountTextBox = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
......@@ -76,7 +77,7 @@
this.panel2 = new System.Windows.Forms.Panel();
this.placesCountTimer = new System.Windows.Forms.Timer(this.components);
this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
this.toolStripButton5 = new System.Windows.Forms.ToolStripButton();
this.movePlacesToolStripButton = new System.Windows.Forms.ToolStripButton();
this.placesContextMenuStrip.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.MapPictureBox)).BeginInit();
this.toolStrip1.SuspendLayout();
......@@ -137,6 +138,7 @@
this.MapPictureBox.MouseDown += new System.Windows.Forms.MouseEventHandler(this.MapPictureBox_MouseDown);
this.MapPictureBox.MouseMove += new System.Windows.Forms.MouseEventHandler(this.MapPictureBox_MouseMove);
this.MapPictureBox.MouseUp += new System.Windows.Forms.MouseEventHandler(this.MapPictureBox_MouseUp);
this.MapPictureBox.PreviewKeyDown += new System.Windows.Forms.PreviewKeyDownEventHandler(this.MapPictureBox_PreviewKeyDown);
//
// placeEditor
//
......@@ -214,7 +216,8 @@
this.generateBacksidesToolStripButton,
this.toolStripButton4,
this.toolStripButton3,
this.toolStripButton5});
this.toolStripButton5,
this.movePlacesToolStripButton});
this.toolStrip1.Location = new System.Drawing.Point(0, 0);
this.toolStrip1.Name = "toolStrip1";
this.toolStrip1.Size = new System.Drawing.Size(1078, 25);
......@@ -393,6 +396,16 @@
this.toolStripButton3.Visible = false;
this.toolStripButton3.Click += new System.EventHandler(this.toolStripButton3_Click_2);
//
// toolStripButton5
//
this.toolStripButton5.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.toolStripButton5.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton5.Image")));
this.toolStripButton5.ImageTransparentColor = System.Drawing.Color.Magenta;
this.toolStripButton5.Name = "toolStripButton5";
this.toolStripButton5.Size = new System.Drawing.Size(23, 22);
this.toolStripButton5.Text = "Find user";
this.toolStripButton5.Click += new System.EventHandler(this.toolStripButton5_Click);
//
// TopPanel
//
this.TopPanel.Controls.Add(this.allPlacesCountTextBox);
......@@ -524,15 +537,15 @@
this.placesCountTimer.Interval = 600000000;
this.placesCountTimer.Tick += new System.EventHandler(this.placesCountTimer_Tick);
//
// toolStripButton5
// movePlacesToolStripButton
//
this.toolStripButton5.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.toolStripButton5.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton5.Image")));
this.toolStripButton5.ImageTransparentColor = System.Drawing.Color.Magenta;
this.toolStripButton5.Name = "toolStripButton5";
this.toolStripButton5.Size = new System.Drawing.Size(23, 22);
this.toolStripButton5.Text = "Find user";
this.toolStripButton5.Click += new System.EventHandler(this.toolStripButton5_Click);
this.movePlacesToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.movePlacesToolStripButton.Image = ((System.Drawing.Image)(resources.GetObject("movePlacesToolStripButton.Image")));
this.movePlacesToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta;
this.movePlacesToolStripButton.Name = "movePlacesToolStripButton";
this.movePlacesToolStripButton.Size = new System.Drawing.Size(23, 22);
this.movePlacesToolStripButton.Text = "Switch to place move edit mode";
this.movePlacesToolStripButton.Click += new System.EventHandler(this.movePlacesToolStripButton_Click);
//
// MainForm
//
......@@ -613,6 +626,7 @@
private System.Windows.Forms.ToolStripMenuItem getCSVForSelectedToolStripMenuItem;
private System.Windows.Forms.SaveFileDialog saveFileDialog1;
private System.Windows.Forms.ToolStripButton toolStripButton5;
private System.Windows.Forms.ToolStripButton movePlacesToolStripButton;
}
}
......@@ -116,6 +116,18 @@ namespace MoyaAdminUI
this.PlacesListView.Items.Add(li);
}
void updatePlaceToListview(ComputerPlace place, ListViewItem lvi)
{
if(lvi.Text != place.Name)
lvi.Text = place.Name;
if(lvi.SubItems[1].Text != place.ReserverUserName)
lvi.SubItems[1].Text = place.ReserverUserName;
if(lvi.SubItems[2].Text != place.MapX.ToString())
lvi.SubItems[2].Text = place.MapX.ToString();
if(lvi.SubItems[3].Text != place.MapY.ToString())
lvi.SubItems[3].Text = place.MapY.ToString();
}
void loadImage()
{
......@@ -206,10 +218,9 @@ namespace MoyaAdminUI
}
else if (e.Button == MouseButtons.Left && multiMoveLastLocation == null)
{
if (selectedPlace == findPlace(clickedLocation))
{
ComputerPlace computerPlace = findPlace(clickedLocation);
if (computerPlace != null && selectedPlace == computerPlace)
{
if (computerPlace != null)
{
this.selectedPlace = computerPlace;
......@@ -1480,26 +1491,106 @@ namespace MoyaAdminUI
private void MainForm_KeyDown(object sender, KeyEventArgs e)
{
if (UnlockToolStripButton.Checked)
{
if(e.KeyCode == Keys.Left || e.KeyCode == Keys.Right || e.KeyCode == Keys.Up || e.KeyCode == Keys.Down)
{
e.SuppressKeyPress = true;
}
List<ListViewItem> placesList = new List<ListViewItem>();
foreach (ListViewItem li in PlacesListView.SelectedItems)
{
placesList.Add(li);
}
Parallel.ForEach(placesList, li =>
{
ComputerPlace p = (ComputerPlace)li.Tag;
//p.Coord += difference;
if (e.KeyCode == Keys.Left)
{
p.MapX -= 1;
//li.SubItems[2].Text = p.MapX.ToString();
}
else if (e.KeyCode == Keys.Right)
{
p.MapX += 1;
//li.SubItems[2].Text = p.MapX.ToString();
}
else if (e.KeyCode == Keys.Up)
{
p.MapY -= 1;
//li.SubItems[3].Text = p.MapY.ToString();
}
else if (e.KeyCode == Keys.Down)
{
p.MapY += 1;
//li.SubItems[3].Text = p.MapY.ToString();
}
});
foreach (ListViewItem li in PlacesListView.SelectedItems)
{
ComputerPlace p = (ComputerPlace)li.Tag;
if (!this.unsavedComputerPlaces.Contains(p))
{
this.unsavedComputerPlaces.Add(p);
}
}
/*
foreach(ListViewItem li in placesList)
{
ComputerPlace p = (ComputerPlace)li.Tag;
updatePlaceToListview(p, li);
}*/
changed();
MapPictureBox.Refresh();
}
}
private void PlacesListView_KeyDown(object sender, KeyEventArgs e)
{
if (UnlockToolStripButton.Checked)
{
foreach (ListViewItem li in this.PlacesListView.SelectedItems)
/*
this.PlacesListView.BeginUpdate();
*/
List<ListViewItem> placesList = new List<ListViewItem>();
foreach(ListViewItem li in PlacesListView.SelectedItems)
{
placesList.Add(li);
}
Parallel.ForEach(placesList, li =>
{
ComputerPlace p = (ComputerPlace)li.Tag;
//p.Coord += difference;
if (e.KeyCode == Keys.Left)
{
p.MapX -= 1;
//li.SubItems[2].Text = p.MapX.ToString();
}
else if (e.KeyCode == Keys.Right)
{
p.MapX += 1;
//li.SubItems[2].Text = p.MapX.ToString();
}
else if (e.KeyCode == Keys.Up)
{
p.MapY -= 1;
//li.SubItems[3].Text = p.MapY.ToString();
}
else if (e.KeyCode == Keys.Down)
{
p.MapY += 1;
//li.SubItems[3].Text = p.MapY.ToString();
}
});
if (this.PlacesListView.SelectedItems.Count == 1)
{
......@@ -1511,10 +1602,17 @@ namespace MoyaAdminUI
{
editObjects();
}
//this.PlacesListView.EndUpdate();
MapPictureBox.Refresh();
foreach (ListViewItem li in placesList)
{
ComputerPlace p = (ComputerPlace)li.Tag;
updatePlaceToListview(p, li);
li.Selected = true;
}
}
}
......@@ -1633,11 +1731,17 @@ namespace MoyaAdminUI
{
lvi.SubItems[2].Text = place.MapX.ToString();
lvi.SubItems[3].Text = place.MapY.ToString();
}
if (!this.unsavedComputerPlaces.Contains(place))
{
this.unsavedComputerPlaces.Add(place);
}
}
}
}
changed();
}
}
......@@ -1672,5 +1776,15 @@ namespace MoyaAdminUI
FindUserForm frm = new FindUserForm();
frm.Show();
}
private void MapPictureBox_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
{
}
private void movePlacesToolStripButton_Click(object sender, EventArgs e)
{
MapPictureBox.Focus();
}
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!