Ejemplo n.º 1
0
        //////////////////////////////////////////////////////////////////////////////

        #region Child controllers

        public void StartController(Controller controller)
        {
            if (controller == null)
            {
                throw new ArgumentException("Controller is null");
            }

            if (m_currentController != null)
            {
                if (controller == m_currentController)
                {
                    throw new InvalidOperationException("Controller already set as current: " + controller);
                }

                if (controller.ParentController == m_currentController)
                {
                    m_currentController.Suspend();
                }
                else
                {
                    m_currentController.Stop();
                }
            }

            m_currentController = controller;
            m_currentController.Start();
        }
Ejemplo n.º 2
0
        public void Stop(int exitCode, Object exitData = null)
        {
            this.exitCode = exitCode;
            this.exitData = exitData;

            if (childController != null)
            {
                childController.parentController = null;
                childController.Stop();
            }

            if (parentController != null)
            {
                parentController.OnChildControllerStopped(this);
            }

            OnStop();
            Application.RootController().ControllerStopped(this);

            Destroy();
        }