Skip to content

Commit 6b632bd

Browse files
committed
tabbar added, pages added. chart added.
1 parent 30a38af commit 6b632bd

22 files changed

+268
-29
lines changed

MyFinance/App.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ public partial class App : MC.Application
55
public App(IServiceProvider services)
66
{
77
this
8-
.Resources(AppStyles.Default)
9-
.MainPage(services.GetService<AppShell>());
8+
.Resources(AppStyles.Default)
9+
.MainPage(services.GetService<AppShell>());
1010
}
1111
}

MyFinance/AppShell.cs

+37-5
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,44 @@ public partial class AppShell : Shell
55
public AppShell(IServiceProvider serviceProvider)
66
{
77
this
8+
.Behaviors(
9+
new StatusBarBehavior()
10+
.StatusBarColor(DeepSkyBlue)
11+
)
812
.FlyoutBehavior(FlyoutBehavior.Disabled)
913
.Items(
14+
15+
new TabBar()
16+
.Items(
17+
new Tab()
18+
.Title("Anasayfa")
19+
.Items(serviceProvider.GetService<MainPage>())
20+
.Route(nameof(MainPage))
21+
.FlyoutDisplayOptions(FlyoutDisplayOptions.AsSingleItem)
22+
.Icon("home.png"),
23+
24+
new Tab()
25+
.Title("İstatistik")
26+
.Items(serviceProvider.GetService<ChartPage>())
27+
.Route(nameof(AccountPage))
28+
.FlyoutDisplayOptions(FlyoutDisplayOptions.AsSingleItem)
29+
.Icon("chart.png"),
30+
31+
new Tab()
32+
.Title("İşlemler")
33+
.Items(serviceProvider.GetService<ItemsPage>())
34+
.Route(nameof(ItemsPage))
35+
.FlyoutDisplayOptions(FlyoutDisplayOptions.AsSingleItem)
36+
.Icon("adjust.png"),
37+
38+
new Tab()
39+
.Title("Profil")
40+
.Items(serviceProvider.GetService<AccountPage>())
41+
.Route(nameof(AccountPage))
42+
.FlyoutDisplayOptions(FlyoutDisplayOptions.AsSingleItem)
43+
.Icon("user.png")
44+
),
45+
1046
new ShellContent()
1147
.Title("")
1248
.ContentTemplate(() => new StartedPage())
@@ -20,12 +56,8 @@ public AppShell(IServiceProvider serviceProvider)
2056
new ShellContent()
2157
.Title("")
2258
.ContentTemplate(() => serviceProvider.GetService<RegisterPage>())
23-
.Route("RegisterPage"),
59+
.Route("RegisterPage")
2460

25-
new ShellContent()
26-
.Title("")
27-
.ContentTemplate(() => serviceProvider.GetService<MainPage>())
28-
.Route("MainPage")
2961
);
3062
}
3163
}

MyFinance/Imports.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,14 @@
2121
global using MyFinance.Repository;
2222
global using MyFinance.DTOs;
2323
global using MyFinance.Controls;
24+
global using MyFinance.VMs;
2425

2526
global using Microsoft.EntityFrameworkCore;
2627

2728

2829
global using DevExpress.Maui.Controls;
2930
global using DevExpress.Maui.Editors;
30-
global using DevExpress.Maui.DataForm;
31+
global using DevExpress.Maui.Charts;
3132
global using DevExpress.Maui.CollectionView;
3233
global using DevExpress.Maui.Core;
3334
global using DevExpress.Maui;

MyFinance/MauiProgram.cs

+7-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ namespace MyFinance;
77
[MauiMarkup(typeof(StatusBarBehavior), typeof(TextEdit), typeof(TextEditBase), typeof(EditBase), typeof(ComboBoxEdit))]
88
[MauiMarkup(typeof(PasswordEdit), typeof(CheckEdit), typeof(DXPopup), typeof(ComboBoxEditBase), typeof(ItemsEditBase))]
99
[MauiMarkup(typeof(DXImage), typeof(DXButton), typeof(DXViewBase), typeof(DXBorder), typeof(DXContentPresenterBase))]
10-
[MauiMarkup(typeof(DXContentPresenter), typeof(DXCollectionView))]
10+
[MauiMarkup(typeof(DXContentPresenter), typeof(DXCollectionView), typeof(ChartView), typeof(SeriesCrosshairOptions), typeof(SeriesHintOptions))]
11+
[MauiMarkup(typeof(SeriesHintOptionsBase), typeof(ChartElement), typeof(LineSeries), typeof(ChartSeriesElement), typeof(XYSeries))]
12+
[MauiMarkup(typeof(Series), typeof(SeriesBase), typeof(ChartSeriesElement), typeof(SeriesDataAdapter), typeof(DataSourceAdapterBase))]
13+
[MauiMarkup(typeof(ValueDataMember))]
1114
public static class MauiProgram
1215
{
1316
public static MauiApp CreateMauiApp()
@@ -30,6 +33,9 @@ public static MauiApp CreateMauiApp()
3033
.AddSingleton<AppShell>()
3134
.AddDbContext<MyFinanceContext>()
3235
.AddScopedWithShellRoute<MainPage, MainPageViewModel>($"//{nameof(MainPage)}")
36+
.AddScopedWithShellRoute<ChartPage, ChartPageViewModel>($"//{nameof(ChartPage)}")
37+
.AddScopedWithShellRoute<ItemsPage, ItemsPageViewModel>($"//{nameof(ItemsPage)}")
38+
.AddScopedWithShellRoute<AccountPage, AccountPageViewModel>($"//{nameof(AccountPage)}")
3339
.AddScopedWithShellRoute<LoginPage, LoginPageViewModel>($"//{nameof(LoginPage)}")
3440
.AddScopedWithShellRoute<RegisterPage, RegisterPageViewModel>($"//{nameof(RegisterPage)}")
3541
.AddScoped<StartedPage>()

MyFinance/MyFinance.csproj

+7-1
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,25 @@
4848
</ItemGroup>
4949

5050
<ItemGroup>
51+
<None Remove="Resources\Images\adjust.png" />
52+
<None Remove="Resources\Images\chart.png" />
5153
<None Remove="Resources\Images\down_arrow.png" />
54+
<None Remove="Resources\Images\filter.png" />
5255
<None Remove="Resources\Images\getstarted.png" />
56+
<None Remove="Resources\Images\home.png" />
5357
<None Remove="Resources\Images\loss.png" />
5458
<None Remove="Resources\Images\profits.png" />
5559
<None Remove="Resources\Images\up_arrow.png" />
60+
<None Remove="Resources\Images\user.png" />
5661
</ItemGroup>
5762

5863
<ItemGroup>
5964
<PackageReference Include="CommunityToolkit.Maui" Version="9.0.0" />
6065
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
66+
<PackageReference Include="DevExpress.Maui.Charts" Version="24.1.1-alpha-24085" />
6167
<PackageReference Include="DevExpress.Maui.Controls" Version="24.1.1-alpha-24085" />
6268
<PackageReference Include="DevExpress.Maui.Editors" Version="24.1.1-alpha-24085" />
63-
<PackageReference Include="FmgLib.MauiMarkup" Version="8.2.3-prev1.0.0" />
69+
<PackageReference Include="FmgLib.MauiMarkup" Version="8.2.3-prev1.0.1" />
6470
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.4" />
6571
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.21" />
6672
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.21" />

MyFinance/Resources/Images/adjust.png

11.7 KB
Loading

MyFinance/Resources/Images/chart.png

20.3 KB
Loading

MyFinance/Resources/Images/filter.png

7.68 KB
Loading

MyFinance/Resources/Images/home.png

5.79 KB
Loading

MyFinance/Resources/Images/user.png

16.4 KB
Loading

MyFinance/Resources/Styles/AppColors.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{
33
public class AppColors
44
{
5-
public static readonly Color Primary = Color.FromArgb("512BD4");
5+
public static readonly Color Primary = DeepSkyBlue;
66
public static readonly Color Secondary = Color.FromArgb("DFD8F7");
77
public static readonly Color Tertiary = Color.FromArgb("2B0B98");
88

MyFinance/Resources/Styles/AppStyles.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -351,10 +351,10 @@ public class AppStyles
351351
.ShellTitleColor(e => e.OnLight(Colors.White).OnDark(Colors.White))
352352
.ShellDisabledColor(e => e.OnLight(AppColors.Gray200).OnDark(AppColors.Gray950))
353353
.ShellUnselectedColor(e => e.OnLight(AppColors.Gray200).OnDark(AppColors.Gray200))
354-
.ShellTabBarBackgroundColor(e => e.OnLight(Colors.White).OnDark(Colors.Black))
355-
.ShellTabBarForegroundColor(e => e.OnLight(AppColors.Primary).OnDark(Colors.White))
356-
.ShellTabBarTitleColor(e => e.OnLight(AppColors.Primary).OnDark(Colors.White))
357-
.ShellTabBarUnselectedColor(e => e.OnLight(AppColors.Gray900).OnDark(AppColors.Gray200))),
354+
.ShellTabBarBackgroundColor(White)
355+
.ShellTabBarForegroundColor(Black)
356+
.ShellTabBarTitleColor(DeepSkyBlue)
357+
.ShellTabBarUnselectedColor(AppColors.Gray900)),
358358

359359
// "NavigationPage"
360360

MyFinance/VMs/OperatonItemsVM.cs

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
namespace MyFinance.VMs;
2+
3+
public class OperatonItemsVM
4+
{
5+
public Guid Id { get; set; }
6+
public string Icon { get; set; }
7+
public string Title { get; set; }
8+
public string Description { get; set; }
9+
public string Date { get; set; }
10+
public string Amount { get; set; }
11+
public Color Color { get; set; }
12+
}

MyFinance/VMs/UserCardVM.cs

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
namespace MyFinance.VMs;
2+
3+
public class UserCardVM
4+
{
5+
public string Name { get; set; }
6+
public string Email { get; set; }
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
namespace MyFinance.ViewModels;
2+
3+
public partial class AccountPageViewModel : BaseViewModel
4+
{
5+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
namespace MyFinance.ViewModels;
2+
3+
public partial class ChartPageViewModel : BaseViewModel
4+
{
5+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
namespace MyFinance.ViewModels;
2+
3+
public partial class ItemsPageViewModel : BaseViewModel
4+
{
5+
}

MyFinance/ViewModels/MainPageViewModel.cs

+49
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,53 @@
22

33
public partial class MainPageViewModel : BaseViewModel
44
{
5+
[ObservableProperty]
6+
private List<OperatonItemsVM> items = new();
7+
8+
[ObservableProperty]
9+
private string totalBalance;
10+
11+
[ObservableProperty]
12+
private string totalIncome;
13+
14+
[ObservableProperty]
15+
private string totalExpense;
16+
17+
[ObservableProperty]
18+
private UserCardVM user = new();
19+
20+
public MainPageViewModel(IUserRepo userRepo)
21+
{
22+
var accessUser = AuthCheckHelper.ParseBasicAuthToken(SecureStorage.GetAsync("USERAUTH").Result);
23+
var currentUser = userRepo.GetSingleAsync(e => e.Email == accessUser.Item1 && e.Password == accessUser.Item2).Result;
24+
if (currentUser == null)
25+
currentUser = default;
26+
27+
TotalBalance = "25,291.50 ₺";
28+
TotalExpense = "2,367.82 ₺";
29+
TotalIncome = "167.82 ₺";
30+
User = new()
31+
{
32+
Name = $"{currentUser?.FirstName} {currentUser?.LastName}",
33+
Email = currentUser?.Email ?? string.Empty
34+
};
35+
Random random = new Random();
36+
for (int i = 1; i <= 10; i++)
37+
{
38+
var amount = random.Next(1,10000);
39+
Items.Add(
40+
new OperatonItemsVM
41+
{
42+
Id = Guid.NewGuid(),
43+
Icon = amount % 2 == 0 ? "loss.png" : "profits.png",
44+
Color = amount % 2 == 0 ? Red : Green,
45+
Date = DateTime.Now.AddDays(-(amount % 20)).ToString("dd.MM.yyyy HH:mm"),
46+
Title = amount % 2 == 0 ? "Borç ödendi" : "Ödeme Alındı",
47+
Description = amount % 2 == 0 ? "Ödemeler yapıldı" : "Yaka parası alındı.",
48+
Amount = $"{amount} ₺"
49+
}
50+
);
51+
}
52+
Items = Items.OrderByDescending(e => DateTime.Parse(e.Date)).ToList();
53+
}
554
}

MyFinance/Views/AccountPage.cs

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
namespace MyFinance.Views;
2+
3+
public partial class AccountPage(AccountPageViewModel viewModel) : BasePage<AccountPageViewModel>(viewModel, "Account Page")
4+
{
5+
public override void Build()
6+
{
7+
this
8+
.Content(
9+
new Label()
10+
.Text("AccountPage")
11+
.Center()
12+
);
13+
}
14+
}

MyFinance/Views/ChartPage.cs

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
namespace MyFinance.Views;
2+
3+
public partial class ChartPage(ChartPageViewModel viewModel) : BasePage<ChartPageViewModel>(viewModel, "Chart Page")
4+
{
5+
public override void Build()
6+
{
7+
this
8+
.Resources(
9+
ResourceDictionaryExtension
10+
.Add(new ResourceDictionary(), "lineSeriesHintOptions", new Style<SeriesCrosshairOptions>(e => e
11+
.PointTextPattern("{}{S}: {V}M")
12+
.ShowInLabel(true)
13+
.AxisLabelVisible(true)
14+
.AxisLineVisible(true)
15+
)
16+
)
17+
)
18+
.Content(
19+
new ChartView()
20+
.Series(
21+
[
22+
new LineSeries()
23+
.DisplayName("deneme")
24+
.Data(
25+
new SeriesDataAdapter()
26+
.ArgumentDataMember("Year")
27+
.DataSource(e => e.Path(""))
28+
29+
)
30+
]
31+
)
32+
);
33+
}
34+
}

MyFinance/Views/ItemsPage.cs

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace MyFinance.Views;
8+
9+
public partial class ItemsPage(ItemsPageViewModel viewModel) : BasePage<ItemsPageViewModel>(viewModel, "Items Page")
10+
{
11+
public override void Build()
12+
{
13+
this
14+
.Content(
15+
new Label()
16+
.Text("ItemsPage")
17+
.Center()
18+
);
19+
}
20+
}

0 commit comments

Comments
 (0)