Skip to content

Commit 49313ad

Browse files
committed
Add sample for connecting to Facebook
1 parent 8737b35 commit 49313ad

22 files changed

+2860
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# ignore generated files for Windows Store Apps
2+
*.g.h
3+
*.g.hpp
4+
*.g.cpp
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Express 2012 for Windows 8
4+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FacebookDemo", "FacebookDemo110\FacebookDemo.vcxproj", "{5BA97497-8CFE-4C98-B2FD-7BF262CEE4E0}"
5+
EndProject
6+
Global
7+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
8+
Debug|ARM = Debug|ARM
9+
Debug|Win32 = Debug|Win32
10+
Debug|x64 = Debug|x64
11+
Release|ARM = Release|ARM
12+
Release|Win32 = Release|Win32
13+
Release|x64 = Release|x64
14+
EndGlobalSection
15+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
16+
{5BA97497-8CFE-4C98-B2FD-7BF262CEE4E0}.Debug|ARM.ActiveCfg = Debug|ARM
17+
{5BA97497-8CFE-4C98-B2FD-7BF262CEE4E0}.Debug|ARM.Build.0 = Debug|ARM
18+
{5BA97497-8CFE-4C98-B2FD-7BF262CEE4E0}.Debug|ARM.Deploy.0 = Debug|ARM
19+
{5BA97497-8CFE-4C98-B2FD-7BF262CEE4E0}.Debug|Win32.ActiveCfg = Debug|Win32
20+
{5BA97497-8CFE-4C98-B2FD-7BF262CEE4E0}.Debug|Win32.Build.0 = Debug|Win32
21+
{5BA97497-8CFE-4C98-B2FD-7BF262CEE4E0}.Debug|Win32.Deploy.0 = Debug|Win32
22+
{5BA97497-8CFE-4C98-B2FD-7BF262CEE4E0}.Debug|x64.ActiveCfg = Debug|x64
23+
{5BA97497-8CFE-4C98-B2FD-7BF262CEE4E0}.Debug|x64.Build.0 = Debug|x64
24+
{5BA97497-8CFE-4C98-B2FD-7BF262CEE4E0}.Debug|x64.Deploy.0 = Debug|x64
25+
{5BA97497-8CFE-4C98-B2FD-7BF262CEE4E0}.Release|ARM.ActiveCfg = Release|ARM
26+
{5BA97497-8CFE-4C98-B2FD-7BF262CEE4E0}.Release|ARM.Build.0 = Release|ARM
27+
{5BA97497-8CFE-4C98-B2FD-7BF262CEE4E0}.Release|ARM.Deploy.0 = Release|ARM
28+
{5BA97497-8CFE-4C98-B2FD-7BF262CEE4E0}.Release|Win32.ActiveCfg = Release|Win32
29+
{5BA97497-8CFE-4C98-B2FD-7BF262CEE4E0}.Release|Win32.Build.0 = Release|Win32
30+
{5BA97497-8CFE-4C98-B2FD-7BF262CEE4E0}.Release|Win32.Deploy.0 = Release|Win32
31+
{5BA97497-8CFE-4C98-B2FD-7BF262CEE4E0}.Release|x64.ActiveCfg = Release|x64
32+
{5BA97497-8CFE-4C98-B2FD-7BF262CEE4E0}.Release|x64.Build.0 = Release|x64
33+
{5BA97497-8CFE-4C98-B2FD-7BF262CEE4E0}.Release|x64.Deploy.0 = Release|x64
34+
EndGlobalSection
35+
GlobalSection(SolutionProperties) = preSolution
36+
HideSolutionNode = FALSE
37+
EndGlobalSection
38+
EndGlobal
Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup Label="ProjectConfigurations">
4+
<ProjectConfiguration Include="Debug|ARM">
5+
<Configuration>Debug</Configuration>
6+
<Platform>ARM</Platform>
7+
</ProjectConfiguration>
8+
<ProjectConfiguration Include="Debug|Win32">
9+
<Configuration>Debug</Configuration>
10+
<Platform>Win32</Platform>
11+
</ProjectConfiguration>
12+
<ProjectConfiguration Include="Debug|x64">
13+
<Configuration>Debug</Configuration>
14+
<Platform>x64</Platform>
15+
</ProjectConfiguration>
16+
<ProjectConfiguration Include="Release|ARM">
17+
<Configuration>Release</Configuration>
18+
<Platform>ARM</Platform>
19+
</ProjectConfiguration>
20+
<ProjectConfiguration Include="Release|Win32">
21+
<Configuration>Release</Configuration>
22+
<Platform>Win32</Platform>
23+
</ProjectConfiguration>
24+
<ProjectConfiguration Include="Release|x64">
25+
<Configuration>Release</Configuration>
26+
<Platform>x64</Platform>
27+
</ProjectConfiguration>
28+
</ItemGroup>
29+
<PropertyGroup Label="Globals">
30+
<ProjectGuid>{5ba97497-8cfe-4c98-b2fd-7bf262cee4e0}</ProjectGuid>
31+
<RootNamespace>FacebookDemo</RootNamespace>
32+
<DefaultLanguage>en-US</DefaultLanguage>
33+
<MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>
34+
<AppContainerApplication>true</AppContainerApplication>
35+
<ProjectName>FacebookDemo110</ProjectName>
36+
</PropertyGroup>
37+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
38+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
39+
<ConfigurationType>Application</ConfigurationType>
40+
<UseDebugLibraries>true</UseDebugLibraries>
41+
<PlatformToolset>v110</PlatformToolset>
42+
</PropertyGroup>
43+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
44+
<ConfigurationType>Application</ConfigurationType>
45+
<UseDebugLibraries>true</UseDebugLibraries>
46+
<PlatformToolset>v110</PlatformToolset>
47+
</PropertyGroup>
48+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
49+
<ConfigurationType>Application</ConfigurationType>
50+
<UseDebugLibraries>true</UseDebugLibraries>
51+
<PlatformToolset>v110</PlatformToolset>
52+
</PropertyGroup>
53+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
54+
<ConfigurationType>Application</ConfigurationType>
55+
<UseDebugLibraries>false</UseDebugLibraries>
56+
<WholeProgramOptimization>true</WholeProgramOptimization>
57+
<PlatformToolset>v110</PlatformToolset>
58+
</PropertyGroup>
59+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration">
60+
<ConfigurationType>Application</ConfigurationType>
61+
<UseDebugLibraries>false</UseDebugLibraries>
62+
<WholeProgramOptimization>true</WholeProgramOptimization>
63+
<PlatformToolset>v110</PlatformToolset>
64+
</PropertyGroup>
65+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
66+
<ConfigurationType>Application</ConfigurationType>
67+
<UseDebugLibraries>false</UseDebugLibraries>
68+
<WholeProgramOptimization>true</WholeProgramOptimization>
69+
<PlatformToolset>v110</PlatformToolset>
70+
</PropertyGroup>
71+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
72+
<ImportGroup Label="ExtensionSettings">
73+
</ImportGroup>
74+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
75+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
76+
<Import Project="$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v8.0\ExtensionSDKs\CppRESTWindowsSDK\0.6\DesignTime\Debug\x86\CppRESTWindowsSDK.props" />
77+
</ImportGroup>
78+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
79+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
80+
<Import Project="$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v8.0\ExtensionSDKs\CppRESTWindowsSDK\0.6\DesignTime\Retail\x86\CppRESTWindowsSDK.props" />
81+
</ImportGroup>
82+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
83+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
84+
<Import Project="$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v8.0\ExtensionSDKs\CppRESTWindowsSDK\0.6\DesignTime\Debug\ARM\CppRESTWindowsSDK.props" />
85+
</ImportGroup>
86+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
87+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
88+
<Import Project="$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v8.0\ExtensionSDKs\CppRESTWindowsSDK\0.6\DesignTime\Retail\ARM\CppRESTWindowsSDK.props" />
89+
</ImportGroup>
90+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
91+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
92+
<Import Project="$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v8.0\ExtensionSDKs\CppRESTWindowsSDK\0.6\DesignTime\Debug\x64\CppRESTWindowsSDK.props" />
93+
</ImportGroup>
94+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
95+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
96+
<Import Project="$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v8.0\ExtensionSDKs\CppRESTWindowsSDK\0.6\DesignTime\Retail\x64\CppRESTWindowsSDK.props" />
97+
</ImportGroup>
98+
<PropertyGroup Label="UserMacros" />
99+
<PropertyGroup>
100+
<PackageCertificateKeyFile>FacebookDemo_TemporaryKey.pfx</PackageCertificateKeyFile>
101+
</PropertyGroup>
102+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
103+
<ClCompile>
104+
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
105+
<DisableSpecificWarnings>4453</DisableSpecificWarnings>
106+
</ClCompile>
107+
</ItemDefinitionGroup>
108+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
109+
<ClCompile>
110+
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
111+
<DisableSpecificWarnings>4453</DisableSpecificWarnings>
112+
</ClCompile>
113+
</ItemDefinitionGroup>
114+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
115+
<ClCompile>
116+
<AdditionalOptions>/bigobj /Zm137 %(AdditionalOptions)</AdditionalOptions>
117+
<DisableSpecificWarnings>4453</DisableSpecificWarnings>
118+
</ClCompile>
119+
</ItemDefinitionGroup>
120+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
121+
<ClCompile>
122+
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
123+
<DisableSpecificWarnings>4453</DisableSpecificWarnings>
124+
</ClCompile>
125+
</ItemDefinitionGroup>
126+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
127+
<ClCompile>
128+
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
129+
<DisableSpecificWarnings>4453</DisableSpecificWarnings>
130+
</ClCompile>
131+
</ItemDefinitionGroup>
132+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
133+
<ClCompile>
134+
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
135+
<DisableSpecificWarnings>4453</DisableSpecificWarnings>
136+
</ClCompile>
137+
</ItemDefinitionGroup>
138+
<ItemGroup>
139+
<ClInclude Include="Facebook.h" />
140+
<ClInclude Include="pch.h" />
141+
<ClInclude Include="App.xaml.h">
142+
<DependentUpon>App.xaml</DependentUpon>
143+
</ClInclude>
144+
<ClInclude Include="MainPage.xaml.h">
145+
<DependentUpon>MainPage.xaml</DependentUpon>
146+
</ClInclude>
147+
</ItemGroup>
148+
<ItemGroup>
149+
<ApplicationDefinition Include="App.xaml">
150+
<SubType>Designer</SubType>
151+
</ApplicationDefinition>
152+
<Page Include="Common\StandardStyles.xaml">
153+
<SubType>Designer</SubType>
154+
</Page>
155+
<Page Include="MainPage.xaml">
156+
<SubType>Designer</SubType>
157+
</Page>
158+
</ItemGroup>
159+
<ItemGroup>
160+
<AppxManifest Include="Package.appxmanifest">
161+
<SubType>Designer</SubType>
162+
</AppxManifest>
163+
<None Include="FacebookDemo_TemporaryKey.pfx" />
164+
</ItemGroup>
165+
<ItemGroup>
166+
<Image Include="Assets\Logo.png" />
167+
<Image Include="Assets\SmallLogo.png" />
168+
<Image Include="Assets\StoreLogo.png" />
169+
<Image Include="Assets\SplashScreen.png" />
170+
</ItemGroup>
171+
<ItemGroup>
172+
<ClCompile Include="App.xaml.cpp">
173+
<DependentUpon>App.xaml</DependentUpon>
174+
</ClCompile>
175+
<ClCompile Include="Facebook.cpp" />
176+
<ClCompile Include="MainPage.xaml.cpp">
177+
<DependentUpon>MainPage.xaml</DependentUpon>
178+
</ClCompile>
179+
<ClCompile Include="pch.cpp">
180+
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
181+
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
182+
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">Create</PrecompiledHeader>
183+
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">Create</PrecompiledHeader>
184+
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
185+
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
186+
</ClCompile>
187+
</ItemGroup>
188+
<ItemGroup>
189+
<SDKReference Include="CppRESTWindowsSDK, Version=0.6" />
190+
</ItemGroup>
191+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
192+
<ImportGroup Label="ExtensionTargets">
193+
</ImportGroup>
194+
</Project>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<Application
2+
x:Class="FacebookDemo.App"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:local="using:FacebookDemo">
6+
7+
<Application.Resources>
8+
<ResourceDictionary>
9+
<ResourceDictionary.MergedDictionaries>
10+
11+
<!--
12+
Styles that define common aspects of the platform look and feel
13+
Required by Visual Studio project and item templates
14+
-->
15+
<ResourceDictionary Source="Common/StandardStyles.xaml"/>
16+
</ResourceDictionary.MergedDictionaries>
17+
18+
</ResourceDictionary>
19+
</Application.Resources>
20+
</Application>
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
//
2+
// App.xaml.cpp
3+
// Implementation of the App class.
4+
//
5+
6+
#include "pch.h"
7+
#include "MainPage.xaml.h"
8+
9+
using namespace FacebookDemo;
10+
11+
using namespace Platform;
12+
using namespace Windows::ApplicationModel;
13+
using namespace Windows::ApplicationModel::Activation;
14+
using namespace Windows::Foundation;
15+
using namespace Windows::Foundation::Collections;
16+
using namespace Windows::UI::Xaml;
17+
using namespace Windows::UI::Xaml::Controls;
18+
using namespace Windows::UI::Xaml::Controls::Primitives;
19+
using namespace Windows::UI::Xaml::Data;
20+
using namespace Windows::UI::Xaml::Input;
21+
using namespace Windows::UI::Xaml::Interop;
22+
using namespace Windows::UI::Xaml::Media;
23+
using namespace Windows::UI::Xaml::Navigation;
24+
25+
// The Blank Application template is documented at http://go.microsoft.com/fwlink/?LinkId=234227
26+
27+
/// <summary>
28+
/// Initializes the singleton application object. This is the first line of authored code
29+
/// executed, and as such is the logical equivalent of main() or WinMain().
30+
/// </summary>
31+
App::App()
32+
{
33+
InitializeComponent();
34+
Suspending += ref new SuspendingEventHandler(this, &App::OnSuspending);
35+
}
36+
37+
/// <summary>
38+
/// Invoked when the application is launched normally by the end user. Other entry points
39+
/// will be used when the application is launched to open a specific file, to display
40+
/// search results, and so forth.
41+
/// </summary>
42+
/// <param name="args">Details about the launch request and process.</param>
43+
void App::OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ args)
44+
{
45+
auto rootFrame = dynamic_cast<Frame^>(Window::Current->Content);
46+
47+
// Do not repeat app initialization when the Window already has content,
48+
// just ensure that the window is active
49+
if (rootFrame == nullptr)
50+
{
51+
// Create a Frame to act as the navigation context and associate it with
52+
// a SuspensionManager key
53+
rootFrame = ref new Frame();
54+
55+
if (args->PreviousExecutionState == ApplicationExecutionState::Terminated)
56+
{
57+
// TODO: Restore the saved session state only when appropriate, scheduling the
58+
// final launch steps after the restore is complete
59+
60+
}
61+
62+
if (rootFrame->Content == nullptr)
63+
{
64+
// When the navigation stack isn't restored navigate to the first page,
65+
// configuring the new page by passing required information as a navigation
66+
// parameter
67+
if (!rootFrame->Navigate(TypeName(MainPage::typeid), args->Arguments))
68+
{
69+
throw ref new FailureException("Failed to create initial page");
70+
}
71+
}
72+
// Place the frame in the current Window
73+
Window::Current->Content = rootFrame;
74+
// Ensure the current window is active
75+
Window::Current->Activate();
76+
}
77+
else
78+
{
79+
if (rootFrame->Content == nullptr)
80+
{
81+
// When the navigation stack isn't restored navigate to the first page,
82+
// configuring the new page by passing required information as a navigation
83+
// parameter
84+
if (!rootFrame->Navigate(TypeName(MainPage::typeid), args->Arguments))
85+
{
86+
throw ref new FailureException("Failed to create initial page");
87+
}
88+
}
89+
// Ensure the current window is active
90+
Window::Current->Activate();
91+
}
92+
}
93+
94+
/// <summary>
95+
/// Invoked when application execution is being suspended. Application state is saved
96+
/// without knowing whether the application will be terminated or resumed with the contents
97+
/// of memory still intact.
98+
/// </summary>
99+
/// <param name="sender">The source of the suspend request.</param>
100+
/// <param name="e">Details about the suspend request.</param>
101+
void App::OnSuspending(Object^ sender, SuspendingEventArgs^ e)
102+
{
103+
(void) sender; // Unused parameter
104+
(void) e; // Unused parameter
105+
106+
//TODO: Save application state and stop any background activity
107+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
//
2+
// App.xaml.h
3+
// Declaration of the App class.
4+
//
5+
6+
#pragma once
7+
8+
#include "App.g.h"
9+
10+
namespace FacebookDemo
11+
{
12+
/// <summary>
13+
/// Provides application-specific behavior to supplement the default Application class.
14+
/// </summary>
15+
ref class App sealed
16+
{
17+
public:
18+
App();
19+
virtual void OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ args) override;
20+
21+
private:
22+
void OnSuspending(Platform::Object^ sender, Windows::ApplicationModel::SuspendingEventArgs^ e);
23+
};
24+
}
801 Bytes
Loading
329 Bytes
Loading
2.1 KB
Loading
429 Bytes
Loading

0 commit comments

Comments
 (0)