Compare commits

...

9 Commits

Author SHA1 Message Date
Matheo THIERRY 5d4ed6dd06 Merge branch 'developpement'
continuous-integration/drone/push Build is passing Details
2 years ago
Matheo THIERRY dae95895be base de base , fonctionnalité -
continuous-integration/drone/push Build is passing Details
2 years ago
Matheo THIERRY c321a864d2 Merge branch 'developpement'
continuous-integration/drone/push Build is passing Details
2 years ago
Matheo THIERRY 7af8f8cb0d fix bug Database previous merge conflict
continuous-integration/drone/push Build is passing Details
2 years ago
Matheo THIERRY ab50893242 SUPP old data structure
continuous-integration/drone/push Build is failing Details
2 years ago
Matheo THIERRY 365742508e conflit fix
continuous-integration/drone/push Build is failing Details
2 years ago
Matheo THIERRY 9b2afcc6b2 oublie de datamember sur note
2 years ago
Liam MONCHANIN b113d34ecc navigation et connexion qui fonctionne
continuous-integration/drone/push Build was killed Details
2 years ago
Liam MONCHANIN 87533de711 Binding essai encore
continuous-integration/drone/push Build was killed Details
2 years ago

@ -7,6 +7,7 @@ using System.Linq;
using System.Runtime.Serialization; using System.Runtime.Serialization;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Web;
namespace Biblioteque_de_Class namespace Biblioteque_de_Class
{ {
@ -18,7 +19,14 @@ namespace Biblioteque_de_Class
[DataMember] [DataMember]
public List<Theme> ThemeList { get; private set; } public List<Theme> ThemeList { get; private set; }
[DataMember] [DataMember]
public List<User> UserList { get; private set; } public List<User> Users;
public List<User> UserList
{
get => Users; private set
{
Users = value;
}
}
public Database() public Database()
{ {
@ -70,7 +78,7 @@ namespace Biblioteque_de_Class
return user; return user;
} }
} }
throw new AlreadyUsedException("No user found with this username."); throw new NotFoundException("No user found with this username.");
} }
/// <summary> /// <summary>
@ -104,12 +112,16 @@ namespace Biblioteque_de_Class
{ {
throw new AlreadyUsedException("Username already used."); throw new AlreadyUsedException("Username already used.");
} }
else if (existingUser.Email == user.Email) else if (user.Email != "")
{ {
throw new AlreadyUsedException("Email already used."); if (existingUser.Email == user.Email)
{
throw new AlreadyUsedException("Email already used.");
}
} }
} }
UserList.Add(user); UserList.Add(user);
user.CreateNote("", ""); // création d'une note vide pour l'utilisateur
} }
/// <summary> /// <summary>

@ -1,15 +1,13 @@
using System; using System.ComponentModel;
using System.Collections.Generic; using System.Drawing;
using System.Linq;
using System.Runtime.Serialization; using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace Biblioteque_de_Class namespace Biblioteque_de_Class
{ {
[DataContract(IsReference = true)] [DataContract(IsReference = true)]
public class Note public class Note : INotifyPropertyChanged
{ {
[DataMember]
public int id { get; init; } public int id { get; init; }
[DataMember] [DataMember]
private string name; private string name;
@ -17,11 +15,17 @@ namespace Biblioteque_de_Class
public string Name public string Name
{ {
get { return name; } get { return name; }
set { if (value == null) { name = "Unnamed Note"; } else { name = value; } } set { if (value == "") { name = "Unnamed Note"; } else { name = value; } OnPropertyChanged(nameof(Name)); }
} }
[DataMember] [DataMember]
public string Text { get; private set; } = ""; private string text;
public string Text {
get => text;
set {
text = value;
OnPropertyChanged(nameof(Text));
} }
[DataMember] [DataMember]
private string logoPath; private string logoPath;
@ -29,7 +33,7 @@ namespace Biblioteque_de_Class
public string LogoPath public string LogoPath
{ {
get { return logoPath; } get { return logoPath; }
private set { if (value == null) { logoPath = "PATH TO DEFAULT LOGO"; } else { logoPath = value; } } private set { if (value == "") { logoPath = "PATH TO DEFAULT LOGO"; } else { logoPath = value; } OnPropertyChanged(nameof(LogoPath)); }
} }
[DataMember] [DataMember]
@ -44,7 +48,23 @@ namespace Biblioteque_de_Class
public List<User> Editors { get; private set; } public List<User> Editors { get; private set; }
[DataMember] [DataMember]
public User Owner { get; private set; } public User Owner { get; private set; }
public bool isfavorite;
public bool IsFavorite
{
get => isfavorite;
set
{
isfavorite = value;
OnPropertyChanged(nameof(IsFavorite));
}
}
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
public Note(int initId,string name, string logoPath, User owner) public Note(int initId,string name, string logoPath, User owner)
{ {
id = initId; id = initId;

@ -1,52 +1,52 @@
using Microsoft.VisualBasic; using Microsoft.VisualBasic;
namespace Biblioteque_de_Class namespace Biblioteque_de_Class
{ {
public class PersistenceManager public class PersistenceManager
{ {
private Database db = new(); private Database db = new Database();
private readonly IManager persistence; private readonly IManager persistence;
public PersistenceManager(IManager pers) public PersistenceManager(IManager pers)
{ {
persistence = pers; persistence = pers;
}
public void SaveDatabaseData(Database database)
{
persistence.SaveDatabaseData(database.UserList);
} }
public void SaveDatabaseData(Database database)
{
persistence.SaveDatabaseData(database.UserList);
}
public void SaveDefaultData(Database database) public void SaveDefaultData(Database database)
{ {
persistence.SaveDefaultData(database.ThemeList, database.DefaultLogoList); persistence.SaveDefaultData(database.ThemeList, database.DefaultLogoList);
} }
public Database LoadDatabaseData() public Database LoadDatabaseData()
{
db.SetUserList(persistence.LoadDatabaseData());
db.SetDefaultThemeList(persistence.LoadDefaultTheme());
db.SetDefaultLogoList(persistence.LoadDefaultLogo());
return db;
}
public Database GetOnlyDatabaseUser()
{ {
db.SetUserList(persistence.LoadDatabaseData()); db.SetUserList(persistence.LoadDatabaseData());
db.SetDefaultThemeList(persistence.LoadDefaultTheme());
db.SetDefaultLogoList(persistence.LoadDefaultLogo());
return db; return db;
} }
public Database GetOnlyDatabaseDefaultTheme() public Database GetOnlyDatabaseUser()
{
db.SetUserList(persistence.LoadDatabaseData());
return db;
}
public Database GetOnlyDatabaseDefaultTheme()
{ {
db.SetDefaultThemeList(persistence.LoadDefaultTheme()); db.SetDefaultThemeList(persistence.LoadDefaultTheme());
return db; return db;
} }
public Database GetOnlyDatabaseDefaultLogo() public Database GetOnlyDatabaseDefaultLogo()
{ {
db.SetDefaultLogoList(persistence.LoadDefaultLogo()); db.SetDefaultLogoList(persistence.LoadDefaultLogo());
return db; return db;
} }
} }
} }

@ -1,5 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq; using System.Linq;
using System.Runtime.Serialization; using System.Runtime.Serialization;
using System.Text; using System.Text;
@ -11,10 +13,40 @@ namespace Biblioteque_de_Class
public class Tags public class Tags
{ {
[DataMember] [DataMember]
public string Name { get; set; } private string name;
public string Name
{
get { return name; }
set
{
if (name != value)
{
name = value;
OnPropertyChanged(nameof(Name));
}
}
}
[DataMember] [DataMember]
public string Color { get; set; } private string color;
public string Color
{
get { return color; }
set
{
if (color != value)
{
color = value;
OnPropertyChanged(nameof(Color));
}
}
}
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
public Tags(string name, string color) public Tags(string name, string color)
{ {
Name = name; Name = name;

@ -6,29 +6,158 @@ using System.Runtime.Serialization;
namespace Biblioteque_de_Class namespace Biblioteque_de_Class
{ {
[DataContract] [DataContract]
public class User public class User : INotifyPropertyChanged
{ {
public event PropertyChangedEventHandler PropertyChanged;
void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
[DataMember] [DataMember]
public string Username { get; set; } private string username;
public string Username
{
get { return username; }
set
{
if (username == value)
return;
username = value;
OnPropertyChanged(nameof(Username));
}
}
[DataMember] [DataMember]
public string Email { get; private set; } private string email;
public string Email
{
get { return email; }
set
{
if (email == value)
return;
email = value;
OnPropertyChanged(nameof(Email));
}
}
[DataMember] [DataMember]
public string Password { get; private set; } private string password;
public string Password
{
get { return password; }
set
{
if (password == value)
return;
password = value;
OnPropertyChanged(nameof(Password));
}
}
[DataMember] [DataMember]
public string Picture { get; private set; } private string picture;
public string Picture
{
get { return picture; }
set
{
if (picture == value)
return;
picture = value;
OnPropertyChanged(nameof(Picture));
}
}
[DataMember] [DataMember]
public Theme UseTheme { get; set; } private Theme useTheme;
public Theme UseTheme
{
get { return useTheme; }
set
{
if (useTheme == value)
return;
useTheme = value;
OnPropertyChanged(nameof(UseTheme));
}
}
[DataMember] [DataMember]
public List<Note> NoteList { get; set; } private List<Note> noteList;
public List<Note> NoteList
{
get { return noteList; }
set
{
if (noteList == value)
return;
noteList = value;
OnPropertyChanged(nameof(NoteList));
}
}
[DataMember] [DataMember]
public List<Tags> TagList { get; private set; } private List<Tags> tagList;
public List<Tags> TagList
{
get { return tagList; }
set
{
if (tagList == value)
return;
tagList = value;
OnPropertyChanged(nameof(TagList));
}
}
[DataMember] [DataMember]
public List<Note> FavList { get; private set; } private List<Note> favList;
public List<Note> FavList
{
get { return favList; }
set
{
if (favList == value)
return;
favList = value;
OnPropertyChanged(nameof(FavList));
}
}
[DataMember(EmitDefaultValue = false)] [DataMember(EmitDefaultValue = false)]
public bool IsConnected { get; set; } private bool isConnected;
public bool IsConnected
{
get { return isConnected; }
set
{
if (isConnected == value)
return;
isConnected = value;
OnPropertyChanged(nameof(IsConnected));
}
}
[DataMember] [DataMember]
public Dictionary<Note, List<Tags>> NoteTagged { get; set; } private Dictionary<Note, List<Tags>> noteTagged;
public List<Theme> AddedTheme { get; set; } public Dictionary<Note, List<Tags>> NoteTagged
{
get { return noteTagged; }
set
{
if (noteTagged == value)
return;
noteTagged = value;
OnPropertyChanged(nameof(NoteTagged));
}
}
[DataMember]
private List<Theme> addedTheme;
public List<Theme> AddedTheme
{
get { return addedTheme; }
set
{
if (addedTheme == value)
return;
addedTheme = value;
OnPropertyChanged(nameof(AddedTheme));
}
}
public User(string username, string email, string password) public User(string username, string email, string password)
{ {
@ -43,7 +172,6 @@ namespace Biblioteque_de_Class
NoteTagged = new Dictionary<Note, List<Tags>>(); NoteTagged = new Dictionary<Note, List<Tags>>();
AddedTheme = new List<Theme>(); AddedTheme = new List<Theme>();
} }
public override string ToString() => $"username: {Username}\nemail: {Email}\npassword: {Password}\nOwned notes: {NoteList.Count}"; public override string ToString() => $"username: {Username}\nemail: {Email}\npassword: {Password}\nOwned notes: {NoteList.Count}";
/// <summary> /// <summary>
@ -162,6 +290,7 @@ namespace Biblioteque_de_Class
throw new AlreadyExistException("Note already in favorites"); throw new AlreadyExistException("Note already in favorites");
} }
FavList.Add(note); FavList.Add(note);
note.IsFavorite = true;
} }
/// <summary> /// <summary>
@ -172,6 +301,7 @@ namespace Biblioteque_de_Class
if (FavList.Contains(note)) if (FavList.Contains(note))
{ {
FavList.Remove(note); FavList.Remove(note);
note.IsFavorite = false;
} }
else else
{ {
@ -184,11 +314,14 @@ namespace Biblioteque_de_Class
/// </summary> /// </summary>
public Note CreateNote(string name, string imagePath) public Note CreateNote(string name, string imagePath)
{ {
foreach (Note existingNote in NoteList) if (name != "")
{ {
if (existingNote.Name == name) foreach (Note existingNote in NoteList)
{ {
throw new AlreadyExistException("Note already exists"); if (existingNote.Name == name)
{
throw new AlreadyExistException("Note already exists");
}
} }
} }
Note note; Note note;

@ -1,496 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Database xmlns:i="http://www.w3.org/2001/XMLSchema-instance" i:type="ArrayOfUser" xmlns="http://schemas.datacontract.org/2004/07/Biblioteque_de_Class">
<User>
<Email>leHeros@gmail.com</Email>
<FavList />
<NoteList>
<Note z:Id="i1" xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/">
<Collaborators>
<User>
<Email>labsent@gmail.com</Email>
<FavList />
<NoteList>
<Note z:Id="i2">
<Collaborators />
<CreationDate xmlns:d9p1="http://schemas.datacontract.org/2004/07/System" />
<Editors>
<User>
<Email>labsent@gmail.com</Email>
<FavList />
<NoteList>
<Note z:Ref="i2" />
<Note z:Ref="i1" />
</NoteList>
<NoteTagged xmlns:d11p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d11p1:KeyValueOfNoteArrayOfTagsw0Ob5Kw8>
<d11p1:Key z:Ref="i2" />
<d11p1:Value />
</d11p1:KeyValueOfNoteArrayOfTagsw0Ob5Kw8>
</NoteTagged>
<Password>fa7d77716ab4b614012aef71d589ef1bd018e1e25438c8546d1a2ce83b52c5c4</Password>
<Picture>defaultpicture.png</Picture>
<TagList>
<Tags>
<Color>#5555FF</Color>
<Name>Tag 1</Name>
</Tags>
</TagList>
<UseTheme>
<ColorList xmlns:d12p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d12p1:string>,,</d12p1:string>
</ColorList>
<Name></Name>
</UseTheme>
<Username>Benjamin</Username>
</User>
</Editors>
<ImageList />
<LogoPath>DefaultLogo.png</LogoPath>
<ModificationDate xmlns:d9p1="http://schemas.datacontract.org/2004/07/System" />
<Name>Note 1</Name>
<Owner>
<Email>labsent@gmail.com</Email>
<FavList />
<NoteList>
<Note z:Ref="i2" />
<Note z:Ref="i1" />
</NoteList>
<NoteTagged xmlns:d10p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d10p1:KeyValueOfNoteArrayOfTagsw0Ob5Kw8>
<d10p1:Key z:Ref="i2" />
<d10p1:Value />
</d10p1:KeyValueOfNoteArrayOfTagsw0Ob5Kw8>
</NoteTagged>
<Password>fa7d77716ab4b614012aef71d589ef1bd018e1e25438c8546d1a2ce83b52c5c4</Password>
<Picture>defaultpicture.png</Picture>
<TagList>
<Tags>
<Color>#5555FF</Color>
<Name>Tag 1</Name>
</Tags>
</TagList>
<UseTheme>
<ColorList xmlns:d11p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d11p1:string>,,</d11p1:string>
</ColorList>
<Name></Name>
</UseTheme>
<Username>Benjamin</Username>
</Owner>
<Text></Text>
<logoPath>DefaultLogo.png</logoPath>
<name>Note 1</name>
</Note>
<Note z:Ref="i1" />
</NoteList>
<NoteTagged xmlns:d7p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d7p1:KeyValueOfNoteArrayOfTagsw0Ob5Kw8>
<d7p1:Key z:Ref="i2" />
<d7p1:Value />
</d7p1:KeyValueOfNoteArrayOfTagsw0Ob5Kw8>
</NoteTagged>
<Password>fa7d77716ab4b614012aef71d589ef1bd018e1e25438c8546d1a2ce83b52c5c4</Password>
<Picture>defaultpicture.png</Picture>
<TagList>
<Tags>
<Color>#5555FF</Color>
<Name>Tag 1</Name>
</Tags>
</TagList>
<UseTheme>
<ColorList xmlns:d8p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d8p1:string>,,</d8p1:string>
</ColorList>
<Name></Name>
</UseTheme>
<Username>Benjamin</Username>
</User>
<User>
<Email>liammonchanin@gmail.com</Email>
<FavList />
<NoteList>
<Note z:Id="i3">
<Collaborators />
<CreationDate xmlns:d9p1="http://schemas.datacontract.org/2004/07/System" />
<Editors>
<User>
<Email>liammonchanin@gmail.com</Email>
<FavList />
<NoteList>
<Note z:Ref="i3" />
<Note z:Ref="i1" />
</NoteList>
<NoteTagged xmlns:d11p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d11p1:KeyValueOfNoteArrayOfTagsw0Ob5Kw8>
<d11p1:Key z:Ref="i3" />
<d11p1:Value />
</d11p1:KeyValueOfNoteArrayOfTagsw0Ob5Kw8>
</NoteTagged>
<Password>dd13d2e59703e108138db99aadebdc3e308e175d5649061baf2764ab6c039a9b</Password>
<Picture>defaultpicture.png</Picture>
<TagList>
<Tags>
<Color>#5555FF</Color>
<Name>Tag 2</Name>
</Tags>
</TagList>
<UseTheme>
<ColorList xmlns:d12p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d12p1:string>,,</d12p1:string>
</ColorList>
<Name></Name>
</UseTheme>
<Username>Liam</Username>
</User>
</Editors>
<ImageList />
<LogoPath>DefaultLogo.png</LogoPath>
<ModificationDate xmlns:d9p1="http://schemas.datacontract.org/2004/07/System" />
<Name>Note 2</Name>
<Owner>
<Email>liammonchanin@gmail.com</Email>
<FavList />
<NoteList>
<Note z:Ref="i3" />
<Note z:Ref="i1" />
</NoteList>
<NoteTagged xmlns:d10p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d10p1:KeyValueOfNoteArrayOfTagsw0Ob5Kw8>
<d10p1:Key z:Ref="i3" />
<d10p1:Value />
</d10p1:KeyValueOfNoteArrayOfTagsw0Ob5Kw8>
</NoteTagged>
<Password>dd13d2e59703e108138db99aadebdc3e308e175d5649061baf2764ab6c039a9b</Password>
<Picture>defaultpicture.png</Picture>
<TagList>
<Tags>
<Color>#5555FF</Color>
<Name>Tag 2</Name>
</Tags>
</TagList>
<UseTheme>
<ColorList xmlns:d11p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d11p1:string>,,</d11p1:string>
</ColorList>
<Name></Name>
</UseTheme>
<Username>Liam</Username>
</Owner>
<Text></Text>
<logoPath>DefaultLogo.png</logoPath>
<name>Note 2</name>
</Note>
<Note z:Ref="i1" />
</NoteList>
<NoteTagged xmlns:d7p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d7p1:KeyValueOfNoteArrayOfTagsw0Ob5Kw8>
<d7p1:Key z:Ref="i3" />
<d7p1:Value />
</d7p1:KeyValueOfNoteArrayOfTagsw0Ob5Kw8>
</NoteTagged>
<Password>dd13d2e59703e108138db99aadebdc3e308e175d5649061baf2764ab6c039a9b</Password>
<Picture>defaultpicture.png</Picture>
<TagList>
<Tags>
<Color>#5555FF</Color>
<Name>Tag 2</Name>
</Tags>
</TagList>
<UseTheme>
<ColorList xmlns:d8p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d8p1:string>,,</d8p1:string>
</ColorList>
<Name></Name>
</UseTheme>
<Username>Liam</Username>
</User>
</Collaborators>
<CreationDate xmlns:d5p1="http://schemas.datacontract.org/2004/07/System" />
<Editors>
<User>
<Email>leHeros@gmail.com</Email>
<FavList />
<NoteList>
<Note z:Ref="i1" />
</NoteList>
<NoteTagged xmlns:d7p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d7p1:KeyValueOfNoteArrayOfTagsw0Ob5Kw8>
<d7p1:Key z:Ref="i1" />
<d7p1:Value>
<Tags>
<Color>#5555FF</Color>
<Name>Tag 0</Name>
</Tags>
</d7p1:Value>
</d7p1:KeyValueOfNoteArrayOfTagsw0Ob5Kw8>
</NoteTagged>
<Password>2cbb89e6f9b003468ecfc7957b6c2a2da22c8e2f600cb115323800dc0da20467</Password>
<Picture>defaultpicture.png</Picture>
<TagList>
<Tags>
<Color>#5555FF</Color>
<Name>Tag 0</Name>
</Tags>
</TagList>
<UseTheme>
<ColorList xmlns:d8p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d8p1:string>,,</d8p1:string>
</ColorList>
<Name></Name>
</UseTheme>
<Username>Nicolas</Username>
</User>
<User>
<Email>liammonchanin@gmail.com</Email>
<FavList />
<NoteList>
<Note z:Ref="i3" />
<Note z:Ref="i1" />
</NoteList>
<NoteTagged xmlns:d7p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d7p1:KeyValueOfNoteArrayOfTagsw0Ob5Kw8>
<d7p1:Key z:Ref="i3" />
<d7p1:Value />
</d7p1:KeyValueOfNoteArrayOfTagsw0Ob5Kw8>
</NoteTagged>
<Password>dd13d2e59703e108138db99aadebdc3e308e175d5649061baf2764ab6c039a9b</Password>
<Picture>defaultpicture.png</Picture>
<TagList>
<Tags>
<Color>#5555FF</Color>
<Name>Tag 2</Name>
</Tags>
</TagList>
<UseTheme>
<ColorList xmlns:d8p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d8p1:string>,,</d8p1:string>
</ColorList>
<Name></Name>
</UseTheme>
<Username>Liam</Username>
</User>
</Editors>
<ImageList />
<LogoPath>DefaultLogo.png</LogoPath>
<ModificationDate xmlns:d5p1="http://schemas.datacontract.org/2004/07/System" />
<Name>Note 0</Name>
<Owner>
<Email>leHeros@gmail.com</Email>
<FavList />
<NoteList>
<Note z:Ref="i1" />
</NoteList>
<NoteTagged xmlns:d6p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d6p1:KeyValueOfNoteArrayOfTagsw0Ob5Kw8>
<d6p1:Key z:Ref="i1" />
<d6p1:Value>
<Tags>
<Color>#5555FF</Color>
<Name>Tag 0</Name>
</Tags>
</d6p1:Value>
</d6p1:KeyValueOfNoteArrayOfTagsw0Ob5Kw8>
</NoteTagged>
<Password>2cbb89e6f9b003468ecfc7957b6c2a2da22c8e2f600cb115323800dc0da20467</Password>
<Picture>defaultpicture.png</Picture>
<TagList>
<Tags>
<Color>#5555FF</Color>
<Name>Tag 0</Name>
</Tags>
</TagList>
<UseTheme>
<ColorList xmlns:d7p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d7p1:string>,,</d7p1:string>
</ColorList>
<Name></Name>
</UseTheme>
<Username>Nicolas</Username>
</Owner>
<Text></Text>
<logoPath>DefaultLogo.png</logoPath>
<name>Note 0</name>
</Note>
</NoteList>
<NoteTagged xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d3p1:KeyValueOfNoteArrayOfTagsw0Ob5Kw8>
<d3p1:Key z:Ref="i1" xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/" />
<d3p1:Value>
<Tags>
<Color>#5555FF</Color>
<Name>Tag 0</Name>
</Tags>
</d3p1:Value>
</d3p1:KeyValueOfNoteArrayOfTagsw0Ob5Kw8>
</NoteTagged>
<Password>2cbb89e6f9b003468ecfc7957b6c2a2da22c8e2f600cb115323800dc0da20467</Password>
<Picture>defaultpicture.png</Picture>
<TagList>
<Tags>
<Color>#5555FF</Color>
<Name>Tag 0</Name>
</Tags>
</TagList>
<UseTheme>
<ColorList xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d4p1:string>,,</d4p1:string>
</ColorList>
<Name></Name>
</UseTheme>
<Username>Nicolas</Username>
</User>
<User>
<Email>labsent@gmail.com</Email>
<FavList />
<NoteList>
<Note z:Ref="i2" xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/" />
<Note z:Ref="i1" xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/" />
</NoteList>
<NoteTagged xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d3p1:KeyValueOfNoteArrayOfTagsw0Ob5Kw8>
<d3p1:Key z:Ref="i2" xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/" />
<d3p1:Value />
</d3p1:KeyValueOfNoteArrayOfTagsw0Ob5Kw8>
</NoteTagged>
<Password>fa7d77716ab4b614012aef71d589ef1bd018e1e25438c8546d1a2ce83b52c5c4</Password>
<Picture>defaultpicture.png</Picture>
<TagList>
<Tags>
<Color>#5555FF</Color>
<Name>Tag 1</Name>
</Tags>
</TagList>
<UseTheme>
<ColorList xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d4p1:string>,,</d4p1:string>
</ColorList>
<Name></Name>
</UseTheme>
<Username>Benjamin</Username>
</User>
<User>
<Email>liammonchanin@gmail.com</Email>
<FavList />
<NoteList>
<Note z:Ref="i3" xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/" />
<Note z:Ref="i1" xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/" />
</NoteList>
<NoteTagged xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d3p1:KeyValueOfNoteArrayOfTagsw0Ob5Kw8>
<d3p1:Key z:Ref="i3" xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/" />
<d3p1:Value />
</d3p1:KeyValueOfNoteArrayOfTagsw0Ob5Kw8>
</NoteTagged>
<Password>dd13d2e59703e108138db99aadebdc3e308e175d5649061baf2764ab6c039a9b</Password>
<Picture>defaultpicture.png</Picture>
<TagList>
<Tags>
<Color>#5555FF</Color>
<Name>Tag 2</Name>
</Tags>
</TagList>
<UseTheme>
<ColorList xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d4p1:string>,,</d4p1:string>
</ColorList>
<Name></Name>
</UseTheme>
<Username>Liam</Username>
</User>
<User>
<Email>Macroutte@gmail.com</Email>
<FavList />
<NoteList>
<Note z:Id="i4" xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/">
<Collaborators />
<CreationDate xmlns:d5p1="http://schemas.datacontract.org/2004/07/System" />
<Editors>
<User>
<Email>Macroutte@gmail.com</Email>
<FavList />
<NoteList>
<Note z:Ref="i4" />
</NoteList>
<NoteTagged xmlns:d7p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d7p1:KeyValueOfNoteArrayOfTagsw0Ob5Kw8>
<d7p1:Key z:Ref="i4" />
<d7p1:Value />
</d7p1:KeyValueOfNoteArrayOfTagsw0Ob5Kw8>
</NoteTagged>
<Password>2dd6f72e332902136f9f27bcae97ccf3dab2cfc45f5cea43a7fbb91847b04716</Password>
<Picture>defaultpicture.png</Picture>
<TagList>
<Tags>
<Color>#5555FF</Color>
<Name>Tag 3</Name>
</Tags>
</TagList>
<UseTheme>
<ColorList xmlns:d8p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d8p1:string>,,</d8p1:string>
</ColorList>
<Name></Name>
</UseTheme>
<Username>Brigitte</Username>
</User>
</Editors>
<ImageList />
<LogoPath>DefaultLogo.png</LogoPath>
<ModificationDate xmlns:d5p1="http://schemas.datacontract.org/2004/07/System" />
<Name>Note 3</Name>
<Owner>
<Email>Macroutte@gmail.com</Email>
<FavList />
<NoteList>
<Note z:Ref="i4" />
</NoteList>
<NoteTagged xmlns:d6p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d6p1:KeyValueOfNoteArrayOfTagsw0Ob5Kw8>
<d6p1:Key z:Ref="i4" />
<d6p1:Value />
</d6p1:KeyValueOfNoteArrayOfTagsw0Ob5Kw8>
</NoteTagged>
<Password>2dd6f72e332902136f9f27bcae97ccf3dab2cfc45f5cea43a7fbb91847b04716</Password>
<Picture>defaultpicture.png</Picture>
<TagList>
<Tags>
<Color>#5555FF</Color>
<Name>Tag 3</Name>
</Tags>
</TagList>
<UseTheme>
<ColorList xmlns:d7p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d7p1:string>,,</d7p1:string>
</ColorList>
<Name></Name>
</UseTheme>
<Username>Brigitte</Username>
</Owner>
<Text></Text>
<logoPath>DefaultLogo.png</logoPath>
<name>Note 3</name>
</Note>
</NoteList>
<NoteTagged xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d3p1:KeyValueOfNoteArrayOfTagsw0Ob5Kw8>
<d3p1:Key z:Ref="i4" xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/" />
<d3p1:Value />
</d3p1:KeyValueOfNoteArrayOfTagsw0Ob5Kw8>
</NoteTagged>
<Password>2dd6f72e332902136f9f27bcae97ccf3dab2cfc45f5cea43a7fbb91847b04716</Password>
<Picture>defaultpicture.png</Picture>
<TagList>
<Tags>
<Color>#5555FF</Color>
<Name>Tag 3</Name>
</Tags>
</TagList>
<UseTheme>
<ColorList xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d4p1:string>,,</d4p1:string>
</ColorList>
<Name></Name>
</UseTheme>
<Username>Brigitte</Username>
</User>
</Database>

@ -7,8 +7,8 @@ using System.Security.Cryptography;
using System.Text; using System.Text;
// load database // load database
PersistenceManager managerLoad = new(new ToXML()); PersistenceManager manager = new PersistenceManager(new Stub());
Database db = managerLoad.LoadDatabaseData(); Database db = manager.LoadDatabaseData();
//save database //save database
PersistenceManager managerSave = new(new ToXML()); PersistenceManager managerSave = new(new ToXML());

@ -63,7 +63,7 @@ namespace UnitTests_Model
public void GetUser_UserDoesNotExist_ThrowsException() public void GetUser_UserDoesNotExist_ThrowsException()
{ {
string userName = "Eve"; string userName = "Eve";
Assert.Throws<AlreadyUsedException>(() => database.GetUser(userName)); Assert.Throws<NotFoundException>(() => database.GetUser(userName));
} }
// ComparePassword tests // ComparePassword tests

@ -6,7 +6,10 @@ MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Notus_Vue", "notus_vue\Notus_Vue.csproj", "{561264A1-4611-40FB-A662-3EF65550CA71}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Notus_Vue", "notus_vue\Notus_Vue.csproj", "{561264A1-4611-40FB-A662-3EF65550CA71}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
{184478A9-E14F-42E0-B963-B3A4474C9C1C} = {184478A9-E14F-42E0-B963-B3A4474C9C1C} {184478A9-E14F-42E0-B963-B3A4474C9C1C} = {184478A9-E14F-42E0-B963-B3A4474C9C1C}
{7B7F1062-9498-44E5-AC77-84BC90A3B730} = {7B7F1062-9498-44E5-AC77-84BC90A3B730}
{92DD50C5-EEAD-44ED-AEFF-E21935725477} = {92DD50C5-EEAD-44ED-AEFF-E21935725477} {92DD50C5-EEAD-44ED-AEFF-E21935725477} = {92DD50C5-EEAD-44ED-AEFF-E21935725477}
{AFCEAA99-3A25-4E9E-B498-72DD76A6B7FF} = {AFCEAA99-3A25-4E9E-B498-72DD76A6B7FF}
{EE443C17-B31D-4AD0-9141-920876E7DF79} = {EE443C17-B31D-4AD0-9141-920876E7DF79}
EndProjectSection EndProjectSection
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Biblioteque_de_Class", "Biblioteque_de_Class\Biblioteque_de_Class.csproj", "{92DD50C5-EEAD-44ED-AEFF-E21935725477}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Biblioteque_de_Class", "Biblioteque_de_Class\Biblioteque_de_Class.csproj", "{92DD50C5-EEAD-44ED-AEFF-E21935725477}"

@ -1,6 +1,8 @@
<?xml version = "1.0" encoding = "UTF-8" ?> <?xml version = "1.0" encoding = "UTF-8" ?>
<Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui" <Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:model="clr-namespace:Biblioteque_de_Class;assembly=Biblioteque_de_Class"
xmlns:system="clr-namespace:System;assembly=mscorlib"
xmlns:local="clr-namespace:notus" xmlns:local="clr-namespace:notus"
x:Class="notus.App"> x:Class="notus.App">
<Application.Resources> <Application.Resources>
@ -11,4 +13,5 @@
</ResourceDictionary.MergedDictionaries> </ResourceDictionary.MergedDictionaries>
</ResourceDictionary> </ResourceDictionary>
</Application.Resources> </Application.Resources>
</Application> </Application>

@ -1,14 +1,59 @@
 
using Biblioteque_de_Class;
using Notus_Persistance;
namespace notus; namespace notus;
public partial class App : Application public partial class App : Application
{ {
public App() public PersistenceManager Mgr { get; private set; } = new PersistenceManager(new Stub());
public Database db = new Database();
public App()
{ {
InitializeComponent(); InitializeComponent();
db = Mgr.LoadDatabaseData();
MainPage = new AppShell(); BindingContext = db;
} MainPage = new AppShell();
}
protected override Window CreateWindow(IActivationState activationState)
{
Window window = base.CreateWindow(activationState);
// Set minimum height and width
window.MinimumHeight = 670;
window.MinimumWidth = 1200;
return window;
}
private User selecUser;
public User SelectedUser
{
get
{
return selecUser;
}
set
{
selecUser = value;
OnPropertyChanged(nameof(SelectedUser));
}
}
private Note selecNote;
public Note SelectedNote
{
get
{
return selecNote;
}
set
{
selecNote = value;
OnPropertyChanged(nameof(SelectedNote));
}
}
} }

@ -3,11 +3,14 @@
x:Class="notus.AppShell" x:Class="notus.AppShell"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:model="clr-namespace:Biblioteque_de_Class;assembly=Biblioteque_de_Class"
xmlns:system="clr-namespace:System;assembly=mscorlib"
xmlns:local="clr-namespace:notus" xmlns:local="clr-namespace:notus"
Shell.FlyoutBehavior="Locked" Shell.FlyoutBehavior="Locked"
Shell.FlyoutWidth="30" Shell.FlyoutWidth="30"
Shell.NavBarIsVisible="False"> Shell.NavBarIsVisible="False"
Shell.BackgroundColor="Grey">
<ShellContent <ShellContent
Title="main_page" Title="main_page"
ContentTemplate="{DataTemplate local:MainPage}" ContentTemplate="{DataTemplate local:MainPage}"
@ -27,6 +30,10 @@
Title="Inscription_Page" Title="Inscription_Page"
ContentTemplate="{DataTemplate local:InscrPage}" ContentTemplate="{DataTemplate local:InscrPage}"
Route="InscrPage"/> Route="InscrPage"/>
<ShellContent
Title="ProfilPage"
ContentTemplate="{DataTemplate local:ProfilPage}"
Route="ProfilPage"/>
</Shell> </Shell>

@ -1,7 +1,11 @@
namespace notus; using Biblioteque_de_Class;
using Notus_Persistance;
namespace notus;
public partial class AppShell : Shell{ public partial class AppShell : Shell{
public AppShell(){ public AppShell(){
InitializeComponent(); InitializeComponent();
} }
} }

@ -5,15 +5,19 @@
x:Class="notus.ConnecPage" x:Class="notus.ConnecPage"
Title="ConnecPage" Title="ConnecPage"
BackgroundColor="#1C1C1C"> BackgroundColor="#1C1C1C">
<Shell.BackButtonBehavior>
<BackButtonBehavior
IsVisible="False"
IsEnabled="False"/>
</Shell.BackButtonBehavior>
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="2*"/> <RowDefinition Height="2*"/>
<RowDefinition Height="1.5*"/> <RowDefinition Height="80"/>
<RowDefinition Height="1*"/> <RowDefinition Height="1*"/>
<RowDefinition Height="1.8*"/> <RowDefinition Height="1.5*"/>
<RowDefinition Height="1*"/> <RowDefinition Height="1*"/>
<RowDefinition Height="1.8*"/> <RowDefinition Height="1.5*"/>
<RowDefinition Height="1*"/> <RowDefinition Height="1*"/>
<RowDefinition Height="1*"/> <RowDefinition Height="1*"/>
<RowDefinition Height="4*"/> <RowDefinition Height="4*"/>
@ -27,6 +31,21 @@
<ColumnDefinition Width="4*"/> <ColumnDefinition Width="4*"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<ImageButton
Source="return.png"
Aspect="AspectFit"
Grid.Column="0"
Grid.Row="0"
HorizontalOptions="Start"
VerticalOptions="Start"
WidthRequest="50"
HeightRequest="50"
BackgroundColor="#4A4A4A"
Margin="10,10,0,0"
CornerRadius="50"
Clicked="Back_Clicked"
/>
<Label <Label
Grid.Column="1" Grid.Column="1"
Grid.ColumnSpan="3" Grid.ColumnSpan="3"
@ -39,18 +58,19 @@
FontFamily="strong" FontFamily="strong"
/> />
<Entry <Entry x:Name="username"
Grid.Column="1" Grid.Column="1"
Grid.ColumnSpan="3" Grid.ColumnSpan="3"
Grid.Row="3" Grid.Row="3"
FontSize="22" FontSize="22"
Placeholder="entrer votre e-mail" Placeholder="entrer votre Username"
PlaceholderColor="#74fabd" PlaceholderColor="#74fabd"
TextColor="#74fabd" TextColor="#74fabd"
BackgroundColor="#4A4A4A" BackgroundColor="#4A4A4A"
Text="{Binding Username}"
/> />
<Entry <Entry x:Name="password"
Grid.Column="1" Grid.Column="1"
Grid.ColumnSpan="3" Grid.ColumnSpan="3"
Grid.Row="5" Grid.Row="5"
@ -60,15 +80,27 @@
TextColor="#74fabd" TextColor="#74fabd"
IsPassword="true" IsPassword="true"
BackgroundColor="#4A4A4A" BackgroundColor="#4A4A4A"
Text="{Binding Password}"
/> />
<Button <Button
WidthRequest="80"
Grid.Column="2" Grid.Column="2"
Grid.ColumnSpan="1" Grid.ColumnSpan="1"
Grid.Row="7" Grid.Row="7"
Text="Valider" Text="Valider"
TextColor="Black" TextColor="Black"
BackgroundColor="#74fabd" BackgroundColor="#74fabd"
Clicked="Connec_Clicked"
/>
<Label
x:Name="ResultSearch"
Text="Incorrect email or password."
IsVisible="false"
Grid.Column="2"
Grid.Row="7"
TextColor="Red"
/> />
</Grid> </Grid>

@ -1,9 +1,46 @@
namespace notus; using Biblioteque_de_Class;
using Windows.UI.Core;
public partial class ConnecPage : ContentPage
{ namespace notus;
public ConnecPage() public partial class ConnecPage : ContentPage
{ {
InitializeComponent(); User selectUser = (Application.Current as App).SelectedUser;
} Database db = (Application.Current as App).db;
public string Username { get; set; }
public string Password { get; set; }
public ConnecPage()
{
InitializeComponent();
BindingContext = this;
}
private void Connec_Clicked(object sender, EventArgs e)
{
try
{
selectUser = db.GetUser(Username);
}
catch (NotFoundException)
{
DisplayAlert("Erreur", "Cet utilisateur n'existe pas" , "OK");
return;
}
if (Database.ComparePassword(selectUser, HashCodeModel.GetSHA256Hash(Password).ToString()))
{
selectUser.IsConnected = true;
(Application.Current as App).SelectedUser = selectUser;
Navigation.PushAsync(new RecherPage());
}
else
{
DisplayAlert("Erreur", "Le mot de passe est incorrect", "OK");
return;
}
}
private void Back_Clicked(object sender, EventArgs e)
{
Navigation.PopAsync();
}
} }

@ -1,81 +1,133 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" <ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="notus.InscrPage" xmlns:toolkit="http://schemas.microsoft.com/dodnet/2022/maui/toolkit"
Title="InscrPage"> x:Class="notus.InscrPage"
Title="InscrPage"
<Grid BackgroundColor="#1C1C1C"> BackgroundColor="#1C1C1C">
<Grid.ColumnDefinitions> <Shell.BackButtonBehavior>
<ColumnDefinition Width="1*"/> <BackButtonBehavior
<ColumnDefinition Width="Auto"/> IsVisible="False"
<ColumnDefinition Width="1*"/> IsEnabled="False"/>
</Grid.ColumnDefinitions> </Shell.BackButtonBehavior>
<Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="1*"/> <RowDefinition Height="2*"/>
<RowDefinition Height="150"/> <RowDefinition Height="80"/>
<RowDefinition Height="150"/> <RowDefinition Height="2*"/>
<RowDefinition Height="150"/> <RowDefinition Height="1.8*"/>
<RowDefinition Height="1*"/> <RowDefinition Height="1*"/>
</Grid.RowDefinitions> <RowDefinition Height="1.8*"/>
<RowDefinition Height="1*"/>
<Entry <RowDefinition Height="1.8*"/>
Placeholder="Pseudo" <RowDefinition Height="1*"/>
HorizontalOptions="Center" <RowDefinition Height="1.6*"/>
VerticalOptions="Center" <RowDefinition Height="4*"/>
WidthRequest="600" </Grid.RowDefinitions>
HeightRequest="100"
FontSize="32" <Grid.ColumnDefinitions>
Grid.Column="1" <ColumnDefinition Width="4*"/>
Grid.Row="1" <ColumnDefinition Width="4*"/>
TextColor="#74fabd" <ColumnDefinition Width="0.9*"/>
BackgroundColor="#4A4A4A" <ColumnDefinition Width="0.2*"/>
PlaceholderColor="#74fabd" <ColumnDefinition Width="4*"/>
/> </Grid.ColumnDefinitions>
<Entry <ImageButton
Placeholder="Mot de passe" Source="return.png"
HorizontalOptions="Center" Aspect="AspectFit"
VerticalOptions="Center" Grid.Column="0"
WidthRequest="600" Grid.Row="0"
HeightRequest="100" HorizontalOptions="Start"
FontSize="32" VerticalOptions="Start"
Grid.Column="1" WidthRequest="50"
Grid.Row="2" HeightRequest="50"
IsPassword="true" BackgroundColor="#4A4A4A"
TextColor="#74fabd" Margin="10,10,0,0"
BackgroundColor="#4A4A4A" CornerRadius="50"
PlaceholderColor="#74fabd" Clicked="Back_Clicked"
/> />
<Entry <Label
Placeholder ="Verif mot de passe" Grid.Column="1"
HorizontalOptions="Center" Grid.ColumnSpan="3"
VerticalOptions="Center" Grid.Row="1"
WidthRequest="600" HorizontalOptions="Center"
HeightRequest="100" VerticalOptions="Center"
FontSize="32" Text="Inscription"
Grid.Column="1" TextColor="#74fabd"
Grid.Row="3" FontSize="80"
IsPassword="true" FontFamily="strong"
TextColor="#74fabd" />
BackgroundColor="#4A4A4A"
PlaceholderColor="#74fabd" <Entry
/> Placeholder="Pseudo"
FontSize="22"
<Button Grid.Column="1"
Text="Valider" Grid.ColumnSpan="3"
Grid.Column="1" Grid.Row="3"
Grid.Row="4" TextColor="#74fabd"
HorizontalOptions="End" BackgroundColor="#4A4A4A"
VerticalOptions="Center" PlaceholderColor="#74fabd"
WidthRequest="110" Text="{Binding Username}"
HeightRequest="70" />
BackgroundColor="#74fabd"
TextColor="Black" <Entry
CornerRadius="10" Placeholder="Mot de passe"
/> FontSize="22"
Grid.Column="1"
</Grid> Grid.ColumnSpan="3"
Grid.Row="5"
</ContentPage> IsPassword="true"
TextColor="#74fabd"
BackgroundColor="#4A4A4A"
PlaceholderColor="#74fabd"
Text="{Binding Password}"
/>
<Entry
Placeholder ="Verif mot de passe"
FontSize="22"
Grid.Column="1"
Grid.ColumnSpan="3"
Grid.Row="7"
IsPassword="true"
TextColor="#74fabd"
BackgroundColor="#4A4A4A"
PlaceholderColor="#74fabd"
Text="{Binding RePassword}"
/>
<Button
WidthRequest="80"
Grid.Column="2"
Grid.ColumnSpan="1"
Grid.Row="9"
Text="Valider"
TextColor="Black"
BackgroundColor="#74fabd"
Clicked="Inscription_Clicked"
/>
<Label
x:Name="userUser"
Text="User Already exist."
IsVisible="false"
Grid.Column="1"
Grid.Row="4"
TextColor="Red"
/>
<Label
x:Name="shortPassword"
Text="Password to short."
IsVisible="false"
Grid.Column="1"
Grid.Row="6"
TextColor="Red"
/>
</Grid>
</ContentPage>

@ -1,9 +1,47 @@
namespace notus; using Biblioteque_de_Class;
public partial class InscrPage : ContentPage namespace notus;
{
public InscrPage() public partial class InscrPage : ContentPage
{ {
Database datab = (Application.Current as App).db;
public string Username { get; set; }
public string Password { get; set; }
public string RePassword { get; set; }
public InscrPage()
{
InitializeComponent(); InitializeComponent();
BindingContext = this;
}
private async void Inscription_Clicked(object sender, EventArgs e)
{
if (Password.Length < 8) { shortPassword.IsVisible = true; return; }
if (Password != RePassword)
{
await DisplayAlert("Erreur", "Les mots de passe ne sont pas identiques", "OK");
return;
}
else if (Username == null || Password == null)
{
await DisplayAlert("Erreur", "Veuillez remplir tous les champs", "OK");
return;
}
try
{
datab.AddUser(new User(Username,"",Password));
}
catch (AlreadyUsedException)
{
userUser.IsVisible = true;
return;
}
(Application.Current as App).SelectedUser = datab.GetUser(Username);
await Navigation.PushAsync(new RecherPage());
}
private void Back_Clicked(object sender, EventArgs e)
{
Navigation.PopAsync();
} }
} }

@ -35,13 +35,14 @@
<Button <Button
CornerRadius="50" CornerRadius="50"
Text="Connection" Text="Connexion"
TextColor="#74fabd" TextColor="#74fabd"
FontSize="30" FontSize="30"
Grid.Row="2" Grid.Row="2"
Grid.Column="1" Grid.Column="1"
HeightRequest="75" HeightRequest="75"
BackgroundColor="#4A4A4A" BackgroundColor="#4A4A4A"
Clicked="Connec_Clicked"
/> />
<Button <Button
@ -53,6 +54,7 @@
Grid.Column="1" Grid.Column="1"
HeightRequest="75" HeightRequest="75"
BackgroundColor="#4A4A4A" BackgroundColor="#4A4A4A"
Clicked="Inscr_Clicked"
/> />
</Grid> </Grid>

@ -1,8 +1,19 @@
namespace notus; namespace notus;
public partial class MainPage : ContentPage{ public partial class MainPage : ContentPage{
public MainPage(){ public MainPage(){
InitializeComponent(); InitializeComponent();
} }
}
private async void Connec_Clicked(object sender, EventArgs e)
{
await Navigation.PushAsync(new ConnecPage());
}
private async void Inscr_Clicked(object sender, EventArgs e)
{
await Navigation.PushAsync(new InscrPage());
}
}

@ -0,0 +1,179 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:toolkit="http://schemas.microsoft.com/dodnet/2022/maui/toolkit"
x:Class="notus.ProfilPage"
Title="ProfilPage"
BackgroundColor="#1C1C1C">
<Shell.BackButtonBehavior>
<BackButtonBehavior
IsVisible="False"
IsEnabled="False"/>
</Shell.BackButtonBehavior>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="4*"/>
<ColumnDefinition Width="6*"/>
</Grid.ColumnDefinitions>
<ImageButton
Source="return.png"
Aspect="AspectFit"
Grid.Column="0"
Grid.Row="0"
HorizontalOptions="Start"
VerticalOptions="Start"
WidthRequest="50"
HeightRequest="50"
BackgroundColor="#4A4A4A"
Margin="10,10,0,0"
CornerRadius="50"
Clicked="Back_Clicked"
/>
<Grid Grid.Column="0">
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="250"/>
<RowDefinition Height="20"/>
<RowDefinition Height="20"/>
<RowDefinition Height="90"/>
<RowDefinition Height="100"/>
<RowDefinition Height="90"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<Image Source="{Binding ProfilPicture}"
HorizontalOptions="Center"
VerticalOptions="Center"
Grid.Row="1"
BackgroundColor="#4A4A4A"
WidthRequest="250"
HeightRequest="250"
Margin="0,0,0,30"
/>
<Label Text="{Binding Username}" VerticalOptions="Center"
Grid.Row="2"
BackgroundColor="#4A4A4A"
WidthRequest="260"
HeightRequest="60"
TextColor="#74fabd"/>
<Button
VerticalOptions="End"
Text="Modifier Profil"
TextColor="#74fabd"
WidthRequest="300"
BackgroundColor="#4A4A4A"
Grid.Row="4"
HeightRequest="80"
FontSize="30"
Margin="0,20,0,0"
Clicked="Modify_Profil"
/>
<Button
VerticalOptions="Center"
Text="Modifier Theme"
TextColor="#74fabd"
WidthRequest="300"
BackgroundColor="#4A4A4A"
Grid.Row="5"
HeightRequest="80"
FontSize="30"
Margin="0,20,0,0"
Clicked="Modify_Theme"
/>
<Button
VerticalOptions="Start"
Text="se déconnecter"
FontSize="30"
TextColor="#74fabd"
WidthRequest="300"
BackgroundColor="#4A4A4A"
Grid.Row="6"
HeightRequest="80"
Margin="0,20,0,0"
Clicked="Disconnect_Clicked"
/>
</Grid>
<Grid x:Name="TagsZone" Grid.Column="1" Margin="40" BackgroundColor="#4A4A4A" IsVisible="True">
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="250"/>
<RowDefinition Height="40"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<ScrollView Grid.Row="1" VerticalScrollBarVisibility="Always" HorizontalScrollBarVisibility="Never">
<StackLayout x:Name="TagListContainer" Padding="10" Spacing="5">
<ListView x:Name="TagListView" SeparatorVisibility="None" BackgroundColor="Transparent">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<BoxView Grid.Column="0" BackgroundColor="{Binding Color}" WidthRequest="40" />
<Label Grid.Column="1" Text="{Binding Name}" VerticalTextAlignment="Center" />
<Button Grid.Column="2" Text="Modify" Clicked="Modify_Clicked"/>
<Button Grid.Column="3" Text="Delete" Clicked="Delete_Clicked" VerticalOptions="End"/>
</Grid>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</ScrollView>
<Grid Grid.Row="2" HorizontalOptions="Center">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Button Grid.Column="0" Text="Add" Command="{Binding AddTagCommand}" HorizontalOptions="Center" />
</Grid>
</Grid>
<Grid x:Name="ProfilZone" Grid.Column="1" Margin="40" BackgroundColor="#4A4A4A" IsVisible="false">
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="250"/>
<RowDefinition Height="20"/>
<RowDefinition Height="20"/>
<RowDefinition Height="90"/>
<RowDefinition Height="100"/>
<RowDefinition Height="90"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
</Grid>
<Grid x:Name="ThemeZone" Grid.Column="1" Margin="40" BackgroundColor="#4A4A4A" IsVisible="false">
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="250"/>
<RowDefinition Height="20"/>
<RowDefinition Height="20"/>
<RowDefinition Height="90"/>
<RowDefinition Height="100"/>
<RowDefinition Height="90"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
</Grid>
</Grid>
</ContentPage>

@ -0,0 +1,101 @@
using Microsoft.Maui.Controls;
using Biblioteque_de_Class;
using Notus_Persistance;
using NHibernate.Mapping;
using System.Collections.ObjectModel;
namespace notus;
public partial class ProfilPage : ContentPage
{
public User SelectedUser = (Application.Current as App).SelectedUser;
private string username;
public string Username
{
get => username;
set
{
username = value;
OnPropertyChanged(nameof(Username));
(Application.Current as App).SelectedUser.Username = username;
}
}
private string password;
public string Password
{
get => password;
set
{
password = value;
OnPropertyChanged(nameof(Password));
(Application.Current as App).SelectedUser.Password = password;
}
}
private string profilPicture;
public string ProfilPicture
{
get => profilPicture;
set
{
profilPicture = value;
OnPropertyChanged(nameof(ProfilPicture));
(Application.Current as App).SelectedUser.Picture = profilPicture;
}
}
public ProfilPage()
{
InitializeComponent();
Username = SelectedUser.Username;
Password = SelectedUser.Password;
ProfilPicture = SelectedUser.Picture;
BindingContext = this;
}
private void Back_Clicked(object sender, EventArgs e)
{
Navigation.PopAsync();
}
private void Disconnect_Clicked(object sender, EventArgs e)
{
(Application.Current as App).SelectedUser.IsConnected = false;
Navigation.PopAsync();
Navigation.PopAsync();
Navigation.PopAsync();
(Application.Current as App).SelectedUser = null;
}
private void AddTag_Clicked(object sender, EventArgs e)
{
// Handle add tag action
// Show color picker and name input dialog
// Create a new Tag object and add it to the Tags collection
}
private void Modify_Clicked(object sender, EventArgs e)
{
// Handle modify action for the tag
}
private void Delete_Clicked(object sender, EventArgs e)
{
// Handle delete action for the tag
}
private void Modify_Profil(object sender, EventArgs e)
{
if (ProfilZone.IsVisible == true) { ProfilZone.IsVisible = false; return; }
ThemeZone.IsVisible = false;
ProfilZone.IsVisible = true;
}
private void Modify_Theme(object sender, EventArgs e)
{
if (ThemeZone.IsVisible == true) { ThemeZone.IsVisible = false; return;}
ProfilZone.IsVisible = false;
ThemeZone.IsVisible = true;
}
}

@ -1,133 +1,152 @@
<?xml version="1.0" encoding="utf-8" ?> <ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:toolkit="http://schemas.microsoft.com/dotnet/2021/maui/toolkit"
xmlns:toolkit="http://schemas.microsoft.com/dodnet/2022/maui/toolkit" xmlns:muxc = "using:Microsoft.UI.Xaml.Controls"
x:Class="notus.RecherPage" x:Class="notus.RecherPage"
Title="RecherPage" Title="Main Page"
BackgroundColor="#1C1C1C"> BackgroundColor="#1C1C1C">
<Grid> <Shell.BackButtonBehavior>
<Grid.RowDefinitions> <BackButtonBehavior
<RowDefinition Height="Auto"/> IsVisible="False"
<RowDefinition Height="1.5*"/> IsEnabled="False"/>
<RowDefinition Height="1*"/> </Shell.BackButtonBehavior>
<RowDefinition Height="1.8*"/> <ContentPage.Content>
<RowDefinition Height="1*"/> <Grid>
<RowDefinition Height="1.8*"/>
<RowDefinition Height="1*"/> <Grid.ColumnDefinitions>
<RowDefinition Height="1*"/> <ColumnDefinition x:Name="MasterColumn" Width="320" />
<RowDefinition Height="4*"/> <ColumnDefinition x:Name="DetailColumn" Width="*" />
</Grid.RowDefinitions> </Grid.ColumnDefinitions>
<Grid.ColumnDefinitions> <Border Background="#6E6E6E" Grid.Column="0" Grid.RowSpan="3" />
<ColumnDefinition Width="Auto"/> <Grid Margin="0,11,0,13" Grid.Column="0">
<ColumnDefinition Width="1*"/> <Grid.RowDefinitions>
<ColumnDefinition Width="1*"/> <RowDefinition Height="Auto" />
<ColumnDefinition Width="Auto"/> <RowDefinition Height="Auto" />
<ColumnDefinition Width="Auto"/> <RowDefinition Height="*" />
</Grid.ColumnDefinitions> </Grid.RowDefinitions>
<Border <Grid.ColumnDefinitions>
Background="#6E6E6E" <ColumnDefinition Width="*" />
Grid.Column="0" </Grid.ColumnDefinitions>
Grid.RowSpan="9"
/> <SearchBar Placeholder="Search Note" Text="{Binding SearchNoteText}" HorizontalOptions="Start" Margin="10" VerticalOptions="Center" WidthRequest="300" HeightRequest="50" FontSize="25" TextColor="#74fabd" BackgroundColor="#4A4A4A" PlaceholderColor="#74fabd" TextChanged="OnSearchNoteTextChanged" />
<CheckBox x:Name="FavoritesCheckBox" CheckedChanged="FavoritesFilter_CheckedChanged" WidthRequest="50" HeightRequest="50" Margin="40,0,0,0" HorizontalOptions="Start" VerticalOptions="Center" Grid.Row="1" />
<ImageButton <ImageButton Source="tagsfilter.png" BackgroundColor="#4A4A4A" Clicked="TagsFilter_Clicked" WidthRequest="50" HeightRequest="50" CornerRadius="50" Margin="20" HorizontalOptions="Center" VerticalOptions="Center" Grid.Row="1"/>
Source="profil.png" <ImageButton Source="Datefilter.png" BackgroundColor="#4A4A4A" Clicked="DatesFilter_Clicked" WidthRequest="50" HeightRequest="50" CornerRadius="50" Margin="20" HorizontalOptions="End" VerticalOptions="Center" Grid.Row="1"/>
Aspect="AspectFit" <ScrollView x:Name="TheScrollView" Grid.Row="2" Grid.Column="0" VerticalOptions="Start" Margin="5,5,5,5">
Grid.Column="4" <ContentView>
Grid.Row="0" <ListView ItemsSource="{Binding NoteList, Mode=TwoWay}" ItemSelected="NoteListView_ItemSelected" VerticalOptions="StartAndExpand">
HorizontalOptions="Start" <ListView.ItemTemplate>
VerticalOptions="Start" <DataTemplate>
WidthRequest="200" <ViewCell>
HeightRequest="120" <StackLayout Orientation="Horizontal" HeightRequest="40" Padding="3" Margin="3" BackgroundColor="#4A4A4A" MinimumWidthRequest="400" MaximumWidthRequest="400">
BackgroundColor="#6E6E6E" <CheckBox IsChecked="{Binding IsFavorite, Mode=TwoWay}" CheckedChanged="FavoriteCheckBox_CheckedChanged" HeightRequest="20" HorizontalOptions="End" VerticalOptions="Center"/>
CornerRadius="10" <StackLayout Orientation="Horizontal">
/> <Image Source="{Binding LogoPath}" HorizontalOptions="Start" VerticalOptions="Center"/>
<Label Text="{Binding Name}" TextColor="#74fabd" HorizontalOptions="Center" VerticalOptions="Center"/>
<ImageButton </StackLayout>
Source="supp.png" </StackLayout>
Aspect="AspectFill" </ViewCell>
Grid.Column="2" </DataTemplate>
Grid.Row="0" </ListView.ItemTemplate>
Margin="20" </ListView>
HorizontalOptions="End" </ContentView>
VerticalOptions="Start" </ScrollView>
WidthRequest="50" </Grid>
HeightRequest="50" <ImageButton Source="create.png" BackgroundColor="#4A4A4A" Clicked="CreateNote_Clicked" WidthRequest="50" HeightRequest="50" CornerRadius="50" Margin="20" HorizontalOptions="Start" VerticalOptions="End" />
BackgroundColor="#4A4A4A" <Grid Grid.Row="0" Grid.Column="1">
CornerRadius="50" <Grid.RowDefinitions>
/> <RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<Label </Grid.RowDefinitions>
Text="Nom de la note"
Grid.Column="1" <Grid.ColumnDefinitions>
Grid.Row="0" <ColumnDefinition Width="350" />
TextColor="#74fabd" <ColumnDefinition Width="*" />
Margin="20" </Grid.ColumnDefinitions>
FontSize="34"
BackgroundColor="#4A4A4A" <ImageButton Source="{Binding LogoPath}" Aspect="AspectFit" Grid.Column="0" Grid.Row="0" Margin="20" HorizontalOptions="Start" VerticalOptions="Start" WidthRequest="50" HeightRequest="50" BackgroundColor="#4A4A4A" CornerRadius="50" />
WidthRequest="250" <Entry Text="{Binding Name}" Grid.Column="0" Grid.Row="0" TextColor="#74fabd" Margin="20" FontSize="21" BackgroundColor="#4A4A4A" WidthRequest="250" HeightRequest="50" HorizontalOptions="End" VerticalOptions="Start" />
HeightRequest="50" <ImageButton Source="supp.png" Clicked="Delete_Note" Aspect="AspectFill" Grid.Column="2" Grid.Row="0" Margin="20" HorizontalOptions="Start" VerticalOptions="Start" WidthRequest="50" HeightRequest="50" BackgroundColor="#4A4A4A" CornerRadius="50" />
HorizontalOptions="Center" <ImageButton Source="AddUser.png" Clicked="AddUser_Clicked" Grid.Column="2" Grid.Row="0" BackgroundColor="#4A4A4A" Margin="120,20,20,20" HorizontalOptions="Start" VerticalOptions="Start" WidthRequest="50" HeightRequest="50" CornerRadius="50"/>
VerticalOptions="Start" <ImageButton Source="{Binding ProfilPicture}" Clicked="Profil_Clicked" Aspect="AspectFit" Grid.Column="2" Grid.Row="0" HorizontalOptions="End" VerticalOptions="Start" WidthRequest="200" HeightRequest="120" BackgroundColor="#6E6E6E"/>
BindingContext="NomDeLaNoteSelected"
/> <Editor
x:Name="textZone"
<ImageButton Placeholder="Text"
Source="edit.png" FontSize="18"
Aspect="AspectFit" Text="{Binding Text, Mode=TwoWay}"
Grid.Column="1" TextColor="#74fabd" BackgroundColor="#4A4A4A"
Grid.Row="0" PlaceholderColor="#74fabd"
Margin="20" Grid.Row="1"
HorizontalOptions="Start" Grid.Column="0"
VerticalOptions="Start" Grid.ColumnSpan="2"
WidthRequest="50" VerticalTextAlignment="Start"
HeightRequest="50" Margin="20"
BackgroundColor="#4A4A4A" TextChanged="OnEditorTextChanged"
CornerRadius="50" Completed="OnEditorCompleted"/>
/>
<Grid
<Entry x:Name="AddUser_Zone"
Placeholder="Rechercher" Grid.Row="1"
HorizontalOptions="Start" Grid.Column="0"
Margin="20" Grid.ColumnSpan="2"
VerticalOptions="Center" BackgroundColor="#6E6E6E"
WidthRequest="300" IsVisible="false"
HeightRequest="50" Margin="20">
FontSize="25" <Grid.RowDefinitions>
Grid.Column="0" <RowDefinition Height="Auto" />
Grid.Row="0" <RowDefinition Height="*" />
TextColor="#74fabd" <RowDefinition Height="*" />
BackgroundColor="#4A4A4A" <RowDefinition Height="*" />
PlaceholderColor="#74fabd" </Grid.RowDefinitions>
/> <Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<VerticalStackLayout <ColumnDefinition Width="*" />
Grid.Column="0" <ColumnDefinition Width="*" />
Grid.RowSpan="5" <ColumnDefinition Width="*" />
BindingContext="ARefaire" </Grid.ColumnDefinitions>
/>
<SearchBar Placeholder="Search User" Text="{Binding SearchNoteText}" HorizontalOptions="Start" Margin="20" VerticalOptions="Center" WidthRequest="400" HeightRequest="50" FontSize="25" TextColor="#74fabd" BackgroundColor="#4A4A4A" PlaceholderColor="#74fabd" TextChanged="OnSearchNoteTextChanged" />
<Editor <ScrollView x:Name="UserListScrollView" Grid.Row="0" Grid.RowSpan="4" Grid.Column="0" Grid.ColumnSpan="3" VerticalOptions="Start" HorizontalOptions="Start" Margin="20,90,0,0" BackgroundColor="#4A4A4A" MinimumWidthRequest="600" MaximumWidthRequest="600">
Placeholder="Texte" <ContentView>
IsSpellCheckEnabled="True" <ListView ItemsSource="{Binding UserList, Mode=TwoWay}" ItemSelected="NoteListView_ItemSelected" VerticalOptions="StartAndExpand">
FontSize="20" <ListView.ItemTemplate>
HorizontalOptions="Start" <DataTemplate>
VerticalOptions="Center" <ViewCell>
Margin="20" <StackLayout Orientation="Horizontal" HeightRequest="40" Padding="3" Margin="3" BackgroundColor="#4A4A4A" MinimumWidthRequest="300" MaximumWidthRequest="300">
WidthRequest="800" <CheckBox IsChecked="{Binding AJouter, Mode=TwoWay}" CheckedChanged="AddUserCheckBox_CheckedChanged" HeightRequest="20" HorizontalOptions="End" VerticalOptions="Center"/>
HeightRequest="750" <Image Source="{Binding ProfilPictureUser}" HorizontalOptions="Start" VerticalOptions="Center"/>
Grid.Column="1" <Label Text="{Binding UserNameUser}" TextColor="#74fabd" HorizontalOptions="Center" VerticalOptions="Center"/>
Grid.ColumnSpan="4" </StackLayout>
Grid.Row="4" </ViewCell>
Grid.RowSpan="3" </DataTemplate>
TextColor="White" </ListView.ItemTemplate>
BackgroundColor="#4A4A4A" </ListView>
PlaceholderColor="#74fabd" </ContentView>
/> </ScrollView>
</Grid> <Button
x:Name="Valid"
Text="Valid"
Grid.Row="3"
Grid.Column="3"
TextColor="#74fabd"
WidthRequest="70"
HeightRequest="50"
HorizontalOptions="End"
VerticalOptions="End"
Margin="0,0,20,20"
Clicked="Valid_Clicked"
BackgroundColor="#4A4A4A"/>
</Grid>
</Grid>
</Grid>
</ContentPage.Content>
</ContentPage> </ContentPage>

@ -1,24 +1,361 @@
namespace notus; using Microsoft.Maui.Controls;
using Biblioteque_de_Class;
public partial class RecherPage : ContentPage using Notus_Persistance;
{ using System.Xml.Linq;
public RecherPage() using System.Collections.ObjectModel;
{ using System.ComponentModel;
InitializeComponent(); using System.Runtime.CompilerServices;
} using Microsoft.Maui;
using System.Globalization;
void ProfilClicked() using System.Drawing;
{
namespace notus
} {
public partial class RecherPage : ContentPage, INotifyPropertyChanged
void EditCLicked() {
{ private ObservableCollection<Note> noteList;
public ObservableCollection<Note> NoteList
} {
get { return noteList; }
void SuppClicked() set
{ {
noteList = value;
} OnPropertyChanged(nameof(NoteList));
}
}
private ObservableCollection<Note> allNotes; // Store all notes initially
private Database db = (Application.Current as App).db;
public User SelectedUser = (Application.Current as App).SelectedUser;
public Note SelectedNote
{
get => (Application.Current as App).SelectedNote;
set
{
if ((Application.Current as App).SelectedNote != value)
{
(Application.Current as App).SelectedNote = value;
OnPropertyChanged(nameof(SelectedNote));
NoteList = new ObservableCollection<Note>(SelectedUser.NoteList);
allNotes = new ObservableCollection<Note>(NoteList);
Name = SelectedNote.Name;
Text = SelectedNote.Text;
LogoPath = SelectedNote.LogoPath;
}
}
}
private string name;
public string Name
{
get { return name; }
set
{
if (name != value)
{
name = value;
OnPropertyChanged(nameof(Name));
if (SelectedNote != null)
{
try
{
SelectedNote.ChangeName(SelectedUser, value);
}
catch (NotAllowedException)
{
Name = SelectedNote.Name;
}
}
}
}
}
private string text;
public string Text
{
get { return text; }
set
{
if (text != value)
{
text = value;
OnPropertyChanged(nameof(Text));
if (SelectedNote != null)
{
try
{
SelectedNote.VerifyPrivilege(SelectedUser);
}
catch (NotAllowedException)
{
Text = SelectedNote.Text;
return;
}
SelectedNote.Text = value;
}
}
}
}
private string logoPath;
public string LogoPath
{
get { return logoPath; }
set
{
if (logoPath != value)
{
logoPath = value;
OnPropertyChanged(nameof(LogoPath));
if (SelectedNote != null)
{
try
{
SelectedNote.ChangeLogo(SelectedUser, value);
}
catch (NotAllowedException)
{
LogoPath = SelectedNote.LogoPath;
}
}
}
}
}
public string SearchNoteText { get; set; }
public string ProfilPicture { get; set; }
public RecherPage()
{
InitializeComponent();
allNotes = new ObservableCollection<Note>(SelectedUser.NoteList);
NoteList = allNotes;
SelectedNote = SelectedUser.NoteList
.OrderByDescending(note => note.ModificationDate)
.FirstOrDefault();
(Application.Current as App).SelectedNote = SelectedNote;
Name = SelectedNote.Name;
Text = SelectedNote.Text;
LogoPath = SelectedNote.LogoPath;
ProfilPicture = SelectedUser.Picture;
BindingContext = this;
}
private void CreateNote_Clicked(object sender, EventArgs e)
{
SelectedUser.CreateNote("", "");
SelectedNote = SelectedUser.NoteList[SelectedUser.NoteList.Count - 1];
}
private async void Profil_Clicked(object sender, EventArgs e)
{
(Application.Current as App).SelectedUser = SelectedUser;
await Navigation.PushAsync(new ProfilPage());
}
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
void OnEditorTextChanged(object sender, TextChangedEventArgs e)
{
string newText = e.NewTextValue;
if (SelectedNote != null)
{
SelectedNote.Text = newText;
(Application.Current as App).SelectedNote = SelectedNote;
}
Text = SelectedNote.Text;
}
void OnEditorCompleted(object sender, EventArgs e)
{
if (SelectedNote != null)
{
SelectedNote.Text = ((Editor)sender).Text;
(Application.Current as App).SelectedNote = SelectedNote;
}
}
private void NoteListView_ItemSelected(object sender, SelectedItemChangedEventArgs e)
{
if (e.SelectedItem is Note selectedNote)
{
SelectedNote = selectedNote;
(Application.Current as App).SelectedNote = SelectedNote;
Name = SelectedNote.Name;
Text = SelectedNote.Text;
LogoPath = SelectedNote.LogoPath;
}
}
private void AddUser_Clicked(object sender, EventArgs e)
{
if (AddUser_Zone.IsVisible)
AddUser_Zone.IsVisible = false;
else
AddUser_Zone.IsVisible = true;
}
private void Valid_Clicked(object sender, EventArgs e)
{
AddUser_Zone.IsVisible = false;
}
private void AddUserCheckBox_CheckedChanged(object sender, CheckedChangedEventArgs e)
{
}
public void Delete_Note(object sender, EventArgs e)
{
if (SelectedNote != null)
{
SelectedUser.NoteList.Remove(SelectedNote);
if (SelectedUser.NoteList.Count == 0)
{
SelectedUser.CreateNote("","");
}
SelectedNote = SelectedUser.NoteList.FirstOrDefault(); // Select the first note in the list (or null if empty)
}
}
private int windowHeight;
public int WindowHeight
{
get { return windowHeight; }
set
{
if (windowHeight != value)
{
windowHeight = value - 300;
OnPropertyChanged(nameof(WindowHeight));
UpdateScrollViewHeight();
}
}
}
protected override void OnSizeAllocated(double width, double height)
{
base.OnSizeAllocated(width, height);
if (WindowHeight != (int)height)
{
WindowHeight = (int)height;
UpdateScrollViewHeight();
}
}
private void UpdateScrollViewHeight()
{
double availableHeight = WindowHeight;
TheScrollView.MaximumHeightRequest = availableHeight;
UserListScrollView.MinimumHeightRequest = availableHeight;
UserListScrollView.MaximumHeightRequest = availableHeight;
}
private bool isFavoritesFilterChecked = false;
private List<Tags> selectedTags = new List<Tags>();
private DateOnly startDate;
private DateOnly endDate;
private bool isfavorite;
public bool IsFavorite
{
get => isfavorite;
set
{
if (IsFavorite != value)
{
IsFavorite = value;
OnPropertyChanged(nameof(IsFavorite));
}
}
}
void OnSearchNoteTextChanged(object sender, TextChangedEventArgs e)
{
string searchText = e.NewTextValue;
if (string.IsNullOrEmpty(searchText))
{
ApplyFilters();
}
else
{
var filteredNotes = NoteList.Where(note => note.Name.Contains(searchText));
NoteList = new ObservableCollection<Note>(filteredNotes);
}
}
private void FavoritesFilter_CheckedChanged(object sender, CheckedChangedEventArgs e)
{
isFavoritesFilterChecked = e.Value;
ApplyFilters();
}
private void TagsFilter_Clicked(object sender, EventArgs e)
{
ApplyFilters();
}
private void DatesFilter_Clicked(object sender, EventArgs e)
{
ApplyFilters();
}
private void ApplyFilters()
{
var filteredNotes = allNotes;
if (isFavoritesFilterChecked)
{
var FavfilteredNotes = allNotes.Where(note => SelectedUser.FavList.Contains(note));
NoteList = new ObservableCollection<Note>(FavfilteredNotes);
filteredNotes = NoteList;
}
if (selectedTags.Count > 0)
{
filteredNotes = (ObservableCollection<Note>)filteredNotes.Where(note => SelectedUser.NoteTagged[note].Any(tag => selectedTags.Contains(tag)));
}
if (startDate != default && endDate != default)
{
filteredNotes = (ObservableCollection<Note>)filteredNotes.Where(note => note.CreationDate >= startDate && note.CreationDate <= endDate || note.ModificationDate >= startDate && note.ModificationDate <= endDate);
}
foreach (var note in filteredNotes)
{
note.IsFavorite = SelectedUser.FavList.Contains(note);
IsFavorite = note.IsFavorite;
}
NoteList = new ObservableCollection<Note>(filteredNotes);
}
private void FavoriteCheckBox_CheckedChanged(object sender, CheckedChangedEventArgs e)
{
CheckBox checkBox = (CheckBox)sender;
Note note = checkBox.BindingContext as Note;
if (note != null)
{
if (e.Value)
{
if(note.IsFavorite == false)
SelectedUser.AddFavorite(note);
(Application.Current as App).SelectedUser = SelectedUser;
allNotes = new ObservableCollection<Note>(SelectedUser.NoteList);
}
else
{
if (note.IsFavorite == true)
SelectedUser.RemoveFavorite(note);
(Application.Current as App).SelectedUser = SelectedUser;
allNotes = new ObservableCollection<Note>(SelectedUser.NoteList);
}
}
}
}
} }

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>net7.0-android;net7.0-ios;net7.0-maccatalyst</TargetFrameworks> <!--<TargetFrameworks>net7.0-android;net7.0-ios;net7.0-maccatalyst</TargetFrameworks>-->
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net7.0-windows10.0.19041.0</TargetFrameworks> <TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net7.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 --> <!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
<!-- <TargetFrameworks>$(TargetFrameworks);net7.0-tizen</TargetFrameworks> --> <!-- <TargetFrameworks>$(TargetFrameworks);net7.0-tizen</TargetFrameworks> -->
@ -53,12 +53,20 @@
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="7.0.0" /> <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="7.0.0" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Biblioteque_de_Class\Biblioteque_de_Class.csproj" />
<ProjectReference Include="..\Notus_Persistence\Notus_Persistance.csproj" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Update="ConnecPage.xaml.cs"> <Compile Update="ConnecPage.xaml.cs">
<DependentUpon>ConnecPage.xaml</DependentUpon> <DependentUpon>ConnecPage.xaml</DependentUpon>
</Compile> </Compile>
<Compile Update="InscrPage.xaml.cs"> <Compile Update="InscrPage.xaml.cs">
<DependentUpon>InscrPage.xaml</DependentUpon> <DependentUpon>InscrPage.xaml</DependentUpon>
</Compile>
<Compile Update="ProfilPage.xaml.cs">
<DependentUpon>ProfilPage.xaml</DependentUpon>
</Compile> </Compile>
<Compile Update="RecherPage.xaml.cs"> <Compile Update="RecherPage.xaml.cs">
<DependentUpon>RecherPage.xaml</DependentUpon> <DependentUpon>RecherPage.xaml</DependentUpon>
@ -69,8 +77,11 @@
<MauiXaml Update="ConnecPage.xaml"> <MauiXaml Update="ConnecPage.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</MauiXaml> </MauiXaml>
<MauiXaml Update="InscrPage.xaml"> <MauiXaml Update="InscrPage.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="ProfilPage.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml> </MauiXaml>
<MauiXaml Update="RecherPage.xaml"> <MauiXaml Update="RecherPage.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>

Loading…
Cancel
Save