Commit 30de29e9 by Javier Piris

Refactor de la app de INutralia

parent 4ad2307a
......@@ -41,11 +41,14 @@ namespace inutralia
FFImageLoading.Forms.Platform.CachedImageRenderer.Init(true);
Forms.Init(this, bundle);
//Initializing GrialKit
GrialKit.Init(this, "inutralia.GrialLicense");
FormsHelper.ForceLoadingAssemblyContainingType(typeof(UXDivers.Effects.Effects));
LoadApplication(new App());}
LoadApplication(new App());
}
public override void OnConfigurationChanged(Android.Content.Res.Configuration newConfig)
{
......@@ -54,17 +57,17 @@ namespace inutralia
DeviceOrientationLocator.NotifyOrientationChanged();
}
public override void OnBackPressed ()
public override void OnBackPressed()
{
var md = Xamarin.Forms.Application.Current.MainPage as MasterDetailPage;
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
base.OnBackPressed ();
base.OnBackPressed();
}
}
}
......
......@@ -6,22 +6,24 @@ namespace inutralia
{
public class CustomFontLabelRenderer : ArtinaCustomFontLabelRenderer
{
private static readonly string[] CustomFontFamily = new []
private static readonly string[] CustomFontFamily = new[]
{
"grialshapes",
"FontAwesome",
"Ionicons"
};
private static readonly Tuple<FontAttributes, string>[][] CustomFontFamilyData = new [] {
new [] {
private static readonly Tuple<FontAttributes, string>[][] CustomFontFamilyData = new[] {
new []
{
new Tuple<FontAttributes, string>(FontAttributes.None, "grialshapes.ttf"),
new Tuple<FontAttributes, string>(FontAttributes.Bold, "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.Bold, "fontawesome-webfont.ttf"),
new Tuple<FontAttributes, string>(FontAttributes.Italic, "fontawesome-webfont.ttf")
......@@ -29,7 +31,8 @@ namespace inutralia
//*/
//*
new [] {
new []
{
new Tuple<FontAttributes, string>(FontAttributes.None, "ionicons.ttf"),
new Tuple<FontAttributes, string>(FontAttributes.Bold, "ionicons.ttf"),
new Tuple<FontAttributes, string>(FontAttributes.Italic, "ionicons.ttf")
......@@ -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];
for (int j = 0; j < fontFamilyData.Length; j++) {
for (int j = 0; j < fontFamilyData.Length; j++)
{
var data = fontFamilyData[j];
if (data.Item1 == attributes){
if (data.Item1 == attributes)
{
fontFileName = data.Item2;
return true;
......
<?xml version="1.0" encoding="utf-8" ?>
<resources>
<color name="primary">@color/AccentColor</color>
<color name="primary_dark">@color/AccentColor</color>
<color name="actionbar_tab_indicator">@color/AccentColor</color>
<!-- Theme -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
......@@ -34,31 +30,29 @@
<item name="android:colorActivatedHighlight">@color/AccentColor</item>
<item name="android:activatedBackgroundIndicator">@color/AccentColor</item>
<!-- Main theme colors -->
<!-- your app branding color for the app bar -->
<item name="android:colorPrimary">@color/primary</item>
<!-- darker variant for the status bar and contextual app bars
<item name="android:colorPrimaryDark">@color/primary_dark</item>-->
<!-- theme UI controls like checkboxes and text fields -->
<item name="android:colorAccent">@color/AccentColor</item>
<!-- TimePicker dialog-->
<item name="android:dialogTheme">@style/AppTheme.Dialog</item>
<item name="android:timePickerDialogTheme">@style/AppTheme.Dialog</item>
<item name="android:datePickerDialogTheme">@style/AppTheme.Dialog</item>
<item name="alertDialogTheme">@style/AppTheme.AlertDialog</item>
<item name="drawerArrowStyle">@style/AppTheme.DrawerArrowStyle</item>
<item name="android:windowContentTransitions">true</item>
<item name="android:windowAllowEnterTransitionOverlap">true</item>
<item name="android:windowAllowReturnTransitionOverlap">true</item>
<item name="android:windowSharedElementEnterTransition">@android:transition/move</item>
<item name="android:windowSharedElementExitTransition">@android:transition/move</item>
</style>
<!-- Adding animation to hamburguer icon, and overriding color to fix weird color change bug on app compat -->
......@@ -83,5 +77,4 @@
<item name="android:windowTitleStyle">@style/AppTheme.DialogTitleTextStyle</item>
<item name="android:windowNoTitle">true</item>
</style>
</resources>
<?xml version="1.0" encoding="utf-8" ?>
<resources>
<!-- Splash styles -->
<style name="Theme.Splash" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowBackground">@drawable/splash_drawable</item>
......@@ -37,17 +35,19 @@
<item name="android:colorActivatedHighlight">@color/AccentColor</item>
<item name="android:activatedBackgroundIndicator">@color/AccentColor</item>
<!-- Main theme colors -->
<!-- your app branding color for the app bar -->
<item name="android:colorPrimary">@color/AccentColor</item>
<!-- darker variant for the status bar and contextual app bars
<item name="android:colorPrimaryDark">@color/primary_dark</item>-->
<!-- theme UI controls like checkboxes and text fields -->
<item name="android:colorAccent">@color/AccentColor</item>
<!-- Dialog attributes -->
<item name="dialogTheme">@style/AppTheme.Dialog</item>
<!-- AlertDialog attributes -->
<item name="alertDialogTheme">@style/AppTheme.Dialog</item>
......@@ -56,7 +56,6 @@
<item name="android:showDividers">none</item>
<item name="android:divider">@null</item>
<item name="android:datePickerStyle">@style/Widget.AppTheme.Picker</item>
</style>
......@@ -76,7 +75,6 @@
<item name="android:borderlessButtonStyle">@style/Widget.AppTheme.Button.Borderless</item>
</style>
<style name="Widget.AppTheme.Button.Borderless" parent="@style/Widget.AppCompat.Button.Borderless">
<item name="android:textColor">#FF00FF</item>
<item name="android:textAppearance">@style/TextAppearance.AppTheme.DialogButton</item>
......@@ -84,7 +82,6 @@
<style name="Widget.AppTheme.TabLayout" parent="@style/Widget.Design.TabLayout">
<item name="tabSelectedTextColor">@color/AccentColor</item>
<item name="tabTextColor">@color/BaseTextColor</item>
</style>
......@@ -97,5 +94,4 @@
<style name="TextAppearance.AppTheme.DialogButton" parent="@style/TextAppearance.AppCompat.Title">
</style>
</resources>
using Newtonsoft.Json;
using System;
using System.ComponentModel;
using System.Globalization;
namespace inutralia.Models
{
[JsonObject(MemberSerialization.OptIn)]
[DataPath("article")]
public class Article : ObservableEntityData
......@@ -25,7 +22,6 @@ namespace inutralia.Models
[JsonProperty("published")]
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
return objectType == typeof(bool);
}
}
}
......@@ -7,10 +7,12 @@ namespace inutralia.Models
/// este atributo, se utilizará el nombre de la clase en minúsculas con una 's' al
/// final
/// </summary>
///
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)]
public class DataPathAttribute : Attribute
{
public DataPathAttribute ( string path)
public DataPathAttribute(string path)
{
DataPath = path;
}
......

using Newtonsoft.Json;
using Newtonsoft.Json;
using System.Collections.Generic;
namespace inutralia.Models
{
[JsonObject(MemberSerialization.OptIn)]
public class Day
{
......@@ -24,9 +21,6 @@ namespace inutralia.Models
[JsonProperty("dinnerSecond", Required = Required.Always)]
public IList<Recipe> DinnerSecond { get; set; }
public Day()
{
}
public Day() { }
}
}
using Newtonsoft.Json;
using System.ComponentModel;
using System;
namespace inutralia.Models
{
[JsonObject(MemberSerialization.OptIn)]
[DataPath("generic")]
public class Generic : MenuBase
{
[JsonProperty("ds", Required = Required.Always)]
public string Ds
{ get; set; }
public string Ds { get; set; }
public override string Title
{
get
{
return Ds;
}
get { return Ds; }
}
}
}

using Newtonsoft.Json;
using System.ComponentModel;
using System.Linq;
using System.Runtime.Serialization;
using Newtonsoft.Json;
namespace inutralia.Models
{
[JsonObject(MemberSerialization.OptIn)]
[DataPath("recipe")]
public class Ingredient : ObservableEntityData
......
using Newtonsoft.Json;
using System.ComponentModel;
using System;
namespace inutralia.Models
{
/// <summary>
/// Representa el menú personal guardado localmente
/// </summary>
[JsonObject (MemberSerialization.OptIn)]
[DataPath ("LocalMenu")]
[JsonObject(MemberSerialization.OptIn)]
[DataPath("LocalMenu")]
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>
/// Indice del plato seleccionado para un día
/// </summary>
public class MealSelections
{
[JsonProperty ("lf_idx", DefaultValueHandling = DefaultValueHandling.Populate)]
[JsonProperty("lf_idx", DefaultValueHandling = DefaultValueHandling.Populate)]
[DefaultValue(-1)]
public int LunchFirstIndex = -1;
[JsonProperty ("ls_idx", DefaultValueHandling = DefaultValueHandling.Populate)]
[DefaultValue (-1)]
[JsonProperty("ls_idx", DefaultValueHandling = DefaultValueHandling.Populate)]
[DefaultValue(-1)]
public int LunchSecondIndex = -1;
[JsonProperty ("df_idx", DefaultValueHandling = DefaultValueHandling.Populate)]
[DefaultValue (-1)]
[JsonProperty("df_idx", DefaultValueHandling = DefaultValueHandling.Populate)]
[DefaultValue(-1)]
public int DinnerFirstIndex = -1;
[JsonProperty ("ds_idx", DefaultValueHandling = DefaultValueHandling.Populate)]
[DefaultValue (-1)]
[JsonProperty("ds_idx", DefaultValueHandling = DefaultValueHandling.Populate)]
[DefaultValue(-1)]
public int DinnerSecondIndex = -1;
}
......@@ -40,7 +42,7 @@ namespace inutralia.Models
/// Platos seleccionados para cada uno de los días
/// </summary>
[JsonProperty("day_selections")]
public MealSelections [] DaySelections;
public MealSelections[] DaySelections;
/// <summary>
/// Identificador del último menú semanal recibido del servidor
......@@ -52,19 +54,18 @@ namespace inutralia.Models
/// Copia los datos del menú recibido del servidor
/// </summary>
/// <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ú
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
DaySelections = new MealSelections [7];
DaySelections = new MealSelections[7];
for (int i = 0; i < 7; i++)
DaySelections[i] = new MealSelections ();
DaySelections[i] = new MealSelections();
// Asignar último menú recibido
LastReceivedMenuId = menu.Id;
}
}
}
using Newtonsoft.Json;
using System.ComponentModel;
using System;
namespace inutralia.Models
{
[JsonObject(MemberSerialization.OptIn)]
[DataPath("menu")]
public class Menu : MenuBase
{
[JsonProperty("recomendation", DefaultValueHandling = DefaultValueHandling.Populate)]
[DefaultValue("")]
public string Recomendation
{ get; set; }
public string Recomendation { get; set; }
[JsonProperty("intro", DefaultValueHandling = DefaultValueHandling.Populate)]
[DefaultValue("")]
public string Intro
{ get; set; }
public string Intro { get; set; }
public override string Title
{
......@@ -26,8 +24,6 @@ namespace inutralia.Models
}
}
public Menu()
{
}
public Menu() { }
}
}
......@@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.ComponentModel;
namespace inutralia.Models
{
public abstract class MenuBase : ObservableEntityData
......@@ -10,52 +9,43 @@ namespace inutralia.Models
public abstract string Title { get; }
[JsonProperty("days")]
public IList<Day> Days
{ get; set; }
public IList<Day> Days { get; set; }
[JsonProperty("recBreakfastBase")]
[DefaultValue("")]
public string RecBreakfastBase
{ get; set; }
public string RecBreakfastBase { get; set; }
[JsonProperty("recBreakfastExt")]
[DefaultValue("")]
public string RecBreakfastExt
{ get; set; }
public string RecBreakfastExt { get; set; }
[JsonProperty("recMorningBase")]
[DefaultValue("")]
public string RecMorningBase
{ get; set; }
public string RecMorningBase { get; set; }
[JsonProperty("recMorningExt")]
[DefaultValue("")]
public string RecMorningExt
{ get; set; }
public string RecMorningExt { get; set; }
[JsonProperty("recAfternoonBase")]
[DefaultValue("")]
public string RecAfternoonBase
{ get; set; }
public string RecAfternoonBase { get; set; }
[JsonProperty("recAfternoonExt")]
[DefaultValue("")]
public string RecAfternoonExt
{ get; set; }
public string RecAfternoonExt { get; set; }
[JsonProperty("recGeneralBase")]
[DefaultValue("")]
public string RecGeneralBase
{ get; set; }
public string RecGeneralBase { get; set; }
[JsonProperty("recGeneralExt")]
[DefaultValue("")]
public string RecGeneralExt
{ get; set; }
public string RecGeneralExt { 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 +
"<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'> 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
/// </summary>
public class ObservableEntityData : ObservableObject, IIdentifiableEntity
{
public ObservableEntityData ()
public ObservableEntityData()
{
// Los identificadores negativos indican que la entidad es nueva y no
// existe por tanto en la base de datos
Id = -1;
}
[JsonProperty ("id", Required = Required.Always)]
[JsonProperty("id", Required = Required.Always)]
public int Id { get; set; }
}
}
using Newtonsoft.Json;
using System.ComponentModel;
using System.Linq;
using System.Runtime.Serialization;
namespace inutralia.Models
{
......@@ -27,8 +25,6 @@ namespace inutralia.Models
[JsonProperty("weight")]
[DefaultValue(0)]
//public int _Weight;
//public int Weight { get { return _Weight;} set { SetProperty(ref _Weight,value);} }
public int Weight { get; set; }
[JsonProperty("physical")]
......@@ -60,7 +56,6 @@ namespace inutralia.Models
[DefaultValue("0")]
public bool Lactose { get; set; }
[JsonProperty("diabetes")]
[JsonConverter(typeof(BoolConverter))]
[DefaultValue("0")]
......@@ -105,8 +100,6 @@ namespace inutralia.Models
[DefaultValue(0)]
public int Preference { get; set; }
public Profile()
{
}
public Profile() { }
}
}

using Newtonsoft.Json;
using Newtonsoft.Json;
using System.Collections.Generic;
namespace inutralia.Models
{
[JsonObject(MemberSerialization.OptIn)]
[DataPath("recipe")]
public class Recipe : ObservableEntityData
{
[JsonProperty("name", Required = Required.Always)]
public string Name { get; set; }
......@@ -54,9 +52,6 @@ namespace inutralia.Models
public string ExcerptQuotes => $"\"{Excerpt}\"";
public Recipe()
{
}
public Recipe() { }
}
}
......@@ -2,10 +2,10 @@
namespace inutralia.Models
{
[JsonObject (MemberSerialization.OptIn)]
[JsonObject(MemberSerialization.OptIn)]
public class RecipeOption : ObservableEntityData
{
[JsonProperty ("name", Required = Required.Always)]
[JsonProperty("name", Required = Required.Always)]
public string Name { get; set; }
public bool Selected { get; set; }
......
......@@ -3,8 +3,9 @@ using System.Collections.Generic;
namespace inutralia.Models
{
[JsonObject (MemberSerialization.OptIn)]
[DataPath ("options")]
[JsonObject(MemberSerialization.OptIn)]
[DataPath("options")]
public class RecipeOptionGroup : ObservableEntityData
{
private bool _isExpanded = false;
......@@ -22,10 +23,10 @@ namespace inutralia.Models
}
}
[JsonProperty ("name", Required = Required.Always)]
[JsonProperty("name", Required = Required.Always)]
public string Name { get; set; }
[JsonProperty ("options")]
[JsonProperty("options")]
public IList<RecipeOption> Options { get; set; }
}
}
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace inutralia.Models
{
[JsonObject(MemberSerialization.OptIn)]
[DataPath("shoppingList")]
public class ShoppingList : ObservableEntityData
{
[JsonProperty("text", Required = Required.Always)]
public string Text { get; set; }
......
......@@ -4,20 +4,21 @@ using System.Collections.Generic;
namespace inutralia.Models
{
[JsonObject (MemberSerialization.OptIn)]
[DataPath ("game")]
[JsonObject(MemberSerialization.OptIn)]
[DataPath("game")]
public class TrivialGame : ObservableEntityData
{
[JsonProperty ("start", Required = Required.Always)]
[JsonProperty("start", Required = Required.Always)]
public string StartDate { get; protected set; }
[JsonProperty ("finish", Required = Required.Always )]
[JsonProperty("finish", Required = Required.Always)]
public string FinishDate { get; protected set; }
[JsonProperty ("questions", Required = Required.Always)]
[JsonProperty("questions", Required = Required.Always)]
public IList<TrivialQuestion> Questions;
[JsonProperty ("answers", Required = Required.Always)]
[JsonProperty("answers", Required = Required.Always)]
public IList<int> Answers;
public string Progress => $"{Answers.Count} / {Questions.Count}";
......@@ -28,13 +29,13 @@ namespace inutralia.Models
{
// Si no está todo respondido, no hay puntuación
int n = Answers.Count;
if ( (n < Questions.Count) || (n < 1) )
if ((n < Questions.Count) || (n < 1))
return "";
// Calcular respuestas correctas
int correctas = 0;
for (int i = 0; i < n; i++)
if (Questions [i].ValidIndex == Answers [i])
if (Questions[i].ValidIndex == Answers[i])
correctas++;
// TODO: Otro mecanismo de score ?
......@@ -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.Answers = new List<int> ();
game.Answers = new List<int>();
game.StartDate = DateTime.Now.ToString();
game.FinishDate = "";
return game;
}
public bool Answer ( int answer)
public bool Answer(int answer)
{
int n = Answers.Count;
if(n < Questions.Count)
if (n < Questions.Count)
{
Answers.Add (answer);
OnPropertyChanged ("Answers");
OnPropertyChanged ("Progress");
OnPropertyChanged ("Score");
return Questions [n].ValidIndex == answer;
Answers.Add(answer);
OnPropertyChanged("Answers");
OnPropertyChanged("Progress");
OnPropertyChanged("Score");
return Questions[n].ValidIndex == answer;
} //endif
return false;
......
......@@ -4,21 +4,22 @@ using System.ComponentModel;
namespace inutralia.Models
{
[JsonObject (MemberSerialization.OptIn)]
[DataPath ("trivial")]
[JsonObject(MemberSerialization.OptIn)]
[DataPath("trivial")]
public class TrivialQuestion : ObservableEntityData
{
[JsonProperty ("image", DefaultValueHandling = DefaultValueHandling.Populate)]
[JsonProperty("image", DefaultValueHandling = DefaultValueHandling.Populate)]
[DefaultValue("")]
public string Image { get; set; }
[JsonProperty ("text", Required = Required.Always)]
[JsonProperty("text", Required = Required.Always)]
public string Text { get; set; }
[JsonProperty ("options", Required = Required.Always)]
[JsonProperty("options", Required = Required.Always)]
public IList<string> Options { get; set; }
[JsonProperty ("valid", Required = Required.Always)]
[JsonProperty("valid", Required = Required.Always)]
public int ValidIndex { get; set; }
}
}

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