• Wriju's BLOG

    WinJS.xhr Issue while running next time

    • 4 Comments

    Windows 8 and WinJS.xhr goes hand in hand while developing application to consume web. I was trying out something like that. It used to work fine for the first run. But the second and consecutive runs it gives error as below.

    clip_image002

    Error message

    Exception is about to be caught by JavaScript library code at line 2351, column 21 in ms-appx://microsoft.winjs.1.0/js/base.js

    0x800c0008 - JavaScript runtime error: The download of the specified resource has failed.

    If there is a handler for this exception, the program may be safely continued.

    I had to delete the bin\debug to run it. This is not possible in installed application and this error was causing my application failure.

    I got an elegant solution to get rid of this issue. Somehow it was caching the page and due to which I was getting error at base.js file which I cannot edit.

    So I have added the code to disable the cache

    return WinJS.xhr({
    
                url: url1,
    
                headers: { "Cache-Control": "no-cache", "If-Modified-Since": "Mon, 27 Mar 1972 00:00:00 GMT" }
    
            });

    Namoskar!!!

  • Wriju's BLOG

    Windows 8 Application Development using HTML, JavaScript and CSS

    • 0 Comments

    Downloadable link to free eBook from Microsoft on Programming Windows 8 with HTML, CSS and JavaScript http://blogs.msdn.com/b/microsoft_press/archive/2012/08/20/free-ebook-programming-windows-8-apps-with-html-css-and-javascript-second-preview.aspx

    Namoskar!!!

  • Wriju's BLOG

    Windows 8 Application and OData with Netflix

    • 3 Comments

    Windows 8 and OData goes hand in hand. Today while discussing with my sweetheart, I started working on this demo on how to consume OData with Windows 8 Style Application. It does not follow the UX design guideline. However, an honest attempt to demonstrate the capability.

    I have used the most famous Netflix OData from http://odata.netflix.com/v2/Catalog/

    So I have created the Blank Windows Store application

    image

    Then have added the reference

    image

    If you get an error, then most probably the WCF Component is not installed. Follow the error message and download from the link

    image

    After that add the below XAML in MainPage.xaml

    <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
    
        <Grid.RowDefinitions>
    
            <RowDefinition Height="100"></RowDefinition>
    
            <RowDefinition Height="*"></RowDefinition>
    
        </Grid.RowDefinitions>
    
        <Button x:Name="btnLoad" Content="Load Them" Grid.Row="0" FontSize="36" Click="btnLoad_Click"></Button>
    
        <ListBox x:Name="lstData" Grid.Row="1">
    
            <ListBox.ItemTemplate>
    
                <DataTemplate>
    
                    <StackPanel Orientation="Horizontal">
    
                        <Image Stretch="Uniform" Height="100" Width="100" Margin="3,0">
    
                            <Image.Source>
    
                                <BitmapImage UriSource="{Binding Path=BoxArt.LargeUrl}"></BitmapImage>
    
                            </Image.Source>
    
                        </Image>
    
                        <TextBlock Text="{Binding Path=Name}"></TextBlock>
    
                            
    
                    </StackPanel>
    
                </DataTemplate>
    
            </ListBox.ItemTemplate>
    
        </ListBox>
    
    </Grid>

    After that C# Code would look like,

    NetFlixSvc.NetflixCatalog context = new NetFlixSvc.NetflixCatalog(new Uri(@"http://odata.netflix.com/v2/Catalog/", UriKind.RelativeOrAbsolute));
    
    DataServiceCollection<NetFlixSvc.Title> _titles;
    
    public void LoadData()
    
    {
    
        _titles = new DataServiceCollection<NetFlixSvc.Title>();
    
        var query = context.Titles;
    
        _titles.LoadAsync(query);
    
        _titles.LoadCompleted += _titles_LoadCompleted;
    
    }
    
    void _titles_LoadCompleted(object sender, LoadCompletedEventArgs e)
    
    {
    
        lstData.ItemsSource = _titles;
    
    }
    
    private void btnLoad_Click(object sender, RoutedEventArgs e)
    
    {
    
        LoadData();            
    
    }

    The output looks like,

    image

    I am again telling that this violets the basic Windows 8 Style Application design guideline.

    Namoskar!!!

  • Page 4 of 25 (606 items) «23456»