public CustomerListViewModel()
        {
            m_modelLoader = IsInDesignMode
            ? (IModelLoader) new DesignDataModelService()
            : new SampleModelLoaderService();

             Customers = m_modelLoader.LoadCustomers();
        }
Esempio n. 2
0
 /// <summary>
 /// Loads a skin file from the specified <paramref name="reader"/> and returns the root UIElement.
 /// </summary>
 /// <param name="reader">The reader containing the XAML contents of the skin file.</param>
 /// <param name="actualResourceBundle">Resource bundle which contains the skin file with the given path.</param>
 /// <param name="loader">Loader callback for GUI models.</param>
 /// <returns><see cref="UIElement"/> descendant corresponding to the root element in the
 /// specified skin file.</returns>
 protected static object Load(TextReader reader, ISkinResourceBundle actualResourceBundle, IModelLoader loader)
 {
   try
   {
     Parser parser = new Parser(reader, parser_ImportNamespace, parser_GetEventHandler);
     parser.SetCustomTypeConverter(MPF.ConvertType);
     parser.SetContextVariable(typeof(IModelLoader), loader);
     parser.SetContextVariable(typeof(ISkinResourceBundle), actualResourceBundle);
     return parser.Parse();
   }
   catch (Exception e)
   {
     throw new XamlLoadException("XAML loader: Error reading XAML file from text reader", e);
   }
 }
Esempio n. 3
0
 /// <summary>
 /// Loads the specified skin file and returns the root UIElement.
 /// </summary>
 /// <param name="skinFilePath">The path to the XAML skin file.</param>
 /// <param name="actualResourceBundle">Resource bundle which contains the skin file with the given path.</param>
 /// <param name="loader">Loader callback for GUI models.</param>
 /// <returns><see cref="UIElement"/> descendant corresponding to the root element in the
 /// specified skin file.</returns>
 public static object Load(string skinFilePath, ISkinResourceBundle actualResourceBundle, IModelLoader loader)
 {
   try
   {
     using (TextReader reader = new StreamReader(skinFilePath))
       return Load(reader, actualResourceBundle, loader);
   }
   catch (XamlLoadException e)
   {
     // Unwrap the exception thrown by Load(TextReader)
     throw new XamlLoadException("XAML loader: Error parsing file '{0}'", e.InnerException, skinFilePath);
   }
   catch (Exception e)
   {
     throw new XamlLoadException("XAML loader: Error parsing file '{0}'", e, skinFilePath);
   }
 }
Esempio n. 4
0
        public MainViewModel()
        {
            m_modelLoader = IsInDesignMode
            ? (IModelLoader)new DesignDataModelService()
            : new SampleModelLoaderService();

             Customers = m_modelLoader.LoadCustomers();
             CustomerDetailsCommand = new OpenCustomerDetaisCommand();
             CustomerDetailsCommand.AfterExecuted += a_customer =>
            {
               if (a_customer == null || Customers.Contains(a_customer))
               {
                  return;
               }

               Customers.Add(a_customer);
            };
        }
 /// <summary>
 /// Default constructor.
 /// </summary>
 /// <param name="api">The current api</param>
 /// <param name="loader">The model loader</param>
 public SinglePageModel(IApi api, IModelLoader loader) : base(api, loader)
 {
 }
Esempio n. 6
0
 /// <summary> Accepts IModelLoader (Visitor pattern). </summary>
 /// <param name="tile">Tile.</param>
 /// <param name="loader">IModelLoader instance.</param>
 public abstract void Accept(Tile tile, IModelLoader loader);
Esempio n. 7
0
 public ElementVisitor(Tile tile, IModelLoader modelLoader, IObjectPool objectPool)
 {
     Tile = tile;
     ModelLoader = modelLoader;
     ObjectPool = objectPool;
 }
Esempio n. 8
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 /// <param name="api">The current api</param>
 /// <param name="loader">The model loader</param>
 public SinglePageWithComments(IApi api, IModelLoader loader) : base(api, loader)
 {
 }
Esempio n. 9
0
 /// <summary>
 /// Loads a skin file from the specified <paramref name="reader"/> and returns the root UIElement.
 /// </summary>
 /// <param name="reader">The reader containing the XAML contents of the skin file.</param>
 /// <param name="actualResourceBundle">Resource bundle which contains the skin file with the given path.</param>
 /// <param name="loader">Loader callback for GUI models.</param>
 /// <returns><see cref="UIElement"/> descendant corresponding to the root element in the
 /// specified skin file.</returns>
 protected static object Load(TextReader reader, ISkinResourceBundle actualResourceBundle, IModelLoader loader)
 {
     try
     {
         Parser parser = new Parser(reader, parser_ImportNamespace, parser_GetEventHandler);
         parser.SetCustomTypeConverter(MPF.ConvertType);
         parser.SetContextVariable(typeof(IModelLoader), loader);
         parser.SetContextVariable(typeof(ISkinResourceBundle), actualResourceBundle);
         return(parser.Parse());
     }
     catch (Exception e)
     {
         throw new XamlLoadException("XAML loader: Error reading XAML file from text reader", e);
     }
 }
Esempio n. 10
0
 public MeshSceneObjectComponent(IModelLoader modelLoader, string modelSource)
 {
     ModelLoader = modelLoader;
     MdlSource   = modelSource;
 }
Esempio n. 11
0
        public override void Load(XmlElement xmlNode)
        {
            base.Load(xmlNode);

            if (xmlNode.HasAttribute("Occluder"))
            {
                isOccluder = bool.Parse(xmlNode.GetAttribute("Occluder"));
            }
            if (xmlNode.HasAttribute("IgnoreDepth"))
            {
                ignoreDepth = bool.Parse(xmlNode.GetAttribute("IgnoreDepth"));
            }
            if (xmlNode.HasAttribute("AddToPhysicsEngine"))
            {
                AddToPhysicsEngine = bool.Parse(xmlNode.GetAttribute("AddToPhysicsEngine"));
            }

            int i = 0;

            if (xmlNode.ChildNodes[i].Name.Equals("ModelCreationInfo"))
            {
                XmlElement modelInfo = (XmlElement)xmlNode.ChildNodes[i];
                if (modelInfo.HasAttribute("ResourceName"))
                {
                    if (!modelInfo.HasAttribute("ModelLoaderName"))
                    {
                        throw new GoblinException("ModelLoaderName attribute is required if " +
                                                  "ResourceName attribute is specified");
                    }

                    String       assetName = Path.ChangeExtension(modelInfo.GetAttribute("ResourceName"), null);
                    IModelLoader loader    = (IModelLoader)Activator.CreateInstance(Type.GetType(
                                                                                        modelInfo.GetAttribute("ModelLoaderName")));
                    model = (IModel)loader.Load("", assetName);
                }
                else
                {
                    if (!modelInfo.HasAttribute("CustomShapeParameters"))
                    {
                        throw new GoblinException("CustomShapeParameters attribute must be " +
                                                  "specified if ResourceName is not specified");
                    }

                    String[] primShapeParams = modelInfo.GetAttribute("CustomShapeParameters").Split(',');
                    model = (IModel)Activator.CreateInstance(Type.GetType(xmlNode.ChildNodes[i + 1].Name),
                                                             primShapeParams);
                }

                model.Load((XmlElement)xmlNode.ChildNodes[i + 1]);
                i += 2;
            }

            material = (Material)Activator.CreateInstance(Type.GetType(xmlNode.ChildNodes[i].Name));
            material.Load((XmlElement)xmlNode.ChildNodes[i]);

            physicsProperties = (IPhysicsObject)Activator.CreateInstance(Type.GetType(
                                                                             xmlNode.ChildNodes[i + 1].Name));
            physicsProperties.Load((XmlElement)xmlNode.ChildNodes[i + 1]);
            physicsProperties.Container = this;
            if (model is IPhysicsMeshProvider)
            {
                physicsProperties.MeshProvider = (IPhysicsMeshProvider)model;
            }
            physicsProperties.Model = model;
        }
Esempio n. 12
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 /// <param name="api">The current api</param>
 /// <param name="loader">The model loader</param>
 public SinglePost(IApi api, IModelLoader loader)
 {
     _api    = api;
     _loader = loader;
 }
Esempio n. 13
0
 /// <inheritdoc />
 public override void Accept(Tile tile, IModelLoader loader)
 {
     loader.CompleteTile(tile);
 }
Esempio n. 14
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 /// <param name="api">The current api</param>
 /// <param name="loader">The model loader</param>
 public ArchivePage(IApi api, IModelLoader loader) : base(api, loader)
 {
 }
Esempio n. 15
0
 public BlogOverviewController(IApi api, IModelLoader loader, IApplicationService service)
 {
     _api     = api;
     _loader  = loader;
     _service = service;
 }
Esempio n. 16
0
 public ContactPageModel(Services.IMailService mailService, IApi api, IModelLoader loader, ILogger <ContactPageModel> logger) : base(api, loader)
 {
     _mailService = mailService;
     _logger      = logger;
 }
 /// <summary>
 /// Default constructor.
 /// </summary>
 /// <param name="api"></param>
 /// <param name="loader"></param>
 public ArchiveModel(IApi api, IModelLoader loader) : base()
 {
     _api    = api;
     _loader = loader;;
 }
Esempio n. 18
0
 /// <inheritdoc />
 public WayVisitor(Tile tile, IModelLoader modelLoader, IObjectPool objectPool)
     : base(tile, modelLoader, objectPool)
 {
 }
Esempio n. 19
0
 public CmsController(IApi api, IModelLoader loader)
 {
     _api    = api;
     _loader = loader;
 }
Esempio n. 20
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 /// <param name="api">The current api</param>
 public StartPageController(IApi api, IModelLoader loader)
 {
     _api    = api;
     _loader = loader;
 }
Esempio n. 21
0
 /// <inheritdoc />
 public override void Accept(Tile tile, IModelLoader loader)
 {
     loader.LoadNode(tile, this);
 }
Esempio n. 22
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 /// <param name="api">The current api</param>
 public CmsController(IApi api, IModelLoader loader, IAdapterEngine adapterEngine)
 {
     _api           = api;
     _loader        = loader;
     _adapterEngine = adapterEngine;
 }
Esempio n. 23
0
 internal AddressParser(ITagger tagger, IModelLoader modelLoader, IFormatter <Address> formatter)
 {
     Tagger    = tagger;
     HMM       = modelLoader.LoadHMM();
     Formatter = formatter;
 }
Esempio n. 24
0
 public ApiController(IApi api, IDb db, IModelLoader loader)
 {
     _api    = api;
     _db     = db;
     _loader = loader;
 }
 public ModelCollectionLoader(IDirectoryLocator directoryLocator, IModelLoader modelLoader, ILogger logger)
 {
     _directoryLocator = directoryLocator;
     _logger = logger;
     _modelLoader = modelLoader;
 }
Esempio n. 26
0
 /// <summary>
 /// Loads the specified skin file and returns the root UIElement.
 /// </summary>
 /// <param name="skinFilePath">The path to the XAML skin file.</param>
 /// <param name="actualResourceBundle">Resource bundle which contains the skin file with the given path.</param>
 /// <param name="loader">Loader callback for GUI models.</param>
 /// <returns><see cref="UIElement"/> descendant corresponding to the root element in the
 /// specified skin file.</returns>
 public static object Load(string skinFilePath, ISkinResourceBundle actualResourceBundle, IModelLoader loader)
 {
     try
     {
         using (TextReader reader = new StreamReader(skinFilePath))
             return(Load(reader, actualResourceBundle, loader));
     }
     catch (XamlLoadException e)
     {
         // Unwrap the exception thrown by Load(TextReader)
         throw new XamlLoadException("XAML loader: Error parsing file '{0}'", e.InnerException, skinFilePath);
     }
     catch (Exception e)
     {
         throw new XamlLoadException("XAML loader: Error parsing file '{0}'", e, skinFilePath);
     }
 }
 public TeaserPageModel(IApi api, IModelLoader loader, IDb db) : base(api, loader)
 {
     _db = db;
 }