jet-image-loader不使用异步方法

时间:2013-10-25 11:45:12

标签: windows-phone-7 windows-phone-8 windows-phone

我尝试在我的Windows 8手机应用程序上使用Jet-Image Loader并且它在表单上工作正常但是一旦我尝试将Jet-Image缓存技术应用于在异步模式下绑定信息的aync方法,它将无法工作,下面是我正在使用的代码:

XAML:

<ctl:LongListSelector x:Name="ListCards" VerticalAlignment="Center"
                      LayoutMode="Grid"  ItemsSource="{Binding greetingsList}"
                      SelectionChanged="lstCards_SelectionChanged"
                      GridCellSize="210,170">enter code here
    <ctl:LongListSelector.ItemTemplate>
        <DataTemplate>
            <StackPanel Width="200" Height="170" VerticalAlignment="Center">                                  
                    <Image Source="{Binding ImgPath, Converter={StaticResource SampleJetImageLoaderConverter}}"
                           Width="180" Height="140"                                                
                           HorizontalAlignment="Center"
                           Stretch="UniformToFill" />

            </StackPanel>
        </DataTemplate>
    </ctl:LongListSelector.ItemTemplate>
</ctl:LongListSelector>

代码:

public partial class card_List3 : PhoneApplicationPage
{
    public class GetGreetingSchema 
    {

    public Uri ImgPath
    {
        get { return _ImgPath; }
        set
        {
            SetProperty(ref _ImgPath, value);
        }
        }      
    }

    public ObservableCollection<GetGreetingSchema> greetingsList { get; private set; }
    public card_List3()
    {
        InitializeComponent();
        greetingsList = new ObservableCollection<GetGreetingSchema>();
        DataContext = this;
    }

    protected override async void OnNavigatedTo(NavigationEventArgs e)
    {
        base.OnNavigatedTo(e);           
        try
        {
            await LoadDataAsync();             
        }
        catch (Exception listbindException)
        {
            ReusableMethods.LogStackTrace(listbindException);             
        }
    }

    private async Task LoadDataAsync()
    {
        var dataSource = new Container().Resolve<IfellowsCollection>();           
        greetingsList = await dataSource.BindGreetingsList(CatId, Contenttype);
        ListCards.ItemsSource = greetingsList;
    }
}

1 个答案:

答案 0 :(得分:0)

我在这里找到了你的问题:)

问题已修复,现在JetImageLoader支持Uri作为imageUrl参数:https://github.com/artem-zinnatullin/jet-image-loader/issues/8