Skip to content

Commit

Permalink
Add check update
Browse files Browse the repository at this point in the history
  • Loading branch information
Olivier Rogier committed May 22, 2019
1 parent f24fe45 commit 1ac6a8d
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Project/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut
// en utilisant '*', comme indiqué ci-dessous :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.7.0.0")]
[assembly: AssemblyFileVersion("1.7.0.0")]
[assembly: AssemblyVersion("1.8.0.0")]
[assembly: AssemblyFileVersion("1.8.0.0")]
14 changes: 14 additions & 0 deletions Project/Source/Classes/Localizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,20 @@ static public readonly Dictionary<string, string> ExitApplicationText
{ "fr", "Quitter l'application ?" }
};

static public readonly Dictionary<string, string> CheckUpdateResultText
= new Dictionary<string, string>()
{
{ "en", "A newer version is available : " },
{ "fr", "Une nouvelle version est disponible : " }
};

static public readonly Dictionary<string, string> CheckUpdateAskDownloadText
= new Dictionary<string, string>()
{
{ "en", "Do you want to open the download page?" },
{ "fr", "Voulez-vous ouvrir la page de téléchargement ?" }
};

static public readonly Dictionary<string, string> SelectBirthdayText
= new Dictionary<string, string>()
{
Expand Down
29 changes: 28 additions & 1 deletion Project/Source/Forms/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
/// You may add additional accurate notices of copyright ownership.
/// </license>
/// <created> 2016-04 </created>
/// <edited> 2019-04 </edited>
/// <edited> 2019-05 </edited>
using Microsoft.Win32;
using Ordisoftware.Core;
using System;
Expand All @@ -20,6 +20,7 @@
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Net;
using System.Windows.Forms;
using System.Drawing.Printing;

Expand Down Expand Up @@ -107,6 +108,7 @@ private void MainForm_Shown(object sender, EventArgs e)
UpdateButtons();
MenuShowHide.Text = Localizer.HideRestoreText.GetLang(Visible);
NavigationForm.Instance.Date = DateTime.Now;
CheckUpdate();
if ( Program.Settings.StartupHide ) MenuShowHide.PerformClick();
}

Expand Down Expand Up @@ -143,6 +145,31 @@ private void SessionEnding(object sender, SessionEndingEventArgs e)
Close();
}

/// <summary>
/// Check if a newer version is available.
/// </summary>
private void CheckUpdate()
{
try
{
string title = AboutBox.Instance.AssemblyTitle;
string url = "http://www.ordisoftware.com/files/" + title.Replace(" ", "") + ".update";
using ( WebClient client = new WebClient() )
{

string version = client.DownloadString(url);
if ( version != AboutBox.Instance.AssemblyVersion )
if ( DisplayManager.QueryYesNo(Localizer.CheckUpdateResultText.GetLang() + version + Environment.NewLine +
Environment.NewLine +
Localizer.CheckUpdateAskDownloadText.GetLang()) )
AboutBox.Instance.OpenApplicationHome();
}
}
catch
{
}
}

/// <summary>
/// Event handler. Called by MenuShowHide for click events.
/// </summary>
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,13 @@ These are Pesa'h or Easter which is the liberation of illusions, Shavuot or Week

## Changelog

#### 2019.05.22 - Version 1.8

- Add check update.

#### 2019.04.25 - Version 1.7

- Fix pessah lenght.
- Fix pessah length.

#### 2019.04.08 - Version 1.6

Expand Down
2 changes: 1 addition & 1 deletion Setup/OrdisoftwareHebrewCalendarSetup.iss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#define MyAppName "Hebrew Calendar"
#define MyAppNameNoSpace "HebrewCalendar"
#define MyAppVersion "1.7"
#define MyAppVersion "1.8"
#define MyAppPublisher "Ordisoftware"
#define MyAppURL "http://www.ordisoftware.com/projects/hebrew-calendar"
#define MyAppExeName "Ordisoftware.HebrewCalendar.exe"
Expand Down

0 comments on commit 1ac6a8d

Please sign in to comment.