Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve app usability #1081

Merged
merged 2 commits into from
Feb 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions docs/changelog.html
Original file line number Diff line number Diff line change
@@ -55,9 +55,14 @@ <h3>Added</h3>
<ul></ul>
</section>

<section id="unreleased_changed" hidden="hidden">
<section id="unreleased_changed">
<h3>Changed</h3>
<ul></ul>
<ul>
<li>
Preserve state from current run for each application view in
<a href="https://github.com/VMelnalksnis/Gnomeshade/pull/1081">#1081</a>
</li>
</ul>
</section>

<section id="unreleased_deprecated" hidden="hidden">
@@ -85,6 +90,10 @@ <h3>Fixed</h3>
Fixed desktop shortcut working directory in
<a href="https://github.com/VMelnalksnis/Gnomeshade/pull/1080">#1080</a>
</li>
<li>
Fixed loan list not refreshing after saving in
<a href="https://github.com/VMelnalksnis/Gnomeshade/pull/1081">#1081</a>
</li>
</ul>
</section>

44 changes: 22 additions & 22 deletions source/Gnomeshade.Avalonia.Core/ServiceCollectionExtensions.cs
Original file line number Diff line number Diff line change
@@ -25,26 +25,26 @@ public static class ServiceCollectionExtensions
/// <returns><paramref name="serviceCollection"/>.</returns>
public static IServiceCollection AddViewModels(this IServiceCollection serviceCollection) => serviceCollection
.AddSingleton<MainWindowViewModel>()
.AddTransient<ConfigurationWizardViewModel>()
.AddTransient<GnomeshadeConfigurationViewModel>()
.AddTransient<AuthenticationConfigurationViewModel>()
.AddTransient<UserConfigurationWriter>()
.AddTransient<LoginViewModel>()
.AddTransient<ApplicationSettingsViewModel>()
.AddTransient<CounterpartyMergeViewModel>()
.AddTransient<CategoryViewModel>()
.AddTransient<AccountViewModel>()
.AddTransient<CounterpartyViewModel>()
.AddTransient<ImportViewModel>()
.AddTransient<ProductViewModel>()
.AddTransient<UnitViewModel>()
.AddTransient<CategoryReportViewModel>()
.AddTransient<BalanceReportViewModel>()
.AddTransient<ProductReportViewModel>()
.AddTransient<PreferencesViewModel>()
.AddTransient<TransactionViewModel>()
.AddTransient<OwnerViewModel>()
.AddTransient<OwnerUpsertionViewModel>()
.AddTransient<AboutViewModel>()
.AddTransient<LicensesViewModel>();
.AddSingleton<ConfigurationWizardViewModel>()
.AddSingleton<GnomeshadeConfigurationViewModel>()
.AddSingleton<AuthenticationConfigurationViewModel>()
.AddSingleton<UserConfigurationWriter>()
.AddSingleton<LoginViewModel>()
.AddSingleton<ApplicationSettingsViewModel>()
.AddSingleton<CounterpartyMergeViewModel>()
.AddSingleton<CategoryViewModel>()
.AddSingleton<AccountViewModel>()
.AddSingleton<CounterpartyViewModel>()
.AddSingleton<ImportViewModel>()
.AddSingleton<ProductViewModel>()
.AddSingleton<UnitViewModel>()
.AddSingleton<CategoryReportViewModel>()
.AddSingleton<BalanceReportViewModel>()
.AddSingleton<ProductReportViewModel>()
.AddSingleton<PreferencesViewModel>()
.AddSingleton<TransactionViewModel>()
.AddSingleton<OwnerViewModel>()
.AddSingleton<OwnerUpsertionViewModel>()
.AddSingleton<AboutViewModel>()
.AddSingleton<LicensesViewModel>();
}
Original file line number Diff line number Diff line change
@@ -36,13 +36,19 @@ public LoanViewModel(IActivityService activityService, IGnomeshadeClient gnomesh
_details = new(activityService, gnomeshadeClient, transactionId, null);

PropertyChanged += OnPropertyChanged;
_details.Upserted += DetailsOnUpserted;
}

/// <inheritdoc />
public override LoanUpsertionViewModel Details
{
get => _details;
set => SetAndNotify(ref _details, value);
set
{
_details.Upserted -= DetailsOnUpserted;
SetAndNotify(ref _details, value);
_details.Upserted += DetailsOnUpserted;
}
}

/// <inheritdoc />
@@ -92,4 +98,9 @@ private void OnPropertyChanged(object? sender, PropertyChangedEventArgs e)
OnPropertyChanged(nameof(Total));
}
}

private async void DetailsOnUpserted(object? sender, UpsertedEventArgs e)
{
await RefreshAsync();
}
}