Beispiel #1
0
 /// <summary>Occurs when the module cannot get a control from the passed location.</summary>
 /// <param name="e">Events.</param>
 protected virtual void OnError(ErrorEventArgs e)
 {
     if (Error != null)
         Error(this, e);
 }
Beispiel #2
0
        /// <summary>Gets the control that is called from the module.</summary>
        /// <remarks>Gets the control that is called from the current module.  If the control cannot be found
        /// then it goes to the default theme and gets that version of the control.</remarks>
        /// <param name="controlLocation">The controls location.</param>
        /// <returns>The control that was loaded.</returns>
        protected Control GetControl(string controlLocation)
        {
            #if DEBUG
            Context.Trace.Write("ModuleBase", "Get Control : " + controlLocation);
            #endif
            try
            {
                // go get control
                return Common.Path.GetControlFromLocation(Common.Path.GetModulePath(this._attribute.FolderName, controlLocation));
            }
            catch (Exception exc)
            {
                ErrorEventArgs e = new ErrorEventArgs(exc);

                this.OnError(e);

                // throw exception if event say to
                if (e.ThrowException == true)
                    throw;

                // return default control
                return e.ErrorControl;
            }
        }