示例#1
0
        private void MainWindow_MouseUp(object sender, MouseButtonEventArgs e)
        {
            Point pos = Mouse.GetPosition(desk);

            if (link != null)
            {
                if ((pos.X < img.Width) && (pos.Y < img.Height))
                {
                    int x = ((int)pos.X / W) * W;
                    int y = ((int)pos.Y / H) * H;


                    int cX = (int)(x / W);
                    int cY = (int)(y / H);

                    int ind = l.get(cX, cY);


                    shapes[ind].RenderTransform = new TranslateTransform(oldX * W, oldY * H);

                    l.move(oldX, oldY, ind);

                    g           = g + 1;
                    hod.Content = g;

                    link.RenderTransform = new TranslateTransform(x, y);



                    if (l.move(cX, cY, int.Parse(link.Tag.ToString())))
                    {
                        // MessageBox.Show("win win");
                        winner winner = new winner();
                        winner.w1.Content = timer.Content;
                        winner.w2.Content = hod.Content;
                        winner.Show();
                        this.Close();
                    }
                }
                else
                {
                    link.RenderTransform = new TranslateTransform(oldX * W, oldY * H);
                }
            }

            link = null;
            // ll.Content = "null";
        }
示例#2
0
        void puzzle_Edited(object sender, EventArgs e)
        {
            bool validate = puzzle.Validate(itemPlacement);

            if (validate)
            {
                // MessageBox.Show("Ты выйграл");
                winner winner = new winner();
                winner.w1.Content = lblTimeElapsed.Content;
                winner.Show();



                this.Close();
            }
        }