Commit initial
This commit is contained in:
commit
b8f9c55b66
67
.gitignore
vendored
Normal file
67
.gitignore
vendored
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
# -------------------------------
|
||||||
|
# Fichiers et dossiers spécifiques à Visual Studio / Rider
|
||||||
|
# -------------------------------
|
||||||
|
.vs/
|
||||||
|
.vscode/
|
||||||
|
.idea/
|
||||||
|
*.suo
|
||||||
|
*.user
|
||||||
|
*.userosscache
|
||||||
|
*.sln.docstates
|
||||||
|
|
||||||
|
# -------------------------------
|
||||||
|
# Fichiers de build et dossiers de sortie
|
||||||
|
# -------------------------------
|
||||||
|
[Bb]in/
|
||||||
|
[Oo]bj/
|
||||||
|
[Ll]og/
|
||||||
|
[Ll]ogs/
|
||||||
|
|
||||||
|
# -------------------------------
|
||||||
|
# Fichiers NuGet
|
||||||
|
# -------------------------------
|
||||||
|
*.nupkg
|
||||||
|
*.nuspec
|
||||||
|
packages/
|
||||||
|
.nuget/
|
||||||
|
|
||||||
|
# -------------------------------
|
||||||
|
# Fichiers de cache et temporaires
|
||||||
|
# -------------------------------
|
||||||
|
*.cache
|
||||||
|
*.temp
|
||||||
|
*.tmp
|
||||||
|
*.log
|
||||||
|
|
||||||
|
# -------------------------------
|
||||||
|
# Spécifique aux plateformes MAUI
|
||||||
|
# -------------------------------
|
||||||
|
|
||||||
|
## Android
|
||||||
|
android/app/build/
|
||||||
|
android/.gradle/
|
||||||
|
android/local.properties
|
||||||
|
|
||||||
|
## iOS
|
||||||
|
ios/obj/
|
||||||
|
ios/bin/
|
||||||
|
|
||||||
|
## MacCatalyst
|
||||||
|
maccatalyst/obj/
|
||||||
|
maccatalyst/bin/
|
||||||
|
|
||||||
|
## Windows
|
||||||
|
windows/obj/
|
||||||
|
windows/bin/
|
||||||
|
|
||||||
|
# -------------------------------
|
||||||
|
# Fichiers de déploiement
|
||||||
|
# -------------------------------
|
||||||
|
*.apk
|
||||||
|
*.aab
|
||||||
|
*.ipa
|
||||||
|
|
||||||
|
# -------------------------------
|
||||||
|
# Dossiers de résultats de tests
|
||||||
|
# -------------------------------
|
||||||
|
TestResults/
|
16
MauiAppStock.sln
Normal file
16
MauiAppStock.sln
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MauiAppStock", "MauiAppStock\MauiAppStock.csproj", "{C70F5056-478B-49C0-AA49-2F10F14D92F5}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{C70F5056-478B-49C0-AA49-2F10F14D92F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{C70F5056-478B-49C0-AA49-2F10F14D92F5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{C70F5056-478B-49C0-AA49-2F10F14D92F5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{C70F5056-478B-49C0-AA49-2F10F14D92F5}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
67
MauiAppStock/.gitignore
vendored
Normal file
67
MauiAppStock/.gitignore
vendored
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
# -------------------------------
|
||||||
|
# Fichiers et dossiers spécifiques à Visual Studio / Rider
|
||||||
|
# -------------------------------
|
||||||
|
.vs/
|
||||||
|
.vscode/
|
||||||
|
.idea/
|
||||||
|
*.suo
|
||||||
|
*.user
|
||||||
|
*.userosscache
|
||||||
|
*.sln.docstates
|
||||||
|
|
||||||
|
# -------------------------------
|
||||||
|
# Fichiers de build et dossiers de sortie
|
||||||
|
# -------------------------------
|
||||||
|
[Bb]in/
|
||||||
|
[Oo]bj/
|
||||||
|
[Ll]og/
|
||||||
|
[Ll]ogs/
|
||||||
|
|
||||||
|
# -------------------------------
|
||||||
|
# Fichiers NuGet
|
||||||
|
# -------------------------------
|
||||||
|
*.nupkg
|
||||||
|
*.nuspec
|
||||||
|
packages/
|
||||||
|
.nuget/
|
||||||
|
|
||||||
|
# -------------------------------
|
||||||
|
# Fichiers de cache et temporaires
|
||||||
|
# -------------------------------
|
||||||
|
*.cache
|
||||||
|
*.temp
|
||||||
|
*.tmp
|
||||||
|
*.log
|
||||||
|
|
||||||
|
# -------------------------------
|
||||||
|
# Spécifique aux plateformes MAUI
|
||||||
|
# -------------------------------
|
||||||
|
|
||||||
|
## Android
|
||||||
|
android/app/build/
|
||||||
|
android/.gradle/
|
||||||
|
android/local.properties
|
||||||
|
|
||||||
|
## iOS
|
||||||
|
ios/obj/
|
||||||
|
ios/bin/
|
||||||
|
|
||||||
|
## MacCatalyst
|
||||||
|
maccatalyst/obj/
|
||||||
|
maccatalyst/bin/
|
||||||
|
|
||||||
|
## Windows
|
||||||
|
windows/obj/
|
||||||
|
windows/bin/
|
||||||
|
|
||||||
|
# -------------------------------
|
||||||
|
# Fichiers de déploiement
|
||||||
|
# -------------------------------
|
||||||
|
*.apk
|
||||||
|
*.aab
|
||||||
|
*.ipa
|
||||||
|
|
||||||
|
# -------------------------------
|
||||||
|
# Dossiers de résultats de tests
|
||||||
|
# -------------------------------
|
||||||
|
TestResults/
|
14
MauiAppStock/App.xaml
Normal file
14
MauiAppStock/App.xaml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?xml version = "1.0" encoding = "UTF-8" ?>
|
||||||
|
<Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
|
xmlns:local="clr-namespace:MauiAppStock"
|
||||||
|
x:Class="MauiAppStock.App">
|
||||||
|
<Application.Resources>
|
||||||
|
<ResourceDictionary>
|
||||||
|
<ResourceDictionary.MergedDictionaries>
|
||||||
|
<ResourceDictionary Source="Resources/Styles/Colors.xaml" />
|
||||||
|
<ResourceDictionary Source="Resources/Styles/Styles.xaml" />
|
||||||
|
</ResourceDictionary.MergedDictionaries>
|
||||||
|
</ResourceDictionary>
|
||||||
|
</Application.Resources>
|
||||||
|
</Application>
|
20
MauiAppStock/App.xaml.cs
Normal file
20
MauiAppStock/App.xaml.cs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
using MauiAppStock.Data;
|
||||||
|
using MauiAppStock.Views;
|
||||||
|
|
||||||
|
namespace MauiAppStock;
|
||||||
|
|
||||||
|
public partial class App : Application
|
||||||
|
{
|
||||||
|
public App()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
// On démarre sur MainPage dans une NavigationPage pour permettre la navigation
|
||||||
|
MainPage = new NavigationPage(new MainPage());
|
||||||
|
InitializeDatabase();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void InitializeDatabase()
|
||||||
|
{
|
||||||
|
await Database.InitializeAsync();
|
||||||
|
}
|
||||||
|
}
|
16
MauiAppStock/AppShell.xaml
Normal file
16
MauiAppStock/AppShell.xaml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<Shell
|
||||||
|
x:Class="MauiAppStock.AppShell"
|
||||||
|
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
|
xmlns:local="clr-namespace:MauiAppStock"
|
||||||
|
xmlns:views="clr-namespace:MauiAppStock.Views"
|
||||||
|
Shell.FlyoutBehavior="Disabled"
|
||||||
|
Title="MauiAppStock">
|
||||||
|
|
||||||
|
<ShellContent
|
||||||
|
Title="Home"
|
||||||
|
ContentTemplate="{DataTemplate views:MainPage}"
|
||||||
|
Route="MainPage" />
|
||||||
|
|
||||||
|
</Shell>
|
9
MauiAppStock/AppShell.xaml.cs
Normal file
9
MauiAppStock/AppShell.xaml.cs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
namespace MauiAppStock;
|
||||||
|
|
||||||
|
public partial class AppShell : Shell
|
||||||
|
{
|
||||||
|
public AppShell()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
143
MauiAppStock/Data/Database.cs
Normal file
143
MauiAppStock/Data/Database.cs
Normal file
@ -0,0 +1,143 @@
|
|||||||
|
using SQLite;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using MauiAppStock.Models;
|
||||||
|
|
||||||
|
namespace MauiAppStock.Data
|
||||||
|
{
|
||||||
|
public class Database
|
||||||
|
{
|
||||||
|
private static SingletonConnection db;
|
||||||
|
|
||||||
|
public static async Task InitializeAsync()
|
||||||
|
{
|
||||||
|
if (db == null)
|
||||||
|
{
|
||||||
|
string dbPath = Path.Combine(FileSystem.AppDataDirectory, "MauiAppStock.db3");
|
||||||
|
db = SingletonConnection.GetInstance(dbPath);
|
||||||
|
// Création des tables si elles n'existent pas
|
||||||
|
await db.CreateTableAsync<Appareil>();
|
||||||
|
await db.CreateTableAsync<Piece>();
|
||||||
|
await db.CreateTableAsync<AppareilPiece>(); // Table de liaison
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// CRUD pour Appareil
|
||||||
|
public static Task<int> AddAppareilAsync(Appareil appareil)
|
||||||
|
{
|
||||||
|
return db.InsertAsync(appareil);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Task<List<Appareil>> GetAppareilsAsync()
|
||||||
|
{
|
||||||
|
return db.Table<Appareil>().ToListAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Task<int> UpdateAppareilAsync(Appareil appareil)
|
||||||
|
{
|
||||||
|
return db.UpdateAsync(appareil);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Task<int> DeleteAppareilAsync(Appareil appareil)
|
||||||
|
{
|
||||||
|
return db.DeleteAsync(appareil);
|
||||||
|
}
|
||||||
|
|
||||||
|
// CRUD pour Piece
|
||||||
|
public static Task<int> AddPieceAsync(Piece piece)
|
||||||
|
{
|
||||||
|
return db.InsertAsync(piece);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Task<List<Piece>> GetPiecesAsync()
|
||||||
|
{
|
||||||
|
return db.Table<Piece>().ToListAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Task<int> UpdatePieceAsync(Piece piece)
|
||||||
|
{
|
||||||
|
return db.UpdateAsync(piece);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Task<int> DeletePieceAsync(Piece piece)
|
||||||
|
{
|
||||||
|
return db.DeleteAsync(piece);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Liaison entre Appareil et Piece
|
||||||
|
public static Task<int> AddAppareilPieceAsync(AppareilPiece appareilPiece)
|
||||||
|
{
|
||||||
|
return db.InsertAsync(appareilPiece);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Met à jour une association existante
|
||||||
|
public static Task<int> UpdateAppareilPieceAsync(AppareilPiece appareilPiece)
|
||||||
|
{
|
||||||
|
return db.UpdateAsync(appareilPiece);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Supprime une association existante
|
||||||
|
public static Task<int> DeleteAppareilPieceAsync(AppareilPiece appareilPiece)
|
||||||
|
{
|
||||||
|
return db.DeleteAsync(appareilPiece);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Récupérer toutes les pièces associées à un appareil
|
||||||
|
public static async Task<List<Piece>> GetPiecesForAppareilAsync(int appareilId)
|
||||||
|
{
|
||||||
|
var associations = await db.Table<AppareilPiece>().Where(ap => ap.AppareilId == appareilId).ToListAsync();
|
||||||
|
var pieces = new List<Piece>();
|
||||||
|
foreach (var assoc in associations)
|
||||||
|
{
|
||||||
|
var piece = await db.Table<Piece>().Where(p => p.Id == assoc.PieceId).FirstOrDefaultAsync();
|
||||||
|
if (piece != null)
|
||||||
|
{
|
||||||
|
// Assigner le flag de recommandation provenant de la table de liaison
|
||||||
|
piece.EstRecommandee = assoc.EstRecommandee;
|
||||||
|
pieces.Add(piece);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Trier pour que les pièces recommandées apparaissent en premier
|
||||||
|
return pieces.OrderByDescending(p => p.EstRecommandee).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Récupérer uniquement les pièces recommandées pour un appareil
|
||||||
|
public static async Task<List<Piece>> GetPiecesRecommandeesForAppareilAsync(int appareilId)
|
||||||
|
{
|
||||||
|
var associations = await db.Table<AppareilPiece>()
|
||||||
|
.Where(ap => ap.AppareilId == appareilId && ap.EstRecommandee)
|
||||||
|
.ToListAsync();
|
||||||
|
var pieces = new List<Piece>();
|
||||||
|
foreach (var assoc in associations)
|
||||||
|
{
|
||||||
|
var piece = await db.Table<Piece>().Where(p => p.Id == assoc.PieceId).FirstOrDefaultAsync();
|
||||||
|
if (piece != null)
|
||||||
|
pieces.Add(piece);
|
||||||
|
}
|
||||||
|
return pieces;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static async Task<List<AppareilPiece>> GetAppareilPiecesForAppareilAsync(int appareilId)
|
||||||
|
{
|
||||||
|
var associations = await db.Table<AppareilPiece>().Where(ap => ap.AppareilId == appareilId).ToListAsync();
|
||||||
|
foreach (var assoc in associations)
|
||||||
|
{
|
||||||
|
var piece = await db.Table<Piece>().Where(p => p.Id == assoc.PieceId).FirstOrDefaultAsync();
|
||||||
|
if (piece != null)
|
||||||
|
{
|
||||||
|
assoc.NomPiece = piece.Nom;
|
||||||
|
assoc.DescriptionPiece = piece.Description;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return associations.OrderByDescending(a => a.EstRecommandee).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static async Task<AppareilPiece> GetAppareilPieceAsync(int appareilId, int pieceId)
|
||||||
|
{
|
||||||
|
return await db.Table<AppareilPiece>()
|
||||||
|
.Where(ap => ap.AppareilId == appareilId && ap.PieceId == pieceId)
|
||||||
|
.FirstOrDefaultAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
23
MauiAppStock/Data/SingletonConnection.cs
Normal file
23
MauiAppStock/Data/SingletonConnection.cs
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
using SQLite;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
|
namespace MauiAppStock.Data
|
||||||
|
{
|
||||||
|
public class SingletonConnection : SQLiteAsyncConnection
|
||||||
|
{
|
||||||
|
private static SingletonConnection instance;
|
||||||
|
|
||||||
|
private SingletonConnection(string dbPath) : base(dbPath)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public static SingletonConnection GetInstance(string dbPath)
|
||||||
|
{
|
||||||
|
if (instance == null)
|
||||||
|
{
|
||||||
|
instance = new SingletonConnection(dbPath);
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
86
MauiAppStock/Helpers/AsyncCommand.cs
Normal file
86
MauiAppStock/Helpers/AsyncCommand.cs
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
using System;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
|
namespace MauiAppStock.Helpers
|
||||||
|
{
|
||||||
|
public class AsyncCommand : ICommand
|
||||||
|
{
|
||||||
|
private readonly Func<Task> _execute;
|
||||||
|
private readonly Func<bool> _canExecute;
|
||||||
|
private bool _isExecuting;
|
||||||
|
|
||||||
|
public AsyncCommand(Func<Task> execute, Func<bool> canExecute = null)
|
||||||
|
{
|
||||||
|
_execute = execute ?? throw new ArgumentNullException(nameof(execute));
|
||||||
|
_canExecute = canExecute;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CanExecute(object parameter)
|
||||||
|
{
|
||||||
|
return !_isExecuting && (_canExecute?.Invoke() ?? true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async void Execute(object parameter)
|
||||||
|
{
|
||||||
|
if (!CanExecute(parameter))
|
||||||
|
return;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_isExecuting = true;
|
||||||
|
RaiseCanExecuteChanged();
|
||||||
|
await _execute();
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
_isExecuting = false;
|
||||||
|
RaiseCanExecuteChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public event EventHandler CanExecuteChanged;
|
||||||
|
public void RaiseCanExecuteChanged() =>
|
||||||
|
CanExecuteChanged?.Invoke(this, EventArgs.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
|
public class AsyncCommand<T> : ICommand
|
||||||
|
{
|
||||||
|
private readonly Func<T, Task> _execute;
|
||||||
|
private readonly Predicate<T> _canExecute;
|
||||||
|
private bool _isExecuting;
|
||||||
|
|
||||||
|
public AsyncCommand(Func<T, Task> execute, Predicate<T> canExecute = null)
|
||||||
|
{
|
||||||
|
_execute = execute ?? throw new ArgumentNullException(nameof(execute));
|
||||||
|
_canExecute = canExecute;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CanExecute(object parameter)
|
||||||
|
{
|
||||||
|
return !_isExecuting && (_canExecute?.Invoke((T)parameter) ?? true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async void Execute(object parameter)
|
||||||
|
{
|
||||||
|
if (!CanExecute(parameter))
|
||||||
|
return;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_isExecuting = true;
|
||||||
|
RaiseCanExecuteChanged();
|
||||||
|
await _execute((T)parameter);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
_isExecuting = false;
|
||||||
|
RaiseCanExecuteChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public event EventHandler CanExecuteChanged;
|
||||||
|
public void RaiseCanExecuteChanged() =>
|
||||||
|
CanExecuteChanged?.Invoke(this, EventArgs.Empty);
|
||||||
|
}
|
||||||
|
}
|
66
MauiAppStock/MauiAppStock.csproj
Normal file
66
MauiAppStock/MauiAppStock.csproj
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFrameworks>net8.0-android;net8.0-ios;net8.0-maccatalyst</TargetFrameworks>
|
||||||
|
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.19041.0</TargetFrameworks>
|
||||||
|
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
|
||||||
|
<!-- <TargetFrameworks>$(TargetFrameworks);net8.0-tizen</TargetFrameworks> -->
|
||||||
|
|
||||||
|
<!-- Note for MacCatalyst:
|
||||||
|
The default runtime is maccatalyst-x64, except in Release config, in which case the default is maccatalyst-x64;maccatalyst-arm64.
|
||||||
|
When specifying both architectures, use the plural <RuntimeIdentifiers> instead of the singular <RuntimeIdentifier>.
|
||||||
|
The Mac App Store will NOT accept apps with ONLY maccatalyst-arm64 indicated;
|
||||||
|
either BOTH runtimes must be indicated or ONLY macatalyst-x64. -->
|
||||||
|
<!-- For example: <RuntimeIdentifiers>maccatalyst-x64;maccatalyst-arm64</RuntimeIdentifiers> -->
|
||||||
|
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<RootNamespace>MauiAppStock</RootNamespace>
|
||||||
|
<UseMaui>true</UseMaui>
|
||||||
|
<SingleProject>true</SingleProject>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
|
||||||
|
<!-- Display name -->
|
||||||
|
<ApplicationTitle>MauiAppStock</ApplicationTitle>
|
||||||
|
|
||||||
|
<!-- App Identifier -->
|
||||||
|
<ApplicationId>com.companyname.mauiappstock</ApplicationId>
|
||||||
|
|
||||||
|
<!-- Versions -->
|
||||||
|
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
|
||||||
|
<ApplicationVersion>1</ApplicationVersion>
|
||||||
|
|
||||||
|
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">11.0</SupportedOSPlatformVersion>
|
||||||
|
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">13.1</SupportedOSPlatformVersion>
|
||||||
|
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
|
||||||
|
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
|
||||||
|
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
|
||||||
|
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<!-- App Icon -->
|
||||||
|
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4"/>
|
||||||
|
|
||||||
|
<!-- Splash Screen -->
|
||||||
|
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128"/>
|
||||||
|
|
||||||
|
<!-- Images -->
|
||||||
|
<MauiImage Include="Resources\Images\*"/>
|
||||||
|
<MauiImage Update="Resources\Images\dotnet_bot.png" Resize="True" BaseSize="300,185"/>
|
||||||
|
|
||||||
|
<!-- Custom Fonts -->
|
||||||
|
<MauiFont Include="Resources\Fonts\*"/>
|
||||||
|
|
||||||
|
<!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
|
||||||
|
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)"/>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)"/>
|
||||||
|
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="$(MauiVersion)"/>
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0"/>
|
||||||
|
<PackageReference Include="sqlite-net-pcl" Version="1.10.196-beta" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
24
MauiAppStock/MauiProgram.cs
Normal file
24
MauiAppStock/MauiProgram.cs
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
namespace MauiAppStock;
|
||||||
|
|
||||||
|
public static class MauiProgram
|
||||||
|
{
|
||||||
|
public static MauiApp CreateMauiApp()
|
||||||
|
{
|
||||||
|
var builder = MauiApp.CreateBuilder();
|
||||||
|
builder
|
||||||
|
.UseMauiApp<App>()
|
||||||
|
.ConfigureFonts(fonts =>
|
||||||
|
{
|
||||||
|
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
|
||||||
|
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
|
||||||
|
});
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
builder.Logging.AddDebug();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return builder.Build();
|
||||||
|
}
|
||||||
|
}
|
13
MauiAppStock/Models/Appareil.cs
Normal file
13
MauiAppStock/Models/Appareil.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
using SQLite;
|
||||||
|
|
||||||
|
namespace MauiAppStock.Models
|
||||||
|
{
|
||||||
|
public class Appareil
|
||||||
|
{
|
||||||
|
[PrimaryKey, AutoIncrement]
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string Nom { get; set; }
|
||||||
|
public string Description { get; set; }
|
||||||
|
// Vous pouvez ajouter d'autres propriétés (stock, historique, etc.)
|
||||||
|
}
|
||||||
|
}
|
18
MauiAppStock/Models/AppareilPiece.cs
Normal file
18
MauiAppStock/Models/AppareilPiece.cs
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
using SQLite;
|
||||||
|
|
||||||
|
namespace MauiAppStock.Models
|
||||||
|
{
|
||||||
|
public class AppareilPiece
|
||||||
|
{
|
||||||
|
[PrimaryKey, AutoIncrement]
|
||||||
|
public int Id { get; set; }
|
||||||
|
public int AppareilId { get; set; }
|
||||||
|
public int PieceId { get; set; }
|
||||||
|
public bool EstRecommandee { get; set; }
|
||||||
|
|
||||||
|
[Ignore]
|
||||||
|
public string NomPiece { get; set; }
|
||||||
|
[Ignore]
|
||||||
|
public string DescriptionPiece { get; set; }
|
||||||
|
}
|
||||||
|
}
|
18
MauiAppStock/Models/Piece.cs
Normal file
18
MauiAppStock/Models/Piece.cs
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
using SQLite;
|
||||||
|
|
||||||
|
namespace MauiAppStock.Models
|
||||||
|
{
|
||||||
|
public class Piece
|
||||||
|
{
|
||||||
|
[PrimaryKey, AutoIncrement]
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string Nom { get; set; }
|
||||||
|
public string Description { get; set; }
|
||||||
|
public double Prix { get; set; }
|
||||||
|
public int Stock { get; set; }
|
||||||
|
public string Fournisseur { get; set; }
|
||||||
|
|
||||||
|
[Ignore]
|
||||||
|
public bool EstRecommandee { get; set; }
|
||||||
|
}
|
||||||
|
}
|
6
MauiAppStock/Platforms/Android/AndroidManifest.xml
Normal file
6
MauiAppStock/Platforms/Android/AndroidManifest.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<application android:allowBackup="true" android:icon="@mipmap/appicon" android:roundIcon="@mipmap/appicon_round" android:supportsRtl="true"></application>
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||||
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
</manifest>
|
12
MauiAppStock/Platforms/Android/MainActivity.cs
Normal file
12
MauiAppStock/Platforms/Android/MainActivity.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
using Android.App;
|
||||||
|
using Android.Content.PM;
|
||||||
|
using Android.OS;
|
||||||
|
|
||||||
|
namespace MauiAppStock;
|
||||||
|
|
||||||
|
[Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, LaunchMode = LaunchMode.SingleTop,
|
||||||
|
ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode |
|
||||||
|
ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)]
|
||||||
|
public class MainActivity : MauiAppCompatActivity
|
||||||
|
{
|
||||||
|
}
|
15
MauiAppStock/Platforms/Android/MainApplication.cs
Normal file
15
MauiAppStock/Platforms/Android/MainApplication.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
using Android.App;
|
||||||
|
using Android.Runtime;
|
||||||
|
|
||||||
|
namespace MauiAppStock;
|
||||||
|
|
||||||
|
[Application]
|
||||||
|
public class MainApplication : MauiApplication
|
||||||
|
{
|
||||||
|
public MainApplication(IntPtr handle, JniHandleOwnership ownership)
|
||||||
|
: base(handle, ownership)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<color name="colorPrimary">#512BD4</color>
|
||||||
|
<color name="colorPrimaryDark">#2B0B98</color>
|
||||||
|
<color name="colorAccent">#2B0B98</color>
|
||||||
|
</resources>
|
9
MauiAppStock/Platforms/MacCatalyst/AppDelegate.cs
Normal file
9
MauiAppStock/Platforms/MacCatalyst/AppDelegate.cs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
using Foundation;
|
||||||
|
|
||||||
|
namespace MauiAppStock;
|
||||||
|
|
||||||
|
[Register("AppDelegate")]
|
||||||
|
public class AppDelegate : MauiUIApplicationDelegate
|
||||||
|
{
|
||||||
|
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
|
||||||
|
}
|
14
MauiAppStock/Platforms/MacCatalyst/Entitlements.plist
Normal file
14
MauiAppStock/Platforms/MacCatalyst/Entitlements.plist
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<!-- See https://aka.ms/maui-publish-app-store#add-entitlements for more information about adding entitlements.-->
|
||||||
|
<dict>
|
||||||
|
<!-- App Sandbox must be enabled to distribute a MacCatalyst app through the Mac App Store. -->
|
||||||
|
<key>com.apple.security.app-sandbox</key>
|
||||||
|
<true/>
|
||||||
|
<!-- When App Sandbox is enabled, this value is required to open outgoing network connections. -->
|
||||||
|
<key>com.apple.security.network.client</key>
|
||||||
|
<true/>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
|
|
38
MauiAppStock/Platforms/MacCatalyst/Info.plist
Normal file
38
MauiAppStock/Platforms/MacCatalyst/Info.plist
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<!-- The Mac App Store requires you specify if the app uses encryption. -->
|
||||||
|
<!-- Please consult https://developer.apple.com/documentation/bundleresources/information_property_list/itsappusesnonexemptencryption -->
|
||||||
|
<!-- <key>ITSAppUsesNonExemptEncryption</key> -->
|
||||||
|
<!-- Please indicate <true/> or <false/> here. -->
|
||||||
|
|
||||||
|
<!-- Specify the category for your app here. -->
|
||||||
|
<!-- Please consult https://developer.apple.com/documentation/bundleresources/information_property_list/lsapplicationcategorytype -->
|
||||||
|
<!-- <key>LSApplicationCategoryType</key> -->
|
||||||
|
<!-- <string>public.app-category.YOUR-CATEGORY-HERE</string> -->
|
||||||
|
<key>UIDeviceFamily</key>
|
||||||
|
<array>
|
||||||
|
<integer>2</integer>
|
||||||
|
</array>
|
||||||
|
<key>UIRequiredDeviceCapabilities</key>
|
||||||
|
<array>
|
||||||
|
<string>arm64</string>
|
||||||
|
</array>
|
||||||
|
<key>UISupportedInterfaceOrientations</key>
|
||||||
|
<array>
|
||||||
|
<string>UIInterfaceOrientationPortrait</string>
|
||||||
|
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||||
|
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||||
|
</array>
|
||||||
|
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||||
|
<array>
|
||||||
|
<string>UIInterfaceOrientationPortrait</string>
|
||||||
|
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||||
|
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||||
|
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||||
|
</array>
|
||||||
|
<key>XSAppIconAssets</key>
|
||||||
|
<string>Assets.xcassets/appicon.appiconset</string>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
15
MauiAppStock/Platforms/MacCatalyst/Program.cs
Normal file
15
MauiAppStock/Platforms/MacCatalyst/Program.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
using ObjCRuntime;
|
||||||
|
using UIKit;
|
||||||
|
|
||||||
|
namespace MauiAppStock;
|
||||||
|
|
||||||
|
public class Program
|
||||||
|
{
|
||||||
|
// This is the main entry point of the application.
|
||||||
|
static void Main(string[] args)
|
||||||
|
{
|
||||||
|
// if you want to use a different Application Delegate class from "AppDelegate"
|
||||||
|
// you can specify it here.
|
||||||
|
UIApplication.Main(args, null, typeof(AppDelegate));
|
||||||
|
}
|
||||||
|
}
|
16
MauiAppStock/Platforms/Tizen/Main.cs
Normal file
16
MauiAppStock/Platforms/Tizen/Main.cs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.Maui;
|
||||||
|
using Microsoft.Maui.Hosting;
|
||||||
|
|
||||||
|
namespace MauiAppStock;
|
||||||
|
|
||||||
|
class Program : MauiApplication
|
||||||
|
{
|
||||||
|
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
|
||||||
|
|
||||||
|
static void Main(string[] args)
|
||||||
|
{
|
||||||
|
var app = new Program();
|
||||||
|
app.Run(args);
|
||||||
|
}
|
||||||
|
}
|
15
MauiAppStock/Platforms/Tizen/tizen-manifest.xml
Normal file
15
MauiAppStock/Platforms/Tizen/tizen-manifest.xml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest package="maui-application-id-placeholder" version="0.0.0" api-version="8" xmlns="http://tizen.org/ns/packages">
|
||||||
|
<profile name="common" />
|
||||||
|
<ui-application appid="maui-application-id-placeholder" exec="MauiAppStock.dll" multiple="false" nodisplay="false" taskmanage="true" type="dotnet" launch_mode="single">
|
||||||
|
<label>maui-application-title-placeholder</label>
|
||||||
|
<icon>maui-appicon-placeholder</icon>
|
||||||
|
<metadata key="http://tizen.org/metadata/prefer_dotnet_aot" value="true" />
|
||||||
|
</ui-application>
|
||||||
|
<shortcut-list />
|
||||||
|
<privileges>
|
||||||
|
<privilege>http://tizen.org/privilege/internet</privilege>
|
||||||
|
</privileges>
|
||||||
|
<dependencies />
|
||||||
|
<provides-appdefined-privileges />
|
||||||
|
</manifest>
|
8
MauiAppStock/Platforms/Windows/App.xaml
Normal file
8
MauiAppStock/Platforms/Windows/App.xaml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<maui:MauiWinUIApplication
|
||||||
|
x:Class="MauiAppStock.WinUI.App"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:maui="using:Microsoft.Maui"
|
||||||
|
xmlns:local="using:MauiAppStock.WinUI">
|
||||||
|
|
||||||
|
</maui:MauiWinUIApplication>
|
23
MauiAppStock/Platforms/Windows/App.xaml.cs
Normal file
23
MauiAppStock/Platforms/Windows/App.xaml.cs
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
using Microsoft.UI.Xaml;
|
||||||
|
|
||||||
|
// To learn more about WinUI, the WinUI project structure,
|
||||||
|
// and more about our project templates, see: http://aka.ms/winui-project-info.
|
||||||
|
|
||||||
|
namespace MauiAppStock.WinUI;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Provides application-specific behavior to supplement the default Application class.
|
||||||
|
/// </summary>
|
||||||
|
public partial class App : MauiWinUIApplication
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes the singleton application object. This is the first line of authored code
|
||||||
|
/// executed, and as such is the logical equivalent of main() or WinMain().
|
||||||
|
/// </summary>
|
||||||
|
public App()
|
||||||
|
{
|
||||||
|
this.InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
|
||||||
|
}
|
46
MauiAppStock/Platforms/Windows/Package.appxmanifest
Normal file
46
MauiAppStock/Platforms/Windows/Package.appxmanifest
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Package
|
||||||
|
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
|
||||||
|
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
|
||||||
|
xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
|
||||||
|
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
|
||||||
|
IgnorableNamespaces="uap rescap">
|
||||||
|
|
||||||
|
<Identity Name="maui-package-name-placeholder" Publisher="CN=User Name" Version="0.0.0.0" />
|
||||||
|
|
||||||
|
<mp:PhoneIdentity PhoneProductId="F3086923-EF50-4808-9A84-8EC499375571" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
|
||||||
|
|
||||||
|
<Properties>
|
||||||
|
<DisplayName>$placeholder$</DisplayName>
|
||||||
|
<PublisherDisplayName>User Name</PublisherDisplayName>
|
||||||
|
<Logo>$placeholder$.png</Logo>
|
||||||
|
</Properties>
|
||||||
|
|
||||||
|
<Dependencies>
|
||||||
|
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.17763.0" MaxVersionTested="10.0.19041.0" />
|
||||||
|
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.17763.0" MaxVersionTested="10.0.19041.0" />
|
||||||
|
</Dependencies>
|
||||||
|
|
||||||
|
<Resources>
|
||||||
|
<Resource Language="x-generate" />
|
||||||
|
</Resources>
|
||||||
|
|
||||||
|
<Applications>
|
||||||
|
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="$targetentrypoint$">
|
||||||
|
<uap:VisualElements
|
||||||
|
DisplayName="$placeholder$"
|
||||||
|
Description="$placeholder$"
|
||||||
|
Square150x150Logo="$placeholder$.png"
|
||||||
|
Square44x44Logo="$placeholder$.png"
|
||||||
|
BackgroundColor="transparent">
|
||||||
|
<uap:DefaultTile Square71x71Logo="$placeholder$.png" Wide310x150Logo="$placeholder$.png" Square310x310Logo="$placeholder$.png" />
|
||||||
|
<uap:SplashScreen Image="$placeholder$.png" />
|
||||||
|
</uap:VisualElements>
|
||||||
|
</Application>
|
||||||
|
</Applications>
|
||||||
|
|
||||||
|
<Capabilities>
|
||||||
|
<rescap:Capability Name="runFullTrust" />
|
||||||
|
</Capabilities>
|
||||||
|
|
||||||
|
</Package>
|
15
MauiAppStock/Platforms/Windows/app.manifest
Normal file
15
MauiAppStock/Platforms/Windows/app.manifest
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
|
<assemblyIdentity version="1.0.0.0" name="MauiAppStock.WinUI.app"/>
|
||||||
|
|
||||||
|
<application xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||||
|
<windowsSettings>
|
||||||
|
<!-- The combination of below two tags have the following effect:
|
||||||
|
1) Per-Monitor for >= Windows 10 Anniversary Update
|
||||||
|
2) System < Windows 10 Anniversary Update
|
||||||
|
-->
|
||||||
|
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/PM</dpiAware>
|
||||||
|
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2, PerMonitor</dpiAwareness>
|
||||||
|
</windowsSettings>
|
||||||
|
</application>
|
||||||
|
</assembly>
|
9
MauiAppStock/Platforms/iOS/AppDelegate.cs
Normal file
9
MauiAppStock/Platforms/iOS/AppDelegate.cs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
using Foundation;
|
||||||
|
|
||||||
|
namespace MauiAppStock;
|
||||||
|
|
||||||
|
[Register("AppDelegate")]
|
||||||
|
public class AppDelegate : MauiUIApplicationDelegate
|
||||||
|
{
|
||||||
|
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
|
||||||
|
}
|
32
MauiAppStock/Platforms/iOS/Info.plist
Normal file
32
MauiAppStock/Platforms/iOS/Info.plist
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>LSRequiresIPhoneOS</key>
|
||||||
|
<true/>
|
||||||
|
<key>UIDeviceFamily</key>
|
||||||
|
<array>
|
||||||
|
<integer>1</integer>
|
||||||
|
<integer>2</integer>
|
||||||
|
</array>
|
||||||
|
<key>UIRequiredDeviceCapabilities</key>
|
||||||
|
<array>
|
||||||
|
<string>arm64</string>
|
||||||
|
</array>
|
||||||
|
<key>UISupportedInterfaceOrientations</key>
|
||||||
|
<array>
|
||||||
|
<string>UIInterfaceOrientationPortrait</string>
|
||||||
|
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||||
|
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||||
|
</array>
|
||||||
|
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||||
|
<array>
|
||||||
|
<string>UIInterfaceOrientationPortrait</string>
|
||||||
|
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||||
|
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||||
|
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||||
|
</array>
|
||||||
|
<key>XSAppIconAssets</key>
|
||||||
|
<string>Assets.xcassets/appicon.appiconset</string>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
15
MauiAppStock/Platforms/iOS/Program.cs
Normal file
15
MauiAppStock/Platforms/iOS/Program.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
using ObjCRuntime;
|
||||||
|
using UIKit;
|
||||||
|
|
||||||
|
namespace MauiAppStock;
|
||||||
|
|
||||||
|
public class Program
|
||||||
|
{
|
||||||
|
// This is the main entry point of the application.
|
||||||
|
static void Main(string[] args)
|
||||||
|
{
|
||||||
|
// if you want to use a different Application Delegate class from "AppDelegate"
|
||||||
|
// you can specify it here.
|
||||||
|
UIApplication.Main(args, null, typeof(AppDelegate));
|
||||||
|
}
|
||||||
|
}
|
51
MauiAppStock/Platforms/iOS/Resources/PrivacyInfo.xcprivacy
Normal file
51
MauiAppStock/Platforms/iOS/Resources/PrivacyInfo.xcprivacy
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
This is the minimum required version of the Apple Privacy Manifest for .NET MAUI apps.
|
||||||
|
The contents below are needed because of APIs that are used in the .NET framework and .NET MAUI SDK.
|
||||||
|
|
||||||
|
You are responsible for adding extra entries as needed for your application.
|
||||||
|
|
||||||
|
More information: https://aka.ms/maui-privacy-manifest
|
||||||
|
-->
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>NSPrivacyAccessedAPITypes</key>
|
||||||
|
<array>
|
||||||
|
<dict>
|
||||||
|
<key>NSPrivacyAccessedAPIType</key>
|
||||||
|
<string>NSPrivacyAccessedAPICategoryFileTimestamp</string>
|
||||||
|
<key>NSPrivacyAccessedAPITypeReasons</key>
|
||||||
|
<array>
|
||||||
|
<string>C617.1</string>
|
||||||
|
</array>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>NSPrivacyAccessedAPIType</key>
|
||||||
|
<string>NSPrivacyAccessedAPICategorySystemBootTime</string>
|
||||||
|
<key>NSPrivacyAccessedAPITypeReasons</key>
|
||||||
|
<array>
|
||||||
|
<string>35F9.1</string>
|
||||||
|
</array>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>NSPrivacyAccessedAPIType</key>
|
||||||
|
<string>NSPrivacyAccessedAPICategoryDiskSpace</string>
|
||||||
|
<key>NSPrivacyAccessedAPITypeReasons</key>
|
||||||
|
<array>
|
||||||
|
<string>E174.1</string>
|
||||||
|
</array>
|
||||||
|
</dict>
|
||||||
|
<!--
|
||||||
|
The entry below is only needed when you're using the Preferences API in your app.
|
||||||
|
<dict>
|
||||||
|
<key>NSPrivacyAccessedAPIType</key>
|
||||||
|
<string>NSPrivacyAccessedAPICategoryUserDefaults</string>
|
||||||
|
<key>NSPrivacyAccessedAPITypeReasons</key>
|
||||||
|
<array>
|
||||||
|
<string>CA92.1</string>
|
||||||
|
</array>
|
||||||
|
</dict> -->
|
||||||
|
</array>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
8
MauiAppStock/Properties/launchSettings.json
Normal file
8
MauiAppStock/Properties/launchSettings.json
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"profiles": {
|
||||||
|
"Windows Machine": {
|
||||||
|
"commandName": "MsixPackage",
|
||||||
|
"nativeDebugging": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
4
MauiAppStock/Resources/AppIcon/appicon.svg
Normal file
4
MauiAppStock/Resources/AppIcon/appicon.svg
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg width="456" height="456" viewBox="0 0 456 456" version="1.1" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<rect x="0" y="0" width="456" height="456" fill="#512BD4" />
|
||||||
|
</svg>
|
After Width: | Height: | Size: 228 B |
8
MauiAppStock/Resources/AppIcon/appiconfg.svg
Normal file
8
MauiAppStock/Resources/AppIcon/appiconfg.svg
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||||
|
<svg width="456" height="456" viewBox="0 0 456 456" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
|
||||||
|
<path d="m 105.50037,281.60863 c -2.70293,0 -5.00091,-0.90042 -6.893127,-2.70209 -1.892214,-1.84778 -2.837901,-4.04181 -2.837901,-6.58209 0,-2.58722 0.945687,-4.80389 2.837901,-6.65167 1.892217,-1.84778 4.190197,-2.77167 6.893127,-2.77167 2.74819,0 5.06798,0.92389 6.96019,2.77167 1.93749,1.84778 2.90581,4.06445 2.90581,6.65167 0,2.54028 -0.96832,4.73431 -2.90581,6.58209 -1.89221,1.80167 -4.212,2.70209 -6.96019,2.70209 z" style="fill:#ffffff;fill-rule:nonzero;stroke-width:0.838376" />
|
||||||
|
<path d="M 213.56111,280.08446 H 195.99044 L 149.69953,207.0544 c -1.17121,-1.84778 -2.14037,-3.76515 -2.90581,-5.75126 h -0.40578 c 0.36051,2.12528 0.54076,6.67515 0.54076,13.6496 v 65.13172 h -15.54349 v -99.36009 h 18.71925 l 44.7374,71.29798 c 1.89222,2.95695 3.1087,4.98917 3.64945,6.09751 h 0.26996 c -0.45021,-2.6325 -0.67573,-7.09015 -0.67573,-13.37293 v -64.02256 h 15.47557 z" style="fill:#ffffff;fill-rule:nonzero;stroke-width:0.838376" />
|
||||||
|
<path d="m 289.25134,280.08446 h -54.40052 v -99.36009 h 52.23835 v 13.99669 h -36.15411 v 28.13085 h 33.31621 v 13.9271 h -33.31621 v 29.37835 h 38.31628 z" style="fill:#ffffff;fill-rule:nonzero;stroke-width:0.838376" />
|
||||||
|
<path d="M 366.56466,194.72106 H 338.7222 v 85.3634 h -16.08423 v -85.3634 h -27.77455 v -13.99669 h 71.70124 z" style="fill:#ffffff;fill-rule:nonzero;stroke-width:0.838376" />
|
||||||
|
</svg>
|
After Width: | Height: | Size: 1.8 KiB |
BIN
MauiAppStock/Resources/Fonts/OpenSans-Regular.ttf
Normal file
BIN
MauiAppStock/Resources/Fonts/OpenSans-Regular.ttf
Normal file
Binary file not shown.
BIN
MauiAppStock/Resources/Fonts/OpenSans-Semibold.ttf
Normal file
BIN
MauiAppStock/Resources/Fonts/OpenSans-Semibold.ttf
Normal file
Binary file not shown.
BIN
MauiAppStock/Resources/Images/dotnet_bot.png
Normal file
BIN
MauiAppStock/Resources/Images/dotnet_bot.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 68 KiB |
15
MauiAppStock/Resources/Raw/AboutAssets.txt
Normal file
15
MauiAppStock/Resources/Raw/AboutAssets.txt
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
Any raw assets you want to be deployed with your application can be placed in
|
||||||
|
this directory (and child directories). Deployment of the asset to your application
|
||||||
|
is automatically handled by the following `MauiAsset` Build Action within your `.csproj`.
|
||||||
|
|
||||||
|
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
|
||||||
|
|
||||||
|
These files will be deployed with your package and will be accessible using Essentials:
|
||||||
|
|
||||||
|
async Task LoadMauiAsset()
|
||||||
|
{
|
||||||
|
using var stream = await FileSystem.OpenAppPackageFileAsync("AboutAssets.txt");
|
||||||
|
using var reader = new StreamReader(stream);
|
||||||
|
|
||||||
|
var contents = reader.ReadToEnd();
|
||||||
|
}
|
8
MauiAppStock/Resources/Splash/splash.svg
Normal file
8
MauiAppStock/Resources/Splash/splash.svg
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||||
|
<svg width="456" height="456" viewBox="0 0 456 456" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
|
||||||
|
<path d="m 105.50037,281.60863 c -2.70293,0 -5.00091,-0.90042 -6.893127,-2.70209 -1.892214,-1.84778 -2.837901,-4.04181 -2.837901,-6.58209 0,-2.58722 0.945687,-4.80389 2.837901,-6.65167 1.892217,-1.84778 4.190197,-2.77167 6.893127,-2.77167 2.74819,0 5.06798,0.92389 6.96019,2.77167 1.93749,1.84778 2.90581,4.06445 2.90581,6.65167 0,2.54028 -0.96832,4.73431 -2.90581,6.58209 -1.89221,1.80167 -4.212,2.70209 -6.96019,2.70209 z" style="fill:#ffffff;fill-rule:nonzero;stroke-width:0.838376" />
|
||||||
|
<path d="M 213.56111,280.08446 H 195.99044 L 149.69953,207.0544 c -1.17121,-1.84778 -2.14037,-3.76515 -2.90581,-5.75126 h -0.40578 c 0.36051,2.12528 0.54076,6.67515 0.54076,13.6496 v 65.13172 h -15.54349 v -99.36009 h 18.71925 l 44.7374,71.29798 c 1.89222,2.95695 3.1087,4.98917 3.64945,6.09751 h 0.26996 c -0.45021,-2.6325 -0.67573,-7.09015 -0.67573,-13.37293 v -64.02256 h 15.47557 z" style="fill:#ffffff;fill-rule:nonzero;stroke-width:0.838376" />
|
||||||
|
<path d="m 289.25134,280.08446 h -54.40052 v -99.36009 h 52.23835 v 13.99669 h -36.15411 v 28.13085 h 33.31621 v 13.9271 h -33.31621 v 29.37835 h 38.31628 z" style="fill:#ffffff;fill-rule:nonzero;stroke-width:0.838376" />
|
||||||
|
<path d="M 366.56466,194.72106 H 338.7222 v 85.3634 h -16.08423 v -85.3634 h -27.77455 v -13.99669 h 71.70124 z" style="fill:#ffffff;fill-rule:nonzero;stroke-width:0.838376" />
|
||||||
|
</svg>
|
After Width: | Height: | Size: 1.8 KiB |
45
MauiAppStock/Resources/Styles/Colors.xaml
Normal file
45
MauiAppStock/Resources/Styles/Colors.xaml
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<?xaml-comp compile="true" ?>
|
||||||
|
<ResourceDictionary
|
||||||
|
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
|
||||||
|
|
||||||
|
<!-- Note: For Android please see also Platforms\Android\Resources\values\colors.xml -->
|
||||||
|
|
||||||
|
<Color x:Key="Primary">#512BD4</Color>
|
||||||
|
<Color x:Key="PrimaryDark">#ac99ea</Color>
|
||||||
|
<Color x:Key="PrimaryDarkText">#242424</Color>
|
||||||
|
<Color x:Key="Secondary">#DFD8F7</Color>
|
||||||
|
<Color x:Key="SecondaryDarkText">#9880e5</Color>
|
||||||
|
<Color x:Key="Tertiary">#2B0B98</Color>
|
||||||
|
|
||||||
|
<Color x:Key="White">White</Color>
|
||||||
|
<Color x:Key="Black">Black</Color>
|
||||||
|
<Color x:Key="Magenta">#D600AA</Color>
|
||||||
|
<Color x:Key="MidnightBlue">#190649</Color>
|
||||||
|
<Color x:Key="OffBlack">#1f1f1f</Color>
|
||||||
|
|
||||||
|
<Color x:Key="Gray100">#E1E1E1</Color>
|
||||||
|
<Color x:Key="Gray200">#C8C8C8</Color>
|
||||||
|
<Color x:Key="Gray300">#ACACAC</Color>
|
||||||
|
<Color x:Key="Gray400">#919191</Color>
|
||||||
|
<Color x:Key="Gray500">#6E6E6E</Color>
|
||||||
|
<Color x:Key="Gray600">#404040</Color>
|
||||||
|
<Color x:Key="Gray900">#212121</Color>
|
||||||
|
<Color x:Key="Gray950">#141414</Color>
|
||||||
|
|
||||||
|
<SolidColorBrush x:Key="PrimaryBrush" Color="{StaticResource Primary}"/>
|
||||||
|
<SolidColorBrush x:Key="SecondaryBrush" Color="{StaticResource Secondary}"/>
|
||||||
|
<SolidColorBrush x:Key="TertiaryBrush" Color="{StaticResource Tertiary}"/>
|
||||||
|
<SolidColorBrush x:Key="WhiteBrush" Color="{StaticResource White}"/>
|
||||||
|
<SolidColorBrush x:Key="BlackBrush" Color="{StaticResource Black}"/>
|
||||||
|
|
||||||
|
<SolidColorBrush x:Key="Gray100Brush" Color="{StaticResource Gray100}"/>
|
||||||
|
<SolidColorBrush x:Key="Gray200Brush" Color="{StaticResource Gray200}"/>
|
||||||
|
<SolidColorBrush x:Key="Gray300Brush" Color="{StaticResource Gray300}"/>
|
||||||
|
<SolidColorBrush x:Key="Gray400Brush" Color="{StaticResource Gray400}"/>
|
||||||
|
<SolidColorBrush x:Key="Gray500Brush" Color="{StaticResource Gray500}"/>
|
||||||
|
<SolidColorBrush x:Key="Gray600Brush" Color="{StaticResource Gray600}"/>
|
||||||
|
<SolidColorBrush x:Key="Gray900Brush" Color="{StaticResource Gray900}"/>
|
||||||
|
<SolidColorBrush x:Key="Gray950Brush" Color="{StaticResource Gray950}"/>
|
||||||
|
</ResourceDictionary>
|
427
MauiAppStock/Resources/Styles/Styles.xaml
Normal file
427
MauiAppStock/Resources/Styles/Styles.xaml
Normal file
@ -0,0 +1,427 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<?xaml-comp compile="true" ?>
|
||||||
|
<ResourceDictionary
|
||||||
|
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
|
||||||
|
|
||||||
|
<Style TargetType="ActivityIndicator">
|
||||||
|
<Setter Property="Color" Value="{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource White}}" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style TargetType="IndicatorView">
|
||||||
|
<Setter Property="IndicatorColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray500}}"/>
|
||||||
|
<Setter Property="SelectedIndicatorColor" Value="{AppThemeBinding Light={StaticResource Gray950}, Dark={StaticResource Gray100}}"/>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style TargetType="Border">
|
||||||
|
<Setter Property="Stroke" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray500}}" />
|
||||||
|
<Setter Property="StrokeShape" Value="Rectangle"/>
|
||||||
|
<Setter Property="StrokeThickness" Value="1"/>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style TargetType="BoxView">
|
||||||
|
<Setter Property="BackgroundColor" Value="{AppThemeBinding Light={StaticResource Gray950}, Dark={StaticResource Gray200}}" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style TargetType="Button">
|
||||||
|
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource PrimaryDarkText}}" />
|
||||||
|
<Setter Property="BackgroundColor" Value="{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource PrimaryDark}}" />
|
||||||
|
<Setter Property="FontFamily" Value="OpenSansRegular"/>
|
||||||
|
<Setter Property="FontSize" Value="14"/>
|
||||||
|
<Setter Property="BorderWidth" Value="0"/>
|
||||||
|
<Setter Property="CornerRadius" Value="8"/>
|
||||||
|
<Setter Property="Padding" Value="14,10"/>
|
||||||
|
<Setter Property="MinimumHeightRequest" Value="44"/>
|
||||||
|
<Setter Property="MinimumWidthRequest" Value="44"/>
|
||||||
|
<Setter Property="VisualStateManager.VisualStateGroups">
|
||||||
|
<VisualStateGroupList>
|
||||||
|
<VisualStateGroup x:Name="CommonStates">
|
||||||
|
<VisualState x:Name="Normal" />
|
||||||
|
<VisualState x:Name="Disabled">
|
||||||
|
<VisualState.Setters>
|
||||||
|
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray950}, Dark={StaticResource Gray200}}" />
|
||||||
|
<Setter Property="BackgroundColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray600}}" />
|
||||||
|
</VisualState.Setters>
|
||||||
|
</VisualState>
|
||||||
|
<VisualState x:Name="PointerOver" />
|
||||||
|
</VisualStateGroup>
|
||||||
|
</VisualStateGroupList>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style TargetType="CheckBox">
|
||||||
|
<Setter Property="Color" Value="{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource White}}" />
|
||||||
|
<Setter Property="MinimumHeightRequest" Value="44"/>
|
||||||
|
<Setter Property="MinimumWidthRequest" Value="44"/>
|
||||||
|
<Setter Property="VisualStateManager.VisualStateGroups">
|
||||||
|
<VisualStateGroupList>
|
||||||
|
<VisualStateGroup x:Name="CommonStates">
|
||||||
|
<VisualState x:Name="Normal" />
|
||||||
|
<VisualState x:Name="Disabled">
|
||||||
|
<VisualState.Setters>
|
||||||
|
<Setter Property="Color" Value="{AppThemeBinding Light={StaticResource Gray300}, Dark={StaticResource Gray600}}" />
|
||||||
|
</VisualState.Setters>
|
||||||
|
</VisualState>
|
||||||
|
</VisualStateGroup>
|
||||||
|
</VisualStateGroupList>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style TargetType="DatePicker">
|
||||||
|
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource White}}" />
|
||||||
|
<Setter Property="BackgroundColor" Value="Transparent" />
|
||||||
|
<Setter Property="FontFamily" Value="OpenSansRegular"/>
|
||||||
|
<Setter Property="FontSize" Value="14"/>
|
||||||
|
<Setter Property="MinimumHeightRequest" Value="44"/>
|
||||||
|
<Setter Property="MinimumWidthRequest" Value="44"/>
|
||||||
|
<Setter Property="VisualStateManager.VisualStateGroups">
|
||||||
|
<VisualStateGroupList>
|
||||||
|
<VisualStateGroup x:Name="CommonStates">
|
||||||
|
<VisualState x:Name="Normal" />
|
||||||
|
<VisualState x:Name="Disabled">
|
||||||
|
<VisualState.Setters>
|
||||||
|
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray500}}" />
|
||||||
|
</VisualState.Setters>
|
||||||
|
</VisualState>
|
||||||
|
</VisualStateGroup>
|
||||||
|
</VisualStateGroupList>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style TargetType="Editor">
|
||||||
|
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Black}, Dark={StaticResource White}}" />
|
||||||
|
<Setter Property="BackgroundColor" Value="Transparent" />
|
||||||
|
<Setter Property="FontFamily" Value="OpenSansRegular"/>
|
||||||
|
<Setter Property="FontSize" Value="14" />
|
||||||
|
<Setter Property="PlaceholderColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray500}}" />
|
||||||
|
<Setter Property="MinimumHeightRequest" Value="44"/>
|
||||||
|
<Setter Property="MinimumWidthRequest" Value="44"/>
|
||||||
|
<Setter Property="VisualStateManager.VisualStateGroups">
|
||||||
|
<VisualStateGroupList>
|
||||||
|
<VisualStateGroup x:Name="CommonStates">
|
||||||
|
<VisualState x:Name="Normal" />
|
||||||
|
<VisualState x:Name="Disabled">
|
||||||
|
<VisualState.Setters>
|
||||||
|
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray300}, Dark={StaticResource Gray600}}" />
|
||||||
|
</VisualState.Setters>
|
||||||
|
</VisualState>
|
||||||
|
</VisualStateGroup>
|
||||||
|
</VisualStateGroupList>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style TargetType="Entry">
|
||||||
|
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Black}, Dark={StaticResource White}}" />
|
||||||
|
<Setter Property="BackgroundColor" Value="Transparent" />
|
||||||
|
<Setter Property="FontFamily" Value="OpenSansRegular"/>
|
||||||
|
<Setter Property="FontSize" Value="14" />
|
||||||
|
<Setter Property="PlaceholderColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray500}}" />
|
||||||
|
<Setter Property="MinimumHeightRequest" Value="44"/>
|
||||||
|
<Setter Property="MinimumWidthRequest" Value="44"/>
|
||||||
|
<Setter Property="VisualStateManager.VisualStateGroups">
|
||||||
|
<VisualStateGroupList>
|
||||||
|
<VisualStateGroup x:Name="CommonStates">
|
||||||
|
<VisualState x:Name="Normal" />
|
||||||
|
<VisualState x:Name="Disabled">
|
||||||
|
<VisualState.Setters>
|
||||||
|
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray300}, Dark={StaticResource Gray600}}" />
|
||||||
|
</VisualState.Setters>
|
||||||
|
</VisualState>
|
||||||
|
</VisualStateGroup>
|
||||||
|
</VisualStateGroupList>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style TargetType="Frame">
|
||||||
|
<Setter Property="HasShadow" Value="False" />
|
||||||
|
<Setter Property="BorderColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray950}}" />
|
||||||
|
<Setter Property="CornerRadius" Value="8" />
|
||||||
|
<Setter Property="BackgroundColor" Value="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource Black}}" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style TargetType="ImageButton">
|
||||||
|
<Setter Property="Opacity" Value="1" />
|
||||||
|
<Setter Property="BorderColor" Value="Transparent"/>
|
||||||
|
<Setter Property="BorderWidth" Value="0"/>
|
||||||
|
<Setter Property="CornerRadius" Value="0"/>
|
||||||
|
<Setter Property="MinimumHeightRequest" Value="44"/>
|
||||||
|
<Setter Property="MinimumWidthRequest" Value="44"/>
|
||||||
|
<Setter Property="VisualStateManager.VisualStateGroups">
|
||||||
|
<VisualStateGroupList>
|
||||||
|
<VisualStateGroup x:Name="CommonStates">
|
||||||
|
<VisualState x:Name="Normal" />
|
||||||
|
<VisualState x:Name="Disabled">
|
||||||
|
<VisualState.Setters>
|
||||||
|
<Setter Property="Opacity" Value="0.5" />
|
||||||
|
</VisualState.Setters>
|
||||||
|
</VisualState>
|
||||||
|
<VisualState x:Name="PointerOver" />
|
||||||
|
</VisualStateGroup>
|
||||||
|
</VisualStateGroupList>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style TargetType="Label">
|
||||||
|
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Black}, Dark={StaticResource White}}" />
|
||||||
|
<Setter Property="BackgroundColor" Value="Transparent" />
|
||||||
|
<Setter Property="FontFamily" Value="OpenSansRegular" />
|
||||||
|
<Setter Property="FontSize" Value="14" />
|
||||||
|
<Setter Property="VisualStateManager.VisualStateGroups">
|
||||||
|
<VisualStateGroupList>
|
||||||
|
<VisualStateGroup x:Name="CommonStates">
|
||||||
|
<VisualState x:Name="Normal" />
|
||||||
|
<VisualState x:Name="Disabled">
|
||||||
|
<VisualState.Setters>
|
||||||
|
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray300}, Dark={StaticResource Gray600}}" />
|
||||||
|
</VisualState.Setters>
|
||||||
|
</VisualState>
|
||||||
|
</VisualStateGroup>
|
||||||
|
</VisualStateGroupList>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style TargetType="Span">
|
||||||
|
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Black}, Dark={StaticResource White}}" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style TargetType="Label" x:Key="Headline">
|
||||||
|
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource MidnightBlue}, Dark={StaticResource White}}" />
|
||||||
|
<Setter Property="FontSize" Value="32" />
|
||||||
|
<Setter Property="HorizontalOptions" Value="Center" />
|
||||||
|
<Setter Property="HorizontalTextAlignment" Value="Center" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style TargetType="Label" x:Key="SubHeadline">
|
||||||
|
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource MidnightBlue}, Dark={StaticResource White}}" />
|
||||||
|
<Setter Property="FontSize" Value="24" />
|
||||||
|
<Setter Property="HorizontalOptions" Value="Center" />
|
||||||
|
<Setter Property="HorizontalTextAlignment" Value="Center" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style TargetType="ListView">
|
||||||
|
<Setter Property="SeparatorColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray500}}" />
|
||||||
|
<Setter Property="RefreshControlColor" Value="{AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource Gray200}}" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style TargetType="Picker">
|
||||||
|
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource White}}" />
|
||||||
|
<Setter Property="TitleColor" Value="{AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource Gray200}}" />
|
||||||
|
<Setter Property="BackgroundColor" Value="Transparent" />
|
||||||
|
<Setter Property="FontFamily" Value="OpenSansRegular"/>
|
||||||
|
<Setter Property="FontSize" Value="14"/>
|
||||||
|
<Setter Property="MinimumHeightRequest" Value="44"/>
|
||||||
|
<Setter Property="MinimumWidthRequest" Value="44"/>
|
||||||
|
<Setter Property="VisualStateManager.VisualStateGroups">
|
||||||
|
<VisualStateGroupList>
|
||||||
|
<VisualStateGroup x:Name="CommonStates">
|
||||||
|
<VisualState x:Name="Normal" />
|
||||||
|
<VisualState x:Name="Disabled">
|
||||||
|
<VisualState.Setters>
|
||||||
|
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray300}, Dark={StaticResource Gray600}}" />
|
||||||
|
<Setter Property="TitleColor" Value="{AppThemeBinding Light={StaticResource Gray300}, Dark={StaticResource Gray600}}" />
|
||||||
|
</VisualState.Setters>
|
||||||
|
</VisualState>
|
||||||
|
</VisualStateGroup>
|
||||||
|
</VisualStateGroupList>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style TargetType="ProgressBar">
|
||||||
|
<Setter Property="ProgressColor" Value="{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource White}}" />
|
||||||
|
<Setter Property="VisualStateManager.VisualStateGroups">
|
||||||
|
<VisualStateGroupList>
|
||||||
|
<VisualStateGroup x:Name="CommonStates">
|
||||||
|
<VisualState x:Name="Normal" />
|
||||||
|
<VisualState x:Name="Disabled">
|
||||||
|
<VisualState.Setters>
|
||||||
|
<Setter Property="ProgressColor" Value="{AppThemeBinding Light={StaticResource Gray300}, Dark={StaticResource Gray600}}" />
|
||||||
|
</VisualState.Setters>
|
||||||
|
</VisualState>
|
||||||
|
</VisualStateGroup>
|
||||||
|
</VisualStateGroupList>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style TargetType="RadioButton">
|
||||||
|
<Setter Property="BackgroundColor" Value="Transparent"/>
|
||||||
|
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Black}, Dark={StaticResource White}}" />
|
||||||
|
<Setter Property="FontFamily" Value="OpenSansRegular"/>
|
||||||
|
<Setter Property="FontSize" Value="14"/>
|
||||||
|
<Setter Property="MinimumHeightRequest" Value="44"/>
|
||||||
|
<Setter Property="MinimumWidthRequest" Value="44"/>
|
||||||
|
<Setter Property="VisualStateManager.VisualStateGroups">
|
||||||
|
<VisualStateGroupList>
|
||||||
|
<VisualStateGroup x:Name="CommonStates">
|
||||||
|
<VisualState x:Name="Normal" />
|
||||||
|
<VisualState x:Name="Disabled">
|
||||||
|
<VisualState.Setters>
|
||||||
|
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray300}, Dark={StaticResource Gray600}}" />
|
||||||
|
</VisualState.Setters>
|
||||||
|
</VisualState>
|
||||||
|
</VisualStateGroup>
|
||||||
|
</VisualStateGroupList>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style TargetType="RefreshView">
|
||||||
|
<Setter Property="RefreshColor" Value="{AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource Gray200}}" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style TargetType="SearchBar">
|
||||||
|
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource White}}" />
|
||||||
|
<Setter Property="PlaceholderColor" Value="{StaticResource Gray500}" />
|
||||||
|
<Setter Property="CancelButtonColor" Value="{StaticResource Gray500}" />
|
||||||
|
<Setter Property="BackgroundColor" Value="Transparent" />
|
||||||
|
<Setter Property="FontFamily" Value="OpenSansRegular" />
|
||||||
|
<Setter Property="FontSize" Value="14" />
|
||||||
|
<Setter Property="MinimumHeightRequest" Value="44"/>
|
||||||
|
<Setter Property="MinimumWidthRequest" Value="44"/>
|
||||||
|
<Setter Property="VisualStateManager.VisualStateGroups">
|
||||||
|
<VisualStateGroupList>
|
||||||
|
<VisualStateGroup x:Name="CommonStates">
|
||||||
|
<VisualState x:Name="Normal" />
|
||||||
|
<VisualState x:Name="Disabled">
|
||||||
|
<VisualState.Setters>
|
||||||
|
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray300}, Dark={StaticResource Gray600}}" />
|
||||||
|
<Setter Property="PlaceholderColor" Value="{AppThemeBinding Light={StaticResource Gray300}, Dark={StaticResource Gray600}}" />
|
||||||
|
</VisualState.Setters>
|
||||||
|
</VisualState>
|
||||||
|
</VisualStateGroup>
|
||||||
|
</VisualStateGroupList>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style TargetType="SearchHandler">
|
||||||
|
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource White}}" />
|
||||||
|
<Setter Property="PlaceholderColor" Value="{StaticResource Gray500}" />
|
||||||
|
<Setter Property="BackgroundColor" Value="Transparent" />
|
||||||
|
<Setter Property="FontFamily" Value="OpenSansRegular" />
|
||||||
|
<Setter Property="FontSize" Value="14" />
|
||||||
|
<Setter Property="VisualStateManager.VisualStateGroups">
|
||||||
|
<VisualStateGroupList>
|
||||||
|
<VisualStateGroup x:Name="CommonStates">
|
||||||
|
<VisualState x:Name="Normal" />
|
||||||
|
<VisualState x:Name="Disabled">
|
||||||
|
<VisualState.Setters>
|
||||||
|
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray300}, Dark={StaticResource Gray600}}" />
|
||||||
|
<Setter Property="PlaceholderColor" Value="{AppThemeBinding Light={StaticResource Gray300}, Dark={StaticResource Gray600}}" />
|
||||||
|
</VisualState.Setters>
|
||||||
|
</VisualState>
|
||||||
|
</VisualStateGroup>
|
||||||
|
</VisualStateGroupList>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style TargetType="Shadow">
|
||||||
|
<Setter Property="Radius" Value="15" />
|
||||||
|
<Setter Property="Opacity" Value="0.5" />
|
||||||
|
<Setter Property="Brush" Value="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource White}}" />
|
||||||
|
<Setter Property="Offset" Value="10,10" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style TargetType="Slider">
|
||||||
|
<Setter Property="MinimumTrackColor" Value="{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource White}}" />
|
||||||
|
<Setter Property="MaximumTrackColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray600}}" />
|
||||||
|
<Setter Property="ThumbColor" Value="{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource White}}" />
|
||||||
|
<Setter Property="VisualStateManager.VisualStateGroups">
|
||||||
|
<VisualStateGroupList>
|
||||||
|
<VisualStateGroup x:Name="CommonStates">
|
||||||
|
<VisualState x:Name="Normal" />
|
||||||
|
<VisualState x:Name="Disabled">
|
||||||
|
<VisualState.Setters>
|
||||||
|
<Setter Property="MinimumTrackColor" Value="{AppThemeBinding Light={StaticResource Gray300}, Dark={StaticResource Gray600}}"/>
|
||||||
|
<Setter Property="MaximumTrackColor" Value="{AppThemeBinding Light={StaticResource Gray300}, Dark={StaticResource Gray600}}"/>
|
||||||
|
<Setter Property="ThumbColor" Value="{AppThemeBinding Light={StaticResource Gray300}, Dark={StaticResource Gray600}}"/>
|
||||||
|
</VisualState.Setters>
|
||||||
|
</VisualState>
|
||||||
|
</VisualStateGroup>
|
||||||
|
</VisualStateGroupList>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style TargetType="SwipeItem">
|
||||||
|
<Setter Property="BackgroundColor" Value="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource Black}}" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style TargetType="Switch">
|
||||||
|
<Setter Property="OnColor" Value="{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource White}}" />
|
||||||
|
<Setter Property="ThumbColor" Value="{StaticResource White}" />
|
||||||
|
<Setter Property="VisualStateManager.VisualStateGroups">
|
||||||
|
<VisualStateGroupList>
|
||||||
|
<VisualStateGroup x:Name="CommonStates">
|
||||||
|
<VisualState x:Name="Normal" />
|
||||||
|
<VisualState x:Name="Disabled">
|
||||||
|
<VisualState.Setters>
|
||||||
|
<Setter Property="OnColor" Value="{AppThemeBinding Light={StaticResource Gray300}, Dark={StaticResource Gray600}}" />
|
||||||
|
<Setter Property="ThumbColor" Value="{AppThemeBinding Light={StaticResource Gray300}, Dark={StaticResource Gray600}}" />
|
||||||
|
</VisualState.Setters>
|
||||||
|
</VisualState>
|
||||||
|
<VisualState x:Name="On">
|
||||||
|
<VisualState.Setters>
|
||||||
|
<Setter Property="OnColor" Value="{AppThemeBinding Light={StaticResource Secondary}, Dark={StaticResource Gray200}}" />
|
||||||
|
<Setter Property="ThumbColor" Value="{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource White}}" />
|
||||||
|
</VisualState.Setters>
|
||||||
|
</VisualState>
|
||||||
|
<VisualState x:Name="Off">
|
||||||
|
<VisualState.Setters>
|
||||||
|
<Setter Property="ThumbColor" Value="{AppThemeBinding Light={StaticResource Gray400}, Dark={StaticResource Gray500}}" />
|
||||||
|
</VisualState.Setters>
|
||||||
|
</VisualState>
|
||||||
|
</VisualStateGroup>
|
||||||
|
</VisualStateGroupList>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style TargetType="TimePicker">
|
||||||
|
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource White}}" />
|
||||||
|
<Setter Property="BackgroundColor" Value="Transparent"/>
|
||||||
|
<Setter Property="FontFamily" Value="OpenSansRegular"/>
|
||||||
|
<Setter Property="FontSize" Value="14"/>
|
||||||
|
<Setter Property="MinimumHeightRequest" Value="44"/>
|
||||||
|
<Setter Property="MinimumWidthRequest" Value="44"/>
|
||||||
|
<Setter Property="VisualStateManager.VisualStateGroups">
|
||||||
|
<VisualStateGroupList>
|
||||||
|
<VisualStateGroup x:Name="CommonStates">
|
||||||
|
<VisualState x:Name="Normal" />
|
||||||
|
<VisualState x:Name="Disabled">
|
||||||
|
<VisualState.Setters>
|
||||||
|
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray300}, Dark={StaticResource Gray600}}" />
|
||||||
|
</VisualState.Setters>
|
||||||
|
</VisualState>
|
||||||
|
</VisualStateGroup>
|
||||||
|
</VisualStateGroupList>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style TargetType="Page" ApplyToDerivedTypes="True">
|
||||||
|
<Setter Property="Padding" Value="0"/>
|
||||||
|
<Setter Property="BackgroundColor" Value="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource OffBlack}}" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style TargetType="Shell" ApplyToDerivedTypes="True">
|
||||||
|
<Setter Property="Shell.BackgroundColor" Value="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource OffBlack}}" />
|
||||||
|
<Setter Property="Shell.ForegroundColor" Value="{AppThemeBinding Light={StaticResource Black}, Dark={StaticResource SecondaryDarkText}}" />
|
||||||
|
<Setter Property="Shell.TitleColor" Value="{AppThemeBinding Light={StaticResource Black}, Dark={StaticResource SecondaryDarkText}}" />
|
||||||
|
<Setter Property="Shell.DisabledColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray950}}" />
|
||||||
|
<Setter Property="Shell.UnselectedColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray200}}" />
|
||||||
|
<Setter Property="Shell.NavBarHasShadow" Value="False" />
|
||||||
|
<Setter Property="Shell.TabBarBackgroundColor" Value="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource Black}}" />
|
||||||
|
<Setter Property="Shell.TabBarForegroundColor" Value="{AppThemeBinding Light={StaticResource Magenta}, Dark={StaticResource White}}" />
|
||||||
|
<Setter Property="Shell.TabBarTitleColor" Value="{AppThemeBinding Light={StaticResource Magenta}, Dark={StaticResource White}}" />
|
||||||
|
<Setter Property="Shell.TabBarUnselectedColor" Value="{AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource Gray200}}" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style TargetType="NavigationPage">
|
||||||
|
<Setter Property="BarBackgroundColor" Value="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource OffBlack}}" />
|
||||||
|
<Setter Property="BarTextColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource White}}" />
|
||||||
|
<Setter Property="IconColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource White}}" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style TargetType="TabbedPage">
|
||||||
|
<Setter Property="BarBackgroundColor" Value="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource Gray950}}" />
|
||||||
|
<Setter Property="BarTextColor" Value="{AppThemeBinding Light={StaticResource Magenta}, Dark={StaticResource White}}" />
|
||||||
|
<Setter Property="UnselectedTabColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray950}}" />
|
||||||
|
<Setter Property="SelectedTabColor" Value="{AppThemeBinding Light={StaticResource Gray950}, Dark={StaticResource Gray200}}" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
</ResourceDictionary>
|
119
MauiAppStock/ViewModels/AppareilPiecesViewModel.cs
Normal file
119
MauiAppStock/ViewModels/AppareilPiecesViewModel.cs
Normal file
@ -0,0 +1,119 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using MauiAppStock.Models;
|
||||||
|
using MauiAppStock.Data;
|
||||||
|
using MauiAppStock.Helpers;
|
||||||
|
|
||||||
|
namespace MauiAppStock.ViewModels
|
||||||
|
{
|
||||||
|
public class AppareilPiecesViewModel : BaseViewModel
|
||||||
|
{
|
||||||
|
private Appareil _appareil;
|
||||||
|
private List<AppareilPiece> _allAssociations;
|
||||||
|
|
||||||
|
public ObservableCollection<AppareilPiece> AppareilPieces { get; set; }
|
||||||
|
public ICommand LoadAssociationsCommand { get; }
|
||||||
|
|
||||||
|
private string _searchText;
|
||||||
|
public string SearchText
|
||||||
|
{
|
||||||
|
get => _searchText;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (SetProperty(ref _searchText, value))
|
||||||
|
{
|
||||||
|
ApplyFilterAndSort();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool _isAscending = true;
|
||||||
|
public bool IsAscending
|
||||||
|
{
|
||||||
|
get => _isAscending;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (SetProperty(ref _isAscending, value))
|
||||||
|
{
|
||||||
|
ApplyFilterAndSort();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public AppareilPiecesViewModel(Appareil appareil)
|
||||||
|
{
|
||||||
|
_appareil = appareil;
|
||||||
|
AppareilPieces = new ObservableCollection<AppareilPiece>();
|
||||||
|
_allAssociations = new List<AppareilPiece>();
|
||||||
|
LoadAssociationsCommand = new AsyncCommand(LoadAssociations);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task LoadAssociations()
|
||||||
|
{
|
||||||
|
_allAssociations = await Database.GetAppareilPiecesForAppareilAsync(_appareil.Id);
|
||||||
|
ApplyFilterAndSort();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ApplyFilterAndSort()
|
||||||
|
{
|
||||||
|
IEnumerable<AppareilPiece> filtered = _allAssociations;
|
||||||
|
|
||||||
|
// Filtrage par SearchText sur le nom de la pièce, en supprimant les diacritiques et en convertissant en minuscules.
|
||||||
|
if (!string.IsNullOrWhiteSpace(SearchText))
|
||||||
|
{
|
||||||
|
string searchNormalized = RemoveDiacritics(SearchText).ToLowerInvariant();
|
||||||
|
filtered = filtered.Where(a =>
|
||||||
|
!string.IsNullOrEmpty(a.NomPiece) &&
|
||||||
|
RemoveDiacritics(a.NomPiece).ToLowerInvariant().Contains(searchNormalized)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Séparation des associations recommandées et non recommandées
|
||||||
|
var recommended = filtered.Where(a => a.EstRecommandee);
|
||||||
|
var nonRecommended = filtered.Where(a => !a.EstRecommandee);
|
||||||
|
|
||||||
|
// Tri dans chaque groupe par ordre numérique (PieceId) puis alphabétique (NomPiece)
|
||||||
|
if (IsAscending)
|
||||||
|
{
|
||||||
|
recommended = recommended.OrderBy(a => a.PieceId).ThenBy(a => a.NomPiece);
|
||||||
|
nonRecommended = nonRecommended.OrderBy(a => a.PieceId).ThenBy(a => a.NomPiece);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
recommended = recommended.OrderByDescending(a => a.PieceId).ThenByDescending(a => a.NomPiece);
|
||||||
|
nonRecommended = nonRecommended.OrderByDescending(a => a.PieceId).ThenByDescending(a => a.NomPiece);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Les associations recommandées apparaissent en premier.
|
||||||
|
var sorted = recommended.Concat(nonRecommended);
|
||||||
|
|
||||||
|
AppareilPieces.Clear();
|
||||||
|
foreach (var assoc in sorted)
|
||||||
|
{
|
||||||
|
AppareilPieces.Add(assoc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Méthode pour supprimer les diacritiques (accents, cédilles, etc.)
|
||||||
|
private string RemoveDiacritics(string text)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(text))
|
||||||
|
return text;
|
||||||
|
|
||||||
|
var normalizedString = text.Normalize(NormalizationForm.FormD);
|
||||||
|
var stringBuilder = new StringBuilder();
|
||||||
|
|
||||||
|
foreach (var c in normalizedString)
|
||||||
|
{
|
||||||
|
if (CharUnicodeInfo.GetUnicodeCategory(c) != UnicodeCategory.NonSpacingMark)
|
||||||
|
stringBuilder.Append(c);
|
||||||
|
}
|
||||||
|
return stringBuilder.ToString().Normalize(NormalizationForm.FormC);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
42
MauiAppStock/ViewModels/AppareilsViewModel.cs
Normal file
42
MauiAppStock/ViewModels/AppareilsViewModel.cs
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using MauiAppStock.Models;
|
||||||
|
using MauiAppStock.Data;
|
||||||
|
using MauiAppStock.Helpers;
|
||||||
|
|
||||||
|
namespace MauiAppStock.ViewModels
|
||||||
|
{
|
||||||
|
public class AppareilsViewModel : BaseViewModel
|
||||||
|
{
|
||||||
|
public ObservableCollection<Appareil> Appareils { get; set; }
|
||||||
|
public ICommand LoadAppareilsCommand { get; }
|
||||||
|
public ICommand DeleteAppareilCommand { get; }
|
||||||
|
|
||||||
|
public AppareilsViewModel()
|
||||||
|
{
|
||||||
|
Appareils = new ObservableCollection<Appareil>();
|
||||||
|
LoadAppareilsCommand = new AsyncCommand(LoadAppareils);
|
||||||
|
DeleteAppareilCommand = new AsyncCommand<Appareil>(DeleteAppareil);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task LoadAppareils()
|
||||||
|
{
|
||||||
|
Appareils.Clear();
|
||||||
|
var appareilsList = await Database.GetAppareilsAsync();
|
||||||
|
foreach (var appareil in appareilsList)
|
||||||
|
{
|
||||||
|
Appareils.Add(appareil);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task DeleteAppareil(Appareil appareil)
|
||||||
|
{
|
||||||
|
if (appareil != null)
|
||||||
|
{
|
||||||
|
await Database.DeleteAppareilAsync(appareil);
|
||||||
|
Appareils.Remove(appareil);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
33
MauiAppStock/ViewModels/BaseViewModel.cs
Normal file
33
MauiAppStock/ViewModels/BaseViewModel.cs
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
|
namespace MauiAppStock.ViewModels
|
||||||
|
{
|
||||||
|
public class BaseViewModel : INotifyPropertyChanged
|
||||||
|
{
|
||||||
|
bool isBusy;
|
||||||
|
public bool IsBusy
|
||||||
|
{
|
||||||
|
get => isBusy;
|
||||||
|
set => SetProperty(ref isBusy, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected bool SetProperty<T>(ref T backingStore, T value, [CallerMemberName] string propertyName = "", System.Action onChanged = null)
|
||||||
|
{
|
||||||
|
if (EqualityComparer<T>.Default.Equals(backingStore, value))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
backingStore = value;
|
||||||
|
onChanged?.Invoke();
|
||||||
|
OnPropertyChanged(propertyName);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public event PropertyChangedEventHandler PropertyChanged;
|
||||||
|
protected void OnPropertyChanged([CallerMemberName] string propertyName = "")
|
||||||
|
{
|
||||||
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
31
MauiAppStock/ViewModels/PiecesViewModel.cs
Normal file
31
MauiAppStock/ViewModels/PiecesViewModel.cs
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using MauiAppStock.Models;
|
||||||
|
using MauiAppStock.Data;
|
||||||
|
using MauiAppStock.Helpers;
|
||||||
|
|
||||||
|
namespace MauiAppStock.ViewModels
|
||||||
|
{
|
||||||
|
public class PiecesViewModel : BaseViewModel
|
||||||
|
{
|
||||||
|
public ObservableCollection<Piece> Pieces { get; set; }
|
||||||
|
public ICommand LoadPiecesCommand { get; }
|
||||||
|
|
||||||
|
public PiecesViewModel()
|
||||||
|
{
|
||||||
|
Pieces = new ObservableCollection<Piece>();
|
||||||
|
LoadPiecesCommand = new AsyncCommand(LoadPieces);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task LoadPieces()
|
||||||
|
{
|
||||||
|
Pieces.Clear();
|
||||||
|
var piecesList = await Database.GetPiecesAsync();
|
||||||
|
foreach (var piece in piecesList)
|
||||||
|
{
|
||||||
|
Pieces.Add(piece);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
13
MauiAppStock/Views/AddAppareilPage.xaml
Normal file
13
MauiAppStock/Views/AddAppareilPage.xaml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<ContentPage
|
||||||
|
x:Class="MauiAppStock.Views.AddAppareilPage"
|
||||||
|
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
|
||||||
|
|
||||||
|
<StackLayout Padding="10">
|
||||||
|
<Label Text="Ajouter un Appareil" FontSize="24" HorizontalOptions="Center"/>
|
||||||
|
<Entry x:Name="NomEntry" Placeholder="Nom"/>
|
||||||
|
<Editor x:Name="DescriptionEditor" Placeholder="Description" HeightRequest="100"/>
|
||||||
|
<Button Text="Enregistrer" Clicked="OnSaveClicked"/>
|
||||||
|
</StackLayout>
|
||||||
|
</ContentPage>
|
24
MauiAppStock/Views/AddAppareilPage.xaml.cs
Normal file
24
MauiAppStock/Views/AddAppareilPage.xaml.cs
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
using MauiAppStock.Models;
|
||||||
|
using MauiAppStock.Data;
|
||||||
|
|
||||||
|
namespace MauiAppStock.Views
|
||||||
|
{
|
||||||
|
public partial class AddAppareilPage : ContentPage
|
||||||
|
{
|
||||||
|
public AddAppareilPage()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void OnSaveClicked(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var appareil = new Appareil
|
||||||
|
{
|
||||||
|
Nom = NomEntry.Text,
|
||||||
|
Description = DescriptionEditor.Text
|
||||||
|
};
|
||||||
|
await Database.AddAppareilAsync(appareil);
|
||||||
|
await Navigation.PopAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
15
MauiAppStock/Views/AddAppareilPiecePage.xaml
Normal file
15
MauiAppStock/Views/AddAppareilPiecePage.xaml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<ContentPage x:Class="MauiAppStock.Views.AddAppareilPiecePage"
|
||||||
|
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
|
||||||
|
<StackLayout Padding="10">
|
||||||
|
<Label Text="Associer une Pièce à l'Appareil" FontSize="24" HorizontalOptions="Center"/>
|
||||||
|
<Label Text="Sélectionnez une pièce:"/>
|
||||||
|
<Picker x:Name="PiecesPicker" Title="Pièces"/>
|
||||||
|
<StackLayout Orientation="Horizontal" VerticalOptions="Center">
|
||||||
|
<Label Text="Recommandée ?" VerticalOptions="Center"/>
|
||||||
|
<Switch x:Name="RecommandeeSwitch"/>
|
||||||
|
</StackLayout>
|
||||||
|
<Button Text="Enregistrer" Clicked="OnSaveClicked"/>
|
||||||
|
</StackLayout>
|
||||||
|
</ContentPage>
|
51
MauiAppStock/Views/AddAppareilPiecePage.xaml.cs
Normal file
51
MauiAppStock/Views/AddAppareilPiecePage.xaml.cs
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
using MauiAppStock.Models;
|
||||||
|
using MauiAppStock.Data;
|
||||||
|
using Microsoft.Maui.Controls;
|
||||||
|
|
||||||
|
namespace MauiAppStock.Views
|
||||||
|
{
|
||||||
|
public partial class AddAppareilPiecePage : ContentPage
|
||||||
|
{
|
||||||
|
private Appareil _appareil;
|
||||||
|
public AddAppareilPiecePage(Appareil appareil)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_appareil = appareil;
|
||||||
|
LoadPieces();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void LoadPieces()
|
||||||
|
{
|
||||||
|
var pieces = await Database.GetPiecesAsync();
|
||||||
|
PiecesPicker.ItemsSource = pieces;
|
||||||
|
PiecesPicker.ItemDisplayBinding = new Binding("Nom");
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void OnSaveClicked(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (PiecesPicker.SelectedItem is Piece selectedPiece)
|
||||||
|
{
|
||||||
|
// Vérification de l'existence d'une association pour cet appareil et cette pièce
|
||||||
|
var existingAssociation = await Database.GetAppareilPieceAsync(_appareil.Id, selectedPiece.Id);
|
||||||
|
if (existingAssociation != null)
|
||||||
|
{
|
||||||
|
await DisplayAlert("Erreur", "Cette pièce est déjà associée à cet appareil.", "OK");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var association = new AppareilPiece
|
||||||
|
{
|
||||||
|
AppareilId = _appareil.Id,
|
||||||
|
PieceId = selectedPiece.Id,
|
||||||
|
EstRecommandee = RecommandeeSwitch.IsToggled
|
||||||
|
};
|
||||||
|
await Database.AddAppareilPieceAsync(association);
|
||||||
|
await Navigation.PopAsync();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
await DisplayAlert("Erreur", "Veuillez sélectionner une pièce.", "OK");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
14
MauiAppStock/Views/AddPiecePage.xaml
Normal file
14
MauiAppStock/Views/AddPiecePage.xaml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<ContentPage x:Class="MauiAppStock.Views.AddPiecePage"
|
||||||
|
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
|
||||||
|
<StackLayout Padding="10">
|
||||||
|
<Label Text="Ajouter une Pièce" FontSize="24" HorizontalOptions="Center"/>
|
||||||
|
<Entry x:Name="NomEntry" Placeholder="Nom"/>
|
||||||
|
<Editor x:Name="DescriptionEditor" Placeholder="Description" HeightRequest="100"/>
|
||||||
|
<Entry x:Name="PrixEntry" Placeholder="Prix" Keyboard="Numeric"/>
|
||||||
|
<Entry x:Name="StockEntry" Placeholder="Stock" Keyboard="Numeric"/>
|
||||||
|
<Entry x:Name="FournisseurEntry" Placeholder="Fournisseur"/>
|
||||||
|
<Button Text="Enregistrer" Clicked="OnSaveClicked"/>
|
||||||
|
</StackLayout>
|
||||||
|
</ContentPage>
|
34
MauiAppStock/Views/AddPiecePage.xaml.cs
Normal file
34
MauiAppStock/Views/AddPiecePage.xaml.cs
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
using MauiAppStock.Models;
|
||||||
|
using MauiAppStock.Data;
|
||||||
|
|
||||||
|
namespace MauiAppStock.Views
|
||||||
|
{
|
||||||
|
public partial class AddPiecePage : ContentPage
|
||||||
|
{
|
||||||
|
public AddPiecePage()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void OnSaveClicked(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (double.TryParse(PrixEntry.Text, out double prix) && int.TryParse(StockEntry.Text, out int stock))
|
||||||
|
{
|
||||||
|
var piece = new Piece
|
||||||
|
{
|
||||||
|
Nom = NomEntry.Text,
|
||||||
|
Description = DescriptionEditor.Text,
|
||||||
|
Prix = prix,
|
||||||
|
Stock = stock,
|
||||||
|
Fournisseur = FournisseurEntry.Text
|
||||||
|
};
|
||||||
|
await Database.AddPieceAsync(piece);
|
||||||
|
await Navigation.PopAsync();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
await DisplayAlert("Erreur", "Veuillez vérifier les valeurs du prix et du stock.", "OK");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
47
MauiAppStock/Views/AppareilPiecesPage.xaml
Normal file
47
MauiAppStock/Views/AppareilPiecesPage.xaml
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<ContentPage x:Class="MauiAppStock.Views.AppareilPiecesPage"
|
||||||
|
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
|
||||||
|
<StackLayout Padding="10" Spacing="10">
|
||||||
|
<!-- Barre de recherche -->
|
||||||
|
<SearchBar Placeholder="Rechercher une pièce..." Text="{Binding SearchText}" />
|
||||||
|
|
||||||
|
<!-- Bouton de tri unique -->
|
||||||
|
<StackLayout Orientation="Horizontal" HorizontalOptions="Center" Spacing="10">
|
||||||
|
<Button Text="Trier" Clicked="OnToggleSortOrderClicked"/>
|
||||||
|
</StackLayout>
|
||||||
|
|
||||||
|
<!-- Liste des associations -->
|
||||||
|
<ListView x:Name="AssociationsListView" ItemsSource="{Binding AppareilPieces}"
|
||||||
|
IsPullToRefreshEnabled="True"
|
||||||
|
RefreshCommand="{Binding LoadAssociationsCommand}"
|
||||||
|
ItemTapped="OnAssociationTapped">
|
||||||
|
<ListView.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<ViewCell>
|
||||||
|
<Grid Padding="10" ColumnSpacing="10">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<StackLayout Grid.Column="0">
|
||||||
|
<Label Text="{Binding NomPiece}" FontSize="16"/>
|
||||||
|
<Label Text="{Binding DescriptionPiece}" FontSize="12" TextColor="Gray"/>
|
||||||
|
</StackLayout>
|
||||||
|
<Label Grid.Column="1" Text="Recommandé !" TextColor="Green" VerticalOptions="Center" IsVisible="False">
|
||||||
|
<Label.Triggers>
|
||||||
|
<DataTrigger TargetType="Label" Binding="{Binding EstRecommandee}" Value="True">
|
||||||
|
<Setter Property="IsVisible" Value="True"/>
|
||||||
|
</DataTrigger>
|
||||||
|
</Label.Triggers>
|
||||||
|
</Label>
|
||||||
|
</Grid>
|
||||||
|
</ViewCell>
|
||||||
|
</DataTemplate>
|
||||||
|
</ListView.ItemTemplate>
|
||||||
|
</ListView>
|
||||||
|
|
||||||
|
<!-- Bouton d'ajout d'une association -->
|
||||||
|
<Button Text="Ajouter une pièce" Clicked="OnAddPieceClicked"/>
|
||||||
|
</StackLayout>
|
||||||
|
</ContentPage>
|
46
MauiAppStock/Views/AppareilPiecesPage.xaml.cs
Normal file
46
MauiAppStock/Views/AppareilPiecesPage.xaml.cs
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
using MauiAppStock.Models;
|
||||||
|
using MauiAppStock.ViewModels;
|
||||||
|
|
||||||
|
namespace MauiAppStock.Views
|
||||||
|
{
|
||||||
|
public partial class AppareilPiecesPage : ContentPage
|
||||||
|
{
|
||||||
|
private Appareil _appareil;
|
||||||
|
|
||||||
|
public AppareilPiecesPage(Appareil appareil)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_appareil = appareil;
|
||||||
|
BindingContext = new AppareilPiecesViewModel(_appareil);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnAppearing()
|
||||||
|
{
|
||||||
|
base.OnAppearing();
|
||||||
|
var vm = BindingContext as AppareilPiecesViewModel;
|
||||||
|
vm?.LoadAssociationsCommand.Execute(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void OnAssociationTapped(object sender, ItemTappedEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Item is AppareilPiece assoc)
|
||||||
|
{
|
||||||
|
await Navigation.PushAsync(new EditAssociationPage(assoc));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void OnAddPieceClicked(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
await Navigation.PushAsync(new AddAppareilPiecePage(_appareil));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnToggleSortOrderClicked(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var vm = BindingContext as AppareilPiecesViewModel;
|
||||||
|
if (vm != null)
|
||||||
|
{
|
||||||
|
vm.IsAscending = !vm.IsAscending;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
29
MauiAppStock/Views/AppareilsPage.xaml
Normal file
29
MauiAppStock/Views/AppareilsPage.xaml
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<ContentPage
|
||||||
|
x:Class="MauiAppStock.Views.AppareilsPage"
|
||||||
|
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
|
xmlns:vm="clr-namespace:MauiAppStock.ViewModels">
|
||||||
|
|
||||||
|
<ContentPage.BindingContext>
|
||||||
|
<vm:AppareilsViewModel/>
|
||||||
|
</ContentPage.BindingContext>
|
||||||
|
|
||||||
|
<ContentPage.ToolbarItems>
|
||||||
|
<ToolbarItem Text="+" Clicked="OnAddAppareilClicked"/>
|
||||||
|
</ContentPage.ToolbarItems>
|
||||||
|
|
||||||
|
<StackLayout Padding="10">
|
||||||
|
<Label Text="Liste des Appareils" FontSize="24" HorizontalOptions="Center"/>
|
||||||
|
<ListView x:Name="AppareilsListView" ItemsSource="{Binding Appareils}"
|
||||||
|
IsPullToRefreshEnabled="True"
|
||||||
|
RefreshCommand="{Binding LoadAppareilsCommand}"
|
||||||
|
ItemTapped="OnAppareilTapped">
|
||||||
|
<ListView.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextCell Text="{Binding Nom}" Detail="{Binding Description}"/>
|
||||||
|
</DataTemplate>
|
||||||
|
</ListView.ItemTemplate>
|
||||||
|
</ListView>
|
||||||
|
</StackLayout>
|
||||||
|
</ContentPage>
|
35
MauiAppStock/Views/AppareilsPage.xaml.cs
Normal file
35
MauiAppStock/Views/AppareilsPage.xaml.cs
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
using MauiAppStock.Models;
|
||||||
|
using MauiAppStock.ViewModels;
|
||||||
|
|
||||||
|
namespace MauiAppStock.Views
|
||||||
|
{
|
||||||
|
public partial class AppareilsPage : ContentPage
|
||||||
|
{
|
||||||
|
public AppareilsPage()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnAppearing()
|
||||||
|
{
|
||||||
|
base.OnAppearing();
|
||||||
|
var viewModel = BindingContext as AppareilsViewModel;
|
||||||
|
viewModel.LoadAppareilsCommand.Execute(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void OnAddAppareilClicked(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
// Navigation vers la page d'ajout
|
||||||
|
await Navigation.PushAsync(new AddAppareilPage());
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void OnAppareilTapped(object sender, ItemTappedEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Item is Appareil selectedAppareil)
|
||||||
|
{
|
||||||
|
// Navigation vers la page d'édition avec l'appareil sélectionné
|
||||||
|
await Navigation.PushAsync(new EditAppareilPage(selectedAppareil));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
14
MauiAppStock/Views/EditAppareilPage.xaml
Normal file
14
MauiAppStock/Views/EditAppareilPage.xaml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<ContentPage
|
||||||
|
x:Class="MauiAppStock.Views.EditAppareilPage"
|
||||||
|
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
|
||||||
|
|
||||||
|
<StackLayout Padding="10">
|
||||||
|
<Label Text="Modifier l'Appareil" FontSize="24" HorizontalOptions="Center"/>
|
||||||
|
<Entry x:Name="NomEntry" Placeholder="Nom"/>
|
||||||
|
<Editor x:Name="DescriptionEditor" Placeholder="Description" HeightRequest="100"/>
|
||||||
|
<Button Text="Enregistrer" Clicked="OnSaveClicked"/>
|
||||||
|
<Button Text="Supprimer" Clicked="OnDeleteClicked" TextColor="Red"/>
|
||||||
|
</StackLayout>
|
||||||
|
</ContentPage>
|
35
MauiAppStock/Views/EditAppareilPage.xaml.cs
Normal file
35
MauiAppStock/Views/EditAppareilPage.xaml.cs
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
using MauiAppStock.Models;
|
||||||
|
using MauiAppStock.Data;
|
||||||
|
|
||||||
|
namespace MauiAppStock.Views
|
||||||
|
{
|
||||||
|
public partial class EditAppareilPage : ContentPage
|
||||||
|
{
|
||||||
|
private Appareil _appareil;
|
||||||
|
public EditAppareilPage(Appareil appareil)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_appareil = appareil;
|
||||||
|
NomEntry.Text = appareil.Nom;
|
||||||
|
DescriptionEditor.Text = appareil.Description;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void OnSaveClicked(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
_appareil.Nom = NomEntry.Text;
|
||||||
|
_appareil.Description = DescriptionEditor.Text;
|
||||||
|
await Database.UpdateAppareilAsync(_appareil);
|
||||||
|
await Navigation.PopAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void OnDeleteClicked(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
bool confirm = await DisplayAlert("Confirmation", "Voulez-vous vraiment supprimer cet appareil ?", "Oui", "Non");
|
||||||
|
if (confirm)
|
||||||
|
{
|
||||||
|
await Database.DeleteAppareilAsync(_appareil);
|
||||||
|
await Navigation.PopAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
17
MauiAppStock/Views/EditAssociationPage.xaml
Normal file
17
MauiAppStock/Views/EditAssociationPage.xaml
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<ContentPage x:Class="MauiAppStock.Views.EditAssociationPage"
|
||||||
|
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
|
||||||
|
<StackLayout Padding="20" Spacing="20">
|
||||||
|
<Label Text="Modifier l'association" FontSize="24" HorizontalOptions="Center"/>
|
||||||
|
<Label Text="Pièce:" FontAttributes="Bold"/>
|
||||||
|
<Label Text="{Binding NomPiece}" />
|
||||||
|
<Label Text="{Binding DescriptionPiece}" />
|
||||||
|
<StackLayout Orientation="Horizontal" VerticalOptions="Center">
|
||||||
|
<Label Text="Recommandée ?" VerticalOptions="Center"/>
|
||||||
|
<Switch IsToggled="{Binding EstRecommandee}" />
|
||||||
|
</StackLayout>
|
||||||
|
<Button Text="Sauvegarder" Clicked="OnSaveClicked"/>
|
||||||
|
<Button Text="Supprimer l'association" TextColor="Red" Clicked="OnDeleteClicked"/>
|
||||||
|
</StackLayout>
|
||||||
|
</ContentPage>
|
33
MauiAppStock/Views/EditAssociationPage.xaml.cs
Normal file
33
MauiAppStock/Views/EditAssociationPage.xaml.cs
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
using MauiAppStock.Models;
|
||||||
|
using MauiAppStock.Data;
|
||||||
|
|
||||||
|
namespace MauiAppStock.Views
|
||||||
|
{
|
||||||
|
public partial class EditAssociationPage : ContentPage
|
||||||
|
{
|
||||||
|
private AppareilPiece _association;
|
||||||
|
|
||||||
|
public EditAssociationPage(AppareilPiece association)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_association = association;
|
||||||
|
BindingContext = _association;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void OnSaveClicked(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
await Database.UpdateAppareilPieceAsync(_association);
|
||||||
|
await Navigation.PopAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void OnDeleteClicked(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
bool confirm = await DisplayAlert("Confirmation", "Voulez-vous supprimer cette association ?", "Oui", "Non");
|
||||||
|
if (confirm)
|
||||||
|
{
|
||||||
|
await Database.DeleteAppareilPieceAsync(_association);
|
||||||
|
await Navigation.PopAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
15
MauiAppStock/Views/EditPiecePage.xaml
Normal file
15
MauiAppStock/Views/EditPiecePage.xaml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<ContentPage x:Class="MauiAppStock.Views.EditPiecePage"
|
||||||
|
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
|
||||||
|
<StackLayout Padding="10">
|
||||||
|
<Label Text="Modifier la Pièce" FontSize="24" HorizontalOptions="Center"/>
|
||||||
|
<Entry x:Name="NomEntry" Placeholder="Nom"/>
|
||||||
|
<Editor x:Name="DescriptionEditor" Placeholder="Description" HeightRequest="100"/>
|
||||||
|
<Entry x:Name="PrixEntry" Placeholder="Prix" Keyboard="Numeric"/>
|
||||||
|
<Entry x:Name="StockEntry" Placeholder="Stock" Keyboard="Numeric"/>
|
||||||
|
<Entry x:Name="FournisseurEntry" Placeholder="Fournisseur"/>
|
||||||
|
<Button Text="Enregistrer" Clicked="OnSaveClicked"/>
|
||||||
|
<Button Text="Supprimer" Clicked="OnDeleteClicked" TextColor="Red"/>
|
||||||
|
</StackLayout>
|
||||||
|
</ContentPage>
|
48
MauiAppStock/Views/EditPiecePage.xaml.cs
Normal file
48
MauiAppStock/Views/EditPiecePage.xaml.cs
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
using MauiAppStock.Models;
|
||||||
|
using MauiAppStock.Data;
|
||||||
|
|
||||||
|
namespace MauiAppStock.Views
|
||||||
|
{
|
||||||
|
public partial class EditPiecePage : ContentPage
|
||||||
|
{
|
||||||
|
private Piece _piece;
|
||||||
|
public EditPiecePage(Piece piece)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_piece = piece;
|
||||||
|
NomEntry.Text = piece.Nom;
|
||||||
|
DescriptionEditor.Text = piece.Description;
|
||||||
|
PrixEntry.Text = piece.Prix.ToString();
|
||||||
|
StockEntry.Text = piece.Stock.ToString();
|
||||||
|
FournisseurEntry.Text = piece.Fournisseur;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void OnSaveClicked(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (double.TryParse(PrixEntry.Text, out double prix) && int.TryParse(StockEntry.Text, out int stock))
|
||||||
|
{
|
||||||
|
_piece.Nom = NomEntry.Text;
|
||||||
|
_piece.Description = DescriptionEditor.Text;
|
||||||
|
_piece.Prix = prix;
|
||||||
|
_piece.Stock = stock;
|
||||||
|
_piece.Fournisseur = FournisseurEntry.Text;
|
||||||
|
await Database.UpdatePieceAsync(_piece);
|
||||||
|
await Navigation.PopAsync();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
await DisplayAlert("Erreur", "Veuillez vérifier les valeurs du prix et du stock.", "OK");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void OnDeleteClicked(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
bool confirm = await DisplayAlert("Confirmation", "Voulez-vous vraiment supprimer cette pièce ?", "Oui", "Non");
|
||||||
|
if (confirm)
|
||||||
|
{
|
||||||
|
await Database.DeletePieceAsync(_piece);
|
||||||
|
await Navigation.PopAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
11
MauiAppStock/Views/MainPage.xaml
Normal file
11
MauiAppStock/Views/MainPage.xaml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<ContentPage x:Class="MauiAppStock.Views.MainPage"
|
||||||
|
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
|
||||||
|
<StackLayout Padding="20" Spacing="20" VerticalOptions="Center">
|
||||||
|
<Label Text="Menu Principal" FontSize="30" HorizontalOptions="Center" />
|
||||||
|
<Button Text="Gestion des Appareils" Clicked="OnAppareilsClicked" />
|
||||||
|
<Button Text="Gestion des Pièces" Clicked="OnPiecesClicked" />
|
||||||
|
<Button Text="Associer une Pièce à un Appareil" Clicked="OnAssocierPieceClicked" />
|
||||||
|
</StackLayout>
|
||||||
|
</ContentPage>
|
29
MauiAppStock/Views/MainPage.xaml.cs
Normal file
29
MauiAppStock/Views/MainPage.xaml.cs
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
using Microsoft.Maui.Controls;
|
||||||
|
using MauiAppStock.Views;
|
||||||
|
|
||||||
|
namespace MauiAppStock.Views
|
||||||
|
{
|
||||||
|
public partial class MainPage : ContentPage
|
||||||
|
{
|
||||||
|
public MainPage()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void OnAppareilsClicked(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
await Navigation.PushAsync(new AppareilsPage());
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void OnPiecesClicked(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
await Navigation.PushAsync(new PiecesPage());
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void OnAssocierPieceClicked(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
// On navigue vers une page qui permet de sélectionner un appareil pour ensuite associer une pièce.
|
||||||
|
await Navigation.PushAsync(new SelectAppareilForAssociationPage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
25
MauiAppStock/Views/PiecesPage.xaml
Normal file
25
MauiAppStock/Views/PiecesPage.xaml
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<ContentPage x:Class="MauiAppStock.Views.PiecesPage"
|
||||||
|
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
|
xmlns:vm="clr-namespace:MauiAppStock.ViewModels">
|
||||||
|
<ContentPage.BindingContext>
|
||||||
|
<vm:PiecesViewModel />
|
||||||
|
</ContentPage.BindingContext>
|
||||||
|
<ContentPage.ToolbarItems>
|
||||||
|
<ToolbarItem Text="+" Clicked="OnAddPieceClicked"/>
|
||||||
|
</ContentPage.ToolbarItems>
|
||||||
|
<StackLayout Padding="10">
|
||||||
|
<Label Text="Liste des Pièces" FontSize="24" HorizontalOptions="Center"/>
|
||||||
|
<ListView x:Name="PiecesListView" ItemsSource="{Binding Pieces}"
|
||||||
|
IsPullToRefreshEnabled="True"
|
||||||
|
RefreshCommand="{Binding LoadPiecesCommand}"
|
||||||
|
ItemTapped="OnPieceTapped">
|
||||||
|
<ListView.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextCell Text="{Binding Nom}" Detail="{Binding Description}"/>
|
||||||
|
</DataTemplate>
|
||||||
|
</ListView.ItemTemplate>
|
||||||
|
</ListView>
|
||||||
|
</StackLayout>
|
||||||
|
</ContentPage>
|
33
MauiAppStock/Views/PiecesPage.xaml.cs
Normal file
33
MauiAppStock/Views/PiecesPage.xaml.cs
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
using MauiAppStock.ViewModels;
|
||||||
|
using MauiAppStock.Models;
|
||||||
|
|
||||||
|
namespace MauiAppStock.Views
|
||||||
|
{
|
||||||
|
public partial class PiecesPage : ContentPage
|
||||||
|
{
|
||||||
|
public PiecesPage()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnAppearing()
|
||||||
|
{
|
||||||
|
base.OnAppearing();
|
||||||
|
var vm = BindingContext as PiecesViewModel;
|
||||||
|
vm.LoadPiecesCommand.Execute(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void OnAddPieceClicked(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
await Navigation.PushAsync(new AddPiecePage());
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void OnPieceTapped(object sender, ItemTappedEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Item is Piece piece)
|
||||||
|
{
|
||||||
|
await Navigation.PushAsync(new EditPiecePage(piece));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
15
MauiAppStock/Views/SelectAppareilForAssociationPage.xaml
Normal file
15
MauiAppStock/Views/SelectAppareilForAssociationPage.xaml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<ContentPage x:Class="MauiAppStock.Views.SelectAppareilForAssociationPage"
|
||||||
|
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
|
||||||
|
<StackLayout Padding="10">
|
||||||
|
<Label Text="Sélectionnez un Appareil" FontSize="24" HorizontalOptions="Center" />
|
||||||
|
<ListView x:Name="AppareilsListView" ItemTapped="OnAppareilTapped">
|
||||||
|
<ListView.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextCell Text="{Binding Nom}" Detail="{Binding Description}" />
|
||||||
|
</DataTemplate>
|
||||||
|
</ListView.ItemTemplate>
|
||||||
|
</ListView>
|
||||||
|
</StackLayout>
|
||||||
|
</ContentPage>
|
29
MauiAppStock/Views/SelectAppareilForAssociationPage.xaml.cs
Normal file
29
MauiAppStock/Views/SelectAppareilForAssociationPage.xaml.cs
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
using MauiAppStock.Models;
|
||||||
|
using MauiAppStock.Data;
|
||||||
|
|
||||||
|
namespace MauiAppStock.Views
|
||||||
|
{
|
||||||
|
public partial class SelectAppareilForAssociationPage : ContentPage
|
||||||
|
{
|
||||||
|
public SelectAppareilForAssociationPage()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
LoadAppareils();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void LoadAppareils()
|
||||||
|
{
|
||||||
|
var appareils = await Database.GetAppareilsAsync();
|
||||||
|
AppareilsListView.ItemsSource = appareils;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void OnAppareilTapped(object sender, ItemTappedEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Item is Appareil selectedAppareil)
|
||||||
|
{
|
||||||
|
// Une fois l'appareil sélectionné, on navigue vers la page qui liste ses pièces et permet d'en ajouter
|
||||||
|
await Navigation.PushAsync(new AppareilPiecesPage(selectedAppareil));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user