Example #1
0
        /// <summary>
        /// Opens a view for the given animation (or brings a view already binded to this animation to the front)
        /// </summary>
        /// <param name="animation">The Animation to open the AnimationView for</param>
        /// <returns>The created AnimationView</returns>
        public AnimationView OpenViewForAnimation(Animation animation)
        {
            foreach (Form curView in MdiChildren)
            {
                var forAnimation = curView as AnimationView;

                if (forAnimation != null && ReferenceEquals(forAnimation.CurrentAnimation, animation))
                {
                    forAnimation.BringToFront();
                    forAnimation.Focus();
                    return(forAnimation);
                }
            }

            AnimationView view = new AnimationView(Controller, animation)
            {
                MdiParent = this
            };

            view.Show();
            view.BringToFront();

            return(view);
        }