KernelContainer.Kernel is null

May 24, 2010 at 8:59 AM
Edited May 24, 2010 at 9:24 AM

It seems to be pretty strange, so I think it's beeing me dumb, but nonetheless I hope you can help me with this problem.

I am trying to load texture:


<UserControl x:Class="SilverlightApplication2.MainPage"
    d:DesignHeight="300" d:DesignWidth="400">

    <Grid x:Name="LayoutRoot" Background="White">
        <Execution:Game Width="400" Height="300"/>





using System.Windows.Controls;
using Balder.Core.Assets;
using Balder.Core.Execution;

namespace SilverlightApplication2
    public partial class MainPage : UserControl
        public MainPage()
            var assetLoaderService = KernelContainer.Kernel.Get<IAssetLoaderService>();
            var loader = assetLoaderService.GetLoader<Balder.Core.Imaging.Image>("pic.png");
            var images = loader.Load("pic.png");


And here I've got a problem. It seems that KernelContainer.Kernel is null, so it can't execute Get() method.

I wonder whether I'm dooing something wrong or maybe there's a better way to load a texture?
May 24, 2010 at 10:40 AM

Disregard that.

Problem's been solved by putting texture loading code inside the Loaded event handler.

May 24, 2010 at 5:05 PM

Good you figured it out - and using the Loaded event would be the appropriate place.