예제 #1
0
        public async Task <IList <RecipeGroup> > GetRecipeGroups()
        {
            var obj    = new { Groups = new List <RecipeGroup>() };
            var result = JsonConvert.DeserializeAnonymousType(await AppResourceHelper.GetEmbeddedResourceAsStringAsync("Data/RecipeData.json"), obj);

            return(result.Groups);
        }
예제 #2
0
 protected CodeBrixApplication(IPlatformConfiguration platformConfig)
     : base(platformConfig?.Initializer)
 {
     //Important: The following code won't run until the base constructor has completed;
     // so the PlatformConfiguration property may be null during the earliest parts of application startup.
     PlatformConfiguration = platformConfig ?? throw new ArgumentNullException(nameof(platformConfig));
     if (PlatformConfiguration.Container == null)
     {
         throw new ArgumentException("The 'Container' property of the platform configuration cannot be null.", nameof(platformConfig));
     }
     AppResourceHelper.SetApplication(this);
 }
예제 #3
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            bool  val    = (bool)value;
            Color result = XamFormsColorHelper.DefaultColor;  //get default color

            if (!String.IsNullOrWhiteSpace(parameter?.ToString()))
            {
                string param =
                    parameter.ToString()
                    .Trim()
                    .Split(';')
                    .FirstOrDefault(
                        f =>
                        (f ?? "").Trim()
                        .StartsWith(val.ToString().ToLower() + ":"));
                if (!String.IsNullOrWhiteSpace(param))
                {
                    result = AppResourceHelper.GetColorByKey(param.Replace(val.ToString().ToLower() + ":", ""));
                }
            }

            return(result);
        }
예제 #4
0
 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     return(((string)value == null)
         ? null
         : AppResourceHelper.GetAppResourceUri((string)value));
 }
예제 #5
0
 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     return(((string)value == null)
         ? null
         : ImageSource.FromStream(() => new MemoryStream(AppResourceHelper.GetEmbeddedResourceAsBytes((string)value))));
 }