-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
harald
committed
Oct 19, 2024
1 parent
87d751f
commit abdc1d9
Showing
20 changed files
with
760 additions
and
216 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
src/Pacioli.Config.Persistence.Test/Pacioli.Config.Persistence.Test.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
|
||
<IsPackable>false</IsPackable> | ||
<IsTestProject>true</IsTestProject> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="coverlet.collector" Version="6.0.0" /> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" /> | ||
<PackageReference Include="NUnit" Version="3.14.0" /> | ||
<PackageReference Include="NUnit.Analyzers" Version="3.9.0" /> | ||
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Pacioli.Config.Persistence\Pacioli.Config.Persistence.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Using Include="NUnit.Framework" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
namespace Pacioli.Config.Persistence.Test | ||
{ | ||
public class Tests | ||
{ | ||
ConfigDb configDb; | ||
|
||
[SetUp] | ||
public void Setup() | ||
{ | ||
configDb = new ConfigDb(); | ||
} | ||
|
||
[Test] | ||
public void Test1() | ||
{ | ||
var pref = configDb.ReadPreferences(); | ||
pref.OpenAfterSave = false; | ||
configDb.SavePreferences(pref); | ||
pref = configDb.ReadPreferences(); | ||
Assert.IsFalse(pref.OpenAfterSave); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
src/Pacioli.Config.Persistence/Pacioli.Config.Persistence.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.Data.Sqlite" Version="8.0.10" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Pacioli.Language\Pacioli.Language.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
using Pacioli.Language.Resources; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Globalization; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Pacioli.Config.Persistence | ||
{ | ||
public class UserPreferences | ||
{ | ||
public string UserName { get; set; } | ||
public string DefaultFolder { get; set; } | ||
public string LanguageCode { get; set; } | ||
public string AttachmentOutputFolder { get; set; } | ||
public bool OpenAfterSave { get; set; } | ||
|
||
public UserPreferences() | ||
{ | ||
UserName = Environment.UserName; | ||
DefaultFolder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); | ||
AttachmentOutputFolder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); | ||
LanguageCode = CultureInfo.CurrentCulture.TwoLetterISOLanguageName; | ||
OpenAfterSave = true; | ||
} | ||
|
||
public void SetCulture() | ||
{ | ||
if (LanguageCode == "System") | ||
{ | ||
CultureInfo.CurrentCulture = CultureInfo.InstalledUICulture; | ||
CultureInfo.CurrentUICulture = CultureInfo.InstalledUICulture; | ||
Thread.CurrentThread.CurrentCulture = CultureInfo.InstalledUICulture; | ||
Thread.CurrentThread.CurrentUICulture = CultureInfo.InstalledUICulture; | ||
Resources.Culture = CultureInfo.InstalledUICulture; | ||
} | ||
else | ||
{ | ||
CultureInfo.CurrentCulture = new CultureInfo(LanguageCode); | ||
Thread.CurrentThread.CurrentCulture = new CultureInfo(LanguageCode); | ||
Thread.CurrentThread.CurrentUICulture = new CultureInfo(LanguageCode); | ||
Resources.Culture = new CultureInfo(LanguageCode); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.