Beispiel #1
0
            /// <summary>
            ///  Gets a collection of standard values collection for a System.Globalization.CultureInfo
            ///  object using the specified context.
            /// </summary>
            public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
            {
                StandardValuesCollection values = null;

                if (context.PropertyDescriptor is not null)
                {
                    ExtenderProvidedPropertyAttribute attr = context.PropertyDescriptor.Attributes[typeof(ExtenderProvidedPropertyAttribute)] as ExtenderProvidedPropertyAttribute;

                    if (attr is not null)
                    {
                        LanguageExtenders provider = attr.Provider as LanguageExtenders;

                        if (provider is not null)
                        {
                            values = provider.SupportedCultures;
                        }
                    }
                }

                if (values is null)
                {
                    values = base.GetStandardValues(context);
                }

                return(values);
            }
Beispiel #2
0
 /// <summary>
 ///  Disposes this object.
 /// </summary>
 public void Dispose()
 {
     if (_providerService is not null && _extender is not null)
     {
         _providerService.RemoveExtenderProvider(_extender);
         _providerService = null;
         _extender        = null;
     }
 }
Beispiel #3
0
 public void Dispose()
 {
     if ((this._providerService != null) && (this._extender != null))
     {
         this._providerService.RemoveExtenderProvider(this._extender);
         this._providerService = null;
         this._extender        = null;
     }
 }
 public void Dispose()
 {
     if ((this._providerService != null) && (this._extender != null))
     {
         this._providerService.RemoveExtenderProvider(this._extender);
         this._providerService = null;
         this._extender = null;
     }
 }
Beispiel #5
0
 private void Initialize(IServiceProvider provider)
 {
     this._providerService = provider.GetService(typeof(IExtenderProviderService)) as IExtenderProviderService;
     if (this._providerService == null)
     {
         throw new NotSupportedException(System.Design.SR.GetString("LocalizationProviderMissingService", new object[] { typeof(IExtenderProviderService).Name }));
     }
     this._extender = new LanguageExtenders(provider, this._supportedCultures);
     this._providerService.AddExtenderProvider(this._extender);
 }
Beispiel #6
0
        /// <summary>
        ///  Adds our extended properties.
        /// </summary>
        private void Initialize(IServiceProvider provider)
        {
            _providerService = provider.GetService(typeof(IExtenderProviderService)) as IExtenderProviderService;

            if (_providerService is null)
            {
                throw new NotSupportedException(string.Format(SR.LocalizationProviderMissingService, typeof(IExtenderProviderService).Name));
            }

            _extender = new LanguageExtenders(provider, _supportedCultures);
            _providerService.AddExtenderProvider(_extender);
        }
 private void Initialize(IServiceProvider provider)
 {
     this._providerService = provider.GetService(typeof(IExtenderProviderService)) as IExtenderProviderService;
     if (this._providerService == null)
     {
         throw new NotSupportedException(System.Design.SR.GetString("LocalizationProviderMissingService", new object[] { typeof(IExtenderProviderService).Name }));
     }
     this._extender = new LanguageExtenders(provider, this._supportedCultures);
     this._providerService.AddExtenderProvider(this._extender);
 }