add 'RemoveFromMyList' button to remove a recipe from MyList
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
8e5e75d49d
commit
060618d89f
@ -1,44 +1,44 @@
|
|||||||
using Models;
|
using Models;
|
||||||
|
|
||||||
namespace ShoopNCook.Views
|
namespace ShoopNCook.Views
|
||||||
{
|
{
|
||||||
public partial class RecipeView : ContentView
|
public partial class RecipeView : ContentView
|
||||||
{
|
{
|
||||||
private readonly Action callback;
|
private readonly Action callback;
|
||||||
|
|
||||||
|
|
||||||
public RecipeView(RecipeInfo info, Action callback)
|
public RecipeView(RecipeInfo info, Action callback)
|
||||||
{
|
{
|
||||||
this.callback = callback;
|
this.callback = callback;
|
||||||
BindingContext = info;
|
BindingContext = info;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
Note = info.AverageNote;
|
Note = info.AverageNote;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float Note
|
public float Note
|
||||||
{
|
{
|
||||||
set => SetNote(value);
|
set => SetNote(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void SetNote(float note)
|
private void SetNote(float note)
|
||||||
{
|
{
|
||||||
note = (uint)note; //truncate integer as we currently do not handle semi stars
|
note = (uint)note; //truncate integer as we currently do not handle semi stars
|
||||||
foreach (Image img in Stars.Children.Reverse())
|
foreach (Image img in Stars.Children.Reverse())
|
||||||
{
|
{
|
||||||
if (note > 0)
|
if (note > 0)
|
||||||
{
|
{
|
||||||
img.Opacity = 1;
|
img.Opacity = 1;
|
||||||
note--;
|
note--;
|
||||||
}
|
}
|
||||||
else img.Opacity = 0;
|
else img.Opacity = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnRecipeTapped(object sender, EventArgs e)
|
private void OnRecipeTapped(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in new issue