Ejemplo n.º 1
0
 /// <summary>
 /// Fills the List of Resources on the Field from the List of Resources on the Terrain.
 /// </summary>
 public void FillFieldResourcesFromTerrainResources()
 {
     foreach (int resource in FieldTerrain.TerrainResources)
     {
         FieldResources.Add(resource);
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Resolves the value for the specified resource.
        /// The result may be a <see cref="BindingBase"/> or a literal value.
        /// </summary>
        /// <param name="name">Resource name. This is not the object property name.</param>
        public virtual object ProvideValue(string name)
        {
            if (FieldResources.TryGetValue(name, out var resource))
            {
                return(resource.ProvideValue(Context));
            }

            if (FormResources.TryGetValue(name, out resource))
            {
                return(resource.ProvideValue(Context));
            }

            if (ThrowOnNotFound)
            {
                throw new InvalidOperationException($"Resource {name} not found.");
            }

            return(null);
        }