Beispiel #1
0
        public static DefaultDatePickerField GetField(HttpBrowserCapabilities browserCapabilities)
        {
            DefaultDatePickerField field;
            BrowserType            browserType = _parser.Parse(browserCapabilities);

            switch (browserType)
            {
            case BrowserType.IE5Up:
            case BrowserType.IE6Up:
            case BrowserType.IE7Up:
                field = new IE5DatePickerField();
                break;

            case BrowserType.Mozilla:
            case BrowserType.FireFox2:
                field = new MozDatePickerField();
                break;

            case BrowserType.Netscape:
                field = new NSDatePickerField();
                break;

            case BrowserType.WebKit:
                field = new WebKitDatePickerField();
                break;

            default:
                field = new DefaultDatePickerField();
                break;
            }

            return(field);
        }
        //============================================================
        // Methods
        //============================================================

        ///
        /// <summary>
        /// Notifies server controls that use composition-based implementation to create any child controls
        /// they contain in preparation for posting back or rendering.
        /// </summary>
        /// <remarks>
        /// If you override this method in a derived class, make sure you call this method as part of your
        /// base class's CreateChildControls.
        /// </remarks>
        ///
        protected override void CreateChildControls()
        {
            if (!IsInDesignMode)
            {
                HttpBrowserCapabilities hbcClient = HttpContext.Current.Request.Browser;
                _realField = DatePickerFieldFactory.GetField(hbcClient);
            }
            else
            {
                _realField = new IE5DatePickerField();
            }

            Controls.Add(_realField);

            return;
        }
        ///
        /// <summary>
        /// Enables a server control to perform final clean up before it is released from
        /// memory.
        /// </summary>
        /// <remarks>
        /// The Dispose method leaves the Control in an unusable state. After calling this
        /// method, you must release all references to the control so the memory it was
        /// occupying can be reclaimed by garbage collection.
        /// </remarks>
        /// <param name="disposing"><b>true</b> to release both managed and unmanaged resources; <b>false</b> to release only unmanaged resources.</param>
        ///
        protected virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (_license != null)
                {
                    _license.Dispose();
                    _license = null;
                }

                if (_realField != null)
                {
                    _realField.Dispose();
                    _realField = null;
                }
            }

            return;
        }