예제 #1
0
        private void MainForm_Shown(object sender, EventArgs e)
        {
            WindowsUtils.RegisterApplicationRestart(_machineWide ? "--restart --machine" : "--restart");

            UpdateAppListAsync();
            _tileManagement.LoadCachedCatalog();
            LoadCatalogAsync();

            bool firstRun = OnFirstRun();

            if (_tileManagement.AppList.Entries.Count == 0)
            {
                if (firstRun)
                {
                    using (var dialog = new IntroDialog()) dialog.ShowDialog(this);
                }

                // Show catalog automatically if AppList is empty
                tabControlApps.SelectTab(tabPageCatalog);
            }

            if (ProgramUtils.IsRunningFromCache && ProgramUtils.FindOtherInstance() == null)
            {
                deployTimer.Enabled = true;
            }
            else if (!SelfUpdateUtils.NoAutoCheck)
            {
                selfUpdateWorker.RunWorkerAsync();
            }
        }
예제 #2
0
        public void InstallPackage(string fastPackageReference)
        {
            var requirements = ParseReference(fastPackageReference);

            try
            {
                Install(requirements);
                SelfUpdateCheck();
            }
            catch (UnsuitableInstallBaseException ex)
            {
                string installLocation = ProgramUtils.FindOtherInstance(ex.NeedsMachineWide);
                if (installLocation == null)
                {
                    if (Handler.Ask(Resources.AskDeployZeroInstall + Environment.NewLine + ex.Message,
                                    defaultAnswer: false, alternateMessage: ex.Message))
                    {
                        installLocation = DeployInstance(ex.NeedsMachineWide);
                    }
                    else
                    {
                        return;
                    }
                }

                // Since we cannot another copy of Zero Install from a different location into the same AppDomain, simply prentend we are running from a different source
                Locations.OverrideInstallBase(installLocation);
                Install(requirements);
            }
        }