-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from DevElkami/Dev
Licence update
- Loading branch information
Showing
22 changed files
with
455 additions
and
134 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
This is free and unencumbered software released into the public domain. | ||
|
||
Anyone is free to copy, modify, publish, use, compile, sell, or | ||
distribute this software, either in source code form or as a compiled | ||
binary, for any purpose, commercial or non-commercial, and by any | ||
means. | ||
|
||
In jurisdictions that recognize copyright laws, the author or authors | ||
of this software dedicate any and all copyright interest in the | ||
software to the public domain. We make this dedication for the benefit | ||
of the public at large and to the detriment of our heirs and | ||
successors. We intend this dedication to be an overt act of | ||
relinquishment in perpetuity of all present and future rights to this | ||
software under copyright law. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
OTHER DEALINGS IN THE SOFTWARE. | ||
|
||
For more information, please refer to <https://unlicense.org> |
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 |
---|---|---|
@@ -1,12 +1,17 @@ | ||
namespace MauiPasswordVault | ||
using MauiPasswordVault.View; | ||
|
||
namespace MauiPasswordVault | ||
{ | ||
public partial class App : Application | ||
{ | ||
public App() | ||
public App(SearchPage searchPage) | ||
{ | ||
if (Application.Current != null) | ||
Application.Current.UserAppTheme = AppTheme.Dark; | ||
|
||
InitializeComponent(); | ||
|
||
MainPage = new AppShell(); | ||
MainPage = new NavigationPage(searchPage); | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,8 @@ | ||
namespace MauiPasswordVault.Service; | ||
|
||
public class ErrorService | ||
{ | ||
public String LastErrorMessage { get; set; } = null!; | ||
public String LastErrorFull { get; set; } = null!; | ||
public bool CriticalError { get; set; } = 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,49 @@ | ||
using System.Diagnostics; | ||
|
||
namespace MauiPasswordVault.Service; | ||
|
||
public class NavigationService | ||
{ | ||
readonly IServiceProvider services; | ||
|
||
public NavigationService(IServiceProvider services) | ||
{ | ||
this.services = services; | ||
} | ||
|
||
public Task NavigateToPage<T>() where T : Page | ||
{ | ||
var page = ResolvePage<T>(); | ||
if (page is not null) | ||
return Navigation.PushAsync(page, true); | ||
throw new InvalidOperationException($"Unable to resolve type {typeof(T).FullName}"); | ||
} | ||
|
||
public Task NavigateBack() | ||
{ | ||
if (Navigation.NavigationStack.Count > 1) | ||
return Navigation.PopAsync(); | ||
throw new InvalidOperationException("No pages to navigate back to!"); | ||
} | ||
|
||
protected INavigation Navigation | ||
{ | ||
get | ||
{ | ||
INavigation? navigation = Application.Current?.MainPage?.Navigation; | ||
if (navigation is not null) | ||
return navigation; | ||
else | ||
{ | ||
if (Debugger.IsAttached) | ||
Debugger.Break(); | ||
throw new Exception("Can't get navigation."); | ||
} | ||
} | ||
} | ||
|
||
private T? ResolvePage<T>() where T : Page | ||
{ | ||
return services.GetService<T>(); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,18 +1,34 @@ | ||
using MauiPasswordVault.Service; | ||
using MauiPasswordVault.ViewModel; | ||
|
||
namespace MauiPasswordVault.View; | ||
|
||
public partial class CheckPage : ContentPage | ||
{ | ||
public CheckPage(CheckViewModel checkViewModel) | ||
private readonly NavigationService navigationService; | ||
private readonly ErrorService errorService; | ||
|
||
public CheckPage(NavigationService navigationService, ErrorService errorService, CheckViewModel checkViewModel) | ||
{ | ||
this.navigationService = navigationService; | ||
this.errorService = errorService; | ||
BindingContext = checkViewModel; | ||
InitializeComponent(); | ||
} | ||
|
||
protected async override void OnAppearing() | ||
{ | ||
if (!((CheckViewModel)BindingContext).IsInitialized()) | ||
await Shell.Current.GoToAsync(nameof(InitPage)); | ||
try | ||
{ | ||
if (!((CheckViewModel)BindingContext).IsInitialized()) | ||
await navigationService.NavigateToPage<InitPage>(); | ||
} | ||
catch (Exception exception) | ||
{ | ||
this.errorService.LastErrorMessage = exception.Message; | ||
this.errorService.LastErrorFull = exception.ToString(); | ||
this.errorService.CriticalError = true; | ||
await this.navigationService.NavigateToPage<ErrorPage>(); | ||
} | ||
} | ||
} |
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,24 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
x:Class="MauiPasswordVault.View.ErrorPage" | ||
Title="ErrorPage"> | ||
<VerticalStackLayout> | ||
<Label | ||
Text="Error page" | ||
VerticalOptions="Center" | ||
HorizontalOptions="Center" /> | ||
|
||
<Label | ||
Text="{Binding LastErrorMessage}" | ||
SemanticProperties.HeadingLevel="Level1" | ||
FontSize="32" | ||
HorizontalOptions="Center" /> | ||
|
||
<Button | ||
Text="Click me" | ||
SemanticProperties.Hint="Error page" | ||
Command="{Binding AcceptCommand}" | ||
HorizontalOptions="Center" /> | ||
</VerticalStackLayout> | ||
</ContentPage> |
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,12 @@ | ||
using MauiPasswordVault.ViewModel; | ||
|
||
namespace MauiPasswordVault.View; | ||
|
||
public partial class ErrorPage : ContentPage | ||
{ | ||
public ErrorPage(ErrorViewModel errorViewModel) | ||
{ | ||
BindingContext = errorViewModel; | ||
InitializeComponent(); | ||
} | ||
} |
Oops, something went wrong.