Example #1
0
        //--------------------------------------------------------------------
        //
        // Public Methods
        //
        //---------------------------------------------------------------------

        #region IServiceProvider Members

        /// <summary>
        /// <see cref="IServiceProvider.GetService" />
        /// </summary>
        object IServiceProvider.GetService(Type serviceType)
        {
            if (serviceType == null)
            {
                throw new ArgumentNullException("serviceType");
            }

            if (serviceType == typeof(ITextContainer))
            {
                return(this.TextContainer);
            }

            if (serviceType == typeof(RubberbandSelector))
            {
                // create this on demand, but not through the property, only through the
                // service, so it is only created when it's actually used
                if (_rubberbandSelector == null)
                {
                    _rubberbandSelector = new RubberbandSelector();
                }
                return(_rubberbandSelector);
            }

            return(null);
        }
 internal void UpdateRubberbandSelection(RubberbandSelector selector)
 {
     _rubberbandSelector = selector;
     InvalidateHighlights();
 }
        //--------------------------------------------------------------------
        //
        // Public Methods
        //
        //---------------------------------------------------------------------

        #region IServiceProvider Members

        /// <summary>
        /// <see cref="IServiceProvider.GetService" />
        /// </summary>
        object IServiceProvider.GetService(Type serviceType)
        {
            if (serviceType == null)
            {
                throw new ArgumentNullException("serviceType");
            }

            if (serviceType == typeof(ITextContainer))
            {
                return this.TextContainer;
            }

            if (serviceType == typeof(RubberbandSelector))
            {
                // create this on demand, but not through the property, only through the
                // service, so it is only created when it's actually used
                if (_rubberbandSelector == null)
                {
                    _rubberbandSelector = new RubberbandSelector();
                }
                return _rubberbandSelector;
            }

            return null;
        }
Example #4
0
 internal void UpdateRubberbandSelection(RubberbandSelector selector)
 {
     _rubberbandSelector = selector;
     InvalidateHighlights();
 }