Run() static private method

static private Run ( System caller ) : int
caller System
return int
Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!PortalContext.IsWebSiteRoot)
            {
                //installing Sense/Net to a virtual folder is
                //not allowed currently. If the software is not
                //in the root of a website than present an info page.

                if (InstallPanel != null)
                {
                    InstallPanel.Visible = false;
                }
                if (AppNameErrorPanel != null)
                {
                    AppNameErrorPanel.Visible = true;
                }

                return;
            }

            if (!this.IsPostBack)
            {
                _runOnceState = RunOnce.Run(this);

                if (_runOnceState == 0)
                {
                    var ctx = PortalContext.Current;
                    if (PortalContext.Current.Site != null)
                    {
                        Response.Redirect("/", true);
                    }
                    else
                    {
                        RegisterHost();
                        Response.Redirect(HttpContext.Current.Request.Url.ToString());
                    }
                }
            }
        }
Exemplo n.º 2
0
        protected void Timer_OnTick(object sender, EventArgs e)
        {
            _runOnceState = RunOnce.Run(this);

            if (_runOnceState != 0)
            {
                string imgUrl       = imgMain.ImageUrl;
                int    currentIndex = -1;
                int    maxPictures  = GetMaxPictures();

                string currentChar = imgUrl.Substring(imgUrl.Length - 5, 1);
                if (int.TryParse(currentChar, out currentIndex))
                {
                    currentIndex++;
                }

                if (currentIndex < 0 || currentIndex > maxPictures)
                {
                    currentIndex = 0;
                }

                imgMain.ImageUrl = string.Format("Install/pic{0}.png", currentIndex);

                if (string.IsNullOrEmpty(RunOnce.ImportError) && RunOnce.TotalCount > 0)
                {
                    //max value is 99% not 100%, because we need to run index
                    //population after importing all the contents...
                    var percentFull  = Math.Min(Math.Max((RunOnce.ImportedCount * 1.0 / RunOnce.TotalCount) * 100, 1.15), 99);
                    var perCentRound = Math.Min(Math.Max(Convert.ToInt32(Math.Round(percentFull)), 1), 99);

                    labelProgressPercent.Text = percentFull.ToString("0.00") + "%";
                    panelBar.Width            = new Unit(string.Format("{0}%", perCentRound));
                }
                else
                {
                    ErrorPanel.Visible     = true;
                    plcProgressBar.Visible = false;

                    labelError.Text   = RunOnce.ImportError ?? "unknown error";
                    timerMain.Enabled = false;
                }

                updSensenetFooter.Update();
            }
            else
            {
                plcProgressBar.Visible = false;

                imgMain.ImageUrl    = "Install/picLast.png";
                imgMessage.ImageUrl = "Install/installer-portlet-caption-text-2.png";
                finish.Visible      = true;
                timerMain.Enabled   = false;

                // wait 1 sec and then redirect to cleanup.aspx -> this way 'Congratulations' picture is shown before being deleted
                var redirectScript = "setTimeout('window.location = \"/Cleanup.aspx\";', 1000)";
                ScriptManager.RegisterStartupScript(this, typeof(Page), "RedirectToCleanup", redirectScript, true);

                updSensenetFooter.Update();

                //HACK: Reset the pinned object: User.Visitor
                SenseNet.ContentRepository.DistributedApplication.Cache.Reset();
                SenseNet.ContentRepository.User.Reset();
            }
        }