Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions Microsoft.Windows.Toolkit.SampleApp/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,38 @@
RequestedTheme="Light">

<Application.Resources>

<!-- Colors -->
<Color x:Key="Grey-01">#FF333333</Color>
<Color x:Key="Grey-02">#FF444444</Color>
<Color x:Key="Grey-03">#FF555555</Color>
<Color x:Key="Grey-04">#FFDDDDDD</Color>
<Color x:Key="Grey-05">#FFF0F0F0</Color>
<Color x:Key="White">#FFFFFFFF</Color>

<Color x:Key="Blue-01">#FF0078D7</Color>

<!-- Brushes -->
<SolidColorBrush x:Key="Brush-Grey-01" Color="{StaticResource Grey-01}"/>
<SolidColorBrush x:Key="Brush-Grey-02" Color="{StaticResource Grey-02}"/>
<SolidColorBrush x:Key="Brush-Grey-03" Color="{StaticResource Grey-03}"/>
<SolidColorBrush x:Key="Brush-Grey-04" Color="{StaticResource Grey-04}"/>
<SolidColorBrush x:Key="Brush-Grey-05" Color="{StaticResource Grey-05}"/>
<SolidColorBrush x:Key="Brush-White" Color="{StaticResource White}"/>

<SolidColorBrush x:Key="Brush-Blue-01" Color="{StaticResource Blue-01}"/>

<!-- Styles -->

<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="{StaticResource Brush-Grey-01}"/>
</Style>

<Style TargetType="Button">
<Setter Property="Foreground" Value="{StaticResource Brush-Grey-01}"/>
</Style>


<Style TargetType="controls:CodeRenderer">
<Setter Property="Template">
<Setter.Value>
Expand Down Expand Up @@ -46,6 +78,11 @@
</Setter.Value>
</Setter>
</Style>
<DataTemplate x:Key="PivotHeaderTemplate">
<Grid>
<TextBlock Text="{Binding}" FontSize="14"/>
</Grid>
</DataTemplate>
</Application.Resources>

</Application>
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ private async void PropertyControl_OnDataContextChanged(FrameworkElement sender,
{
var propertyDesc = await sample.GetPropertyDescriptorAsync();

if (propertyDesc == null)
{
return;
}

foreach (var option in propertyDesc.Options)
{
// Label
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,12 @@
<Content Include="Assets\Photos\WestSeattleView.png" />
<Content Include="Icons\Notifications.png" />
<Content Include="Icons\Services.png" />
<Content Include="SamplePages\Bing Service\BingCode.txt" />
<Content Include="SamplePages\Bing Service\icon.png" />
<Content Include="SamplePages\Carousel\icon.jpg" />
<Content Include="SamplePages\Carousel\CarouselCode.txt" />
<Content Include="SamplePages\Facebook Service\FacebookCode.txt" />
<Content Include="SamplePages\Facebook Service\icon.png" />
<Content Include="SamplePages\HamburgerMenu\HamburgerMenuCode.txt" />
<Content Include="SamplePages\HamburgerMenu\icon.jpg" />
<Content Include="SamplePages\HeaderedTextBlock\HeaderedTextBlockCode.txt" />
Expand Down Expand Up @@ -189,9 +193,15 @@
<Compile Include="Models\PropertyDescriptor\PropertyKind.cs" />
<Compile Include="Models\PropertyDescriptor\PropertyDescriptor.cs" />
<Compile Include="Common\BindableBase.cs" />
<Compile Include="SamplePages\Bing Service\BingPage.xaml.cs">
<DependentUpon>BingPage.xaml</DependentUpon>
</Compile>
<Compile Include="SamplePages\Carousel\CarouselPage.xaml.cs">
<DependentUpon>CarouselPage.xaml</DependentUpon>
</Compile>
<Compile Include="SamplePages\Facebook Service\FacebookPage.xaml.cs">
<DependentUpon>FacebookPage.xaml</DependentUpon>
</Compile>
<Compile Include="SamplePages\HamburgerMenu\HamburgerMenuPage.xaml.cs">
<DependentUpon>HamburgerMenuPage.xaml</DependentUpon>
</Compile>
Expand Down Expand Up @@ -258,10 +268,18 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="SamplePages\Bing Service\BingPage.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="SamplePages\Carousel\CarouselPage.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="SamplePages\Facebook Service\FacebookPage.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="SamplePages\HamburgerMenu\HamburgerMenuPage.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
Expand Down Expand Up @@ -312,6 +330,10 @@
</Page>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Microsoft.Windows.Toolkit.Services\Microsoft.Windows.Toolkit.Services.csproj">
<Project>{7189A42D-6F1A-4FA3-8E00-E2C14FDF167A}</Project>
<Name>Microsoft.Windows.Toolkit.Services</Name>
</ProjectReference>
<ProjectReference Include="..\Microsoft.Windows.Toolkit.UI.Controls\Microsoft.Windows.Toolkit.UI.Controls.csproj">
<Project>{e9faabfb-d726-42c1-83c1-cb46a29fea81}</Project>
<Name>Microsoft.Windows.Toolkit.UI.Controls</Name>
Expand Down
15 changes: 15 additions & 0 deletions Microsoft.Windows.Toolkit.SampleApp/Models/Sample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ public class Sample

public string CodeUrl { get; set; }

public string CodeFile { get; set; }

public string XamlCodeFile { get; set; }

public string XamlCode { get; private set; }
Expand Down Expand Up @@ -67,6 +69,14 @@ private static Type LookForTypeByName(string typeName)
return null;
}

public async Task<string> GetCSharpSource()
{
using (var codeStream = await Helpers.GetPackagedFileStreamAsync($"SamplePages/{Name}/{CodeFile}"))
{
return await codeStream.ReadTextAsync();
}
}

public string UpdatedXamlCode
{
get
Expand All @@ -93,6 +103,11 @@ public string UpdatedXamlCode

public async Task<PropertyDescriptor> GetPropertyDescriptorAsync()
{
if (string.IsNullOrEmpty(XamlCodeFile))
{
return null;
}

if (_propertyDescriptor == null)
{
// Get Xaml code
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
</DataTemplate>
</Page.Resources>

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid Background="{StaticResource Brush-Grey-05}">
<ListView Name="SamplesList" ItemsSource="{Binding Samples}" ItemTemplate="{StaticResource SampleTemplate}" IsItemClickEnabled="True" ItemClick="SamplesList_OnItemClick" />
</Grid>
</Page>
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,9 @@
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;

// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
namespace Microsoft.Windows.Toolkit.SampleApp.Pages
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class SamplePicker : Page
public sealed partial class SamplePicker
{
public SamplePicker()
{
Expand All @@ -29,7 +25,6 @@ protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);

Shell.Current.ShowOnlyHeader("Please select a sample");
DataContext = e.Parameter as SampleCategory;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
if (string.IsNullOrEmpty(SearchText.Text))
{
return;
}

var searchConfig = new BingSearchConfig
{
Country = BingCountry.UnitedStates,
Query = SearchText.Text
};

ListView.ItemsSource = await BingService.Instance.RequestAsync(searchConfig, 50);
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<Page
x:Class="Microsoft.Windows.Toolkit.SampleApp.SamplePages.BingPage"
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:bing="using:Microsoft.Windows.Toolkit.Services.Bing"
mc:Ignorable="d">
<Page.Resources>
<DataTemplate x:Key="BingSchemaTemplate" x:DataType="bing:BingResult">
<Grid Margin="0,5,10,5">
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<TextBlock Text="{x:Bind Title}" Grid.Row="0" Grid.Column="0" FontWeight="Bold" TextTrimming="CharacterEllipsis"></TextBlock>
<TextBlock Text="{x:Bind Published}" Grid.Row="0" Grid.Column="1" HorizontalAlignment="Right"></TextBlock>
<TextBlock Text="{x:Bind Summary}" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" TextWrapping="Wrap"></TextBlock>
<HyperlinkButton Content="{x:Bind Link}" NavigateUri="{x:Bind Link}" Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2"></HyperlinkButton>
</Grid>
</DataTemplate>
</Page.Resources>

<Grid Background="{StaticResource Brush-Grey-05}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<StackPanel Orientation="Vertical" Margin="10">
<TextBox Header="Request:" x:Name="SearchText" Text="UWP"></TextBox>
<Button Content="Search" x:Name="SearchButton" Click="SearchButton_OnClick" Margin="0,10,0,0"></Button>
</StackPanel>
<ListView Grid.Row="1" ItemTemplate="{StaticResource BingSchemaTemplate}" x:Name="ListView">
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
</Style>
</ListView.ItemContainerStyle>
</ListView>
</Grid>
</Page>

Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,33 @@
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE CODE OR THE USE OR OTHER DEALINGS IN THE CODE.
// ******************************************************************
using System;

namespace Microsoft.Windows.Toolkit.Services.Core
using Microsoft.Windows.Toolkit.Services.Bing;
using Windows.UI.Xaml;

namespace Microsoft.Windows.Toolkit.SampleApp.SamplePages
{
[AttributeUsage(AttributeTargets.Class)]
public class ConnectedServiceProviderAttribute : Attribute
public sealed partial class BingPage
{
public string ProviderPublisherKeyName { get; set; }

public string DeveloperPortalUrl { get; set; }
public BingPage()
{
InitializeComponent();
}

public ConnectedServiceProviderAttribute(string providerPublisherKeyName, string serviceDeveloperInformationUrl)
private async void SearchButton_OnClick(object sender, RoutedEventArgs e)
{
ProviderPublisherKeyName = providerPublisherKeyName;
DeveloperPortalUrl = serviceDeveloperInformationUrl;
if (string.IsNullOrEmpty(SearchText.Text))
{
return;
}

var searchConfig = new BingSearchConfig
{
Country = BingCountry.UnitedStates,
Query = SearchText.Text
};

ListView.ItemsSource = await BingService.Instance.RequestAsync(searchConfig, 50);
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</DataTemplate>
</Page.Resources>

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid Background="{StaticResource Brush-Grey-05}">
<controls:Carousel
Name="control"
ContentTemplate="{StaticResource PhotosTemplate}"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FacebookService.Instance.Initialize(AppIDText.Text, FacebookService.Instance.DevelopmentTimeWindowsStoreId);
if (!await FacebookService.Instance.LoginAsync())
{
ShareBox.Visibility = Visibility.Collapsed;
var error = new MessageDialog("Unable to log with Facebook");
await error.ShowAsync();
return;
}

FacebookDataConfig config;

switch (QueryType.SelectedIndex)
{
case 1:
config = FacebookDataConfig.MyPosts;
break;
case 2:
config = FacebookDataConfig.MyTagged;
break;
default:
config = FacebookDataConfig.MyFeed;
break;
}

ListView.ItemsSource = await FacebookService.Instance.RequestAsync(config, 50);

ShareBox.Visibility = Visibility.Visible;

ProfileImage.DataContext = await FacebookService.Instance.GetUserPictureInfoAsync();
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<Page
x:Class="Microsoft.Windows.Toolkit.SampleApp.SamplePages.FacebookPage"
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:facebook="using:Microsoft.Windows.Toolkit.Services.Facebook"
mc:Ignorable="d">
<Page.Resources>
<DataTemplate x:Key="FacebookSchemaTemplate" x:DataType="facebook:FacebookPost">
<Grid Margin="0,5,10,5" Height="100">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100"></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Image Source="{Binding Full_Picture}" Grid.RowSpan="2" Grid.Column="0" Stretch="UniformToFill"></Image>
<TextBlock Text="{x:Bind Message}" Grid.Row="0" Grid.Column="1" Margin="5,0,0,0" VerticalAlignment="Center" FontSize="20" TextWrapping="Wrap" TextTrimming="CharacterEllipsis"></TextBlock>
<TextBlock Text="{x:Bind Created_Time}" Grid.Row="1" Grid.Column="1" Margin="5,0,0,0" VerticalAlignment="Center" FontSize="16" TextWrapping="Wrap" TextTrimming="CharacterEllipsis" FontWeight="ExtraLight"></TextBlock>
</Grid>
</DataTemplate>
</Page.Resources>

<Grid Background="{StaticResource Brush-Grey-05}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Vertical" Margin="10">
<TextBox Header="AppID:" x:Name="AppIDText"></TextBox>
<StackPanel Orientation="Horizontal">
<ComboBox x:Name="QueryType" Header="Type:"></ComboBox>
<Button Content="Connect" x:Name="ConnectButton" Click="ConnectButton_OnClick" Margin="10,0,0,0" VerticalAlignment="Bottom"></Button>
</StackPanel>
</StackPanel>
<Image Grid.Column="1" x:Name="ProfileImage" Source="{Binding Url}" VerticalAlignment="Top" Margin="5"></Image>
</Grid>
<Border Margin="10" Grid.Row="1" x:Name="ShareBox" BorderThickness="1" BorderBrush="#555555" Padding="5">
<StackPanel Orientation="Vertical">
<TextBox Header="Title:" x:Name="TitleText"></TextBox>
<TextBox Header="Description:" x:Name="DescriptionText"></TextBox>
<Button Content="Share" x:Name="ShareButton" Click="ShareButton_OnClick" Margin="0,10,0,0"></Button>
</StackPanel>
</Border>
<ListView Grid.Row="2" ItemTemplate="{StaticResource FacebookSchemaTemplate}" x:Name="ListView">
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
</Style>
</ListView.ItemContainerStyle>
</ListView>
</Grid>
</Page>

Loading