Skip to content

Commit 3d7cddc

Browse files
author
Mustafa Gonultas
committed
register page develop
1 parent 1099faf commit 3d7cddc

8 files changed

+85
-54
lines changed

MyFinance/AppShell.cs

+5
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ public AppShell(IServiceProvider serviceProvider)
1717
.ContentTemplate(() => serviceProvider.GetService<LoginPage>())
1818
.Route("LoginPage"),
1919

20+
new ShellContent()
21+
.Title("")
22+
.ContentTemplate(() => serviceProvider.GetService<RegisterPage>())
23+
.Route("RegisterPage"),
24+
2025
new ShellContent()
2126
.Title("")
2227
.ContentTemplate(() => serviceProvider.GetService<MainPage>())

MyFinance/Imports.cs

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
global using static Microsoft.Maui.Graphics.Colors;
3636
global using static Microsoft.Maui.TextDecorations;
3737
global using static Microsoft.Maui.LineBreakMode;
38+
global using static Microsoft.Maui.Keyboard;
3839

3940
global using MC = Microsoft.Maui.Controls;
4041
global using DC = DevExpress.Maui.Controls;

MyFinance/MauiProgram.cs

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public static MauiApp CreateMauiApp()
2828
.AddDbContext<MyFinanceContext>()
2929
.AddScopedWithShellRoute<MainPage, MainPageViewModel>($"//{nameof(MainPage)}")
3030
.AddScopedWithShellRoute<LoginPage, LoginPageViewModel>($"//{nameof(LoginPage)}")
31+
.AddScopedWithShellRoute<RegisterPage, RegisterPageViewModel>($"//{nameof(RegisterPage)}")
3132
.AddScoped<StartedPage>()
3233
.AddScoped<IUserRepo, UserRepo>();
3334

MyFinance/ViewModels/LoginPageViewModel.cs

+8
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,15 @@ public partial class LoginPageViewModel(IUserRepo repo) : BaseViewModel
3030
await SecureStorage.SetAsync("USERAUTH", auth);
3131
}
3232

33+
Login = new();
3334
await AppShell.Current.GoToAsync($"//{nameof(MainPage)}");
3435
}
36+
});
37+
38+
public ICommand GoToRegisterCommand => new Command(async () =>
39+
{
40+
IsPopupShow = false;
41+
Login = new();
42+
await AppShell.Current.GoToAsync($"//{nameof(RegisterPage)}");
3543
});
3644
}

MyFinance/ViewModels/RegisterPageViewModel.cs

+22-5
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ public partial class RegisterPageViewModel(IUserRepo repo) : BaseViewModel
1414
};
1515

1616
[ObservableProperty]
17-
private bool isPopupShow = false;
17+
private bool isInfoPopupShow = false;
18+
19+
[ObservableProperty]
20+
private bool isErrorPopupShow = false;
1821

1922
[ObservableProperty]
2023
private bool isUserAdded = false;
@@ -30,20 +33,34 @@ public partial class RegisterPageViewModel(IUserRepo repo) : BaseViewModel
3033
if (!result)
3134
{
3235
IsUserAdded = false;
33-
IsPopupShow = true;
36+
IsErrorPopupShow = true;
3437
}
3538
else
3639
{
3740
IsUserAdded = true;
38-
IsPopupShow = true;
41+
IsInfoPopupShow = true;
42+
await Task.Delay(3000);
43+
UserModel = new()
44+
{
45+
Email = string.Empty,
46+
FirstName = string.Empty,
47+
LastName = string.Empty,
48+
Password = string.Empty
49+
};
50+
IsInfoPopupShow = true;
3951
await AppShell.Current.GoToAsync($"//{nameof(LoginPage)}");
4052
}
4153
});
4254

4355
public ICommand GoToLoginCommand => new Command(async () =>
4456
{
57+
UserModel = new()
58+
{
59+
Email = string.Empty,
60+
FirstName = string.Empty,
61+
LastName = string.Empty,
62+
Password = string.Empty
63+
};
4564
await AppShell.Current.GoToAsync($"//{nameof(LoginPage)}");
4665
});
47-
48-
4966
}

MyFinance/Views/LoginPage.cs

+4
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,10 @@ public override void Build()
110110
.Text("Sign up")
111111
.TextColor(DeepSkyBlue)
112112
.TextDecorations(Underline)
113+
.GestureRecognizers(
114+
new TapGestureRecognizer()
115+
.Command(BindingContext.GoToRegisterCommand)
116+
)
113117
)
114118
),
115119

MyFinance/Views/RegisterPage.cs

+35-45
Original file line numberDiff line numberDiff line change
@@ -15,47 +15,50 @@ public override void Build()
1515
)
1616
.Content(
1717
new Grid()
18-
.RowDefinitions(e => e.Star(2.5).Star(4).Star(2).Star(1.5))
19-
.RowSpacing(15)
20-
.Margin(20, 15)
18+
.RowDefinitions(e => e.Star(1.2).Star(7.4).Star(1).Star(0.4))
19+
.Margin(20,10)
20+
.RowSpacing(5)
2121
.Children(
2222
(IView)new VerticalStackLayout()
23-
.Spacing(10)
23+
.Spacing(5)
2424
.Children(
2525
new HorizontalStackLayout()
2626
.CenterHorizontal()
2727
.Spacing(5)
28-
.Margin(0, 25, 0, 0)
28+
//.Margin(0, 25, 0, 0)
2929
.Children(
3030
new Label()
3131
.Text("My")
3232
.TextColor(DeepSkyBlue)
33-
.FontSize(44)
33+
.FontSize(25)
3434
.FontAttributes(Bold),
3535

3636
new Label()
3737
.Text("FINANCE")
3838
.TextColor(Black)
39-
.FontSize(44)
39+
.FontSize(25)
4040
.FontAttributes(Bold)
4141
),
4242

43-
new Label()
44-
.Text("Welcome to our app")
45-
.TextColor(Black)
46-
.FontSize(25)
47-
.FontAttributes(Bold)
48-
.Margin(0, 30, 0, 0),
43+
new VerticalStackLayout()
44+
.Spacing(3)
45+
.Children(
46+
new Label()
47+
.Text("Welcome to our app")
48+
.TextColor(Black)
49+
.FontSize(15)
50+
.FontAttributes(Bold),
4951

50-
new Label()
51-
.Text("Create a free account")
52-
.TextColor(Black)
53-
.FontSize(15)
54-
.FontAttributes(Italic)
52+
new Label()
53+
.Text("Create a free account")
54+
.TextColor(Black)
55+
.FontSize(12)
56+
.FontAttributes(Italic)
57+
)
5558
),
5659

5760
new VerticalStackLayout()
58-
.Spacing(15)
61+
.Spacing(5)
5962
.Row(1)
6063
.Children(
6164
new TextEdit()
@@ -80,12 +83,12 @@ public override void Build()
8083

8184
new TextEdit()
8285
.LabelText("Phone")
83-
.Keyboard(Keyboard.Telephone)
86+
.Keyboard(Telephone)
8487
.Text(e => e.Path("UserModel.PhoneNumber")),
8588

8689
new TextEdit()
8790
.LabelText("Age")
88-
.Keyboard(Keyboard.Numeric)
91+
.Keyboard(Numeric)
8992
.Text(e => e.Path("UserModel.Age")),
9093

9194
new ComboBoxEdit()
@@ -94,30 +97,12 @@ public override void Build()
9497
{
9598
"Male",
9699
"Female"
97-
}),
98-
99-
new Grid()
100-
.ColumnDefinitions(e => e.Star().Star())
101-
.FillHorizontal()
102-
.Children(
103-
new CheckEdit()
104-
.Label("Remember for 30 days")
105-
.AlignStart()
106-
.IsChecked(e => e.Path("UserModel.IsRememberMe")),
107-
108-
new Label()
109-
.Text("Forget password")
110-
.TextColor(DeepSkyBlue)
111-
.TextDecorations(Underline)
112-
.TextCenterVertical()
113-
.Column(1)
114-
.AlignEnd()
115-
)
100+
})
116101
),
117102

118103
new VerticalStackLayout()
119104
.Row(2)
120-
.Spacing(20)
105+
.Spacing(10)
121106
.Children(
122107
new Button()
123108
.Text("Sign up")
@@ -134,7 +119,7 @@ public override void Build()
134119
.Text("Already have an account? ")
135120
.TextColor(Black)
136121
.FontAttributes(Italic)
137-
.FontSize(16),
122+
.FontSize(14),
138123

139124
new Label()
140125
.Text("Sign in")
@@ -149,7 +134,8 @@ public override void Build()
149134

150135
new HorizontalStackLayout()
151136
.Row(3)
152-
.Center()
137+
.CenterHorizontal()
138+
.AlignBottom()
153139
.Spacing(5)
154140
.Children(
155141
new Label()
@@ -165,9 +151,13 @@ public override void Build()
165151
.FontSize(18)
166152
),
167153

168-
new GeneralPopup("HATA", "Kullanıcı Adı veya Şifre Hatalı!!! ", "OK", PopupType.Error)
154+
new GeneralPopup("BİLGİ", "Kullanıcı Başarılı Şekilde Eklendi. ", "OK", PopupType.Info)
155+
.RowSpan(4)
156+
.IsOpen(e => e.Path("IsInfoPopupShow")),
157+
158+
new GeneralPopup("HATA", "İşlem sırasında beklenmeyen bir hata oluştu! ", "OK", PopupType.Error)
169159
.RowSpan(4)
170-
.IsOpen(e => e.Path("IsPopupShow"))
160+
.IsOpen(e => e.Path("IsErrorPopupShow"))
171161
)
172162
);
173163
}

MyFinance/Views/StartedPage.cs

+9-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,13 @@ public partial class StartedPage() : BasePage("Get Started")
44
{
55
public override void Build()
66
{
7-
bool skipStartedPage = true;
7+
bool skipStartedPage;
8+
var isStarted = SecureStorage.GetAsync("IsStarted").GetAwaiter().GetResult();
9+
if (!string.IsNullOrEmpty(isStarted) && bool.TryParse(isStarted, out skipStartedPage) && !skipStartedPage)
10+
skipStartedPage = true;
11+
else
12+
skipStartedPage = false;
13+
814
this
915
.ShellNavBarIsVisible(false)
1016
.Behaviors(
@@ -13,8 +19,7 @@ public override void Build()
1319
)
1420
.OnLoaded(async (sender, e) =>
1521
{
16-
var isStarted = await SecureStorage.GetAsync("IsStarted");
17-
if (!string.IsNullOrEmpty(isStarted) && bool.TryParse(isStarted, out skipStartedPage) && skipStartedPage)
22+
if (skipStartedPage)
1823
{
1924
if (await CheckLogin())
2025
await AppShell.Current.GoToAsync("//MainPage", true);
@@ -87,7 +92,7 @@ public override void Build()
8792
.Row(3)
8893
.OnClicked(async (sender,arg) =>
8994
{
90-
await SecureStorage.SetAsync("IsStarted", "true");
95+
await SecureStorage.SetAsync("IsStarted", "false");
9196
await AppShell.Current.GoToAsync("//LoginPage", true);
9297
})
9398
)

0 commit comments

Comments
 (0)