INIT GITEA

This commit is contained in:
2026-09-12 18:19:29 +02:00
parent b2faeb2986
commit 02ba8d4fe5
405 changed files with 125279 additions and 125267 deletions
+62 -62
View File
@@ -1,62 +1,62 @@
using SkiaSharp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.MAUI.Helper
{
public static class ImageHelper
{
public static string ResizeAndSaveImage(byte[] imageBytes, int id, int targetWidth = 50)
{
// Átméretezett fájl elérési útja
var filename = Path.Combine(FileSystem.CacheDirectory, $"wfc_{id}_photo.jpg");
if (File.Exists(filename))
{
try
{
File.Delete(filename);
// opcionálisan logolhatsz
// Console.WriteLine($"Törölve: {filename}");
}
catch (Exception ex)
{
//Console.WriteLine($"Hiba a fájl törlésekor: {ex.Message}");
}
}
// Eredeti kép betöltése
using var inputStream = new MemoryStream(imageBytes);
using var original = SKBitmap.Decode(inputStream);
if (original == null)
throw new InvalidOperationException("A kép nem olvasható vagy hibás.");
// Új szélesség és magasság arányosan
int targetHeight = (int)(original.Height * ((double)targetWidth / original.Width));
// Új üres bitmap létrehozása
using var resizedSurface = SKSurface.Create(new SKImageInfo(targetWidth, targetHeight));
using var canvas = resizedSurface.Canvas;
canvas.Clear(SKColors.White); // választható háttérszín
var srcRect = new SKRect(0, 0, original.Width, original.Height);
var destRect = new SKRect(0, 0, targetWidth, targetHeight);
canvas.DrawBitmap(original, srcRect, destRect);
using var resizedImage = resizedSurface.Snapshot();
using var imageData = resizedImage.Encode(SKEncodedImageFormat.Jpeg, 90);
// Mentés fájlba
using var fileStream = File.OpenWrite(filename);
imageData.SaveTo(fileStream);
return filename;
}
}
}
using SkiaSharp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.MAUI.Helper
{
public static class ImageHelper
{
public static string ResizeAndSaveImage(byte[] imageBytes, int id, int targetWidth = 50)
{
// Átméretezett fájl elérési útja
var filename = Path.Combine(FileSystem.CacheDirectory, $"wfc_{id}_photo.jpg");
if (File.Exists(filename))
{
try
{
File.Delete(filename);
// opcionálisan logolhatsz
// Console.WriteLine($"Törölve: {filename}");
}
catch (Exception ex)
{
//Console.WriteLine($"Hiba a fájl törlésekor: {ex.Message}");
}
}
// Eredeti kép betöltése
using var inputStream = new MemoryStream(imageBytes);
using var original = SKBitmap.Decode(inputStream);
if (original == null)
throw new InvalidOperationException("A kép nem olvasható vagy hibás.");
// Új szélesség és magasság arányosan
int targetHeight = (int)(original.Height * ((double)targetWidth / original.Width));
// Új üres bitmap létrehozása
using var resizedSurface = SKSurface.Create(new SKImageInfo(targetWidth, targetHeight));
using var canvas = resizedSurface.Canvas;
canvas.Clear(SKColors.White); // választható háttérszín
var srcRect = new SKRect(0, 0, original.Width, original.Height);
var destRect = new SKRect(0, 0, targetWidth, targetHeight);
canvas.DrawBitmap(original, srcRect, destRect);
using var resizedImage = resizedSurface.Snapshot();
using var imageData = resizedImage.Encode(SKEncodedImageFormat.Jpeg, 90);
// Mentés fájlba
using var fileStream = File.OpenWrite(filename);
imageData.SaveTo(fileStream);
return filename;
}
}
}
+101 -101
View File
@@ -1,101 +1,101 @@
using Android.Util;
using CommunityToolkit.Maui.Alerts;
using CommunityToolkit.Maui.Core;
using DevExpress.Maui.Core.Internal;
using Microsoft.Extensions.Configuration;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http.Json;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using WorkFlowCheck.Common.DTO;
namespace WorkFlowCheck.MAUI.Helper
{
public static class SystemHelper
{
public static string DatabaseName = "";
public static bool Syncronised = false;
public static UserDTO SystemUserDTO;
public static string ProgramVersion = "v1.1.039";
#if DEBUG
//public static string ApiBaseUrl = $"http://10.0.2.2:59027/";
//public static string ApiBaseUrl = $"https://dev.wfcapi.nuvolar.hu/";
public static string ApiBaseUrl = $"https://uat.wfcapi.nuvolar.hu/";
public static string ApiKey = $"RUJeLSpSMzVASUdaRCEzUyYxRSE0VyFISFRSJC0zRzhLM1hCSDU=";
#endif
#if !DEBUG
public static string ApiBaseUrl = $"https://uat.wfcapi.nuvolar.hu/";
public static string ApiKey = $"RUJeLSpSMzVASUdaRCEzUyYxRSE0VyFISFRSJC0zRzhLM1hCSDU=";
#endif
public async static Task GetAPIInfoAsync()
{
using (var httpClient = new HttpClient())
{
httpClient.BaseAddress = new Uri(ApiBaseUrl);
httpClient.DefaultRequestHeaders.Add("X-Api-Key", ApiKey);
string endpoint = $"{ApiBaseUrl}api/System/GetDatabaseAndVersionInfo";
var retVal = new RoleDTO();
try
{
var response = await httpClient.GetFromJsonAsync<ApiResponseDTO<string>>(endpoint);
if (response != null)
{
if (response.IsSuccess)
{
DatabaseName = response.Data;
}
}
}
catch (Exception ex)
{
//Log.Error(ex.Message);
}
}
}
public async static Task ShowSnackBar(string message,
string actionButtonTextColor = "#FFFFFF00",
string backgroundColor = "#FFFF0000",
string textColor = "##FFFFFF00",
int duration = 10,
string actionButtonText = "Ok",
Func<Task> action = null)
{
var visualOptions = new SnackbarOptions
{
ActionButtonTextColor = Color.FromArgb(actionButtonTextColor),
CornerRadius = new CornerRadius(10),
Font = Microsoft.Maui.Font.SystemFontOfSize(16),
BackgroundColor = Color.FromArgb(backgroundColor),
TextColor = Color.FromArgb(textColor)
};
var snackbar = Snackbar.Make(
message,
duration: TimeSpan.FromSeconds(duration),
action: async () =>
{
if (action != null)
await action();
},
actionButtonText: actionButtonText,
visualOptions: visualOptions
);
await snackbar.Show();
}
public static string ColorToHex(Color color)
{
// ARGB értékek lekérése
uint colorInt = (uint)color.ToArgb();
// Hexadecimális stringgé alakítás, és a '#'-t is hozzáadjuk
return $"#{colorInt:X8}";
}
}
}
using Android.Util;
using CommunityToolkit.Maui.Alerts;
using CommunityToolkit.Maui.Core;
using DevExpress.Maui.Core.Internal;
using Microsoft.Extensions.Configuration;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http.Json;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using WorkFlowCheck.Common.DTO;
namespace WorkFlowCheck.MAUI.Helper
{
public static class SystemHelper
{
public static string DatabaseName = "";
public static bool Syncronised = false;
public static UserDTO SystemUserDTO;
public static string ProgramVersion = "v1.1.039";
#if DEBUG
//public static string ApiBaseUrl = $"http://10.0.2.2:59027/";
//public static string ApiBaseUrl = $"https://dev.wfcapi.nuvolar.hu/";
public static string ApiBaseUrl = $"https://uat.wfcapi.nuvolar.hu/";
public static string ApiKey = $"RUJeLSpSMzVASUdaRCEzUyYxRSE0VyFISFRSJC0zRzhLM1hCSDU=";
#endif
#if !DEBUG
public static string ApiBaseUrl = $"https://uat.wfcapi.nuvolar.hu/";
public static string ApiKey = $"RUJeLSpSMzVASUdaRCEzUyYxRSE0VyFISFRSJC0zRzhLM1hCSDU=";
#endif
public async static Task GetAPIInfoAsync()
{
using (var httpClient = new HttpClient())
{
httpClient.BaseAddress = new Uri(ApiBaseUrl);
httpClient.DefaultRequestHeaders.Add("X-Api-Key", ApiKey);
string endpoint = $"{ApiBaseUrl}api/System/GetDatabaseAndVersionInfo";
var retVal = new RoleDTO();
try
{
var response = await httpClient.GetFromJsonAsync<ApiResponseDTO<string>>(endpoint);
if (response != null)
{
if (response.IsSuccess)
{
DatabaseName = response.Data;
}
}
}
catch (Exception ex)
{
//Log.Error(ex.Message);
}
}
}
public async static Task ShowSnackBar(string message,
string actionButtonTextColor = "#FFFFFF00",
string backgroundColor = "#FFFF0000",
string textColor = "##FFFFFF00",
int duration = 10,
string actionButtonText = "Ok",
Func<Task> action = null)
{
var visualOptions = new SnackbarOptions
{
ActionButtonTextColor = Color.FromArgb(actionButtonTextColor),
CornerRadius = new CornerRadius(10),
Font = Microsoft.Maui.Font.SystemFontOfSize(16),
BackgroundColor = Color.FromArgb(backgroundColor),
TextColor = Color.FromArgb(textColor)
};
var snackbar = Snackbar.Make(
message,
duration: TimeSpan.FromSeconds(duration),
action: async () =>
{
if (action != null)
await action();
},
actionButtonText: actionButtonText,
visualOptions: visualOptions
);
await snackbar.Show();
}
public static string ColorToHex(Color color)
{
// ARGB értékek lekérése
uint colorInt = (uint)color.ToArgb();
// Hexadecimális stringgé alakítás, és a '#'-t is hozzáadjuk
return $"#{colorInt:X8}";
}
}
}