Example #1
0
        /// <summary>
        /// Loads a dictionary of JSON resource definitions specified by the given asset identifier.
        /// </summary>
        private T LoadJsonResource <T>(SourcedAssetID id)
        {
            if (!id.AssetID.IsValid)
            {
                return(default(T));
            }

            var definition = view.LoadResource <JObject>(id);

            if (definition == null)
            {
                return(default(T));
            }

            var serializer = new JsonSerializer()
            {
                TypeNameHandling = TypeNameHandling.Auto
            };
            var resource = definition.ToObject <T>(serializer);

            return(resource);
        }
Example #2
0
        /// <summary>
        /// Occurs when the value of the <see cref="TextShaders"/> dependency property changes.
        /// </summary>
        private static void HandleTextShadersChanged(DependencyObject dobj, SourcedAssetID oldValue, SourcedAssetID newValue)
        {
            var resources = (PresentationFoundationViewResources)dobj;

            resources.ReloadTextShaders();
        }