示例#1
0
        /// <summary>
        /// Sets the closer and the controller name, and injected itself into view.
        /// </summary>
        /// <param name="parent">The parent.</param>
        /// <param name="closer">The closer.</param>
        internal void Initialize(IController parent, ControllerCloser closer)
        {
            var realView = View as BaseView;

            if (realView == null)
            {
                throw new Exception("");
            }
            realView.Initialize(this);

            _parent = parent;
            _closer = closer;
        }
示例#2
0
        protected override void Dispose(bool disposing)
        {
            if (disposing && _closer != null)
            {
                // Store the reference of [_closer] to a local variable,
                // and set the [_closer] to null to prevent disposing multiple times.
                var closer = _closer;
                _closer = null;

                var realView = View.Cast <BaseView>();
                realView.CloseThisView();

                closer.Close(this);
            }
        }