示例#1
0
        /// <summary>
        /// Prepares the panel to load the view from the specified panel definition.
        /// </summary>
        /// <param name="definition">The panel definition from which to load the view.</param>
        protected void PrepareView(UIPanelDefinition definition)
        {
            Contract.Require(definition, nameof(definition));
            Contract.EnsureNotDisposed(this, Disposed);

            if (IsViewLoaded)
            {
                throw new InvalidOperationException(UltravioletStrings.ViewAlreadyLoaded);
            }

            this.definition = definition;
        }
示例#2
0
        /// <summary>
        /// Creates a new instance of the <see cref="UIView"/> class.
        /// </summary>
        /// <param name="uiPanel">The <see cref="UIPanel"/> which is creating the view.</param>
        /// <param name="uiPanelDefinition">The <see cref="UIPanelDefinition"/> that defines the view's containing panel.</param>
        /// <param name="vmfactory">A view model factory which is used to create the view's initial view model, or <see langword="null"/> to skip view model creation.</param>
        /// <returns>The instance of <see cref="UIView"/> that was created.</returns>
        public static UIView Create(UIPanel uiPanel, UIPanelDefinition uiPanelDefinition, UIViewModelFactory vmfactory)
        {
            Contract.Require(uiPanel, nameof(uiPanel));
            Contract.Require(uiPanelDefinition, nameof(uiPanelDefinition));

            var uv      = UltravioletContext.DemandCurrent();
            var factory = uv.TryGetFactoryMethod <UIViewFactory>();

            if (factory != null)
            {
                return(factory(uv, uiPanel, uiPanelDefinition, vmfactory));
            }

            return(null);
        }
示例#3
0
        /// <summary>
        /// Loads the view from the specified panel definition.
        /// </summary>
        /// <param name="definition">The panel definition from which to load the view.</param>
        protected void LoadView(UIPanelDefinition definition)
        {
            var view = UIView.Create(this, definition);
            if (view != null)
            {
                if (window != null)
                {
                    var area = new Rectangle(X, Y, Width, Height);
                    view.SetViewPosition(window, area);
                }
            }

            this.view = view;

            HandleViewLoaded();
        }
示例#4
0
        /// <summary>
        /// Prepares the panel to load the view from the specified panel definition.
        /// </summary>
        /// <param name="definition">The panel definition from which to load the view.</param>
        protected void PrepareView(UIPanelDefinition definition)
        {
            Contract.Require(definition, nameof(definition));
            Contract.EnsureNotDisposed(this, Disposed);

            if (IsViewLoaded)
                throw new InvalidOperationException(UltravioletStrings.ViewAlreadyLoaded);

            this.definition = definition;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="UIPanelDefinitionWrapper"/> class.
 /// </summary>
 /// <param name="asset">The <see cref="UIPanelDefinition"/> which is represented by this wrapper.</param>
 public UIPanelDefinitionWrapper(UIPanelDefinition asset)
 {
     this.asset = asset;
     this.lastKnownGoodVersion = asset;
 }