Esempio n. 1
0
        /// <summary> Add objects to the context from the current properties.
        /// *
        /// </summary>
        /// <param name="Context">control context to fill with objects
        /// that are specified in the default.properties
        /// file
        ///
        /// </param>
        protected internal virtual void  fillContextProperties(IContext context)
        {
            IDictionaryEnumerator enum_Renamed = props.GetEnumerator();

            while (enum_Renamed.MoveNext())
            {
                DictionaryEntry de = (DictionaryEntry)enum_Renamed.Current;
                String          nm = (String)de.Key;
                if (nm.StartsWith("context.objects."))
                {
                    System.String contextObj  = (System.String)props.GetString(nm);
                    int           colon       = nm.LastIndexOf((System.Char) '.');
                    System.String contextName = nm.Substring(colon + 1);

                    //try {
                    Log.WriteLine(LogPrefix + "loading " + contextObj + " as " + nm);
                    System.Type   cls = System.Type.GetType(contextObj);
                    System.Object o   = System.Activator.CreateInstance(cls);
                    context.Put(contextName, o);
                    //} catch (System.Exception e) {
                    //	SupportClass.WriteStackTrace(e, Console.Error);
                    //	//TO DO: Log Something Here
                    //}
                }
            }
        }