Skip to content

Commit

Permalink
Merge pull request #31 from DSaladinCH/develop
Browse files Browse the repository at this point in the history
Version 0.14.2
  • Loading branch information
DominicSaladin authored Jan 25, 2024
2 parents 13b3432 + 344bd7c commit 644e0a8
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
5 changes: 5 additions & 0 deletions speed-time/Dialogs/TrackTimeEditor.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ public TrackTimeEditor(TrackTime? trackTime = null)
};
}

public TrackTimeEditor(DateTime startDate): this()
{
SelectedDate = startDate;
}

private void SaveAndClose()
{
if (string.IsNullOrEmpty(TrackTimeTitle))
Expand Down
19 changes: 7 additions & 12 deletions speed-time/Model/FileDataService.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using DSaladin.SpeedTime.Dialogs;
using DSaladin.FancyPotato;
using DSaladin.SpeedTime.Dialogs;
using DSaladin.SpeedTime.Properties;
using System;
using System.Collections.Generic;
Expand All @@ -14,19 +15,14 @@ namespace DSaladin.SpeedTime.Model
{
internal class FileDataService : IDataService
{
private const string PUBLISHER = "DSaladin";
private const string APPNAME = "speed-time";
private const string FILENAME = "usersettings.json";
private const string CONFIG_NAME = "usersettings.json";

public async Task LoadSettings()
{
string appDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
string filePath = Path.Combine(appDataPath, PUBLISHER, APPNAME, FILENAME);

SettingsModel? settings = null;
try
{
FileStream stream = File.OpenRead(filePath);
FileStream stream = File.OpenRead(DSApplication.GetSettingsFilePath(CONFIG_NAME));
settings = await JsonSerializer.DeserializeAsync<SettingsModel>(stream);
stream.Close();
}
Expand All @@ -44,11 +40,10 @@ public async Task SaveSettings()
var stream = new MemoryStream();
await JsonSerializer.SerializeAsync(stream, SettingsModel.Instance);

string appDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
string appFolderPath = Path.Combine(appDataPath, PUBLISHER, APPNAME);
Directory.CreateDirectory(appFolderPath);
string filePath = DSApplication.GetSettingsFilePath(CONFIG_NAME);
Directory.CreateDirectory(Path.GetDirectoryName(filePath)!);

File.WriteAllText(Path.Combine(appFolderPath, FILENAME), Encoding.UTF8.GetString(stream.ToArray()));
File.WriteAllText(filePath, Encoding.UTF8.GetString(stream.ToArray()));
stream.Close();
}
}
Expand Down
2 changes: 1 addition & 1 deletion speed-time/ViewModel/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public MainWindowViewModel()
return;

IsTrackTimeEditorOpen = true;
TrackTime? newTime = await ShowDialog<TrackTime>(new TrackTimeEditor());
TrackTime? newTime = await ShowDialog<TrackTime>(new TrackTimeEditor(CurrentDateTime));
IsTrackTimeEditorOpen = false;

if (newTime is not null)
Expand Down
4 changes: 2 additions & 2 deletions speed-time/speed-time.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<PackageReadmeFile>README.md</PackageReadmeFile>
<ApplicationIcon>Icon.ico</ApplicationIcon>
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
<Version>0.14.1</Version>
<Version>0.14.2</Version>
<SignAssembly>True</SignAssembly>
<AssemblyOriginatorKeyFile></AssemblyOriginatorKeyFile>
</PropertyGroup>
Expand All @@ -44,7 +44,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="DSaladin.FancyPotato" Version="0.5.2" />
<PackageReference Include="DSaladin.FancyPotato" Version="0.5.4" />
<PackageReference Include="DSaladin.FontAwesome.WPF" Version="6.3.0" />
<PackageReference Include="GlobalHotKey" Version="1.1.0" />
<PackageReference Include="LiveChartsCore.SkiaSharpView.WPF" Version="2.0.0-rc1.2" />
Expand Down

0 comments on commit 644e0a8

Please sign in to comment.