예제 #1
0
        protected override void CreateChildControls()
        {
            if (powerWebPartException != null)
            {
                return;
            }

            try
            {
                renderControl = new DynamicControl(this);

                if (functions.ContainsKey(PowerWebPartConstants.FunctionCreateControls))
                {
                    Command cmd = new Command(PowerWebPartConstants.FunctionCreateControls);
                    cmd.Parameters.Add("controls", renderControl.Controls);

                    Pipeline tmpPipe = CreatePipeline();
                    tmpPipe.Commands.Add(cmd);
                    InvokePipeline(tmpPipe, false);
                }

                this.Controls.Add(renderControl);
            }
            catch (Exception ex)
            {
                powerWebPartException = new PowerControlException(PowerWebPartConstants.FunctionCreateControls, ex);
            }

            base.CreateChildControls();
        }
예제 #2
0
        protected override void CreateChildControls()
        {
            if (powerWebPartException != null)
            {
                return;
            }

            try
            {
                renderControl = new DynamicControl(this);

                if (AjaxEnabled)
                {
                    updatePanel    = new UpdatePanel();
                    updatePanel.ID = "updatePanel";

                    string progressTemplate      = runspace.SessionStateProxy.GetVariable(VariableProgressTemplate) as string;
                    bool   progressDynamicLayout = (bool)runspace.SessionStateProxy.GetVariable(VariableProgressDynamicLayout);
                    int    progressDisplayAfter  = (int)runspace.SessionStateProxy.GetVariable(VariableProgressDisplayAfter);
                    int    refreshInterval       = (int)runspace.SessionStateProxy.GetVariable(VariableRefreshInterval);

                    if (String.IsNullOrEmpty(progressTemplate) == false)
                    {
                        updateProgress                         = new UpdateProgress();
                        updateProgress.ID                      = "updateProgress";
                        updateProgress.DynamicLayout           = progressDynamicLayout;
                        updateProgress.AssociatedUpdatePanelID = updatePanel.ClientID;
                        updateProgress.ProgressTemplate        = new PowerWebPartProgressTemplate(progressTemplate);
                        updateProgress.DisplayAfter            = progressDisplayAfter;
                        this.Controls.Add(updateProgress);
                    }

                    if (refreshInterval > 0)
                    {
                        timer          = new Timer();
                        timer.Interval = refreshInterval;
                        timer.Tick    += new EventHandler <EventArgs>(RefreshIntervalElapsed);
                        updatePanel.ContentTemplateContainer.Controls.Add(timer);
                    }

                    this.Controls.Add(updatePanel);
                }

                if (functions.ContainsKey(FunctionCreateControls))
                {
                    Command cmd = new Command(FunctionCreateControls);
                    cmd.Parameters.Add("controls", renderControl.Controls);

                    Pipeline pipe = runspace.CreatePipeline();
                    pipe.Commands.Add(cmd);
                    InvokePipeline(pipe);
                }

                if (AjaxEnabled)
                {
                    this.updatePanel.ContentTemplateContainer.Controls.Add(renderControl);
                }
                else
                {
                    this.Controls.Add(renderControl);
                }
            }
            catch (Exception ex)
            {
                powerWebPartException = new PowerWebPartException(FunctionCreateControls, ex);
            }

            base.CreateChildControls();
        }