Skip to content

Commit dcd5201

Browse files
authored
Merge pull request #16 from EnesEfeTokta/Develop
Develop
2 parents 17843c8 + b7b1b4f commit dcd5201

File tree

65 files changed

+2329
-930
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+2329
-930
lines changed

FinTrack/App.xaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<Application x:Class="FinTrackForWindows.App"
22
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
33
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4-
xmlns:local="clr-namespace:FinTrackForWindows">
4+
xmlns:local="clr-namespace:FinTrackForWindows"
5+
ShutdownMode="OnExplicitShutdown">
56
<Application.Resources>
67
<ResourceDictionary>
78
<ResourceDictionary.MergedDictionaries>

FinTrack/App.xaml.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,15 @@
33
using FinTrackForWindows.Services;
44
using FinTrackForWindows.Services.Accounts;
55
using FinTrackForWindows.Services.Api;
6+
using FinTrackForWindows.Services.AppInNotifications;
67
using FinTrackForWindows.Services.Budgets;
78
using FinTrackForWindows.Services.Camera;
89
using FinTrackForWindows.Services.Currencies;
910
using FinTrackForWindows.Services.Debts;
1011
using FinTrackForWindows.Services.Memberships;
12+
using FinTrackForWindows.Services.Reports;
1113
using FinTrackForWindows.Services.Transactions;
14+
using FinTrackForWindows.Services.Users;
1215
using FinTrackForWindows.ViewModels;
1316
using FinTrackForWindows.Views;
1417
using Microsoft.Extensions.DependencyInjection;
@@ -88,8 +91,12 @@ private void ConfigureServices(IServiceCollection services)
8891
services.AddSingleton<ICurrenciesStore, CurrenciesStore>();
8992
services.AddSingleton<IMembershipStore, MembershipStore>();
9093
services.AddSingleton<IDebtStore, DebtStore>();
94+
services.AddSingleton<IReportStore, ReportStore>();
95+
services.AddSingleton<IUserStore, UserStore>();
9196

9297
services.AddTransient<ICameraService, CameraService>();
98+
99+
services.AddSingleton<IAppInNotificationService, AppInNotificationService>();
93100
}
94101

95102
protected override async void OnStartup(StartupEventArgs e)
@@ -126,11 +133,17 @@ private void SetupGlobalExceptionHandling()
126133

127134
protected override async void OnExit(ExitEventArgs e)
128135
{
136+
var notificationService = _host.Services.GetService<IAppInNotificationService>();
137+
notificationService?.Dispose();
138+
129139
using (_host)
130140
{
131141
await _host.StopAsync(TimeSpan.FromSeconds(5));
142+
_host.Dispose();
132143
}
144+
133145
base.OnExit(e);
134146
}
147+
135148
}
136149
}

FinTrack/Dtos/BudgetDtos/BudgetCreateDto.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ public class BudgetCreateDto
88
public string? Description { get; set; }
99
public string Category { get; set; } = null!;
1010
public decimal AllocatedAmount { get; set; }
11+
public decimal? ReachedAmount { get; set; }
1112
public BaseCurrencyType Currency { get; set; }
1213
public DateTime StartDate { get; set; }
1314
public DateTime EndDate { get; set; }

FinTrack/Dtos/BudgetDtos/BudgetDto.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ public class BudgetDto
99
public string? Description { get; set; }
1010
public string Category { get; set; } = null!;
1111
public decimal AllocatedAmount { get; set; }
12+
public decimal? ReachedAmount { get; set; }
1213
public BaseCurrencyType Currency { get; set; }
1314
public DateTime StartDate { get; set; }
1415
public DateTime EndDate { get; set; }

FinTrack/Dtos/BudgetDtos/BudgetUpdateDto.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ public class BudgetUpdateDto
88
public string? Description { get; set; }
99
public string Category { get; set; } = null!;
1010
public decimal AllocatedAmount { get; set; }
11+
public decimal? ReachedAmount { get; set; }
1112
public BaseCurrencyType Currency { get; set; }
1213
public DateTime StartDate { get; set; }
1314
public DateTime EndDate { get; set; }
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
namespace FinTrackForWindows.Dtos.BudgetDtos
2+
{
3+
public class BudgetUpdateReachedAmountDto
4+
{
5+
public int BudgetId { get; set; }
6+
public decimal? ReachedAmount { get; set; }
7+
}
8+
}

FinTrack/Dtos/UserProfileDto.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ public class UserProfileDto
55
public int Id { get; set; }
66
public string UserName { get; set; } = string.Empty;
77
public string Email { get; set; } = string.Empty;
8-
public string ProfilePicture { get; set; } = string.Empty;
9-
public string Role { get; set; } = string.Empty;
8+
public string? ProfilePicture { get; set; }
109
public string MembershipType { get; set; } = string.Empty;
1110
}
1211
}

FinTrack/FinTrackForWindows.csproj

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,17 @@
88
<UseWPF>true</UseWPF>
99
</PropertyGroup>
1010

11+
<ItemGroup>
12+
<Compile Remove="Services\EmailService\**" />
13+
<Compile Remove="Services\NotificationTemplates\**" />
14+
<EmbeddedResource Remove="Services\EmailService\**" />
15+
<EmbeddedResource Remove="Services\NotificationTemplates\**" />
16+
<None Remove="Services\EmailService\**" />
17+
<None Remove="Services\NotificationTemplates\**" />
18+
<Page Remove="Services\EmailService\**" />
19+
<Page Remove="Services\NotificationTemplates\**" />
20+
</ItemGroup>
21+
1122
<ItemGroup>
1223
<None Remove="Assets\Images\chatbot.png" />
1324
<None Remove="Assets\Images\Icons\add.png" />
@@ -57,6 +68,7 @@
5768
<PackageReference Include="Microsoft.Extensions.Hosting" Version="10.0.0-preview.6.25358.103" />
5869
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.135" />
5970
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
71+
<PackageReference Include="Notifications.Wpf" Version="0.1.1" />
6072
<PackageReference Include="Npgsql" Version="9.0.3" />
6173
<PackageReference Include="ReactiveUI.WPF" Version="20.4.1" />
6274
<PackageReference Include="Serilog.Extensions.Hosting" Version="9.0.1-dev-02307" />
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
using System.Collections.Specialized;
2+
using System.Windows;
3+
using System.Windows.Controls;
4+
5+
namespace FinTrackForWindows.Helpers
6+
{
7+
public static class AutoScrollBehavior
8+
{
9+
public static readonly DependencyProperty AutoScrollProperty =
10+
DependencyProperty.RegisterAttached(
11+
"AutoScroll",
12+
typeof(bool),
13+
typeof(AutoScrollBehavior),
14+
new PropertyMetadata(false, OnAutoScrollPropertyChanged));
15+
16+
public static void SetAutoScroll(DependencyObject obj, bool value)
17+
{
18+
obj.SetValue(AutoScrollProperty, value);
19+
}
20+
21+
public static bool GetAutoScroll(DependencyObject obj)
22+
{
23+
return (bool)obj.GetValue(AutoScrollProperty);
24+
}
25+
26+
private static void OnAutoScrollPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
27+
{
28+
if (d is not ScrollViewer scrollViewer)
29+
{
30+
return;
31+
}
32+
33+
if ((bool)e.NewValue)
34+
{
35+
scrollViewer.ScrollToBottom();
36+
37+
if (FindItemsControl(scrollViewer) is { } itemsControl &&
38+
itemsControl.ItemsSource is INotifyCollectionChanged collection)
39+
{
40+
collection.CollectionChanged += (s, args) =>
41+
{
42+
if (args.Action == NotifyCollectionChangedAction.Add)
43+
{
44+
scrollViewer.ScrollToBottom();
45+
}
46+
};
47+
}
48+
}
49+
}
50+
51+
private static ItemsControl? FindItemsControl(DependencyObject parent)
52+
{
53+
if (parent == null) return null;
54+
55+
if (parent is ItemsControl itemsControl)
56+
{
57+
return itemsControl;
58+
}
59+
60+
if (parent is ContentPresenter contentPresenter)
61+
{
62+
if (contentPresenter.Content is ItemsControl ic)
63+
{
64+
return ic;
65+
}
66+
}
67+
68+
if (parent is Panel panel)
69+
{
70+
foreach (var child in panel.Children)
71+
{
72+
if (child is ItemsControl ic)
73+
{
74+
return ic;
75+
}
76+
}
77+
}
78+
79+
return null;
80+
}
81+
}
82+
}

0 commit comments

Comments
 (0)