Skip to content

Commit

Permalink
Merge pull request #39 from DSaladinCH/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
DominicSaladin authored Mar 9, 2024
2 parents e35c85e + e440fd0 commit 76ad84c
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
15 changes: 13 additions & 2 deletions speed-time/Dialogs/TrackTimeEditor.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public double SuggestionsHeight
if (!IsSuggestionsOpen)
return 0;

if (TrackedTimesViewSource.View is null || string.IsNullOrEmpty(TrackTimeTitle) || TrackedTimesViewSource.View.Cast<object>().Count() == 0)
if (TrackedTimesViewSource.View is null || string.IsNullOrEmpty(TrackTimeTitle) || !TrackedTimesViewSource.View.Cast<object>().Any())
return 0;

return 165;
Expand Down Expand Up @@ -116,6 +116,13 @@ public TrackTimeEditor(TrackTime? trackTime = null)
TrackedTimesViewSource = new();
TrackedTimesViewSource.SetCurrentValue(CollectionViewSource.SourceProperty,
(await App.dbContext.TrackedTimes.OrderByDescending(t => t.Id).AsNoTracking()
.GroupBy(t => t.Title)
.Select(group => new
{
Title = group.Key,
Id = group.Max(t => t.Id)
})
.OrderByDescending(t => t.Id)
.Take(SettingsModel.Instance.SearchNumberOfItems).ToListAsync())
.Select(t => new TitleMatch() { Title = t.Title }));

Expand All @@ -131,7 +138,7 @@ public TrackTimeEditor(TrackTime? trackTime = null)
IsSuggestionsOpen = false;
NotifyPropertyChanged(nameof(SuggestionsHeight));

if (TrackedTimesViewSource.View.Cast<object>().Count() == 0)
if (!TrackedTimesViewSource.View.Cast<object>().Any())
{
TitleMoveNext();
return;
Expand Down Expand Up @@ -187,8 +194,12 @@ public TrackTimeEditor(DateTime startDate) : this()

private void TitleMoveNext()
{
refreshCancellationToken.Cancel();
refreshCancellationToken = new();

TraversalRequest request = new(FocusNavigationDirection.Next) { Wrapped = true };
tbx_title.MoveFocus(request);

}

private void Title_LostFocus(object sender, RoutedEventArgs e)
Expand Down
9 changes: 8 additions & 1 deletion speed-time/ViewModel/QuickTimeTrackerViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public QuickTimeTrackerViewModel(TrackTime? lastTrackTime)

TabButtonCommand = new((_) =>
{
if (TrackedTimesViewSource.View.Cast<object>().Count() == 0)
if (!TrackedTimesViewSource.View.Cast<object>().Any())
return;

WorkTitle = TrackedTimesViewSource.View.Cast<TitleMatch>().ElementAt(SuggestionSelectedIndex).Title;
Expand Down Expand Up @@ -155,6 +155,13 @@ public override async void WindowLoaded(object sender, RoutedEventArgs eventArgs
TrackedTimesViewSource = new();
TrackedTimesViewSource.SetCurrentValue(CollectionViewSource.SourceProperty,
(await App.dbContext.TrackedTimes.OrderByDescending(t => t.Id).AsNoTracking()
.GroupBy(t => t.Title)
.Select(group => new
{
Title = group.Key,
Id = group.Max(t => t.Id)
})
.OrderByDescending(t => t.Id)
.Take(SettingsModel.Instance.SearchNumberOfItems).ToListAsync())
.Select(t => new TitleMatch() { Title = t.Title }));

Expand Down
2 changes: 1 addition & 1 deletion 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.17</Version>
<Version>0.17.1</Version>
<SignAssembly>True</SignAssembly>
<AssemblyOriginatorKeyFile></AssemblyOriginatorKeyFile>
</PropertyGroup>
Expand Down

0 comments on commit 76ad84c

Please sign in to comment.