-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
popup created and Register page started.
- Loading branch information
1 parent
6bff7ed
commit 1099faf
Showing
12 changed files
with
495 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
namespace MyFinance.Controls; | ||
|
||
public partial class GeneralPopup : DXPopup | ||
{ | ||
public GeneralPopup(string title, string desc, string okBtnTxt = "OK", PopupType pType = PopupType.Info, bool allowScrim = false) | ||
{ | ||
var color = pType == PopupType.Info ? SkyBlue : pType == PopupType.Warning ? DarkOrange : Red; | ||
|
||
this | ||
.AllowScrim(allowScrim) | ||
.AnimationDuration(new TimeSpan(0, 0, 0, 1)) | ||
.VerticalAlignment(PopupVerticalAlignment.Center) | ||
.HorizontalAlignment(PopupHorizontalAlignment.Center) | ||
.BackgroundColor(color) | ||
.Content( | ||
new Grid() | ||
.WidthRequest(250) | ||
.HeightRequest(150) | ||
.Padding(0) | ||
.Children( | ||
new Frame() | ||
.CornerRadius(25) | ||
.BackgroundColor(color) | ||
.BorderColor(color) | ||
.FillBothDirections() | ||
.Padding(0) | ||
.Content( | ||
new Grid() | ||
.RowDefinitions(e => e.Star(2).Star(7).Star(1)) | ||
.FillBothDirections() | ||
.Margin(10) | ||
.Padding(10) | ||
.Children( | ||
new Label() | ||
.Text(title) | ||
.FontAttributes(Bold) | ||
.FontSize(18) | ||
.TextColor(Black) | ||
.Center() | ||
.Row(0), | ||
|
||
new Label() | ||
.Text(desc) | ||
.FontAttributes(Italic) | ||
.LineBreakMode(WordWrap) | ||
.FontSize(12) | ||
.TextColor(Black) | ||
.Center() | ||
.Row(1), | ||
|
||
new Button() | ||
.Text(okBtnTxt) | ||
.TextColor(Black) | ||
.FontAttributes(Bold) | ||
.FontSize(15) | ||
.Row(2) | ||
.HeightRequest(30) | ||
.BackgroundColor(DeepSkyBlue) | ||
.CenterHorizontal() | ||
.Padding(0) | ||
.OnClicked((sender, e) => | ||
{ | ||
IsOpen = false; | ||
}) | ||
) | ||
) | ||
) | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
using DevExpress.CodeParser; | ||
|
||
namespace MyFinance.Controls; | ||
|
||
public partial class OperationPopup : DXPopup | ||
{ | ||
public static bool RESULT = false; | ||
public OperationPopup(string title, string desc, string okBtnTxt = "OK", string cancelBtnTxt = "Cancel", PopupType pType = PopupType.Info, bool allowScrim = false) | ||
{ | ||
var color = pType == PopupType.Info ? SkyBlue : pType == PopupType.Warning ? DarkOrange : Red; | ||
|
||
this | ||
.AllowScrim(allowScrim) | ||
.AnimationDuration(new TimeSpan(0, 0, 0, 1)) | ||
.VerticalAlignment(PopupVerticalAlignment.Center) | ||
.HorizontalAlignment(PopupHorizontalAlignment.Center) | ||
.BackgroundColor(color) | ||
.Content( | ||
new Grid() | ||
.WidthRequest(250) | ||
.HeightRequest(150) | ||
.Padding(0) | ||
.Children( | ||
new Frame() | ||
.CornerRadius(25) | ||
.BackgroundColor(color) | ||
.BorderColor(color) | ||
.FillBothDirections() | ||
.Padding(0) | ||
.Content( | ||
new Grid() | ||
.RowDefinitions(e => e.Star(2).Star(7).Star(1)) | ||
.FillBothDirections() | ||
.Margin(10) | ||
.Padding(10) | ||
.Children( | ||
new Label() | ||
.Text(title) | ||
.FontAttributes(Bold) | ||
.FontSize(18) | ||
.TextColor(Black) | ||
.Center() | ||
.Row(0), | ||
|
||
new Label() | ||
.Text(desc) | ||
.FontAttributes(Italic) | ||
.LineBreakMode(WordWrap) | ||
.FontSize(12) | ||
.TextColor(Black) | ||
.Center() | ||
.Row(1), | ||
|
||
new HorizontalStackLayout() | ||
.ColumnSpan(2) | ||
.Row(2) | ||
.Spacing(10) | ||
.CenterHorizontal() | ||
.Children( | ||
new Button() | ||
.Text(cancelBtnTxt) | ||
.FontAttributes(Bold) | ||
.FontSize(15) | ||
.WidthRequest(100) | ||
.IsVisible(pType == PopupType.Warning) | ||
.BackgroundColor(IndianRed) | ||
.Padding(0) | ||
.HeightRequest(27) | ||
.OnClicked((sender, e) => | ||
{ | ||
RESULT = false; | ||
IsOpen = false; | ||
}), | ||
|
||
new Button() | ||
.Text(okBtnTxt) | ||
.FontAttributes(Bold) | ||
.FontSize(15) | ||
.WidthRequest(100) | ||
.HeightRequest(25) | ||
.BackgroundColor(DeepSkyBlue) | ||
.AlignEnd() | ||
.Padding(0) | ||
.HeightRequest(27) | ||
.OnClicked((sender, e) => | ||
{ | ||
RESULT = true; | ||
IsOpen = false; | ||
}) | ||
) | ||
) | ||
) | ||
) | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace MyFinance.Enums; | ||
|
||
public enum PopupType | ||
{ | ||
Info, | ||
Warning, | ||
Error | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
using System.Windows.Input; | ||
|
||
namespace MyFinance.ViewModels; | ||
|
||
public partial class RegisterPageViewModel(IUserRepo repo) : BaseViewModel | ||
{ | ||
[ObservableProperty] | ||
private User userModel = new() | ||
{ | ||
Email = string.Empty, | ||
FirstName = string.Empty, | ||
LastName = string.Empty, | ||
Password = string.Empty | ||
}; | ||
|
||
[ObservableProperty] | ||
private bool isPopupShow = false; | ||
|
||
[ObservableProperty] | ||
private bool isUserAdded = false; | ||
|
||
public ICommand RegisterCommand => new Command(async () => | ||
{ | ||
if (UserModel == default!) | ||
return; | ||
UserModel.IsActive = true; | ||
var result = await repo.InsertAsync(UserModel); | ||
if (!result) | ||
{ | ||
IsUserAdded = false; | ||
IsPopupShow = true; | ||
} | ||
else | ||
{ | ||
IsUserAdded = true; | ||
IsPopupShow = true; | ||
await AppShell.Current.GoToAsync($"//{nameof(LoginPage)}"); | ||
} | ||
}); | ||
|
||
public ICommand GoToLoginCommand => new Command(async () => | ||
{ | ||
await AppShell.Current.GoToAsync($"//{nameof(LoginPage)}"); | ||
}); | ||
|
||
|
||
} |
Oops, something went wrong.