You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
999 B
50 lines
999 B
using ShoopNCook.Pages;
|
|
using ShoopNCook.Models;
|
|
namespace ShoopNCook.Views;
|
|
|
|
public partial class RecipeView : ContentView
|
|
{
|
|
|
|
public RecipeView(RecipeInfo info)
|
|
{
|
|
InitializeComponent();
|
|
Note = info.AverageNote;
|
|
Title = info.Name;
|
|
Subtitle = info.Description;
|
|
RecipeImage.Source = ImageSource.FromUri(info.Image);
|
|
}
|
|
|
|
public float Note
|
|
{
|
|
set => SetNote(value);
|
|
}
|
|
|
|
public string Title
|
|
{
|
|
set => TitleLabel.Text = value;
|
|
}
|
|
|
|
public string Subtitle
|
|
{
|
|
set => SubtitleLabel.Text = value;
|
|
}
|
|
|
|
|
|
private void SetNote(float note)
|
|
{
|
|
int i = 1;
|
|
foreach (Image img in Stars.Children)
|
|
{
|
|
if (i <= note)
|
|
{
|
|
img.Opacity = 0;
|
|
i++;
|
|
}
|
|
else img.Opacity = 1;
|
|
}
|
|
}
|
|
private async void OnRecipeTapped(object sender, EventArgs e)
|
|
{
|
|
await Shell.Current.Navigation.PushAsync(new RecipePage());
|
|
}
|
|
} |