Commit 30de29e9 by Javier Piris

Refactor de la app de INutralia

parent 4ad2307a
...@@ -41,11 +41,14 @@ namespace inutralia ...@@ -41,11 +41,14 @@ namespace inutralia
FFImageLoading.Forms.Platform.CachedImageRenderer.Init(true); FFImageLoading.Forms.Platform.CachedImageRenderer.Init(true);
Forms.Init(this, bundle); Forms.Init(this, bundle);
//Initializing GrialKit
GrialKit.Init(this, "inutralia.GrialLicense"); GrialKit.Init(this, "inutralia.GrialLicense");
FormsHelper.ForceLoadingAssemblyContainingType(typeof(UXDivers.Effects.Effects)); FormsHelper.ForceLoadingAssemblyContainingType(typeof(UXDivers.Effects.Effects));
LoadApplication(new App());} LoadApplication(new App());
}
public override void OnConfigurationChanged(Android.Content.Res.Configuration newConfig) public override void OnConfigurationChanged(Android.Content.Res.Configuration newConfig)
{ {
...@@ -54,17 +57,17 @@ namespace inutralia ...@@ -54,17 +57,17 @@ namespace inutralia
DeviceOrientationLocator.NotifyOrientationChanged(); DeviceOrientationLocator.NotifyOrientationChanged();
} }
public override void OnBackPressed () public override void OnBackPressed()
{ {
var md = Xamarin.Forms.Application.Current.MainPage as MasterDetailPage; var md = Xamarin.Forms.Application.Current.MainPage as MasterDetailPage;
if (md != null && !md.IsPresented && if (md != null && !md.IsPresented &&
( (
!(md.Detail is NavigationPage) || (((NavigationPage) md.Detail).Navigation.NavigationStack.Count == 1 && ((NavigationPage) md.Detail).Navigation.ModalStack.Count == 0) !(md.Detail is NavigationPage) || (((NavigationPage)md.Detail).Navigation.NavigationStack.Count == 1 && ((NavigationPage)md.Detail).Navigation.ModalStack.Count == 0)
)) ))
MoveTaskToBack (true); MoveTaskToBack(true);
else else
base.OnBackPressed (); base.OnBackPressed();
} }
} }
} }
......
...@@ -6,22 +6,24 @@ namespace inutralia ...@@ -6,22 +6,24 @@ namespace inutralia
{ {
public class CustomFontLabelRenderer : ArtinaCustomFontLabelRenderer public class CustomFontLabelRenderer : ArtinaCustomFontLabelRenderer
{ {
private static readonly string[] CustomFontFamily = new [] private static readonly string[] CustomFontFamily = new[]
{ {
"grialshapes", "grialshapes",
"FontAwesome", "FontAwesome",
"Ionicons" "Ionicons"
}; };
private static readonly Tuple<FontAttributes, string>[][] CustomFontFamilyData = new [] { private static readonly Tuple<FontAttributes, string>[][] CustomFontFamilyData = new[] {
new [] { new []
{
new Tuple<FontAttributes, string>(FontAttributes.None, "grialshapes.ttf"), new Tuple<FontAttributes, string>(FontAttributes.None, "grialshapes.ttf"),
new Tuple<FontAttributes, string>(FontAttributes.Bold, "grialshapes.ttf"), new Tuple<FontAttributes, string>(FontAttributes.Bold, "grialshapes.ttf"),
new Tuple<FontAttributes, string>(FontAttributes.Italic, "grialshapes.ttf") new Tuple<FontAttributes, string>(FontAttributes.Italic, "grialshapes.ttf")
}, },
//* //*
new [] { new []
{
new Tuple<FontAttributes, string>(FontAttributes.None, "fontawesome-webfont.ttf"), new Tuple<FontAttributes, string>(FontAttributes.None, "fontawesome-webfont.ttf"),
new Tuple<FontAttributes, string>(FontAttributes.Bold, "fontawesome-webfont.ttf"), new Tuple<FontAttributes, string>(FontAttributes.Bold, "fontawesome-webfont.ttf"),
new Tuple<FontAttributes, string>(FontAttributes.Italic, "fontawesome-webfont.ttf") new Tuple<FontAttributes, string>(FontAttributes.Italic, "fontawesome-webfont.ttf")
...@@ -29,7 +31,8 @@ namespace inutralia ...@@ -29,7 +31,8 @@ namespace inutralia
//*/ //*/
//* //*
new [] { new []
{
new Tuple<FontAttributes, string>(FontAttributes.None, "ionicons.ttf"), new Tuple<FontAttributes, string>(FontAttributes.None, "ionicons.ttf"),
new Tuple<FontAttributes, string>(FontAttributes.Bold, "ionicons.ttf"), new Tuple<FontAttributes, string>(FontAttributes.Bold, "ionicons.ttf"),
new Tuple<FontAttributes, string>(FontAttributes.Italic, "ionicons.ttf") new Tuple<FontAttributes, string>(FontAttributes.Italic, "ionicons.ttf")
...@@ -37,15 +40,19 @@ namespace inutralia ...@@ -37,15 +40,19 @@ namespace inutralia
//*/ //*/
}; };
protected override bool CheckIfCustomFont (string fontFamily, FontAttributes attributes, out string fontFileName) protected override bool CheckIfCustomFont(string fontFamily, FontAttributes attributes, out string fontFileName)
{
for (int i = 0; i < CustomFontFamily.Length; i++)
{
if (string.Equals(fontFamily, CustomFontFamily[i], StringComparison.InvariantCulture))
{ {
for (int i = 0; i < CustomFontFamily.Length; i++) {
if (string.Equals(fontFamily, CustomFontFamily[i], StringComparison.InvariantCulture)){
var fontFamilyData = CustomFontFamilyData[i]; var fontFamilyData = CustomFontFamilyData[i];
for (int j = 0; j < fontFamilyData.Length; j++) { for (int j = 0; j < fontFamilyData.Length; j++)
{
var data = fontFamilyData[j]; var data = fontFamilyData[j];
if (data.Item1 == attributes){ if (data.Item1 == attributes)
{
fontFileName = data.Item2; fontFileName = data.Item2;
return true; return true;
......
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<resources> <resources>
<color name="primary">@color/AccentColor</color> <color name="primary">@color/AccentColor</color>
<color name="primary_dark">@color/AccentColor</color> <color name="primary_dark">@color/AccentColor</color>
<color name="actionbar_tab_indicator">@color/AccentColor</color> <color name="actionbar_tab_indicator">@color/AccentColor</color>
<!-- Theme --> <!-- Theme -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
...@@ -34,31 +30,29 @@ ...@@ -34,31 +30,29 @@
<item name="android:colorActivatedHighlight">@color/AccentColor</item> <item name="android:colorActivatedHighlight">@color/AccentColor</item>
<item name="android:activatedBackgroundIndicator">@color/AccentColor</item> <item name="android:activatedBackgroundIndicator">@color/AccentColor</item>
<!-- Main theme colors --> <!-- Main theme colors -->
<!-- your app branding color for the app bar --> <!-- your app branding color for the app bar -->
<item name="android:colorPrimary">@color/primary</item> <item name="android:colorPrimary">@color/primary</item>
<!-- darker variant for the status bar and contextual app bars <!-- darker variant for the status bar and contextual app bars
<item name="android:colorPrimaryDark">@color/primary_dark</item>--> <item name="android:colorPrimaryDark">@color/primary_dark</item>-->
<!-- theme UI controls like checkboxes and text fields --> <!-- theme UI controls like checkboxes and text fields -->
<item name="android:colorAccent">@color/AccentColor</item> <item name="android:colorAccent">@color/AccentColor</item>
<!-- TimePicker dialog--> <!-- TimePicker dialog-->
<item name="android:dialogTheme">@style/AppTheme.Dialog</item> <item name="android:dialogTheme">@style/AppTheme.Dialog</item>
<item name="android:timePickerDialogTheme">@style/AppTheme.Dialog</item> <item name="android:timePickerDialogTheme">@style/AppTheme.Dialog</item>
<item name="android:datePickerDialogTheme">@style/AppTheme.Dialog</item> <item name="android:datePickerDialogTheme">@style/AppTheme.Dialog</item>
<item name="alertDialogTheme">@style/AppTheme.AlertDialog</item> <item name="alertDialogTheme">@style/AppTheme.AlertDialog</item>
<item name="drawerArrowStyle">@style/AppTheme.DrawerArrowStyle</item> <item name="drawerArrowStyle">@style/AppTheme.DrawerArrowStyle</item>
<item name="android:windowContentTransitions">true</item> <item name="android:windowContentTransitions">true</item>
<item name="android:windowAllowEnterTransitionOverlap">true</item> <item name="android:windowAllowEnterTransitionOverlap">true</item>
<item name="android:windowAllowReturnTransitionOverlap">true</item> <item name="android:windowAllowReturnTransitionOverlap">true</item>
<item name="android:windowSharedElementEnterTransition">@android:transition/move</item> <item name="android:windowSharedElementEnterTransition">@android:transition/move</item>
<item name="android:windowSharedElementExitTransition">@android:transition/move</item> <item name="android:windowSharedElementExitTransition">@android:transition/move</item>
</style> </style>
<!-- Adding animation to hamburguer icon, and overriding color to fix weird color change bug on app compat --> <!-- Adding animation to hamburguer icon, and overriding color to fix weird color change bug on app compat -->
...@@ -83,5 +77,4 @@ ...@@ -83,5 +77,4 @@
<item name="android:windowTitleStyle">@style/AppTheme.DialogTitleTextStyle</item> <item name="android:windowTitleStyle">@style/AppTheme.DialogTitleTextStyle</item>
<item name="android:windowNoTitle">true</item> <item name="android:windowNoTitle">true</item>
</style> </style>
</resources> </resources>
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<resources> <resources>
<!-- Splash styles --> <!-- Splash styles -->
<style name="Theme.Splash" parent="Theme.AppCompat.Light.NoActionBar"> <style name="Theme.Splash" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowBackground">@drawable/splash_drawable</item> <item name="android:windowBackground">@drawable/splash_drawable</item>
...@@ -37,17 +35,19 @@ ...@@ -37,17 +35,19 @@
<item name="android:colorActivatedHighlight">@color/AccentColor</item> <item name="android:colorActivatedHighlight">@color/AccentColor</item>
<item name="android:activatedBackgroundIndicator">@color/AccentColor</item> <item name="android:activatedBackgroundIndicator">@color/AccentColor</item>
<!-- Main theme colors --> <!-- Main theme colors -->
<!-- your app branding color for the app bar --> <!-- your app branding color for the app bar -->
<item name="android:colorPrimary">@color/AccentColor</item> <item name="android:colorPrimary">@color/AccentColor</item>
<!-- darker variant for the status bar and contextual app bars <!-- darker variant for the status bar and contextual app bars
<item name="android:colorPrimaryDark">@color/primary_dark</item>--> <item name="android:colorPrimaryDark">@color/primary_dark</item>-->
<!-- theme UI controls like checkboxes and text fields --> <!-- theme UI controls like checkboxes and text fields -->
<item name="android:colorAccent">@color/AccentColor</item> <item name="android:colorAccent">@color/AccentColor</item>
<!-- Dialog attributes --> <!-- Dialog attributes -->
<item name="dialogTheme">@style/AppTheme.Dialog</item> <item name="dialogTheme">@style/AppTheme.Dialog</item>
<!-- AlertDialog attributes --> <!-- AlertDialog attributes -->
<item name="alertDialogTheme">@style/AppTheme.Dialog</item> <item name="alertDialogTheme">@style/AppTheme.Dialog</item>
...@@ -56,7 +56,6 @@ ...@@ -56,7 +56,6 @@
<item name="android:showDividers">none</item> <item name="android:showDividers">none</item>
<item name="android:divider">@null</item> <item name="android:divider">@null</item>
<item name="android:datePickerStyle">@style/Widget.AppTheme.Picker</item> <item name="android:datePickerStyle">@style/Widget.AppTheme.Picker</item>
</style> </style>
...@@ -76,7 +75,6 @@ ...@@ -76,7 +75,6 @@
<item name="android:borderlessButtonStyle">@style/Widget.AppTheme.Button.Borderless</item> <item name="android:borderlessButtonStyle">@style/Widget.AppTheme.Button.Borderless</item>
</style> </style>
<style name="Widget.AppTheme.Button.Borderless" parent="@style/Widget.AppCompat.Button.Borderless"> <style name="Widget.AppTheme.Button.Borderless" parent="@style/Widget.AppCompat.Button.Borderless">
<item name="android:textColor">#FF00FF</item> <item name="android:textColor">#FF00FF</item>
<item name="android:textAppearance">@style/TextAppearance.AppTheme.DialogButton</item> <item name="android:textAppearance">@style/TextAppearance.AppTheme.DialogButton</item>
...@@ -84,7 +82,6 @@ ...@@ -84,7 +82,6 @@
<style name="Widget.AppTheme.TabLayout" parent="@style/Widget.Design.TabLayout"> <style name="Widget.AppTheme.TabLayout" parent="@style/Widget.Design.TabLayout">
<item name="tabSelectedTextColor">@color/AccentColor</item> <item name="tabSelectedTextColor">@color/AccentColor</item>
<item name="tabTextColor">@color/BaseTextColor</item> <item name="tabTextColor">@color/BaseTextColor</item>
</style> </style>
...@@ -97,5 +94,4 @@ ...@@ -97,5 +94,4 @@
<style name="TextAppearance.AppTheme.DialogButton" parent="@style/TextAppearance.AppCompat.Title"> <style name="TextAppearance.AppTheme.DialogButton" parent="@style/TextAppearance.AppCompat.Title">
</style> </style>
</resources> </resources>
using Newtonsoft.Json; using Newtonsoft.Json;
using System; using System;
using System.ComponentModel;
using System.Globalization;
namespace inutralia.Models namespace inutralia.Models
{ {
[JsonObject(MemberSerialization.OptIn)] [JsonObject(MemberSerialization.OptIn)]
[DataPath("article")] [DataPath("article")]
public class Article : ObservableEntityData public class Article : ObservableEntityData
...@@ -25,7 +22,6 @@ namespace inutralia.Models ...@@ -25,7 +22,6 @@ namespace inutralia.Models
[JsonProperty("published")] [JsonProperty("published")]
public string Date { get; set; } public string Date { get; set; }
public string ExcerptCompress => Excerpt == null ? "..." : Excerpt.Substring(0, Math.Min(80, Excerpt.Length)).Length<80 ? Excerpt : Excerpt.Substring(0, Excerpt.Substring(0, 80).LastIndexOf(" ")) + ((Excerpt.Length>80) ? "..." : "" ); public string ExcerptCompress => Excerpt == null ? "..." : Excerpt.Substring(0, Math.Min(80, Excerpt.Length)).Length < 80 ? Excerpt : Excerpt.Substring(0, Excerpt.Substring(0, 80).LastIndexOf(" ")) + ((Excerpt.Length > 80) ? "..." : "");
} }
} }
...@@ -20,5 +20,4 @@ namespace inutralia ...@@ -20,5 +20,4 @@ namespace inutralia
return objectType == typeof(bool); return objectType == typeof(bool);
} }
} }
} }
...@@ -7,10 +7,12 @@ namespace inutralia.Models ...@@ -7,10 +7,12 @@ namespace inutralia.Models
/// este atributo, se utilizará el nombre de la clase en minúsculas con una 's' al /// este atributo, se utilizará el nombre de la clase en minúsculas con una 's' al
/// final /// final
/// </summary> /// </summary>
///
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)]
public class DataPathAttribute : Attribute public class DataPathAttribute : Attribute
{ {
public DataPathAttribute ( string path) public DataPathAttribute(string path)
{ {
DataPath = path; DataPath = path;
} }
......
 using Newtonsoft.Json;
using Newtonsoft.Json;
using System.Collections.Generic; using System.Collections.Generic;
namespace inutralia.Models namespace inutralia.Models
{ {
[JsonObject(MemberSerialization.OptIn)] [JsonObject(MemberSerialization.OptIn)]
public class Day public class Day
{ {
...@@ -24,9 +21,6 @@ namespace inutralia.Models ...@@ -24,9 +21,6 @@ namespace inutralia.Models
[JsonProperty("dinnerSecond", Required = Required.Always)] [JsonProperty("dinnerSecond", Required = Required.Always)]
public IList<Recipe> DinnerSecond { get; set; } public IList<Recipe> DinnerSecond { get; set; }
public Day() public Day() { }
{
}
} }
} }
using Newtonsoft.Json; using Newtonsoft.Json;
using System.ComponentModel;
using System;
namespace inutralia.Models namespace inutralia.Models
{ {
[JsonObject(MemberSerialization.OptIn)] [JsonObject(MemberSerialization.OptIn)]
[DataPath("generic")] [DataPath("generic")]
public class Generic : MenuBase public class Generic : MenuBase
{ {
[JsonProperty("ds", Required = Required.Always)] [JsonProperty("ds", Required = Required.Always)]
public string Ds public string Ds { get; set; }
{ get; set; }
public override string Title public override string Title
{ {
get get { return Ds; }
{
return Ds;
}
} }
} }
} }
 using Newtonsoft.Json;
using Newtonsoft.Json;
using System.ComponentModel;
using System.Linq;
using System.Runtime.Serialization;
namespace inutralia.Models namespace inutralia.Models
{ {
[JsonObject(MemberSerialization.OptIn)] [JsonObject(MemberSerialization.OptIn)]
[DataPath("recipe")] [DataPath("recipe")]
public class Ingredient : ObservableEntityData public class Ingredient : ObservableEntityData
......
using Newtonsoft.Json; using Newtonsoft.Json;
using System.ComponentModel; using System.ComponentModel;
using System;
namespace inutralia.Models namespace inutralia.Models
{ {
/// <summary> /// <summary>
/// Representa el menú personal guardado localmente /// Representa el menú personal guardado localmente
/// </summary> /// </summary>
[JsonObject (MemberSerialization.OptIn)] [JsonObject(MemberSerialization.OptIn)]
[DataPath ("LocalMenu")] [DataPath("LocalMenu")]
public class LocalMenu : Menu public class LocalMenu : Menu
{ {
private static JsonSerializerSettings _jsonSettings = new JsonSerializerSettings { ObjectCreationHandling = ObjectCreationHandling.Replace, NullValueHandling = NullValueHandling.Ignore}; private static JsonSerializerSettings _jsonSettings = new JsonSerializerSettings
{
ObjectCreationHandling = ObjectCreationHandling.Replace,
NullValueHandling = NullValueHandling.Ignore
};
/// <summary> /// <summary>
/// Indice del plato seleccionado para un día /// Indice del plato seleccionado para un día
/// </summary> /// </summary>
public class MealSelections public class MealSelections
{ {
[JsonProperty ("lf_idx", DefaultValueHandling = DefaultValueHandling.Populate)] [JsonProperty("lf_idx", DefaultValueHandling = DefaultValueHandling.Populate)]
[DefaultValue(-1)] [DefaultValue(-1)]
public int LunchFirstIndex = -1; public int LunchFirstIndex = -1;
[JsonProperty ("ls_idx", DefaultValueHandling = DefaultValueHandling.Populate)] [JsonProperty("ls_idx", DefaultValueHandling = DefaultValueHandling.Populate)]
[DefaultValue (-1)] [DefaultValue(-1)]
public int LunchSecondIndex = -1; public int LunchSecondIndex = -1;
[JsonProperty ("df_idx", DefaultValueHandling = DefaultValueHandling.Populate)] [JsonProperty("df_idx", DefaultValueHandling = DefaultValueHandling.Populate)]
[DefaultValue (-1)] [DefaultValue(-1)]
public int DinnerFirstIndex = -1; public int DinnerFirstIndex = -1;
[JsonProperty ("ds_idx", DefaultValueHandling = DefaultValueHandling.Populate)] [JsonProperty("ds_idx", DefaultValueHandling = DefaultValueHandling.Populate)]
[DefaultValue (-1)] [DefaultValue(-1)]
public int DinnerSecondIndex = -1; public int DinnerSecondIndex = -1;
} }
...@@ -40,7 +42,7 @@ namespace inutralia.Models ...@@ -40,7 +42,7 @@ namespace inutralia.Models
/// Platos seleccionados para cada uno de los días /// Platos seleccionados para cada uno de los días
/// </summary> /// </summary>
[JsonProperty("day_selections")] [JsonProperty("day_selections")]
public MealSelections [] DaySelections; public MealSelections[] DaySelections;
/// <summary> /// <summary>
/// Identificador del último menú semanal recibido del servidor /// Identificador del último menú semanal recibido del servidor
...@@ -52,19 +54,18 @@ namespace inutralia.Models ...@@ -52,19 +54,18 @@ namespace inutralia.Models
/// Copia los datos del menú recibido del servidor /// Copia los datos del menú recibido del servidor
/// </summary> /// </summary>
/// <param name="menu">El recibido del servidor</param> /// <param name="menu">El recibido del servidor</param>
public void AssignFromMenu ( Menu menu) public void AssignFromMenu(Menu menu)
{ {
// Usar el serializador Json para copiar los datos del menú // Usar el serializador Json para copiar los datos del menú
JsonConvert.PopulateObject (JsonConvert.SerializeObject (menu), this, _jsonSettings); JsonConvert.PopulateObject(JsonConvert.SerializeObject(menu), this, _jsonSettings);
// Borrar la selección de los platos de cada día // Borrar la selección de los platos de cada día
DaySelections = new MealSelections [7]; DaySelections = new MealSelections[7];
for (int i = 0; i < 7; i++) for (int i = 0; i < 7; i++)
DaySelections[i] = new MealSelections (); DaySelections[i] = new MealSelections();
// Asignar último menú recibido // Asignar último menú recibido
LastReceivedMenuId = menu.Id; LastReceivedMenuId = menu.Id;
} }
} }
} }
using Newtonsoft.Json; using Newtonsoft.Json;
using System.ComponentModel; using System.ComponentModel;
using System;
namespace inutralia.Models namespace inutralia.Models
{ {
[JsonObject(MemberSerialization.OptIn)] [JsonObject(MemberSerialization.OptIn)]
[DataPath("menu")] [DataPath("menu")]
public class Menu : MenuBase public class Menu : MenuBase
{ {
[JsonProperty("recomendation", DefaultValueHandling = DefaultValueHandling.Populate)] [JsonProperty("recomendation", DefaultValueHandling = DefaultValueHandling.Populate)]
[DefaultValue("")] [DefaultValue("")]
public string Recomendation public string Recomendation { get; set; }
{ get; set; }
[JsonProperty("intro", DefaultValueHandling = DefaultValueHandling.Populate)] [JsonProperty("intro", DefaultValueHandling = DefaultValueHandling.Populate)]
[DefaultValue("")] [DefaultValue("")]
public string Intro public string Intro { get; set; }
{ get; set; }
public override string Title public override string Title
{ {
...@@ -26,8 +24,6 @@ namespace inutralia.Models ...@@ -26,8 +24,6 @@ namespace inutralia.Models
} }
} }
public Menu() public Menu() { }
{
}
} }
} }
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
namespace inutralia.Models namespace inutralia.Models
{ {
public abstract class MenuBase : ObservableEntityData public abstract class MenuBase : ObservableEntityData
...@@ -10,52 +9,43 @@ namespace inutralia.Models ...@@ -10,52 +9,43 @@ namespace inutralia.Models
public abstract string Title { get; } public abstract string Title { get; }
[JsonProperty("days")] [JsonProperty("days")]
public IList<Day> Days public IList<Day> Days { get; set; }
{ get; set; }
[JsonProperty("recBreakfastBase")] [JsonProperty("recBreakfastBase")]
[DefaultValue("")] [DefaultValue("")]
public string RecBreakfastBase public string RecBreakfastBase { get; set; }
{ get; set; }
[JsonProperty("recBreakfastExt")] [JsonProperty("recBreakfastExt")]
[DefaultValue("")] [DefaultValue("")]
public string RecBreakfastExt public string RecBreakfastExt { get; set; }
{ get; set; }
[JsonProperty("recMorningBase")] [JsonProperty("recMorningBase")]
[DefaultValue("")] [DefaultValue("")]
public string RecMorningBase public string RecMorningBase { get; set; }
{ get; set; }
[JsonProperty("recMorningExt")] [JsonProperty("recMorningExt")]
[DefaultValue("")] [DefaultValue("")]
public string RecMorningExt public string RecMorningExt { get; set; }
{ get; set; }
[JsonProperty("recAfternoonBase")] [JsonProperty("recAfternoonBase")]
[DefaultValue("")] [DefaultValue("")]
public string RecAfternoonBase public string RecAfternoonBase { get; set; }
{ get; set; }
[JsonProperty("recAfternoonExt")] [JsonProperty("recAfternoonExt")]
[DefaultValue("")] [DefaultValue("")]
public string RecAfternoonExt public string RecAfternoonExt { get; set; }
{ get; set; }
[JsonProperty("recGeneralBase")] [JsonProperty("recGeneralBase")]
[DefaultValue("")] [DefaultValue("")]
public string RecGeneralBase public string RecGeneralBase { get; set; }
{ get; set; }
[JsonProperty("recGeneralExt")] [JsonProperty("recGeneralExt")]
[DefaultValue("")] [DefaultValue("")]
public string RecGeneralExt public string RecGeneralExt { get; set; }
{ get; set; }
public string resume => "<br><div style='background-color:#62b9ae; overflow: auto; width:100%; text-align:center'><h3 style='color:#FFFFFF'> DESAYUNO </h3></div><br>" + RecBreakfastBase + "<br>" + RecBreakfastExt + public string resume => "<br><div style='background-color:#62b9ae; overflow: auto; width:100%; text-align:center'><h3 style='color:#FFFFFF'> DESAYUNO </h3></div><br>" + RecBreakfastBase + "<br>" + RecBreakfastExt +
"<br><div style='background-color:#62b9ae; overflow: auto; width:100%; text-align:center'><h3 style='color:#FFFFFF'> MEDIA MAÑANA </h3></div><br>" + RecMorningBase + "<br>" + RecMorningExt + "<br><div style='background-color:#62b9ae; overflow: auto; width:100%; text-align:center'><h3 style='color:#FFFFFF'> MEDIA MAÑANA </h3></div><br>" + RecMorningBase + "<br>" + RecMorningExt +
"<br><div style='background-color:#62b9ae; overflow: auto; width:100%; text-align:center'><h3 style='color:#FFFFFF'> MERIENDA </h3></div><br>" + RecAfternoonBase + "<br>" + RecAfternoonExt + "<br><div style='background-color:#62b9ae; overflow: auto; width:100%; text-align:center'><h3 style='color:#FFFFFF'> MERIENDA </h3></div><br>" + RecAfternoonBase + "<br>" + RecAfternoonExt +
"<br><div style='background-color:#62b9ae; overflow: auto; width:100%; text-align:center'><h3 style='color:#FFFFFF'> CONSEJOS GENERALES </h3></div><br>" + RecGeneralBase + "<br>" + RecGeneralExt ; "<br><div style='background-color:#62b9ae; overflow: auto; width:100%; text-align:center'><h3 style='color:#FFFFFF'> CONSEJOS GENERALES </h3></div><br>" + RecGeneralBase + "<br>" + RecGeneralExt;
} }
} }
\ No newline at end of file
...@@ -9,14 +9,14 @@ namespace inutralia.Models ...@@ -9,14 +9,14 @@ namespace inutralia.Models
/// </summary> /// </summary>
public class ObservableEntityData : ObservableObject, IIdentifiableEntity public class ObservableEntityData : ObservableObject, IIdentifiableEntity
{ {
public ObservableEntityData () public ObservableEntityData()
{ {
// Los identificadores negativos indican que la entidad es nueva y no // Los identificadores negativos indican que la entidad es nueva y no
// existe por tanto en la base de datos // existe por tanto en la base de datos
Id = -1; Id = -1;
} }
[JsonProperty ("id", Required = Required.Always)] [JsonProperty("id", Required = Required.Always)]
public int Id { get; set; } public int Id { get; set; }
} }
} }
using Newtonsoft.Json; using Newtonsoft.Json;
using System.ComponentModel; using System.ComponentModel;
using System.Linq;
using System.Runtime.Serialization;
namespace inutralia.Models namespace inutralia.Models
{ {
...@@ -27,8 +25,6 @@ namespace inutralia.Models ...@@ -27,8 +25,6 @@ namespace inutralia.Models
[JsonProperty("weight")] [JsonProperty("weight")]
[DefaultValue(0)] [DefaultValue(0)]
//public int _Weight;
//public int Weight { get { return _Weight;} set { SetProperty(ref _Weight,value);} }
public int Weight { get; set; } public int Weight { get; set; }
[JsonProperty("physical")] [JsonProperty("physical")]
...@@ -60,7 +56,6 @@ namespace inutralia.Models ...@@ -60,7 +56,6 @@ namespace inutralia.Models
[DefaultValue("0")] [DefaultValue("0")]
public bool Lactose { get; set; } public bool Lactose { get; set; }
[JsonProperty("diabetes")] [JsonProperty("diabetes")]
[JsonConverter(typeof(BoolConverter))] [JsonConverter(typeof(BoolConverter))]
[DefaultValue("0")] [DefaultValue("0")]
...@@ -105,8 +100,6 @@ namespace inutralia.Models ...@@ -105,8 +100,6 @@ namespace inutralia.Models
[DefaultValue(0)] [DefaultValue(0)]
public int Preference { get; set; } public int Preference { get; set; }
public Profile() public Profile() { }
{
}
} }
} }
 using Newtonsoft.Json;
using Newtonsoft.Json;
using System.Collections.Generic; using System.Collections.Generic;
namespace inutralia.Models namespace inutralia.Models
{ {
[JsonObject(MemberSerialization.OptIn)] [JsonObject(MemberSerialization.OptIn)]
[DataPath("recipe")] [DataPath("recipe")]
public class Recipe : ObservableEntityData public class Recipe : ObservableEntityData
{ {
[JsonProperty("name", Required = Required.Always)] [JsonProperty("name", Required = Required.Always)]
public string Name { get; set; } public string Name { get; set; }
...@@ -54,9 +52,6 @@ namespace inutralia.Models ...@@ -54,9 +52,6 @@ namespace inutralia.Models
public string ExcerptQuotes => $"\"{Excerpt}\""; public string ExcerptQuotes => $"\"{Excerpt}\"";
public Recipe() public Recipe() { }
{
}
} }
} }
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
namespace inutralia.Models namespace inutralia.Models
{ {
[JsonObject (MemberSerialization.OptIn)] [JsonObject(MemberSerialization.OptIn)]
public class RecipeOption : ObservableEntityData public class RecipeOption : ObservableEntityData
{ {
[JsonProperty ("name", Required = Required.Always)] [JsonProperty("name", Required = Required.Always)]
public string Name { get; set; } public string Name { get; set; }
public bool Selected { get; set; } public bool Selected { get; set; }
......
...@@ -3,8 +3,9 @@ using System.Collections.Generic; ...@@ -3,8 +3,9 @@ using System.Collections.Generic;
namespace inutralia.Models namespace inutralia.Models
{ {
[JsonObject (MemberSerialization.OptIn)] [JsonObject(MemberSerialization.OptIn)]
[DataPath ("options")] [DataPath("options")]
public class RecipeOptionGroup : ObservableEntityData public class RecipeOptionGroup : ObservableEntityData
{ {
private bool _isExpanded = false; private bool _isExpanded = false;
...@@ -22,10 +23,10 @@ namespace inutralia.Models ...@@ -22,10 +23,10 @@ namespace inutralia.Models
} }
} }
[JsonProperty ("name", Required = Required.Always)] [JsonProperty("name", Required = Required.Always)]
public string Name { get; set; } public string Name { get; set; }
[JsonProperty ("options")] [JsonProperty("options")]
public IList<RecipeOption> Options { get; set; } public IList<RecipeOption> Options { get; set; }
} }
} }
using Newtonsoft.Json; using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace inutralia.Models namespace inutralia.Models
{ {
[JsonObject(MemberSerialization.OptIn)] [JsonObject(MemberSerialization.OptIn)]
[DataPath("shoppingList")] [DataPath("shoppingList")]
public class ShoppingList : ObservableEntityData public class ShoppingList : ObservableEntityData
{ {
[JsonProperty("text", Required = Required.Always)] [JsonProperty("text", Required = Required.Always)]
public string Text { get; set; } public string Text { get; set; }
......
...@@ -4,20 +4,21 @@ using System.Collections.Generic; ...@@ -4,20 +4,21 @@ using System.Collections.Generic;
namespace inutralia.Models namespace inutralia.Models
{ {
[JsonObject (MemberSerialization.OptIn)] [JsonObject(MemberSerialization.OptIn)]
[DataPath ("game")] [DataPath("game")]
public class TrivialGame : ObservableEntityData public class TrivialGame : ObservableEntityData
{ {
[JsonProperty ("start", Required = Required.Always)] [JsonProperty("start", Required = Required.Always)]
public string StartDate { get; protected set; } public string StartDate { get; protected set; }
[JsonProperty ("finish", Required = Required.Always )] [JsonProperty("finish", Required = Required.Always)]
public string FinishDate { get; protected set; } public string FinishDate { get; protected set; }
[JsonProperty ("questions", Required = Required.Always)] [JsonProperty("questions", Required = Required.Always)]
public IList<TrivialQuestion> Questions; public IList<TrivialQuestion> Questions;
[JsonProperty ("answers", Required = Required.Always)] [JsonProperty("answers", Required = Required.Always)]
public IList<int> Answers; public IList<int> Answers;
public string Progress => $"{Answers.Count} / {Questions.Count}"; public string Progress => $"{Answers.Count} / {Questions.Count}";
...@@ -28,13 +29,13 @@ namespace inutralia.Models ...@@ -28,13 +29,13 @@ namespace inutralia.Models
{ {
// Si no está todo respondido, no hay puntuación // Si no está todo respondido, no hay puntuación
int n = Answers.Count; int n = Answers.Count;
if ( (n < Questions.Count) || (n < 1) ) if ((n < Questions.Count) || (n < 1))
return ""; return "";
// Calcular respuestas correctas // Calcular respuestas correctas
int correctas = 0; int correctas = 0;
for (int i = 0; i < n; i++) for (int i = 0; i < n; i++)
if (Questions [i].ValidIndex == Answers [i]) if (Questions[i].ValidIndex == Answers[i])
correctas++; correctas++;
// TODO: Otro mecanismo de score ? // TODO: Otro mecanismo de score ?
...@@ -43,28 +44,26 @@ namespace inutralia.Models ...@@ -43,28 +44,26 @@ namespace inutralia.Models
} }
} }
public static TrivialGame Create ( IList<TrivialQuestion> questions) public static TrivialGame Create(IList<TrivialQuestion> questions)
{ {
TrivialGame game = new TrivialGame (); TrivialGame game = new TrivialGame();
game.Questions = questions; game.Questions = questions;
game.Answers = new List<int> (); game.Answers = new List<int>();
game.StartDate = DateTime.Now.ToString(); game.StartDate = DateTime.Now.ToString();
game.FinishDate = ""; game.FinishDate = "";
return game; return game;
} }
public bool Answer ( int answer) public bool Answer(int answer)
{ {
int n = Answers.Count; int n = Answers.Count;
if(n < Questions.Count) if (n < Questions.Count)
{ {
Answers.Add (answer); Answers.Add(answer);
OnPropertyChanged ("Answers"); OnPropertyChanged("Answers");
OnPropertyChanged ("Progress"); OnPropertyChanged("Progress");
OnPropertyChanged ("Score"); OnPropertyChanged("Score");
return Questions [n].ValidIndex == answer; return Questions[n].ValidIndex == answer;
} //endif } //endif
return false; return false;
......
...@@ -4,21 +4,22 @@ using System.ComponentModel; ...@@ -4,21 +4,22 @@ using System.ComponentModel;
namespace inutralia.Models namespace inutralia.Models
{ {
[JsonObject (MemberSerialization.OptIn)] [JsonObject(MemberSerialization.OptIn)]
[DataPath ("trivial")] [DataPath("trivial")]
public class TrivialQuestion : ObservableEntityData public class TrivialQuestion : ObservableEntityData
{ {
[JsonProperty ("image", DefaultValueHandling = DefaultValueHandling.Populate)] [JsonProperty("image", DefaultValueHandling = DefaultValueHandling.Populate)]
[DefaultValue("")] [DefaultValue("")]
public string Image { get; set; } public string Image { get; set; }
[JsonProperty ("text", Required = Required.Always)] [JsonProperty("text", Required = Required.Always)]
public string Text { get; set; } public string Text { get; set; }
[JsonProperty ("options", Required = Required.Always)] [JsonProperty("options", Required = Required.Always)]
public IList<string> Options { get; set; } public IList<string> Options { get; set; }
[JsonProperty ("valid", Required = Required.Always)] [JsonProperty("valid", Required = Required.Always)]
public int ValidIndex { get; set; } public int ValidIndex { get; set; }
} }
} }
 using Newtonsoft.Json;
using Newtonsoft.Json;
using System.ComponentModel;
using System.Linq;
using System.Runtime.Serialization;
namespace inutralia.Models namespace inutralia.Models
{ {
[JsonObject(MemberSerialization.OptIn)] [JsonObject(MemberSerialization.OptIn)]
[DataPath("user")] [DataPath("user")]
public class User : ObservableEntityData public class User : ObservableEntityData
{ {
public User() public User() { }
{
}
} }
} }
using System.Diagnostics;
using Foundation; using Foundation;
using UIKit; using UIKit;
using Xamarin.Forms; using Xamarin.Forms;
using Lottie.Forms.iOS.Renderers; using Lottie.Forms.iOS.Renderers;
using FFImageLoading.Forms.Touch;
using UXDivers.Artina.Shared; using UXDivers.Artina.Shared;
namespace inutralia namespace inutralia
{ {
// The UIApplicationDelegate for the application. This class is responsible for launching the // The UIApplicationDelegate for the application. This class is responsible for launching the
// User Interface of the application, as well as listening (and optionally responding) to application events from iOS. // User Interface of the application, as well as listening (and optionally responding) to application events from iOS
[Register ("AppDelegate")]
[Register("AppDelegate")]
public class AppDelegate : Xamarin.Forms.Platform.iOS.FormsApplicationDelegate public class AppDelegate : Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
{ {
public override bool FinishedLaunching (UIApplication app, NSDictionary options) public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{ {
Forms.Init (); Forms.Init();
FFImageLoading.Forms.Platform.CachedImageRenderer.Init(); // Initializing FFImageLoading
AnimationViewRenderer.Init(); // Initializing Lottie
GrialKit.Init(new ThemeColors(), "inutralia.GrialLicense"); // Initializing FFImageLoading
FFImageLoading.Forms.Platform.CachedImageRenderer.Init();
// Initializing Lottie
AnimationViewRenderer.Init();
//Initializing GrialKit
GrialKit.Init(new ThemeColors(), "inutralia.GrialLicense");
UIApplication.SharedApplication.SetStatusBarHidden(true, true); UIApplication.SharedApplication.SetStatusBarHidden(true, true);
var tint = UIColor.White; var tint = UIColor.White;
UIButton.AppearanceWhenContainedIn( typeof(UINavigationBar) ).TintColor = tint; UIButton.AppearanceWhenContainedIn(typeof(UINavigationBar)).TintColor = tint;
app.SetStatusBarStyle(UIStatusBarStyle.LightContent, true); app.SetStatusBarStyle(UIStatusBarStyle.LightContent, true);
//UINavigationBar.Appearance.SetTitleTextAttributes(new UITextAttributes{TextColor = UIColor.White});
UINavigationBar.Appearance.TintColor = UIColor.White; UINavigationBar.Appearance.TintColor = UIColor.White;
// Code for starting up the Xamarin Test Cloud Agent
#if ENABLE_TEST_CLOUD
Xamarin.Calabash.Start();
#endif
FormsHelper.ForceLoadingAssemblyContainingType(typeof(UXDivers.Effects.Effects)); FormsHelper.ForceLoadingAssemblyContainingType(typeof(UXDivers.Effects.Effects));
FormsHelper.ForceLoadingAssemblyContainingType<UXDivers.Effects.iOS.CircleEffect>(); FormsHelper.ForceLoadingAssemblyContainingType<UXDivers.Effects.iOS.CircleEffect>();
LoadApplication (new App ()); LoadApplication(new App());
return base.FinishedLaunching (app, options); return base.FinishedLaunching(app, options);
} }
} }
} }
\ No newline at end of file
...@@ -5,11 +5,11 @@ namespace inutralia ...@@ -5,11 +5,11 @@ namespace inutralia
public class Application public class Application
{ {
// This is the main entry point of the application. // This is the main entry point of the application.
static void Main (string[] args) static void Main(string[] args)
{ {
// if you want to use a different Application Delegate class from "AppDelegate" // if you want to use a different Application Delegate class from "AppDelegate"
// you can specify it here. // you can specify it here.
UIApplication.Main (args, null, "AppDelegate"); UIApplication.Main(args, null, "AppDelegate");
} }
} }
} }
...@@ -197,10 +197,6 @@ ...@@ -197,10 +197,6 @@
</Reference> </Reference>
<Reference Include="Xamarin.iOS" /> <Reference Include="Xamarin.iOS" />
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />
<Reference Include="SkiaSharp">
<HintPath>..\packages\SkiaSharp.1.56.1\lib\XamariniOS\SkiaSharp.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ImageAsset Include="Resources\Images.xcassets\AppIcons.appiconset\Contents.json"> <ImageAsset Include="Resources\Images.xcassets\AppIcons.appiconset\Contents.json">
...@@ -372,9 +368,6 @@ ...@@ -372,9 +368,6 @@
<BundleResource Include="Resources\icon_info.png" /> <BundleResource Include="Resources\icon_info.png" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<BundleResource Include="icon_filter.png" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\icon_filter.png" /> <BundleResource Include="Resources\icon_filter.png" />
</ItemGroup> </ItemGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
......
...@@ -5,11 +5,10 @@ namespace inutralia.API ...@@ -5,11 +5,10 @@ namespace inutralia.API
class Constants class Constants
{ {
public static readonly string ApiUrlTemplate = public static readonly string ApiUrlTemplate =
Device.OnPlatform ("http://i20.inutralia.com/api/v1/{0}?api-key=7745289b-f09c-4e0b-89d1-bb59c599c85e", Device.OnPlatform("http://i20.inutralia.com/api/v1/{0}?api-key=7745289b-f09c-4e0b-89d1-bb59c599c85e",
"http://i20.inutralia.com/api/v1/{0}?api-key=7745289b-f09c-4e0b-89d1-bb59c599c85e", "http://i20.inutralia.com/api/v1/{0}?api-key=7745289b-f09c-4e0b-89d1-bb59c599c85e",
"http://i20.inutralia.com/api/v1/{0}?api-key=7745289b-f09c-4e0b-89d1-bb59c599c85e"); "http://i20.inutralia.com/api/v1/{0}?api-key=7745289b-f09c-4e0b-89d1-bb59c599c85e");
// Url redirect a DEL SUPER // Url redirect a DEL SUPER
public const string ApiUrl = "https://delsuper.es/inutralia?ids="; public const string ApiUrl = "https://delsuper.es/inutralia?ids=";
......
...@@ -21,7 +21,7 @@ namespace inutralia.API ...@@ -21,7 +21,7 @@ namespace inutralia.API
/// </summary> /// </summary>
/// <param name="username">Nombre del usuario accediendo a la API</param> /// <param name="username">Nombre del usuario accediendo a la API</param>
/// <param name="password">Contraseña del usuario</param> /// <param name="password">Contraseña del usuario</param>
void CredentialsSet (string username, string password); void CredentialsSet(string username, string password);
/// <summary> /// <summary>
/// Registra un usuario en el servidor /// Registra un usuario en el servidor
......
...@@ -5,9 +5,7 @@ using Plugin.Settings; ...@@ -5,9 +5,7 @@ using Plugin.Settings;
using Plugin.Settings.Abstractions; using Plugin.Settings.Abstractions;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Reflection; using System.Reflection;
using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace inutralia.API namespace inutralia.API
...@@ -22,96 +20,96 @@ namespace inutralia.API ...@@ -22,96 +20,96 @@ namespace inutralia.API
#pragma warning disable CS1998 // Sabemos que no vamos a poner await en los métodos async, por lo que deshabilitamos el warning #pragma warning disable CS1998 // Sabemos que no vamos a poner await en los métodos async, por lo que deshabilitamos el warning
public async Task<bool> DeleteItemAsync<T> (T item) where T : IIdentifiableEntity public async Task<bool> DeleteItemAsync<T>(T item) where T : IIdentifiableEntity
{ {
Type type = item.GetType (); Type type = item.GetType();
string path = GetItemPath (item); string path = GetItemPath(item);
if(AppSettings.Contains(path)) if (AppSettings.Contains(path))
{ {
// Eliminar elemento // Eliminar elemento
AppSettings.Remove (path); AppSettings.Remove(path);
// Eliminar de la lista de elementos // Eliminar de la lista de elementos
var list = GetIdList (type); var list = GetIdList(type);
list.Remove (item.Id); list.Remove(item.Id);
SetIdList (type, list); SetIdList(type, list);
} //endif } //endif
return true; return true;
} }
public async Task<T> GetItemAsync<T> (int id) where T : IIdentifiableEntity public async Task<T> GetItemAsync<T>(int id) where T : IIdentifiableEntity
{ {
string path = string.Format ("Models/{0}/{1}", GetDataPath (typeof (T)), id); string path = string.Format("Models/{0}/{1}", GetDataPath(typeof(T)), id);
if(AppSettings.Contains(path)) if (AppSettings.Contains(path))
{ {
var content = AppSettings.GetValueOrDefault<string> (path); var content = AppSettings.GetValueOrDefault<string>(path);
return JsonConvert.DeserializeObject<T> (content); return JsonConvert.DeserializeObject<T>(content);
} //endif } //endif
return default (T); return default(T);
} }
public async Task<bool> RefreshItemAsync<T> (T item) where T : IIdentifiableEntity public async Task<bool> RefreshItemAsync<T>(T item) where T : IIdentifiableEntity
{ {
string path = GetItemPath (item); string path = GetItemPath(item);
if(AppSettings.Contains(path)) if (AppSettings.Contains(path))
{ {
var content = AppSettings.GetValueOrDefault<string> (path); var content = AppSettings.GetValueOrDefault<string>(path);
JsonConvert.PopulateObject (content, item); JsonConvert.PopulateObject(content, item);
return true; return true;
} //endif } //endif
return false; return false;
} }
public async Task<List<T>> RefreshListAsync<T> () where T : IIdentifiableEntity public async Task<List<T>> RefreshListAsync<T>() where T : IIdentifiableEntity
{ {
Type type = typeof (T); Type type = typeof(T);
string basePath = GetDataPath (type); string basePath = GetDataPath(type);
List<int> idList = GetIdList (type); List<int> idList = GetIdList(type);
List<T> retVal = new List<T> (); List<T> retVal = new List<T>();
List<int> idsToRemove = new List<int> (); List<int> idsToRemove = new List<int>();
foreach(int id in idList) foreach (int id in idList)
{ {
string path = string.Format ("Models/{0}/{1}", basePath, id); string path = string.Format("Models/{0}/{1}", basePath, id);
if (AppSettings.Contains (path)) if (AppSettings.Contains(path))
{ {
var content = AppSettings.GetValueOrDefault<string> (path); var content = AppSettings.GetValueOrDefault<string>(path);
retVal.Add (JsonConvert.DeserializeObject<T> (content)); retVal.Add(JsonConvert.DeserializeObject<T>(content));
} }
else else
{ {
idsToRemove.Add (id); idsToRemove.Add(id);
} //endif } //endif
} //endforeach } //endforeach
if(idsToRemove.Count > 0) if (idsToRemove.Count > 0)
{ {
// Borrar de la lista inicial los que haya que elilminar, y guardar la lista // Borrar de la lista inicial los que haya que elilminar, y guardar la lista
idList.RemoveAll ((i) => { return idsToRemove.Contains (i); }); idList.RemoveAll((i) => { return idsToRemove.Contains(i); });
SetIdList (type, idList); SetIdList(type, idList);
} //endif } //endif
return retVal; return retVal;
} }
public async Task<int?> UpdateItemAsync<T> (T item, bool isNew = false) where T : IIdentifiableEntity public async Task<int?> UpdateItemAsync<T>(T item, bool isNew = false) where T : IIdentifiableEntity
{ {
if(isNew) if (isNew)
{ {
// Elemento nuevo: asignarle Id. Cogemos la lista de ids ... // Elemento nuevo: asignarle Id. Cogemos la lista de ids ...
List<int> idList = GetIdList (item.GetType ()); List<int> idList = GetIdList(item.GetType());
// ... buscamos el máximo y le sumamos 1 // ... buscamos el máximo y le sumamos 1
//item.Id = (idList.Count < 1) ? 1 : idList.Max () + 1; //item.Id = (idList.Count < 1) ? 1 : idList.Max () + 1;
// ... añadimos el nuevo id a la lista // ... añadimos el nuevo id a la lista
idList.Add (item.Id); idList.Add(item.Id);
// ... y la guardamos // ... y la guardamos
SetIdList (item.GetType (), idList); SetIdList(item.GetType(), idList);
} }
else if (!AppSettings.Contains(GetItemPath(item))) else if (!AppSettings.Contains(GetItemPath(item)))
{ {
...@@ -120,7 +118,7 @@ namespace inutralia.API ...@@ -120,7 +118,7 @@ namespace inutralia.API
} //endif } //endif
// Guardar elemento // Guardar elemento
AppSettings.AddOrUpdateValue (GetItemPath (item), JsonConvert.SerializeObject (item)); AppSettings.AddOrUpdateValue(GetItemPath(item), JsonConvert.SerializeObject(item));
// Retornar su id // Retornar su id
return item.Id; return item.Id;
...@@ -128,38 +126,38 @@ namespace inutralia.API ...@@ -128,38 +126,38 @@ namespace inutralia.API
#pragma warning restore CS1998 // Sabemos que no vamos a poner await en los métodos async, por lo que deshabilitamos el warning #pragma warning restore CS1998 // Sabemos que no vamos a poner await en los métodos async, por lo que deshabilitamos el warning
private static List<int> GetIdList (Type t, List<int> listToFill = null) private static List<int> GetIdList(Type t, List<int> listToFill = null)
{ {
// Crear lista si no nos pasan ninguna. Vaciarla. // Crear lista si no nos pasan ninguna. Vaciarla.
List<int> retVal = listToFill ?? new List<int> (); List<int> retVal = listToFill ?? new List<int>();
retVal.Clear (); retVal.Clear();
// Leer lista de ids (sólo si existe) // Leer lista de ids (sólo si existe)
string path = string.Format ("ModelIdList/{0}", GetDataPath (t)); string path = string.Format("ModelIdList/{0}", GetDataPath(t));
if (AppSettings.Contains (path)) if (AppSettings.Contains(path))
{ {
// Deserializar valor json // Deserializar valor json
string value = AppSettings.GetValueOrDefault<string> (path); string value = AppSettings.GetValueOrDefault<string>(path);
JsonConvert.PopulateObject (value, retVal); JsonConvert.PopulateObject(value, retVal);
} //endif } //endif
return retVal; return retVal;
} }
private static void SetIdList (Type t, List<int> idList) private static void SetIdList(Type t, List<int> idList)
{ {
string path = string.Format ("ModelIdList/{0}", GetDataPath (t)); string path = string.Format("ModelIdList/{0}", GetDataPath(t));
if ((idList == null) || (idList.Count < 1)) if ((idList == null) || (idList.Count < 1))
{ {
// Si la lista está vacía, borrar la entrada de settings // Si la lista está vacía, borrar la entrada de settings
AppSettings.Remove (path); AppSettings.Remove(path);
} }
else else
{ {
// Serializar con JSON y guardar // Serializar con JSON y guardar
string value = JsonConvert.SerializeObject (idList); string value = JsonConvert.SerializeObject(idList);
AppSettings.AddOrUpdateValue (path, value); AppSettings.AddOrUpdateValue(path, value);
} //endif } //endif
} }
...@@ -168,15 +166,15 @@ namespace inutralia.API ...@@ -168,15 +166,15 @@ namespace inutralia.API
/// </summary> /// </summary>
/// <param name="t">Tipo de dato de la entidad</typeparam> /// <param name="t">Tipo de dato de la entidad</typeparam>
/// <returns>El path correspondiente dentro del API</returns> /// <returns>El path correspondiente dentro del API</returns>
private static string GetDataPath (Type t) private static string GetDataPath(Type t)
{ {
// Si tiene el atributo DataPath, lo utilizamos // Si tiene el atributo DataPath, lo utilizamos
DataPathAttribute attr = t.GetTypeInfo ().GetCustomAttribute<DataPathAttribute> (); DataPathAttribute attr = t.GetTypeInfo().GetCustomAttribute<DataPathAttribute>();
if (attr != null) if (attr != null)
return attr.DataPath; return attr.DataPath;
// En caso contrario devolvemos el nombre de la clase en minúsculas y en plural // En caso contrario devolvemos el nombre de la clase en minúsculas y en plural
return t.Name.ToLowerInvariant () + "s"; return t.Name.ToLowerInvariant() + "s";
} }
/// <summary> /// <summary>
...@@ -185,11 +183,9 @@ namespace inutralia.API ...@@ -185,11 +183,9 @@ namespace inutralia.API
/// <typeparam name="T"></typeparam> /// <typeparam name="T"></typeparam>
/// <param name="item"></param> /// <param name="item"></param>
/// <returns></returns> /// <returns></returns>
private static string GetItemPath<T> (T item) where T: IIdentifiableEntity private static string GetItemPath<T>(T item) where T : IIdentifiableEntity
{ {
return string.Format ("Models/{0}/{1}", GetDataPath (item.GetType ()), item.Id); return string.Format("Models/{0}/{1}", GetDataPath(item.GetType()), item.Id);
} }
} }
} }
...@@ -9,7 +9,6 @@ using System.Net.Http.Headers; ...@@ -9,7 +9,6 @@ using System.Net.Http.Headers;
using System.Reflection; using System.Reflection;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Xamarin.Forms;
namespace inutralia.API namespace inutralia.API
{ {
...@@ -55,15 +54,15 @@ namespace inutralia.API ...@@ -55,15 +54,15 @@ namespace inutralia.API
try try
{ {
// Hacer la petición // Hacer la petición
var response = await _client.GetAsync (uri); var response = await _client.GetAsync(uri);
if (response.IsSuccessStatusCode) if (response.IsSuccessStatusCode)
{ {
// Si es correcta, traer los datos y deserializarlos // Si es correcta, traer los datos y deserializarlos
var content = await response.Content.ReadAsStringAsync (); var content = await response.Content.ReadAsStringAsync();
return JsonConvert.DeserializeObject<T> (content); return JsonConvert.DeserializeObject<T>(content);
} //endif } //endif
} }
catch(Exception) catch (Exception)
{ } { }
// En caso contrario retornar error // En caso contrario retornar error
...@@ -90,7 +89,7 @@ namespace inutralia.API ...@@ -90,7 +89,7 @@ namespace inutralia.API
public async Task<bool> RefreshItemAsync<T>(T item) where T : IIdentifiableEntity public async Task<bool> RefreshItemAsync<T>(T item) where T : IIdentifiableEntity
{ {
// Preparar el path de acceso al elemento // Preparar el path de acceso al elemento
string fullPath = string.Format("{0}/{1}", GetDataPath(item.GetType() ), item.Id); string fullPath = string.Format("{0}/{1}", GetDataPath(item.GetType()), item.Id);
// Crear uri a partir de la URL base y el path // Crear uri a partir de la URL base y el path
var uri = new Uri(string.Format(Constants.ApiUrlTemplate, fullPath)); var uri = new Uri(string.Format(Constants.ApiUrlTemplate, fullPath));
...@@ -98,14 +97,14 @@ namespace inutralia.API ...@@ -98,14 +97,14 @@ namespace inutralia.API
try try
{ {
// Hacer la petición // Hacer la petición
var response = await _client.GetAsync (uri); var response = await _client.GetAsync(uri);
if (response.IsSuccessStatusCode) if (response.IsSuccessStatusCode)
{ {
// Si es correcta, traer los datos y deserializarlos // Si es correcta, traer los datos y deserializarlos
var responseContent = await response.Content.ReadAsStringAsync (); var responseContent = await response.Content.ReadAsStringAsync();
try try
{ {
JsonConvert.PopulateObject (responseContent, item, _serializerSettings); JsonConvert.PopulateObject(responseContent, item, _serializerSettings);
} }
catch (Exception e) catch (Exception e)
{ {
...@@ -115,7 +114,7 @@ namespace inutralia.API ...@@ -115,7 +114,7 @@ namespace inutralia.API
return true; return true;
} //endif } //endif
} }
catch(Exception) catch (Exception)
{ } { }
// En caso contrario retornar error // En caso contrario retornar error
...@@ -171,7 +170,6 @@ namespace inutralia.API ...@@ -171,7 +170,6 @@ namespace inutralia.API
catch (Exception) catch (Exception)
{ } { }
// Si llegamos aquí, es que la petición devolvió error // Si llegamos aquí, es que la petición devolvió error
return null; return null;
} }
...@@ -377,9 +375,9 @@ namespace inutralia.API ...@@ -377,9 +375,9 @@ namespace inutralia.API
/// </summary> /// </summary>
/// <typeparam name="T">Tipo de dato de la entidad</typeparam> /// <typeparam name="T">Tipo de dato de la entidad</typeparam>
/// <returns>El path correspondiente dentro del API</returns> /// <returns>El path correspondiente dentro del API</returns>
private static string GetDataPath<T> () private static string GetDataPath<T>()
{ {
return GetDataPath (typeof (T)); return GetDataPath(typeof(T));
} }
/// <summary> /// <summary>
...@@ -430,6 +428,5 @@ namespace inutralia.API ...@@ -430,6 +428,5 @@ namespace inutralia.API
{ {
public string error { get; set; } public string error { get; set; }
} }
} }
} }
...@@ -52,7 +52,6 @@ ...@@ -52,7 +52,6 @@
<FileImageSource x:Key="WelcomeBackgroundImagePhone">welcome_bg.jpg</FileImageSource> <FileImageSource x:Key="WelcomeBackgroundImagePhone">welcome_bg.jpg</FileImageSource>
<FileImageSource x:Key="WelcomeBackgroundImageTablet">welcome_bg_tablet.jpg</FileImageSource> <FileImageSource x:Key="WelcomeBackgroundImageTablet">welcome_bg_tablet.jpg</FileImageSource>
<!--<FileImageSource x:Key="BrandImage">logo.png</FileImageSource>--> <!--<FileImageSource x:Key="BrandImage">logo.png</FileImageSource>-->
<FileImageSource x:Key="BrandImage">logo_empresa.png</FileImageSource> <FileImageSource x:Key="BrandImage">logo_empresa.png</FileImageSource>
...@@ -104,8 +103,6 @@ ...@@ -104,8 +103,6 @@
</OnPlatform> </OnPlatform>
<!-- ENDS RESPONSIVE HELPERS --> <!-- ENDS RESPONSIVE HELPERS -->
<!-- IMPLICIT STYLES --> <!-- IMPLICIT STYLES -->
<Style TargetType="Frame"> <Style TargetType="Frame">
<Setter Property="OutlineColor" Value="{DynamicResource BrandColor}" /> <Setter Property="OutlineColor" Value="{DynamicResource BrandColor}" />
...@@ -159,8 +156,6 @@ ...@@ -159,8 +156,6 @@
</Setter> </Setter>
</Style> </Style>
<Style TargetType="ProgressBar"> <Style TargetType="ProgressBar">
<Setter Property="artina:ProgressBarProperties.TintColor" Value="{DynamicResource AccentColor}" /> <Setter Property="artina:ProgressBarProperties.TintColor" Value="{DynamicResource AccentColor}" />
</Style> </Style>
...@@ -169,7 +164,6 @@ ...@@ -169,7 +164,6 @@
<Setter Property="artina:SliderProperties.TintColor" Value="{DynamicResource AccentColor}" /> <Setter Property="artina:SliderProperties.TintColor" Value="{DynamicResource AccentColor}" />
</Style> </Style>
<Style TargetType="TextCell"> <Style TargetType="TextCell">
<Setter Property="TextColor" Value="{ DynamicResource AccentColor }" /> <Setter Property="TextColor" Value="{ DynamicResource AccentColor }" />
</Style> </Style>
...@@ -200,8 +194,6 @@ ...@@ -200,8 +194,6 @@
<Setter Property="BorderColor" Value="Transparent" /> <Setter Property="BorderColor" Value="Transparent" />
<Setter Property="HeightRequest" Value="{DynamicResource BaseButtonHeight}" /> <Setter Property="HeightRequest" Value="{DynamicResource BaseButtonHeight}" />
<!-- <!--
Mimic Android Buttons background color Mimic Android Buttons background color
If no background color is set, If no background color is set,
...@@ -235,8 +227,6 @@ ...@@ -235,8 +227,6 @@
<Setter Property="FontFamily" Value="{ DynamicResource GrialShapesFontFamily }" /> <Setter Property="FontFamily" Value="{ DynamicResource GrialShapesFontFamily }" />
</Style> </Style>
<Style x:Key="RoundedButtonStyle" TargetType="Button"> <Style x:Key="RoundedButtonStyle" TargetType="Button">
<Setter Property="FontSize" Value="{DynamicResource BaseFontSize}" /> <Setter Property="FontSize" Value="{DynamicResource BaseFontSize}" />
<Setter Property="BorderRadius" Value="22" /> <Setter Property="BorderRadius" Value="22" />
...@@ -354,7 +344,6 @@ ...@@ -354,7 +344,6 @@
</Setter> </Setter>
</Style> </Style>
<!-- LOGINS STYLES --> <!-- LOGINS STYLES -->
<Style x:Key="SignUpBackgroundImage" TargetType="Image"> <Style x:Key="SignUpBackgroundImage" TargetType="Image">
<Setter Property="Aspect" Value="AspectFill" /> <Setter Property="Aspect" Value="AspectFill" />
...@@ -507,7 +496,6 @@ ...@@ -507,7 +496,6 @@
<Setter Property="Opacity" Value="0.1" /> <Setter Property="Opacity" Value="0.1" />
</Style> </Style>
<!-- SETTINGS --> <!-- SETTINGS -->
<Style x:Key="SaveButtonStyle" TargetType="Button" BasedOn="{StaticResource RoundedButtonStyle}"> <Style x:Key="SaveButtonStyle" TargetType="Button" BasedOn="{StaticResource RoundedButtonStyle}">
<Setter Property="BackgroundColor" Value="{DynamicResource SaveButtonColor}" /> <Setter Property="BackgroundColor" Value="{DynamicResource SaveButtonColor}" />
...@@ -593,7 +581,6 @@ ...@@ -593,7 +581,6 @@
<Setter Property="Padding" Value="40,0,40,0" /> <Setter Property="Padding" Value="40,0,40,0" />
</Style> </Style>
<!-- THEME --> <!-- THEME -->
<Style TargetType="artina:CircleImage"> <Style TargetType="artina:CircleImage">
<Setter Property="WidthRequest" Value="50" /> <Setter Property="WidthRequest" Value="50" />
...@@ -625,7 +612,6 @@ ...@@ -625,7 +612,6 @@
<Setter Property="HeightRequest" Value="110" /> <Setter Property="HeightRequest" Value="110" />
</Style> </Style>
<Style x:Key="GrialBaseIconShapeDemo" TargetType="Label" BasedOn="{ StaticResource FontIconBase }"> <Style x:Key="GrialBaseIconShapeDemo" TargetType="Label" BasedOn="{ StaticResource FontIconBase }">
<Setter Property="TextColor" Value="{ DynamicResource AccentColor }" /> <Setter Property="TextColor" Value="{ DynamicResource AccentColor }" />
<Setter Property="FontSize" Value="24" /> <Setter Property="FontSize" Value="24" />
...@@ -636,7 +622,6 @@ ...@@ -636,7 +622,6 @@
<Setter Property="FontSize" Value="24" /> <Setter Property="FontSize" Value="24" />
</Style> </Style>
<!-- ECOMMERCE --> <!-- ECOMMERCE -->
<Style x:Key="EcommerceProductGridBannerStyle" TargetType="StackLayout"> <Style x:Key="EcommerceProductGridBannerStyle" TargetType="StackLayout">
<Setter Property="HeightRequest" Value="120" /> <Setter Property="HeightRequest" Value="120" />
...@@ -653,7 +638,6 @@ ...@@ -653,7 +638,6 @@
</Setter> </Setter>
</Style> </Style>
<!--Dashboard Item Template--> <!--Dashboard Item Template-->
<Style x:Key="DashboardItemTemplateShape" TargetType="Label" BasedOn="{ StaticResource FontIconBase }"> <Style x:Key="DashboardItemTemplateShape" TargetType="Label" BasedOn="{ StaticResource FontIconBase }">
<Setter Property="Text" Value="{ x:Static local:GrialShapesFont.Circle }" /> <Setter Property="Text" Value="{ x:Static local:GrialShapesFont.Circle }" />
...@@ -690,7 +674,6 @@ ...@@ -690,7 +674,6 @@
<!--Dashboard Multiple Scroll--> <!--Dashboard Multiple Scroll-->
<OnIdiom x:TypeArguments="GridLength" Phone="250" Tablet="500" x:Key="DashboardMultipleScrollMainItemHeight" /> <OnIdiom x:TypeArguments="GridLength" Phone="250" Tablet="500" x:Key="DashboardMultipleScrollMainItemHeight" />
<OnIdiom x:TypeArguments="GridLength" Phone="134" Tablet="268" x:Key="DashboardMultipleScrollSecondaryItemRowHeight" /> <OnIdiom x:TypeArguments="GridLength" Phone="134" Tablet="268" x:Key="DashboardMultipleScrollSecondaryItemRowHeight" />
<OnIdiom x:TypeArguments="GridLength" Phone="81" Tablet="162" x:Key="DashboardMultipleScrollSecondaryItemColumnWidth" /> <OnIdiom x:TypeArguments="GridLength" Phone="81" Tablet="162" x:Key="DashboardMultipleScrollSecondaryItemColumnWidth" />
...@@ -705,7 +688,6 @@ ...@@ -705,7 +688,6 @@
<OnIdiom x:TypeArguments="x:Double" Phone="10" Tablet="40" x:Key="DashboardMultipleScrollMainItemRowSpacing" /> <OnIdiom x:TypeArguments="x:Double" Phone="10" Tablet="40" x:Key="DashboardMultipleScrollMainItemRowSpacing" />
<Style x:Key="DashboardMultipleScrollItemTitleStyle" TargetType="Label"> <Style x:Key="DashboardMultipleScrollItemTitleStyle" TargetType="Label">
<Setter Property="Margin" Value="10,20,10,10" /> <Setter Property="Margin" Value="10,20,10,10" />
<Setter Property="FontSize" Value="16" /> <Setter Property="FontSize" Value="16" />
...@@ -731,7 +713,6 @@ ...@@ -731,7 +713,6 @@
<Setter Property="FontAttributes" Value="Bold" /> <Setter Property="FontAttributes" Value="Bold" />
</Style> </Style>
<Style x:Key="DashboardMultipleScrollMainItemDescriptionStyle" TargetType="Label"> <Style x:Key="DashboardMultipleScrollMainItemDescriptionStyle" TargetType="Label">
<Setter Property="TextColor" Value="{ DynamicResource OverImageTextColor }" /> <Setter Property="TextColor" Value="{ DynamicResource OverImageTextColor }" />
<Setter Property="FontSize" Value="{ DynamicResource DashboardMultipleScrollMainItemDescriptionFontSize }" /> <Setter Property="FontSize" Value="{ DynamicResource DashboardMultipleScrollMainItemDescriptionFontSize }" />
...@@ -793,7 +774,6 @@ ...@@ -793,7 +774,6 @@
<x:String>#FFd480d6,#FFd4a4d6,#FF62b9ae,#FF81b9ae,#ffa2c300,#FF9999b2,#FF999999</x:String> <x:String>#FFd480d6,#FFd4a4d6,#FF62b9ae,#FF81b9ae,#ffa2c300,#FF9999b2,#FF999999</x:String>
</x:Arguments> </x:Arguments>
</local:AlternatingBackgroundColorConverter> </local:AlternatingBackgroundColorConverter>
</ResourceDictionary> </ResourceDictionary>
</Application.Resources> </Application.Resources>
</Application> </Application>
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.Linq; using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms; using Xamarin.Forms;
namespace inutralia namespace inutralia
...@@ -12,42 +10,42 @@ namespace inutralia ...@@ -12,42 +10,42 @@ namespace inutralia
{ {
private List<Color> _Colors; private List<Color> _Colors;
public AlternatingBackgroundColorConverter (string commaSeparatedColors) public AlternatingBackgroundColorConverter(string commaSeparatedColors)
{ {
var conv = new ColorTypeConverter (); var conv = new ColorTypeConverter();
string [] colors = commaSeparatedColors.Split (','); string[] colors = commaSeparatedColors.Split(',');
_Colors = new List<Color> (); _Colors = new List<Color>();
foreach (string s in colors) foreach (string s in colors)
{ {
try try
{ {
if (s.Length > 0) if (s.Length > 0)
_Colors.Add ((Color) conv.ConvertFromInvariantString (s)); _Colors.Add((Color)conv.ConvertFromInvariantString(s));
} }
catch (Exception) catch (Exception)
{ } { }
} //endforeach } //endforeach
} }
public object Convert (object value, Type targetType, object parameter, CultureInfo culture) public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{ {
// Si no hay lista de colores o los parámetros no son correctos => transparente // Si no hay lista de colores o los parámetros no son correctos => transparente
if( (value == null) || (parameter == null) || (_Colors.Count < 1) ) if ((value == null) || (parameter == null) || (_Colors.Count < 1))
return Color.Transparent; return Color.Transparent;
// Obtener índice del elemento en la lista // Obtener índice del elemento en la lista
var index = ((ListView) parameter).ItemsSource.Cast<object> ().ToList ().IndexOf (value); var index = ((ListView)parameter).ItemsSource.Cast<object>().ToList().IndexOf(value);
// Retornar el color que corresponda // Retornar el color que corresponda
return _Colors [index % _Colors.Count]; return _Colors[index % _Colors.Count];
} }
public object ConvertBack (object value, Type targetType, object parameter, CultureInfo culture) public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{ {
throw new NotImplementedException (); throw new NotImplementedException();
} }
} }
} }
...@@ -7,7 +7,6 @@ namespace inutralia ...@@ -7,7 +7,6 @@ namespace inutralia
{ {
public class DateTransformator : IValueConverter public class DateTransformator : IValueConverter
{ {
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{ {
return DateUtilities.formatedDateFromTimeStamp((int)value, parameter != null ? parameter as string : culture.DateTimeFormat.ShortDatePattern); return DateUtilities.formatedDateFromTimeStamp((int)value, parameter != null ? parameter as string : culture.DateTimeFormat.ShortDatePattern);
......
...@@ -5,12 +5,11 @@ using Xamarin.Forms; ...@@ -5,12 +5,11 @@ using Xamarin.Forms;
namespace inutralia.Converters namespace inutralia.Converters
{ {
class ImageTransformator: IValueConverter class ImageTransformator : IValueConverter
{ {
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{ {
return ImageSource.FromStream (() => new MemoryStream(System.Convert.FromBase64String ((string)value))); return ImageSource.FromStream(() => new MemoryStream(System.Convert.FromBase64String((string)value)));
} }
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
......
using System;
namespace inutralia namespace inutralia
{ {
// Ionicons v2.0.0 Cheatsheet, 733 icons: // Ionicons v2.0.0 Cheatsheet, 733 icons:
......
// Helpers/Settings.cs
using Plugin.Settings; using Plugin.Settings;
using Plugin.Settings.Abstractions; using Plugin.Settings.Abstractions;
...@@ -26,7 +25,6 @@ namespace inutralia.Helpers ...@@ -26,7 +25,6 @@ namespace inutralia.Helpers
#endregion #endregion
public static string GeneralSettings public static string GeneralSettings
{ {
get get
...@@ -38,6 +36,5 @@ namespace inutralia.Helpers ...@@ -38,6 +36,5 @@ namespace inutralia.Helpers
AppSettings.AddOrUpdateValue<string>(SettingsKey, value); AppSettings.AddOrUpdateValue<string>(SettingsKey, value);
} }
} }
} }
} }
\ No newline at end of file
using System;
namespace inutralia namespace inutralia
{ {
public static class AssemblyGlobal public static class AssemblyGlobal
......
...@@ -2,11 +2,9 @@ using System.Reflection; ...@@ -2,11 +2,9 @@ using System.Reflection;
using Xamarin.Forms.Xaml; using Xamarin.Forms.Xaml;
using inutralia; using inutralia;
[assembly: AssemblyTitle (AssemblyGlobal.ProductLine + " - " + "Grial Xamarin.Forms UIKit")] [assembly: AssemblyTitle(AssemblyGlobal.ProductLine + " - " + "Grial Xamarin.Forms UIKit")]
[assembly: AssemblyConfiguration (AssemblyGlobal.Configuration)] [assembly: AssemblyConfiguration(AssemblyGlobal.Configuration)]
[assembly: AssemblyCompany (AssemblyGlobal.Company)] [assembly: AssemblyCompany(AssemblyGlobal.Company)]
[assembly: AssemblyProduct (AssemblyGlobal.ProductLine + " - " + "Grial Xamarin.Forms UIKit")] [assembly: AssemblyProduct(AssemblyGlobal.ProductLine + " - " + "Grial Xamarin.Forms UIKit")]
[assembly: AssemblyCopyright (AssemblyGlobal.Copyright)] [assembly: AssemblyCopyright(AssemblyGlobal.Copyright)]
[assembly: XamlCompilation(XamlCompilationOptions.Compile)]
\ No newline at end of file
[assembly: XamlCompilation (XamlCompilationOptions.Compile)]
\ No newline at end of file
...@@ -19,12 +19,10 @@ ...@@ -19,12 +19,10 @@
...but this is: ...but this is:
#FF169CEE #FF169CEE
--> -->
<!-- Grial Theme Exported Colors --> <!-- Grial Theme Exported Colors -->
<Color x:Key="AccentColor">#FFDA125F</Color> <Color x:Key="AccentColor">#FFDA125F</Color>
<Color x:Key="BaseTextColor">#D6E1F1</Color> <Color x:Key="BaseTextColor">#D6E1F1</Color>
<!-- GENERAL COLORS --> <!-- GENERAL COLORS -->
<Color x:Key="InverseTextColor">White</Color> <Color x:Key="InverseTextColor">White</Color>
<Color x:Key="BrandColor">#ad1457</Color> <Color x:Key="BrandColor">#ad1457</Color>
...@@ -37,12 +35,9 @@ ...@@ -37,12 +35,9 @@
<Color x:Key="CustomNavBarTextColor">#FFFFFF</Color> <Color x:Key="CustomNavBarTextColor">#FFFFFF</Color>
<Color x:Key="ListViewItemTextColor">#FFFFFF</Color> <Color x:Key="ListViewItemTextColor">#FFFFFF</Color>
<Color x:Key="AboutHeaderBackgroundColor">#FFFFFF</Color> <Color x:Key="AboutHeaderBackgroundColor">#FFFFFF</Color>
<Color x:Key="BasePageColor">#282C37</Color> <Color x:Key="BasePageColor">#282C37</Color>
<Color x:Key="BaseTabbedPageColor">#213D55</Color> <Color x:Key="BaseTabbedPageColor">#213D55</Color>
<Color x:Key="MainWrapperBackgroundColor">#1B1D22</Color> <Color x:Key="MainWrapperBackgroundColor">#1B1D22</Color>
<Color x:Key="CategoriesListIconColor">#55000000</Color> <Color x:Key="CategoriesListIconColor">#55000000</Color>
<Color x:Key="DashboardIconColor">#FFFFFF</Color> <Color x:Key="DashboardIconColor">#FFFFFF</Color>
...@@ -61,10 +56,8 @@ ...@@ -61,10 +56,8 @@
<Color x:Key="SaveButtonColor">#22c064</Color> <Color x:Key="SaveButtonColor">#22c064</Color>
<Color x:Key="DeleteButtonColor">#D50000</Color> <Color x:Key="DeleteButtonColor">#D50000</Color>
<Color x:Key="LabelButtonColor">#ffffff</Color> <Color x:Key="LabelButtonColor">#ffffff</Color>
<Color x:Key="PlaceholderColor">#FFFFFF</Color> <Color x:Key="PlaceholderColor">#FFFFFF</Color>
<Color x:Key="PlaceholderColorEntry">#505971</Color> <Color x:Key="PlaceholderColorEntry">#505971</Color>
<Color x:Key="RoundedLabelBackgroundColor">#525ABB</Color> <Color x:Key="RoundedLabelBackgroundColor">#525ABB</Color>
<!-- MAIN MENU COLORS --> <!-- MAIN MENU COLORS -->
......
using System;
using System.Collections.Generic;
using Xamarin.Forms;
namespace inutralia namespace inutralia
{ {
public partial class GrialDarkTheme public partial class GrialDarkTheme
......
...@@ -19,12 +19,10 @@ ...@@ -19,12 +19,10 @@
...but this is: ...but this is:
#FF169CEE #FF169CEE
--> -->
<!-- Grial Theme Exported Colors --> <!-- Grial Theme Exported Colors -->
<Color x:Key="AccentColor">#FF25BC99</Color> <Color x:Key="AccentColor">#FF25BC99</Color>
<Color x:Key="BaseTextColor">#FFFFFF</Color> <Color x:Key="BaseTextColor">#FFFFFF</Color>
<!-- GENERAL COLORS --> <!-- GENERAL COLORS -->
<Color x:Key="InverseTextColor">White</Color> <Color x:Key="InverseTextColor">White</Color>
<Color x:Key="BrandColor">#1F8269</Color> <Color x:Key="BrandColor">#1F8269</Color>
...@@ -37,12 +35,9 @@ ...@@ -37,12 +35,9 @@
<Color x:Key="CustomNavBarTextColor">#FFFFFF</Color> <Color x:Key="CustomNavBarTextColor">#FFFFFF</Color>
<Color x:Key="ListViewItemTextColor">#666666</Color> <Color x:Key="ListViewItemTextColor">#666666</Color>
<Color x:Key="AboutHeaderBackgroundColor">#FFFFFF</Color> <Color x:Key="AboutHeaderBackgroundColor">#FFFFFF</Color>
<Color x:Key="BasePageColor">#1A2634</Color> <Color x:Key="BasePageColor">#1A2634</Color>
<Color x:Key="BaseTabbedPageColor">#fafafa</Color> <Color x:Key="BaseTabbedPageColor">#fafafa</Color>
<Color x:Key="MainWrapperBackgroundColor">#1B1D22</Color> <Color x:Key="MainWrapperBackgroundColor">#1B1D22</Color>
<Color x:Key="CategoriesListIconColor">#55000000</Color> <Color x:Key="CategoriesListIconColor">#55000000</Color>
<Color x:Key="DashboardIconColor">#FFFFFF</Color> <Color x:Key="DashboardIconColor">#FFFFFF</Color>
...@@ -61,7 +56,6 @@ ...@@ -61,7 +56,6 @@
<Color x:Key="SaveButtonColor">#22c064</Color> <Color x:Key="SaveButtonColor">#22c064</Color>
<Color x:Key="DeleteButtonColor">#D50000</Color> <Color x:Key="DeleteButtonColor">#D50000</Color>
<Color x:Key="LabelButtonColor">#ffffff</Color> <Color x:Key="LabelButtonColor">#ffffff</Color>
<Color x:Key="PlaceholderColor">#ffffff</Color> <Color x:Key="PlaceholderColor">#ffffff</Color>
<Color x:Key="PlaceholderColorEntry">#344860</Color> <Color x:Key="PlaceholderColorEntry">#344860</Color>
......
using System;
using System.Collections.Generic;
using Xamarin.Forms;
namespace inutralia namespace inutralia
{ {
public partial class GrialEnterpriseTheme public partial class GrialEnterpriseTheme
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
<Color x:Key="AccentColor">#FFDA125F</Color> <Color x:Key="AccentColor">#FFDA125F</Color>
<Color x:Key="BaseTextColor">#666666</Color> <Color x:Key="BaseTextColor">#666666</Color>
<!-- GENERAL COLORS --> <!-- GENERAL COLORS -->
<Color x:Key="InverseTextColor">White</Color> <Color x:Key="InverseTextColor">White</Color>
<Color x:Key="BrandColor">#ad1457</Color> <Color x:Key="BrandColor">#ad1457</Color>
...@@ -37,12 +36,9 @@ ...@@ -37,12 +36,9 @@
<Color x:Key="CustomNavBarTextColor">#FFFFFF</Color> <Color x:Key="CustomNavBarTextColor">#FFFFFF</Color>
<Color x:Key="ListViewItemTextColor">#666666</Color> <Color x:Key="ListViewItemTextColor">#666666</Color>
<Color x:Key="AboutHeaderBackgroundColor">#FFFFFF</Color> <Color x:Key="AboutHeaderBackgroundColor">#FFFFFF</Color>
<Color x:Key="BasePageColor">#FFFFFF</Color> <Color x:Key="BasePageColor">#FFFFFF</Color>
<Color x:Key="BaseTabbedPageColor">#fafafa</Color> <Color x:Key="BaseTabbedPageColor">#fafafa</Color>
<Color x:Key="MainWrapperBackgroundColor">#EFEFEF</Color> <Color x:Key="MainWrapperBackgroundColor">#EFEFEF</Color>
<Color x:Key="CategoriesListIconColor">#55000000</Color> <Color x:Key="CategoriesListIconColor">#55000000</Color>
<Color x:Key="DashboardIconColor">#FFFFFF</Color> <Color x:Key="DashboardIconColor">#FFFFFF</Color>
......
using System;
using System.Collections.Generic;
using Xamarin.Forms;
namespace inutralia namespace inutralia
{ {
public partial class GrialLightTheme public partial class GrialLightTheme
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
<Color x:Key="AccentColor">#FFa2c300</Color> <Color x:Key="AccentColor">#FFa2c300</Color>
<Color x:Key="BaseTextColor">#666666</Color> <Color x:Key="BaseTextColor">#666666</Color>
<!-- GENERAL COLORS --> <!-- GENERAL COLORS -->
<Color x:Key="InverseTextColor">White</Color> <Color x:Key="InverseTextColor">White</Color>
<Color x:Key="BrandColor">#ad1457</Color> <Color x:Key="BrandColor">#ad1457</Color>
...@@ -37,12 +36,9 @@ ...@@ -37,12 +36,9 @@
<Color x:Key="CustomNavBarTextColor">#FFFFFF</Color> <Color x:Key="CustomNavBarTextColor">#FFFFFF</Color>
<Color x:Key="ListViewItemTextColor">#666666</Color> <Color x:Key="ListViewItemTextColor">#666666</Color>
<Color x:Key="AboutHeaderBackgroundColor">#FFFFFF</Color> <Color x:Key="AboutHeaderBackgroundColor">#FFFFFF</Color>
<Color x:Key="BasePageColor">#FFFFFF</Color> <Color x:Key="BasePageColor">#FFFFFF</Color>
<Color x:Key="BaseTabbedPageColor">#fafafa</Color> <Color x:Key="BaseTabbedPageColor">#fafafa</Color>
<Color x:Key="MainWrapperBackgroundColor">#EFEFEF</Color> <Color x:Key="MainWrapperBackgroundColor">#EFEFEF</Color>
<Color x:Key="CategoriesListIconColor">#55000000</Color> <Color x:Key="CategoriesListIconColor">#55000000</Color>
<Color x:Key="DashboardIconColor">#FFFFFF</Color> <Color x:Key="DashboardIconColor">#FFFFFF</Color>
...@@ -61,10 +57,8 @@ ...@@ -61,10 +57,8 @@
<Color x:Key="SaveButtonColor">#22c064</Color> <Color x:Key="SaveButtonColor">#22c064</Color>
<Color x:Key="DeleteButtonColor">#D50000</Color> <Color x:Key="DeleteButtonColor">#D50000</Color>
<Color x:Key="LabelButtonColor">#ffffff</Color> <Color x:Key="LabelButtonColor">#ffffff</Color>
<Color x:Key="PlaceholderColor">#22ffffff</Color> <Color x:Key="PlaceholderColor">#22ffffff</Color>
<Color x:Key="PlaceholderColorEntry">#FFFFFF</Color> <Color x:Key="PlaceholderColorEntry">#FFFFFF</Color>
<Color x:Key="RoundedLabelBackgroundColor">#525ABB</Color> <Color x:Key="RoundedLabelBackgroundColor">#525ABB</Color>
<!-- MAIN MENU COLORS --> <!-- MAIN MENU COLORS -->
......
using System;
using System.Collections.Generic;
using Xamarin.Forms;
namespace inutralia namespace inutralia
{ {
public partial class MyAppTheme public partial class MyAppTheme
......
using inutralia.Models; using inutralia.Models;
using System.Threading.Tasks;
using MvvmHelpers; // Este namespace está en el paquete Refractored.MvvmHelpers
using Xamarin.Forms;
namespace inutralia.ViewModels namespace inutralia.ViewModels
{ {
public class ArticleDetailViewModel : ModelBasedViewModel public class ArticleDetailViewModel : ModelBasedViewModel
{ {
public ArticleDetailViewModel( Article artic) : base (artic) public ArticleDetailViewModel(Article artic) : base(artic)
{ {
//Title = Generic?.Title; //Title = Generic?.Title;
//Subtitle = Generic?.Body; //Subtitle = Generic?.Body;
......
...@@ -2,16 +2,13 @@ ...@@ -2,16 +2,13 @@
using System.Threading.Tasks; using System.Threading.Tasks;
using MvvmHelpers; // Este namespace está en el paquete Refractored.MvvmHelpers using MvvmHelpers; // Este namespace está en el paquete Refractored.MvvmHelpers
using Xamarin.Forms; using Xamarin.Forms;
using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
namespace inutralia.ViewModels namespace inutralia.ViewModels
{ {
public class ArticleListViewModel : BaseViewModel public class ArticleListViewModel : BaseViewModel
{ {
public ArticleListViewModel() public ArticleListViewModel() { }
{
}
// Lista de articulos // Lista de articulos
ObservableRangeCollection<Article> _Articles; ObservableRangeCollection<Article> _Articles;
......
...@@ -8,13 +8,9 @@ namespace inutralia.ViewModels ...@@ -8,13 +8,9 @@ namespace inutralia.ViewModels
{ {
public class CustomMenuViewModel : MenuBaseViewModel public class CustomMenuViewModel : MenuBaseViewModel
{ {
public CustomMenuViewModel() : this(new Models.Menu()) public CustomMenuViewModel() : this(new Models.Menu()) { }
{
}
public CustomMenuViewModel(Models.Menu menu) : base(menu) public CustomMenuViewModel(Models.Menu menu) : base(menu) { }
{
}
/// <summary> /// <summary>
/// El menú guardado en el almacenamiento local /// El menú guardado en el almacenamiento local
...@@ -295,7 +291,6 @@ namespace inutralia.ViewModels ...@@ -295,7 +291,6 @@ namespace inutralia.ViewModels
_SelectionHasBeenChanged = false; _SelectionHasBeenChanged = false;
IsBusy = false; IsBusy = false;
OnPropertyChanged("NoMenuPanel"); OnPropertyChanged("NoMenuPanel");
} }
protected void SelectionChanged() protected void SelectionChanged()
...@@ -361,7 +356,7 @@ namespace inutralia.ViewModels ...@@ -361,7 +356,7 @@ namespace inutralia.ViewModels
} }
//protected void AddRecipe ( HashSet<string> ingredients, IList<Recipe> recipes, int index) //protected void AddRecipe ( HashSet<string> ingredients, IList<Recipe> recipes, int index)
protected void AddRecipe(HashSet<Ingredient> ingredients, IList<Recipe> recipes, int index) protected async void AddRecipe(HashSet<Ingredient> ingredients, IList<Recipe> recipes, int index)
{ {
if ((index >= 0) && (index < recipes.Count)) if ((index >= 0) && (index < recipes.Count))
{ {
...@@ -375,7 +370,8 @@ namespace inutralia.ViewModels ...@@ -375,7 +370,8 @@ namespace inutralia.ViewModels
ingredients.Add(new Ingredient() { Name = ing.Name, Id = ing.Id }); ingredients.Add(new Ingredient() { Name = ing.Name, Id = ing.Id });
} //endforeach } //endforeach
} //endif } //endif
} //endif }//endif
await App.LocalData.RefreshListAsync<ShoppingList>();
} }
protected override void OnDataRefreshed() protected override void OnDataRefreshed()
......
using inutralia.Models; using inutralia.Models;
using System.Threading.Tasks;
using MvvmHelpers; // Este namespace está en el paquete Refractored.MvvmHelpers
using Xamarin.Forms;
using System;
namespace inutralia.ViewModels namespace inutralia.ViewModels
{ {
public class GenericDetailViewModel : MenuBaseViewModel public class GenericDetailViewModel : MenuBaseViewModel
{ {
public GenericDetailViewModel(Generic gener) : base (gener) public GenericDetailViewModel(Generic gener) : base(gener) { }
{
}
} }
} }
...@@ -7,9 +7,7 @@ namespace inutralia.ViewModels ...@@ -7,9 +7,7 @@ namespace inutralia.ViewModels
{ {
public class GenericListViewModel : BaseViewModel public class GenericListViewModel : BaseViewModel
{ {
public GenericListViewModel() public GenericListViewModel() { }
{
}
//Lista de menús genéricos //Lista de menús genéricos
ObservableRangeCollection<Generic> _Generics; ObservableRangeCollection<Generic> _Generics;
......
using inutralia.Models; using inutralia.Models;
using inutralia.Views; using inutralia.Views;
using System.Threading.Tasks; using System.Threading.Tasks;
using MvvmHelpers; // Este namespace está en el paquete Refractored.MvvmHelpers
using Xamarin.Forms; using Xamarin.Forms;
using System; using System;
...@@ -10,9 +9,10 @@ namespace inutralia.ViewModels ...@@ -10,9 +9,10 @@ namespace inutralia.ViewModels
/// <summary> /// <summary>
/// ViewModel de un menú semanal /// ViewModel de un menú semanal
/// </summary> /// </summary>
public abstract class MenuBaseViewModel : ModelBasedViewModel public abstract class MenuBaseViewModel : ModelBasedViewModel
{ {
public MenuBaseViewModel ( MenuBase menu) : base (menu) public MenuBaseViewModel(MenuBase menu) : base(menu)
{ {
Title = WeekMenu?.Title; Title = WeekMenu?.Title;
} }
...@@ -37,13 +37,13 @@ namespace inutralia.ViewModels ...@@ -37,13 +37,13 @@ namespace inutralia.ViewModels
get { return _Index; } get { return _Index; }
set set
{ {
if( (_Index != value) && (value >= 0) && (value < WeekMenu?.Days?.Count) ) if ((_Index != value) && (value >= 0) && (value < WeekMenu?.Days?.Count))
{ {
_Index = value; _Index = value;
OnPropertyChanged ("Index"); OnPropertyChanged("Index");
OnPropertyChanged ("CurrentDay"); OnPropertyChanged("CurrentDay");
OnIndexChanged (); OnIndexChanged();
} //endif } //endif
} }
} }
...@@ -55,7 +55,7 @@ namespace inutralia.ViewModels ...@@ -55,7 +55,7 @@ namespace inutralia.ViewModels
{ {
get get
{ {
return ( (Index >= 0) && (Index < WeekMenu?.Days?.Count) ) ? WeekMenu.Days [Index] : null; return ((Index >= 0) && (Index < WeekMenu?.Days?.Count)) ? WeekMenu.Days[Index] : null;
} }
} }
...@@ -69,8 +69,8 @@ namespace inutralia.ViewModels ...@@ -69,8 +69,8 @@ namespace inutralia.ViewModels
get { return _LoadingRecipes; } get { return _LoadingRecipes; }
set set
{ {
SetProperty (ref _LoadingRecipes, value, "IsLoadingRecipes"); SetProperty(ref _LoadingRecipes, value, "IsLoadingRecipes");
OnPropertyChanged ("IsNotLoadingRecipes"); OnPropertyChanged("IsNotLoadingRecipes");
} }
} }
...@@ -82,8 +82,8 @@ namespace inutralia.ViewModels ...@@ -82,8 +82,8 @@ namespace inutralia.ViewModels
get { return !_LoadingRecipes; } get { return !_LoadingRecipes; }
set set
{ {
SetProperty (ref _LoadingRecipes, !value, "IsLoadingRecipes"); SetProperty(ref _LoadingRecipes, !value, "IsLoadingRecipes");
OnPropertyChanged ("IsNotLoadingRecipes"); OnPropertyChanged("IsNotLoadingRecipes");
} }
} }
...@@ -97,7 +97,7 @@ namespace inutralia.ViewModels ...@@ -97,7 +97,7 @@ namespace inutralia.ViewModels
/// Comando para mostrar una receta /// Comando para mostrar una receta
/// </summary> /// </summary>
public Command ShowRecipeCommand => _ShowRecipeCommand ?? public Command ShowRecipeCommand => _ShowRecipeCommand ??
(_ShowRecipeCommand = new Command (async (parameter) => await ShowRecipe (parameter as Recipe))); (_ShowRecipeCommand = new Command(async (parameter) => await ShowRecipe(parameter as Recipe)));
protected Command _ShowRecomendationCommand = null; protected Command _ShowRecomendationCommand = null;
...@@ -105,7 +105,7 @@ namespace inutralia.ViewModels ...@@ -105,7 +105,7 @@ namespace inutralia.ViewModels
/// Comando para mostrar las recomendaciones /// Comando para mostrar las recomendaciones
/// </summary> /// </summary>
public Command ShowRecomendationCommand => _ShowRecomendationCommand ?? public Command ShowRecomendationCommand => _ShowRecomendationCommand ??
(_ShowRecomendationCommand = new Command (async () => await ShowRecomendation())); (_ShowRecomendationCommand = new Command(async () => await ShowRecomendation()));
#endregion #endregion
...@@ -114,7 +114,7 @@ namespace inutralia.ViewModels ...@@ -114,7 +114,7 @@ namespace inutralia.ViewModels
/// <summary> /// <summary>
/// Actualiza los datos de todas las recetas /// Actualiza los datos de todas las recetas
/// </summary> /// </summary>
public async Task LoadAllRecipesAsync () public async Task LoadAllRecipesAsync()
{ {
IsLoadingRecipes = true; IsLoadingRecipes = true;
...@@ -122,13 +122,13 @@ namespace inutralia.ViewModels ...@@ -122,13 +122,13 @@ namespace inutralia.ViewModels
foreach (var d in WeekMenu.Days) foreach (var d in WeekMenu.Days)
{ {
foreach (var r in d.LunchFirst) foreach (var r in d.LunchFirst)
await App.API.RefreshItemAsync (r); await App.API.RefreshItemAsync(r);
foreach (var r in d.LunchSecond) foreach (var r in d.LunchSecond)
await App.API.RefreshItemAsync (r); await App.API.RefreshItemAsync(r);
foreach (var r in d.DinnerFirst) foreach (var r in d.DinnerFirst)
await App.API.RefreshItemAsync (r); await App.API.RefreshItemAsync(r);
foreach (var r in d.DinnerSecond) foreach (var r in d.DinnerSecond)
await App.API.RefreshItemAsync (r); await App.API.RefreshItemAsync(r);
} //endforeach } //endforeach
IsLoadingRecipes = false; IsLoadingRecipes = false;
...@@ -140,15 +140,15 @@ namespace inutralia.ViewModels ...@@ -140,15 +140,15 @@ namespace inutralia.ViewModels
/// <param name="recipe">La receta a mostrar</param> /// <param name="recipe">La receta a mostrar</param>
protected async Task ShowRecipe(Recipe recipe) protected async Task ShowRecipe(Recipe recipe)
{ {
await PushAsync (new RecipeDetailView () { BindingContext = new RecipeViewModel(recipe) }); await PushAsync(new RecipeDetailView() { BindingContext = new RecipeViewModel(recipe) });
} }
/// <summary> /// <summary>
/// Navega a la vista de recomendaciones /// Navega a la vista de recomendaciones
/// </summary> /// </summary>
protected async Task ShowRecomendation () protected async Task ShowRecomendation()
{ {
await PushAsync (new RecomendationView () { BindingContext = WeekMenu }); await PushAsync(new RecomendationView() { BindingContext = WeekMenu });
} }
#endregion #endregion
...@@ -156,12 +156,12 @@ namespace inutralia.ViewModels ...@@ -156,12 +156,12 @@ namespace inutralia.ViewModels
/// <summary> /// <summary>
/// Llamado cuando se han actualizado los datos /// Llamado cuando se han actualizado los datos
/// </summary> /// </summary>
protected override void OnDataRefreshed () protected override void OnDataRefreshed()
{ {
base.OnDataRefreshed (); base.OnDataRefreshed();
// Informar que ha cambiado el menú // Informar que ha cambiado el menú
OnPropertyChanged ("WeekMenu"); OnPropertyChanged("WeekMenu");
// Cambiar título // Cambiar título
Title = WeekMenu?.Title; Title = WeekMenu?.Title;
...@@ -173,19 +173,17 @@ namespace inutralia.ViewModels ...@@ -173,19 +173,17 @@ namespace inutralia.ViewModels
DayOfWeek dw = DateTime.Now.DayOfWeek; DayOfWeek dw = DateTime.Now.DayOfWeek;
// Como DayOfWeek empieza con el 0 en Domingo, le "restamos 1 modulo 7" // Como DayOfWeek empieza con el 0 en Domingo, le "restamos 1 modulo 7"
Index = ( (int) dw + 6) % 7; Index = ((int)dw + 6) % 7;
} //endif } //endif
// Informar que ha cambiado el día actual (aunque no cambie el índice // Informar que ha cambiado el día actual (aunque no cambie el índice
// puede haber cambiado el contenido) // puede haber cambiado el contenido)
OnPropertyChanged ("CurrentDay"); OnPropertyChanged("CurrentDay");
} }
/// <summary> /// <summary>
/// Llamado cuando ha cambiado el índice del día seleccionado /// Llamado cuando ha cambiado el índice del día seleccionado
/// </summary> /// </summary>
protected virtual void OnIndexChanged () protected virtual void OnIndexChanged() { }
{
}
} }
} }
...@@ -12,12 +12,10 @@ namespace inutralia.ViewModels ...@@ -12,12 +12,10 @@ namespace inutralia.ViewModels
public RecipeListViewModel() public RecipeListViewModel()
{ {
Title = "Recetas"; Title = "Recetas";
Filters = new RecipeListOptionsViewModel(); Filters = new RecipeListOptionsViewModel();
} }
public RecipeListOptionsViewModel Filters public RecipeListOptionsViewModel Filters { get; private set; }
{ get; private set; }
// Lista de articulos // Lista de articulos
ObservableRangeCollection<Recipe> _Recipes; ObservableRangeCollection<Recipe> _Recipes;
...@@ -36,13 +34,13 @@ namespace inutralia.ViewModels ...@@ -36,13 +34,13 @@ namespace inutralia.ViewModels
{ {
_Recipes = value; _Recipes = value;
OnPropertyChanged("Recipes"); OnPropertyChanged("Recipes");
} }
} }
// Indica si hay resultados // Indica si hay resultados
public bool IsEmpty => IsNotBusy && (Recipes.Count < 1); public bool IsEmpty => IsNotBusy && (Recipes.Count < 1);
public bool IsNotEmpty => IsNotBusy && (Recipes.Count > 0); public bool IsNotEmpty => IsNotBusy && (Recipes.Count > 0);
/// <summary> /// <summary>
/// Método que realiza la carga inicial del listado /// Método que realiza la carga inicial del listado
/// </summary> /// </summary>
...@@ -106,31 +104,31 @@ namespace inutralia.ViewModels ...@@ -106,31 +104,31 @@ namespace inutralia.ViewModels
{ {
if (orFlags.Length > 0) if (orFlags.Length > 0)
orFlags += ","; orFlags += ",";
orFlags += cat.Id.ToString (); orFlags += cat.Id.ToString();
} }
else else
{ {
if (flags.Length > 0) if (flags.Length > 0)
flags += ","; flags += ",";
flags += cat.Id.ToString (); flags += cat.Id.ToString();
} //endif } //endif
} //endif } //endif
} //endforeach } //endforeach
} //endforeach } //endforeach
if (string.IsNullOrEmpty (flags) && string.IsNullOrEmpty (orFlags) && string.IsNullOrEmpty(Filters?.Desc) ) if (string.IsNullOrEmpty(flags) && string.IsNullOrEmpty(orFlags) && string.IsNullOrEmpty(Filters?.Desc))
{ {
Recipes = new ObservableRangeCollection<Recipe> (await App.API.RefreshListAsync<Recipe> ()); Recipes = new ObservableRangeCollection<Recipe>(await App.API.RefreshListAsync<Recipe>());
} }
else else
{ {
var options = new Dictionary<string, string> (); var options = new Dictionary<string, string>();
if (!string.IsNullOrEmpty (flags)) options.Add ("flags", flags); if (!string.IsNullOrEmpty(flags)) options.Add("flags", flags);
if (!string.IsNullOrEmpty (orFlags)) options.Add ("flags_or", orFlags); if (!string.IsNullOrEmpty(orFlags)) options.Add("flags_or", orFlags);
if (!string.IsNullOrEmpty (Filters?.Desc)) options.Add ("desc", Filters.Desc); if (!string.IsNullOrEmpty(Filters?.Desc)) options.Add("desc", Filters.Desc);
var recipes = await App.API.RawMessage<List<Recipe>> (HttpMethod.Post, "recipes", options); var recipes = await App.API.RawMessage<List<Recipe>>(HttpMethod.Post, "recipes", options);
Recipes = new ObservableRangeCollection<Recipe> (recipes); Recipes = new ObservableRangeCollection<Recipe>(recipes);
} //endif } //endif
} }
catch (System.Exception e) catch (System.Exception e)
...@@ -143,6 +141,5 @@ namespace inutralia.ViewModels ...@@ -143,6 +141,5 @@ namespace inutralia.ViewModels
OnPropertyChanged("IsEmpty"); OnPropertyChanged("IsEmpty");
OnPropertyChanged("IsNotEmpty"); OnPropertyChanged("IsNotEmpty");
} }
} }
} }
using inutralia.Models; using inutralia.Models;
using MvvmHelpers;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace inutralia.ViewModels namespace inutralia.ViewModels
{ {
public class RecipeViewModel : BaseNavigationViewModel public class RecipeViewModel : BaseNavigationViewModel
{ {
public RecipeViewModel ( Recipe recipe) public RecipeViewModel(Recipe recipe)
{ {
Recipe = recipe; Recipe = recipe;
Title = Recipe.Name; Title = Recipe.Name;
if(Recipe.Ingredients == null) if (Recipe.Ingredients == null)
Recipe.Ingredients = new Ingredient[0]; Recipe.Ingredients = new Ingredient[0];
} }
public Recipe Recipe { get; private set; } public Recipe Recipe { get; private set; }
public async Task RefreshData () public async Task RefreshData()
{ {
if (Recipe == null) if (Recipe == null)
return; return;
IsBusy = true; IsBusy = true;
if (await App.API.RefreshItemAsync (Recipe)) if (await App.API.RefreshItemAsync(Recipe))
{ {
OnPropertyChanged ("Recipe"); OnPropertyChanged("Recipe");
// Cambiar título // Cambiar título
Title = Recipe.Name; Title = Recipe.Name;
...@@ -33,6 +32,5 @@ namespace inutralia.ViewModels ...@@ -33,6 +32,5 @@ namespace inutralia.ViewModels
IsBusy = false; IsBusy = false;
} }
} }
} }
using inutralia.Models; using inutralia.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace inutralia.ViewModels namespace inutralia.ViewModels
...@@ -12,7 +8,7 @@ namespace inutralia.ViewModels ...@@ -12,7 +8,7 @@ namespace inutralia.ViewModels
/// </summary> /// </summary>
public abstract class ModelBasedViewModel : BaseNavigationViewModel public abstract class ModelBasedViewModel : BaseNavigationViewModel
{ {
public ModelBasedViewModel ( ObservableEntityData model) public ModelBasedViewModel(ObservableEntityData model)
{ {
Model = model; Model = model;
} }
...@@ -25,20 +21,20 @@ namespace inutralia.ViewModels ...@@ -25,20 +21,20 @@ namespace inutralia.ViewModels
/// <summary> /// <summary>
/// Refresca los datos del modelo asociado /// Refresca los datos del modelo asociado
/// </summary> /// </summary>
public async Task RefreshData () public async Task RefreshData()
{ {
if (Model == null) if (Model == null)
return; return;
IsBusy = true; IsBusy = true;
if (await App.API.RefreshItemAsync (Model)) if (await App.API.RefreshItemAsync(Model))
{ {
// Informar que el modelo ha cambiado // Informar que el modelo ha cambiado
OnPropertyChanged ("Model"); OnPropertyChanged("Model");
// Comportamiento específico de clases hijas // Comportamiento específico de clases hijas
OnDataRefreshed (); OnDataRefreshed();
} //endif } //endif
IsBusy = false; IsBusy = false;
...@@ -47,9 +43,6 @@ namespace inutralia.ViewModels ...@@ -47,9 +43,6 @@ namespace inutralia.ViewModels
/// <summary> /// <summary>
/// Permite a las clases hijas realizar acciones específicas /// Permite a las clases hijas realizar acciones específicas
/// </summary> /// </summary>
protected virtual void OnDataRefreshed () protected virtual void OnDataRefreshed() { }
{
}
} }
} }
using inutralia.Models; using inutralia.Models;
using System.Threading.Tasks; using System.Threading.Tasks;
using MvvmHelpers; // Este namespace está en el paquete Refractored.MvvmHelpers
using Xamarin.Forms;
using System;
namespace inutralia.ViewModels namespace inutralia.ViewModels
{ {
public class ProfileViewModel : BaseNavigationViewModel public class ProfileViewModel : BaseNavigationViewModel
{ {
public ProfileViewModel() public ProfileViewModel() { Profile = new Profile(); }
{
Profile = new Profile();
}
public Profile Profile { private set; get;} public Profile Profile { private set; get; }
public string Code => Profile?.Code; public string Code => Profile?.Code;
public int Gender public int Gender
{ {
get get { return Profile.Gender == 'H' ? 0 : 1; }
{ set { Profile.Gender = value == 0 ? 'H' : 'M'; }
return Profile.Gender == 'H' ? 0 : 1;
}
set
{
Profile.Gender = value == 0 ?'H':'M';
}
} }
public int Physical public int Physical
{ {
get get { return Profile.Physical > 0 ? (Profile.Physical - 1) : 0; }
{ set { Profile.Physical = value + 1; }
return Profile.Physical > 0 ? (Profile.Physical -1) : 0;
}
set
{
Profile.Physical = value + 1;
}
} }
public int Preference public int Preference
{ {
get get { return Profile.Preference - 1; }
{ set { Profile.Preference = value + 1; }
return Profile.Preference -1 ;
}
set
{
Profile.Preference = value + 1;
}
} }
public async Task RefreshData() public async Task RefreshData()
...@@ -73,7 +48,6 @@ namespace inutralia.ViewModels ...@@ -73,7 +48,6 @@ namespace inutralia.ViewModels
{ {
IsBusy = true; IsBusy = true;
await App.API.UpdateItemAsync(Profile); await App.API.UpdateItemAsync(Profile);
IsBusy = false; IsBusy = false;
......
using inutralia.Models; using MvvmHelpers;
using MvvmHelpers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
namespace inutralia.ViewModels namespace inutralia.ViewModels
{ {
public class RecipeListOptionsViewModel : BaseNavigationViewModel public class RecipeListOptionsViewModel : BaseNavigationViewModel
{ {
public RecipeListOptionsViewModel () public RecipeListOptionsViewModel() { Title = "Filtrado de Recetas"; }
{
Title = "Filtrado de Recetas";
}
public string Desc { get; set; } public string Desc { get; set; }
...@@ -22,29 +12,26 @@ namespace inutralia.ViewModels ...@@ -22,29 +12,26 @@ namespace inutralia.ViewModels
public ObservableRangeCollection<RecipeOptionGroupViewModel> Groups public ObservableRangeCollection<RecipeOptionGroupViewModel> Groups
{ {
get { return _Groups ?? (_Groups = new ObservableRangeCollection<RecipeOptionGroupViewModel> ()); } get { return _Groups ?? (_Groups = new ObservableRangeCollection<RecipeOptionGroupViewModel>()); }
set set { SetProperty(ref _Groups, value); }
{
SetProperty (ref _Groups, value);
}
} }
/// <summary> /// <summary>
/// Método que realiza la carga inicial de las opciones de filtrado /// Método que realiza la carga inicial de las opciones de filtrado
/// </summary> /// </summary>
public async Task ExecuteLoadOptionsCommand () public void ExecuteLoadOptionsCommand()
{ {
// Realiza el proceso de actualización si hay menos de un // Realiza el proceso de actualización si hay menos de un
// elemento en el listado // elemento en el listado
if (Groups.Count < 1) if (Groups.Count < 1)
await FetchOptions (); FetchOptions();
} }
/// <summary> /// <summary>
/// Proceso de actualización del listado /// Proceso de actualización del listado
/// </summary> /// </summary>
async Task FetchOptions () void FetchOptions()
{ {
// Indicamos que estamos ocupados (provoca que aparezca el indicador de carga) // Indicamos que estamos ocupados (provoca que aparezca el indicador de carga)
IsBusy = true; IsBusy = true;
...@@ -55,21 +42,18 @@ namespace inutralia.ViewModels ...@@ -55,21 +42,18 @@ namespace inutralia.ViewModels
try try
{ {
var groups = App.FilterOptions; var groups = App.FilterOptions;
var groupList = new ObservableRangeCollection<RecipeOptionGroupViewModel> (); var groupList = new ObservableRangeCollection<RecipeOptionGroupViewModel>();
foreach (var group in groups) foreach (var group in groups)
groupList.Add (new RecipeOptionGroupViewModel (group)); groupList.Add(new RecipeOptionGroupViewModel(group));
Groups = groupList; Groups = groupList;
} }
catch (System.Exception e) catch (System.Exception e)
{ {
Groups.Clear();
Groups.Clear ();
} }
// Indicamos que ya no estamos ocupados (provoca que desaparezca el indicador de carga) // Indicamos que ya no estamos ocupados (provoca que desaparezca el indicador de carga)
IsBusy = false; IsBusy = false;
} }
} }
} }
...@@ -9,11 +9,11 @@ namespace inutralia.ViewModels ...@@ -9,11 +9,11 @@ namespace inutralia.ViewModels
public RecipeOptionGroup Group { get; private set; } public RecipeOptionGroup Group { get; private set; }
public RecipeOptionGroupViewModel ( RecipeOptionGroup group) public RecipeOptionGroupViewModel(RecipeOptionGroup group)
{ {
Name = group.Name; Name = group.Name;
Group = group; Group = group;
AddRange (group.Options); AddRange(group.Options);
} }
} }
} }
using inutralia.Models; using inutralia.Models;
using MvvmHelpers; using MvvmHelpers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Xamarin.Forms; using Xamarin.Forms;
...@@ -11,10 +7,7 @@ namespace inutralia.ViewModels ...@@ -11,10 +7,7 @@ namespace inutralia.ViewModels
{ {
public class ShoppingListViewModel : BaseNavigationViewModel public class ShoppingListViewModel : BaseNavigationViewModel
{ {
public ShoppingListViewModel() public ShoppingListViewModel() { }
{
}
ObservableRangeCollection<ShoppingList> _ShoppingList; ObservableRangeCollection<ShoppingList> _ShoppingList;
...@@ -38,36 +31,36 @@ namespace inutralia.ViewModels ...@@ -38,36 +31,36 @@ namespace inutralia.ViewModels
} }
} }
public async Task AddItem (ShoppingList item) public async Task AddItem(ShoppingList item)
{ {
// Añadir elemento y refrescar lista // Añadir elemento y refrescar lista
if (await App.LocalData.UpdateItemAsync (item, true) != null) if (await App.LocalData.UpdateItemAsync(item, true) != null)
await FetchShoppingList (); await FetchShoppingList();
} }
public async Task DeleteSelected () public async Task DeleteSelected()
{ {
IsBusy = true; IsBusy = true;
foreach (var item in ShoppingList) foreach (var item in ShoppingList)
if(item.Select) if (item.Select)
await App.LocalData.DeleteItemAsync (item); await App.LocalData.DeleteItemAsync(item);
ShoppingList.Clear (); ShoppingList.Clear();
await FetchShoppingList (); await FetchShoppingList();
} }
public async Task DeleteAll () public async Task DeleteAll()
{ {
IsBusy = true; IsBusy = true;
foreach (var item in ShoppingList) foreach (var item in ShoppingList)
await App.LocalData.DeleteItemAsync (item); await App.LocalData.DeleteItemAsync(item);
ShoppingList.Clear (); ShoppingList.Clear();
await FetchShoppingList (); await FetchShoppingList();
} }
/// <summary> /// <summary>
...@@ -121,10 +114,10 @@ namespace inutralia.ViewModels ...@@ -121,10 +114,10 @@ namespace inutralia.ViewModels
try try
{ {
// Obtener lista // Obtener lista
var list = await App.LocalData.RefreshListAsync<ShoppingList> (); var list = await App.LocalData.RefreshListAsync<ShoppingList>();
// Ordenarla // Ordenarla
list.Sort ((a, b) => { return a.Text.CompareTo (b.Text); }); list.Sort((a, b) => { return a.Text.CompareTo(b.Text); });
// Asignarla a la que utiliza la vista // Asignarla a la que utiliza la vista
ShoppingList = new ObservableRangeCollection<ShoppingList>(list); ShoppingList = new ObservableRangeCollection<ShoppingList>(list);
...@@ -138,7 +131,6 @@ namespace inutralia.ViewModels ...@@ -138,7 +131,6 @@ namespace inutralia.ViewModels
IsBusy = false; IsBusy = false;
} }
public Command DeleteShoppingListCommand public Command DeleteShoppingListCommand
{ {
// Getter (lazy load), crea el comando si no existe. Nótese que, a diferencia del comando // Getter (lazy load), crea el comando si no existe. Nótese que, a diferencia del comando
......
using inutralia.Models; using inutralia.Models;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace inutralia.ViewModels namespace inutralia.ViewModels
...@@ -13,9 +10,9 @@ namespace inutralia.ViewModels ...@@ -13,9 +10,9 @@ namespace inutralia.ViewModels
{ {
public TrivialQuestion Question { get; set; } public TrivialQuestion Question { get; set; }
public string ValidAnswer => Question.Options [Question.ValidIndex]; public string ValidAnswer => Question.Options[Question.ValidIndex];
public string Answer => Question.Options [SelectedAnswer]; public string Answer => Question.Options[SelectedAnswer];
public int SelectedAnswer { get; set; } public int SelectedAnswer { get; set; }
...@@ -39,45 +36,45 @@ namespace inutralia.ViewModels ...@@ -39,45 +36,45 @@ namespace inutralia.ViewModels
get get
{ {
int n = Game.Answers.Count; int n = Game.Answers.Count;
return (n >= 0) && (n < Game.Questions.Count) ? Game.Questions [n] : null; return (n >= 0) && (n < Game.Questions.Count) ? Game.Questions[n] : null;
} }
} }
public TrivialGameViewModel ( TrivialGame game) public TrivialGameViewModel(TrivialGame game)
{ {
Game = game; Game = game;
Results = null; Results = null;
GenerateTitle (); GenerateTitle();
GenerateResults (); GenerateResults();
} }
public async Task<bool> Answer ( int answer) public async Task<bool> Answer(int answer)
{ {
bool retVal = Game.Answer (answer); bool retVal = Game.Answer(answer);
await App.LocalData.UpdateItemAsync (Game); await App.LocalData.UpdateItemAsync(Game);
GenerateTitle (); GenerateTitle();
GenerateResults (); GenerateResults();
OnPropertyChanged ("CurrentQuestion"); OnPropertyChanged("CurrentQuestion");
OnPropertyChanged ("IsComplete"); OnPropertyChanged("IsComplete");
OnPropertyChanged ("IsNotComplete"); OnPropertyChanged("IsNotComplete");
return retVal; return retVal;
} }
protected void GenerateResults () protected void GenerateResults()
{ {
if(IsComplete) if (IsComplete)
{ {
if(Results == null) if (Results == null)
{ {
Results = new List<QuestionResult> (); Results = new List<QuestionResult>();
for(int i = 0; i < Game.Questions.Count; i++) for (int i = 0; i < Game.Questions.Count; i++)
{ {
TrivialQuestion q = Game.Questions [i]; TrivialQuestion q = Game.Questions[i];
int answer = Game.Answers [i]; int answer = Game.Answers[i];
Results.Add (new QuestionResult () Results.Add(new QuestionResult()
{ {
Question = q, Question = q,
SelectedAnswer = answer, SelectedAnswer = answer,
...@@ -85,14 +82,14 @@ namespace inutralia.ViewModels ...@@ -85,14 +82,14 @@ namespace inutralia.ViewModels
}); });
} //endfor } //endfor
OnPropertyChanged ("Results"); OnPropertyChanged("Results");
} //endif } //endif
} //endif } //endif
} }
protected void GenerateTitle () protected void GenerateTitle()
{ {
if(IsComplete) if (IsComplete)
{ {
Title = "Trivial: Partida completada"; Title = "Trivial: Partida completada";
} }
...@@ -101,6 +98,5 @@ namespace inutralia.ViewModels ...@@ -101,6 +98,5 @@ namespace inutralia.ViewModels
Title = $"Trivial: Pregunta {Game.Answers.Count + 1} de {Game.Questions.Count}"; Title = $"Trivial: Pregunta {Game.Answers.Count + 1} de {Game.Questions.Count}";
} //endif } //endif
} }
} }
} }
...@@ -3,8 +3,6 @@ using inutralia.Views; ...@@ -3,8 +3,6 @@ using inutralia.Views;
using MvvmHelpers; using MvvmHelpers;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Xamarin.Forms; using Xamarin.Forms;
...@@ -12,9 +10,7 @@ namespace inutralia.ViewModels ...@@ -12,9 +10,7 @@ namespace inutralia.ViewModels
{ {
public class TrivialListViewModel : BaseNavigationViewModel public class TrivialListViewModel : BaseNavigationViewModel
{ {
public TrivialListViewModel () public TrivialListViewModel() { }
{
}
// Lista de partidas // Lista de partidas
ObservableRangeCollection<TrivialGame> _Games; ObservableRangeCollection<TrivialGame> _Games;
...@@ -23,13 +19,13 @@ namespace inutralia.ViewModels ...@@ -23,13 +19,13 @@ namespace inutralia.ViewModels
public ObservableRangeCollection<TrivialGame> Games public ObservableRangeCollection<TrivialGame> Games
{ {
// Getter (lazy load), crea la lista si no existe // Getter (lazy load), crea la lista si no existe
get { return _Games ?? (_Games = new ObservableRangeCollection<TrivialGame> ()); } get { return _Games ?? (_Games = new ObservableRangeCollection<TrivialGame>()); }
// Setter. cambiar el valor y notifica a la vista de dicho cambio // Setter. cambiar el valor y notifica a la vista de dicho cambio
set set
{ {
_Games = value; _Games = value;
OnPropertyChanged ("Games"); OnPropertyChanged("Games");
} }
} }
...@@ -37,24 +33,21 @@ namespace inutralia.ViewModels ...@@ -37,24 +33,21 @@ namespace inutralia.ViewModels
Command _NewGameCommand; Command _NewGameCommand;
public Command NewGameCommand => public Command NewGameCommand => _NewGameCommand ?? (_NewGameCommand = new Command(async () => await ExecuteNewGameCommand()));
_NewGameCommand ?? (_NewGameCommand = new Command(async () => await ExecuteNewGameCommand ()));
protected async Task ExecuteNewGameCommand () protected async Task ExecuteNewGameCommand()
{ {
NewGameCommand.ChangeCanExecute (); NewGameCommand.ChangeCanExecute();
List<TrivialQuestion> questions = null; List<TrivialQuestion> questions = null;
try try
{ {
questions = await App.API.RefreshListAsync<TrivialQuestion> (); questions = await App.API.RefreshListAsync<TrivialQuestion>();
} }
catch (Exception e) catch (Exception e) { }
{ }
if (questions == null) if (questions == null) questions = new List<TrivialQuestion>()
questions = new List<TrivialQuestion> ()
{ {
new TrivialQuestion () new TrivialQuestion ()
{ {
...@@ -66,16 +59,15 @@ namespace inutralia.ViewModels ...@@ -66,16 +59,15 @@ namespace inutralia.ViewModels
} }
}; };
var game = TrivialGame.Create (questions); var game = TrivialGame.Create(questions);
await App.LocalData.UpdateItemAsync (game, true); await App.LocalData.UpdateItemAsync(game, true);
await PushAsync (new TrivialGameView () await PushAsync(new TrivialGameView()
{ {
BindingContext = new TrivialGameViewModel (game) BindingContext = new TrivialGameViewModel(game)
}); });
NewGameCommand.ChangeCanExecute();
NewGameCommand.ChangeCanExecute ();
} }
#endregion #endregion
...@@ -85,9 +77,9 @@ namespace inutralia.ViewModels ...@@ -85,9 +77,9 @@ namespace inutralia.ViewModels
Command _DeleteGameCommand; Command _DeleteGameCommand;
public Command DeleteGameCommand => public Command DeleteGameCommand =>
_DeleteGameCommand ?? (_DeleteGameCommand = new Command (async (parameter) => await ExecuteDeleteGameCommand (parameter as TrivialGame))); _DeleteGameCommand ?? (_DeleteGameCommand = new Command(async (parameter) => await ExecuteDeleteGameCommand(parameter as TrivialGame)));
protected async Task ExecuteDeleteGameCommand (TrivialGame game) protected async Task ExecuteDeleteGameCommand(TrivialGame game)
{ {
// Verificar parámetro // Verificar parámetro
if (game != null) if (game != null)
...@@ -96,10 +88,10 @@ namespace inutralia.ViewModels ...@@ -96,10 +88,10 @@ namespace inutralia.ViewModels
IsBusy = true; IsBusy = true;
// Llamamos al API para borrar la notificación // Llamamos al API para borrar la notificación
await App.LocalData.DeleteItemAsync (game); await App.LocalData.DeleteItemAsync(game);
// Actualizamos la lista // Actualizamos la lista
Games.Remove (game); Games.Remove(game);
// Indicamos que ya no estamos ocupados (provoca que desaparezca el indicador de carga) // Indicamos que ya no estamos ocupados (provoca que desaparezca el indicador de carga)
IsBusy = false; IsBusy = false;
...@@ -112,15 +104,15 @@ namespace inutralia.ViewModels ...@@ -112,15 +104,15 @@ namespace inutralia.ViewModels
/// <summary> /// <summary>
/// Método que realiza la carga inicial del listado /// Método que realiza la carga inicial del listado
/// </summary> /// </summary>
public async Task RefreshList () public async Task RefreshList()
{ {
await FetchGames (); await FetchGames();
} }
/// <summary> /// <summary>
/// Proceso de actualización del listado /// Proceso de actualización del listado
/// </summary> /// </summary>
async Task FetchGames () async Task FetchGames()
{ {
// Indicamos que estamos ocupados (provoca que aparezca el indicador de carga) // Indicamos que estamos ocupados (provoca que aparezca el indicador de carga)
IsBusy = true; IsBusy = true;
...@@ -128,11 +120,11 @@ namespace inutralia.ViewModels ...@@ -128,11 +120,11 @@ namespace inutralia.ViewModels
// Llamada al API para coger el listado (provoca que se actualize la vista del listado) // Llamada al API para coger el listado (provoca que se actualize la vista del listado)
try try
{ {
Games = new ObservableRangeCollection<TrivialGame> (await App.LocalData.RefreshListAsync<TrivialGame> ()); Games = new ObservableRangeCollection<TrivialGame>(await App.LocalData.RefreshListAsync<TrivialGame>());
} }
catch (System.Exception e) catch (System.Exception e)
{ {
Games.Clear (); Games.Clear();
} }
// Indicamos que ya no estamos ocupados (provoca que desaparezca el indicador de carga) // Indicamos que ya no estamos ocupados (provoca que desaparezca el indicador de carga)
......
...@@ -14,27 +14,26 @@ ...@@ -14,27 +14,26 @@
--> -->
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" <ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:inutralia;assembly=inutralia"
xmlns:conv="clr-namespace:inutralia.Converters;assembly=inutralia" xmlns:conv="clr-namespace:inutralia.Converters;assembly=inutralia"
xmlns:views="clr-namespace:inutralia.Views;assembly=inutralia" xmlns:views="clr-namespace:inutralia.Views;assembly=inutralia"
x:Class="inutralia.Views.ArticleListView" x:Class="inutralia.Views.ArticleListView"
x:Name="ArticleListView" x:Name="ArticleListView"
BackgroundColor="White" BackgroundColor="White"
Title="Articulos" Title="Articulos">
>
<ContentPage.Resources> <ContentPage.Resources>
<ResourceDictionary> <ResourceDictionary>
<conv:ImageTransformator x:Key="cnvImg"></conv:ImageTransformator> <conv:ImageTransformator x:Key="cnvImg"></conv:ImageTransformator>
</ResourceDictionary> </ResourceDictionary>
</ContentPage.Resources> </ContentPage.Resources>
<!-- Este es el componente para el listado. Primero configura de dónde obtiene los datos <!-- Este es el componente para el listado. Primero configura de dónde obtiene los datos
y el método al que llamar cuando se hace tap en un elemento de la lista. Luego y el método al que llamar cuando se hace tap en un elemento de la lista. Luego
configura el pull-to-refresh. Por último algunas opciones de visionado y gestión configura el pull-to-refresh. Por último algunas opciones de visionado y gestión
de memoria de memoria
--> -->
<ListView
SeparatorVisibility="None" <ListView SeparatorVisibility="None"
SeparatorColor="{ DynamicResource ListViewSeparatorColor }" SeparatorColor="{ DynamicResource ListViewSeparatorColor }"
Footer="" Footer=""
ItemsSource="{Binding Articles}" ItemsSource="{Binding Articles}"
...@@ -42,6 +41,7 @@ ...@@ -42,6 +41,7 @@
ItemTapped="ItemTapped" ItemTapped="ItemTapped"
HasUnevenRows="false" HasUnevenRows="false"
x:Name="listArticle"> x:Name="listArticle">
<ListView.ItemTemplate> <ListView.ItemTemplate>
<DataTemplate> <DataTemplate>
<ViewCell> <ViewCell>
......
...@@ -12,7 +12,6 @@ namespace inutralia.Views ...@@ -12,7 +12,6 @@ namespace inutralia.Views
public ArticleListView() public ArticleListView()
{ {
InitializeComponent(); InitializeComponent();
BindingContext = new ArticleListViewModel(); BindingContext = new ArticleListViewModel();
} }
......
...@@ -3,14 +3,10 @@ ...@@ -3,14 +3,10 @@
xmlns="http://xamarin.com/schemas/2014/forms" xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="inutralia.Views.ArticleViewPage" x:Class="inutralia.Views.ArticleViewPage"
xmlns:local="clr-namespace:inutralia;assembly=inutralia"
xmlns:ffimageloading="clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms" xmlns:ffimageloading="clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms"
xmlns:fftransformations="clr-namespace:FFImageLoading.Transformations;assembly=FFImageLoading.Transformations"
xmlns:artina="clr-namespace:UXDivers.Artina.Shared;assembly=UXDivers.Artina.Shared"
BackgroundColor="{ DynamicResource MainWrapperBackgroundColor }"> BackgroundColor="{ DynamicResource MainWrapperBackgroundColor }">
<ScrollView x:Name="outerScrollView"> <ScrollView x:Name="outerScrollView">
<Grid <Grid
x:Name="layeringGrid" x:Name="layeringGrid"
RowSpacing="0" RowSpacing="0"
...@@ -61,15 +57,6 @@ ...@@ -61,15 +57,6 @@
Margin="10" Margin="10"
HorizontalOptions="CenterAndExpand" HorizontalOptions="CenterAndExpand"
VerticalOptions="Center"/> VerticalOptions="Center"/>
<!--<Label
Text="{ Binding Article.Subtitle }"
LineBreakMode="WordWrap"
TextColor="{ DynamicResource OverImageTextColor }"
FontSize="16"/>
<BoxView
Style="{StaticResource BrandNameOrnamentStyle}"
Margin="0,20,0,0"/>-->
</Grid> </Grid>
</StackLayout> </StackLayout>
...@@ -111,8 +98,6 @@ ...@@ -111,8 +98,6 @@
FontSize="14" FontSize="14"
TextColor="{ DynamicResource BaseTextColor }" TextColor="{ DynamicResource BaseTextColor }"
HorizontalOptions="End"/> HorizontalOptions="End"/>
</StackLayout> </StackLayout>
<!-- SEPARATOR (CAJA EN LA QUE SE INCLUYEN LAS DOS VARIABLES ANTERIORES (ARTICULO Y FECHA)) --> <!-- SEPARATOR (CAJA EN LA QUE SE INCLUYEN LAS DOS VARIABLES ANTERIORES (ARTICULO Y FECHA)) -->
...@@ -170,5 +155,4 @@ ...@@ -170,5 +155,4 @@
</StackLayout> </StackLayout>
</Grid> </Grid>
</ScrollView> </ScrollView>
</ContentPage> </ContentPage>
...@@ -11,63 +11,65 @@ namespace inutralia.Views ...@@ -11,63 +11,65 @@ namespace inutralia.Views
InitializeComponent(); InitializeComponent();
} }
public ArticleViewPage (ArticleDetailViewModel viewModel) public ArticleViewPage(ArticleDetailViewModel viewModel)
{ {
InitializeComponent (); InitializeComponent();
BindingContext = viewModel; BindingContext = viewModel;
} }
protected override void OnAppearing (){ protected override void OnAppearing()
base.OnAppearing (); {
base.OnAppearing();
outerScrollView.Scrolled += OnScroll; outerScrollView.Scrolled += OnScroll;
} }
protected override void OnDisappearing () protected override void OnDisappearing()
{ {
base.OnDisappearing (); base.OnDisappearing();
outerScrollView.Scrolled -= OnScroll; outerScrollView.Scrolled -= OnScroll;
} }
public void OnScroll (object sender, ScrolledEventArgs e) { public void OnScroll(object sender, ScrolledEventArgs e)
{
var imageHeight = img.Height * 2; var imageHeight = img.Height * 2;
var scrollRegion = layeringGrid.Height - outerScrollView.Height; var scrollRegion = layeringGrid.Height - outerScrollView.Height;
var parallexRegion = imageHeight - outerScrollView.Height; var parallexRegion = imageHeight - outerScrollView.Height;
var factor = outerScrollView.ScrollY - parallexRegion * (outerScrollView.ScrollY / scrollRegion); var factor = outerScrollView.ScrollY - parallexRegion * (outerScrollView.ScrollY / scrollRegion);
if (factor < 0) if (factor < 0)
{ {
factor = 0; factor = 0;
} }
else else
{ {
if (img.TranslationY > img.Height) if (img.TranslationY > img.Height)
{ {
factor = img.Height; factor = img.Height;
} }
else if( img.TranslationY > outerScrollView.ScrollY ){ else if (img.TranslationY > outerScrollView.ScrollY)
{
img.TranslationY = outerScrollView.ScrollY; img.TranslationY = outerScrollView.ScrollY;
} }
} }
img.TranslationY = factor; img.TranslationY = factor;
img.Opacity = 1 - ( factor / imageHeight ) ; img.Opacity = 1 - (factor / imageHeight);
//headers.Scale = 1 - ( (factor ) / (imageHeight * 2) ) ; //headers.Scale = 1 - ( (factor ) / (imageHeight * 2) ) ;
} }
public void OnMore (object sender, EventArgs e) { public void OnMore(object sender, EventArgs e)
{
var mi = ((MenuItem)sender); var mi = ((MenuItem)sender);
DisplayAlert("More Context Action", mi.CommandParameter + " more context action", "OK"); DisplayAlert("More Context Action", mi.CommandParameter + " more context action", "OK");
} }
public void OnDelete (object sender, EventArgs e) { public void OnDelete(object sender, EventArgs e)
{
var mi = ((MenuItem)sender); var mi = ((MenuItem)sender);
DisplayAlert("Delete Context Action", mi.CommandParameter + " delete context action", "OK"); DisplayAlert("Delete Context Action", mi.CommandParameter + " delete context action", "OK");
} }
public void OnPrimaryActionButtonClicked(object sender, EventArgs e) { }
public void OnPrimaryActionButtonClicked (object sender, EventArgs e){
}
} }
} }
...@@ -2,18 +2,11 @@ ...@@ -2,18 +2,11 @@
<ContentView <ContentView
xmlns="http://xamarin.com/schemas/2014/forms" xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:inutralia;assembly=inutralia"
xmlns:ffimageloading="clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms" xmlns:ffimageloading="clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms"
x:Class="inutralia.Views.ArticleItemTemplate" x:Class="inutralia.Views.ArticleItemTemplate"
x:Name="ArticleItemTemplate" x:Name="ArticleItemTemplate"
BackgroundColor="White"> BackgroundColor="White">
<!--<ContentPage.Resources>
<ResourceDictionary>
<local:ImageTransformator x:Key="cnvImg"></local:ImageTransformator>
</ResourceDictionary>
</ContentPage.Resources>-->
<Grid BackgroundColor="Black"> <Grid BackgroundColor="Black">
<ffimageloading:CachedImage <ffimageloading:CachedImage
...@@ -22,8 +15,7 @@ ...@@ -22,8 +15,7 @@
Aspect="AspectFill" Aspect="AspectFill"
Opacity="0.5"/> Opacity="0.5"/>
<Grid <Grid ColumnSpacing="0"
ColumnSpacing="0"
RowSpacing="6" RowSpacing="6"
Padding="20"> Padding="20">
...@@ -32,23 +24,20 @@ ...@@ -32,23 +24,20 @@
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="10" /> <RowDefinition Height="10" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<!--PARTE SUPERIOR--> <!--PARTE SUPERIOR-->
<StackLayout <StackLayout Grid.Row="0"
Grid.Row="0"
VerticalOptions="End" VerticalOptions="End"
HorizontalOptions="Start" HorizontalOptions="Start">
>
<StackLayout <StackLayout Grid.Row="1"
Grid.Row="1"
Orientation="Horizontal" Orientation="Horizontal"
HorizontalOptions="Fill" HorizontalOptions="Fill"
VerticalOptions="FillAndExpand" VerticalOptions="FillAndExpand"
Padding="5" Padding="5">
>
<!--TITULO--> <!--TITULO-->
<Label <Label FontSize="Large"
FontSize="Large"
FontAttributes="Bold" FontAttributes="Bold"
Text="{Binding Title}" Text="{Binding Title}"
LineBreakMode="WordWrap" LineBreakMode="WordWrap"
...@@ -57,37 +46,28 @@ ...@@ -57,37 +46,28 @@
</StackLayout> </StackLayout>
<!--PARTE INFERIOR--> <!--PARTE INFERIOR-->
<StackLayout <StackLayout Grid.Row="1"
Grid.Row="1"
Orientation="Horizontal" Orientation="Horizontal"
HorizontalOptions="Fill" HorizontalOptions="Fill"
VerticalOptions="FillAndExpand"> VerticalOptions="FillAndExpand">
<!--RESUMEN --> <!--RESUMEN -->
<Label Text="{ Binding ExcerptCompress }"
<Label
Text="{ Binding ExcerptCompress }"
TextColor="{ DynamicResource InverseTextColor }" TextColor="{ DynamicResource InverseTextColor }"
HorizontalOptions="FillAndExpand" HorizontalOptions="FillAndExpand"
VerticalOptions="End" VerticalOptions="End"
FontSize="Small"/> FontSize="Small"/>
<!--FECHA--> <!--FECHA-->
<Label Text="{Binding Date}"
<Label
Text="{Binding Date}"
TextColor="{ DynamicResource InverseTextColor }" TextColor="{ DynamicResource InverseTextColor }"
VerticalOptions="End" VerticalOptions="End"
HorizontalOptions="End" HorizontalOptions="End"
FontSize="Micro"/> FontSize="Micro"/>
</StackLayout> </StackLayout>
<BoxView <BoxView Grid.Row="2"
Grid.Row="2"
Style="{StaticResource BrandNameOrnamentStyle}"/> Style="{StaticResource BrandNameOrnamentStyle}"/>
</Grid> </Grid>
</Grid> </Grid>
</ContentView> </ContentView>
using System;
using System.Collections.Generic;
using Xamarin.Forms; using Xamarin.Forms;
namespace inutralia.Views namespace inutralia.Views
{ {
public partial class ArticleItemTemplate : ContentView public partial class ArticleItemTemplate : ContentView
{ {
public ArticleItemTemplate () public ArticleItemTemplate()
{ {
InitializeComponent (); InitializeComponent();
} }
} }
} }
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
<ContentView <ContentView
xmlns="http://xamarin.com/schemas/2014/forms" xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:artina="clr-namespace:UXDivers.Artina.Shared;assembly=UXDivers.Artina.Shared"
xmlns:converter="clr-namespace:UXDivers.Artina.Shared;assembly=UXDivers.Artina.Shared.Base" xmlns:converter="clr-namespace:UXDivers.Artina.Shared;assembly=UXDivers.Artina.Shared.Base"
xmlns:local="clr-namespace:inutralia;assembly=inutralia" xmlns:local="clr-namespace:inutralia;assembly=inutralia"
x:Class="inutralia.Views.Badge" x:Class="inutralia.Views.Badge"
...@@ -18,25 +17,22 @@ ...@@ -18,25 +17,22 @@
<ContentView.Content> <ContentView.Content>
<AbsoluteLayout <AbsoluteLayout
IsVisible="{Binding Source={x:Reference Root}, Path=BadgeText, Converter={StaticResource isBadgeVisibleConverter}}"> IsVisible="{Binding Source={x:Reference Root}, Path=BadgeText, Converter={StaticResource isBadgeVisibleConverter}}">
<Label
FontSize="28" <Label FontSize="28"
Text="{ x:Static local:GrialShapesFont.Circle }" Text="{ x:Static local:GrialShapesFont.Circle }"
TextColor="{Binding Source={x:Reference Root}, Path=BadgeBackgroundColor}" TextColor="{Binding Source={x:Reference Root}, Path=BadgeBackgroundColor}"
Style="{StaticResource FontIconBase}" Style="{StaticResource FontIconBase}"
HorizontalTextAlignment="Center" HorizontalTextAlignment="Center"
VerticalTextAlignment="Center" VerticalTextAlignment="Center"
AbsoluteLayout.LayoutBounds="0,0,28,28" AbsoluteLayout.LayoutBounds="0,0,28,28"/>
/>
<Label <Label Text="{Binding Source={x:Reference Root}, Path=BadgeText}"
Text="{Binding Source={x:Reference Root}, Path=BadgeText}"
TextColor="{Binding Source={x:Reference Root}, Path=BadgeTextColor}" TextColor="{Binding Source={x:Reference Root}, Path=BadgeTextColor}"
HorizontalTextAlignment="Center" HorizontalTextAlignment="Center"
VerticalTextAlignment="Center" VerticalTextAlignment="Center"
FontSize="12" FontSize="12"
FontAttributes="Bold" FontAttributes="Bold"
AbsoluteLayout.LayoutBounds="0,0,28,28" AbsoluteLayout.LayoutBounds="0,0,28,28"/>
/>
</AbsoluteLayout> </AbsoluteLayout>
</ContentView.Content> </ContentView.Content>
</ContentView> </ContentView>
using System;
using System.Collections.Generic;
using Xamarin.Forms; using Xamarin.Forms;
namespace inutralia.Views namespace inutralia.Views
{ {
public partial class Badge : ContentView public partial class Badge : ContentView
{ {
public Badge () public Badge()
{ {
InitializeComponent (); InitializeComponent();
} }
/* CIRCLE */ /* CIRCLE */
public static BindableProperty BadgeBackgroundColorProperty = public static BindableProperty BadgeBackgroundColorProperty =
BindableProperty.Create ( BindableProperty.Create(
nameof ( BadgeBackgroundColor ), nameof(BadgeBackgroundColor),
typeof ( Color ), typeof(Color),
typeof ( Badge ), typeof(Badge),
defaultValue : Color.Default, defaultValue: Color.Default,
defaultBindingMode : BindingMode.OneWay defaultBindingMode: BindingMode.OneWay);
);
public Color BadgeBackgroundColor
public Color BadgeBackgroundColor { {
get { return ( Color )GetValue( BadgeBackgroundColorProperty ); } get { return (Color)GetValue(BadgeBackgroundColorProperty); }
set { SetValue ( BadgeBackgroundColorProperty, value ); } set { SetValue(BadgeBackgroundColorProperty, value); }
} }
/* ICON */ /* ICON */
public static BindableProperty BadgeTextColorProperty = public static BindableProperty BadgeTextColorProperty =
BindableProperty.Create ( BindableProperty.Create(
nameof( BadgeTextColor ), nameof(BadgeTextColor),
typeof ( Color ), typeof(Color),
typeof ( Badge ), typeof(Badge),
defaultValue : Color.White, defaultValue: Color.White,
defaultBindingMode : BindingMode.OneWay defaultBindingMode: BindingMode.OneWay);
);
public Color BadgeTextColor
public Color BadgeTextColor { {
get { return ( Color )GetValue( BadgeTextColorProperty ); } get { return (Color)GetValue(BadgeTextColorProperty); }
set { SetValue ( BadgeTextColorProperty, value ); } set { SetValue(BadgeTextColorProperty, value); }
} }
public static BindableProperty BadgeTextProperty = public static BindableProperty BadgeTextProperty =
BindableProperty.Create ( BindableProperty.Create(
nameof( BadgeText ), nameof(BadgeText),
typeof ( string ), typeof(string),
typeof ( Badge ), typeof(Badge),
defaultValue : "", defaultValue: "",
defaultBindingMode : BindingMode.OneWay defaultBindingMode: BindingMode.OneWay);
);
public string BadgeText
public string BadgeText { {
get { return ( string ) GetValue( BadgeTextProperty ); } get { return (string)GetValue(BadgeTextProperty); }
set { SetValue ( BadgeTextProperty, value ); } set { SetValue(BadgeTextProperty, value); }
} }
} }
} }
......
...@@ -5,8 +5,7 @@ ...@@ -5,8 +5,7 @@
x:Class="inutralia.BrandBlock" x:Class="inutralia.BrandBlock"
Padding="20"> Padding="20">
<Grid <Grid ColumnSpacing="10"
ColumnSpacing="10"
Padding="0" Padding="0"
Style="{ StaticResource BrandContainerStyle }"> Style="{ StaticResource BrandContainerStyle }">
...@@ -15,33 +14,26 @@ ...@@ -15,33 +14,26 @@
<ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Image Grid.Column="0"
<Image
Grid.Column="0"
HeightRequest="64" HeightRequest="64"
WidthRequest="64" WidthRequest="64"
Source="{ StaticResource BrandImage }" Source="{ StaticResource BrandImage }"
BackgroundColor="{ DynamicResource AccentColor }" BackgroundColor="{ DynamicResource AccentColor }" />
/>
<StackLayout <StackLayout Grid.Column="1"
Grid.Column="1"
Orientation="Vertical" Orientation="Vertical"
HorizontalOptions="Start" HorizontalOptions="Start"
VerticalOptions="Center" VerticalOptions="Center"
Spacing="0"> Spacing="0">
<Label
Style="{ DynamicResource BrandNameStyle }" <Label Style="{ DynamicResource BrandNameStyle }"
Text="GRIAL" Text="GRIAL"
FontAttributes="Bold" FontAttributes="Bold"
VerticalTextAlignment="Start"/> VerticalTextAlignment="Start"/>
<Label
Style="{ DynamicResource BrandNameStyle }" <Label Style="{ DynamicResource BrandNameStyle }"
Text="UI.KIT" Text="UI.KIT"
VerticalTextAlignment="Start"/> VerticalTextAlignment="Start"/>
</StackLayout> </StackLayout>
</Grid> </Grid>
</ContentView> </ContentView>
...@@ -4,9 +4,9 @@ namespace inutralia ...@@ -4,9 +4,9 @@ namespace inutralia
{ {
public partial class BrandBlock : ContentView public partial class BrandBlock : ContentView
{ {
public BrandBlock () public BrandBlock()
{ {
InitializeComponent (); InitializeComponent();
} }
} }
} }
\ No newline at end of file
...@@ -2,29 +2,24 @@ ...@@ -2,29 +2,24 @@
<ContentView <ContentView
xmlns="http://xamarin.com/schemas/2014/forms" xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:artina="clr-namespace:UXDivers.Artina.Shared;assembly=UXDivers.Artina.Shared"
xmlns:local="clr-namespace:inutralia;assembly=inutralia" xmlns:local="clr-namespace:inutralia;assembly=inutralia"
x:Class="inutralia.CircleIcon"> x:Class="inutralia.CircleIcon">
<Grid> <Grid>
<Label <Label Text="{ x:Static local:GrialShapesFont.Circle }"
Text="{ x:Static local:GrialShapesFont.Circle }"
IsVisible="{ Binding ShowBackgroundColor }" IsVisible="{ Binding ShowBackgroundColor }"
Style="{ StaticResource FontIconBase }" Style="{ StaticResource FontIconBase }"
HorizontalTextAlignment="Center" HorizontalTextAlignment="Center"
VerticalTextAlignment="Center" VerticalTextAlignment="Center"
Opacity="1" Opacity="1"
FontSize="60" FontSize="60"
TextColor="{ DynamicResource OkColor }" TextColor="{ DynamicResource OkColor }" />
/>
<Label <Label Text="{ x:Static local:GrialShapesFont.ShoppingCart }"
Text="{ x:Static local:GrialShapesFont.ShoppingCart }"
FontSize="25" FontSize="25"
Style="{ StaticResource FontIcon }" Style="{ StaticResource FontIcon }"
HorizontalTextAlignment="Center" HorizontalTextAlignment="Center"
VerticalTextAlignment="Center" VerticalTextAlignment="Center"
TextColor="{ DynamicResource InverseTextColor }" TextColor="{ DynamicResource InverseTextColor }" />
/>
</Grid> </Grid>
</ContentView> </ContentView>
using System;
using System.Collections.Generic;
using Xamarin.Forms; using Xamarin.Forms;
namespace inutralia namespace inutralia
{ {
public partial class CircleIcon : ContentView public partial class CircleIcon : ContentView
{ {
public CircleIcon () public CircleIcon()
{ {
InitializeComponent (); InitializeComponent();
} }
} }
} }
......
...@@ -3,19 +3,17 @@ ...@@ -3,19 +3,17 @@
xmlns="http://xamarin.com/schemas/2014/forms" xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:inutralia;assembly=inutralia" xmlns:local="clr-namespace:inutralia;assembly=inutralia"
x:Class="inutralia.CustomActivityIndicator" x:Class="inutralia.CustomActivityIndicator" >
>
<ContentView.Content> <ContentView.Content>
<Grid <Grid
x:Name="Wrapper"> x:Name="Wrapper">
<BoxView <BoxView HeightRequest="64"
HeightRequest="64"
WidthRequest="64" WidthRequest="64"
BackgroundColor="{DynamicResource AccentColor}" /> BackgroundColor="{DynamicResource AccentColor}" />
<Label <Label Text="{ x:Static local:GrialShapesFont.LogoGrial }"
Text="{ x:Static local:GrialShapesFont.LogoGrial }"
Style="{ DynamicResource FontIconBase }" Style="{ DynamicResource FontIconBase }"
TextColor="White" TextColor="White"
FontSize="45" FontSize="45"
......
using System;
using System.Collections.Generic;
using Xamarin.Forms; using Xamarin.Forms;
namespace inutralia namespace inutralia
...@@ -9,9 +7,10 @@ namespace inutralia ...@@ -9,9 +7,10 @@ namespace inutralia
public CustomActivityIndicator() public CustomActivityIndicator()
{ {
InitializeComponent(); InitializeComponent();
spinY(Wrapper, 1000); SpinY(Wrapper, 1000);
} }
static void spinY(View child, uint duration)
static void SpinY(View child, uint duration)
{ {
var animation = new Animation( var animation = new Animation(
callback: d => child.RotationY = d, callback: d => child.RotationY = d,
...@@ -19,9 +18,8 @@ namespace inutralia ...@@ -19,9 +18,8 @@ namespace inutralia
end: 360, end: 360,
easing: Easing.Linear); easing: Easing.Linear);
animation.Commit(child, "Loop", length: duration, repeat:()=>true); animation.Commit(child, "Loop", length: duration, repeat: () => true);
} }
} }
} }
...@@ -6,8 +6,7 @@ ...@@ -6,8 +6,7 @@
x:Class="inutralia.Rating"> x:Class="inutralia.Rating">
<ContentView.Content> <ContentView.Content>
<Label <Label x:Name="RatingLabel"
x:Name="RatingLabel"
VerticalTextAlignment="Center" VerticalTextAlignment="Center"
HorizontalTextAlignment="Start" HorizontalTextAlignment="Start"
Text="{ Binding Value }" Text="{ Binding Value }"
...@@ -19,7 +18,6 @@ ...@@ -19,7 +18,6 @@
PortraitTablet=34, PortraitTablet=34,
LandscapeTablet=34 }"/> LandscapeTablet=34 }"/>
</ContentView.Content> </ContentView.Content>
</ContentView> </ContentView>
......
using System; using System;
using System.Collections.Generic;
using Xamarin.Forms; using Xamarin.Forms;
namespace inutralia namespace inutralia
...@@ -26,7 +25,6 @@ namespace inutralia ...@@ -26,7 +25,6 @@ namespace inutralia
{ {
var ctrl = (Rating)bindable; var ctrl = (Rating)bindable;
ctrl.RatingLabel.Text = ctrl.Update(); ctrl.RatingLabel.Text = ctrl.Update();
} }
); );
...@@ -65,6 +63,7 @@ namespace inutralia ...@@ -65,6 +63,7 @@ namespace inutralia
{ {
value = Max; value = Max;
} }
else if (Value < 0) else if (Value < 0)
{ {
value = 0; value = 0;
...@@ -76,23 +75,30 @@ namespace inutralia ...@@ -76,23 +75,30 @@ namespace inutralia
{ {
str += RATING_FULL_ICON_CHAR; str += RATING_FULL_ICON_CHAR;
} }
else {
else
{
if (i - value > 1.0) if (i - value > 1.0)
{ {
str += RATING_EMPTY_ICON_CHAR; str += RATING_EMPTY_ICON_CHAR;
} }
else {
else
{
var decimals = value - Math.Floor(value); var decimals = value - Math.Floor(value);
if (decimals < 0.2) if (decimals < 0.2)
{ {
str += RATING_EMPTY_ICON_CHAR; str += RATING_EMPTY_ICON_CHAR;
} }
else if (decimals > 0.8) else if (decimals > 0.8)
{ {
str += RATING_FULL_ICON_CHAR; str += RATING_FULL_ICON_CHAR;
} }
else {
else
{
str += RATING_PARTIAL_ICON_CHAR; str += RATING_PARTIAL_ICON_CHAR;
} }
} }
......
...@@ -9,12 +9,11 @@ ...@@ -9,12 +9,11 @@
<ContentView.Content> <ContentView.Content>
<AbsoluteLayout <AbsoluteLayout
effects:Effects.CornerRadius="{ Binding Source={ x:Reference Root }, Path=RoundedLabelCornerRadius }" effects:Effects.CornerRadius="{ Binding Source={ x:Reference Root }, Path=RoundedLabelCornerRadius }"
BackgroundColor="{ Binding Source={ x:Reference Root }, Path=RoundedLabelBackgroundColor }" BackgroundColor="{ Binding Source={ x:Reference Root }, Path=RoundedLabelBackgroundColor }" >
>
<Label <Label VerticalOptions="Center"
VerticalOptions="Center"
LineBreakMode="TailTruncation" LineBreakMode="TailTruncation"
Margin="{ Binding Source={ x:Reference Root }, Path=RoundedLabelPadding }" Margin="{ Binding Source={ x:Reference Root }, Path=RoundedLabelPadding }"
FontSize="{ Binding Source={ x:Reference Root }, Path=RoundedLabelFontSize }" FontSize="{ Binding Source={ x:Reference Root }, Path=RoundedLabelFontSize }"
...@@ -25,5 +24,4 @@ ...@@ -25,5 +24,4 @@
</AbsoluteLayout> </AbsoluteLayout>
</ContentView.Content> </ContentView.Content>
</ContentView> </ContentView>
using System; using System;
using System.Collections.Generic;
using Xamarin.Forms; using Xamarin.Forms;
namespace inutralia namespace inutralia
...@@ -11,117 +10,95 @@ namespace inutralia ...@@ -11,117 +10,95 @@ namespace inutralia
InitializeComponent(); InitializeComponent();
} }
public static BindableProperty RoundedLabelBackgroundColorProperty = BindableProperty.Create(
nameof(RoundedLabelBackgroundColor),
typeof(Color),
typeof(RoundedLabel),
defaultValue: Color.Green,
defaultBindingMode: BindingMode.OneWay);
public static BindableProperty RoundedLabelBackgroundColorProperty = public Color RoundedLabelBackgroundColor
BindableProperty.Create ( {
nameof ( RoundedLabelBackgroundColor ), get { return (Color)GetValue(RoundedLabelBackgroundColorProperty); }
typeof ( Color ), set { SetValue(RoundedLabelBackgroundColorProperty, value); }
typeof ( RoundedLabel ),
defaultValue : Color.Green,
defaultBindingMode : BindingMode.OneWay
);
public Color RoundedLabelBackgroundColor {
get { return ( Color )GetValue( RoundedLabelBackgroundColorProperty ); }
set { SetValue ( RoundedLabelBackgroundColorProperty, value ); }
} }
public static BindableProperty RoundedLabelTextColorProperty = BindableProperty.Create(
nameof(RoundedLabelTextColor),
typeof(Color),
typeof(RoundedLabel),
defaultValue: Color.White,
defaultBindingMode: BindingMode.OneWay);
public Color RoundedLabelTextColor
public static BindableProperty RoundedLabelTextColorProperty = {
BindableProperty.Create ( get { return (Color)GetValue(RoundedLabelTextColorProperty); }
nameof( RoundedLabelTextColor ), set { SetValue(RoundedLabelTextColorProperty, value); }
typeof ( Color ),
typeof ( RoundedLabel ),
defaultValue : Color.White,
defaultBindingMode : BindingMode.OneWay
);
public Color RoundedLabelTextColor {
get { return ( Color )GetValue( RoundedLabelTextColorProperty ); }
set { SetValue ( RoundedLabelTextColorProperty, value ); }
} }
public static BindableProperty RoundedLabelTextProperty = BindableProperty.Create(
nameof(RoundedLabelText),
typeof(string),
typeof(RoundedLabel),
defaultValue: "",
defaultBindingMode: BindingMode.OneWay);
public string RoundedLabelText
{
public static BindableProperty RoundedLabelTextProperty = get { return (string)GetValue(RoundedLabelTextProperty); }
BindableProperty.Create ( set { SetValue(RoundedLabelTextProperty, value); }
nameof( RoundedLabelText ),
typeof ( string ),
typeof ( RoundedLabel ),
defaultValue : "",
defaultBindingMode : BindingMode.OneWay
);
public string RoundedLabelText {
get { return (string) GetValue( RoundedLabelTextProperty ); }
set { SetValue ( RoundedLabelTextProperty, value ); }
} }
public static BindableProperty RoundedLabelPaddingProperty = BindableProperty.Create(
nameof(RoundedLabelPadding),
typeof(Thickness),
typeof(RoundedLabel),
defaultValue: new Thickness(6, 0),
defaultBindingMode: BindingMode.OneWay);
public Thickness RoundedLabelPadding
{
public static BindableProperty RoundedLabelPaddingProperty = get { return (Thickness)GetValue(RoundedLabelPaddingProperty); }
BindableProperty.Create ( set { SetValue(RoundedLabelPaddingProperty, value); }
nameof ( RoundedLabelPadding ),
typeof ( Thickness ),
typeof ( RoundedLabel ),
defaultValue : new Thickness(6,0),
defaultBindingMode : BindingMode.OneWay
);
public Thickness RoundedLabelPadding {
get { return ( Thickness )GetValue( RoundedLabelPaddingProperty ); }
set { SetValue ( RoundedLabelPaddingProperty, value ); }
} }
public static BindableProperty RoundedLabelCornerRadiusProperty = BindableProperty.Create(
nameof(RoundedLabelCornerRadius),
typeof(Double),
typeof(RoundedLabel),
defaultValue: 6.0,
defaultBindingMode: BindingMode.OneWay);
public Double RoundedLabelCornerRadius
public static BindableProperty RoundedLabelCornerRadiusProperty = {
BindableProperty.Create ( get { return (Double)GetValue(RoundedLabelCornerRadiusProperty); }
nameof ( RoundedLabelCornerRadius ), set { SetValue(RoundedLabelCornerRadiusProperty, value); }
typeof ( Double ),
typeof ( RoundedLabel ),
defaultValue : 6.0,
defaultBindingMode : BindingMode.OneWay
);
public Double RoundedLabelCornerRadius {
get { return ( Double )GetValue( RoundedLabelCornerRadiusProperty ); }
set { SetValue ( RoundedLabelCornerRadiusProperty, value ); }
} }
public static BindableProperty RoundedLabelFontSizeProperty = BindableProperty.Create(
nameof(RoundedLabelFontSize),
typeof(Double),
typeof(RoundedLabel),
defaultValue: 10.0,
defaultBindingMode: BindingMode.OneWay);
public Double RoundedLabelFontSize
public static BindableProperty RoundedLabelFontSizeProperty = {
BindableProperty.Create ( get { return (Double)GetValue(RoundedLabelFontSizeProperty); }
nameof ( RoundedLabelFontSize ), set { SetValue(RoundedLabelFontSizeProperty, value); }
typeof ( Double ),
typeof ( RoundedLabel ),
defaultValue : 10.0,
defaultBindingMode : BindingMode.OneWay
);
public Double RoundedLabelFontSize {
get { return ( Double )GetValue( RoundedLabelFontSizeProperty ); }
set { SetValue ( RoundedLabelFontSizeProperty, value ); }
} }
public static BindableProperty RoundedLabelFontAttributesProperty = BindableProperty.Create(
nameof(RoundedLabelFontAttributes),
typeof(Enum),
typeof(RoundedLabel),
defaultValue: null,
defaultBindingMode: BindingMode.OneWay);
public Enum RoundedLabelFontAttributes
public static BindableProperty RoundedLabelFontAttributesProperty = {
BindableProperty.Create ( get { return (Enum)GetValue(RoundedLabelFontAttributesProperty); }
nameof ( RoundedLabelFontAttributes ), set { SetValue(RoundedLabelFontAttributesProperty, value); }
typeof ( Enum ),
typeof ( RoundedLabel ),
defaultValue : null,
defaultBindingMode : BindingMode.OneWay
);
public Enum RoundedLabelFontAttributes {
get { return ( Enum )GetValue( RoundedLabelFontAttributesProperty ); }
set { SetValue ( RoundedLabelFontAttributesProperty, value ); }
} }
} }
} }
...@@ -3,12 +3,13 @@ ...@@ -3,12 +3,13 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="inutralia.Views.HomeView" x:Class="inutralia.Views.HomeView"
xmlns:local="clr-namespace:inutralia;assembly=inutralia" xmlns:local="clr-namespace:inutralia;assembly=inutralia"
xmlns:artina="clr-namespace:UXDivers.Artina.Shared;assembly=UXDivers.Artina.Shared"
NavigationPage.HasNavigationBar="false" NavigationPage.HasNavigationBar="false"
Padding ="0,40,0,10"> Padding ="0,40,0,10">
<StackLayout> <StackLayout>
<!-- -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*LOGO-*-*-*-*-*-*-*-*-*-*-*-* --> <!-- -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*LOGO-*-*-*-*-*-*-*-*-*-*-*-* -->
<StackLayout HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"> <StackLayout HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
<Image Source="logo_empresa.png" Aspect="AspectFit" HorizontalOptions="FillAndExpand" VerticalOptions="CenterAndExpand" > <Image Source="logo_empresa.png" Aspect="AspectFit" HorizontalOptions="FillAndExpand" VerticalOptions="CenterAndExpand" >
<Image.WidthRequest> <Image.WidthRequest>
...@@ -30,6 +31,7 @@ ...@@ -30,6 +31,7 @@
</StackLayout> </StackLayout>
<!-- -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*MENÚ CUADRADOS-*-*-*-*-*-*-*-*-*-*-*-* --> <!-- -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*MENÚ CUADRADOS-*-*-*-*-*-*-*-*-*-*-*-* -->
<Grid HorizontalOptions="Center" VerticalOptions="FillAndExpand" Padding="15,20,15,10" ColumnSpacing="10" RowSpacing="10"> <Grid HorizontalOptions="Center" VerticalOptions="FillAndExpand" Padding="15,20,15,10" ColumnSpacing="10" RowSpacing="10">
<Grid.RowDefinitions> <Grid.RowDefinitions>
...@@ -60,8 +62,7 @@ ...@@ -60,8 +62,7 @@
</Image.WidthRequest> </Image.WidthRequest>
<Image.GestureRecognizers> <Image.GestureRecognizers>
<TapGestureRecognizer <TapGestureRecognizer Tapped="OnTapGestureProfile"
Tapped="OnTapGestureProfile"
NumberOfTapsRequired="1" /> NumberOfTapsRequired="1" />
</Image.GestureRecognizers> </Image.GestureRecognizers>
</Image> </Image>
...@@ -84,8 +85,7 @@ ...@@ -84,8 +85,7 @@
</Image.WidthRequest> </Image.WidthRequest>
<Image.GestureRecognizers> <Image.GestureRecognizers>
<TapGestureRecognizer <TapGestureRecognizer Tapped="OnTapGestureMenu"
Tapped="OnTapGestureMenu"
NumberOfTapsRequired="1" /> NumberOfTapsRequired="1" />
</Image.GestureRecognizers> </Image.GestureRecognizers>
</Image> </Image>
...@@ -108,8 +108,7 @@ ...@@ -108,8 +108,7 @@
</Image.WidthRequest> </Image.WidthRequest>
<Image.GestureRecognizers> <Image.GestureRecognizers>
<TapGestureRecognizer <TapGestureRecognizer Tapped="OnTapGestureGeneric"
Tapped="OnTapGestureGeneric"
NumberOfTapsRequired="1" /> NumberOfTapsRequired="1" />
</Image.GestureRecognizers> </Image.GestureRecognizers>
</Image> </Image>
...@@ -132,16 +131,15 @@ ...@@ -132,16 +131,15 @@
</Image.WidthRequest> </Image.WidthRequest>
<Image.GestureRecognizers> <Image.GestureRecognizers>
<TapGestureRecognizer <TapGestureRecognizer Tapped="OnTapGestureTrivial"
Tapped="OnTapGestureTrivial"
NumberOfTapsRequired="1" /> NumberOfTapsRequired="1" />
</Image.GestureRecognizers> </Image.GestureRecognizers>
</Image> </Image>
</Grid> </Grid>
<!-- -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*MENÚ LISTADO-*-*-*-*-*-*-*-*-*-*-*-* --> <!-- -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*MENÚ LISTADO-*-*-*-*-*-*-*-*-*-*-*-* -->
<Grid Padding="15,0,10,20" VerticalOptions="End">
<Grid Padding="15,0,10,20" VerticalOptions="End">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition> <RowDefinition>
<RowDefinition.Height> <RowDefinition.Height>
...@@ -200,8 +198,7 @@ ...@@ -200,8 +198,7 @@
<!--label clickable que englobal las 3 columnas del item del menú--> <!--label clickable que englobal las 3 columnas del item del menú-->
<Label HorizontalOptions="Fill" VerticalOptions="Fill" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3"> <Label HorizontalOptions="Fill" VerticalOptions="Fill" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3">
<Label.GestureRecognizers> <Label.GestureRecognizers>
<TapGestureRecognizer <TapGestureRecognizer Tapped="OnTapGestureRecipe"
Tapped="OnTapGestureRecipe"
NumberOfTapsRequired="1" /> NumberOfTapsRequired="1" />
</Label.GestureRecognizers> </Label.GestureRecognizers>
</Label> </Label>
...@@ -213,9 +210,9 @@ ...@@ -213,9 +210,9 @@
Phone="30" Phone="30"
Tablet="50"/> Tablet="50"/>
</Label.FontSize> </Label.FontSize>
<Label.GestureRecognizers> <Label.GestureRecognizers>
<TapGestureRecognizer <TapGestureRecognizer Tapped="OnTapGestureRecipe"
Tapped="OnTapGestureRecipe"
NumberOfTapsRequired="1" /> NumberOfTapsRequired="1" />
</Label.GestureRecognizers> </Label.GestureRecognizers>
</Label> </Label>
...@@ -227,9 +224,9 @@ ...@@ -227,9 +224,9 @@
Phone="15" Phone="15"
Tablet="25"/> Tablet="25"/>
</Label.FontSize> </Label.FontSize>
<Label.GestureRecognizers> <Label.GestureRecognizers>
<TapGestureRecognizer <TapGestureRecognizer Tapped="OnTapGestureRecipe"
Tapped="OnTapGestureRecipe"
NumberOfTapsRequired="1" /> NumberOfTapsRequired="1" />
</Label.GestureRecognizers> </Label.GestureRecognizers>
</Label> </Label>
...@@ -241,9 +238,9 @@ ...@@ -241,9 +238,9 @@
Phone="30" Phone="30"
Tablet="50"/> Tablet="50"/>
</Label.FontSize> </Label.FontSize>
<Label.GestureRecognizers> <Label.GestureRecognizers>
<TapGestureRecognizer <TapGestureRecognizer Tapped="OnTapGestureRecipe"
Tapped="OnTapGestureRecipe"
NumberOfTapsRequired="1" /> NumberOfTapsRequired="1" />
</Label.GestureRecognizers> </Label.GestureRecognizers>
</Label> </Label>
...@@ -257,8 +254,7 @@ ...@@ -257,8 +254,7 @@
<!--label clickable que englobal las 3 columnas del item del menú--> <!--label clickable que englobal las 3 columnas del item del menú-->
<Label HorizontalOptions="Fill" VerticalOptions="Fill" Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3"> <Label HorizontalOptions="Fill" VerticalOptions="Fill" Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3">
<Label.GestureRecognizers> <Label.GestureRecognizers>
<TapGestureRecognizer <TapGestureRecognizer Tapped="OnTapGestureArticle"
Tapped="OnTapGestureArticle"
NumberOfTapsRequired="1" /> NumberOfTapsRequired="1" />
</Label.GestureRecognizers> </Label.GestureRecognizers>
</Label> </Label>
...@@ -270,9 +266,9 @@ ...@@ -270,9 +266,9 @@
Phone="30" Phone="30"
Tablet="50"/> Tablet="50"/>
</Label.FontSize> </Label.FontSize>
<Label.GestureRecognizers> <Label.GestureRecognizers>
<TapGestureRecognizer <TapGestureRecognizer Tapped="OnTapGestureArticle"
Tapped="OnTapGestureArticle"
NumberOfTapsRequired="1" /> NumberOfTapsRequired="1" />
</Label.GestureRecognizers> </Label.GestureRecognizers>
</Label> </Label>
...@@ -284,9 +280,9 @@ ...@@ -284,9 +280,9 @@
Phone="15" Phone="15"
Tablet="25"/> Tablet="25"/>
</Label.FontSize> </Label.FontSize>
<Label.GestureRecognizers> <Label.GestureRecognizers>
<TapGestureRecognizer <TapGestureRecognizer Tapped="OnTapGestureArticle"
Tapped="OnTapGestureArticle"
NumberOfTapsRequired="1" /> NumberOfTapsRequired="1" />
</Label.GestureRecognizers> </Label.GestureRecognizers>
</Label> </Label>
...@@ -298,9 +294,9 @@ ...@@ -298,9 +294,9 @@
Phone="30" Phone="30"
Tablet="50"/> Tablet="50"/>
</Label.FontSize> </Label.FontSize>
<Label.GestureRecognizers> <Label.GestureRecognizers>
<TapGestureRecognizer <TapGestureRecognizer Tapped="OnTapGestureArticle"
Tapped="OnTapGestureArticle"
NumberOfTapsRequired="1" /> NumberOfTapsRequired="1" />
</Label.GestureRecognizers> </Label.GestureRecognizers>
</Label> </Label>
...@@ -314,8 +310,7 @@ ...@@ -314,8 +310,7 @@
<!--label clickable que englobal las 3 columnas del item del menú--> <!--label clickable que englobal las 3 columnas del item del menú-->
<Label HorizontalOptions="Fill" VerticalOptions="Fill" Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="3" > <Label HorizontalOptions="Fill" VerticalOptions="Fill" Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="3" >
<Label.GestureRecognizers> <Label.GestureRecognizers>
<TapGestureRecognizer <TapGestureRecognizer Tapped="OnTapGestureShoppingList"
Tapped="OnTapGestureShoppingList"
NumberOfTapsRequired="1" /> NumberOfTapsRequired="1" />
</Label.GestureRecognizers> </Label.GestureRecognizers>
</Label> </Label>
...@@ -327,9 +322,9 @@ ...@@ -327,9 +322,9 @@
Phone="30" Phone="30"
Tablet="50"/> Tablet="50"/>
</Label.FontSize> </Label.FontSize>
<Label.GestureRecognizers> <Label.GestureRecognizers>
<TapGestureRecognizer <TapGestureRecognizer Tapped="OnTapGestureShoppingList"
Tapped="OnTapGestureShoppingList"
NumberOfTapsRequired="1" /> NumberOfTapsRequired="1" />
</Label.GestureRecognizers> </Label.GestureRecognizers>
</Label> </Label>
...@@ -341,9 +336,9 @@ ...@@ -341,9 +336,9 @@
Phone="15" Phone="15"
Tablet="25"/> Tablet="25"/>
</Label.FontSize> </Label.FontSize>
<Label.GestureRecognizers> <Label.GestureRecognizers>
<TapGestureRecognizer <TapGestureRecognizer Tapped="OnTapGestureShoppingList"
Tapped="OnTapGestureShoppingList"
NumberOfTapsRequired="1" /> NumberOfTapsRequired="1" />
</Label.GestureRecognizers> </Label.GestureRecognizers>
</Label> </Label>
...@@ -355,16 +350,15 @@ ...@@ -355,16 +350,15 @@
Phone="30" Phone="30"
Tablet="50"/> Tablet="50"/>
</Label.FontSize> </Label.FontSize>
<Label.GestureRecognizers> <Label.GestureRecognizers>
<TapGestureRecognizer <TapGestureRecognizer Tapped="OnTapGestureShoppingList"
Tapped="OnTapGestureShoppingList"
NumberOfTapsRequired="1" /> NumberOfTapsRequired="1" />
</Label.GestureRecognizers> </Label.GestureRecognizers>
</Label> </Label>
<!---*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-5. item separator-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*_*-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-* --> <!---*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-5. item separator-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*_*-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-* -->
<BoxView Grid.Row="5" HeightRequest="1" Grid.ColumnSpan="3" BackgroundColor="{ DynamicResource ListViewSeparatorColor }" HorizontalOptions="FillAndExpand" /> <BoxView Grid.Row="5" HeightRequest="1" Grid.ColumnSpan="3" BackgroundColor="{ DynamicResource ListViewSeparatorColor }" HorizontalOptions="FillAndExpand" />
</Grid> </Grid>
</StackLayout> </StackLayout>
</ContentPage> </ContentPage>
using inutralia.Views; using System;
using System;
using System.Collections.Generic;
using Xamarin.Forms; using Xamarin.Forms;
namespace inutralia.Views namespace inutralia.Views
...@@ -17,39 +14,38 @@ namespace inutralia.Views ...@@ -17,39 +14,38 @@ namespace inutralia.Views
void OnTapGestureProfile(object sender, EventArgs args) void OnTapGestureProfile(object sender, EventArgs args)
{ {
RootPage?.Navigate<ProfileView> (); RootPage?.Navigate<ProfileView>();
} }
void OnTapGestureMenu (object sender, EventArgs args) void OnTapGestureMenu(object sender, EventArgs args)
{ {
RootPage?.Navigate<CustomMenuView> (); RootPage?.Navigate<CustomMenuView>();
} }
void OnTapGestureGeneric (object sender, EventArgs args) void OnTapGestureGeneric(object sender, EventArgs args)
{ {
RootPage?.Navigate<GenericListView> (); RootPage?.Navigate<GenericListView>();
} }
void OnTapGestureTrivial (object sender, EventArgs args) void OnTapGestureTrivial(object sender, EventArgs args)
{ {
RootPage?.Navigate<TrivialListView> (); RootPage?.Navigate<TrivialListView>();
} }
void OnTapGestureArticle (object sender, EventArgs args) void OnTapGestureArticle(object sender, EventArgs args)
{ {
RootPage?.Navigate<ArticleListView> (); RootPage?.Navigate<ArticleListView>();
} }
void OnTapGestureShoppingList(object sender, EventArgs args) void OnTapGestureShoppingList(object sender, EventArgs args)
{ {
RootPage?.Navigate<ShoppingListView> (); RootPage?.Navigate<ShoppingListView>();
} }
void OnTapGestureRecipe(object sender, EventArgs args) void OnTapGestureRecipe(object sender, EventArgs args)
{ {
RootPage?.Navigate<RecipeListView> (); RootPage?.Navigate<RecipeListView>();
} }
} }
} }
...@@ -7,28 +7,24 @@ ...@@ -7,28 +7,24 @@
xmlns:local="clr-namespace:inutralia;assembly=inutralia" xmlns:local="clr-namespace:inutralia;assembly=inutralia"
Title="Acceso a la Aplicación ..." Title="Acceso a la Aplicación ..."
NavigationPage.HasNavigationBar="False" NavigationPage.HasNavigationBar="False"
BackgroundColor="{DynamicResource BasePageColor}"> BackgroundColor="{DynamicResource BasePageColor}">
<ContentPage.Content> <ContentPage.Content>
<AbsoluteLayout> <AbsoluteLayout>
<!-- GRADIENT--> <!-- GRADIENT-->
<Image <Image AbsoluteLayout.LayoutBounds="0,0,1,44"
AbsoluteLayout.LayoutBounds="0,0,1,44"
AbsoluteLayout.LayoutFlags="WidthProportional" AbsoluteLayout.LayoutFlags="WidthProportional"
Style="{ StaticResource StatusBarShimStyle }" Style="{ StaticResource StatusBarShimStyle }"
VerticalOptions="Start"/> VerticalOptions="Start"/>
<ScrollView <ScrollView AbsoluteLayout.LayoutBounds="0,0,1,1"
AbsoluteLayout.LayoutBounds="0,0,1,1"
AbsoluteLayout.LayoutFlags="All" AbsoluteLayout.LayoutFlags="All"
VerticalOptions="FillAndExpand" VerticalOptions="FillAndExpand"
Padding="{ DynamicResource MainWrapperPadding }"> Padding="{ DynamicResource MainWrapperPadding }">
<!-- MAIN CONTAINER --> <!-- MAIN CONTAINER -->
<Grid <Grid ColumnSpacing="0"
ColumnSpacing="0"
RowSpacing="0" RowSpacing="0"
Padding="20,30,20,10" Padding="20,30,20,10"
HorizontalOptions="Fill" HorizontalOptions="Fill"
...@@ -41,27 +37,23 @@ ...@@ -41,27 +37,23 @@
</Grid.RowDefinitions> </Grid.RowDefinitions>
<!-- HEADER --> <!-- HEADER -->
<StackLayout <StackLayout Grid.Row="0"
Grid.Row="0"
Spacing="5" Spacing="5"
Padding="0,20,0,0" Padding="0,20,0,0"
InputTransparent="true"> InputTransparent="true">
<!-- LOGO --> <!-- LOGO -->
<Grid <Grid Grid.Row="1"
Grid.Row="1"
WidthRequest="150" WidthRequest="150"
VerticalOptions="Center" VerticalOptions="Center"
HorizontalOptions="Center"> HorizontalOptions="Center">
<Image Source="logo_empresa.png" WidthRequest="150"></Image>
<Image Source="logo_empresa.png"
WidthRequest="150" />
</Grid> </Grid>
<!-- WELCOME TEXT --> <!-- WELCOME TEXT -->
<Label <Label Text="{ StaticResource LoginWelcomeText }"
Text="{ StaticResource LoginWelcomeText }"
FontSize="{ artina:OnOrientationDouble FontSize="{ artina:OnOrientationDouble
PortraitPhone=22, PortraitPhone=22,
LandscapePhone=22, LandscapePhone=22,
...@@ -70,8 +62,7 @@ ...@@ -70,8 +62,7 @@
HorizontalTextAlignment="Center" HorizontalTextAlignment="Center"
TextColor="{ DynamicResource BaseTextColor }"/> TextColor="{ DynamicResource BaseTextColor }"/>
<Label <Label Text="Por favor, ingrese usuario y password"
Text="Por favor, ingrese usuario y password"
HorizontalTextAlignment="Center" HorizontalTextAlignment="Center"
FontSize="{ artina:OnOrientationDouble FontSize="{ artina:OnOrientationDouble
PortraitPhone=15, PortraitPhone=15,
...@@ -80,24 +71,19 @@ ...@@ -80,24 +71,19 @@
LandscapeTablet=18 }"/> LandscapeTablet=18 }"/>
<!--SEPARATOR--> <!--SEPARATOR-->
<BoxView <BoxView WidthRequest="80"
WidthRequest="80"
HeightRequest="1" HeightRequest="1"
HorizontalOptions="Center" HorizontalOptions="Center"
VerticalOptions="End" VerticalOptions="End"
BackgroundColor="{DynamicResource BaseTextColor}"/> BackgroundColor="{DynamicResource BaseTextColor}"/>
</StackLayout> </StackLayout>
<!---FIELDS CONTAINER--> <!---FIELDS CONTAINER-->
<Grid <Grid Grid.Row="1"
Grid.Row="1"
RowSpacing="30" RowSpacing="30"
Padding="0,20,0,20" Padding="0,20,0,20"
VerticalOptions="Center"> VerticalOptions="Center">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
...@@ -109,20 +95,17 @@ ...@@ -109,20 +95,17 @@
</Grid.RowDefinitions> </Grid.RowDefinitions>
<!-- ICON BACKGROUND --> <!-- ICON BACKGROUND -->
<Label <Label Grid.Column="0"
Grid.Column="0"
Grid.Row="0" Grid.Row="0"
FontSize="40" FontSize="40"
Style="{StaticResource RoundShape}" Style="{StaticResource RoundShape}"
HorizontalTextAlignment="Center" HorizontalTextAlignment="Center"
TextColor="{DynamicResource ComplementColor}" TextColor="{DynamicResource ComplementColor}"
VerticalOptions="Center" VerticalOptions="Center"
HorizontalOptions="Center" HorizontalOptions="Center"/>
/>
<!-- ICON --> <!-- ICON -->
<Label <Label Grid.Column="0"
Grid.Column="0"
Grid.Row="0" Grid.Row="0"
FontSize="14" FontSize="14"
Text="{ x:Static local:GrialShapesFont.Email }" Text="{ x:Static local:GrialShapesFont.Email }"
...@@ -130,12 +113,10 @@ ...@@ -130,12 +113,10 @@
HorizontalTextAlignment="Center" HorizontalTextAlignment="Center"
TextColor="White" TextColor="White"
VerticalOptions="Center" VerticalOptions="Center"
HorizontalOptions="Center" HorizontalOptions="Center"/>
/>
<!--EMAIL FIELD--> <!--EMAIL FIELD-->
<Entry <Entry Grid.Column="1"
Grid.Column="1"
Grid.Row="0" Grid.Row="0"
HeightRequest="40" HeightRequest="40"
x:Name = "userEntry" x:Name = "userEntry"
...@@ -144,20 +125,17 @@ ...@@ -144,20 +125,17 @@
PlaceholderColor="{ DynamicResource BaseTextColor }"/> PlaceholderColor="{ DynamicResource BaseTextColor }"/>
<!-- ICON BACKGROUND --> <!-- ICON BACKGROUND -->
<Label <Label Grid.Column="0"
Grid.Column="0"
Grid.Row="1" Grid.Row="1"
FontSize="40" FontSize="40"
Style="{StaticResource RoundShape}" Style="{StaticResource RoundShape}"
HorizontalTextAlignment="Center" HorizontalTextAlignment="Center"
TextColor="{DynamicResource ComplementColor}" TextColor="{DynamicResource ComplementColor}"
VerticalOptions="Center" VerticalOptions="Center"
HorizontalOptions="Center" HorizontalOptions="Center"/>
/>
<!-- ICON --> <!-- ICON -->
<Label <Label Grid.Column="0"
Grid.Column="0"
Grid.Row="1" Grid.Row="1"
FontSize="14" FontSize="14"
Text="{ x:Static local:GrialShapesFont.Lock }" Text="{ x:Static local:GrialShapesFont.Lock }"
...@@ -165,12 +143,10 @@ ...@@ -165,12 +143,10 @@
HorizontalTextAlignment="Center" HorizontalTextAlignment="Center"
TextColor="White" TextColor="White"
VerticalOptions="Center" VerticalOptions="Center"
HorizontalOptions="Center" HorizontalOptions="Center" />
/>
<!-- PASSWORD ENTRY --> <!-- PASSWORD ENTRY -->
<Entry <Entry Grid.Column="1"
Grid.Column="1"
Grid.Row="1" Grid.Row="1"
HeightRequest="40" HeightRequest="40"
x:Name = "passwordEntry" x:Name = "passwordEntry"
...@@ -178,12 +154,10 @@ ...@@ -178,12 +154,10 @@
IsPassword="True" IsPassword="True"
BackgroundColor="{ DynamicResource PlaceholderColorEntry }" BackgroundColor="{ DynamicResource PlaceholderColorEntry }"
PlaceholderColor="{ DynamicResource BaseTextColor }"/> PlaceholderColor="{ DynamicResource BaseTextColor }"/>
</Grid> </Grid>
<!-- BUTTONS --> <!-- BUTTONS -->
<StackLayout <StackLayout Grid.Row="2"
Grid.Row="2"
Spacing="10" Spacing="10"
Padding="0,10,0,0" Padding="0,10,0,0"
HorizontalOptions="FillAndExpand" HorizontalOptions="FillAndExpand"
...@@ -204,49 +178,16 @@ ...@@ -204,49 +178,16 @@
PortraitTablet=Fill, PortraitTablet=Fill,
LandscapeTablet=Center }"/> LandscapeTablet=Center }"/>
<!--<Label
Text="Si todavía no se ha registrado ..."
FontSize="13"
HorizontalTextAlignment="Center"/>
--><!-- FACEBOOK --><!--
<artina:Button
Style="{ DynamicResource PrimaryActionButtonStyle }"
BackgroundColor="#3b5998"
VerticalOptions="End"
x:Name="registerButton"
Text = "Registrar"
Clicked="OnRegisterButtonClicked"
WidthRequest="{ artina:OnOrientationDouble
LandscapePhone=200,
LandscapeTablet=400 }"
HorizontalOptions="{ artina:OnOrientationLayoutOptions
PortraitPhone=Fill,
LandscapePhone=Center,
PortraitTablet=Fill,
LandscapeTablet=Center }"/>-->
<!--SEPARATOR--> <!--SEPARATOR-->
<BoxView <BoxView Grid.Row="4"
Grid.Row="4"
HeightRequest="1" HeightRequest="1"
VerticalOptions="Start" VerticalOptions="Start"
HorizontalOptions="Center" HorizontalOptions="Center"
WidthRequest="300" WidthRequest="300"
BackgroundColor="{DynamicResource BaseTextColor}"/> BackgroundColor="{DynamicResource BaseTextColor}"/>
<!--
<Label
Grid.Row="4"
HorizontalOptions="Center"
VerticalOptions="Center"
FontSize="14"
x:Name="rememberButton"
Text = "Recordar Contraseña"
Clicked="OnRememberButtonClicked"/>
-->
</StackLayout> </StackLayout>
</Grid> </Grid>
</ScrollView> </ScrollView>
</AbsoluteLayout> </AbsoluteLayout>
</ContentPage.Content> </ContentPage.Content>
</ContentPage> </ContentPage>
using System; using System;
using System.Collections.Generic;
using inutralia.Models; using inutralia.Models;
using Xamarin.Forms; using Xamarin.Forms;
...@@ -8,13 +6,9 @@ namespace inutralia.Views ...@@ -8,13 +6,9 @@ namespace inutralia.Views
{ {
public partial class LoginView : ContentPage public partial class LoginView : ContentPage
{ {
private bool processing private bool processing
{ {
set set { loginButton.IsEnabled = !value; }
{
loginButton.IsEnabled = !value;
}
} }
public LoginView() public LoginView()
...@@ -23,7 +17,6 @@ namespace inutralia.Views ...@@ -23,7 +17,6 @@ namespace inutralia.Views
if (Application.Current.Properties.ContainsKey("Username")) userEntry.Text = Application.Current.Properties["Username"].ToString(); if (Application.Current.Properties.ContainsKey("Username")) userEntry.Text = Application.Current.Properties["Username"].ToString();
if (Application.Current.Properties.ContainsKey("Password")) passwordEntry.Text = Application.Current.Properties["Password"].ToString(); if (Application.Current.Properties.ContainsKey("Password")) passwordEntry.Text = Application.Current.Properties["Password"].ToString();
} }
async void OnLoginButtonClicked(object sender, EventArgs e) async void OnLoginButtonClicked(object sender, EventArgs e)
...@@ -33,12 +26,9 @@ namespace inutralia.Views ...@@ -33,12 +26,9 @@ namespace inutralia.Views
Application.Current.Properties["Username"] = userEntry.Text; Application.Current.Properties["Username"] = userEntry.Text;
Application.Current.Properties["Password"] = passwordEntry.Text; Application.Current.Properties["Password"] = passwordEntry.Text;
var Username = userEntry.Text; var Username = userEntry.Text;
var Password = passwordEntry.Text; var Password = passwordEntry.Text;
//passwordEntry.Text = string.Empty;
App.API.CredentialsSet(Username, Password); App.API.CredentialsSet(Username, Password);
try try
...@@ -54,11 +44,13 @@ namespace inutralia.Views ...@@ -54,11 +44,13 @@ namespace inutralia.Views
// Cambiar de vista // Cambiar de vista
Application.Current.MainPage = nextView; Application.Current.MainPage = nextView;
} }
else else
{ {
throw new Exception(); throw new Exception();
} }
} }
catch (Exception err) catch (Exception err)
{ {
await DisplayAlert("Error", "El usuario o la contraseña no son correctos", "Entendido"); await DisplayAlert("Error", "El usuario o la contraseña no son correctos", "Entendido");
...@@ -71,14 +63,5 @@ namespace inutralia.Views ...@@ -71,14 +63,5 @@ namespace inutralia.Views
{ {
base.OnDisappearing(); base.OnDisappearing();
} }
//async void OnRegisterButtonClicked(object sender, EventArgs e)
//{
// Page nextView = new RegisterView() as Page;
// // Cambiar de vista
// await Navigation.PushModalAsync (nextView);
//}
} }
} }
...@@ -7,34 +7,40 @@ ...@@ -7,34 +7,40 @@
Padding="0,40,0,0" Padding="0,40,0,0"
Title="Inutralia"> Title="Inutralia">
<ContentPage.Content> <ContentPage.Content>
<StackLayout VerticalOptions="FillAndExpand" BackgroundColor="{DynamicResource CorporativeColor}"> <StackLayout VerticalOptions="FillAndExpand" BackgroundColor="{DynamicResource CorporativeColor}">
<Image Source="logo_empresa.png" WidthRequest="100" HorizontalOptions="Center"/> <Image Source="logo_empresa.png" WidthRequest="100" HorizontalOptions="Center"/>
<StackLayout> <StackLayout>
<Label /> <Label />
<BoxView HeightRequest="1" BackgroundColor="Black" HorizontalOptions="FillAndExpand" /> <BoxView HeightRequest="1" BackgroundColor="Black" HorizontalOptions="FillAndExpand" />
</StackLayout> </StackLayout>
<StackLayout VerticalOptions="FillAndExpand" BackgroundColor="{DynamicResource CorporativeColor}"> <StackLayout VerticalOptions="FillAndExpand" BackgroundColor="{DynamicResource CorporativeColor}">
<StackLayout x:Name="btnHome" Orientation="Horizontal" Padding="10,0,0,0" Spacing="25" > <StackLayout x:Name="btnHome" Orientation="Horizontal" Padding="10,0,0,0" Spacing="25" >
<Label Text="{ x:Static local:IoniciconsFont.IosHomeOutline }" FontSize="40" Style="{StaticResource FontIcon}" HorizontalOptions="Center" VerticalOptions="Center" TextColor="{ DynamicResource ListViewItemTextColor }"/> <Label Text="{ x:Static local:IoniciconsFont.IosHomeOutline }" FontSize="40" Style="{StaticResource FontIcon}" HorizontalOptions="Center" VerticalOptions="Center" TextColor="{ DynamicResource ListViewItemTextColor }"/>
<Label FontSize="Medium" Text="Inicio" TextColor="{ DynamicResource ListViewItemTextColor }" VerticalTextAlignment="Center" /> <Label FontSize="Medium" Text="Inicio" TextColor="{ DynamicResource ListViewItemTextColor }" VerticalTextAlignment="Center" />
</StackLayout> </StackLayout>
<StackLayout> <StackLayout>
<BoxView HeightRequest="1" BackgroundColor="{ DynamicResource ListViewItemTextColor }" HorizontalOptions="FillAndExpand" /> <BoxView HeightRequest="1" BackgroundColor="{ DynamicResource ListViewItemTextColor }" HorizontalOptions="FillAndExpand" />
</StackLayout> </StackLayout>
<StackLayout x:Name="btnMyProfile" Orientation="Horizontal" Padding="10,0,0,0" Spacing="25" > <StackLayout x:Name="btnMyProfile" Orientation="Horizontal" Padding="10,0,0,0" Spacing="25" >
<Label Text="{ x:Static local:IoniciconsFont.IosContactOutline }" FontSize="40" Style="{StaticResource FontIcon}" HorizontalOptions="Center" VerticalOptions="Center" TextColor="{ DynamicResource ListViewItemTextColor }" /> <Label Text="{ x:Static local:IoniciconsFont.IosContactOutline }" FontSize="40" Style="{StaticResource FontIcon}" HorizontalOptions="Center" VerticalOptions="Center" TextColor="{ DynamicResource ListViewItemTextColor }" />
<Label FontSize="Medium" Text="Mi Perfil" TextColor="{ DynamicResource ListViewItemTextColor }" VerticalTextAlignment="Center" /> <Label FontSize="Medium" Text="Mi Perfil" TextColor="{ DynamicResource ListViewItemTextColor }" VerticalTextAlignment="Center" />
</StackLayout> </StackLayout>
<StackLayout x:Name="btnMyMenu" Orientation="Horizontal" Padding="10,0,0,0" Spacing="25" > <StackLayout x:Name="btnMyMenu" Orientation="Horizontal" Padding="10,0,0,0" Spacing="25" >
<Label Text="{ x:Static local:IoniciconsFont.Clipboard }" FontSize="40" Style="{StaticResource FontIcon}" HorizontalOptions="Center" VerticalOptions="Center" TextColor="{ DynamicResource ListViewItemTextColor }" /> <Label Text="{ x:Static local:IoniciconsFont.Clipboard }" FontSize="40" Style="{StaticResource FontIcon}" HorizontalOptions="Center" VerticalOptions="Center" TextColor="{ DynamicResource ListViewItemTextColor }" />
<Label FontSize="Medium" Text="Mi Menú" TextColor="{ DynamicResource ListViewItemTextColor }" VerticalTextAlignment="Center" /> <Label FontSize="Medium" Text="Mi Menú" TextColor="{ DynamicResource ListViewItemTextColor }" VerticalTextAlignment="Center" />
</StackLayout> </StackLayout>
<StackLayout x:Name="btnShoppingList" Orientation="Horizontal" Padding="10,0,0,0" Spacing="25" > <StackLayout x:Name="btnShoppingList" Orientation="Horizontal" Padding="10,0,0,0" Spacing="25" >
<Label Text="{ x:Static local:IoniciconsFont.IosCartOutline }" FontSize="40" Style="{StaticResource FontIcon}" HorizontalOptions="Center" VerticalOptions="Center" TextColor="{ DynamicResource ListViewItemTextColor }" /> <Label Text="{ x:Static local:IoniciconsFont.IosCartOutline }" FontSize="40" Style="{StaticResource FontIcon}" HorizontalOptions="Center" VerticalOptions="Center" TextColor="{ DynamicResource ListViewItemTextColor }" />
<Label FontSize="Medium" Text="Lista de la Compra" TextColor="{ DynamicResource ListViewItemTextColor }" VerticalTextAlignment="Center" /> <Label FontSize="Medium" Text="Lista de la Compra" TextColor="{ DynamicResource ListViewItemTextColor }" VerticalTextAlignment="Center" />
</StackLayout> </StackLayout>
<StackLayout> <StackLayout>
<BoxView HeightRequest="1" BackgroundColor="{ DynamicResource ListViewItemTextColor }" HorizontalOptions="FillAndExpand" /> <BoxView HeightRequest="1" BackgroundColor="{ DynamicResource ListViewItemTextColor }" HorizontalOptions="FillAndExpand" />
</StackLayout> </StackLayout>
...@@ -43,22 +49,24 @@ ...@@ -43,22 +49,24 @@
<Label Text="{ x:Static local:IoniciconsFont.IosPaperOutline }" FontSize="40" Style="{StaticResource FontIcon}" HorizontalOptions="Center" VerticalOptions="Center" TextColor="{ DynamicResource ListViewItemTextColor }" /> <Label Text="{ x:Static local:IoniciconsFont.IosPaperOutline }" FontSize="40" Style="{StaticResource FontIcon}" HorizontalOptions="Center" VerticalOptions="Center" TextColor="{ DynamicResource ListViewItemTextColor }" />
<Label FontSize="Medium" Text="Menús Saludables" TextColor="{ DynamicResource ListViewItemTextColor }" VerticalTextAlignment="Center" /> <Label FontSize="Medium" Text="Menús Saludables" TextColor="{ DynamicResource ListViewItemTextColor }" VerticalTextAlignment="Center" />
</StackLayout> </StackLayout>
<StackLayout> <StackLayout>
<BoxView HeightRequest="1" BackgroundColor="{ DynamicResource ListViewItemTextColor }" HorizontalOptions="FillAndExpand" /> <BoxView HeightRequest="1" BackgroundColor="{ DynamicResource ListViewItemTextColor }" HorizontalOptions="FillAndExpand" />
</StackLayout> </StackLayout>
<StackLayout x:Name="btnRecipeBook" Orientation="Horizontal" Padding="10,0,0,0" Spacing="25" > <StackLayout x:Name="btnRecipeBook" Orientation="Horizontal" Padding="10,0,0,0" Spacing="25" >
<Label Text="{ x:Static local:IoniciconsFont.IosBookmarksOutline }" FontSize="40" Style="{StaticResource FontIcon}" HorizontalOptions="Center" VerticalOptions="Center" TextColor="{ DynamicResource ListViewItemTextColor }" /> <Label Text="{ x:Static local:IoniciconsFont.IosBookmarksOutline }" FontSize="40" Style="{StaticResource FontIcon}" HorizontalOptions="Center" VerticalOptions="Center" TextColor="{ DynamicResource ListViewItemTextColor }" />
<Label FontSize="Medium" Text="Recetario" TextColor="{ DynamicResource ListViewItemTextColor }" VerticalTextAlignment="Center" /> <Label FontSize="Medium" Text="Recetario" TextColor="{ DynamicResource ListViewItemTextColor }" VerticalTextAlignment="Center" />
</StackLayout> </StackLayout>
<StackLayout> <StackLayout>
<BoxView HeightRequest="1" BackgroundColor="{ DynamicResource ListViewItemTextColor }" HorizontalOptions="FillAndExpand" /> <BoxView HeightRequest="1" BackgroundColor="{ DynamicResource ListViewItemTextColor }" HorizontalOptions="FillAndExpand" />
</StackLayout> </StackLayout>
<StackLayout x:Name="btnLoginOut" Orientation="Horizontal" Padding="10,0,0,0" Spacing="25" > <StackLayout x:Name="btnLoginOut" Orientation="Horizontal" Padding="10,0,0,0" Spacing="25" >
<Label Text="{ x:Static local:IoniciconsFont.LogOut }" FontSize="40" Style="{StaticResource FontIcon}" HorizontalOptions="Center" VerticalOptions="Center" TextColor="{ DynamicResource ListViewItemTextColor }" /> <Label Text="{ x:Static local:IoniciconsFont.LogOut }" FontSize="40" Style="{StaticResource FontIcon}" HorizontalOptions="Center" VerticalOptions="Center" TextColor="{ DynamicResource ListViewItemTextColor }" />
<Label FontSize="Medium" Text="Salir" TextColor="{ DynamicResource ListViewItemTextColor }" VerticalTextAlignment="Center" /> <Label FontSize="Medium" Text="Salir" TextColor="{ DynamicResource ListViewItemTextColor }" VerticalTextAlignment="Center" />
</StackLayout> </StackLayout>
<!--<ButtonText="Inicio" Clicked="onBtnHomeClicked"/>-->
</StackLayout> </StackLayout>
</StackLayout> </StackLayout>
</ContentPage.Content> </ContentPage.Content>
......
using inutralia.Views; using Xamarin.Forms;
using System;
using System.Collections.Generic;
using Xamarin.Forms;
namespace inutralia.Views namespace inutralia.Views
{ {
...@@ -11,69 +7,76 @@ namespace inutralia.Views ...@@ -11,69 +7,76 @@ namespace inutralia.Views
public MenuView() public MenuView()
{ {
InitializeComponent(); InitializeComponent();
btnHome.GestureRecognizers.Add(new TapGestureRecognizer btnHome.GestureRecognizers.Add(new TapGestureRecognizer
{ {
Command = new Command(() => onBtnHomeClicked()) Command = new Command(() => OnBtnHomeClicked())
}); });
btnLoginOut .GestureRecognizers.Add(new TapGestureRecognizer btnLoginOut.GestureRecognizers.Add(new TapGestureRecognizer
{ {
Command = new Command(() => onLoginOutClicked()) Command = new Command(() => OnLoginOutClicked())
});; }); ;
btnMyMenu .GestureRecognizers.Add(new TapGestureRecognizer
btnMyMenu.GestureRecognizers.Add(new TapGestureRecognizer
{ {
Command = new Command(() => onBtnMyMenuClicked()) Command = new Command(() => OnBtnMyMenuClicked())
});; }); ;
btnMyProfile .GestureRecognizers.Add(new TapGestureRecognizer
btnMyProfile.GestureRecognizers.Add(new TapGestureRecognizer
{ {
Command = new Command(() => onBtnMyProfileClicked()) Command = new Command(() => OnBtnMyProfileClicked())
});; }); ;
btnRecipeBook .GestureRecognizers.Add(new TapGestureRecognizer
btnRecipeBook.GestureRecognizers.Add(new TapGestureRecognizer
{ {
Command = new Command(() => onBtnRecipeBookClicked()) Command = new Command(() => OnBtnRecipeBookClicked())
});; }); ;
btnShoppingList.GestureRecognizers.Add(new TapGestureRecognizer btnShoppingList.GestureRecognizers.Add(new TapGestureRecognizer
{ {
Command = new Command(() => onBtnShoppingListClicked()) Command = new Command(() => OnBtnShoppingListClicked())
}); ; }); ;
btnGenericMenus.GestureRecognizers.Add(new TapGestureRecognizer btnGenericMenus.GestureRecognizers.Add(new TapGestureRecognizer
{ {
Command = new Command(() => onBtnGenericMenusClicked()) Command = new Command(() => OnBtnGenericMenusClicked())
}); ; }); ;
} }
void onBtnHomeClicked() void OnBtnHomeClicked()
{ {
//await (App.Current.MainPage as MasterDetailPage).Detail.Navigation.PopToRootAsync();
(App.Current.MainPage as RootPage).Navigate<HomeView>(); (App.Current.MainPage as RootPage).Navigate<HomeView>();
} }
void onBtnMyMenuClicked() void OnBtnMyMenuClicked()
{ {
(App.Current.MainPage as RootPage).Navigate<CustomMenuView>(); (App.Current.MainPage as RootPage).Navigate<CustomMenuView>();
} }
void onBtnMyProfileClicked()
void OnBtnMyProfileClicked()
{ {
(App.Current.MainPage as RootPage).Navigate<ProfileView>(); (App.Current.MainPage as RootPage).Navigate<ProfileView>();
} }
void onBtnRecipeBookClicked()
void OnBtnRecipeBookClicked()
{ {
(App.Current.MainPage as RootPage).Navigate<RecipeListView>(); (App.Current.MainPage as RootPage).Navigate<RecipeListView>();
} }
void onBtnGenericMenusClicked() void OnBtnGenericMenusClicked()
{ {
(App.Current.MainPage as RootPage).Navigate<GenericListView>(); (App.Current.MainPage as RootPage).Navigate<GenericListView>();
} }
void onBtnShoppingListClicked()
void OnBtnShoppingListClicked()
{ {
(App.Current.MainPage as RootPage).Navigate<ShoppingListView>(); (App.Current.MainPage as RootPage).Navigate<ShoppingListView>();
} }
void onLoginOutClicked()
void OnLoginOutClicked()
{ {
App.IsUserLoggedIn = false; App.IsUserLoggedIn = false;
} }
} }
} }
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:inutralia.Views;assembly=inutralia" xmlns:local="clr-namespace:inutralia.Views;assembly=inutralia"
xmlns:views="clr-namespace:inutralia.Views;assembly=inutralia" xmlns:views="clr-namespace:inutralia.Views;assembly=inutralia"
x:Class="inutralia.Views.RootPage"> x:Class="inutralia.Views.RootPage">
<MasterDetailPage.Master> <MasterDetailPage.Master>
<local:MenuView x:Name="MenuView" /> <local:MenuView x:Name="MenuView" />
</MasterDetailPage.Master> </MasterDetailPage.Master>
...@@ -16,5 +16,4 @@ ...@@ -16,5 +16,4 @@
</x:Arguments> </x:Arguments>
</NavigationPage> </NavigationPage>
</MasterDetailPage.Detail> </MasterDetailPage.Detail>
</MasterDetailPage> </MasterDetailPage>
using System; using System;
using System.Collections.Generic;
using Xamarin.Forms; using Xamarin.Forms;
namespace inutralia.Views namespace inutralia.Views
...@@ -12,10 +10,10 @@ namespace inutralia.Views ...@@ -12,10 +10,10 @@ namespace inutralia.Views
InitializeComponent(); InitializeComponent();
} }
public void Navigate<T>() where T:ContentPage public void Navigate<T>() where T : ContentPage
{ {
NavigationPage p = Detail as NavigationPage; NavigationPage p = Detail as NavigationPage;
if(p?.Navigation?.NavigationStack?[0]?.GetType() != typeof(T) ) if (p?.Navigation?.NavigationStack?[0]?.GetType() != typeof(T))
Detail = new NavigationPage(Activator.CreateInstance(typeof(T)) as Page); Detail = new NavigationPage(Activator.CreateInstance(typeof(T)) as Page);
IsPresented = false; IsPresented = false;
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ContentPage <ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="inutralia.WelcomeStarterPage" x:Class="inutralia.WelcomeStarterPage"
xmlns:artina="clr-namespace:UXDivers.Artina.Shared;assembly=UXDivers.Artina.Shared"
xmlns:local="clr-namespace:inutralia;assembly=inutralia" xmlns:local="clr-namespace:inutralia;assembly=inutralia"
Title="Welcome Starter" Title="Welcome Starter"
BackgroundColor="{DynamicResource BasePageColor}"> BackgroundColor="{DynamicResource BasePageColor}">
<ContentPage.Content> <ContentPage.Content>
<!-- MAIN WRAPPER --> <!-- MAIN WRAPPER -->
<Grid> <Grid>
...@@ -15,19 +14,17 @@ ...@@ -15,19 +14,17 @@
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid <Grid Grid.Row="0"
Grid.Row="0"
VerticalOptions="Center" VerticalOptions="Center"
HorizontalOptions="Center"> HorizontalOptions="Center">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="60*"/> <RowDefinition Height="60*"/>
<RowDefinition Height="40*"/> <RowDefinition Height="40*"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<!--ICON BACKGROUND--> <!--ICON BACKGROUND-->
<Label <Label Grid.Row="0"
Grid.Row="0"
Style="{StaticResource RoundShape}" Style="{StaticResource RoundShape}"
TextColor="{DynamicResource ComplementColor}" TextColor="{DynamicResource ComplementColor}"
VerticalOptions="Center" VerticalOptions="Center"
...@@ -36,8 +33,7 @@ ...@@ -36,8 +33,7 @@
Opacity="0.1"/> Opacity="0.1"/>
<!--ICON BACKGROUND--> <!--ICON BACKGROUND-->
<Label <Label Grid.Row="0"
Grid.Row="0"
Style="{StaticResource RoundShape}" Style="{StaticResource RoundShape}"
TextColor="{DynamicResource ComplementColor}" TextColor="{DynamicResource ComplementColor}"
VerticalOptions="Center" VerticalOptions="Center"
...@@ -46,8 +42,7 @@ ...@@ -46,8 +42,7 @@
Opacity="0.1"/> Opacity="0.1"/>
<!--ICON--> <!--ICON-->
<Label <Label Grid.Row="0"
Grid.Row="0"
Text="{ x:Static local:GrialShapesFont.Whatshot }" Text="{ x:Static local:GrialShapesFont.Whatshot }"
Style="{StaticResource FontIconBase}" Style="{StaticResource FontIconBase}"
FontSize="100" FontSize="100"
...@@ -56,30 +51,25 @@ ...@@ -56,30 +51,25 @@
VerticalOptions="Center" VerticalOptions="Center"
HorizontalOptions="Center"/> HorizontalOptions="Center"/>
<!--TEXT --> <!--TEXT -->
<StackLayout <StackLayout Grid.Row="1"
Grid.Row="1"
VerticalOptions="Center" VerticalOptions="Center"
Padding="60,0" Padding="60,0"
Spacing="2"> Spacing="2">
<Label
HorizontalTextAlignment="Center" <Label HorizontalTextAlignment="Center"
Text="Welcome to Grial.Starter" Text="Welcome to Grial.Starter"
FontSize="24" FontSize="24"
FontAttributes="Bold" FontAttributes="Bold"
TextColor="{ DynamicResource BaseTextColor }"/> TextColor="{ DynamicResource BaseTextColor }"/>
<Label
HorizontalTextAlignment="Center" <Label HorizontalTextAlignment="Center"
Opacity="0.8" Opacity="0.8"
Text="Welcome to Grial 2.0 Starter. You are all setup and ready to rock!" Text="Welcome to Grial 2.0 Starter. You are all setup and ready to rock!"
FontSize="16" FontSize="16"
TextColor="{ DynamicResource BaseTextColor }"/> TextColor="{ DynamicResource BaseTextColor }"/>
</StackLayout> </StackLayout>
</Grid> </Grid>
</Grid> </Grid>
</ContentPage.Content> </ContentPage.Content>
</ContentPage> </ContentPage>
using System;
using System.Collections.Generic;
using Xamarin.Forms; using Xamarin.Forms;
namespace inutralia namespace inutralia
......
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" <ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:app="clr-namespace:inutralia;assembly=inutralia"
xmlns:artina="clr-namespace:UXDivers.Artina.Shared;assembly=UXDivers.Artina.Shared" xmlns:artina="clr-namespace:UXDivers.Artina.Shared;assembly=UXDivers.Artina.Shared"
x:Class="inutralia.Views.ProfileView" x:Class="inutralia.Views.ProfileView"
x:Name="profileView" x:Name="profileView"
...@@ -117,6 +115,7 @@ ...@@ -117,6 +115,7 @@
</OnIdiom> </OnIdiom>
</Label.FontSize> </Label.FontSize>
</Label> </Label>
<Entry VerticalOptions="CenterAndExpand" HorizontalOptions="FillAndExpand" x:Name = "weightEntry" Text="{Binding Profile.Weight}" Placeholder="Kg."> <Entry VerticalOptions="CenterAndExpand" HorizontalOptions="FillAndExpand" x:Name = "weightEntry" Text="{Binding Profile.Weight}" Placeholder="Kg.">
<Entry.FontSize> <Entry.FontSize>
<OnIdiom x:TypeArguments="x:Double"> <OnIdiom x:TypeArguments="x:Double">
...@@ -170,6 +169,7 @@ ...@@ -170,6 +169,7 @@
</OnIdiom> </OnIdiom>
</Label.FontSize> </Label.FontSize>
</Label> </Label>
<Entry VerticalOptions="CenterAndExpand" HorizontalOptions="FillAndExpand" x:Name = "heightEntry" Text="{Binding Profile.Height}" Placeholder="cm."> <Entry VerticalOptions="CenterAndExpand" HorizontalOptions="FillAndExpand" x:Name = "heightEntry" Text="{Binding Profile.Height}" Placeholder="cm.">
<Entry.FontSize> <Entry.FontSize>
<OnIdiom x:TypeArguments="x:Double"> <OnIdiom x:TypeArguments="x:Double">
...@@ -223,11 +223,13 @@ ...@@ -223,11 +223,13 @@
</OnIdiom> </OnIdiom>
</Label.FontSize> </Label.FontSize>
</Label> </Label>
<Picker x:Name="genderPicker" HorizontalOptions="FillAndExpand" VerticalOptions="CenterAndExpand" SelectedIndex="{Binding Gender}" > <Picker x:Name="genderPicker" HorizontalOptions="FillAndExpand" VerticalOptions="CenterAndExpand" SelectedIndex="{Binding Gender}" >
<Picker.Items> <Picker.Items>
<x:String>Hombre</x:String> <x:String>Hombre</x:String>
<x:String>Mujer</x:String> <x:String>Mujer</x:String>
</Picker.Items> </Picker.Items>
<Picker.SelectedIndex>0</Picker.SelectedIndex> <Picker.SelectedIndex>0</Picker.SelectedIndex>
</Picker> </Picker>
</StackLayout> </StackLayout>
...@@ -266,6 +268,7 @@ ...@@ -266,6 +268,7 @@
</OnIdiom> </OnIdiom>
</Label.FontSize> </Label.FontSize>
</Label> </Label>
<Picker x:Name="fisExerPicker" HorizontalOptions="FillAndExpand" VerticalOptions="CenterAndExpand" SelectedIndex="{Binding Physical}" > <Picker x:Name="fisExerPicker" HorizontalOptions="FillAndExpand" VerticalOptions="CenterAndExpand" SelectedIndex="{Binding Physical}" >
<Picker.Items> <Picker.Items>
<x:String>Sedentario</x:String> <x:String>Sedentario</x:String>
...@@ -274,6 +277,7 @@ ...@@ -274,6 +277,7 @@
<x:String>Intenso</x:String> <x:String>Intenso</x:String>
<x:String>Muy Intenso</x:String> <x:String>Muy Intenso</x:String>
</Picker.Items> </Picker.Items>
<Picker.SelectedIndex>0</Picker.SelectedIndex> <Picker.SelectedIndex>0</Picker.SelectedIndex>
</Picker> </Picker>
</StackLayout> </StackLayout>
...@@ -312,12 +316,14 @@ ...@@ -312,12 +316,14 @@
</OnIdiom> </OnIdiom>
</Label.FontSize> </Label.FontSize>
</Label> </Label>
<Picker x:Name="preferencePicker" HorizontalOptions="FillAndExpand" VerticalOptions="CenterAndExpand" SelectedIndex="{Binding Preference}"> <Picker x:Name="preferencePicker" HorizontalOptions="FillAndExpand" VerticalOptions="CenterAndExpand" SelectedIndex="{Binding Preference}">
<Picker.Items> <Picker.Items>
<x:String>Normal</x:String> <x:String>Normal</x:String>
<x:String>Vegetariano</x:String> <x:String>Vegetariano</x:String>
<x:String>Vegano</x:String> <x:String>Vegano</x:String>
</Picker.Items> </Picker.Items>
<Picker.SelectedIndex>0</Picker.SelectedIndex> <Picker.SelectedIndex>0</Picker.SelectedIndex>
</Picker> </Picker>
</StackLayout> </StackLayout>
...@@ -378,6 +384,7 @@ ...@@ -378,6 +384,7 @@
<StackLayout Grid.Row="1" Orientation="Horizontal" Padding="0,20,0,0"> <StackLayout Grid.Row="1" Orientation="Horizontal" Padding="0,20,0,0">
<Switch IsToggled="{Binding Profile.Cv}" /> <Switch IsToggled="{Binding Profile.Cv}" />
<Label Text=" ... una enfermedad cardiovascular ?"> <Label Text=" ... una enfermedad cardiovascular ?">
<Label.FontSize> <Label.FontSize>
<OnIdiom x:TypeArguments="x:Double"> <OnIdiom x:TypeArguments="x:Double">
...@@ -399,6 +406,7 @@ ...@@ -399,6 +406,7 @@
<StackLayout Grid.Row="2" Orientation="Horizontal" > <StackLayout Grid.Row="2" Orientation="Horizontal" >
<Switch IsToggled="{Binding Profile.Hypertension}"/> <Switch IsToggled="{Binding Profile.Hypertension}"/>
<Label Text=" ... hipertensión ?"> <Label Text=" ... hipertensión ?">
<Label.FontSize> <Label.FontSize>
<OnIdiom x:TypeArguments="x:Double"> <OnIdiom x:TypeArguments="x:Double">
...@@ -420,6 +428,7 @@ ...@@ -420,6 +428,7 @@
<StackLayout Grid.Row="3" Orientation="Horizontal" > <StackLayout Grid.Row="3" Orientation="Horizontal" >
<Switch IsToggled="{Binding Profile.Menopause}" /> <Switch IsToggled="{Binding Profile.Menopause}" />
<Label Text=" ... menopausia ?"> <Label Text=" ... menopausia ?">
<Label.FontSize> <Label.FontSize>
<OnIdiom x:TypeArguments="x:Double"> <OnIdiom x:TypeArguments="x:Double">
...@@ -441,6 +450,7 @@ ...@@ -441,6 +450,7 @@
<StackLayout Grid.Row="4" Orientation="Horizontal"> <StackLayout Grid.Row="4" Orientation="Horizontal">
<Switch IsToggled="{Binding Profile.Pregnancy}"/> <Switch IsToggled="{Binding Profile.Pregnancy}"/>
<Label Text=" ... embarazo ?"> <Label Text=" ... embarazo ?">
<Label.FontSize> <Label.FontSize>
<OnIdiom x:TypeArguments="x:Double"> <OnIdiom x:TypeArguments="x:Double">
...@@ -462,6 +472,7 @@ ...@@ -462,6 +472,7 @@
<StackLayout Grid.Row="5" Orientation="Horizontal" > <StackLayout Grid.Row="5" Orientation="Horizontal" >
<Switch IsToggled="{Binding Profile.Lactation}"/> <Switch IsToggled="{Binding Profile.Lactation}"/>
<Label Text=" ... lactancia ?"> <Label Text=" ... lactancia ?">
<Label.FontSize> <Label.FontSize>
<OnIdiom x:TypeArguments="x:Double"> <OnIdiom x:TypeArguments="x:Double">
...@@ -483,6 +494,7 @@ ...@@ -483,6 +494,7 @@
<StackLayout Grid.Row="6" Orientation="Horizontal" > <StackLayout Grid.Row="6" Orientation="Horizontal" >
<Switch IsToggled="{Binding Profile.Celiac}"/> <Switch IsToggled="{Binding Profile.Celiac}"/>
<Label Text=" ... celiaco ?"> <Label Text=" ... celiaco ?">
<Label.FontSize> <Label.FontSize>
<OnIdiom x:TypeArguments="x:Double"> <OnIdiom x:TypeArguments="x:Double">
...@@ -504,6 +516,7 @@ ...@@ -504,6 +516,7 @@
<StackLayout Grid.Row="7" Orientation="Horizontal" > <StackLayout Grid.Row="7" Orientation="Horizontal" >
<Switch IsToggled="{Binding Profile.Lactose}"/> <Switch IsToggled="{Binding Profile.Lactose}"/>
<Label Text=" ... intoleracia a la lactosa ?"> <Label Text=" ... intoleracia a la lactosa ?">
<Label.FontSize> <Label.FontSize>
<OnIdiom x:TypeArguments="x:Double"> <OnIdiom x:TypeArguments="x:Double">
...@@ -525,6 +538,7 @@ ...@@ -525,6 +538,7 @@
<StackLayout Grid.Row="8" Orientation="Horizontal" > <StackLayout Grid.Row="8" Orientation="Horizontal" >
<Switch IsToggled="{Binding Profile.Diabetes}"/> <Switch IsToggled="{Binding Profile.Diabetes}"/>
<Label Text=" ... diabetes ?" > <Label Text=" ... diabetes ?" >
<Label.FontSize> <Label.FontSize>
<OnIdiom x:TypeArguments="x:Double"> <OnIdiom x:TypeArguments="x:Double">
...@@ -546,6 +560,7 @@ ...@@ -546,6 +560,7 @@
<StackLayout Grid.Row="9" Orientation="Horizontal" > <StackLayout Grid.Row="9" Orientation="Horizontal" >
<Switch IsToggled="{Binding Profile.Cholesterol}"/> <Switch IsToggled="{Binding Profile.Cholesterol}"/>
<Label Text=" ... colesterol ?"> <Label Text=" ... colesterol ?">
<Label.FontSize> <Label.FontSize>
<OnIdiom x:TypeArguments="x:Double"> <OnIdiom x:TypeArguments="x:Double">
...@@ -567,6 +582,7 @@ ...@@ -567,6 +582,7 @@
<StackLayout Grid.Row="10" Orientation="Horizontal"> <StackLayout Grid.Row="10" Orientation="Horizontal">
<Switch IsToggled="{Binding Profile.Triglycerides}"/> <Switch IsToggled="{Binding Profile.Triglycerides}"/>
<Label Text=" ... trigliceridos ?"> <Label Text=" ... trigliceridos ?">
<Label.FontSize> <Label.FontSize>
<OnIdiom x:TypeArguments="x:Double"> <OnIdiom x:TypeArguments="x:Double">
...@@ -588,6 +604,7 @@ ...@@ -588,6 +604,7 @@
<StackLayout Grid.Row="11" Orientation="Horizontal"> <StackLayout Grid.Row="11" Orientation="Horizontal">
<Switch IsToggled="{Binding Profile.Al_fish}"/> <Switch IsToggled="{Binding Profile.Al_fish}"/>
<Label Text=" ... alergia al pescado/marisco ?"> <Label Text=" ... alergia al pescado/marisco ?">
<Label.FontSize> <Label.FontSize>
<OnIdiom x:TypeArguments="x:Double"> <OnIdiom x:TypeArguments="x:Double">
...@@ -609,6 +626,7 @@ ...@@ -609,6 +626,7 @@
<StackLayout Grid.Row="12" Orientation="Horizontal"> <StackLayout Grid.Row="12" Orientation="Horizontal">
<Switch IsToggled="{Binding Profile.Al_egg}"/> <Switch IsToggled="{Binding Profile.Al_egg}"/>
<Label Text=" ... alergia al huevo ?"> <Label Text=" ... alergia al huevo ?">
<Label.FontSize> <Label.FontSize>
<OnIdiom x:TypeArguments="x:Double"> <OnIdiom x:TypeArguments="x:Double">
...@@ -630,6 +648,7 @@ ...@@ -630,6 +648,7 @@
<StackLayout Grid.Row="13" Orientation="Horizontal"> <StackLayout Grid.Row="13" Orientation="Horizontal">
<Switch IsToggled="{Binding Profile.Al_nuts}"/> <Switch IsToggled="{Binding Profile.Al_nuts}"/>
<Label Text=" ... alergia a los frutos secos ?"> <Label Text=" ... alergia a los frutos secos ?">
<Label.FontSize> <Label.FontSize>
<OnIdiom x:TypeArguments="x:Double"> <OnIdiom x:TypeArguments="x:Double">
......
using System; using System;
using System.Collections.Generic;
using inutralia.ViewModels; using inutralia.ViewModels;
using Xamarin.Forms; using Xamarin.Forms;
namespace inutralia.Views namespace inutralia.Views
...@@ -13,7 +11,6 @@ namespace inutralia.Views ...@@ -13,7 +11,6 @@ namespace inutralia.Views
public ProfileView() public ProfileView()
{ {
InitializeComponent(); InitializeComponent();
BindingContext = new ProfileViewModel(); BindingContext = new ProfileViewModel();
} }
...@@ -22,13 +19,10 @@ namespace inutralia.Views ...@@ -22,13 +19,10 @@ namespace inutralia.Views
try try
{ {
await ViewModel.RefreshData(); await ViewModel.RefreshData();
base.OnAppearing(); base.OnAppearing();
} }
catch(Exception e)
{
} catch (Exception e) { }
} }
async void OnSaveButtonClicked(object sender, EventArgs e) async void OnSaveButtonClicked(object sender, EventArgs e)
...@@ -41,6 +35,7 @@ namespace inutralia.Views ...@@ -41,6 +35,7 @@ namespace inutralia.Views
(App.Current.MainPage as RootPage).Navigate<HomeView>(); (App.Current.MainPage as RootPage).Navigate<HomeView>();
} }
catch (Exception err) catch (Exception err)
{ {
await DisplayAlert("Error", "Se ha producido un error. Por favbor, intentelo más tarde", "Entendido"); await DisplayAlert("Error", "Se ha producido un error. Por favbor, intentelo más tarde", "Entendido");
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ContentPage <ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="inutralia.Views.RecipeDetailView" x:Class="inutralia.Views.RecipeDetailView"
xmlns:local="clr-namespace:inutralia;assembly=inutralia" xmlns:local="clr-namespace:inutralia;assembly=inutralia"
xmlns:ffimageloading="clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms" xmlns:ffimageloading="clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms"
xmlns:fftransformations="clr-namespace:FFImageLoading.Transformations;assembly=FFImageLoading.Transformations"
xmlns:artina="clr-namespace:UXDivers.Artina.Shared;assembly=UXDivers.Artina.Shared"
BackgroundColor="{ DynamicResource MainWrapperBackgroundColor }" BackgroundColor="{ DynamicResource MainWrapperBackgroundColor }"
Title="{Binding Title}"> Title="{Binding Title}">
<StackLayout> <StackLayout>
<ScrollView <ScrollView x:Name="outerScrollView">
x:Name="outerScrollView">
<Grid x:Name="layeringGrid" RowSpacing="0" VerticalOptions="FillAndExpand" > <Grid x:Name="layeringGrid" RowSpacing="0" VerticalOptions="FillAndExpand" >
...@@ -30,8 +26,8 @@ ...@@ -30,8 +26,8 @@
BackgroundColor="Black"> BackgroundColor="Black">
<!-- MAIN IMAGE --> <!-- MAIN IMAGE -->
<ffimageloading:CachedImage
x:Name="img" <ffimageloading:CachedImage x:Name="img"
Source="{ Binding Recipe.Image }" Source="{ Binding Recipe.Image }"
Aspect="AspectFill" Aspect="AspectFill"
BackgroundColor="Black" BackgroundColor="Black"
...@@ -43,6 +39,7 @@ ...@@ -43,6 +39,7 @@
</Grid> </Grid>
<!--GRID CUERPO DEPUES DE LA IMAGEN --> <!--GRID CUERPO DEPUES DE LA IMAGEN -->
<Grid Grid.Row="1" BackgroundColor="{ DynamicResource BasePageColor }"> <Grid Grid.Row="1" BackgroundColor="{ DynamicResource BasePageColor }">
<Grid.RowDefinitions> <Grid.RowDefinitions>
...@@ -52,29 +49,35 @@ ...@@ -52,29 +49,35 @@
</Grid.RowDefinitions> </Grid.RowDefinitions>
<!--HEADER BACKGROUND--> <!--HEADER BACKGROUND-->
<BoxView Grid.Row="0" BackgroundColor="{ DynamicResource ArticleHeaderBackgroundColor }" /> <BoxView Grid.Row="0" BackgroundColor="{ DynamicResource ArticleHeaderBackgroundColor }" />
<StackLayout Orientation="Horizontal" Grid.Row="0" Padding="20"> <StackLayout Orientation="Horizontal" Grid.Row="0" Padding="20">
<!--HEADER INFO--> <!--HEADER INFO-->
<StackLayout Orientation="Horizontal" Grid.Row="0" HorizontalOptions="StartAndExpand"> <StackLayout Orientation="Horizontal" Grid.Row="0" HorizontalOptions="StartAndExpand">
<Label Text="{ x:Static local:IoniciconsFont.IosTimeOutline }" FontSize="Large" TextColor="{ DynamicResource BaseTextColor }" HorizontalOptions="Center" Style="{StaticResource FontIcon}"/> <Label Text="{ x:Static local:IoniciconsFont.IosTimeOutline }" FontSize="Large" TextColor="{ DynamicResource BaseTextColor }" HorizontalOptions="Center" Style="{StaticResource FontIcon}"/>
<Label Text="{ Binding Recipe.Time , StringFormat='{0:N} min' }" FontSize="Small" TextColor="{ DynamicResource BaseTextColor }" HorizontalOptions="Center"/> <Label Text="{ Binding Recipe.Time , StringFormat='{0:N} min' }" FontSize="Small" TextColor="{ DynamicResource BaseTextColor }" HorizontalOptions="Center"/>
</StackLayout> </StackLayout>
<StackLayout Orientation="Horizontal" Grid.Row="0" HorizontalOptions="EndAndExpand"> <StackLayout Orientation="Horizontal" Grid.Row="0" HorizontalOptions="EndAndExpand">
<!--DESCRIPCIÓN (FECHA)--> <!--DESCRIPCIÓN (FECHA)-->
<Label Text="{ x:Static local:IoniciconsFont.Fork }" FontSize="Large" TextColor="{ DynamicResource BaseTextColor }" HorizontalOptions="Center" Style="{StaticResource FontIcon}"/> <Label Text="{ x:Static local:IoniciconsFont.Fork }" FontSize="Large" TextColor="{ DynamicResource BaseTextColor }" HorizontalOptions="Center" Style="{StaticResource FontIcon}"/>
<Label Text="{ Binding Recipe.Difficulty, StringFormat='Dificultad : {0:N}'}" FontSize="Small" TextColor="{ DynamicResource BaseTextColor }" HorizontalOptions="Center"/> <Label Text="{ Binding Recipe.Difficulty, StringFormat='Dificultad : {0:N}'}" FontSize="Small" TextColor="{ DynamicResource BaseTextColor }" HorizontalOptions="Center"/>
</StackLayout> </StackLayout>
</StackLayout> </StackLayout>
<!-- SEPARATOR (CAJA EN LA QUE SE INCLUYEN LAS DOS VARIABLES ANTERIORES (ARTICULO Y FECHA)) --> <!-- SEPARATOR (CAJA EN LA QUE SE INCLUYEN LAS DOS VARIABLES ANTERIORES (ARTICULO Y FECHA)) -->
<BoxView Grid.Row="0" VerticalOptions="End" Style="{ StaticResource Horizontal1ptLineStyle}" /> <BoxView Grid.Row="0" VerticalOptions="End" Style="{ StaticResource Horizontal1ptLineStyle}" />
<!--************************* MAIN PARAGRAPH *************************--> <!--************************* MAIN PARAGRAPH *************************-->
<!-- TEXT (CUERPO DE LA RECETA) --> <!-- TEXT (CUERPO DE LA RECETA) -->
<Grid Grid.Row="1" Padding="20,20,20,0" VerticalOptions="Center"> <Grid Grid.Row="1" Padding="20,20,20,0" VerticalOptions="Center">
<Grid.RowDefinitions> <Grid.RowDefinitions>
...@@ -94,24 +97,18 @@ ...@@ -94,24 +97,18 @@
<!--++++++++++++++++++ FIN RESUMEN ++++++++++++++++++++++--> <!--++++++++++++++++++ FIN RESUMEN ++++++++++++++++++++++-->
<!--++++++++++++++++++ INGREDIENTES ++++++++++++++++++++++--> <!--++++++++++++++++++ INGREDIENTES ++++++++++++++++++++++-->
<!-- INGREDIENTE CABECERA --> <!-- INGREDIENTE CABECERA -->
<StackLayout Orientation="Horizontal" BackgroundColor="#FF62b9ae" Grid.Row="1" Margin="0,5" Padding="10,5,10,5">
<Label HorizontalOptions="Start"
FontSize="50"
Text="{ x:Static local:IoniciconsFont.IosNutrition }"
Style="{StaticResource FontIcon}"
TextColor="#FFFFFFFF"/>
<StackLayout Orientation="Horizontal" BackgroundColor="#FF62b9ae" Grid.Row="1" Margin="0,5" Padding="10,5,10,5">
<Label HorizontalOptions="Start" FontSize="50" Text="{ x:Static local:IoniciconsFont.IosNutrition }" Style="{StaticResource FontIcon}" TextColor="#FFFFFFFF"/>
<Label Text=" Ingredientes (4 personas)" VerticalOptions="Center" TextColor="#FFFFFFFF"/> <Label Text=" Ingredientes (4 personas)" VerticalOptions="Center" TextColor="#FFFFFFFF"/>
</StackLayout> </StackLayout>
<!--INGREDIENTE CUERPO--> <!--INGREDIENTE CUERPO-->
<ListView
SeparatorVisibility="None" <ListView SeparatorVisibility="None"
Grid.Row="2" Grid.Row="2"
ItemsSource="{Binding Recipe.Ingredients}" ItemsSource="{Binding Recipe.Ingredients}"
x:Name="listTable" x:Name="listTable"
...@@ -132,56 +129,38 @@ ...@@ -132,56 +129,38 @@
</DataTemplate> </DataTemplate>
</ListView.ItemTemplate> </ListView.ItemTemplate>
</ListView> </ListView>
<!--++++++++++++++++++FIN INGREDIENTES++++++++++++++++++++++--> <!--++++++++++++++++++FIN INGREDIENTES++++++++++++++++++++++-->
<Label/> <Label/>
<Label/> <Label/>
<!--++++++++++++++++++ PREPARACIÓN ++++++++++++++++++++++--> <!--++++++++++++++++++ PREPARACIÓN ++++++++++++++++++++++-->
<!--CABECERA-->
<StackLayout Orientation="Horizontal" BackgroundColor="#FF62b9ae" Grid.Row="3" Margin="0,5" Padding="10,5,10,5">
<Label HorizontalOptions="Start" <!--CABECERA-->
FontSize="50"
Text="{ x:Static local:IoniciconsFont.ErlenmeyerFlaskBubbles }"
Style="{StaticResource FontIcon}"
TextColor="#FFFFFFFF"/>
<StackLayout Orientation="Horizontal" BackgroundColor="#FF62b9ae" Grid.Row="3" Margin="0,5" Padding="10,5,10,5">
<Label HorizontalOptions="Start" FontSize="50" Text="{ x:Static local:IoniciconsFont.ErlenmeyerFlaskBubbles }" Style="{StaticResource FontIcon}" TextColor="#FFFFFFFF"/>
<Label Text="Preparación" VerticalOptions="Center" TextColor="#FFFFFFFF"/> <Label Text="Preparación" VerticalOptions="Center" TextColor="#FFFFFFFF"/>
</StackLayout> </StackLayout>
<!-- CUERPO --> <!-- CUERPO -->
<Label
Grid.Row="4"
Text="{ Binding Recipe.Description }"
VerticalOptions="Center"
TextColor="{ DynamicResource BaseTextColor }"/>
<!--++++++++++++++++++ FIN PREPARACIÓN ++++++++++++++++++++++--> <Label Grid.Row="4" Text="{ Binding Recipe.Description }" VerticalOptions="Center" TextColor="{ DynamicResource BaseTextColor }"/>
<!--++++++++++++++++++ FIN PREPARACIÓN ++++++++++++++++++++++-->
<!--++++++++++++++++++ TABLA INFORMACIÓN NUTRICIONAL ++++++++++++++++++++++--> <!--++++++++++++++++++ TABLA INFORMACIÓN NUTRICIONAL ++++++++++++++++++++++-->
<!-- CABECERA --> <!-- CABECERA -->
<StackLayout Orientation="Horizontal" BackgroundColor="#FF62b9ae" Grid.Row="5" Margin="0,5" Padding="10,5,10,5"> <StackLayout Orientation="Horizontal" BackgroundColor="#FF62b9ae" Grid.Row="5" Margin="0,5" Padding="10,5,10,5">
<Label HorizontalOptions="Start" FontSize="50" Text="{ x:Static local:IoniciconsFont.IosInformation }" Style="{StaticResource FontIcon}" TextColor="#FFFFFFFF"/>
<Label <Label Text="Información nutricional por ración" VerticalOptions="Center" TextColor="#FFFFFFFF"/>
HorizontalOptions="Start"
FontSize="50"
Text="{ x:Static local:IoniciconsFont.IosInformation }"
Style="{StaticResource FontIcon}"
TextColor="#FFFFFFFF"/>
<Label
Text="Información nutricional por ración"
VerticalOptions="Center"
TextColor="#FFFFFFFF"/>
</StackLayout> </StackLayout>
<!-- TABLA --> <!-- TABLA -->
<!-- INFORMATION CUERPO--> <!-- INFORMATION CUERPO-->
<Grid
HorizontalOptions="StartAndExpand" <Grid HorizontalOptions="StartAndExpand" Grid.Row="6">
Grid.Row="6">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
...@@ -191,127 +170,47 @@ ...@@ -191,127 +170,47 @@
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<!-- COLUMN 1 (ENERGÍA)--> <!-- COLUMN 1 (ENERGÍA)-->
<Label <Label Grid.Column="0" Grid.Row="0" Text="Energía" VerticalOptions="Center" TextColor="{ DynamicResource BaseTextColor }"/>
Grid.Column="0" <Label Grid.Column="1" Margin="30,0" Grid.Row="0" Text="{Binding Recipe.Energy}" VerticalOptions="Center" TextColor="{ DynamicResource BaseTextColor }"/>
Grid.Row="0"
Text="Energía"
VerticalOptions="Center"
TextColor="{ DynamicResource BaseTextColor }"/>
<Label
Grid.Column="1"
Margin="30,0"
Grid.Row="0"
Text="{Binding Recipe.Energy}"
VerticalOptions="Center"
TextColor="{ DynamicResource BaseTextColor }"/>
<!-- COLUMN 2 (PROTEINAS)--> <!-- COLUMN 2 (PROTEINAS)-->
<Label <Label Grid.Column="0" Grid.Row="1" Text="Proteinas" VerticalOptions="Center" TextColor="{ DynamicResource BaseTextColor }"/>
Grid.Column="0" <Label Grid.Column="1" Margin="30,0" Grid.Row="1" Text="{Binding Recipe.Protein}" VerticalOptions="Center" TextColor="{ DynamicResource BaseTextColor }"/>
Grid.Row="1"
Text="Proteinas"
VerticalOptions="Center"
TextColor="{ DynamicResource BaseTextColor }"/>
<Label
Grid.Column="1"
Margin="30,0"
Grid.Row="1"
Text="{Binding Recipe.Protein}"
VerticalOptions="Center"
TextColor="{ DynamicResource BaseTextColor }"/>
<!-- COLUMN 3 (HIDRATOS DE CARBONO)--> <!-- COLUMN 3 (HIDRATOS DE CARBONO)-->
<Label <Label Grid.Column="0" Grid.Row="2" Text="Hidratos de Carbono" VerticalOptions="Center" TextColor="{ DynamicResource BaseTextColor }"/>
Grid.Column="0" <Label Grid.Column="1" Grid.Row="2" Margin="30,0" Text="{Binding Recipe.Carbohydrates}" VerticalOptions="Center" TextColor="{ DynamicResource BaseTextColor }"/>
Grid.Row="2"
Text="Hidratos de Carbono"
VerticalOptions="Center"
TextColor="{ DynamicResource BaseTextColor }"/>
<Label
Grid.Column="1"
Grid.Row="2"
Margin="30,0"
Text="{Binding Recipe.Carbohydrates}"
VerticalOptions="Center"
TextColor="{ DynamicResource BaseTextColor }"/>
<!-- COLUMN 4 (LÍQUIDOS)--> <!-- COLUMN 4 (LÍQUIDOS)-->
<Label <Label Grid.Column="0" Grid.Row="3" Text="Líquidos" VerticalOptions="Center" TextColor="{ DynamicResource BaseTextColor }"/>
Grid.Column="0" <Label Grid.Column="1" Grid.Row="3" Margin="30,0" Text="{Binding Recipe.Lipids}" VerticalOptions="Center" TextColor="{ DynamicResource BaseTextColor }"/>
Grid.Row="3"
Text="Líquidos"
VerticalOptions="Center"
TextColor="{ DynamicResource BaseTextColor }"/>
<Label
Grid.Column="1"
Grid.Row="3"
Margin="30,0"
Text="{Binding Recipe.Lipids}"
VerticalOptions="Center"
TextColor="{ DynamicResource BaseTextColor }"/>
<!-- COLUMN 5 (FIBRA)--> <!-- COLUMN 5 (FIBRA)-->
<Label <Label Grid.Column="0" Grid.Row="4" Text="Fibra" VerticalOptions="Center" TextColor="{ DynamicResource BaseTextColor }"/>
Grid.Column="0" <Label Grid.Column="1" Grid.Row="4" Margin="30,0" Text="{Binding Recipe.Fiber}" VerticalOptions="Center" TextColor="{ DynamicResource BaseTextColor }"/>
Grid.Row="4"
Text="Fibra"
VerticalOptions="Center"
TextColor="{ DynamicResource BaseTextColor }"/>
<Label
Grid.Column="1"
Grid.Row="4"
Margin="30,0"
Text="{Binding Recipe.Fiber}"
VerticalOptions="Center"
TextColor="{ DynamicResource BaseTextColor }"/>
<!-- COLUMN 6 (COLESTEROL)--> <!-- COLUMN 6 (COLESTEROL)-->
<Label <Label Grid.Column="0" Grid.Row="5" Text="Colesterol" VerticalOptions="Center" TextColor="{ DynamicResource BaseTextColor }"/>
Grid.Column="0" <Label Grid.Column="1" Grid.Row="5" Margin="30,0" Text="{Binding Recipe.Cholesterol}" VerticalOptions="Center" TextColor="{ DynamicResource BaseTextColor }"/>
Grid.Row="5"
Text="Colesterol"
VerticalOptions="Center"
TextColor="{ DynamicResource BaseTextColor }"/>
<Label
Grid.Column="1"
Grid.Row="5"
Margin="30,0"
Text="{Binding Recipe.Cholesterol}"
VerticalOptions="Center"
TextColor="{ DynamicResource BaseTextColor }"/>
</Grid> </Grid>
<!--++++++++++++++++++ FIN INFORMACIÓN ++++++++++++++++++++++--> <!--++++++++++++++++++ FIN INFORMACIÓN ++++++++++++++++++++++-->
</Grid> </Grid>
</Grid> </Grid>
</Grid> </Grid>
</ScrollView> </ScrollView>
<!-- POSTED --> <!-- POSTED -->
<StackLayout <StackLayout Padding="0,0,0,5" Orientation="Horizontal" VerticalOptions="FillAndExpand" HorizontalOptions="Center">
Padding="0,0,0,5"
Orientation="Horizontal" <Label Text="Publicado por : " TextColor="{ DynamicResource AccentColor }" VerticalTextAlignment="Center" HorizontalOptions="End"/>
VerticalOptions="FillAndExpand" <Image Source="inutralia.png" HorizontalOptions="End"/>
HorizontalOptions="Center">
<Label
Text="Publicado por : "
TextColor="{ DynamicResource AccentColor }"
VerticalTextAlignment="Center"
HorizontalOptions="End"/>
<Image
Source="inutralia.png"
HorizontalOptions="End"/>
</StackLayout> </StackLayout>
</StackLayout> </StackLayout>
</ContentPage> </ContentPage>
\ No newline at end of file
using inutralia.ViewModels; using inutralia.ViewModels;
using System; using System;
using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms; using Xamarin.Forms;
namespace inutralia.Views namespace inutralia.Views
...@@ -19,39 +15,23 @@ namespace inutralia.Views ...@@ -19,39 +15,23 @@ namespace inutralia.Views
{ {
InitializeComponent(); InitializeComponent();
} }
catch(Exception e)
{
} catch (Exception e) { }
} }
protected override async void OnAppearing() protected override async void OnAppearing()
{ {
base.OnAppearing(); base.OnAppearing();
await ViewModel.RefreshData(); await ViewModel.RefreshData();
//setTimeout(Excerpt.Text = "\""+ Excerpt.Text+ "\"");
//await Task.Run(async () =>
//{
// await Task.Delay(5000);
// Device.BeginInvokeOnMainThread(() =>
// {
// });
//});
outerScrollView.Scrolled += OnScroll; outerScrollView.Scrolled += OnScroll;
} }
public void UnSelectedItem() public void UnSelectedItem()
{ {
((ListView)listTable).SelectedItem = null; ((ListView)listTable).SelectedItem = null;
} }
protected override void OnDisappearing() protected override void OnDisappearing()
{ {
base.OnDisappearing(); base.OnDisappearing();
...@@ -64,21 +44,25 @@ namespace inutralia.Views ...@@ -64,21 +44,25 @@ namespace inutralia.Views
var scrollRegion = layeringGrid.Height - outerScrollView.Height; var scrollRegion = layeringGrid.Height - outerScrollView.Height;
var parallexRegion = imageHeight - outerScrollView.Height; var parallexRegion = imageHeight - outerScrollView.Height;
var factor = outerScrollView.ScrollY - parallexRegion * (outerScrollView.ScrollY / scrollRegion); var factor = outerScrollView.ScrollY - parallexRegion * (outerScrollView.ScrollY / scrollRegion);
if (factor < 0) if (factor < 0)
{ {
factor = 0; factor = 0;
} }
else else
{ {
if (img.TranslationY > img.Height) if (img.TranslationY > img.Height)
{ {
factor = img.Height; factor = img.Height;
} }
else if (img.TranslationY > outerScrollView.ScrollY) else if (img.TranslationY > outerScrollView.ScrollY)
{ {
img.TranslationY = outerScrollView.ScrollY; img.TranslationY = outerScrollView.ScrollY;
} }
} }
img.TranslationY = factor; img.TranslationY = factor;
img.Opacity = 1 - (factor / imageHeight); img.Opacity = 1 - (factor / imageHeight);
//headers.Scale = 1 - ( (factor ) / (imageHeight * 2) ) ; //headers.Scale = 1 - ( (factor ) / (imageHeight * 2) ) ;
...@@ -119,11 +103,7 @@ namespace inutralia.Views ...@@ -119,11 +103,7 @@ namespace inutralia.Views
} //endif } //endif
} }
public void OnPrimaryActionButtonClicked(object sender, EventArgs e) { }
public void OnPrimaryActionButtonClicked(object sender, EventArgs e)
{
}
} }
} }
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" <ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:app="clr-namespace:inutralia;assembly=inutralia"
xmlns:artina="clr-namespace:UXDivers.Artina.Shared;assembly=UXDivers.Artina.Shared" xmlns:artina="clr-namespace:UXDivers.Artina.Shared;assembly=UXDivers.Artina.Shared"
x:Class="inutralia.Views.ModalFiltersRecipe" x:Class="inutralia.Views.ModalFiltersRecipe"
x:Name="modalFiltersRecipe" x:Name="modalFiltersRecipe"
BackgroundColor="{DynamicResource BasePageColor}" BackgroundColor="{DynamicResource BasePageColor}"
Title="Recetas"> Title="Recetas">
<StackLayout Padding="20" <StackLayout Padding="20" VerticalOptions="FillAndExpand">
VerticalOptions="FillAndExpand"
>
<StackLayout VerticalOptions="Start" Orientation="Horizontal" Padding="0,0,0,10"> <StackLayout VerticalOptions="Start" Orientation="Horizontal" Padding="0,0,0,10">
<Entry HorizontalOptions="FillAndExpand" Text="{Binding Desc}" Placeholder="Introduzca búsqueda" /> <Entry HorizontalOptions="FillAndExpand" Text="{Binding Desc}" Placeholder="Introduzca búsqueda" />
...@@ -18,7 +15,6 @@ ...@@ -18,7 +15,6 @@
<ListView ItemTapped="ItemTapped" <ListView ItemTapped="ItemTapped"
ItemsSource="{Binding Groups}" ItemsSource="{Binding Groups}"
Footer="" Footer=""
HasUnevenRows="True" HasUnevenRows="True"
IsGroupingEnabled="True"> IsGroupingEnabled="True">
...@@ -32,6 +28,7 @@ ...@@ -32,6 +28,7 @@
</ViewCell> </ViewCell>
</DataTemplate> </DataTemplate>
</ListView.GroupHeaderTemplate> </ListView.GroupHeaderTemplate>
<ListView.ItemTemplate> <ListView.ItemTemplate>
<DataTemplate> <DataTemplate>
<SwitchCell Text="{Binding Name}" On="{Binding Selected}" /> <SwitchCell Text="{Binding Name}" On="{Binding Selected}" />
...@@ -49,8 +46,6 @@ ...@@ -49,8 +46,6 @@
VerticalOptions="End" VerticalOptions="End"
Clicked="ApplyModalButton" Clicked="ApplyModalButton"
Style="{DynamicResource PrimaryActionButtonStyle}" Style="{DynamicResource PrimaryActionButtonStyle}"
Text= "Aplicar" Text= "Aplicar"/>
/>
</StackLayout> </StackLayout>
</ContentPage> </ContentPage>
\ No newline at end of file
using inutralia.ViewModels; using inutralia.ViewModels;
using System; using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms; using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace inutralia.Views namespace inutralia.Views
{ {
public partial class ModalFiltersRecipe : ContentPage public partial class ModalFiltersRecipe : ContentPage
{ {
protected RecipeListOptionsViewModel ViewModel => BindingContext as RecipeListOptionsViewModel; protected RecipeListOptionsViewModel ViewModel => BindingContext as RecipeListOptionsViewModel;
protected RecipeListView ListView; protected RecipeListView ListView;
public ModalFiltersRecipe( RecipeListView listView) public ModalFiltersRecipe(RecipeListView listView)
{ {
InitializeComponent(); InitializeComponent();
ListView = listView; ListView = listView;
} }
...@@ -32,14 +23,13 @@ namespace inutralia.Views ...@@ -32,14 +23,13 @@ namespace inutralia.Views
private async void ApplyModalButton(object sender, EventArgs e) private async void ApplyModalButton(object sender, EventArgs e)
{ {
await ListView.ApplyFilters (); await ListView.ApplyFilters();
} }
protected override async void OnAppearing() protected override void OnAppearing()
{ {
base.OnAppearing(); base.OnAppearing();
ViewModel.ExecuteLoadOptionsCommand();
await ViewModel.ExecuteLoadOptionsCommand();
} }
} }
} }
...@@ -2,31 +2,20 @@ ...@@ -2,31 +2,20 @@
<ContentView <ContentView
xmlns="http://xamarin.com/schemas/2014/forms" xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:inutralia;assembly=inutralia"
xmlns:ffimageloading="clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms" xmlns:ffimageloading="clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms"
x:Class="inutralia.Views.RecipeItemTemplate" x:Class="inutralia.Views.RecipeItemTemplate"
x:Name="RecipeItemTemplate" x:Name="RecipeItemTemplate"
BackgroundColor="White"> BackgroundColor="White">
<!--<ContentPage.Resources>
<ResourceDictionary>
<local:ImageTransformator x:Key="cnvImg"></local:ImageTransformator>
</ResourceDictionary>
</ContentPage.Resources>-->
<Grid BackgroundColor="Black"> <Grid BackgroundColor="Black">
<!-- TODO: Cambiar icon.png por imagen adecuada --> <!-- TODO: Cambiar icon.png por imagen adecuada -->
<ffimageloading:CachedImage <ffimageloading:CachedImage FadeAnimationEnabled="true"
FadeAnimationEnabled="true"
Source="{ Binding Image }" Source="{ Binding Image }"
Aspect="AspectFill" Aspect="AspectFill"
Opacity="0.5"/> Opacity="0.5"/>
<Grid <Grid ColumnSpacing="0" RowSpacing="6" Padding="20">
ColumnSpacing="0"
RowSpacing="6"
Padding="20">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="*" /> <RowDefinition Height="*" />
...@@ -35,59 +24,21 @@ ...@@ -35,59 +24,21 @@
</Grid.RowDefinitions> </Grid.RowDefinitions>
<!--PARTE SUPERIOR--> <!--PARTE SUPERIOR-->
<StackLayout <StackLayout Grid.Row="0" VerticalOptions="End" HorizontalOptions="Start">
Grid.Row="0" <StackLayout Grid.Row="1" Orientation="Horizontal" HorizontalOptions="Fill" VerticalOptions="FillAndExpand" Padding="5" >
VerticalOptions="End"
HorizontalOptions="Start">
<StackLayout
Grid.Row="1"
Orientation="Horizontal"
HorizontalOptions="Fill"
VerticalOptions="FillAndExpand"
Padding="5"
>
<!--TITULO--> <!--TITULO-->
<Label <Label FontSize="30" FontAttributes="Bold" Text="{Binding ShortName}" LineBreakMode="WordWrap" TextColor="{ DynamicResource InverseTextColor }"/>
FontSize="30"
FontAttributes="Bold"
Text="{Binding ShortName}"
LineBreakMode="WordWrap"
TextColor="{ DynamicResource InverseTextColor }"/>
</StackLayout> </StackLayout>
</StackLayout> </StackLayout>
<!--PARTE INFERIOR--> <!--PARTE INFERIOR-->
<StackLayout <StackLayout Grid.Row="1" Orientation="Horizontal" HorizontalOptions="FillAndExpand" VerticalOptions="End">
Grid.Row="1"
Orientation="Horizontal"
HorizontalOptions="FillAndExpand"
VerticalOptions="End">
<!--RESUMEN --> <!--RESUMEN -->
<Label Text="{ Binding Excerpt}" TextColor="{ DynamicResource InverseTextColor }" HorizontalOptions="FillAndExpand" />
<Label
Text="{ Binding Excerpt}"
TextColor="{ DynamicResource InverseTextColor }"
HorizontalOptions="FillAndExpand" />
<!--KCAL-->
<!-- <Label
Text="{Binding Energy}"
TextColor="{ DynamicResource InverseTextColor }"
FontSize="Small"
LineBreakMode="NoWrap"
HorizontalOptions="End" />-->
</StackLayout> </StackLayout>
<BoxView Grid.Row="2" Style="{StaticResource BrandNameOrnamentStyle}"/>
<BoxView
Grid.Row="2"
Style="{StaticResource BrandNameOrnamentStyle}"/>
</Grid> </Grid>
</Grid> </Grid>
</ContentView> </ContentView>
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
--> -->
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" <ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:inutralia;assembly=inutralia"
xmlns:conv="clr-namespace:inutralia.Converters;assembly=inutralia" xmlns:conv="clr-namespace:inutralia.Converters;assembly=inutralia"
xmlns:views="clr-namespace:inutralia.Views;assembly=inutralia" xmlns:views="clr-namespace:inutralia.Views;assembly=inutralia"
x:Class="inutralia.Views.RecipeListView" x:Class="inutralia.Views.RecipeListView"
...@@ -31,6 +30,7 @@ ...@@ -31,6 +30,7 @@
<conv:ImageTransformator x:Key="cnvImg"></conv:ImageTransformator> <conv:ImageTransformator x:Key="cnvImg"></conv:ImageTransformator>
</ResourceDictionary> </ResourceDictionary>
</ContentPage.Resources> </ContentPage.Resources>
<!-- Este es el componente para el listado. Primero configura de dónde obtiene los datos <!-- Este es el componente para el listado. Primero configura de dónde obtiene los datos
y el método al que llamar cuando se hace tap en un elemento de la lista. Luego y el método al que llamar cuando se hace tap en un elemento de la lista. Luego
configura el pull-to-refresh. Por último algunas opciones de visionado y gestión configura el pull-to-refresh. Por último algunas opciones de visionado y gestión
...@@ -39,20 +39,9 @@ ...@@ -39,20 +39,9 @@
<StackLayout VerticalOptions="FillAndExpand"> <StackLayout VerticalOptions="FillAndExpand">
<ActivityIndicator HorizontalOptions="FillAndExpand" IsRunning="{Binding IsBusy}" IsVisible="{Binding IsBusy}"/> <ActivityIndicator HorizontalOptions="FillAndExpand" IsRunning="{Binding IsBusy}" IsVisible="{Binding IsBusy}"/>
<Label Text="Buscando recetas..."
VerticalOptions="CenterAndExpand"
VerticalTextAlignment="Center"
HorizontalTextAlignment="Center"
IsVisible="{Binding IsBusy}"
/>
<Label Margin="8,0,8,0" <Label Text="Buscando recetas..." VerticalOptions="CenterAndExpand" VerticalTextAlignment="Center" HorizontalTextAlignment="Center" IsVisible="{Binding IsBusy}"/>
Text="No se encontraron resultados. Cambie los filtros y pulse Aplicar" <Label Margin="8,0,8,0" Text="No se encontraron resultados. Cambie los filtros y pulse Aplicar" VerticalOptions="CenterAndExpand" VerticalTextAlignment="Center" HorizontalTextAlignment="Center" IsVisible="{Binding IsEmpty}"/>
VerticalOptions="CenterAndExpand"
VerticalTextAlignment="Center"
HorizontalTextAlignment="Center"
IsVisible="{Binding IsEmpty}"
/>
<ListView VerticalOptions="FillAndExpand" <ListView VerticalOptions="FillAndExpand"
SeparatorVisibility="None" SeparatorVisibility="None"
...@@ -63,8 +52,8 @@ ...@@ -63,8 +52,8 @@
ItemTapped="ItemTapped" ItemTapped="ItemTapped"
HasUnevenRows="false" HasUnevenRows="false"
x:Name="listRecipe" x:Name="listRecipe"
IsVisible="{Binding IsNotEmpty}" IsVisible="{Binding IsNotEmpty}">
>
<ListView.ItemTemplate> <ListView.ItemTemplate>
<DataTemplate> <DataTemplate>
<ViewCell> <ViewCell>
......
using inutralia.Models; using inutralia.Models;
using inutralia.ViewModels; using inutralia.ViewModels;
using System; using System;
using System.Collections.Generic;
using System.Threading.Tasks; using System.Threading.Tasks;
using Xamarin.Forms; using Xamarin.Forms;
...@@ -18,7 +17,6 @@ namespace inutralia.Views ...@@ -18,7 +17,6 @@ namespace inutralia.Views
public RecipeListView() public RecipeListView()
{ {
InitializeComponent(); InitializeComponent();
BindingContext = new RecipeListViewModel(); BindingContext = new RecipeListViewModel();
} }
...@@ -37,11 +35,11 @@ namespace inutralia.Views ...@@ -37,11 +35,11 @@ namespace inutralia.Views
); );
} }
public async Task ApplyFilters () public async Task ApplyFilters()
{ {
await Navigation.PopAsync (); await Navigation.PopAsync();
ViewModel.Recipes.Clear (); ViewModel.Recipes.Clear();
ViewModel.RefreshRecipesCommand.Execute (BindingContext); ViewModel.RefreshRecipesCommand.Execute(BindingContext);
} }
/// <summary> /// <summary>
...@@ -56,36 +54,35 @@ namespace inutralia.Views ...@@ -56,36 +54,35 @@ namespace inutralia.Views
{ {
firstTime = false; firstTime = false;
await DoFiltersAsync (); await DoFiltersAsync();
} //endif } //endif
} }
/// <summary> /// <summary>
/// Método llamado al pulsar el toolbar 'Filtros' /// Método llamado al pulsar el toolbar 'Filtros'
/// </summary> /// </summary>
private async void ToolbarFiltersClicked (object sender, EventArgs e) private async void ToolbarFiltersClicked(object sender, EventArgs e)
{ {
if(ViewModel.IsNotBusy) if (ViewModel.IsNotBusy)
await DoFiltersAsync (); await DoFiltersAsync();
} }
/// <summary> /// <summary>
/// Tarea de filtrado. Muestra el modal, espera a que se cierre, y actualiza el listado /// Tarea de filtrado. Muestra el modal, espera a que se cierre, y actualiza el listado
/// </summary> /// </summary>
protected async Task DoFiltersAsync () protected async Task DoFiltersAsync()
{ {
// Crear la página de filtros si todavía no existe // Crear la página de filtros si todavía no existe
if (filtersPage == null) if (filtersPage == null)
{ {
filtersPage = new ModalFiltersRecipe (this) filtersPage = new ModalFiltersRecipe(this)
{ {
BindingContext = ViewModel.Filters BindingContext = ViewModel.Filters
}; };
} //endif } //endif
// Mostrarla // Mostrarla
await Navigation.PushAsync (filtersPage); await Navigation.PushAsync(filtersPage);
} }
} }
} }
...@@ -4,15 +4,13 @@ ...@@ -4,15 +4,13 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="inutralia.Views.RegisterConditionsView" x:Class="inutralia.Views.RegisterConditionsView"
xmlns:artina="clr-namespace:UXDivers.Artina.Shared;assembly=UXDivers.Artina.Shared" xmlns:artina="clr-namespace:UXDivers.Artina.Shared;assembly=UXDivers.Artina.Shared"
xmlns:local="clr-namespace:inutralia;assembly=inutralia"
Title="Registro en la aplicación ..." Title="Registro en la aplicación ..."
BackgroundColor="{DynamicResource BasePageColor}"> BackgroundColor="{DynamicResource BasePageColor}">
<ContentPage.Content> <ContentPage.Content>
<StackLayout Padding="{ DynamicResource MainWrapperPadding }"> <StackLayout Padding="{ DynamicResource MainWrapperPadding }">
<StackLayout Padding="20" > <StackLayout Padding="20" >
<WebView x:Name="ConditionsWebView" <WebView x:Name="ConditionsWebView"
HorizontalOptions="FillAndExpand" HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand" VerticalOptions="FillAndExpand"
...@@ -35,7 +33,6 @@ ...@@ -35,7 +33,6 @@
PortraitTablet=Fill, PortraitTablet=Fill,
LandscapeTablet=Center }"/> LandscapeTablet=Center }"/>
</StackLayout> </StackLayout>
</StackLayout> </StackLayout>
</ContentPage.Content> </ContentPage.Content>
</ContentPage> </ContentPage>
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Reflection; using System.Reflection;
using Xamarin.Forms; using Xamarin.Forms;
...@@ -12,13 +11,13 @@ namespace inutralia.Views ...@@ -12,13 +11,13 @@ namespace inutralia.Views
{ {
InitializeComponent(); InitializeComponent();
var htmlSource = new HtmlWebViewSource (); var htmlSource = new HtmlWebViewSource();
var assembly = typeof (App).GetTypeInfo ().Assembly; var assembly = typeof(App).GetTypeInfo().Assembly;
Stream stream = assembly.GetManifestResourceStream ("inutralia.LegalConditions.html"); Stream stream = assembly.GetManifestResourceStream("inutralia.LegalConditions.html");
using (var reader = new StreamReader (stream)) using (var reader = new StreamReader(stream))
{ {
htmlSource.Html = reader.ReadToEnd (); htmlSource.Html = reader.ReadToEnd();
} }
ConditionsWebView.Source = htmlSource; ConditionsWebView.Source = htmlSource;
...@@ -26,7 +25,7 @@ namespace inutralia.Views ...@@ -26,7 +25,7 @@ namespace inutralia.Views
async void OnBackButtonClicked(object sender, EventArgs e) async void OnBackButtonClicked(object sender, EventArgs e)
{ {
await Navigation.PopModalAsync (); await Navigation.PopModalAsync();
} }
} }
} }
\ No newline at end of file
...@@ -6,32 +6,18 @@ ...@@ -6,32 +6,18 @@
xmlns:artina="clr-namespace:UXDivers.Artina.Shared;assembly=UXDivers.Artina.Shared" xmlns:artina="clr-namespace:UXDivers.Artina.Shared;assembly=UXDivers.Artina.Shared"
xmlns:local="clr-namespace:inutralia;assembly=inutralia" xmlns:local="clr-namespace:inutralia;assembly=inutralia"
Title="Registro en la aplicación ..." Title="Registro en la aplicación ..."
BackgroundColor="{DynamicResource BasePageColor}"> BackgroundColor="{DynamicResource BasePageColor}">
<ContentPage.Content> <ContentPage.Content>
<AbsoluteLayout> <AbsoluteLayout>
<!-- GRADIENT--> <!-- GRADIENT-->
<Image <Image AbsoluteLayout.LayoutBounds="0,0,1,44" AbsoluteLayout.LayoutFlags="WidthProportional" Style="{ StaticResource StatusBarShimStyle }" VerticalOptions="Start"/>
AbsoluteLayout.LayoutBounds="0,0,1,44"
AbsoluteLayout.LayoutFlags="WidthProportional"
Style="{ StaticResource StatusBarShimStyle }"
VerticalOptions="Start"/>
<ScrollView <ScrollView AbsoluteLayout.LayoutBounds="0,0,1,1" AbsoluteLayout.LayoutFlags="All" VerticalOptions="FillAndExpand" Padding="{ DynamicResource MainWrapperPadding }">
AbsoluteLayout.LayoutBounds="0,0,1,1"
AbsoluteLayout.LayoutFlags="All"
VerticalOptions="FillAndExpand"
Padding="{ DynamicResource MainWrapperPadding }">
<!-- MAIN CONTAINER --> <!-- MAIN CONTAINER -->
<Grid <Grid ColumnSpacing="0" RowSpacing="0" Padding="20,30,20,10" HorizontalOptions="Fill" VerticalOptions="FillAndExpand" >
ColumnSpacing="0"
RowSpacing="0"
Padding="20,30,20,10"
HorizontalOptions="Fill"
VerticalOptions="FillAndExpand" >
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
...@@ -40,42 +26,20 @@ ...@@ -40,42 +26,20 @@
</Grid.RowDefinitions> </Grid.RowDefinitions>
<!-- HEADER --> <!-- HEADER -->
<StackLayout <StackLayout Grid.Row="0" Spacing="5" Padding="0,20,0,0" InputTransparent="true">
Grid.Row="0"
Spacing="5"
Padding="0,20,0,0"
InputTransparent="true">
<!-- LOGO --> <!-- LOGO -->
<Grid <Grid Grid.Row="1" WidthRequest="150" VerticalOptions="Center" HorizontalOptions="Center">
Grid.Row="1"
WidthRequest="150"
VerticalOptions="Center"
HorizontalOptions="Center">
<Image Source="logo_empresa.png" WidthRequest="150"></Image> <Image Source="logo_empresa.png" WidthRequest="150"></Image>
</Grid> </Grid>
<!--SEPARATOR--> <!--SEPARATOR-->
<BoxView <BoxView WidthRequest="80" HeightRequest="1" HorizontalOptions="Center" VerticalOptions="End" BackgroundColor="{DynamicResource BaseTextColor}"/>
WidthRequest="80"
HeightRequest="1"
HorizontalOptions="Center"
VerticalOptions="End"
BackgroundColor="{DynamicResource BaseTextColor}"/>
</StackLayout> </StackLayout>
<!---FIELDS CONTAINER--> <!---FIELDS CONTAINER-->
<Grid <Grid Grid.Row="1" RowSpacing="30" Padding="0,20,0,20" VerticalOptions="Center">
Grid.Row="1"
RowSpacing="30"
Padding="0,20,0,20"
VerticalOptions="Center">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
...@@ -88,20 +52,17 @@ ...@@ -88,20 +52,17 @@
</Grid.RowDefinitions> </Grid.RowDefinitions>
<!-- ICON BACKGROUND --> <!-- ICON BACKGROUND -->
<Label <Label Grid.Column="0"
Grid.Column="0"
Grid.Row="0" Grid.Row="0"
FontSize="40" FontSize="40"
Style="{StaticResource RoundShape}" Style="{StaticResource RoundShape}"
HorizontalTextAlignment="Center" HorizontalTextAlignment="Center"
TextColor="{DynamicResource ComplementColor}" TextColor="{DynamicResource ComplementColor}"
VerticalOptions="Center" VerticalOptions="Center"
HorizontalOptions="Center" HorizontalOptions="Center"/>
/>
<!-- ICON --> <!-- ICON -->
<Label <Label Grid.Column="0"
Grid.Column="0"
Grid.Row="0" Grid.Row="0"
FontSize="14" FontSize="14"
Text="{ x:Static local:GrialShapesFont.Email }" Text="{ x:Static local:GrialShapesFont.Email }"
...@@ -109,12 +70,10 @@ ...@@ -109,12 +70,10 @@
HorizontalTextAlignment="Center" HorizontalTextAlignment="Center"
TextColor="White" TextColor="White"
VerticalOptions="Center" VerticalOptions="Center"
HorizontalOptions="Center" HorizontalOptions="Center"/>
/>
<!--EMAIL FIELD--> <!--EMAIL FIELD-->
<Entry <Entry Grid.Column="1"
Grid.Column="1"
Grid.Row="0" Grid.Row="0"
HeightRequest="40" HeightRequest="40"
x:Name = "userNameEntry" x:Name = "userNameEntry"
...@@ -122,25 +81,18 @@ ...@@ -122,25 +81,18 @@
BackgroundColor="{ DynamicResource PlaceholderColorEntry }" BackgroundColor="{ DynamicResource PlaceholderColorEntry }"
PlaceholderColor="{ DynamicResource BaseTextColor }"/> PlaceholderColor="{ DynamicResource BaseTextColor }"/>
<!-- ICON BACKGROUND --> <!-- ICON BACKGROUND -->
<Label <Label Grid.Column="0"
Grid.Column="0"
Grid.Row="1" Grid.Row="1"
FontSize="40" FontSize="40"
Style="{StaticResource RoundShape}" Style="{StaticResource RoundShape}"
HorizontalTextAlignment="Center" HorizontalTextAlignment="Center"
TextColor="{DynamicResource ComplementColor}" TextColor="{DynamicResource ComplementColor}"
VerticalOptions="Center" VerticalOptions="Center"
HorizontalOptions="Center" HorizontalOptions="Center"/>
/>
<!-- ICON --> <!-- ICON -->
<Label <Label Grid.Column="0"
Grid.Column="0"
Grid.Row="1" Grid.Row="1"
FontSize="14" FontSize="14"
Text="{ x:Static local:GrialShapesFont.Lock }" Text="{ x:Static local:GrialShapesFont.Lock }"
...@@ -148,37 +100,30 @@ ...@@ -148,37 +100,30 @@
HorizontalTextAlignment="Center" HorizontalTextAlignment="Center"
TextColor="White" TextColor="White"
VerticalOptions="Center" VerticalOptions="Center"
HorizontalOptions="Center" HorizontalOptions="Center" />
/>
<!-- PASSWORD ENTRY --> <!-- PASSWORD ENTRY -->
<Entry <Entry Grid.Column="1"
Grid.Column="1"
Grid.Row="1" Grid.Row="1"
HeightRequest="40" HeightRequest="40"
x:Name = "passWordEntry" x:Name = "passWordEntry"
Placeholder="Contraseña" Placeholder="Contraseña"
IsPassword="True" IsPassword="True"
BackgroundColor="{ DynamicResource PlaceholderColorEntry }" BackgroundColor="{ DynamicResource PlaceholderColorEntry }"
PlaceholderColor="{ DynamicResource BaseTextColor }"/> PlaceholderColor="{ DynamicResource BaseTextColor }" />
<!-- ICON BACKGROUND --> <!-- ICON BACKGROUND -->
<Label <Label Grid.Column="0"
Grid.Column="0"
Grid.Row="2" Grid.Row="2"
FontSize="40" FontSize="40"
Style="{StaticResource RoundShape}" Style="{StaticResource RoundShape}"
HorizontalTextAlignment="Center" HorizontalTextAlignment="Center"
TextColor="{DynamicResource ComplementColor}" TextColor="{DynamicResource ComplementColor}"
VerticalOptions="Center" VerticalOptions="Center"
HorizontalOptions="Center" HorizontalOptions="Center" />
/>
<!-- ICON --> <!-- ICON -->
<Label <Label Grid.Column="0"
Grid.Column="0"
Grid.Row="2" Grid.Row="2"
FontSize="14" FontSize="14"
Text="{ x:Static local:GrialShapesFont.Star }" Text="{ x:Static local:GrialShapesFont.Star }"
...@@ -186,12 +131,10 @@ ...@@ -186,12 +131,10 @@
HorizontalTextAlignment="Center" HorizontalTextAlignment="Center"
TextColor="White" TextColor="White"
VerticalOptions="Center" VerticalOptions="Center"
HorizontalOptions="Center" HorizontalOptions="Center"/>
/>
<!-- PASSWORD ENTRY --> <!-- PASSWORD ENTRY -->
<Entry <Entry Grid.Column="1"
Grid.Column="1"
Grid.Row="2" Grid.Row="2"
HeightRequest="40" HeightRequest="40"
x:Name = "companyCodeEntry" x:Name = "companyCodeEntry"
...@@ -199,21 +142,14 @@ ...@@ -199,21 +142,14 @@
IsPassword="True" IsPassword="True"
BackgroundColor="{ DynamicResource PlaceholderColorEntry }" BackgroundColor="{ DynamicResource PlaceholderColorEntry }"
PlaceholderColor="{ DynamicResource BaseTextColor }"/> PlaceholderColor="{ DynamicResource BaseTextColor }"/>
</Grid> </Grid>
<!-- BUTTONS --> <!-- BUTTONS -->
<StackLayout <StackLayout Grid.Row="2" Spacing="10" Padding="0,10,0,0" HorizontalOptions="FillAndExpand" VerticalOptions="End" >
Grid.Row="2"
Spacing="10"
Padding="0,10,0,0"
HorizontalOptions="FillAndExpand"
VerticalOptions="End" >
<StackLayout Orientation="Horizontal" IsVisible="False"> <StackLayout Orientation="Horizontal" IsVisible="False">
<Switch x:Name="ConditionsSwitch" Toggled="ConditionsSwitch_Toggled" /> <Switch x:Name="ConditionsSwitch" Toggled="ConditionsSwitch_Toggled" />
<Label Text="Confirmo haber leído y aceptado la política de privacidad y las condiciones de uso"> <Label Text="Confirmo haber leído y aceptado la política de privacidad y las condiciones de uso">
<Label.GestureRecognizers> <Label.GestureRecognizers>
<TapGestureRecognizer Tapped="ConditionsLabelTapped" <TapGestureRecognizer Tapped="ConditionsLabelTapped"
...@@ -238,8 +174,7 @@ ...@@ -238,8 +174,7 @@
LandscapeTablet=Center }"/> LandscapeTablet=Center }"/>
<!-- Volver --> <!-- Volver -->
<artina:Button <artina:Button Style="{ DynamicResource PrimaryActionButtonStyle }"
Style="{ DynamicResource PrimaryActionButtonStyle }"
BackgroundColor="#3b5998" BackgroundColor="#3b5998"
VerticalOptions="End" VerticalOptions="End"
x:Name="backButton" x:Name="backButton"
...@@ -255,8 +190,7 @@ ...@@ -255,8 +190,7 @@
LandscapeTablet=Center }"/> LandscapeTablet=Center }"/>
<!--SEPARATOR--> <!--SEPARATOR-->
<BoxView <BoxView Grid.Row="4"
Grid.Row="4"
HeightRequest="1" HeightRequest="1"
VerticalOptions="Start" VerticalOptions="Start"
HorizontalOptions="Center" HorizontalOptions="Center"
...@@ -264,15 +198,8 @@ ...@@ -264,15 +198,8 @@
BackgroundColor="{DynamicResource BaseTextColor}"/> BackgroundColor="{DynamicResource BaseTextColor}"/>
</StackLayout> </StackLayout>
</Grid> </Grid>
</ScrollView> </ScrollView>
</AbsoluteLayout> </AbsoluteLayout>
</ContentPage.Content> </ContentPage.Content>
</ContentPage> </ContentPage>
using System; using System;
using System.Collections.Generic;
using System.Net; using System.Net;
using Xamarin.Forms; using Xamarin.Forms;
...@@ -10,25 +9,23 @@ namespace inutralia.Views ...@@ -10,25 +9,23 @@ namespace inutralia.Views
public RegisterView() public RegisterView()
{ {
InitializeComponent(); InitializeComponent();
// RegisterButton.IsEnabled = false;
} }
async void OnRegisterButtonClicked(object sender, EventArgs e) async void OnRegisterButtonClicked(object sender, EventArgs e)
{ {
var companyCode = companyCodeEntry.Text; var companyCode = companyCodeEntry.Text;
var userName = userNameEntry.Text; var userName = userNameEntry.Text;
var passWord = passWordEntry.Text; var passWord = passWordEntry.Text;
HttpStatusCode? errorCode = await App.API.RegisterUser (companyCode, userName, passWord); HttpStatusCode? errorCode = await App.API.RegisterUser(companyCode, userName, passWord);
if (errorCode == null) if (errorCode == null)
{ {
await DisplayAlert("Correcto" , "Se ha registrado correctamente. Puede acceder a la aplicación." , "Entendido"); await DisplayAlert("Correcto", "Se ha registrado correctamente. Puede acceder a la aplicación.", "Entendido");
// Cambiar de vista // Cambiar de vista
await Navigation.PopModalAsync (); await Navigation.PopModalAsync();
} }
else else
{ {
string msg = (errorCode == HttpStatusCode.Conflict) ? string msg = (errorCode == HttpStatusCode.Conflict) ?
...@@ -39,21 +36,20 @@ namespace inutralia.Views ...@@ -39,21 +36,20 @@ namespace inutralia.Views
} //endif } //endif
} }
async void OnBackButtonClicked(object sender, EventArgs e) async void OnBackButtonClicked(object sender, EventArgs e)
{ {
await Navigation.PopModalAsync (); await Navigation.PopModalAsync();
} }
private void ConditionsSwitch_Toggled (object sender, ToggledEventArgs e) private void ConditionsSwitch_Toggled(object sender, ToggledEventArgs e)
{ {
RegisterButton.IsEnabled = e.Value; RegisterButton.IsEnabled = e.Value;
} }
private async void ConditionsLabelTapped (object sender, EventArgs e) private async void ConditionsLabelTapped(object sender, EventArgs e)
{ {
// Vista con las condiciones legales // Vista con las condiciones legales
await Navigation.PushModalAsync (new RegisterConditionsView () as Page); await Navigation.PushModalAsync(new RegisterConditionsView() as Page);
} }
} }
} }
...@@ -5,12 +5,7 @@ ...@@ -5,12 +5,7 @@
<StackLayout Padding = "25,50" > <StackLayout Padding = "25,50" >
<Label x:Name="messageLabel" HorizontalOptions = "Center"/> <Label x:Name="messageLabel" HorizontalOptions = "Center"/>
<Entry x:Name = "userEntry" Placeholder="Usuario" HorizontalOptions = "Fill" VerticalOptions = "CenterAndExpand" />
<Entry x:Name = "userEntry" Placeholder="Usuario" HorizontalOptions = "Fill" <Button x:Name="RememberButton" Text = "Recuperar" Clicked="OnRememberButtonClicked" HorizontalOptions = "Fill" VerticalOptions = "EndAndExpand" FontSize="24" BorderRadius="10" BorderWidth="1"/>
VerticalOptions = "CenterAndExpand" />
<Button x:Name="RememberButton" Text = "Recuperar" Clicked="OnRememberButtonClicked" HorizontalOptions = "Fill"
VerticalOptions = "EndAndExpand" FontSize="24" BorderRadius="10" BorderWidth="1"/>
</StackLayout> </StackLayout>
</ContentPage> </ContentPage>
using System; using System;
using System.Collections.Generic;
using Xamarin.Forms; using Xamarin.Forms;
namespace inutralia.Views namespace inutralia.Views
...@@ -19,6 +17,5 @@ namespace inutralia.Views ...@@ -19,6 +17,5 @@ namespace inutralia.Views
// Cambiar de vista // Cambiar de vista
Application.Current.MainPage = nextView; Application.Current.MainPage = nextView;
} }
} }
} }
...@@ -8,8 +8,7 @@ ...@@ -8,8 +8,7 @@
BackgroundColor="Transparent"> BackgroundColor="Transparent">
<pages:PopupPage.Animation> <pages:PopupPage.Animation>
<animations:ScaleAnimation <animations:ScaleAnimation PositionIn="Center"
PositionIn="Center"
PositionOut="Center" PositionOut="Center"
ScaleIn="1.2" ScaleIn="1.2"
ScaleOut="0.8" ScaleOut="0.8"
...@@ -21,7 +20,9 @@ ...@@ -21,7 +20,9 @@
</pages:PopupPage.Animation> </pages:PopupPage.Animation>
<StackLayout VerticalOptions="Center" Padding="20,0" HorizontalOptions="FillAndExpand" > <StackLayout VerticalOptions="Center" Padding="20,0" HorizontalOptions="FillAndExpand" >
<Frame CornerRadius="10" Padding="0" BackgroundColor="{DynamicResource AccentColor}" > <Frame CornerRadius="10" Padding="0" BackgroundColor="{DynamicResource AccentColor}" >
<StackLayout Padding="10"> <StackLayout Padding="10">
<Label Text="COMO SE UTILIZA LA LISTA DE LA COMPRA" TextColor="White" HorizontalOptions="Start"/> <Label Text="COMO SE UTILIZA LA LISTA DE LA COMPRA" TextColor="White" HorizontalOptions="Start"/>
<Label Text="La lista de la compra mostrará por defecto los ingredientes a utilizar por orden alfabético." TextColor="#333333" FontSize="Small" HorizontalOptions="CenterAndExpand"></Label> <Label Text="La lista de la compra mostrará por defecto los ingredientes a utilizar por orden alfabético." TextColor="#333333" FontSize="Small" HorizontalOptions="CenterAndExpand"></Label>
......
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" <ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:app="clr-namespace:inutralia;assembly=inutralia"
xmlns:artina="clr-namespace:UXDivers.Artina.Shared;assembly=UXDivers.Artina.Shared" xmlns:artina="clr-namespace:UXDivers.Artina.Shared;assembly=UXDivers.Artina.Shared"
x:Class="inutralia.Views.ListDelSuper" x:Class="inutralia.Views.ListDelSuper"
x:Name="listDelSuper" x:Name="listDelSuper"
Title=" TU COMPRA DELSUPER" > Title=" TU COMPRA DELSUPER" >
<StackLayout Margin="10,10" VerticalOptions="FillAndExpand" IsVisible="{Binding isBusy}"> <StackLayout Margin="10,10" VerticalOptions="FillAndExpand" IsVisible="{Binding isBusy}">
<ListView ItemsSource="{Binding ShoppingList}"
<ListView
ItemsSource="{Binding ShoppingList}"
ItemTapped="ItemTapped" ItemTapped="ItemTapped"
IsPullToRefreshEnabled="True" IsPullToRefreshEnabled="True"
RefreshCommand="{Binding RefreshShoppingListCommand}" RefreshCommand="{Binding RefreshShoppingListCommand}"
IsRefreshing="{Binding IsBusy, Mode=OneWay}" IsRefreshing="{Binding IsBusy, Mode=OneWay}"
BackgroundColor="Transparent" BackgroundColor="Transparent"
CachingStrategy="RecycleElement" CachingStrategy="RecycleElement"
SeparatorColor="{DynamicResource AccentColor}" SeparatorColor="{DynamicResource AccentColor}"
Footer="" Footer=""
HasUnevenRows="False" HasUnevenRows="False"
x:Name="ListView" x:Name="ListView">
>
<ListView.ItemTemplate> <ListView.ItemTemplate>
<DataTemplate> <DataTemplate>
......
using inutralia.Models; using inutralia.ViewModels;
using inutralia.ViewModels;
using System; using System;
using System.Net.Http;
using Xamarin.Forms; using Xamarin.Forms;
using Xamarin.Forms.Xaml; using Xamarin.Forms.Xaml;
......
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" <ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:app="clr-namespace:inutralia;assembly=inutralia"
xmlns:artina="clr-namespace:UXDivers.Artina.Shared;assembly=UXDivers.Artina.Shared" xmlns:artina="clr-namespace:UXDivers.Artina.Shared;assembly=UXDivers.Artina.Shared"
x:Class="inutralia.Views.ModalAddShoppingList" x:Class="inutralia.Views.ModalAddShoppingList"
x:Name="modalAddShoppingListView" x:Name="modalAddShoppingListView"
Title="Ingredientes adicionales" Title="Ingredientes adicionales"
BackgroundColor="{DynamicResource BasePageColor}"> BackgroundColor="{DynamicResource BasePageColor}">
<ContentPage.Padding> <ContentPage.Padding>
<OnPlatform x:TypeArguments="Thickness" <OnPlatform x:TypeArguments="Thickness"
iOS="0,40,0,0" iOS="0,40,0,0"
...@@ -21,7 +19,6 @@ ...@@ -21,7 +19,6 @@
<StackLayout VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand"> <StackLayout VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand">
<StackLayout VerticalOptions="CenterAndExpand" Padding="10,20,10,20"> <StackLayout VerticalOptions="CenterAndExpand" Padding="10,20,10,20">
<Label Text="AÑADE QUE QUIERES COMPRAR" TextColor="{DynamicResource AccentColor}" HorizontalOptions="Center" FontSize="24"/> <Label Text="AÑADE QUE QUIERES COMPRAR" TextColor="{DynamicResource AccentColor}" HorizontalOptions="Center" FontSize="24"/>
<Entry x:Name="entryIngre" Placeholder="Añade el ingrediente" HorizontalOptions="FillAndExpand" VerticalOptions="Center" Margin="20,20" /> <Entry x:Name="entryIngre" Placeholder="Añade el ingrediente" HorizontalOptions="FillAndExpand" VerticalOptions="Center" Margin="20,20" />
</StackLayout> </StackLayout>
</StackLayout> </StackLayout>
......
using inutralia.Models; using inutralia.ViewModels;
using inutralia.ViewModels;
using System; using System;
using System.Threading.Tasks;
using System.Windows.Input;
using Xamarin.Forms; using Xamarin.Forms;
namespace inutralia.Views namespace inutralia.Views
...@@ -26,7 +23,7 @@ namespace inutralia.Views ...@@ -26,7 +23,7 @@ namespace inutralia.Views
private async void AddModalButton(object sender, EventArgs e) private async void AddModalButton(object sender, EventArgs e)
{ {
var newItem = new Models.ShoppingList() { FromMenus = false, Select = false, Text = entryIngre.Text}; var newItem = new Models.ShoppingList() { FromMenus = false, Select = false, Text = entryIngre.Text };
await ViewModel.AddItem(newItem); await ViewModel.AddItem(newItem);
await Navigation.PopModalAsync(); await Navigation.PopModalAsync();
} }
...@@ -39,7 +36,6 @@ namespace inutralia.Views ...@@ -39,7 +36,6 @@ namespace inutralia.Views
protected override void OnAppearing() protected override void OnAppearing()
{ {
base.OnAppearing(); base.OnAppearing();
} }
} }
} }
......
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" <ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:app="clr-namespace:inutralia;assembly=inutralia"
xmlns:artina="clr-namespace:UXDivers.Artina.Shared;assembly=UXDivers.Artina.Shared" xmlns:artina="clr-namespace:UXDivers.Artina.Shared;assembly=UXDivers.Artina.Shared"
x:Class="inutralia.Views.ShoppingListView" x:Class="inutralia.Views.ShoppingListView"
x:Name="shoppingListView" x:Name="shoppingListView"
Title="Lista de la Compra" Title="Lista de la Compra"
BackgroundColor="{DynamicResource BasePageColor}"> BackgroundColor="{DynamicResource BasePageColor}">
<ContentPage.ToolbarItems> <ContentPage.ToolbarItems>
<ToolbarItem Icon="icon_info.png" artina:Theme.Name="Info" Clicked="InfoButtonClicked"/> <ToolbarItem Icon="icon_info.png" artina:Theme.Name="Info" Clicked="InfoButtonClicked"/>
</ContentPage.ToolbarItems> </ContentPage.ToolbarItems>
...@@ -16,14 +14,11 @@ ...@@ -16,14 +14,11 @@
<ContentPage.Content> <ContentPage.Content>
<StackLayout Margin="10,10" VerticalOptions="FillAndExpand" IsVisible="{Binding isBusy}"> <StackLayout Margin="10,10" VerticalOptions="FillAndExpand" IsVisible="{Binding isBusy}">
<ListView <ListView ItemsSource="{Binding ShoppingList}"
ItemsSource="{Binding ShoppingList}"
ItemTapped="ItemTapped" ItemTapped="ItemTapped"
IsPullToRefreshEnabled="True" IsPullToRefreshEnabled="True"
RefreshCommand="{Binding RefreshShoppingListCommand}" RefreshCommand="{Binding RefreshShoppingListCommand}"
IsRefreshing="{Binding IsBusy, Mode=OneWay}" IsRefreshing="{Binding IsBusy, Mode=OneWay}"
BackgroundColor="Transparent" BackgroundColor="Transparent"
Footer="" Footer=""
CachingStrategy="RecycleElement" CachingStrategy="RecycleElement"
...@@ -39,18 +34,18 @@ ...@@ -39,18 +34,18 @@
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<StackLayout > <StackLayout >
<Label Text="{Binding Text}" FontSize="Medium"/> <Label Text="{Binding Text}" FontSize="Medium"/>
</StackLayout> </StackLayout>
<Switch IsToggled="{Binding Select}" Grid.Column="1" /> <Switch IsToggled="{Binding Select}" Grid.Column="1" />
</Grid> </Grid>
</ViewCell> </ViewCell>
<!--<SwitchCell Text="{Binding Text}" On="{Binding Select}"/>-->
</DataTemplate> </DataTemplate>
</ListView.ItemTemplate> </ListView.ItemTemplate>
</ListView> </ListView>
<StackLayout Orientation="Vertical" HorizontalOptions="FillAndExpand" > <StackLayout Orientation="Vertical" HorizontalOptions="FillAndExpand" >
<!--button 1--> <!--button 1-->
<artina:Button x:Name="addButton" <artina:Button x:Name="addButton"
...@@ -71,7 +66,6 @@ ...@@ -71,7 +66,6 @@
FontSize="Medium"/> FontSize="Medium"/>
</StackLayout> </StackLayout>
<StackLayout Orientation="Horizontal"> <StackLayout Orientation="Horizontal">
<!--button 2--> <!--button 2-->
<artina:Button x:Name="deleteButton" <artina:Button x:Name="deleteButton"
...@@ -91,8 +85,6 @@ ...@@ -91,8 +85,6 @@
Text="Borrar todos" Text="Borrar todos"
FontSize="Small"/> FontSize="Small"/>
</StackLayout> </StackLayout>
<!--<BoxView Style="{ DynamicResource ThemeShowCaseHorizontalRuleStyle }" />-->
</StackLayout> </StackLayout>
</ContentPage.Content> </ContentPage.Content>
</ContentPage> </ContentPage>
\ No newline at end of file
...@@ -15,6 +15,7 @@ namespace inutralia.Views ...@@ -15,6 +15,7 @@ namespace inutralia.Views
InitializeComponent(); InitializeComponent();
BindingContext = new ShoppingListViewModel(); BindingContext = new ShoppingListViewModel();
} }
protected override async void OnAppearing() protected override async void OnAppearing()
{ {
base.OnAppearing(); base.OnAppearing();
...@@ -28,7 +29,6 @@ namespace inutralia.Views ...@@ -28,7 +29,6 @@ namespace inutralia.Views
private async void InfoButtonClicked(object sender, EventArgs e) => await PopupNavigation.PushAsync(new InfoPopup()); private async void InfoButtonClicked(object sender, EventArgs e) => await PopupNavigation.PushAsync(new InfoPopup());
async void OnAddButtonClicked(object sender, EventArgs e) async void OnAddButtonClicked(object sender, EventArgs e)
{ {
var addingre = new ModalAddShoppingList() var addingre = new ModalAddShoppingList()
...@@ -49,17 +49,17 @@ namespace inutralia.Views ...@@ -49,17 +49,17 @@ namespace inutralia.Views
async void OnDeleteButtonClicked(object sender, EventArgs e) async void OnDeleteButtonClicked(object sender, EventArgs e)
{ {
if(await DisplayAlert("Está a punto de borrar uno o varios ingredientes.", "¿Desea continuar?", "Aceptar", "Cancelar") ) if (await DisplayAlert("Está a punto de borrar uno o varios ingredientes.", "¿Desea continuar?", "Aceptar", "Cancelar"))
{ {
await ViewModel.DeleteSelected (); await ViewModel.DeleteSelected();
} //endif } //endif
} }
async void OnDeleteAllButtonClicked(object sender, EventArgs e) async void OnDeleteAllButtonClicked(object sender, EventArgs e)
{ {
if(await DisplayAlert("Está a punto de borrar todos los ingredientes.", "¿Desea continuar?", "Aceptar", "Cancelar") ) if (await DisplayAlert("Está a punto de borrar todos los ingredientes.", "¿Desea continuar?", "Aceptar", "Cancelar"))
{ {
await ViewModel.DeleteAll (); await ViewModel.DeleteAll();
} }
} }
} }
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ContentView <ContentView xmlns="http://xamarin.com/schemas/2014/forms"
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:inutralia;assembly=inutralia"
xmlns:ffimageloading="clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms"
x:Class="inutralia.Views.TrivialGameItemTemplate" x:Class="inutralia.Views.TrivialGameItemTemplate"
x:Name="TrivialGameItemTemplate" x:Name="TrivialGameItemTemplate"
BackgroundColor="White"> BackgroundColor="White">
<Grid <Grid HorizontalOptions="Fill" VerticalOptions="Fill" Padding="8,8,8,8">
HorizontalOptions="Fill"
VerticalOptions="Fill"
Padding="8,8,8,8">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
...@@ -23,17 +18,8 @@ ...@@ -23,17 +18,8 @@
</Grid.RowDefinitions> </Grid.RowDefinitions>
<!-- Datos --> <!-- Datos -->
<Label Grid.Row="1" <Label Grid.Row="1" Grid.Column="0" Text="{Binding StartDate}" XAlign="Center"/>
Grid.Column="0" <Label Grid.Row="1" Grid.Column="1" Text="{Binding Progress}" XAlign="Center"/>
Text="{Binding StartDate}" <Label Grid.Row="1" Grid.Column="2" Text="{Binding Score}" XAlign="Center"/>
XAlign="Center"/>
<Label Grid.Row="1"
Grid.Column="1"
Text="{Binding Progress}"
XAlign="Center"/>
<Label Grid.Row="1"
Grid.Column="2"
Text="{Binding Score}"
XAlign="Center"/>
</Grid> </Grid>
</ContentView> </ContentView>
using System;
using System.Collections.Generic;
using Xamarin.Forms; using Xamarin.Forms;
namespace inutralia.Views namespace inutralia.Views
{ {
public partial class TrivialGameItemTemplate : ContentView public partial class TrivialGameItemTemplate : ContentView
{ {
public TrivialGameItemTemplate () public TrivialGameItemTemplate()
{ {
InitializeComponent (); InitializeComponent();
} }
} }
} }
......
...@@ -10,23 +10,45 @@ ...@@ -10,23 +10,45 @@
<StackLayout Padding="8,8,8,8"> <StackLayout Padding="8,8,8,8">
<Label Text="{Binding Question.Text}" HorizontalOptions="Start" /> <Label Text="{Binding Question.Text}" HorizontalOptions="Start" />
<StackLayout Orientation="Horizontal" HorizontalOptions="FillAndExpand"> <StackLayout Orientation="Horizontal" HorizontalOptions="FillAndExpand">
<Label Text=" { x:Static local:IoniciconsFont.CheckmarkCircled }" IsVisible="{Binding IsCorrect}" Margin="26,0,26,0" HorizontalOptions="Start" TextColor="Green" Style="{StaticResource FontIcon}" FontSize="Small" YAlign="Center" XAlign="Start"> <Label Text=" { x:Static local:IoniciconsFont.CheckmarkCircled }"
IsVisible="{Binding IsCorrect}"
Margin="26,0,26,0"
HorizontalOptions="Start"
TextColor="Green"
Style="{StaticResource FontIcon}"
FontSize="Small"
YAlign="Center"
XAlign="Start">
<Label.FontSize> <Label.FontSize>
<OnIdiom x:TypeArguments="x:Double" <OnIdiom x:TypeArguments="x:Double"
Phone="12" Phone="12"
Tablet="20"/> Tablet="20"/>
</Label.FontSize> </Label.FontSize>
</Label> </Label>
<Label Text=" { x:Static local:IoniciconsFont.CloseCircled }" IsVisible="{Binding IsNotCorrect}" Margin="26,0,26,0" HorizontalOptions="Start" TextColor="Red" Style="{StaticResource FontIcon}" FontSize="Small" YAlign="Center" XAlign="Start">
<Label Text=" { x:Static local:IoniciconsFont.CloseCircled }"
IsVisible="{Binding IsNotCorrect}"
Margin="26,0,26,0"
HorizontalOptions="Start"
TextColor="Red"
Style="{StaticResource FontIcon}"
FontSize="Small"
YAlign="Center"
XAlign="Start">
<Label.FontSize> <Label.FontSize>
<OnIdiom x:TypeArguments="x:Double" <OnIdiom x:TypeArguments="x:Double"
Phone="12" Phone="12"
Tablet="20"/> Tablet="20"/>
</Label.FontSize> </Label.FontSize>
</Label> </Label>
<Label Text="{Binding Answer}" HorizontalOptions="Start" YAlign="Center" /> <Label Text="{Binding Answer}" HorizontalOptions="Start" YAlign="Center" />
</StackLayout> </StackLayout>
<StackLayout IsVisible="{Binding IsNotCorrect}" Orientation="Horizontal" HorizontalOptions="FillAndExpand"> <StackLayout IsVisible="{Binding IsNotCorrect}" Orientation="Horizontal" HorizontalOptions="FillAndExpand">
<Label Text=" { x:Static local:IoniciconsFont.CheckmarkCircled }" Margin="26,0,26,0" HorizontalOptions="Start" TextColor="Green" Style="{StaticResource FontIcon}" FontSize="Small" YAlign="Center" XAlign="Start"> <Label Text=" { x:Static local:IoniciconsFont.CheckmarkCircled }" Margin="26,0,26,0" HorizontalOptions="Start" TextColor="Green" Style="{StaticResource FontIcon}" FontSize="Small" YAlign="Center" XAlign="Start">
<Label.FontSize> <Label.FontSize>
...@@ -35,8 +57,9 @@ ...@@ -35,8 +57,9 @@
Tablet="20"/> Tablet="20"/>
</Label.FontSize> </Label.FontSize>
</Label> </Label>
<Label Text="{Binding ValidAnswer}" HorizontalOptions="Start" YAlign="Center" /> <Label Text="{Binding ValidAnswer}" HorizontalOptions="Start" YAlign="Center" />
</StackLayout> </StackLayout>
</StackLayout> </StackLayout>
</ContentView> </ContentView>
using System;
using System.Collections.Generic;
using Xamarin.Forms; using Xamarin.Forms;
namespace inutralia.Views namespace inutralia.Views
{ {
public partial class TrivialGameResultTemplate : ContentView public partial class TrivialGameResultTemplate : ContentView
{ {
public TrivialGameResultTemplate () public TrivialGameResultTemplate()
{ {
InitializeComponent (); InitializeComponent();
} }
} }
} }
......
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" <ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:inutralia;assembly=inutralia"
xmlns:ffimageloading="clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms" xmlns:ffimageloading="clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms"
xmlns:views="clr-namespace:inutralia.Views;assembly=inutralia" xmlns:views="clr-namespace:inutralia.Views;assembly=inutralia"
x:Class="inutralia.Views.TrivialGameView" x:Class="inutralia.Views.TrivialGameView"
Title="{Binding Title}" Title="{Binding Title}">
>
<!-- Contenedor principal --> <!-- Contenedor principal -->
<StackLayout VerticalOptions="FillAndExpand"> <StackLayout VerticalOptions="FillAndExpand">
...@@ -14,8 +13,7 @@ ...@@ -14,8 +13,7 @@
<StackLayout VerticalOptions="Fill" IsVisible="{Binding IsNotComplete}"> <StackLayout VerticalOptions="Fill" IsVisible="{Binding IsNotComplete}">
<!-- MAIN IMAGE --> <!-- MAIN IMAGE -->
<ffimageloading:CachedImage <ffimageloading:CachedImage x:Name="img"
x:Name="img"
Source="{ Binding CurrentQuestion.Image }" Source="{ Binding CurrentQuestion.Image }"
Aspect="AspectFit" Aspect="AspectFit"
BackgroundColor="Black" BackgroundColor="Black"
...@@ -29,8 +27,7 @@ ...@@ -29,8 +27,7 @@
HorizontalTextAlignment="Center" HorizontalTextAlignment="Center"
Text="{Binding CurrentQuestion.Text}" Text="{Binding CurrentQuestion.Text}"
BackgroundColor="{ DynamicResource ComplementColor }" BackgroundColor="{ DynamicResource ComplementColor }"
TextColor="{DynamicResource CustomNavBarTextColor }" TextColor="{DynamicResource CustomNavBarTextColor }" />
/>
<!-- Opciones --> <!-- Opciones -->
<ListView SeparatorVisibility="Default" <ListView SeparatorVisibility="Default"
...@@ -40,8 +37,8 @@ ...@@ -40,8 +37,8 @@
VerticalOptions="EndAndExpand" VerticalOptions="EndAndExpand"
ItemTapped="ItemTapped" ItemTapped="ItemTapped"
HasUnevenRows="True" HasUnevenRows="True"
x:Name="listOptions"> x:Name="listOptions">
<ListView.ItemTemplate> <ListView.ItemTemplate>
<DataTemplate> <DataTemplate>
<ViewCell> <ViewCell>
...@@ -51,7 +48,6 @@ ...@@ -51,7 +48,6 @@
</StackLayout> </StackLayout>
</ContentView> </ContentView>
</ViewCell> </ViewCell>
</DataTemplate> </DataTemplate>
</ListView.ItemTemplate> </ListView.ItemTemplate>
</ListView> </ListView>
...@@ -59,13 +55,14 @@ ...@@ -59,13 +55,14 @@
<!-- Contenedor resultado (visible cuando la partida ha terminado) --> <!-- Contenedor resultado (visible cuando la partida ha terminado) -->
<StackLayout VerticalOptions="FillAndExpand" IsVisible="{Binding IsComplete}" Padding="8,8,8,8" Margin="8,8,8,8"> <StackLayout VerticalOptions="FillAndExpand" IsVisible="{Binding IsComplete}" Padding="8,8,8,8" Margin="8,8,8,8">
<!--titulo campos de cada partida--> <!--titulo campos de cada partida-->
<StackLayout Orientation="Horizontal" HorizontalOptions="FillAndExpand" BackgroundColor="{DynamicResource ComplementColor}" Padding="8,8,8,8" Margin="0,20,0,0" Grid.Row="1"> <StackLayout Orientation="Horizontal" HorizontalOptions="FillAndExpand" BackgroundColor="{DynamicResource ComplementColor}" Padding="8,8,8,8" Margin="0,20,0,0" Grid.Row="1">
<Label Text="Fecha" HorizontalOptions="CenterAndExpand" TextColor="{DynamicResource CustomNavBarTextColor}" /> <Label Text="Fecha" HorizontalOptions="CenterAndExpand" TextColor="{DynamicResource CustomNavBarTextColor}" />
<Label Text="Respuestas" HorizontalOptions="CenterAndExpand" TextColor="{DynamicResource CustomNavBarTextColor}" /> <Label Text="Respuestas" HorizontalOptions="CenterAndExpand" TextColor="{DynamicResource CustomNavBarTextColor}" />
<Label Text="Puntuación" HorizontalOptions="CenterAndExpand" TextColor="{DynamicResource CustomNavBarTextColor}" /> <Label Text="Puntuación" HorizontalOptions="CenterAndExpand" TextColor="{DynamicResource CustomNavBarTextColor}" />
</StackLayout> </StackLayout>
<!-- Resumen --> <!-- Resumen -->
<views:TrivialGameItemTemplate BindingContext="{Binding Game}" /> <views:TrivialGameItemTemplate BindingContext="{Binding Game}" />
...@@ -82,6 +79,7 @@ ...@@ -82,6 +79,7 @@
ItemTapped="Results_ItemTapped" ItemTapped="Results_ItemTapped"
HasUnevenRows="True" HasUnevenRows="True"
x:Name="listResults"> x:Name="listResults">
<ListView.ItemTemplate> <ListView.ItemTemplate>
<DataTemplate> <DataTemplate>
<ViewCell> <ViewCell>
......
using inutralia.ViewModels; using inutralia.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Xamarin.Forms; using Xamarin.Forms;
using Xamarin.Forms.Xaml; using Xamarin.Forms.Xaml;
namespace inutralia.Views namespace inutralia.Views
{ {
[XamlCompilation (XamlCompilationOptions.Compile)] [XamlCompilation(XamlCompilationOptions.Compile)]
public partial class TrivialGameView : ContentPage public partial class TrivialGameView : ContentPage
{ {
protected TrivialGameViewModel ViewModel => BindingContext as TrivialGameViewModel; protected TrivialGameViewModel ViewModel => BindingContext as TrivialGameViewModel;
public TrivialGameView () public TrivialGameView()
{ {
InitializeComponent (); InitializeComponent();
} }
async Task ItemTapped (object sender, ItemTappedEventArgs e) async Task ItemTapped(object sender, ItemTappedEventArgs e)
{ {
// Obtiene el índice de la respuesta seleccionada // Obtiene el índice de la respuesta seleccionada
var index = ((ListView) sender).ItemsSource.Cast<object> ().ToList ().IndexOf (e.Item); var index = ((ListView)sender).ItemsSource.Cast<object>().ToList().IndexOf(e.Item);
// Deselecciona el item para que no le cambie el color de fondo // Deselecciona el item para que no le cambie el color de fondo
((ListView) sender).SelectedItem = null; ((ListView)sender).SelectedItem = null;
await ViewModel.Answer (index); await ViewModel.Answer(index);
} }
private void Results_ItemTapped (object sender, ItemTappedEventArgs e) private void Results_ItemTapped(object sender, ItemTappedEventArgs e)
{ {
// Deselecciona el item para que no le cambie el color de fondo // Deselecciona el item para que no le cambie el color de fondo
((ListView) sender).SelectedItem = null; ((ListView)sender).SelectedItem = null;
} }
} }
} }
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
Title="Trivial"> Title="Trivial">
<ContentPage.Content> <ContentPage.Content>
<Grid VerticalOptions="FillAndExpand" Padding="20,20,20,20" > <Grid VerticalOptions="FillAndExpand" Padding="20,20,20,20" >
<Grid.RowDefinitions> <Grid.RowDefinitions>
...@@ -21,15 +20,13 @@ ...@@ -21,15 +20,13 @@
<!--PARTIDAS--> <!--PARTIDAS-->
<StackLayout Orientation="Vertical" HorizontalOptions="Fill" BackgroundColor="{DynamicResource ComplementColor}" Padding="8,8,8,8" Grid.Row="0" Margin="0,5,0,0"> <StackLayout Orientation="Vertical" HorizontalOptions="Fill" BackgroundColor="{DynamicResource ComplementColor}" Padding="8,8,8,8" Grid.Row="0" Margin="0,5,0,0">
<Label Text="PARTIDAS" HorizontalOptions="Center" TextColor="{DynamicResource CustomNavBarTextColor}" /> <Label Text="PARTIDAS" HorizontalOptions="Center" TextColor="{DynamicResource CustomNavBarTextColor}" />
</StackLayout> </StackLayout>
<!--titulo campos de cada partida--> <!--titulo campos de cada partida-->
<StackLayout Orientation="Horizontal" HorizontalOptions="FillAndExpand" BackgroundColor="#FF62b9ae" Padding="8,8,8,8" Margin="0,5,0,0" Grid.Row="1"> <StackLayout Orientation="Horizontal" HorizontalOptions="FillAndExpand" BackgroundColor="#FF62b9ae" Padding="8,8,8,8" Margin="0,5,0,0" Grid.Row="1">
<Label Text="Fecha" HorizontalOptions="CenterAndExpand" TextColor="{DynamicResource CustomNavBarTextColor}" /> <Label Text="Fecha" HorizontalOptions="CenterAndExpand" TextColor="{DynamicResource CustomNavBarTextColor}" />
<Label Text="Respuestas" IsVisible="{Binding IsCorrect}" HorizontalOptions="CenterAndExpand" TextColor="{DynamicResource CustomNavBarTextColor}" /> <Label Text="Respuestas" IsVisible="{Binding IsCorrect}" HorizontalOptions="CenterAndExpand" TextColor="{DynamicResource CustomNavBarTextColor}" />
<Label Text="Puntuación" IsVisible="{Binding IsCorrect}" HorizontalOptions="CenterAndExpand" TextColor="{DynamicResource CustomNavBarTextColor}" /> <Label Text="Puntuación" IsVisible="{Binding IsCorrect}" HorizontalOptions="CenterAndExpand" TextColor="{DynamicResource CustomNavBarTextColor}" />
</StackLayout> </StackLayout>
<ListView Grid.Row="2" <ListView Grid.Row="2"
...@@ -38,15 +35,10 @@ ...@@ -38,15 +35,10 @@
SeparatorVisibility="None" SeparatorVisibility="None"
SeparatorColor="{ DynamicResource ListViewSeparatorColor }" SeparatorColor="{ DynamicResource ListViewSeparatorColor }"
ItemsSource="{Binding Games}" ItemsSource="{Binding Games}"
ItemTapped="ItemTapped" ItemTapped="ItemTapped"
HasUnevenRows="True" HasUnevenRows="True"
x:Name="listGames"> x:Name="listGames">
<ListView.RowHeight>
<!--<OnIdiom x:TypeArguments="x:Int32"
Phone="80"
Tablet="120"/>-->
</ListView.RowHeight>
<ListView.ItemTemplate> <ListView.ItemTemplate>
<DataTemplate> <DataTemplate>
<ViewCell> <ViewCell>
...@@ -73,6 +65,5 @@ ...@@ -73,6 +65,5 @@
PortraitTablet=Fill, PortraitTablet=Fill,
LandscapeTablet=Center }"/> LandscapeTablet=Center }"/>
</Grid> </Grid>
</ContentPage.Content> </ContentPage.Content>
</ContentPage> </ContentPage>
\ No newline at end of file
using inutralia.Models; using inutralia.Models;
using inutralia.ViewModels; using inutralia.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms; using Xamarin.Forms;
using Xamarin.Forms.Xaml; using Xamarin.Forms.Xaml;
namespace inutralia.Views namespace inutralia.Views
{ {
[XamlCompilation (XamlCompilationOptions.Compile)] [XamlCompilation(XamlCompilationOptions.Compile)]
public partial class TrivialListView : ContentPage public partial class TrivialListView : ContentPage
{ {
protected TrivialListViewModel ViewModel => BindingContext as TrivialListViewModel; protected TrivialListViewModel ViewModel => BindingContext as TrivialListViewModel;
public TrivialListView () public TrivialListView()
{ {
InitializeComponent (); InitializeComponent();
BindingContext = new TrivialListViewModel (); BindingContext = new TrivialListViewModel();
} }
/// <summary> /// <summary>
/// Método llamado cada vez que una página pasa a ser visible /// Método llamado cada vez que una página pasa a ser visible
/// </summary> /// </summary>
protected override async void OnAppearing () protected override async void OnAppearing()
{ {
base.OnAppearing (); base.OnAppearing();
// Le decimos al ViewModel que realice la primera carga del listado // Le decimos al ViewModel que realice la primera carga del listado
await ViewModel.RefreshList (); await ViewModel.RefreshList();
} }
/// <summary> /// <summary>
...@@ -39,20 +33,19 @@ namespace inutralia.Views ...@@ -39,20 +33,19 @@ namespace inutralia.Views
/// </summary> /// </summary>
/// <param name="sender">La ListView</param> /// <param name="sender">La ListView</param>
/// <param name="e">Argumentos del evento</param> /// <param name="e">Argumentos del evento</param>
void ItemTapped (object sender, ItemTappedEventArgs e) void ItemTapped(object sender, ItemTappedEventArgs e)
{ {
// e.Item apunta a la partida seleccionada. A partir de ella se crea su ViewModel // e.Item apunta a la partida seleccionada. A partir de ella se crea su ViewModel
// y con él se crea la página de detalle y se navega a ella // y con él se crea la página de detalle y se navega a ella
Navigation.PushAsync ( Navigation.PushAsync(
new TrivialGameView () new TrivialGameView()
{ {
BindingContext = new TrivialGameViewModel((TrivialGame) e.Item) BindingContext = new TrivialGameViewModel((TrivialGame)e.Item)
} }
); );
// Deselecciona el item para que no le cambie el color de fondo // Deselecciona el item para que no le cambie el color de fondo
((ListView) sender).SelectedItem = null; ((ListView)sender).SelectedItem = null;
} }
} }
} }
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
<StackLayout VerticalOptions="FillAndExpand"> <StackLayout VerticalOptions="FillAndExpand">
<ActivityIndicator HorizontalOptions="FillAndExpand" IsRunning="{Binding IsBusy}" IsVisible="{Binding IsBusy}" /> <ActivityIndicator HorizontalOptions="FillAndExpand" IsRunning="{Binding IsBusy}" IsVisible="{Binding IsBusy}" />
<Label Text="Danos dos segundos estámos cargando tu menú personalizado..." <Label Text="Danos dos segundos estámos cargando tu menú personalizado..."
VerticalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand"
VerticalTextAlignment="Center" VerticalTextAlignment="Center"
...@@ -17,7 +18,6 @@ ...@@ -17,7 +18,6 @@
TextColor="{DynamicResource AccentColor}" TextColor="{DynamicResource AccentColor}"
IsVisible="{Binding IsBusy}"/> IsVisible="{Binding IsBusy}"/>
<!-- MAIN CONTAINER --> <!-- MAIN CONTAINER -->
<Grid IsVisible="{Binding IsNotBusy}" ColumnSpacing="0" RowSpacing="10" Padding="20,20,20,20" HorizontalOptions="Fill" VerticalOptions="FillAndExpand"> <Grid IsVisible="{Binding IsNotBusy}" ColumnSpacing="0" RowSpacing="10" Padding="20,20,20,20" HorizontalOptions="Fill" VerticalOptions="FillAndExpand">
...@@ -29,9 +29,11 @@ ...@@ -29,9 +29,11 @@
Tablet="80"/> Tablet="80"/>
</RowDefinition.Height> </RowDefinition.Height>
</RowDefinition> </RowDefinition>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
<RowDefinition> <RowDefinition>
<RowDefinition.Height> <RowDefinition.Height>
<OnIdiom x:TypeArguments="GridLength" <OnIdiom x:TypeArguments="GridLength"
Phone="50" Phone="50"
...@@ -118,13 +120,7 @@ ...@@ -118,13 +120,7 @@
<!-- Primero Comida --> <!-- Primero Comida -->
<Label Text="1º" <Label Text="1º" Grid.Row="1" Grid.Column="0" Grid.RowSpan="2" VerticalOptions="Center" Margin="10,0,0,0">
Grid.Row="1"
Grid.Column="0"
Grid.RowSpan="2"
VerticalOptions="Center"
Margin="10,0,0,0">
<Label.FontSize> <Label.FontSize>
<OnIdiom x:TypeArguments="x:Double" <OnIdiom x:TypeArguments="x:Double"
Phone="18" Phone="18"
...@@ -134,31 +130,17 @@ ...@@ -134,31 +130,17 @@
<!-- Primero Comida - Opc 1 --> <!-- Primero Comida - Opc 1 -->
<Label HorizontalOptions="Fill" <Label HorizontalOptions="Fill" VerticalOptions="Fill" Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="3">
VerticalOptions="Fill"
Grid.Row="1"
Grid.Column="1"
Grid.ColumnSpan="3">
<Label.GestureRecognizers> <Label.GestureRecognizers>
<TapGestureRecognizer <TapGestureRecognizer Command="{Binding ShowRecipeCommand}"
Command="{Binding ShowRecipeCommand}"
CommandParameter="{Binding CurrentDay.LunchFirst[0]}" CommandParameter="{Binding CurrentDay.LunchFirst[0]}"
NumberOfTapsRequired="1" /> NumberOfTapsRequired="1" />
</Label.GestureRecognizers> </Label.GestureRecognizers>
</Label> </Label>
<Switch Grid.Row="1" <Switch Grid.Row="1" Grid.Column="1" IsToggled="{Binding IsLunchFirstOption1}" VerticalOptions="Center"/>
Grid.Column="1"
IsToggled="{Binding IsLunchFirstOption1}"
VerticalOptions="Center"/>
<Label Text="{Binding CurrentDay.LunchFirst[0].ShortName}"
Grid.Row="1"
Grid.Column="2"
VerticalOptions="Center"
HorizontalOptions="CenterAndExpand">
<Label Text="{Binding CurrentDay.LunchFirst[0].ShortName}" Grid.Row="1" Grid.Column="2" VerticalOptions="Center" HorizontalOptions="CenterAndExpand">
<Label.FontSize> <Label.FontSize>
<OnIdiom x:TypeArguments="x:Double" <OnIdiom x:TypeArguments="x:Double"
Phone="12" Phone="12"
...@@ -166,8 +148,7 @@ ...@@ -166,8 +148,7 @@
</Label.FontSize> </Label.FontSize>
<Label.GestureRecognizers> <Label.GestureRecognizers>
<TapGestureRecognizer <TapGestureRecognizer Command="{Binding ShowRecipeCommand}"
Command="{Binding ShowRecipeCommand}"
CommandParameter="{Binding CurrentDay.LunchFirst[0]}" CommandParameter="{Binding CurrentDay.LunchFirst[0]}"
NumberOfTapsRequired="1" /> NumberOfTapsRequired="1" />
</Label.GestureRecognizers> </Label.GestureRecognizers>
...@@ -188,8 +169,7 @@ ...@@ -188,8 +169,7 @@
</Label.FontSize> </Label.FontSize>
<Label.GestureRecognizers> <Label.GestureRecognizers>
<TapGestureRecognizer <TapGestureRecognizer Command="{Binding ShowRecipeCommand}"
Command="{Binding ShowRecipeCommand}"
CommandParameter="{Binding CurrentDay.LunchFirst[0]}" CommandParameter="{Binding CurrentDay.LunchFirst[0]}"
NumberOfTapsRequired="1" /> NumberOfTapsRequired="1" />
</Label.GestureRecognizers> </Label.GestureRecognizers>
...@@ -197,25 +177,15 @@ ...@@ -197,25 +177,15 @@
<!-- Primero Comida - Opc 2 --> <!-- Primero Comida - Opc 2 -->
<Label HorizontalOptions="Fill" <Label HorizontalOptions="Fill" VerticalOptions="Fill" Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="3" >
VerticalOptions="Fill"
Grid.Row="2"
Grid.Column="1"
Grid.ColumnSpan="3" >
<Label.GestureRecognizers> <Label.GestureRecognizers>
<TapGestureRecognizer <TapGestureRecognizer Command="{Binding ShowRecipeCommand}"
Command="{Binding ShowRecipeCommand}"
CommandParameter="{Binding CurrentDay.LunchFirst[1]}" CommandParameter="{Binding CurrentDay.LunchFirst[1]}"
NumberOfTapsRequired="1" /> NumberOfTapsRequired="1" />
</Label.GestureRecognizers> </Label.GestureRecognizers>
</Label> </Label>
<Switch Grid.Row="2" <Switch Grid.Row="2" Grid.Column="1" IsToggled="{Binding IsLunchFirstOption2}" VerticalOptions="Center"/>
Grid.Column="1"
IsToggled="{Binding IsLunchFirstOption2}"
VerticalOptions="Center"/>
<Label Text="{Binding CurrentDay.LunchFirst[1].ShortName}" <Label Text="{Binding CurrentDay.LunchFirst[1].ShortName}"
Grid.Row="2" Grid.Row="2"
...@@ -230,8 +200,7 @@ ...@@ -230,8 +200,7 @@
</Label.FontSize> </Label.FontSize>
<Label.GestureRecognizers> <Label.GestureRecognizers>
<TapGestureRecognizer <TapGestureRecognizer Command="{Binding ShowRecipeCommand}"
Command="{Binding ShowRecipeCommand}"
CommandParameter="{Binding CurrentDay.LunchFirst[1]}" CommandParameter="{Binding CurrentDay.LunchFirst[1]}"
NumberOfTapsRequired="1" /> NumberOfTapsRequired="1" />
</Label.GestureRecognizers> </Label.GestureRecognizers>
...@@ -252,8 +221,7 @@ ...@@ -252,8 +221,7 @@
</Label.FontSize> </Label.FontSize>
<Label.GestureRecognizers> <Label.GestureRecognizers>
<TapGestureRecognizer <TapGestureRecognizer Command="{Binding ShowRecipeCommand}"
Command="{Binding ShowRecipeCommand}"
CommandParameter="{Binding CurrentDay.LunchFirst[1]}" CommandParameter="{Binding CurrentDay.LunchFirst[1]}"
NumberOfTapsRequired="1" /> NumberOfTapsRequired="1" />
</Label.GestureRecognizers> </Label.GestureRecognizers>
...@@ -261,13 +229,7 @@ ...@@ -261,13 +229,7 @@
<!-- Segundo Comida --> <!-- Segundo Comida -->
<Label Text="2º" <Label Text="2º" Grid.Row="3" Grid.Column="0" Grid.RowSpan="2" VerticalOptions="Center" Margin="10,0,0,0">
Grid.Row="3"
Grid.Column="0"
Grid.RowSpan="2"
VerticalOptions="Center"
Margin="10,0,0,0">
<Label.FontSize> <Label.FontSize>
<OnIdiom x:TypeArguments="x:Double" <OnIdiom x:TypeArguments="x:Double"
Phone="15" Phone="15"
...@@ -277,15 +239,9 @@ ...@@ -277,15 +239,9 @@
<!-- Segundo Comida - Opc 1 --> <!-- Segundo Comida - Opc 1 -->
<Label HorizontalOptions="Fill" <Label HorizontalOptions="Fill" VerticalOptions="Fill" Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="3">
VerticalOptions="Fill"
Grid.Row="3"
Grid.Column="1"
Grid.ColumnSpan="3">
<Label.GestureRecognizers> <Label.GestureRecognizers>
<TapGestureRecognizer <TapGestureRecognizer Command="{Binding ShowRecipeCommand}"
Command="{Binding ShowRecipeCommand}"
CommandParameter="{Binding CurrentDay.LunchSecond[0]}" CommandParameter="{Binding CurrentDay.LunchSecond[0]}"
NumberOfTapsRequired="1" /> NumberOfTapsRequired="1" />
</Label.GestureRecognizers> </Label.GestureRecognizers>
...@@ -304,17 +260,13 @@ ...@@ -304,17 +260,13 @@
</Label.FontSize> </Label.FontSize>
<Label.GestureRecognizers> <Label.GestureRecognizers>
<TapGestureRecognizer <TapGestureRecognizer Command="{Binding ShowRecipeCommand}"
Command="{Binding ShowRecipeCommand}"
CommandParameter="{Binding CurrentDay.LunchSecond[0]}" CommandParameter="{Binding CurrentDay.LunchSecond[0]}"
NumberOfTapsRequired="1" /> NumberOfTapsRequired="1" />
</Label.GestureRecognizers> </Label.GestureRecognizers>
</Label> </Label>
<Switch Grid.Row="3" <Switch Grid.Row="3" Grid.Column="1" IsToggled="{Binding IsLunchSecondOption1}" VerticalOptions="Center"/>
Grid.Column="1"
IsToggled="{Binding IsLunchSecondOption1}"
VerticalOptions="Center"/>
<Label Text="{ x:Static app:IoniciconsFont.Search }" <Label Text="{ x:Static app:IoniciconsFont.Search }"
Style="{StaticResource FontIcon}" Style="{StaticResource FontIcon}"
...@@ -331,8 +283,7 @@ ...@@ -331,8 +283,7 @@
</Label.FontSize> </Label.FontSize>
<Label.GestureRecognizers> <Label.GestureRecognizers>
<TapGestureRecognizer <TapGestureRecognizer Command="{Binding ShowRecipeCommand}"
Command="{Binding ShowRecipeCommand}"
CommandParameter="{Binding CurrentDay.LunchSecond[0]}" CommandParameter="{Binding CurrentDay.LunchSecond[0]}"
NumberOfTapsRequired="1" /> NumberOfTapsRequired="1" />
</Label.GestureRecognizers> </Label.GestureRecognizers>
...@@ -340,25 +291,15 @@ ...@@ -340,25 +291,15 @@
<!-- Segundo Comida - Opc 2 --> <!-- Segundo Comida - Opc 2 -->
<Label HorizontalOptions="Fill" <Label HorizontalOptions="Fill" VerticalOptions="Fill" Grid.Row="4" Grid.Column="1" Grid.ColumnSpan="3">
VerticalOptions="Fill"
Grid.Row="4"
Grid.Column="1"
Grid.ColumnSpan="3">
<Label.GestureRecognizers> <Label.GestureRecognizers>
<TapGestureRecognizer <TapGestureRecognizer Command="{Binding ShowRecipeCommand}"
Command="{Binding ShowRecipeCommand}"
CommandParameter="{Binding CurrentDay.LunchSecond[1]}" CommandParameter="{Binding CurrentDay.LunchSecond[1]}"
NumberOfTapsRequired="1" /> NumberOfTapsRequired="1" />
</Label.GestureRecognizers> </Label.GestureRecognizers>
</Label> </Label>
<Switch Grid.Row="4" <Switch Grid.Row="4" Grid.Column="1" IsToggled="{Binding IsLunchSecondOption2}" VerticalOptions="Center"/>
Grid.Column="1"
IsToggled="{Binding IsLunchSecondOption2}"
VerticalOptions="Center"/>
<Label Text="{Binding CurrentDay.LunchSecond[1].ShortName}" <Label Text="{Binding CurrentDay.LunchSecond[1].ShortName}"
Grid.Row="4" Grid.Row="4"
...@@ -373,8 +314,7 @@ ...@@ -373,8 +314,7 @@
</Label.FontSize> </Label.FontSize>
<Label.GestureRecognizers> <Label.GestureRecognizers>
<TapGestureRecognizer <TapGestureRecognizer Command="{Binding ShowRecipeCommand}"
Command="{Binding ShowRecipeCommand}"
CommandParameter="{Binding CurrentDay.LunchSecond[1]}" CommandParameter="{Binding CurrentDay.LunchSecond[1]}"
NumberOfTapsRequired="1" /> NumberOfTapsRequired="1" />
</Label.GestureRecognizers> </Label.GestureRecognizers>
...@@ -395,8 +335,7 @@ ...@@ -395,8 +335,7 @@
</Label.FontSize> </Label.FontSize>
<Label.GestureRecognizers> <Label.GestureRecognizers>
<TapGestureRecognizer <TapGestureRecognizer Command="{Binding ShowRecipeCommand}"
Command="{Binding ShowRecipeCommand}"
CommandParameter="{Binding CurrentDay.LunchSecond[1]}" CommandParameter="{Binding CurrentDay.LunchSecond[1]}"
NumberOfTapsRequired="1" /> NumberOfTapsRequired="1" />
</Label.GestureRecognizers> </Label.GestureRecognizers>
...@@ -475,13 +414,7 @@ ...@@ -475,13 +414,7 @@
<!-- Primero Cena --> <!-- Primero Cena -->
<Label Text="1º" <Label Text="1º" Grid.Row="1" Grid.Column="0" Grid.RowSpan="2" VerticalOptions="Center" Margin="10,0,0,0">
Grid.Row="1"
Grid.Column="0"
Grid.RowSpan="2"
VerticalOptions="Center"
Margin="10,0,0,0">
<Label.FontSize> <Label.FontSize>
<OnIdiom x:TypeArguments="x:Double" <OnIdiom x:TypeArguments="x:Double"
Phone="15" Phone="15"
...@@ -491,11 +424,7 @@ ...@@ -491,11 +424,7 @@
<!-- Primero Cena - Opc 1 --> <!-- Primero Cena - Opc 1 -->
<Label HorizontalOptions="Fill" <Label HorizontalOptions="Fill" VerticalOptions="Fill" Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="3">
VerticalOptions="Fill"
Grid.Row="1"
Grid.Column="1"
Grid.ColumnSpan="3">
<Label.FontSize> <Label.FontSize>
<OnIdiom x:TypeArguments="x:Double" <OnIdiom x:TypeArguments="x:Double"
...@@ -504,17 +433,13 @@ ...@@ -504,17 +433,13 @@
</Label.FontSize> </Label.FontSize>
<Label.GestureRecognizers> <Label.GestureRecognizers>
<TapGestureRecognizer <TapGestureRecognizer Command="{Binding ShowRecipeCommand}"
Command="{Binding ShowRecipeCommand}"
CommandParameter="{Binding CurrentDay.DinnerFirst[0]}" CommandParameter="{Binding CurrentDay.DinnerFirst[0]}"
NumberOfTapsRequired="1" /> NumberOfTapsRequired="1" />
</Label.GestureRecognizers> </Label.GestureRecognizers>
</Label> </Label>
<Switch Grid.Row="1" <Switch Grid.Row="1" Grid.Column="1" IsToggled="{Binding IsDinnerFirstOption1}" VerticalOptions="Center"/>
Grid.Column="1"
IsToggled="{Binding IsDinnerFirstOption1}"
VerticalOptions="Center"/>
<Label Text="{Binding CurrentDay.DinnerFirst[0].ShortName}" <Label Text="{Binding CurrentDay.DinnerFirst[0].ShortName}"
Grid.Row="1" Grid.Row="1"
...@@ -529,8 +454,7 @@ ...@@ -529,8 +454,7 @@
</Label.FontSize> </Label.FontSize>
<Label.GestureRecognizers> <Label.GestureRecognizers>
<TapGestureRecognizer <TapGestureRecognizer Command="{Binding ShowRecipeCommand}"
Command="{Binding ShowRecipeCommand}"
CommandParameter="{Binding CurrentDay.DinnerFirst[0]}" CommandParameter="{Binding CurrentDay.DinnerFirst[0]}"
NumberOfTapsRequired="1" /> NumberOfTapsRequired="1" />
</Label.GestureRecognizers> </Label.GestureRecognizers>
...@@ -551,8 +475,7 @@ ...@@ -551,8 +475,7 @@
</Label.FontSize> </Label.FontSize>
<Label.GestureRecognizers> <Label.GestureRecognizers>
<TapGestureRecognizer <TapGestureRecognizer Command="{Binding ShowRecipeCommand}"
Command="{Binding ShowRecipeCommand}"
CommandParameter="{Binding CurrentDay.DinnerFirst[0]}" CommandParameter="{Binding CurrentDay.DinnerFirst[0]}"
NumberOfTapsRequired="1" /> NumberOfTapsRequired="1" />
</Label.GestureRecognizers> </Label.GestureRecognizers>
...@@ -560,31 +483,17 @@ ...@@ -560,31 +483,17 @@
<!-- Primero Cena - Opc 2 --> <!-- Primero Cena - Opc 2 -->
<Label HorizontalOptions="Fill" <Label HorizontalOptions="Fill" VerticalOptions="Fill" Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="3">
VerticalOptions="Fill"
Grid.Row="2"
Grid.Column="1"
Grid.ColumnSpan="3">
<Label.GestureRecognizers> <Label.GestureRecognizers>
<TapGestureRecognizer <TapGestureRecognizer Command="{Binding ShowRecipeCommand}"
Command="{Binding ShowRecipeCommand}"
CommandParameter="{Binding CurrentDay.DinnerFirst[1]}" CommandParameter="{Binding CurrentDay.DinnerFirst[1]}"
NumberOfTapsRequired="1" /> NumberOfTapsRequired="1" />
</Label.GestureRecognizers> </Label.GestureRecognizers>
</Label> </Label>
<Switch Grid.Row="2" <Switch Grid.Row="2" Grid.Column="1" IsToggled="{Binding IsDinnerFirstOption2}" VerticalOptions="Center"/>
Grid.Column="1"
IsToggled="{Binding IsDinnerFirstOption2}"
VerticalOptions="Center"/>
<Label Text="{Binding CurrentDay.DinnerFirst[1].ShortName}"
Grid.Row="2"
Grid.Column="2"
VerticalOptions="Center"
HorizontalOptions="CenterAndExpand">
<Label Text="{Binding CurrentDay.DinnerFirst[1].ShortName}" Grid.Row="2" Grid.Column="2" VerticalOptions="Center" HorizontalOptions="CenterAndExpand">
<Label.FontSize> <Label.FontSize>
<OnIdiom x:TypeArguments="x:Double" <OnIdiom x:TypeArguments="x:Double"
Phone="12" Phone="12"
...@@ -592,8 +501,7 @@ ...@@ -592,8 +501,7 @@
</Label.FontSize> </Label.FontSize>
<Label.GestureRecognizers> <Label.GestureRecognizers>
<TapGestureRecognizer <TapGestureRecognizer Command="{Binding ShowRecipeCommand}"
Command="{Binding ShowRecipeCommand}"
CommandParameter="{Binding CurrentDay.DinnerFirst[1]}" CommandParameter="{Binding CurrentDay.DinnerFirst[1]}"
NumberOfTapsRequired="1" /> NumberOfTapsRequired="1" />
</Label.GestureRecognizers> </Label.GestureRecognizers>
...@@ -614,8 +522,7 @@ ...@@ -614,8 +522,7 @@
</Label.FontSize> </Label.FontSize>
<Label.GestureRecognizers> <Label.GestureRecognizers>
<TapGestureRecognizer <TapGestureRecognizer Command="{Binding ShowRecipeCommand}"
Command="{Binding ShowRecipeCommand}"
CommandParameter="{Binding CurrentDay.DinnerFirst[1]}" CommandParameter="{Binding CurrentDay.DinnerFirst[1]}"
NumberOfTapsRequired="1" /> NumberOfTapsRequired="1" />
</Label.GestureRecognizers> </Label.GestureRecognizers>
...@@ -623,13 +530,7 @@ ...@@ -623,13 +530,7 @@
<!-- Segundo Cena --> <!-- Segundo Cena -->
<Label Text="2º" <Label Text="2º" Grid.Row="3" Grid.Column="0" Grid.RowSpan="2" VerticalOptions="Center" Margin="10,0,0,0">
Grid.Row="3"
Grid.Column="0"
Grid.RowSpan="2"
VerticalOptions="Center"
Margin="10,0,0,0">
<Label.FontSize> <Label.FontSize>
<OnIdiom x:TypeArguments="x:Double" <OnIdiom x:TypeArguments="x:Double"
Phone="15" Phone="15"
...@@ -639,31 +540,17 @@ ...@@ -639,31 +540,17 @@
<!-- Segundo Cena - Opc 1 --> <!-- Segundo Cena - Opc 1 -->
<Label HorizontalOptions="Fill" <Label HorizontalOptions="Fill" VerticalOptions="Fill" Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="3">
VerticalOptions="Fill"
Grid.Row="3"
Grid.Column="1"
Grid.ColumnSpan="3">
<Label.GestureRecognizers> <Label.GestureRecognizers>
<TapGestureRecognizer <TapGestureRecognizer Command="{Binding ShowRecipeCommand}"
Command="{Binding ShowRecipeCommand}"
CommandParameter="{Binding CurrentDay.DinnerSecond[0]}" CommandParameter="{Binding CurrentDay.DinnerSecond[0]}"
NumberOfTapsRequired="1" /> NumberOfTapsRequired="1" />
</Label.GestureRecognizers> </Label.GestureRecognizers>
</Label> </Label>
<Switch Grid.Row="3" <Switch Grid.Row="3" Grid.Column="1" IsToggled="{Binding IsDinnerSecondOption1}" VerticalOptions="Center"/>
Grid.Column="1"
IsToggled="{Binding IsDinnerSecondOption1}"
VerticalOptions="Center"/>
<Label Text="{Binding CurrentDay.DinnerSecond[0].ShortName}"
Grid.Row="3"
Grid.Column="2"
VerticalOptions="Center"
HorizontalOptions="CenterAndExpand">
<Label Text="{Binding CurrentDay.DinnerSecond[0].ShortName}" Grid.Row="3" Grid.Column="2" VerticalOptions="Center" HorizontalOptions="CenterAndExpand">
<Label.FontSize> <Label.FontSize>
<OnIdiom x:TypeArguments="x:Double" <OnIdiom x:TypeArguments="x:Double"
Phone="12" Phone="12"
...@@ -671,8 +558,7 @@ ...@@ -671,8 +558,7 @@
</Label.FontSize> </Label.FontSize>
<Label.GestureRecognizers> <Label.GestureRecognizers>
<TapGestureRecognizer <TapGestureRecognizer Command="{Binding ShowRecipeCommand}"
Command="{Binding ShowRecipeCommand}"
CommandParameter="{Binding CurrentDay.DinnerSecond[0]}" CommandParameter="{Binding CurrentDay.DinnerSecond[0]}"
NumberOfTapsRequired="1" /> NumberOfTapsRequired="1" />
</Label.GestureRecognizers> </Label.GestureRecognizers>
...@@ -693,8 +579,7 @@ ...@@ -693,8 +579,7 @@
</Label.FontSize> </Label.FontSize>
<Label.GestureRecognizers> <Label.GestureRecognizers>
<TapGestureRecognizer <TapGestureRecognizer Command="{Binding ShowRecipeCommand}"
Command="{Binding ShowRecipeCommand}"
CommandParameter="{Binding CurrentDay.DinnerSecond[0]}" CommandParameter="{Binding CurrentDay.DinnerSecond[0]}"
NumberOfTapsRequired="1" /> NumberOfTapsRequired="1" />
</Label.GestureRecognizers> </Label.GestureRecognizers>
...@@ -702,31 +587,17 @@ ...@@ -702,31 +587,17 @@
<!-- Segundo Cena - Opc 2 --> <!-- Segundo Cena - Opc 2 -->
<Label HorizontalOptions="Fill" <Label HorizontalOptions="Fill" VerticalOptions="Fill" Grid.Row="4" Grid.Column="1" Grid.ColumnSpan="3">
VerticalOptions="Fill"
Grid.Row="4"
Grid.Column="1"
Grid.ColumnSpan="3">
<Label.GestureRecognizers> <Label.GestureRecognizers>
<TapGestureRecognizer <TapGestureRecognizer Command="{Binding ShowRecipeCommand}"
Command="{Binding ShowRecipeCommand}"
CommandParameter="{Binding CurrentDay.DinnerSecond[1]}" CommandParameter="{Binding CurrentDay.DinnerSecond[1]}"
NumberOfTapsRequired="1" /> NumberOfTapsRequired="1" />
</Label.GestureRecognizers> </Label.GestureRecognizers>
</Label> </Label>
<Switch Grid.Row="4" <Switch Grid.Row="4" Grid.Column="1" IsToggled="{Binding IsDinnerSecondOption2}" VerticalOptions="Center"/>
Grid.Column="1"
IsToggled="{Binding IsDinnerSecondOption2}"
VerticalOptions="Center"/>
<Label Text="{Binding CurrentDay.DinnerSecond[1].ShortName}"
Grid.Row="4"
Grid.Column="2"
VerticalOptions="Center"
HorizontalOptions="CenterAndExpand">
<Label Text="{Binding CurrentDay.DinnerSecond[1].ShortName}" Grid.Row="4" Grid.Column="2" VerticalOptions="Center" HorizontalOptions="CenterAndExpand">
<Label.FontSize> <Label.FontSize>
<OnIdiom x:TypeArguments="x:Double" <OnIdiom x:TypeArguments="x:Double"
Phone="12" Phone="12"
...@@ -734,8 +605,7 @@ ...@@ -734,8 +605,7 @@
</Label.FontSize> </Label.FontSize>
<Label.GestureRecognizers> <Label.GestureRecognizers>
<TapGestureRecognizer <TapGestureRecognizer Command="{Binding ShowRecipeCommand}"
Command="{Binding ShowRecipeCommand}"
CommandParameter="{Binding CurrentDay.DinnerSecond[1]}" CommandParameter="{Binding CurrentDay.DinnerSecond[1]}"
NumberOfTapsRequired="1" /> NumberOfTapsRequired="1" />
</Label.GestureRecognizers> </Label.GestureRecognizers>
...@@ -756,8 +626,7 @@ ...@@ -756,8 +626,7 @@
</Label.FontSize> </Label.FontSize>
<Label.GestureRecognizers> <Label.GestureRecognizers>
<TapGestureRecognizer <TapGestureRecognizer Command="{Binding ShowRecipeCommand}"
Command="{Binding ShowRecipeCommand}"
CommandParameter="{Binding CurrentDay.DinnerSecond[1]}" CommandParameter="{Binding CurrentDay.DinnerSecond[1]}"
NumberOfTapsRequired="1" /> NumberOfTapsRequired="1" />
</Label.GestureRecognizers> </Label.GestureRecognizers>
......
using inutralia.Models; using inutralia.ViewModels;
using inutralia.ViewModels;
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms; using Xamarin.Forms;
using Xamarin.Forms.Xaml; using Xamarin.Forms.Xaml;
namespace inutralia.Views namespace inutralia.Views
{ {
[XamlCompilation (XamlCompilationOptions.Compile)] [XamlCompilation(XamlCompilationOptions.Compile)]
public partial class CustomMenuView : ContentPage public partial class CustomMenuView : ContentPage
{ {
protected CustomMenuViewModel ViewModel => BindingContext as CustomMenuViewModel; protected CustomMenuViewModel ViewModel => BindingContext as CustomMenuViewModel;
// Labels para los botónes de los días // Labels para los botónes de los días
private static readonly string [] DayNames = new [] private static readonly string[] DayNames = new[]
{ {
"L", "M", "X", "J", "V", "S", "D" "L", "M", "X", "J", "V", "S", "D"
}; };
// Constructor. Añade los botones de los días // Constructor. Añade los botones de los días
public CustomMenuView () public CustomMenuView()
{ {
InitializeComponent (); InitializeComponent();
BindingContext = new CustomMenuViewModel();
BindingContext = new CustomMenuViewModel ();
for (int i = 0; i < 7; i++) for (int i = 0; i < 7; i++)
{ {
var b = new UXDivers.Artina.Shared.Button var b = new UXDivers.Artina.Shared.Button
{ {
Style = Application.Current.Resources ["SquaredButtonStyle"] as Style, Style = Application.Current.Resources["SquaredButtonStyle"] as Style,
VerticalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand,
HorizontalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.Fill,
FontSize = 22, FontSize = 22,
Text = DayNames [i], Text = DayNames[i],
}; };
b.Clicked += OnDayClicked; b.Clicked += OnDayClicked;
buttonList.Children.Add (b, i, 0); buttonList.Children.Add(b, i, 0);
} }
} }
...@@ -50,9 +43,9 @@ namespace inutralia.Views ...@@ -50,9 +43,9 @@ namespace inutralia.Views
/// <summary> /// <summary>
/// Llamado cuando cambia el contexto asociado /// Llamado cuando cambia el contexto asociado
/// </summary> /// </summary>
protected override void OnBindingContextChanged () protected override void OnBindingContextChanged()
{ {
base.OnBindingContextChanged (); base.OnBindingContextChanged();
// Le decimos al ViewModel que queremos ser informados cuando cambie // Le decimos al ViewModel que queremos ser informados cuando cambie
// cualquiera de sus propiedades // cualquiera de sus propiedades
...@@ -62,45 +55,45 @@ namespace inutralia.Views ...@@ -62,45 +55,45 @@ namespace inutralia.Views
/// <summary> /// <summary>
/// Llamado cuando cambia el valor de una propiedad del ViewModel /// Llamado cuando cambia el valor de una propiedad del ViewModel
/// </summary> /// </summary>
private void OnViewModelPropertyChanged (object sender, System.ComponentModel.PropertyChangedEventArgs e) private void OnViewModelPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{ {
// Cuando cambia el índice del día seleccionado, cambiamos el color de los botones // Cuando cambia el índice del día seleccionado, cambiamos el color de los botones
if (e.PropertyName == "Index") if (e.PropertyName == "Index")
{ {
// Coger el botón seleccionado // Coger el botón seleccionado
View but = buttonList.Children [ViewModel.Index] as View; View but = buttonList.Children[ViewModel.Index] as View;
// Poner el fondo del seleccionado a ComplementColor y el resto a AccentColor // Poner el fondo del seleccionado a ComplementColor y el resto a AccentColor
foreach (var b in buttonList.Children) foreach (var b in buttonList.Children)
b.BackgroundColor = (Color) Application.Current.Resources [b == but ? "ComplementColor" : "BaseTextColor"]; b.BackgroundColor = (Color)Application.Current.Resources[b == but ? "ComplementColor" : "BaseTextColor"];
} //endif } //endif
} }
/// <summary> /// <summary>
/// Llamado cuando se pulsa un botón de día /// Llamado cuando se pulsa un botón de día
/// </summary> /// </summary>
private void OnDayClicked (object sender, EventArgs e) private void OnDayClicked(object sender, EventArgs e)
{ {
// Cambiar el índice del día seleccionado al del botón // Cambiar el índice del día seleccionado al del botón
ViewModel.Index = buttonList.Children.IndexOf (sender as View); ViewModel.Index = buttonList.Children.IndexOf(sender as View);
} }
/// <summary> /// <summary>
/// Llamado cuando esta vista se muestra /// Llamado cuando esta vista se muestra
/// </summary> /// </summary>
protected override async void OnAppearing () protected override async void OnAppearing()
{ {
base.OnAppearing (); base.OnAppearing();
// Decirle al ViewModel que refresque sus datos // Decirle al ViewModel que refresque sus datos
await ViewModel.LoadData (); await ViewModel.LoadData();
} }
protected override async void OnDisappearing () protected override async void OnDisappearing()
{ {
base.OnDisappearing (); base.OnDisappearing();
await ViewModel.UpdateShoppingListAsync (); await ViewModel.UpdateShoppingListAsync();
} }
} }
} }
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
<StackLayout VerticalOptions="FillAndExpand"> <StackLayout VerticalOptions="FillAndExpand">
<ActivityIndicator HorizontalOptions="FillAndExpand" IsRunning="{Binding IsBusy}" IsVisible="{Binding IsBusy}" /> <ActivityIndicator HorizontalOptions="FillAndExpand" IsRunning="{Binding IsBusy}" IsVisible="{Binding IsBusy}" />
<Label Text="Danos dos segundos estámos cargando tu menú personalizado..." <Label Text="Danos dos segundos estámos cargando tu menú personalizado..."
VerticalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand"
VerticalTextAlignment="Center" VerticalTextAlignment="Center"
...@@ -17,7 +18,6 @@ ...@@ -17,7 +18,6 @@
TextColor="{DynamicResource AccentColor}" TextColor="{DynamicResource AccentColor}"
IsVisible="{Binding IsBusy}"/> IsVisible="{Binding IsBusy}"/>
<!-- MAIN CONTAINER --> <!-- MAIN CONTAINER -->
<Grid IsVisible="{Binding IsNotBusy}" ColumnSpacing="0" RowSpacing="10" Padding="20,20,20,20" HorizontalOptions="Fill" VerticalOptions="FillAndExpand"> <Grid IsVisible="{Binding IsNotBusy}" ColumnSpacing="0" RowSpacing="10" Padding="20,20,20,20" HorizontalOptions="Fill" VerticalOptions="FillAndExpand">
<Grid.RowDefinitions> <Grid.RowDefinitions>
...@@ -119,14 +119,7 @@ ...@@ -119,14 +119,7 @@
<!-- Primero Comida --> <!-- Primero Comida -->
<Label <Label Text="1º" Grid.Row="1" Grid.Column="0" VerticalOptions="Center" HorizontalOptions="Start" Margin="10,0,0,0">
Text="1º"
Grid.Row="1"
Grid.Column="0"
VerticalOptions="Center"
HorizontalOptions="Start"
Margin="10,0,0,0">
<Label.FontSize> <Label.FontSize>
<OnIdiom x:TypeArguments="x:Double" <OnIdiom x:TypeArguments="x:Double"
Phone="23" Phone="23"
...@@ -134,8 +127,7 @@ ...@@ -134,8 +127,7 @@
</Label.FontSize> </Label.FontSize>
<Label.GestureRecognizers> <Label.GestureRecognizers>
<TapGestureRecognizer <TapGestureRecognizer Command="{Binding ShowRecipeCommand}"
Command="{Binding ShowRecipeCommand}"
CommandParameter="{Binding CurrentDay.LunchFirst[0]}" CommandParameter="{Binding CurrentDay.LunchFirst[0]}"
NumberOfTapsRequired="1" /> NumberOfTapsRequired="1" />
</Label.GestureRecognizers> </Label.GestureRecognizers>
...@@ -155,15 +147,13 @@ ...@@ -155,15 +147,13 @@
</Label.FontSize> </Label.FontSize>
<Label.GestureRecognizers> <Label.GestureRecognizers>
<TapGestureRecognizer <TapGestureRecognizer Command="{Binding ShowRecipeCommand}"
Command="{Binding ShowRecipeCommand}"
CommandParameter="{Binding CurrentDay.LunchFirst[0]}" CommandParameter="{Binding CurrentDay.LunchFirst[0]}"
NumberOfTapsRequired="1" /> NumberOfTapsRequired="1" />
</Label.GestureRecognizers> </Label.GestureRecognizers>
</Label> </Label>
<Label <Label Text="{ x:Static app:IoniciconsFont.Search }"
Text="{ x:Static app:IoniciconsFont.Search }"
Style="{StaticResource FontIcon}" Style="{StaticResource FontIcon}"
Grid.Row="1" Grid.Row="1"
Grid.Column="2" Grid.Column="2"
...@@ -178,23 +168,15 @@ ...@@ -178,23 +168,15 @@
</Label.FontSize> </Label.FontSize>
<Label.GestureRecognizers> <Label.GestureRecognizers>
<TapGestureRecognizer <TapGestureRecognizer Command="{Binding ShowRecipeCommand}"
Command="{Binding ShowRecipeCommand}"
CommandParameter="{Binding CurrentDay.LunchFirst[0]}" CommandParameter="{Binding CurrentDay.LunchFirst[0]}"
NumberOfTapsRequired="1" /> NumberOfTapsRequired="1" />
</Label.GestureRecognizers> </Label.GestureRecognizers>
</Label> </Label>
<!-- Segundo Comida --> <!-- Segundo Comida -->
<Label Text="2º" <Label Text="2º" Grid.Row="2" Grid.Column="0" VerticalOptions="Center" HorizontalOptions="Start" Margin="10,0,0,0">
Grid.Row="2"
Grid.Column="0"
VerticalOptions="Center"
HorizontalOptions="Start"
Margin="10,0,0,0">
<Label.FontSize> <Label.FontSize>
<OnIdiom x:TypeArguments="x:Double" <OnIdiom x:TypeArguments="x:Double"
Phone="23" Phone="23"
...@@ -202,8 +184,7 @@ ...@@ -202,8 +184,7 @@
</Label.FontSize> </Label.FontSize>
<Label.GestureRecognizers> <Label.GestureRecognizers>
<TapGestureRecognizer <TapGestureRecognizer Command="{Binding ShowRecipeCommand}"
Command="{Binding ShowRecipeCommand}"
CommandParameter="{Binding CurrentDay.LunchSecond[0]}" CommandParameter="{Binding CurrentDay.LunchSecond[0]}"
NumberOfTapsRequired="1" /> NumberOfTapsRequired="1" />
</Label.GestureRecognizers> </Label.GestureRecognizers>
...@@ -223,8 +204,7 @@ ...@@ -223,8 +204,7 @@
</Label.FontSize> </Label.FontSize>
<Label.GestureRecognizers> <Label.GestureRecognizers>
<TapGestureRecognizer <TapGestureRecognizer Command="{Binding ShowRecipeCommand}"
Command="{Binding ShowRecipeCommand}"
CommandParameter="{Binding CurrentDay.LunchSecond[0]}" CommandParameter="{Binding CurrentDay.LunchSecond[0]}"
NumberOfTapsRequired="1" /> NumberOfTapsRequired="1" />
</Label.GestureRecognizers> </Label.GestureRecognizers>
...@@ -245,8 +225,7 @@ ...@@ -245,8 +225,7 @@
</Label.FontSize> </Label.FontSize>
<Label.GestureRecognizers> <Label.GestureRecognizers>
<TapGestureRecognizer <TapGestureRecognizer Command="{Binding ShowRecipeCommand}"
Command="{Binding ShowRecipeCommand}"
CommandParameter="{Binding CurrentDay.LunchSecond[0]}" CommandParameter="{Binding CurrentDay.LunchSecond[0]}"
NumberOfTapsRequired="1" /> NumberOfTapsRequired="1" />
</Label.GestureRecognizers> </Label.GestureRecognizers>
...@@ -320,14 +299,7 @@ ...@@ -320,14 +299,7 @@
<!-- Primero Cena --> <!-- Primero Cena -->
<Label <Label Text="1º" Grid.Row="1" Grid.Column="0" VerticalOptions="Center" HorizontalOptions="Start" Margin="10,0,0,0">
Text="1º"
Grid.Row="1"
Grid.Column="0"
VerticalOptions="Center"
HorizontalOptions="Start"
Margin="10,0,0,0">
<Label.FontSize> <Label.FontSize>
<OnIdiom x:TypeArguments="x:Double" <OnIdiom x:TypeArguments="x:Double"
Phone="23" Phone="23"
...@@ -335,15 +307,13 @@ ...@@ -335,15 +307,13 @@
</Label.FontSize> </Label.FontSize>
<Label.GestureRecognizers> <Label.GestureRecognizers>
<TapGestureRecognizer <TapGestureRecognizer Command="{Binding ShowRecipeCommand}"
Command="{Binding ShowRecipeCommand}"
CommandParameter="{Binding CurrentDay.DinnerFirst[0]}" CommandParameter="{Binding CurrentDay.DinnerFirst[0]}"
NumberOfTapsRequired="1" /> NumberOfTapsRequired="1" />
</Label.GestureRecognizers> </Label.GestureRecognizers>
</Label> </Label>
<Label <Label Text="{Binding CurrentDay.DinnerFirst[0].Name}"
Text="{Binding CurrentDay.DinnerFirst[0].Name}"
Grid.Row="1" Grid.Row="1"
Grid.Column="1" Grid.Column="1"
VerticalOptions="Center" VerticalOptions="Center"
...@@ -357,15 +327,13 @@ ...@@ -357,15 +327,13 @@
</Label.FontSize> </Label.FontSize>
<Label.GestureRecognizers> <Label.GestureRecognizers>
<TapGestureRecognizer <TapGestureRecognizer Command="{Binding ShowRecipeCommand}"
Command="{Binding ShowRecipeCommand}"
CommandParameter="{Binding CurrentDay.DinnerFirst[0]}" CommandParameter="{Binding CurrentDay.DinnerFirst[0]}"
NumberOfTapsRequired="1" /> NumberOfTapsRequired="1" />
</Label.GestureRecognizers> </Label.GestureRecognizers>
</Label> </Label>
<Label <Label Text="{ x:Static app:IoniciconsFont.Search }"
Text="{ x:Static app:IoniciconsFont.Search }"
Style="{StaticResource FontIcon}" Style="{StaticResource FontIcon}"
Grid.Row="1" Grid.Row="1"
Grid.Column="2" Grid.Column="2"
...@@ -380,8 +348,7 @@ ...@@ -380,8 +348,7 @@
</Label.FontSize> </Label.FontSize>
<Label.GestureRecognizers> <Label.GestureRecognizers>
<TapGestureRecognizer <TapGestureRecognizer Command="{Binding ShowRecipeCommand}"
Command="{Binding ShowRecipeCommand}"
CommandParameter="{Binding CurrentDay.DinnerFirst[0]}" CommandParameter="{Binding CurrentDay.DinnerFirst[0]}"
NumberOfTapsRequired="1" /> NumberOfTapsRequired="1" />
</Label.GestureRecognizers> </Label.GestureRecognizers>
...@@ -389,13 +356,7 @@ ...@@ -389,13 +356,7 @@
<!-- Segundo Cena --> <!-- Segundo Cena -->
<Label Text="2º" <Label Text="2º" Grid.Row="2" Grid.Column="0" VerticalOptions="Center" HorizontalOptions="Start" Margin="10,0,0,0">
Grid.Row="2"
Grid.Column="0"
VerticalOptions="Center"
HorizontalOptions="Start"
Margin="10,0,0,0">
<Label.FontSize> <Label.FontSize>
<OnIdiom x:TypeArguments="x:Double" <OnIdiom x:TypeArguments="x:Double"
Phone="23" Phone="23"
...@@ -403,8 +364,7 @@ ...@@ -403,8 +364,7 @@
</Label.FontSize> </Label.FontSize>
<Label.GestureRecognizers> <Label.GestureRecognizers>
<TapGestureRecognizer <TapGestureRecognizer Command="{Binding ShowRecipeCommand}"
Command="{Binding ShowRecipeCommand}"
CommandParameter="{Binding CurrentDay.DinnerSecond[0]}" CommandParameter="{Binding CurrentDay.DinnerSecond[0]}"
NumberOfTapsRequired="1" /> NumberOfTapsRequired="1" />
</Label.GestureRecognizers> </Label.GestureRecognizers>
...@@ -424,8 +384,7 @@ ...@@ -424,8 +384,7 @@
</Label.FontSize> </Label.FontSize>
<Label.GestureRecognizers> <Label.GestureRecognizers>
<TapGestureRecognizer <TapGestureRecognizer Command="{Binding ShowRecipeCommand}"
Command="{Binding ShowRecipeCommand}"
CommandParameter="{Binding CurrentDay.DinnerSecond[0]}" CommandParameter="{Binding CurrentDay.DinnerSecond[0]}"
NumberOfTapsRequired="1" /> NumberOfTapsRequired="1" />
</Label.GestureRecognizers> </Label.GestureRecognizers>
...@@ -446,8 +405,7 @@ ...@@ -446,8 +405,7 @@
</Label.FontSize> </Label.FontSize>
<Label.GestureRecognizers> <Label.GestureRecognizers>
<TapGestureRecognizer <TapGestureRecognizer Command="{Binding ShowRecipeCommand}"
Command="{Binding ShowRecipeCommand}"
CommandParameter="{Binding CurrentDay.DinnerSecond[0]}" CommandParameter="{Binding CurrentDay.DinnerSecond[0]}"
NumberOfTapsRequired="1" /> NumberOfTapsRequired="1" />
</Label.GestureRecognizers> </Label.GestureRecognizers>
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
using inutralia.ViewModels; using inutralia.ViewModels;
using Xamarin.Forms; using Xamarin.Forms;
namespace inutralia.Views namespace inutralia.Views
{ {
public partial class GenericDetailView : ContentPage public partial class GenericDetailView : ContentPage
...@@ -10,39 +9,39 @@ namespace inutralia.Views ...@@ -10,39 +9,39 @@ namespace inutralia.Views
protected GenericDetailViewModel ViewModel => BindingContext as GenericDetailViewModel; protected GenericDetailViewModel ViewModel => BindingContext as GenericDetailViewModel;
// Labels para los botónes de los días // Labels para los botónes de los días
private static readonly string [] DayNames = new [] private static readonly string[] DayNames = new[]
{ {
"L", "M", "X", "J", "V", "S", "D" "L", "M", "X", "J", "V", "S", "D"
}; };
// Constructor. Añade los botones de los días // Constructor. Añade los botones de los días
public GenericDetailView () public GenericDetailView()
{ {
InitializeComponent (); InitializeComponent();
for (int i = 0; i < 7; i++) for (int i = 0; i < 7; i++)
{ {
var b = new UXDivers.Artina.Shared.Button var b = new UXDivers.Artina.Shared.Button
{ {
Style = Application.Current.Resources ["SquaredButtonStyle"] as Style, Style = Application.Current.Resources["SquaredButtonStyle"] as Style,
VerticalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand,
HorizontalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.Fill,
FontSize = 22, FontSize = 22,
Text = DayNames [i], Text = DayNames[i],
}; };
b.Clicked += OnDayClicked; b.Clicked += OnDayClicked;
buttonList.Children.Add (b, i, 0); buttonList.Children.Add(b, i, 0);
} }
} }
/// <summary> /// <summary>
/// Llamado cuando cambia el contexto asociado /// Llamado cuando cambia el contexto asociado
/// </summary> /// </summary>
protected override void OnBindingContextChanged () protected override void OnBindingContextChanged()
{ {
base.OnBindingContextChanged (); base.OnBindingContextChanged();
// Le decimos al ViewModel que queremos ser informados cuando cambie // Le decimos al ViewModel que queremos ser informados cuando cambie
// cualquiera de sus propiedades // cualquiera de sus propiedades
...@@ -52,27 +51,27 @@ namespace inutralia.Views ...@@ -52,27 +51,27 @@ namespace inutralia.Views
/// <summary> /// <summary>
/// Llamado cuando cambia el valor de una propiedad del ViewModel /// Llamado cuando cambia el valor de una propiedad del ViewModel
/// </summary> /// </summary>
private void OnViewModelPropertyChanged (object sender, System.ComponentModel.PropertyChangedEventArgs e) private void OnViewModelPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{ {
// Cuando cambia el índice del día seleccionado, cambiamos el color de los botones // Cuando cambia el índice del día seleccionado, cambiamos el color de los botones
if(e.PropertyName == "Index") if (e.PropertyName == "Index")
{ {
// Coger el botón seleccionado // Coger el botón seleccionado
View but = buttonList.Children [ViewModel.Index] as View; View but = buttonList.Children[ViewModel.Index] as View;
// Poner el fondo del seleccionado a ComplementColor y el resto a AccentColor // Poner el fondo del seleccionado a ComplementColor y el resto a AccentColor
foreach (var b in buttonList.Children) foreach (var b in buttonList.Children)
b.BackgroundColor = (Color) Application.Current.Resources [b == but ? "ComplementColor" : "BaseTextColor"]; b.BackgroundColor = (Color)Application.Current.Resources[b == but ? "ComplementColor" : "BaseTextColor"];
} //endif } //endif
} }
/// <summary> /// <summary>
/// Llamado cuando se pulsa un botón de día /// Llamado cuando se pulsa un botón de día
/// </summary> /// </summary>
private void OnDayClicked (object sender, EventArgs e) private void OnDayClicked(object sender, EventArgs e)
{ {
// Cambiar el índice del día seleccionado al del botón // Cambiar el índice del día seleccionado al del botón
ViewModel.Index = buttonList.Children.IndexOf (sender as View); ViewModel.Index = buttonList.Children.IndexOf(sender as View);
} }
/// <summary> /// <summary>
...@@ -85,6 +84,5 @@ namespace inutralia.Views ...@@ -85,6 +84,5 @@ namespace inutralia.Views
// Decirle al ViewModel que refresque sus datos // Decirle al ViewModel que refresque sus datos
await ViewModel.RefreshData(); await ViewModel.RefreshData();
} }
} }
} }
...@@ -19,8 +19,7 @@ ...@@ -19,8 +19,7 @@
xmlns:artina="clr-namespace:UXDivers.Artina.Shared;assembly=UXDivers.Artina.Shared" xmlns:artina="clr-namespace:UXDivers.Artina.Shared;assembly=UXDivers.Artina.Shared"
x:Class="inutralia.Views.GenericListView" x:Class="inutralia.Views.GenericListView"
BackgroundColor="White" BackgroundColor="White"
Title="Menus Saludables" Title="Menus Saludables">
>
<StackLayout VerticalOptions="FillAndExpand"> <StackLayout VerticalOptions="FillAndExpand">
...@@ -31,14 +30,12 @@ ...@@ -31,14 +30,12 @@
--> -->
<ListView x:Name="ListView" <ListView x:Name="ListView"
ItemsSource="{Binding Generics}" ItemsSource="{Binding Generics}"
ItemTapped="ItemTapped" ItemTapped="ItemTapped"
VerticalOptions="FillAndExpand" VerticalOptions="FillAndExpand"
SeparatorVisibility="None" SeparatorVisibility="None"
SeparatorColor="Transparent" SeparatorColor="Transparent"
Footer="" Footer=""
BackgroundColor="Transparent" BackgroundColor="Transparent"
CachingStrategy="RecycleElement" CachingStrategy="RecycleElement"
HasUnevenRows="false"> HasUnevenRows="false">
...@@ -63,37 +60,28 @@ ...@@ -63,37 +60,28 @@
<ListView.ItemTemplate> <ListView.ItemTemplate>
<DataTemplate> <DataTemplate>
<ViewCell> <ViewCell>
<StackLayout <StackLayout BackgroundColor="{Binding . , Converter={StaticResource ListBgConverter}, ConverterParameter={x:Reference ListView} }"
BackgroundColor="{Binding . , Converter={StaticResource ListBgConverter}, ConverterParameter={x:Reference ListView} }"
Spacing="20" Spacing="20"
HorizontalOptions="FillAndExpand" HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand" VerticalOptions="FillAndExpand"
Orientation="Horizontal" > Orientation="Horizontal" >
<Grid <Grid BackgroundColor="#33000000" WidthRequest="80" HorizontalOptions="Start" VerticalOptions="FillAndExpand">
BackgroundColor="#33000000"
WidthRequest="80"
HorizontalOptions="Start"
VerticalOptions="FillAndExpand">
<Grid.WidthRequest> <Grid.WidthRequest>
<OnIdiom x:TypeArguments="x:Double" <OnIdiom x:TypeArguments="x:Double"
Phone="80" Phone="80"
Tablet="100"/> Tablet="100"/>
</Grid.WidthRequest> </Grid.WidthRequest>
<Label <Label Text="{ x:Static app:IoniciconsFont.IosListOutline }"
Text="{ x:Static app:IoniciconsFont.IosListOutline }"
FontSize="40" FontSize="40"
Style="{StaticResource FontIcon}" Style="{StaticResource FontIcon}"
HorizontalOptions="Center" HorizontalOptions="Center"
VerticalOptions="Center" VerticalOptions="Center"
TextColor="White" TextColor="White" />
/>
</Grid> </Grid>
<StackLayout VerticalOptions="Center" Spacing="2" > <StackLayout VerticalOptions="Center" Spacing="2" >
<Label Text="{Binding Title}" <Label Text="{Binding Title}"
FontSize="{artina:OnOrientationDouble FontSize="{artina:OnOrientationDouble
PortraitPhone=18, PortraitPhone=18,
...@@ -102,7 +90,6 @@ ...@@ -102,7 +90,6 @@
LandscapeTablet=30 }" LandscapeTablet=30 }"
TextColor="{ DynamicResource InverseTextColor }" /> TextColor="{ DynamicResource InverseTextColor }" />
</StackLayout> </StackLayout>
</StackLayout> </StackLayout>
</ViewCell> </ViewCell>
</DataTemplate> </DataTemplate>
......
...@@ -6,15 +6,13 @@ namespace inutralia.Views ...@@ -6,15 +6,13 @@ namespace inutralia.Views
{ {
public partial class GenericListView : ContentPage public partial class GenericListView : ContentPage
{ {
// Accesor al ViewModel // Accesor al ViewModel
protected GenericListViewModel ViewModel => BindingContext as GenericListViewModel; protected GenericListViewModel ViewModel => BindingContext as GenericListViewModel;
public GenericListView() public GenericListView()
{ {
InitializeComponent(); InitializeComponent();
BindingContext = new GenericListViewModel();
BindingContext = new GenericListViewModel ();
} }
/// <summary> /// <summary>
...@@ -48,6 +46,5 @@ namespace inutralia.Views ...@@ -48,6 +46,5 @@ namespace inutralia.Views
// Le decimos al ViewModel que realice la primera carga del listado // Le decimos al ViewModel que realice la primera carga del listado
await ViewModel.ExecuteLoadGenericsCommand(); await ViewModel.ExecuteLoadGenericsCommand();
} }
} }
} }
...@@ -4,13 +4,9 @@ ...@@ -4,13 +4,9 @@
x:Class="inutralia.Views.RecomendationView" x:Class="inutralia.Views.RecomendationView"
Title="Resto del día"> Title="Resto del día">
<WebView <WebView HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" x:Name="webview">
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand"
x:Name="webview">
<WebView.Source> <WebView.Source>
<HtmlWebViewSource Html="{Binding resume}}" /> <HtmlWebViewSource Html="{Binding resume}" />
</WebView.Source> </WebView.Source>
</WebView> </WebView>
</ContentPage> </ContentPage>
\ No newline at end of file
using System; using Xamarin.Forms;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
using Xamarin.Forms.Xaml; using Xamarin.Forms.Xaml;
namespace inutralia.Views namespace inutralia.Views
{ {
[XamlCompilation (XamlCompilationOptions.Compile)] [XamlCompilation(XamlCompilationOptions.Compile)]
public partial class RecomendationView : ContentPage public partial class RecomendationView : ContentPage
{ {
public RecomendationView () public RecomendationView()
{ {
InitializeComponent (); InitializeComponent();
} }
/// <summary> /// <summary>
...@@ -23,7 +17,6 @@ namespace inutralia.Views ...@@ -23,7 +17,6 @@ namespace inutralia.Views
protected override async void OnAppearing() protected override async void OnAppearing()
{ {
base.OnAppearing(); base.OnAppearing();
} }
} }
} }
...@@ -262,9 +262,7 @@ ...@@ -262,9 +262,7 @@
<None Include="SampleData.json" /> <None Include="SampleData.json" />
<None Include="Gorilla.json" /> <None Include="Gorilla.json" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup />
<Folder Include="Models\" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<EmbeddedResource Include="Views\Recipe\ItemList\RecipeItemTemplate.xaml"> <EmbeddedResource Include="Views\Recipe\ItemList\RecipeItemTemplate.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator> <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment