From cba9181a2de46b566e4e425afbbbdfc713ba1da0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Szab=C3=B3?= Date: Mon, 21 Apr 2025 19:16:58 +0200 Subject: [PATCH] =?UTF-8?q?Kis=20kerek=20gombok=20+=20Egy=C3=A9b=20nyal?= =?UTF-8?q?=C3=A1nks=C3=A1gok?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/WorkFlowCheck.MAUI/Helper/SystemHelper.cs | 34 +++++++++++++++- src/WorkFlowCheck.MAUI/MauiProgram.cs | 1 + .../Pages/CheckList/CheckListPage.xaml | 40 +++++++++++-------- .../Pages/CheckList/CheckListPage.xaml.cs | 22 ++++++++-- .../Pages/CheckList/CheckListWorkPage.xaml.cs | 3 +- .../Pages/Security/LoginPage.xaml | 1 + .../Resources/Images/arrow_clockwise.svg | 4 ++ .../Images/arrow_counterclockwise.svg | 4 ++ .../Resources/Images/arrow_down.svg | 3 ++ .../Resources/Images/arrow_left.svg | 3 ++ .../Resources/Images/arrow_right.svg | 3 ++ .../Resources/Images/arrow_up.svg | 3 ++ .../Resources/Images/check.svg | 4 ++ .../Resources/Images/check_circle.svg | 4 ++ .../Resources/Images/pencil_fill.svg | 3 ++ .../Resources/Images/save2.svg | 3 ++ .../Resources/Images/stop.svg | 3 ++ .../Services/CheckListService.cs | 4 +- 18 files changed, 118 insertions(+), 24 deletions(-) create mode 100644 src/WorkFlowCheck.MAUI/Resources/Images/arrow_clockwise.svg create mode 100644 src/WorkFlowCheck.MAUI/Resources/Images/arrow_counterclockwise.svg create mode 100644 src/WorkFlowCheck.MAUI/Resources/Images/arrow_down.svg create mode 100644 src/WorkFlowCheck.MAUI/Resources/Images/arrow_left.svg create mode 100644 src/WorkFlowCheck.MAUI/Resources/Images/arrow_right.svg create mode 100644 src/WorkFlowCheck.MAUI/Resources/Images/arrow_up.svg create mode 100644 src/WorkFlowCheck.MAUI/Resources/Images/check.svg create mode 100644 src/WorkFlowCheck.MAUI/Resources/Images/check_circle.svg create mode 100644 src/WorkFlowCheck.MAUI/Resources/Images/pencil_fill.svg create mode 100644 src/WorkFlowCheck.MAUI/Resources/Images/save2.svg create mode 100644 src/WorkFlowCheck.MAUI/Resources/Images/stop.svg diff --git a/src/WorkFlowCheck.MAUI/Helper/SystemHelper.cs b/src/WorkFlowCheck.MAUI/Helper/SystemHelper.cs index 957e5a2..d8cf74c 100644 --- a/src/WorkFlowCheck.MAUI/Helper/SystemHelper.cs +++ b/src/WorkFlowCheck.MAUI/Helper/SystemHelper.cs @@ -1,4 +1,6 @@ using Android.Util; +using CommunityToolkit.Maui.Alerts; +using CommunityToolkit.Maui.Core; using Microsoft.Extensions.Configuration; using System; using System.Collections.Generic; @@ -28,7 +30,7 @@ namespace WorkFlowCheck.MAUI.Helper { using (var httpClient = new HttpClient()) { - + httpClient.BaseAddress = new Uri(ApiBaseUrl); httpClient.DefaultRequestHeaders.Add("X-Api-Key", ApiKey); @@ -51,5 +53,35 @@ namespace WorkFlowCheck.MAUI.Helper } } } + public async static Task ShowSnackBar(string message, + string actionButtonTextColor = "#FF0000", + string backgroundColor = "#FF0000", + string textColor = "#FF0000", + int duration = 10, + string actionButtonText = "Ok", + Func action = null) + { + var visualOptions = new SnackbarOptions + { + ActionButtonTextColor = Colors.Yellow, + CornerRadius = new CornerRadius(10), + Font = Microsoft.Maui.Font.SystemFontOfSize(16), + BackgroundColor = Colors.Red, + TextColor = Colors.Yellow + + }; + var snackbar = Snackbar.Make( + message, + duration: TimeSpan.FromSeconds(duration), + action: async () => + { + if (action != null) + await action(); + }, + actionButtonText: actionButtonText, + visualOptions: visualOptions + ); + await snackbar.Show(); + } } } diff --git a/src/WorkFlowCheck.MAUI/MauiProgram.cs b/src/WorkFlowCheck.MAUI/MauiProgram.cs index f984473..87c562d 100644 --- a/src/WorkFlowCheck.MAUI/MauiProgram.cs +++ b/src/WorkFlowCheck.MAUI/MauiProgram.cs @@ -46,6 +46,7 @@ namespace WorkFlowCheck.MAUI fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold"); fonts.AddFont("FontAwesome.ttf", "FontAwesome"); }) + .UseMauiCommunityToolkitCore() .UseMauiCommunityToolkit(); #if DEBUG diff --git a/src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListPage.xaml b/src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListPage.xaml index 5369f0a..76e417e 100644 --- a/src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListPage.xaml +++ b/src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListPage.xaml @@ -51,7 +51,7 @@ - + @@ -62,20 +62,23 @@ - - - - @@ -174,6 +181,7 @@ + \ No newline at end of file diff --git a/src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListPage.xaml.cs b/src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListPage.xaml.cs index c2878aa..d4f83fd 100644 --- a/src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListPage.xaml.cs +++ b/src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListPage.xaml.cs @@ -1,5 +1,6 @@ using CommunityToolkit.Maui.Alerts; using CommunityToolkit.Maui.Core; +using Plugin.NFC; using System.Diagnostics; using System.Globalization; using System.Threading.Tasks; @@ -17,6 +18,7 @@ public partial class CheckListPage : ContentPage private readonly IUserService _userService; private readonly ISyncService _syncService; private bool _isLoading; + private bool _isNFCSupported; private UserDTO _currentUser; public ICommand NewCommand { get; set; } @@ -24,6 +26,7 @@ public partial class CheckListPage : ContentPage public ICommand UnblockCommand { get; set; } public ICommand BlockCommand { get; set; } public ICommand AcceptCommand { get; set; } + public bool IsLoading { get => _isLoading; @@ -33,7 +36,15 @@ public partial class CheckListPage : ContentPage OnPropertyChanged(nameof(IsLoading)); } } - + public bool IsNFCSupported + { + get => _isNFCSupported; + set + { + _isNFCSupported = value; + OnPropertyChanged(nameof(IsNFCSupported)); + } + } public CheckListPage() { @@ -46,7 +57,8 @@ public partial class CheckListPage : ContentPage UnblockCommand = new Command(OnUnblockItem); BlockCommand = new Command(OnBlockItem); AcceptCommand = new Command(OnAcceptItem); - + + } private void SetInfo() { @@ -62,8 +74,10 @@ public partial class CheckListPage : ContentPage protected override async void OnAppearing() { base.OnAppearing(); - SetInfo(); BindingContext = this; + //CrossNFC.Legacy = false; + //IsNFCSupported = CrossNFC.IsSupported; + SetInfo(); await LoadCheckListTemplate(); await LoadCheckList(); } @@ -233,7 +247,7 @@ public class ContinueConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { - if (value is CheckStatus status) + if (value is CheckStatus status && CrossNFC.IsSupported && CrossNFC.Current.IsAvailable) { if (status == CheckStatus.InProgress || status == CheckStatus.Open) { diff --git a/src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListWorkPage.xaml.cs b/src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListWorkPage.xaml.cs index 1efa9d7..f51c3b1 100644 --- a/src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListWorkPage.xaml.cs +++ b/src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListWorkPage.xaml.cs @@ -72,7 +72,8 @@ public partial class CheckListWorkPage : ContentPage { if (Navigation.ModalStack.Count > 0) { - await Shell.Current.Navigation.PopModalAsync(); + //await Navigation.PopModalAsync(); + await Shell.Current.GoToAsync("//CheckListPage"); } } else diff --git a/src/WorkFlowCheck.MAUI/Pages/Security/LoginPage.xaml b/src/WorkFlowCheck.MAUI/Pages/Security/LoginPage.xaml index 08bde29..a4e1228 100644 --- a/src/WorkFlowCheck.MAUI/Pages/Security/LoginPage.xaml +++ b/src/WorkFlowCheck.MAUI/Pages/Security/LoginPage.xaml @@ -62,6 +62,7 @@ HeightRequest="50" CornerRadius="10" TextColor="White" + ImageSource="check_circle.svg" Clicked="OnLoginClicked" />