Esempio n. 1
0
 public StackWrapper(PodController controller)
 {
     _controller = controller;
 }
Esempio n. 2
0
        private void MoveRight()
        {
            // Decide if we can move
            StackWrapper current = CurrentController;

            if (current.Controller.Items.Count == 0)
            {
                return;
            }

            PodItem item = (PodItem)current.Controller.Items[current.Index];

            if (item.IsLeaf)
            {
                return;
            }

            PodController child = item.GetChildController();

            if (child == null)
            {
                return;
            }

            child.Refresh();

            // Create graphics port
            Graphics g = this.CreateGraphics();

            // Get image of the current view
            Bitmap   bmp1  = new Bitmap(ClientRectangle.Width, ClientRectangle.Height);
            Graphics bmp1G = Graphics.FromImage(bmp1);

            GoPaint(bmp1G, ClientRectangle);

            // Add new controller to stack
            _stack.Add(new StackWrapper(child));

            // Get image of new view
            Bitmap   bmp2  = new Bitmap(ClientRectangle.Width, ClientRectangle.Height);
            Graphics bmp2G = Graphics.FromImage(bmp2);

            GoPaint(bmp2G, ClientRectangle);

            // Animate transition between views
            Pen pen = new Pen(Color.Gray, 3);

            for (int i = 1; i < 4; i++)
            {
                int x = ClientRectangle.Width * (5 - i) / 5;

                g.DrawImage(bmp1, x - ClientRectangle.Width, 0);
                g.DrawImage(bmp2, x, 0);
                g.DrawLine(pen, x, 0, x, ClientRectangle.Height);

                Thread.Sleep(25);
            }

            pen.Dispose();

            // Clean up images
            bmp1G.Dispose();
            bmp1.Dispose();

            bmp2G.Dispose();
            bmp2.Dispose();

            g.Dispose();

            // Finally, draw new view
            Refresh();

            OnSelectedIndexChanged(EventArgs.Empty);
        }