Beispiel #1
0
        public static bool CheckAndDownloadApp(DownloadType dlt)
        {
            if (UpdateSetting.ServerDown)
            {
                return(false);
            }
            try {
                DateTime lastUpdateDate     = FileTimeStamp(dlt.file2Download);// response1.LastModified;
                DateTime currentVersionDate = System.IO.File.GetLastWriteTime(dlt.PC_Destination);
                TimeSpan span = lastUpdateDate.Subtract(currentVersionDate);

                if (span.Days > 0 || span.Hours * 3600 + span.Minutes * 60 + span.Seconds > 100)//min 5 min
                {
                    DialogsResult res  = DialogsResult.Yes;
                    FileInfo      file = new FileInfo(Assembly.GetExecutingAssembly().Location);
                    res = StaticFormsCalls.DoResult("Nieuwe versie " + FileName(dlt.PC_Destination) + " downloaden?", "Nieuwe versie aanwezig", false);
                    if (res == DialogsResult.Yes)
                    {
                        //  writeDownloadInfo();
                        return(true);
                    }
                }
            }
            catch (Exception err) {
                StaticFormsCalls.ShowMessage("Update check van " + FileName(dlt.file2Download) + err.Message);
            }
            return(false);
        }