1

Customizing My app W10 Template from AppStudio

Hello everyone, I’m new to programming and I wanted to make a Windows App just for fun, so far it looks good, however. I have a problem (mostly because I don’t know what I’m doing). But I want the RSS feed to open Edge instead of the feed view (second page after you click on a feed icon) I found the config file for the rss feed ( I called it news) but I don’t know how to make it open a new window on edge . The code is located at:

Sections\NewsConfig.cs

Update: This is the full original code:

using System;
using System.Collections.Generic;
using AppStudio.DataProviders;
using AppStudio.DataProviders.Core;
using AppStudio.DataProviders.Rss;
using AppStudio.Uwp.Actions;
using AppStudio.Uwp.Commands;
using AppStudio.Uwp.Navigation;
using MyWindows10App.Config;
using MyWindows10App.ViewModels;

namespace MyWindows10App.Sections
{
public class NewsConfig : SectionConfigBase<RssDataConfig, RssSchema>
{
    public override DataProviderBase<RssDataConfig, RssSchema> DataProvider
    {
        get
        {
            return new RssDataProvider();
        }
    }

    public override RssDataConfig Config
    {
        get
        {
            return new RssDataConfig
            {
                Url = new Uri("https://localhost:804514/feed")
            };
        }
    }

    public override NavigationInfo ListNavigationInfo
    {
        get 
        {
            return NavigationInfo.FromPage("NewsListPage");
        }
    }

    public override ListPageConfig<RssSchema> ListPage
    {
        get 
        {
            return new ListPageConfig<RssSchema>
            {
                Title = "News",

                LayoutBindings = (viewModel, item) =>
                {
                    viewModel.Title = item.Title.ToSafeString();
                    viewModel.SubTitle = item.Summary.ToSafeString();
                    viewModel.Description = item.Summary.ToSafeString();
                    viewModel.Image = item.ImageUrl.ToSafeString();
                },
                NavigationInfo = (item) =>
                {
                    return null;
                }
            };
        }
    }

    public override DetailPageConfig<RssSchema> DetailPage
    {
        get
        {
            var bindings = new List<Action<ItemViewModel, RssSchema>>();

            var actions = new List<ActionConfig<RssSchema>>
            {
            };

            return new DetailPageConfig<RssSchema>
            {
                Title = "News",
                LayoutBindings = bindings,
                Actions = actions
            };
        }
    }

    public override string PageTitle
    {
        get { return "News"; }
    }
}
}

Update 2: here is the XAML from the List page

<Page
x:Class="MyWindows10App.Views.NewsListPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:was_actions="using:AppStudio.Uwp.Actions"
xmlns:was_commands="using:AppStudio.Uwp.Commands"
xmlns:was_controls="using:AppStudio.Uwp.Controls"
xmlns:layouts="using:MyWindows10App.Layouts"
xmlns:list_layouts="using:MyWindows10App.Layouts.List"
xmlns:controls="using:MyWindows10App.Layouts.Controls"
xmlns:vm="using:MyWindows10App.ViewModels"
xmlns:triggers="using:MyWindows10App.Triggers"
DataContext="{Binding RelativeSource={RelativeSource Self}}"
d:DataContext="{d:DesignData Source=/Assets/Design/DesignData.json, Type=vm:DesignViewModel, IsDesignTimeCreatable=true}"
mc:Ignorable="d">
<Grid Background="{StaticResource AppBackground}">
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="15"/>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="*"/>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="Auto"/>
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="*"/>
        <ColumnDefinition Width="Auto"/>
    </Grid.ColumnDefinitions>
    <Grid Grid.Row="0" Grid.ColumnSpan="2" Background="{StaticResource AppBarBackground}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Height="48"/>
    <TextBlock Grid.Row="0" Grid.Column="0" Margin="{Binding ViewModel.PageTitleMargin}" Text="{Binding ViewModel.PageTitle}" Foreground="{StaticResource AppBarForeground}" FontSize="21" VerticalAlignment="Center" HorizontalAlignment="Left" TextTrimming="WordEllipsis" MaxLines="1"/>
    <was_actions:ActionsCommandBar 
        x:Name="appBar"
        ActionsSource="{Binding ViewModel.Actions}" Style="{StaticResource WasCommandBarStyle}"
        Foreground="{StaticResource AppBarForeground}"
        IsVisible="{Binding ViewModel.HasActions}"
        Background="{StaticResource AppBarBackground}"
        Grid.Row="{Binding ViewModel.AppBarRow}"
        Grid.Column="{Binding ViewModel.AppBarColumn}"
        Grid.ColumnSpan="{Binding ViewModel.AppBarColumnSpan}">
    </was_actions:ActionsCommandBar>
    <ProgressBar Grid.Row="1" Grid.ColumnSpan="2" Height="3" Margin="0,6,0,6" IsIndeterminate="True" Foreground="{StaticResource PageTitleForeground}" Visibility="{Binding ViewModel.IsBusy, Converter={StaticResource BoolToVisibilityConverter}, FallbackValue=Collapsed}"/>
    <was_controls:ErrorNotificationControl Grid.ColumnSpan="2" x:Uid="ListErrorNotificationControl" Grid.Row="2" ErrorVisibility="{Binding ViewModel.HasLoadDataErrors, Converter={StaticResource BoolToVisibilityConverter}}" ErrorColor="{StaticResource PageTitleForeground}" Margin="10,0,18,0"/>
    <list_layouts:ListBigHorizontalCardBox Grid.Row="3" Grid.ColumnSpan="2" DataContext="{Binding ViewModel}" ItemsSource="{Binding Items}" ItemClickCommand="{Binding ItemClickCommand}" OneRowModeEnabled="False" Margin="19,0,12,0" />
    <controls:DataUpdateInformationControl Grid.ColumnSpan="2" Grid.Row="4" LastUpdateDateTime="{Binding ViewModel.LastUpdated}" Color="{StaticResource PageTitleForeground}" Margin="8,4,8,4" HorizontalAlignment="Left" HasLocalData="{Binding ViewModel.HasLocalData}"/>
</Grid>
</Page>
Dannny
  • 11
  • 4

1 Answers1

0

In UWP apps, While performing navigating you can use URI scheme or recommend any app to use that URI to open with.

You can use the http URI scheme to launch default web browser as follows

// The URI to launch
   var uriFeed = new Uri(@"http://www.myblogfeed.com");

   // Launch the URI
   var success = await Windows.System.Launcher.LaunchUriAsync(uriFeed);

when launching any URI, you can also pass in LaucherOptions obect, where you can specify the preferredApplication for URI to launch it. Here is the example from a msdn page.

// Set the recommended app
var options = new Windows.System.LauncherOptions();
options.PreferredApplicationPackageFamilyName = "Contoso.URIApp_8wknc82po1e";
options.PreferredApplicationDisplayName = "Contoso URI Ap";

// Launch the URI and pass in the recommended app 
// in case the user has no apps installed to handle the URI
var success = await Windows.System.Launcher.LaunchUriAsync(uriContoso, options);
Haseeb Asif
  • 1,766
  • 2
  • 23
  • 41
  • I think the first one will do the trick, however I don't want to pass the URL of the blog, I would like to use the URL of the post. how can I extract the post url ? – Dannny Oct 31 '15 at 12:59
  • above doesn't seem to related to get the link, I think it should be already taking to you to the individual posts once you click on them? – Haseeb Asif Oct 31 '15 at 13:10
  • How are you displaying the individual post? You should try to layout your logic around that – Haseeb Asif Oct 31 '15 at 13:12
  • No it currently doesn't do anything, since I added the return null; before that it had this return NavigationInfo.FromPage("NewsDetailPage", true); but that only sent to the detail page. – Dannny Oct 31 '15 at 13:12
  • umm I don't know how its displaying the posts, again I'm using the app studio sample called my app w10 from here http://appstudio.windows.com/projects/create – Dannny Oct 31 '15 at 13:14