Ext.Net.Desktop.GetCurrent C# (CSharp) Method

GetCurrent() private method

private GetCurrent ( Page page ) : Desktop
page System.Web.UI.Page
return Desktop
        public static Desktop GetCurrent(Page page)
        {
            if (page == null)
            {
                throw new ArgumentNullException("page");
            }

            return page.Items[typeof(Desktop)] as Desktop;
        }

Usage Example

Example #1
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            if (!this.DesignMode)
            {
                Desktop existingInstance = Desktop.GetCurrent(this.Page);

                if (existingInstance != null && !DesignMode)
                {
                    throw new InvalidOperationException("Only one desktop is allowed");
                }

                this.Page.Items[typeof(Desktop)] = this;

                if (this.content != null)
                {
                    this.content.InstantiateIn(this);
                }
            }
        }