Skip to content

mainfish#9

Open
frenchfish wants to merge 3 commits into
furesoft:mainfrom
frenchfish:mainfish
Open

mainfish#9
frenchfish wants to merge 3 commits into
furesoft:mainfrom
frenchfish:mainfish

Conversation

@frenchfish

Copy link
Copy Markdown
Contributor

Added favourite

Comment thread src/RomManager/Models/Game.cs Outdated
Comment on lines +29 to +40
[ObservableProperty] private CoverArtImage? _coverArtImage;
[ObservableProperty] private Manual? _manual;
[ObservableProperty] private RomFile? _romFile;
[ObservableProperty] private SaveGame? _saveGame;
[ObservableProperty] private Screenshot? _screenshot;
[ObservableProperty] private State[] _state;
[ObservableProperty] private TitleScreen? _titleScreen;
[ObservableProperty] private Video _video;
//probably delete
[ObservableProperty] private bool _showLogo = false ;
[ObservableProperty] private Bitmap? _favouritePAth;
[ObservableProperty] private bool? _isFavourite = false;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Don't introduce new properties
  2. Don't make a new property for binding "_isFavourite" use Info.IsFavorite

Comment thread src/RomManager/Models/Game.cs Outdated
Comment on lines +49 to +57
Uri uri;
if (IsFavourite == true)
{
uri = new Uri("avares://RomManager/Assets/Icons/Games/favourite.png");
}
else
{
uri = new Uri("avares://RomManager/Assets/Icons/Games/unfavourite.png");
}

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +16 to +21
private static readonly Dictionary<bool, string> FavouriteToIcon = new()
{
{ true, "favourite" },
{ false, "unfavourite" },

};

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you use a dictionary for maximum of 2 values? It creates unneccesary allocations.
If you want to cache those images just use 2 IImage fields.

Comment on lines +23 to +30
if (IsFavourite == true)
{
uri = new Uri("avares://RomManager/Assets/Icons/Games/favourite.png");
}
else
{
uri = new Uri("avares://RomManager/Assets/Icons/Games/unfavourite.png");
}

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could use something like this:

var iconName = IsFavourite ? "favourite" : "unfavourite";
var uri = new Uri($"avares://RomManager/Assets/Icons/Games/{iconName}.png");

Comment on lines +76 to +78
//DELETE TEST
gameInfo = new GameInfo { Path = file, Name = System.IO.Path.GetFileNameWithoutExtension(file),IsFavorite = false};
// gameInfo = new GameInfo { Path = file, Name = System.IO.Path.GetFileNameWithoutExtension(file) };

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete the test code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants