protected override void Bind( string argument, Queue<string> additionalArguments )
        {
            var valueArg = GetValueArgument( argument, additionalArguments );

            var config = new ValidatingXamlReader().Read<object>( valueArg );

            Property.SetValue( Owner, config, null );
        }
        public void Include_FileExists_XamlIncluded()
        {
            var master = Path.Combine(Path.GetDirectoryName(GetType().Assembly.Location), "TestData/Xaml/Master.xaml");

            // ValidatingXamlReader only used for convenience. .Net XamlReader would do as well
            var model = new ValidatingXamlReader().Read <Model>(master);

            Assert.That(model.Content.Value, Is.EqualTo(42));
        }
        public void Load(string directory)
        {
            var reader = new ValidatingXamlReader();

            var datumLocatorsFromXaml = Directory.GetFiles(directory, "*.xaml", SearchOption.AllDirectories)
                                        .Select(file => reader.Read <Document>(file))
                                        .SelectMany(doc => doc.DatumLocators)
                                        .ToList();

            datumLocatorsFromXaml.Foreach(Add);
        }
Beispiel #4
0
        public AnalysisTemplate LoadAnalysisTemplate(ICurrenciesLut lut)
        {
            var reader = new ValidatingXamlReader();

            var text = LoadAnalysisTemplateText();

            // required for currency translation during loading from text to entity
            CurrencyConverter.CurrenciesLut = lut;

            return(reader.Read <AnalysisTemplate>(XElement.Parse(text)));
        }
Beispiel #5
0
        public ScriptCollection LoadScript( string file )
        {
            myLogger.Debug( "Processing starter script: {0}", file );

            LoadDependentAssemblies( file );

            var reader = new ValidatingXamlReader();
            var obj = reader.Read<object>( file );

            if( obj is Script )
            {
                var col = new ScriptCollection();
                col.Scripts.Add( ( Script )obj );
                return col;
            }
            else if( obj is ScriptCollection )
            {
                return ( ScriptCollection )obj;
            }
            else
            {
                throw new NotSupportedException( "Unknown root element: " + obj.GetType() );
            }
        }
 public override object ProvideValue( IServiceProvider serviceProvider )
 {
     var reader = new ValidatingXamlReader();
     return reader.Read<object>( Path );
 }