예제 #1
0
        // called when the compilation ended
        private void OnCompilationEnd(DeploymentHandler proDeployment)
        {
            Task.Factory.StartNew(() => {
                this.SafeInvoke(page => {
                    // get rid of the timer
                    if (_progressTimer != null)
                    {
                        _progressTimer.Stop();
                        _progressTimer.Dispose();
                        _progressTimer = null;
                    }
                    ResetScreen();
                    UpdateReport(_proDeployment.FormatDeploymentReport());
                    btReport.Visible = true;

                    // notify the user
                    if (!_proDeployment.HasBeenCancelled)
                    {
                        UserCommunication.NotifyUnique("ReportAvailable", "The requested deployment is over,<br>please check the generated report to see the result :<br><br><a href= '#'>Click here to see the report</a>", MessageImg.MsgInfo, "Deploy your application", "Report available", args => {
                            Appli.GoToPage(PageNames.MassCompiler);
                            UserCommunication.CloseUniqueNotif("ReportAvailable");
                        }, Appli.IsFocused() ? 10 : 0);
                    }
                });
            });
        }
예제 #2
0
파일: HomePage.cs 프로젝트: zhitian/3P
        public HomePage()
        {
            InitializeComponent();

            var prolintVer    = Updater <ProlintUpdaterWrapper> .Instance.LocalVersion;
            var proparseVer   = Updater <ProparseUpdaterWrapper> .Instance.LocalVersion;
            var datadiggerVer = Updater <DataDiggerUpdaterWrapper> .Instance.LocalVersion;


            html.Text = HtmlResources.home.Replace("%version%", AssemblyInfo.Version)
                        .Replace("%disclaimer%", AssemblyInfo.IsPreRelease ? HtmlResources.disclaimer : "")
                        .Replace("%YamuiFrameworkVersion%", LibLoader.GetYamuiAssemblyVersion())
                        .Replace("%ProlintVersion%", prolintVer.Equals("v0") ? "*not installed*" : prolintVer)
                        .Replace("%ProparseVersion%", proparseVer.Equals("v0") ? "*not installed*" : proparseVer)
                        .Replace("%DataDiggerVersion%", datadiggerVer.Equals("v0") ? "*not installed*" : datadiggerVer)
                        .Replace("%getting-started.md%", HtmlResources.getting_started.MdToHtml());

            html.LinkClicked += (sender, args) => {
                if (args.Link.Equals("update"))
                {
                    Appli.GoToPage(PageNames.OptionsUpdate);
                    args.Handled = true;
                }
            };

            yamuiScrollPage1.ContentPanel.Height = html.Height;
        }
예제 #3
0
        /// <summary>
        /// Called when the soft is already up to date
        /// </summary>
        protected virtual void OnAlreadyUpdated(GitHubUpdater gitHubUpdater, GitHubUpdater.ReleaseInfo releaseInfo)
        {
            try {
                Config.Instance.TechnicalLastWebserviceCallOk = true;

                if (AlwaysShowNotifications)
                {
                    UserCommunication.NotifyUnique("Update" + UpdatedSoftName, "Congratulations! You already own the latest <b>" + (!gitHubUpdater.GetPreReleases ? "beta" : "stable") + "</b> version of " + UpdatedSoftName + "." + (!gitHubUpdater.GetPreReleases ? "<br><br><i>If you wish to check for beta versions as well, toggle the corresponding option in the update " + "options".ToHtmlLink("options page") + "</i>" : ""), MessageImg.MsgUpdate, UpdatedSoftName + " updater", "Local version is " + gitHubUpdater.LocalVersion, args => {
                        if (args.Link.Equals("options"))
                        {
                            args.Handled = true;
                            Appli.GoToPage(PageNames.OptionsUpdate);
                        }
                    });
                }

                if (OnUpdateDone != null)
                {
                    OnUpdateDone(this);
                }
            } finally {
                _updating = false;
            }
        }
예제 #4
0
        /// <summary>
        /// Called when an error occurred during the update
        /// </summary>
        /// <param name="gitHubUpdater"></param>
        /// <param name="e"></param>
        /// <param name="gitHubUpdaterFailReason"></param>
        protected virtual void OnErrorOccured(GitHubUpdater gitHubUpdater, Exception e, GitHubUpdater.GitHubUpdaterFailReason gitHubUpdaterFailReason)
        {
            try {
                switch (gitHubUpdaterFailReason)
                {
                case GitHubUpdater.GitHubUpdaterFailReason.ReleaseApiUnreachable:

                    if (Config.Instance.TechnicalLastWebserviceCallOk || AlwaysShowNotifications)
                    {
                        // only show this message once in case of repetitive failures
                        UserCommunication.NotifyUnique("Update" + UpdatedSoftName, "For your information, it has not been possible to check for new releases on GITHUB.<br><br>The API requested was :<br>" + gitHubUpdater.GitHubReleaseApi.ToHtmlLink() + "<br>You might want to check your proxy settings on the " + "options".ToHtmlLink("update options page") + HowToInstallManually, MessageImg.MsgHighImportance, UpdatedSoftName + " updater", "Couldn't query GITHUB API", args => {
                            if (args.Link.Equals("options"))
                            {
                                args.Handled = true;
                                Appli.GoToPage(PageNames.OptionsUpdate);
                            }
                        });
                    }

                    Config.Instance.TechnicalLastWebserviceCallOk = false;

                    // check if there is an update available in the Shared config folder
                    if (!String.IsNullOrEmpty(Config.Instance.SharedConfFolder) && Directory.Exists(Config.Instance.SharedConfFolder))
                    {
                        var potentialUpdate = Path.Combine(Config.Instance.SharedConfFolder, AssemblyInfo.AssemblyName);

                        // if the .dll exists, is higher version and (the user get beta releases or it's a stable release)
                        if (File.Exists(potentialUpdate) &&
                            Utils.GetDllVersion(potentialUpdate).IsHigherVersionThan(AssemblyInfo.Version) &&
                            (Config.Instance.UserGetsPreReleases || AssemblyInfo.IsPreRelease || Utils.GetDllVersion(potentialUpdate).EndsWith(".0")))
                        {
                            // copy to local update folder and warn the user
                            if (Utils.CopyFile(potentialUpdate, Path.Combine(FolderUnzip, AssemblyInfo.AssemblyName)))
                            {
                                gitHubUpdater.LatestReleaseInfo = new GitHubUpdater.ReleaseInfo {
                                    tag_name     = Utils.GetDllVersion(potentialUpdate),
                                    prerelease   = Utils.GetDllVersion(potentialUpdate).EndsWith(".1"),
                                    published_at = "???",
                                    html_url     = Config.UrlCheckReleases
                                };

                                if (ExtraActionWhenDownloaded != null)
                                {
                                    ExtraActionWhenDownloaded(gitHubUpdater);
                                }

                                gitHubUpdater.VersionLog.Append("Version found on the shared folder : \n" + Config.Instance.SharedConfFolder.ToHtmlLink() + "\n\nCheck the official website to learn more about this release");

                                NotifyUpdateAvailable(Updater);
                            }
                        }
                    }

                    break;

                default:
                    ErrorHandler.ShowErrors(e, "Update error for " + UpdatedSoftName + " : " + gitHubUpdaterFailReason);
                    break;
                }
            } finally {
                _updating = false;
            }
        }
예제 #5
0
        // called when the compilation ended
        private void OnCompilationEnd()
        {
            Task.Factory.StartNew(() => {
                _filesToDeployPerStep.Add(0, _currentCompil.TransferedFiles);

                // if it went ok, move on to deploying files
                if (_currentCompil.DeploymentDone)
                {
                    // hook
                    ExecuteDeploymentHook();

                    _currentStep++; // move on to step 1

                    // Update the progress bar
                    UpdateProgressBar();

                    // transfer rules found for this step?
                    while (_proEnv.Deployer.DeployTransferRules.Exists(rule => rule.Step == _currentStep))
                    {
                        _filesToDeployPerStep.Add(_currentStep,
                                                  _proEnv.Deployer.DeployFilesForStep(_currentStep, new List <string> {
                            _currentStep == 1 ? _currentProfile.SourceDirectory : _proEnv.BaseCompilationPath
                        }, _currentProfile.ExploreRecursively ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly, f => _deploymentPercentage = f));

                        // hook
                        ExecuteDeploymentHook();

                        _currentStep++;
                    }
                }

                this.SafeInvoke(page => {
                    // Update the progress bar
                    progressBar.Progress = 100;
                    progressBar.Text     = @"Generating the report, please wait...";

                    // get rid of the timer
                    if (_progressTimer != null)
                    {
                        _progressTimer.Stop();
                        _progressTimer.Dispose();
                        _progressTimer = null;
                    }

                    // create the report and display it
                    BuildReport();

                    ResetScreen();

                    // notify the user
                    if (!_currentCompil.HasBeenCancelled)
                    {
                        UserCommunication.NotifyUnique("ReportAvailable", "The requested deployment is over,<br>please check the generated report to see the result :<br><br><a href= '#'>Cick here to see the report</a>", MessageImg.MsgInfo, "Deploy your application", "Report available", args => {
                            Appli.GoToPage(PageNames.MassCompiler);
                            UserCommunication.CloseUniqueNotif("ReportAvailable");
                        }, Appli.IsFocused() ? 10 : 0);
                    }

                    btReport.Visible = true;
                });
            });
        }