private void Pn_MouseUp(object sender, MouseEventArgs e) { if (f != null) { f.Close(); f = null; } check = false; KeyValuePair <KeyValuePair <int, int>, int> temp = wh.convert((double)e.X, (double)e.Y); switch (e.Button) { case MouseButtons.Left: KeyValuePair <int, int> p1 = new KeyValuePair <int, int>(FirstY, FirstX); KeyValuePair <int, int> p2 = new KeyValuePair <int, int>(temp.Key.Value, temp.Key.Key); wh.MovePackage(p1, FirstField, p2, temp.Value); draw(); send(); break; case MouseButtons.Right: _check = false; if (temp.Key.Key >= 0 && temp.Key.Value >= 0) { listField.Add(temp.Value); } if (listField.Count > 0) { _f = new FieldForm(ref wh, wh.top_left(listField), this); _f.Show(); } break; } }
private void Pn_MouseMove(object sender, MouseEventArgs e) { double x = (double)e.X; double y = (double)e.Y; KeyValuePair <KeyValuePair <int, int>, int> temp = wh.convert(x, y); int k = temp.Value; KeyValuePair <int, int> tmp = temp.Key; if (k < 0 || tmp.Key < 0 || tmp.Value < 0) { txtCurNo.Text = ""; txtCurX.Text = ""; txtCurY.Text = ""; if (f != null) { f.Close(); f = null; } } else { txtCurNo.Text = k.ToString(); txtCurX.Text = tmp.Key.ToString(); txtCurY.Text = tmp.Value.ToString(); if (!check) { if (!compareCoordNate(tmp, temp.Value)) { if (f != null) { f.Close(); f = null; } Package pa = wh.lf[temp.Value].getPackage(new KeyValuePair <int, int>(tmp.Value, tmp.Key)); if (pa != null) { if (pa.getType() == 0) { pa = wh.lf[temp.Value].getPackage(new KeyValuePair <int, int>(tmp.Value, tmp.Key - 1)); } f = new PackageForm(pa); f.Location = new Point(e.X, e.Y + f.Height); f.StartPosition = FormStartPosition.Manual; f.Show(); } } } else { if (_check) { listField.Add(k); } } } preCoordNate = tmp; preField = temp.Value; }
public WarehouseForm(ref WareHouse p) { InitializeComponent(); check = false; preField = new int(); preField = -1; f = null; _check = false; wh = p; draw(); }
public WarehouseForm() { InitializeComponent(); Text += " " + Constant.SOFTWAREVERSION; IPHostEntry IPHost = Dns.GetHostEntry(Dns.GetHostName()); for (int i = 0; i < IPHost.AddressList.Length; i++) { textBox1.AppendText("My IP address is: " + IPHost.AddressList[i].ToString() + "\r\n"); } string ipText = IPHost.AddressList[IPHost.AddressList.Length - 1].ToString(); string[] IPs = ipText.Split(new char[] { '.' }); textBox3.Text = IPs[0]; check = false; preField = new int(); preField = -1; f = null; _check = false; this.Width = 1030; this.Height = 620; TreeView tv = new TreeView(); }
private void Pn_MouseDown(object sender, MouseEventArgs e) { if (f != null) { f.Close(); f = null; } check = true; double x = (double)e.X; double y = (double)e.Y; KeyValuePair <KeyValuePair <int, int>, int> temp = wh.convert(x, y); int k = temp.Value; KeyValuePair <int, int> tmp = temp.Key; switch (e.Button) { case MouseButtons.Left: if (k >= 0 && tmp.Key >= 0 && tmp.Value >= 0) { check = true; FirstX = tmp.Key; FirstY = tmp.Value; FirstField = k; } break; case MouseButtons.Right: listField = new HashSet <int>(); if (k >= 0 && tmp.Key >= 0 && tmp.Value >= 0) { listField.Add(k); } _check = true; break; } }