protected void Page_Load(object sender, EventArgs e)
    {
        threadGuid = QueryHelper.GetGuid("threadguid", Guid.Empty);

        thread = CMSThread.GetThread(threadGuid);
        ctlAsync.OnRequestLog += new EventHandler(ctlAsync_OnRequestLog);

        if (!IsCallback)
        {
            // Set the title
            CurrentMaster.Title.TitleText  = GetString("ViewLog.Title");
            CurrentMaster.Title.TitleImage = GetImageUrl("Objects/__GLOBAL__/Object.png");
            Page.Title = GetString("ViewLog.Title");

            if ((thread != null) && (thread.Log != null))
            {
                pnlLog.Visible          = true;
                btnCancel.Text          = GetString("general.cancel");
                btnCancel.OnClientClick = "return confirm('" + GetString("ViewLog.CancelPrompt") + "')";


                ctlAsync.RunAsync();
            }
            else
            {
                pnlLog.Visible = false;
                ShowError(GetString("ViewLog.ThreadNotRunning"));
            }
        }
    }
    protected void btnCancel_Click(object sender, EventArgs e)
    {
        Guid      threadGuid = ValidationHelper.GetGuid(hdnGuid.Value, Guid.Empty);
        CMSThread thread     = CMSThread.GetThread(threadGuid);

        if (thread != null)
        {
            thread.Stop();
        }
    }
Пример #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        PageTitle.IsDialog = true;

        threadGuid = QueryHelper.GetGuid("threadGuid", Guid.Empty);
        string requestedServerName = QueryHelper.GetString("serverName", "");

        if (!RequestHelper.IsCallback())
        {
            // Set the title
            PageTitle.TitleText = GetString("ViewLog.Title");
            Page.Title          = GetString("ViewLog.Title");

            if (WebFarmHelper.WebFarmEnabled && !String.IsNullOrEmpty(requestedServerName))
            {
                if (WebFarmHelper.ServerName.ToLowerCSafe() != requestedServerName.ToLowerCSafe())
                {
                    string loadMsg = ScriptHelper.GetLoaderInlineHtml(Page, GetString("debug.contactrequestedserver"));
                    litMessage.Text    = loadMsg;
                    litMessage.Visible = true;

                    RegisterRefreshScript();
                    return;
                }
            }
        }

        thread = CMSThread.GetThread(threadGuid);
        ctlAsync.ProcessGUID   = threadGuid;
        ctlAsync.OnRequestLog += ctlAsync_OnRequestLog;
        ctlAsync.OnFinished   += ctlAsync_OnFinished;
        ctlAsync.OnCancel     += ctlAsync_OnCancel;

        if (!RequestHelper.IsCallback() && !RequestHelper.IsPostBack())
        {
            if ((thread != null) && (thread.Log != null))
            {
                pnlLog.Visible = pnlCancel.Visible = true;

                btnCancel.Text          = GetString("general.cancel");
                btnCancel.OnClientClick = "if(confirm(" + ScriptHelper.GetLocalizedString("ViewLog.CancelPrompt") + ")) { " + ctlAsync.GetCancelScript(true) + "} " + "return false;";

                ctlAsync.AttachToThread(thread);
            }
            else
            {
                pnlLog.Visible = false;

                ShowError(GetString("ViewLog.ThreadNotRunning"));
            }

            ScriptHelper.RegisterModule(Page, "CMS/HeaderShadow");
        }
    }