Skip to content

Commit

Permalink
Merge pull request #1216 from Ordisoftware/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Ordisoftware authored Sep 25, 2022
2 parents 45f6690 + 4f79ad4 commit b1eca6a
Show file tree
Hide file tree
Showing 17 changed files with 69 additions and 150 deletions.
4 changes: 2 additions & 2 deletions Project/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -742,11 +742,11 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="SQLitePCLRaw.core" publicKeyToken="1488e028ca7ab535" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.1.1.1705" newVersion="2.1.1.1705" />
<bindingRedirect oldVersion="0.0.0.0-2.1.2.1721" newVersion="2.1.2.1721" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="SQLitePCLRaw.batteries_v2" publicKeyToken="8226ea5df37bcae9" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.1.1.1705" newVersion="2.1.1.1705" />
<bindingRedirect oldVersion="0.0.0.0-2.1.2.1721" newVersion="2.1.2.1721" />
</dependentAssembly>
</assemblyBinding>
</runtime>
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 @@
// en utilisant '*', comme indiqué ci-dessous :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: NeutralResourcesLanguage("en")]
[assembly: AssemblyVersion("9.34.0.0")]
[assembly: AssemblyFileVersion("9.34.0.0")]
[assembly: AssemblyVersion("9.33.0.0")]
[assembly: AssemblyFileVersion("9.33.0.0")]
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> 2022-06 </edited>
/// <edited> 2022-09 </edited>
namespace Ordisoftware.Core;

/// <summary>
Expand Down Expand Up @@ -129,10 +129,10 @@ static public TranslationsDictionary ApplicationMustExit
[Language.FR] = "Quitter l'application ?"
};

static public readonly TranslationsDictionary CantExitWhileGenerating = new()
static public readonly TranslationsDictionary CantExitWhileProcessing = new()
{
[Language.EN] = "Can't exit application while generating data.",
[Language.FR] = "Impossible de quitter l'application durant la génération des données."
[Language.EN] = "Can't exit application while processing data.",
[Language.FR] = "Impossible de quitter l'application durant le traitement des données."
};

static public readonly TranslationsDictionary AskToShutdownComputer = new()
Expand Down
7 changes: 6 additions & 1 deletion Project/Source/Common/Core/Globals/Globals.State.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> 2021-09 </edited>
/// <edited> 2022-09 </edited>
namespace Ordisoftware.Core;

/// <summary>
Expand Down Expand Up @@ -45,6 +45,11 @@ static partial class Globals
/// </summary>
static public bool IsLoadingData { get; set; }

/// <summary>
/// Indicates if the application is in loading or rendering or generating data stage.
/// </summary>
static public bool IsProcessingData => IsLoadingData || IsRendering || IsGenerating;

/// <summary>
/// Indicates if the application is ready to interact with the user or do its purpose.
/// </summary>
Expand Down
5 changes: 2 additions & 3 deletions Project/Source/Common/Hebrew/WinControls/LettersControl.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> 2012-10 </created>
/// <edited> 2022-07 </edited>
/// <edited> 2022-09 </edited>
namespace Ordisoftware.Hebrew;

public enum LettersControlFocusSelect
Expand Down Expand Up @@ -563,7 +563,6 @@ private void ActionPaste_Click(object sender, EventArgs e)
{
Focus(LettersControlFocusSelect.All);
TextBox.Text = Clipboard.GetText();
//TextBoxEx.ActionPaste.PerformClick();
}

private void ActionSearchOnline_Click(object sender, EventArgs e)
Expand Down Expand Up @@ -599,7 +598,7 @@ public bool UpdateControls()
internal void CheckClipboardContentType()
{
string strContent = Clipboard.GetText();
ActionPaste.Enabled = !strContent.IsNullOrEmpty() /* TODO && strContent.Length <= Settings.HebrewTextBoxMaxLength*/;
ActionPaste.Enabled = !strContent.IsNullOrEmpty();
if ( ActionPaste.Enabled )
{
var strLabel = HebrewAlphabet.IsValidUnicode(strContent)
Expand Down
22 changes: 21 additions & 1 deletion Project/Source/Database/ApplicationDatabase.Generate.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> 2022-03 </edited>
/// <edited> 2022-09 </edited>
namespace Ordisoftware.Hebrew.Calendar;

[Serializable]
Expand Down Expand Up @@ -47,6 +47,26 @@ public bool AddGenerateErrorAndCheckIfTooMany(string method, string date, Except
return LastGenerationErrors.Count >= MaxGenerateErrors;
}

public string ShowLastGenerationErrors(string title)
{
string errors = LastGenerationErrors.AsMultiLine();
LastGenerationErrors.Clear();
errors = Settings.GetGPSText() + Globals.NL2 + errors;
DebugManager.Trace(LogTraceEvent.Error, errors);
using ( var form = new ShowTextForm(title, errors,
false, true,
MessageBoxEx.DefaultWidthLarge, MessageBoxEx.DefaultHeightLarge,
false, false) )
{
form.TextBox.Font = new Font("Courier new", 8);
form.ShowDialog();
}
if ( DisplayManager.QueryYesNo(SysTranslations.ContactSupport.GetLang()) )
ExceptionForm.Run(new ExceptionInfo(this, new TooManyErrorsException(errors)));
return errors;
}


/// <summary>
/// Creates the days.
/// </summary>
Expand Down
3 changes: 1 addition & 2 deletions Project/Source/Forms/Boxes/Boards/ParashotForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,6 @@ private void EditFontSize_ValueChanged(object sender, EventArgs e)
{
DataGridView.Font = new Font("Microsoft Sans Serif", (float)EditFontSize.Value);
ColumnHebrew.DefaultCellStyle.Font = new Font("Hebrew", (float)EditFontSize.Value + 5);
// TODO remove if ( DataGridView.Rows.Count > 0 ) DataGridView.ColumnHeadersHeight = DataGridView.Rows[0].Height + 5;
}

private void BindingSource_DataSourceChanged(object sender, EventArgs e)
Expand All @@ -347,7 +346,7 @@ private void DataGridView_DataError(object sender, DataGridViewDataErrorEventArg
e.ThrowException = false;
}

private KeysConverter KeysConverter = new();
private readonly KeysConverter KeysConverter = new();

private void DataGridView_KeyDown(object sender, KeyEventArgs e)
{
Expand Down
3 changes: 1 addition & 2 deletions Project/Source/Forms/Config/PreferencesForm.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> 2022-08 </edited>
/// <edited> 2022-09 </edited>
namespace Ordisoftware.Hebrew.Calendar;

using KVPDataExportTarget = KeyValuePair<DataExportTarget, string>;
Expand All @@ -29,7 +29,6 @@ partial class PreferencesForm : Form
private bool IsReady;
private bool InitialHotKeyEnabled;

// TODO refactor in a class or dictionary
public int OldShabatDay { get; private set; }
public string OldLatitude { get; private set; }
public string OldLongitude { get; private set; }
Expand Down
20 changes: 2 additions & 18 deletions Project/Source/Forms/MainForm/Data/MainForm.Data.Create.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> 2022-03 </edited>
/// <edited> 2022-09 </edited>
namespace Ordisoftware.Hebrew.Calendar;

partial class MainForm
Expand Down Expand Up @@ -92,23 +92,7 @@ private string CreateData(int yearFirst, int yearLast)
UpdateButtons();
}
if ( ApplicationDatabase.Instance.LastGenerationErrors.Count != 0 )
{
string errors = ApplicationDatabase.Instance.LastGenerationErrors.AsMultiLine();
ApplicationDatabase.Instance.LastGenerationErrors.Clear();
errors = Settings.GetGPSText() + Globals.NL2 + errors;
DebugManager.Trace(LogTraceEvent.Error, errors);
using ( var form = new ShowTextForm(Text, errors,
false, true,
MessageBoxEx.DefaultWidthLarge, MessageBoxEx.DefaultHeightLarge,
false, false) )
{
form.TextBox.Font = new Font("Courier new", 8);
form.ShowDialog();
}
if ( DisplayManager.QueryYesNo(SysTranslations.ContactSupport.GetLang()) )
ExceptionForm.Run(new ExceptionInfo(this, new TooManyErrorsException(errors)));
return errors;
}
return ApplicationDatabase.Instance.ShowLastGenerationErrors(Text);
return null;
}

Expand Down
6 changes: 3 additions & 3 deletions Project/Source/Forms/MainForm/Data/MainForm.Data.Load.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> 2019-01 </created>
/// <edited> 2021-12 </edited>
/// <edited> 2022-09 </edited>
namespace Ordisoftware.Hebrew.Calendar;

partial class MainForm
Expand All @@ -21,7 +21,7 @@ private void LoadData()
{
bool formEnabled = Enabled;
ToolStrip.Enabled = false;
Globals.IsGenerating = true;
Globals.IsLoadingData = true;
try
{
PanelTitleInner.Visible = true;
Expand Down Expand Up @@ -50,7 +50,7 @@ private void LoadData()
}
finally
{
Globals.IsGenerating = false;
Globals.IsLoadingData = false;
LabelSubTitleGPS.Text = string.Empty;
ToolStrip.Enabled = formEnabled;
LoadDataEnd();
Expand Down
8 changes: 6 additions & 2 deletions Project/Source/Forms/MainForm/Data/MainForm.FillMonths.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@
/// You may add additional accurate notices of copyright ownership.
/// </license>
/// <created> 2019-01 </created>
/// <edited> 2022-06 </edited>
/// <edited> 2022-09 </edited>
namespace Ordisoftware.Hebrew.Calendar;

using CodeProjectCalendar.NET;
using CommandLine;

partial class MainForm
{
Expand Down Expand Up @@ -236,12 +237,15 @@ void add(Color color, string text)
catch ( Exception ex )
{
if ( ApplicationDatabase.Instance.AddGenerateErrorAndCheckIfTooMany(nameof(FillMonths), row.DateAsString, ex) )
{
if ( !Globals.IsGenerating && ApplicationDatabase.Instance.LastGenerationErrors.Count != 0 )
ApplicationDatabase.Instance.ShowLastGenerationErrors(Text);
return;
}
}
}
finally
{
// TODO show errors like with generate days
Globals.ChronoShowData.Stop();
Settings.BenchmarkFillCalendar = Globals.ChronoShowData.ElapsedMilliseconds;
SystemManager.TryCatch(Settings.Store);
Expand Down
5 changes: 3 additions & 2 deletions Project/Source/Forms/MainForm/UI/MainForm.GoToDate.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> 2022-06 </edited>
/// <edited> 2022-09 </edited>
namespace Ordisoftware.Hebrew.Calendar;

partial class MainForm
Expand All @@ -28,7 +28,8 @@ public void GoToDate(DateTime date,
Form regetFocus = null,
ViewScrollOverride scroll = ViewScrollOverride.None)
{
if ( !Globals.IsReady || Globals.IsGenerating ) return;
if ( !Globals.IsReady ) return;
if ( Globals.IsProcessingData ) return;
if ( GoToDateMutex ) return;
if ( date < DateFirst ) date = DateFirst;
if ( date > DateLast ) date = DateLast;
Expand Down
6 changes: 3 additions & 3 deletions Project/Source/Forms/MainForm/UI/MainForm.TrayIcon.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> 2022-06 </edited>
/// <edited> 2022-09 </edited>
namespace Ordisoftware.Hebrew.Calendar;

partial class MainForm
Expand Down Expand Up @@ -125,9 +125,9 @@ public void DoMenuShowHide_Click(object sender, EventArgs e)

private void DoMenuExit_Click(object sender, EventArgs e)
{
if ( Globals.IsGenerating )
if ( Globals.IsProcessingData )
{
DisplayManager.ShowInformation(SysTranslations.CantExitWhileGenerating.GetLang());
DisplayManager.ShowInformation(SysTranslations.CantExitWhileProcessing.GetLang());
return;
}
if ( ( EditConfirmClosing.Checked && !Globals.IsSessionEnding )
Expand Down
13 changes: 7 additions & 6 deletions Project/Source/Forms/MainForm/UI/MainForm.UpdateUI.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> 2022-04 </edited>
/// <edited> 2022-09 </edited>
namespace Ordisoftware.Hebrew.Calendar;

/// <summary>
Expand Down Expand Up @@ -89,7 +89,8 @@ private void DoScreenPosition(object sender, EventArgs e)
/// </summary>
private void UpdateTitles(bool force = false)
{
if ( !Globals.IsReady || Globals.IsGenerating ) return;
if ( !Globals.IsReady ) return;
if ( Globals.IsProcessingData ) return;
if ( UpdateTitlesMutex ) return;
UpdateTitlesMutex = true;
try
Expand Down Expand Up @@ -179,8 +180,8 @@ public void UpdateButtons()
SystemManager.TryCatchManage(() =>
{
if ( LoadingForm.Instance.Visible ) LoadingForm.Instance.Hide();
MenuTray.Enabled = Globals.IsReady && !Globals.IsGenerating;
ToolStrip.Enabled = !Globals.IsGenerating;
MenuTray.Enabled = Globals.IsReady && !Globals.IsProcessingData;
ToolStrip.Enabled = !Globals.IsProcessingData;
ActionSaveToFile.Enabled = LunisolarDays.Count > 0;
ActionCopyToClipboard.Enabled = ActionSaveToFile.Enabled;
ActionPrint.Enabled = ActionSaveToFile.Enabled && Settings.CurrentView != ViewMode.Grid;
Expand All @@ -198,7 +199,7 @@ public void UpdateButtons()
/// </summary>
public void UpdateCalendarMonth(bool doFill)
{
Globals.IsGenerating = true;
Globals.IsRendering = true;
var cursor = Cursor;
Cursor = Cursors.WaitCursor;
bool formEnabled = Enabled;
Expand All @@ -213,7 +214,7 @@ public void UpdateCalendarMonth(bool doFill)
{
ToolStrip.Enabled = formEnabled;
Cursor = cursor;
Globals.IsGenerating = false;
Globals.IsRendering = false;
SetView(Settings.CurrentView, true);
UpdateButtons();
}
Expand Down
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> 2022-06 </edited>
/// <edited> 2022-09 </edited>
namespace Ordisoftware.Hebrew.Calendar;

using static Ordisoftware.Hebrew.HebrewTranslations;
Expand Down Expand Up @@ -126,7 +126,7 @@ static partial class AppTranslations
[Language.EN] = TorahCelebrations[TorahCelebration.Soukot][Language.EN] + " " + End[Language.EN],
[Language.FR] = TorahCelebrations[TorahCelebration.Soukot][Language.FR] + " " + End[Language.FR]
}
// TODO Manage as user custom remind list
// TODO manage as user custom remind list
/*[TorahCelebrationDay.HanoukaD1] = new TranslationsDictionary
{
[Language.EN] = "'Hanouka start",
Expand Down
Loading

0 comments on commit b1eca6a

Please sign in to comment.