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;
            }
        }
Esempio n. 2
0
        private void Pn_MouseUp(object sender, MouseEventArgs e)
        {
            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();
                break;

            case MouseButtons.Right:
                break;
            }
            draw();
        }