Skip to content

Commit

Permalink
Merge pull request #919 from Ordisoftware/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Ordisoftware authored Sep 29, 2021
2 parents 181b88b + e3bba99 commit 29f12fe
Show file tree
Hide file tree
Showing 26 changed files with 371 additions and 178 deletions.
3 changes: 3 additions & 0 deletions Project/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,9 @@
<setting name="CalendarDoubleClickAction" serializeAs="String">
<value>SetActive</value>
</setting>
<setting name="MainFormTitleBarShowCelebration" serializeAs="String">
<value>True</value>
</setting>
</Ordisoftware.Hebrew.Calendar.Properties.Settings>
</userSettings>
<startup>
Expand Down
3 changes: 3 additions & 0 deletions Project/Hebrew Calendar (vs2017).csproj
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,9 @@
<Compile Include="Source\Forms\MainForm\MainForm.Initialize.Menus.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Source\Forms\MainForm\Reminder\MainForm.Reminder.Timers.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Source\Forms\MainForm\UI\MainForm.TrayIcon.cs">
<SubType>Form</SubType>
</Compile>
Expand Down
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("9.5.0.0")]
[assembly: AssemblyFileVersion("9.5.0.0")]
[assembly: AssemblyVersion("9.6.0.0")]
[assembly: AssemblyFileVersion("9.6.0.0")]
12 changes: 12 additions & 0 deletions Project/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Project/Properties/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -679,5 +679,8 @@
<Setting Name="CalendarDoubleClickAction" Type="Ordisoftware.Hebrew.Calendar.CalendarDoubleClickAction" Scope="User">
<Value Profile="(Default)">SetActive</Value>
</Setting>
<Setting Name="MainFormTitleBarShowCelebration" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
</Settings>
</SettingsFile>
4 changes: 1 addition & 3 deletions Project/Source/Common/Core/Exceptions/ExceptionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
using System.Reflection;
using System.Threading;

#pragma warning disable S1643 // Strings should not be concatenated using '+' in a loop
#pragma warning disable S1643 // Strings should not be concatenated using '+' in a loop - Opinion
namespace Ordisoftware.Core
{

Expand Down Expand Up @@ -212,7 +212,6 @@ private void ExtractStack(bool full)
{
var method = frame.GetMethod();
partMethod = method.DeclaringType.FullName;
//var type = Type.GetType(partMethod);
Type[] list = { typeof(DebugManager), typeof(ExceptionInfo) };
if ( list.Contains(method.DeclaringType) )
continue;
Expand Down Expand Up @@ -328,7 +327,6 @@ public ExceptionInfo(object sender, Exception ex)
TargetSite = ex.TargetSite;
try
{
//Emitter = Sender is ExceptionForm form ? form.Text : Globals.MainForm?.Text ?? ex.Source;
Emitter = Globals.AssemblyTitleWithVersion;
ExtractInherits();
try
Expand Down
27 changes: 27 additions & 0 deletions Project/Source/Common/Core/Managers.System/SystemManager.Try.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,33 @@ namespace Ordisoftware.Core
static partial class SystemManager
{

/// <summary>
/// Call actions without raising exceptions.
/// </summary>
static public void TryCatch(params Action[] actions)
{
foreach ( var action in actions )
TryCatch(action);
}

/// <summary>
/// Call actions without raising exceptions.
/// </summary>
static public void TryCatchManage(params Action[] actions)
{
foreach ( var action in actions )
TryCatchManage(action);
}

/// <summary>
/// Call actions without raising exceptions.
/// </summary>
static public void TryCatchManage(ShowExceptionMode mode, params Action[] actions)
{
foreach ( var action in actions )
TryCatchManage(mode, action);
}

/// <summary>
/// Call an action without raising exceptions.
/// </summary>
Expand Down
18 changes: 10 additions & 8 deletions Project/Source/Common/Hebrew/Classes/HebrewGlobals.providers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,15 @@ static private OnlineProviders CreateOnlineProviders(DataFileFolder folder, stri
}
}

static private void LoadWebLinksProviders()
{
foreach ( var file in Directory.GetFiles(WebLinksFolderPath, "WebLinks*.txt") )
{
var item = CreateOnlineProviders(DataFileFolder.ApplicationDocuments, file);
if ( item != null ) WebLinksProviders.Add(item);
}
}

/// <summary>
/// Load the providers files.
/// </summary>
Expand All @@ -127,14 +136,7 @@ static internal void LoadProviders()
WebProvidersCelebration = CreateOnlineProviders(folder, WebProvidersCelebrationFilePath);
WebLinksProviders = new List<OnlineProviders>();
if ( Directory.Exists(WebLinksFolderPath) )
SystemManager.TryCatch(() =>
{
foreach ( var file in Directory.GetFiles(WebLinksFolderPath, "WebLinks*.txt") )
{
var item = CreateOnlineProviders(DataFileFolder.ApplicationDocuments, file);
if ( item != null ) WebLinksProviders.Add(item);
}
});
SystemManager.TryCatchManage(ShowExceptionMode.OnlyMessage, LoadWebLinksProviders);
}

}
Expand Down
1 change: 1 addition & 0 deletions Project/Source/Common/Hebrew/Entities/TorahCelebration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ namespace Ordisoftware.Hebrew

public enum TorahCelebration
{
None,
Pessah,
Chavouot,
YomTerouah,
Expand Down
14 changes: 12 additions & 2 deletions Project/Source/Database/ApplicationDatabase.Parashah.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,21 @@ partial class ApplicationDatabase : SQLiteDatabase
if ( today.TorahEvent == TorahCelebrationDay.PessahD1 || today.TorahEvent == TorahCelebrationDay.PessahD7 )
return (today, null);
else
if ( !today.GetWeekLongCelebrationIntermediateDay().IsNullOrEmpty() )
if ( today.GetWeekLongCelebrationIntermediateDay().Event != TorahCelebration.None )
return (today, null);
if ( today.LunarMonth == TorahCelebrationSettings.YomsMonth )
if ( today.TorahEvent == TorahCelebrationDay.YomTerouah || today.TorahEvent == TorahCelebrationDay.YomHaKipourim )
return (today, null);
else
{
var dayInfos = today.GetWeekLongCelebrationIntermediateDay();
if ( dayInfos.Event == TorahCelebration.Soukot )
if ( dayInfos.Index < 8 || ( dayInfos.Index == 8 && Program.Settings.UseSimhatTorahOutside ) )
return (today, null);
}
if ( Program.Settings.TorahEventsCountAsMoon ) today = GetDaySun(DateTime.Now);
today = today?.GetParashahReadingDay();
return (today, ParashotFactory.Instance.Get(today?.ParashahID) ?? null);
return (today, ParashotFactory.Instance.Get(today?.ParashahID));
}

public bool ShowWeeklyParashahDescription()
Expand Down
12 changes: 7 additions & 5 deletions Project/Source/Database/LunisolarDay.Helper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace Ordisoftware.Hebrew.Calendar
partial class LunisolarDay
{

public string GetWeekLongCelebrationIntermediateDay()
public (TorahCelebration Event, int Index, string Text) GetWeekLongCelebrationIntermediateDay()
{
int deltaPessah = Program.Settings.TorahEventsCountAsMoon ? 0 : -1;
if ( MoonriseOccuring != MoonriseOccuring.NextDay || deltaPessah != 0 )
Expand All @@ -31,7 +31,7 @@ public string GetWeekLongCelebrationIntermediateDay()
? LunarDay - TorahCelebrationSettings.PessahStartDay + 1 + deltaPessah
: -1;
if ( day > 0 && day <= TorahCelebrationSettings.PessahLenght )
return AppTranslations.PessahDay.GetLang(day);
return (TorahCelebration.Pessah, day, AppTranslations.PessahDay.GetLang(day));
}
else
if ( LunarMonth == TorahCelebrationSettings.YomsMonth )
Expand All @@ -40,7 +40,7 @@ public string GetWeekLongCelebrationIntermediateDay()
? LunarDay - TorahCelebrationSettings.SoukotStartDay + 1
: -1;
if ( day > 0 && day <= TorahCelebrationSettings.SoukotLenght )
return AppTranslations.SoukotDay.GetLang(day);
return (TorahCelebration.Soukot, day, AppTranslations.SoukotDay.GetLang(day));
}
else
if ( LunarMonth == 3 )
Expand Down Expand Up @@ -74,9 +74,11 @@ public string GetWeekLongCelebrationIntermediateDay()
&& first.Date <= last.Date
&& this.Date >= first.Date
&& this.Date <= last.Date )
return AppTranslations.TorahCelebrationDays[TorahCelebrationDay.ChavouotDiet].GetLang();
return (TorahCelebration.Chavouot,
(int)( this.Date - first.Date ).TotalDays + 1,
AppTranslations.TorahCelebrationDays[TorahCelebrationDay.ChavouotDiet].GetLang());
}
return string.Empty;
return (TorahCelebration.None, 0, string.Empty);
}

}
Expand Down
1 change: 1 addition & 0 deletions Project/Source/Forms/Config/PreferencesForm.Load.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ private void LoadSettings()
SystemManager.TryCatch(() => { EditWeatherAppPath.Text = Settings.WeatherAppPath; });
SystemManager.TryCatch(() => { EditWeatherMenuItemsEnabled.Checked = Settings.WeatherMenuItemsEnabled; });
SystemManager.TryCatch(() => { EditMainFormTitleBarShowToday.Checked = Settings.MainFormTitleBarShowToday; });
SystemManager.TryCatch(() => { EditMainFormTitleBarShowCelebration.Checked = Settings.MainFormTitleBarShowCelebration; });
SystemManager.TryCatch(() => { EditShowLastNewInVersionAfterUpdate.Checked = Settings.ShowLastNewInVersionAfterUpdate; });
SystemManager.TryCatch(() => { EditCalendarLineSpacing.Value = Settings.CalendarLineSpacing; });
SystemManager.TryCatch(() => { EditConfirmShutdown.Checked = Settings.LockSessionConfirmLogOffOrMore; });
Expand Down
1 change: 1 addition & 0 deletions Project/Source/Forms/Config/PreferencesForm.Save.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ private void SaveSettings()
Settings.WeatherMenuItemsEnabled = EditWeatherMenuItemsEnabled.Checked;
Settings.ShowLastNewInVersionAfterUpdate = EditShowLastNewInVersionAfterUpdate.Checked;
Settings.MainFormTitleBarShowToday = EditMainFormTitleBarShowToday.Checked;
Settings.MainFormTitleBarShowCelebration = EditMainFormTitleBarShowCelebration.Checked;
Settings.CalendarLineSpacing = (int)EditCalendarLineSpacing.Value;
Settings.LockSessionConfirmLogOffOrMore = EditConfirmShutdown.Checked;
Settings.AskRegenerateIfIntervalGreater = EditAskRegenerateIfIntervalGreater.Checked;
Expand Down
9 changes: 9 additions & 0 deletions Project/Source/Forms/Config/PreferencesForm.designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Project/Source/Forms/Config/PreferencesForm.fr.resx
Original file line number Diff line number Diff line change
Expand Up @@ -901,4 +901,7 @@
<data name="TabPageColors.Text" xml:space="preserve">
<value>Couleurs</value>
</data>
<data name="EditMainFormTitleBarShowCelebration.Text" xml:space="preserve">
<value>Afficher la célébration en cours dans la barre de titre</value>
</data>
</root>
Loading

0 comments on commit 29f12fe

Please sign in to comment.