コード例 #1
0
    private void LoadData()
    {
        ActivityInfo ai = ActivityInfo.Provider.Get(ActivityID);

        if (ai == null)
        {
            return;
        }

        string         pathToControl = String.Format(PATH_TO_CONTROLS, ai.ActivityType);
        ActivityDetail ucDetails     = null;

        try
        {
            ucDetails = Page.LoadUserControl(pathToControl) as ActivityDetail;
        }
        catch (HttpException exception)
        {
            // Ignore not existing control.
            // File.Exists cannot be used because user control is not available on filesystem for precompiled web application.
            if (exception.GetHttpCode() != (int)HttpStatusCode.NotFound)
            {
                throw;
            }
        }

        if (ucDetails != null && ucDetails.LoadData(ai))
        {
            pnlDetails.Controls.Add(ucDetails);
            return;
        }

        // Control doesn't exist or couldn't load data. It's ok for custom activities or activities without details.
        Visible = false;
    }
コード例 #2
0
ファイル: Details.ascx.cs プロジェクト: kudutest2/Kentico
    private void LoadData()
    {
        ActivityInfo ai = ActivityInfoProvider.GetActivityInfo(this.ActivityID);

        if (ai == null)
        {
            return;
        }

        string pathToControl = String.Format(PATH_TO_CONTROLS, ai.ActivityType);

        try
        {
            ucDetails = this.Page.LoadControl(pathToControl) as ActivityDetail;
            bool dataLoaded = ucDetails.LoadData(ai);
            pnlDetails.GroupingText = GetString("om.activity.details.groupdetails");
            pnlDetails.Controls.Add(ucDetails);
            ucDetails.Visible  = dataLoaded;
            pnlDetails.Visible = dataLoaded;
        }
        catch (HttpException)
        {
            // Failed to load the control
        }
    }
コード例 #3
0
    private void LoadData()
    {
        ActivityInfo ai = ActivityInfoProvider.GetActivityInfo(this.ActivityID);
        if (ai == null)
        {
            return;
        }

        string pathToControl = String.Format(PATH_TO_CONTROLS, ai.ActivityType);
        try
        {
            ucDetails = this.Page.LoadControl(pathToControl) as ActivityDetail;
            bool dataLoaded = ucDetails.LoadData(ai);
            pnlDetails.GroupingText = GetString("om.activity.details.groupdetails");
            pnlDetails.Controls.Add(ucDetails);
            ucDetails.Visible = dataLoaded;
            pnlDetails.Visible = dataLoaded;
        }
        catch(HttpException)
        {
            // Failed to load the control
        }
    }
コード例 #4
0
    private void LoadData()
    {
        ActivityInfo ai = ActivityInfoProvider.GetActivityInfo(ActivityID);

        if (ai == null)
        {
            return;
        }

        string pathToControl = String.Format(PATH_TO_CONTROLS, ai.ActivityType);

        if (FileHelper.FileExists(pathToControl))
        {
            ActivityDetail ucDetails = Page.LoadUserControl(pathToControl) as ActivityDetail;
            if (ucDetails.LoadData(ai))
            {
                pnlDetails.Controls.Add(ucDetails);
                return;
            }
        }

        // Control doesn't exist or couldn't load data. It's ok for custom activities or activities without details.
        Visible = false;
    }