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
......
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