Exemple #1
0
        public ApplicationUpdateEventInfo CheckUpdates()
        {
            var nothingChangedEvent = new ApplicationUpdateEventInfo()
            {
                Type = ApplicationUpdateEventType.NothingChanged
            };

            var latestVersion = GetLatestVersionFromServer();

            if (latestVersion == null)
            {
                return(nothingChangedEvent);
            }

            var applicationVersionManager = PrintingApp.GetVersionManager();

            if (applicationVersionManager.ApplicationVersion != latestVersion.ApplicationVersion)
            {
                return(new ApplicationUpdateEventInfo()
                {
                    Type = ApplicationUpdateEventType.ApplicationVersionChanged,
                    LatestVersion = latestVersion,
                });
            }
            else if (applicationVersionManager.ReportTemplateVersion != latestVersion.ReportTemplateVersion)
            {
                return(new ApplicationUpdateEventInfo()
                {
                    Type = ApplicationUpdateEventType.ReportTemplateVersionChanged,
                    LatestVersion = latestVersion,
                });
            }

            return(nothingChangedEvent);
        }
Exemple #2
0
        public void Time_Elapsed(object source, System.Timers.ElapsedEventArgs e)
        {
            var applicationUpdateEventInfo = CheckUpdates();

            switch (applicationUpdateEventInfo.Type)
            {
            case ApplicationUpdateEventType.ApplicationVersionChanged:
                MessageBox.Show(ConstString.DetectNewVersionNotification);
                break;

            case ApplicationUpdateEventType.ReportTemplateVersionChanged:
            {
                var applicationVersionManager = PrintingApp.GetVersionManager();
                applicationVersionManager.UpdateReportTemplateVersion(applicationUpdateEventInfo.LatestVersion.ReportTemplateVersion);
            }
            break;

            case ApplicationUpdateEventType.NothingChanged:
                break;

            default:
                break;
            }
        }