зеркало из https://github.com/microsoft/winsdkfb.git
LoginCpp-UWP sample improvements
This commit is contained in:
Родитель
1129e7b8c6
Коммит
4317b1e22f
|
@ -111,6 +111,9 @@ void App::OnLaunched(LaunchActivatedEventArgs^ e)
|
|||
|
||||
// Place the frame in the current Window
|
||||
Window::Current->Content = rootFrame;
|
||||
|
||||
SystemNavigationManager::GetForCurrentView()->BackRequested += ref new Windows::Foundation::EventHandler<Windows::UI::Core::BackRequestedEventArgs ^>(this, &LoginCpp::App::OnBackRequested);
|
||||
rootFrame->Navigated += ref new Windows::UI::Xaml::Navigation::NavigatedEventHandler(this, &LoginCpp::App::OnNavigated);
|
||||
}
|
||||
|
||||
if (rootFrame->Content == nullptr)
|
||||
|
@ -241,3 +244,28 @@ void App::OnSuspending(Object^ sender, SuspendingEventArgs^ e)
|
|||
|
||||
// TODO: Save application state and stop any background activity
|
||||
}
|
||||
|
||||
|
||||
void LoginCpp::App::OnBackRequested(Platform::Object^ sender, Windows::UI::Core::BackRequestedEventArgs ^args)
|
||||
{
|
||||
Frame^ rootFrame = dynamic_cast<Frame^>(Window::Current->Content);
|
||||
if (rootFrame->CanGoBack)
|
||||
{
|
||||
args->Handled = true;
|
||||
rootFrame->GoBack();
|
||||
}
|
||||
}
|
||||
|
||||
void LoginCpp::App::OnNavigated(Platform::Object^ sender, Windows::UI::Xaml::Navigation::NavigationEventArgs^ args)
|
||||
{
|
||||
|
||||
Frame^ rootFrame = dynamic_cast<Frame^>(Window::Current->Content);
|
||||
if (rootFrame->CanGoBack)
|
||||
{
|
||||
SystemNavigationManager::GetForCurrentView()->AppViewBackButtonVisibility = AppViewBackButtonVisibility::Visible;
|
||||
}
|
||||
else
|
||||
{
|
||||
SystemNavigationManager::GetForCurrentView()->AppViewBackButtonVisibility = AppViewBackButtonVisibility::Collapsed;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,5 +50,7 @@ namespace LoginCpp
|
|||
#endif
|
||||
|
||||
void OnSuspending(Platform::Object^ sender, Windows::ApplicationModel::SuspendingEventArgs^ e);
|
||||
};
|
||||
void OnBackRequested(Platform::Object^ sender, Windows::UI::Core::BackRequestedEventArgs ^args);
|
||||
void OnNavigated(Platform::Object^ sender, Windows::UI::Xaml::Navigation::NavigationEventArgs^ args);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -27,11 +27,10 @@
|
|||
<TextBlock Text="Show Dialogs" Margin="0,-6.5,0,26.5" Style="{ThemeResource HeaderTextBlockStyle}" CharacterSpacing="{ThemeResource PivotHeaderItemCharacterSpacing}"/>
|
||||
</StackPanel>
|
||||
|
||||
<!--TODO: Content should be placed within the following grid-->
|
||||
<Grid Grid.Row="1" x:Name="ContentRoot" Margin="19,9.5,19,0">
|
||||
<Button Content="Feed" HorizontalAlignment="Left" Height="73" VerticalAlignment="Top" Width="362" Margin="0,-10,0,0" Click="Feed_Click"/>
|
||||
<Button Content="App Requests" HorizontalAlignment="Left" Height="73" VerticalAlignment="Top" Width="362" Margin="0,49,0,0" Click="AppRequests_Click"/>
|
||||
|
||||
</Grid>
|
||||
<StackPanel Grid.Row="1" x:Name="ContentRoot" Margin="19,9.5,19,0">
|
||||
<Button Content="Feed Dialog" Width="{Binding ActualWidth, ElementName=ContentRoot}" HorizontalAlignment="Left" Height="73" VerticalAlignment="Top" MaxWidth="362" Margin="0,10,0,0" Click="FeedDialogButton_Click"/>
|
||||
<Button Content="App Requests Dialog" Width="{Binding ActualWidth, ElementName=ContentRoot}" HorizontalAlignment="Left" Height="73" VerticalAlignment="Top" MaxWidth="362" Margin="0,10,0,0" Click="AppRequestsButton_Click"/>
|
||||
<Button Content="Send Dialog" Width="{Binding ActualWidth, ElementName=ContentRoot}" x:Name="SendDialogButton" HorizontalAlignment="Left" Margin="0,10,0,0" VerticalAlignment="Top" Height="73" MaxWidth="362" Click="SendDialogButton_Click"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Page>
|
||||
|
|
|
@ -131,7 +131,7 @@ void Dialogs::SaveState(Object^ sender, Common::SaveStateEventArgs^ e) {
|
|||
}
|
||||
|
||||
|
||||
void Dialogs::Feed_Click(
|
||||
void Dialogs::FeedDialogButton_Click(
|
||||
Object^ sender,
|
||||
RoutedEventArgs^ e
|
||||
)
|
||||
|
@ -158,7 +158,7 @@ void Dialogs::Feed_Click(
|
|||
}
|
||||
|
||||
|
||||
void Dialogs::AppRequests_Click(
|
||||
void Dialogs::AppRequestsButton_Click(
|
||||
Object^ sender,
|
||||
RoutedEventArgs^ e
|
||||
)
|
||||
|
@ -183,3 +183,25 @@ void Dialogs::AppRequests_Click(
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void LoginCpp::Dialogs::SendDialogButton_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
|
||||
{
|
||||
FBSession^ s = FBSession::ActiveSession;
|
||||
if (!s->LoggedIn)
|
||||
{
|
||||
OutputDebugString(L"The user is no longer logged in.\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
PropertySet^ params = ref new PropertySet();
|
||||
|
||||
params->Insert(L"link", L"http://example.com");
|
||||
|
||||
create_task(s->ShowSendDialogAsync(params))
|
||||
.then([=](FBResult^ DialogResponse)
|
||||
{
|
||||
OutputDebugString(L"Showed 'Send' dialog.\n");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,8 +62,9 @@ namespace LoginCpp
|
|||
|
||||
static Windows::UI::Xaml::DependencyProperty^ _defaultViewModelProperty;
|
||||
static Windows::UI::Xaml::DependencyProperty^ _navigationHelperProperty;
|
||||
void Feed_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void AppRequests_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void FeedDialogButton_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void AppRequestsButton_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void SendDialogButton_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{351701a8-12d1-45b3-8e6a-164d796b0297}</ProjectGuid>
|
||||
|
@ -141,9 +141,6 @@
|
|||
<DependentUpon>Dialogs.xaml</DependentUpon>
|
||||
</ClInclude>
|
||||
<ClInclude Include="FBPageBindable.h" />
|
||||
<ClInclude Include="OptionsPage.xaml.h">
|
||||
<DependentUpon>OptionsPage.xaml</DependentUpon>
|
||||
</ClInclude>
|
||||
<ClInclude Include="pch.h" />
|
||||
<ClInclude Include="App.xaml.h">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
|
@ -166,7 +163,6 @@
|
|||
<Page Include="MainPage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="OptionsPage.xaml" />
|
||||
<Page Include="UserInfo.xaml" />
|
||||
<Page Include="UserLikes.xaml" />
|
||||
</ItemGroup>
|
||||
|
@ -197,9 +193,6 @@
|
|||
<ClCompile Include="MainPage.xaml.cpp">
|
||||
<DependentUpon>MainPage.xaml</DependentUpon>
|
||||
</ClCompile>
|
||||
<ClCompile Include="OptionsPage.xaml.cpp">
|
||||
<DependentUpon>OptionsPage.xaml</DependentUpon>
|
||||
</ClCompile>
|
||||
<ClCompile Include="pch.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
|
@ -225,4 +218,4 @@
|
|||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets" />
|
||||
</Project>
|
||||
</Project>
|
|
@ -65,10 +65,9 @@
|
|||
<Page Include="MainPage.xaml" />
|
||||
<Page Include="UserInfo.xaml" />
|
||||
<Page Include="UserLikes.xaml" />
|
||||
<Page Include="OptionsPage.xaml" />
|
||||
<Page Include="Dialogs.xaml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PRIResource Include="Resources.resw" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
</Project>
|
|
@ -7,12 +7,35 @@
|
|||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
<Button x:Name="LoginButton" Content="Login To FB" HorizontalAlignment="Left" Margin="39,48,0,0" VerticalAlignment="Top" Click="login_OnClicked"/>
|
||||
<!--<fbsdk:ProfilePictureControl />-->
|
||||
<TextBlock FontSize="14" HorizontalAlignment="Left" Margin="39,111,0,0" TextWrapping="Wrap" Text="Access Token:" VerticalAlignment="Top" Width="261" Height="18"/>
|
||||
<TextBlock x:Name="ResponseText" FontSize="14" HorizontalAlignment="Left" Margin="39,135,0,0" Text="TextBox" TextWrapping="Wrap" VerticalAlignment="Top" Height="94" Width="261"/>
|
||||
<TextBlock FontSize="14" HorizontalAlignment="Left" Margin="39,263,0,0" TextWrapping="Wrap" Text="Expires" VerticalAlignment="Top" Height="24" Width="261"/>
|
||||
<TextBlock x:Name="ExpirationDate" FontSize="14" HorizontalAlignment="Left" Margin="39,289,0,0" TextWrapping="Wrap" Text="TextBlock" VerticalAlignment="Top" Width="261" Height="24"/>
|
||||
</Grid>
|
||||
<ScrollViewer>
|
||||
<Grid x:Name="LayoutRoot" Loaded="LayoutRoot_Loaded">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<StackPanel Grid.Row="0" Margin="19,0,0,0">
|
||||
<TextBlock Text="Facebook Sample App" Style="{ThemeResource TitleTextBlockStyle}" Margin="0,12,0,0"/>
|
||||
<TextBlock Text="Login Information" Margin="0,-6.5,0,26.5" Style="{ThemeResource HeaderTextBlockStyle}" CharacterSpacing="{ThemeResource PivotHeaderItemCharacterSpacing}"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Row="1" Margin="19,0,19,0" x:Name="ContentRoot" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
<ComboBox x:Name="LoginMethodComboBox" SelectedIndex="0" HorizontalAlignment="Left" Margin="0,10,0,0" VerticalAlignment="Top" MaxWidth="362" Width="{Binding ActualWidth, ElementName=ContentRoot}" VerticalContentAlignment="Center">
|
||||
<ComboBoxItem Content="WebView" />
|
||||
<ComboBoxItem Content="WebAuth" />
|
||||
<ComboBoxItem Content="WebAccountProvider" />
|
||||
<ComboBoxItem Content="DefaultOrdering" />
|
||||
<ComboBoxItem Content="Silent" />
|
||||
</ComboBox>
|
||||
<Button x:Name="LoginButton" Content="Login To FB" HorizontalAlignment="Left" Margin="0,10,0,0" VerticalAlignment="Top" Click="login_OnClicked" Width="{Binding ActualWidth, ElementName=ContentRoot}" MaxWidth="362" Height="68"/>
|
||||
<Button x:Name="UserInfoButton" Content="User Info" IsEnabled="False" HorizontalAlignment="Left" Margin="0,10,0,0" VerticalAlignment="Top" Click="UserInfoButton_Click" Width="{Binding ActualWidth, ElementName=ContentRoot}" MaxWidth="362" Height="68"/>
|
||||
<Button x:Name="DialogsPageButton" Content="Dialogs" IsEnabled="False" HorizontalAlignment="Left" Margin="0,10,0,0" VerticalAlignment="Top" Click="DialogsPageButton_Click" Width="{Binding ActualWidth, ElementName=ContentRoot}" MaxWidth="362" Height="68"/>
|
||||
<!--<fbsdk:ProfilePictureControl />-->
|
||||
<TextBlock FontSize="14" HorizontalAlignment="Left" Margin="0,10,0,0" TextWrapping="Wrap" Text="Access Token:" VerticalAlignment="Top" Width="261" Height="18"/>
|
||||
<TextBlock x:Name="AccessTokenText" FontSize="14" HorizontalAlignment="Left" Margin="0,10,0,0" Text="" TextWrapping="Wrap" VerticalAlignment="Top" MaxHeight="120" MaxWidth="362" IsRightTapEnabled="True" IsTextSelectionEnabled="True"/>
|
||||
<TextBlock FontSize="14" HorizontalAlignment="Left" Margin="0,10,0,0" TextWrapping="Wrap" Text="Expires:" VerticalAlignment="Top" Height="24" Width="261"/>
|
||||
<TextBlock x:Name="ExpirationDateText" FontSize="14" HorizontalAlignment="Left" Margin="0,10,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" MaxWidth="261" Height="24" IsRightTapEnabled="True" IsTextSelectionEnabled="True"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</Page>
|
||||
|
|
|
@ -21,7 +21,8 @@
|
|||
|
||||
#include "pch.h"
|
||||
#include "MainPage.xaml.h"
|
||||
#include "OptionsPage.xaml.h"
|
||||
#include "Dialogs.xaml.h"
|
||||
#include "UserInfo.xaml.h"
|
||||
|
||||
using namespace concurrency;
|
||||
using namespace winsdkfb;
|
||||
|
@ -43,6 +44,7 @@ using namespace Windows::UI::Xaml::Data;
|
|||
using namespace Windows::UI::Xaml::Input;
|
||||
using namespace Windows::UI::Xaml::Media;
|
||||
using namespace Windows::UI::Xaml::Navigation;
|
||||
using namespace Windows::Globalization::DateTimeFormatting;
|
||||
|
||||
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409
|
||||
|
||||
|
@ -130,20 +132,6 @@ BOOL MainPage::ShouldRerequest(
|
|||
!DidGetAllRequestedPermissions());
|
||||
}
|
||||
|
||||
void MainPage::NavigateToOptionsPage()
|
||||
{
|
||||
LoginButton->Content = L"Logout";
|
||||
|
||||
CoreApplication::MainView->CoreWindow->Dispatcher->RunAsync(
|
||||
Windows::UI::Core::CoreDispatcherPriority::Normal,
|
||||
ref new Windows::UI::Core::DispatchedHandler([this]()
|
||||
{
|
||||
LoginCpp::App^ a = dynamic_cast<LoginCpp::App^>(Application::Current);
|
||||
Windows::UI::Xaml::Controls::Frame^ f = a->CreateRootFrame();
|
||||
f->Navigate(OptionsPage::typeid);
|
||||
}));
|
||||
}
|
||||
|
||||
void MainPage::TryRerequest(
|
||||
BOOL retry
|
||||
)
|
||||
|
@ -171,7 +159,7 @@ void MainPage::TryRerequest(
|
|||
}
|
||||
else
|
||||
{
|
||||
NavigateToOptionsPage();
|
||||
UpdateXamlControls();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -207,14 +195,13 @@ void MainPage::login_OnClicked(
|
|||
if (sess->LoggedIn)
|
||||
{
|
||||
sess->LogoutAsync();
|
||||
LoginButton->Content = L"Logout";
|
||||
LoginCpp::App^ a = dynamic_cast<LoginCpp::App^>(Application::Current);
|
||||
Windows::UI::Xaml::Controls::Frame^ f = a->CreateRootFrame();
|
||||
f->Navigate(MainPage::typeid);
|
||||
}
|
||||
else
|
||||
{
|
||||
create_task(sess->LoginAsync(BuildPermissions())).then([=](FBResult^ result)
|
||||
create_task(sess->LoginAsync(BuildPermissions(), GetLoginBehavior())).then([=](FBResult^ result)
|
||||
{
|
||||
// There may be other cases where an a failed login request should
|
||||
// prompt the app to retry login, but this one is common enough that
|
||||
|
@ -238,8 +225,91 @@ void MainPage::login_OnClicked(
|
|||
else if (result->Succeeded)
|
||||
{
|
||||
// Got a token and all our permissions.
|
||||
NavigateToOptionsPage();
|
||||
UpdateXamlControls();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
SessionLoginBehavior MainPage::GetLoginBehavior()
|
||||
{
|
||||
ComboBoxItem^ selectedLoginMethod = dynamic_cast<ComboBoxItem^>(LoginMethodComboBox->SelectedItem);
|
||||
String^ text = dynamic_cast<String^>(selectedLoginMethod->Content);
|
||||
if (String::CompareOrdinal(text, L"WebView") == 0)
|
||||
{
|
||||
return SessionLoginBehavior::WebView;
|
||||
}
|
||||
if (String::CompareOrdinal(text, L"WebAuth") == 0)
|
||||
{
|
||||
return SessionLoginBehavior::WebAuth;
|
||||
}
|
||||
if (String::CompareOrdinal(text, L"WebAccountProvider") == 0)
|
||||
{
|
||||
return SessionLoginBehavior::WebAccountProvider;
|
||||
}
|
||||
if (String::CompareOrdinal(text, L"DefaultOrdering") == 0)
|
||||
{
|
||||
return SessionLoginBehavior::DefaultOrdering;
|
||||
}
|
||||
if (String::CompareOrdinal(text, L"Silent") == 0)
|
||||
{
|
||||
return SessionLoginBehavior::Silent;
|
||||
}
|
||||
throw ref new InvalidArgumentException();
|
||||
}
|
||||
|
||||
void LoginCpp::MainPage::LayoutRoot_Loaded(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
|
||||
{
|
||||
UpdateXamlControls();
|
||||
}
|
||||
|
||||
void LoginCpp::MainPage::UpdateXamlControls()
|
||||
{
|
||||
FBSession^ sess = FBSession::ActiveSession;
|
||||
if (sess->LoggedIn)
|
||||
{
|
||||
LoginButton->Content = L"Logout";
|
||||
AccessTokenText->Text = sess->AccessTokenData->AccessToken;
|
||||
DateTimeFormatter^ dateFormatter = ref new DateTimeFormatter(
|
||||
L"{year.full(4)}-{month.integer(2)}-{day.integer(2)} "
|
||||
L"{hour.integer(2)}:{minute.integer(2)}:{second.integer(2)}");
|
||||
ExpirationDateText->Text = dateFormatter->Format(sess->AccessTokenData->ExpirationDate);
|
||||
UserInfoButton->IsEnabled = true;
|
||||
DialogsPageButton->IsEnabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
LoginButton->Content = L"Login To FB";
|
||||
AccessTokenText->Text = L"";
|
||||
ExpirationDateText->Text = L"";
|
||||
UserInfoButton->IsEnabled = false;
|
||||
DialogsPageButton->IsEnabled = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void LoginCpp::MainPage::UserInfoButton_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
|
||||
{
|
||||
CoreApplication::MainView->CoreWindow->Dispatcher->RunAsync(
|
||||
Windows::UI::Core::CoreDispatcherPriority::Normal,
|
||||
ref new Windows::UI::Core::DispatchedHandler([this]()
|
||||
{
|
||||
LoginCpp::App^ a = dynamic_cast<LoginCpp::App^>(Application::Current);
|
||||
Windows::UI::Xaml::Controls::Frame^ f = a->CreateRootFrame();
|
||||
f->Navigate(UserInfo::typeid);
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
void LoginCpp::MainPage::DialogsPageButton_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
|
||||
{
|
||||
CoreApplication::MainView->CoreWindow->Dispatcher->RunAsync(
|
||||
Windows::UI::Core::CoreDispatcherPriority::Normal,
|
||||
ref new Windows::UI::Core::DispatchedHandler([this]()
|
||||
{
|
||||
LoginCpp::App^ a = dynamic_cast<LoginCpp::App^>(Application::Current);
|
||||
Windows::UI::Xaml::Controls::Frame^ f = a->CreateRootFrame();
|
||||
f->Navigate(Dialogs::typeid);
|
||||
}));
|
||||
}
|
||||
|
|
|
@ -51,9 +51,6 @@ namespace LoginCpp
|
|||
winsdkfb::FBResult^ result
|
||||
);
|
||||
|
||||
void NavigateToOptionsPage(
|
||||
);
|
||||
|
||||
void MainPage::TryRerequest(
|
||||
BOOL retry
|
||||
);
|
||||
|
@ -64,5 +61,26 @@ namespace LoginCpp
|
|||
void login_OnClicked(
|
||||
Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e
|
||||
);
|
||||
};
|
||||
|
||||
winsdkfb::SessionLoginBehavior GetLoginBehavior(
|
||||
);
|
||||
|
||||
void MainPage::UpdateXamlControls(
|
||||
);
|
||||
|
||||
void LayoutRoot_Loaded(
|
||||
Platform::Object^ sender,
|
||||
Windows::UI::Xaml::RoutedEventArgs^ e
|
||||
);
|
||||
|
||||
void UserInfoButton_Click(
|
||||
Platform::Object^ sender,
|
||||
Windows::UI::Xaml::RoutedEventArgs^ e
|
||||
);
|
||||
|
||||
void DialogsPageButton_Click (
|
||||
Platform::Object^ sender,
|
||||
Windows::UI::Xaml::RoutedEventArgs^ e
|
||||
);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,67 +0,0 @@
|
|||
<Page
|
||||
x:Class="LoginCpp.OptionsPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:LoginCpp"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
|
||||
<Grid x:Name="LayoutRoot">
|
||||
<Grid.ChildrenTransitions>
|
||||
<TransitionCollection>
|
||||
<EntranceThemeTransition/>
|
||||
</TransitionCollection>
|
||||
</Grid.ChildrenTransitions>
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Title Panel -->
|
||||
<StackPanel Grid.Row="0" Margin="19,0,0,0">
|
||||
<TextBlock Text="Facebook Sample App" Style="{ThemeResource TitleTextBlockStyle}" Margin="0,12,0,0"/>
|
||||
<TextBlock Text="Options:" Margin="0,-6.5,0,26.5" Style="{ThemeResource HeaderTextBlockStyle}" CharacterSpacing="{ThemeResource PivotHeaderItemCharacterSpacing}"/>
|
||||
</StackPanel>
|
||||
|
||||
<Grid Grid.Row="1" x:Name="ContentRoot" Margin="19,9.5,19,0">
|
||||
<Button Content="User Info" HorizontalAlignment="Left" Height="68" VerticalAlignment="Top" Width="362" Margin="0,-10,0,0" Click="userInfo_OnClicked"/>
|
||||
<Button Content="Dialogs" HorizontalAlignment="Left" Height="68" VerticalAlignment="Top" Width="362" Margin="0,74,0,0" Click="dialogs_OnClicked"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Page>
|
||||
|
||||
|
||||
<!--<Page
|
||||
x:Class="LoginCpp.OptionsPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:LoginCpp"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
|
||||
<Grid x:Name="LayoutRoot">
|
||||
|
||||
<Grid.ChildrenTransitions>
|
||||
<TransitionCollection>
|
||||
<EntranceThemeTransition/>
|
||||
</TransitionCollection>
|
||||
</Grid.ChildrenTransitions>
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
--><!-- Title Panel --><!--
|
||||
<StackPanel Grid.Row="0" Margin="19,0,0,0">
|
||||
<TextBlock Text="Facebook Sample App" Style="{ThemeResource TitleTextBlockStyle}" Margin="0,12,0,0"/>
|
||||
<TextBlock Text="Options:" Margin="0,-6.5,0,26.5" Style="{ThemeResource HeaderTextBlockStyle}" CharacterSpacing="{ThemeResource PivotHeaderItemCharacterSpacing}"/>
|
||||
</StackPanel>
|
||||
|
||||
--><!--TODO: Content should be placed within the following grid--><!--
|
||||
</Grid>
|
||||
</Page>-->
|
|
@ -1,64 +0,0 @@
|
|||
//******************************************************************************
|
||||
//
|
||||
// Copyright (c) 2015 Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// This code is licensed under the MIT License (MIT).
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
//******************************************************************************
|
||||
|
||||
//
|
||||
// OptionsPage.xaml.cpp
|
||||
// Implementation of the OptionsPage class
|
||||
//
|
||||
|
||||
#include "pch.h"
|
||||
#include "OptionsPage.xaml.h"
|
||||
#include "UserInfo.xaml.h"
|
||||
#include "Dialogs.xaml.h"
|
||||
|
||||
using namespace LoginCpp;
|
||||
|
||||
using namespace Platform;
|
||||
using namespace Windows::Foundation;
|
||||
using namespace Windows::Foundation::Collections;
|
||||
using namespace Windows::UI::Xaml;
|
||||
using namespace Windows::UI::Xaml::Controls;
|
||||
using namespace Windows::UI::Xaml::Controls::Primitives;
|
||||
using namespace Windows::UI::Xaml::Data;
|
||||
using namespace Windows::UI::Xaml::Input;
|
||||
using namespace Windows::UI::Xaml::Media;
|
||||
using namespace Windows::UI::Xaml::Navigation;
|
||||
|
||||
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
|
||||
|
||||
OptionsPage::OptionsPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
void OptionsPage::userInfo_OnClicked(
|
||||
Platform::Object^ sender,
|
||||
Windows::UI::Xaml::RoutedEventArgs^ e)
|
||||
{
|
||||
LoginCpp::App^ a = dynamic_cast<LoginCpp::App^>(Application::Current);
|
||||
Windows::UI::Xaml::Controls::Frame^ f = a->CreateRootFrame();
|
||||
f->Navigate(UserInfo::typeid);
|
||||
}
|
||||
|
||||
void OptionsPage::dialogs_OnClicked(
|
||||
Platform::Object^ sender,
|
||||
Windows::UI::Xaml::RoutedEventArgs^ e
|
||||
)
|
||||
{
|
||||
LoginCpp::App^ a = dynamic_cast<LoginCpp::App^>(Application::Current);
|
||||
Windows::UI::Xaml::Controls::Frame^ f = a->CreateRootFrame();
|
||||
f->Navigate(Dialogs::typeid);
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
//******************************************************************************
|
||||
//
|
||||
// Copyright (c) 2015 Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// This code is licensed under the MIT License (MIT).
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
//******************************************************************************
|
||||
|
||||
//
|
||||
// OptionsPage.xaml.h
|
||||
// Declaration of the OptionsPage class
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "OptionsPage.g.h"
|
||||
|
||||
namespace LoginCpp
|
||||
{
|
||||
/// <summary>
|
||||
/// An empty page that can be used on its own or navigated to within a Frame.
|
||||
/// </summary>
|
||||
[Windows::Foundation::Metadata::WebHostHidden]
|
||||
public ref class OptionsPage sealed
|
||||
{
|
||||
public:
|
||||
OptionsPage();
|
||||
|
||||
private:
|
||||
void userInfo_OnClicked(
|
||||
Platform::Object^ sender,
|
||||
Windows::UI::Xaml::RoutedEventArgs^ e
|
||||
);
|
||||
|
||||
void dialogs_OnClicked(
|
||||
Platform::Object^ sender,
|
||||
Windows::UI::Xaml::RoutedEventArgs^ e
|
||||
);
|
||||
};
|
||||
}
|
|
@ -9,57 +9,78 @@
|
|||
mc:Ignorable="d"
|
||||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
|
||||
<Grid x:Name="LayoutRoot">
|
||||
<ScrollViewer>
|
||||
<Grid x:Name="LayoutRoot">
|
||||
|
||||
<Grid.ChildrenTransitions>
|
||||
<TransitionCollection>
|
||||
<EntranceThemeTransition/>
|
||||
</TransitionCollection>
|
||||
</Grid.ChildrenTransitions>
|
||||
<Grid.ChildrenTransitions>
|
||||
<TransitionCollection>
|
||||
<EntranceThemeTransition/>
|
||||
</TransitionCollection>
|
||||
</Grid.ChildrenTransitions>
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Title Panel -->
|
||||
<StackPanel Grid.Row="0" Margin="19,0,0,0">
|
||||
<TextBlock Text="FB Login Tester" Style="{ThemeResource TitleTextBlockStyle}" Margin="0,12,0,0"/>
|
||||
<TextBlock Text="User Info" Margin="0,-6.5,-0.167,26.5" Style="{ThemeResource HeaderTextBlockStyle}" />
|
||||
</StackPanel>
|
||||
<!-- Title Panel -->
|
||||
<StackPanel Grid.Row="0" Margin="19,0,0,0">
|
||||
<TextBlock Text="Facebook Sample App" Style="{ThemeResource TitleTextBlockStyle}" Margin="0,12,0,0"/>
|
||||
<TextBlock Text="User Info" Margin="0,-6.5,-0.167,26.5" Style="{ThemeResource HeaderTextBlockStyle}" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Row="1" Margin="19,0,0,0">
|
||||
<fbsdk:ProfilePictureControl Grid.Column="0" CropMode="Square" x:Name="SquarePicture" Width="100" Height="100" />
|
||||
<Button x:Name="UserLikesButton" Content="Show Likes..." HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Click="UserLikesButton_Click"/>
|
||||
</StackPanel>
|
||||
|
||||
<!--TODO: Content should be placed within the following grid-->
|
||||
<Grid Grid.Row="2" x:Name="ContentRoot" Margin="19,9.5,19,0">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel Grid.Row="0">
|
||||
<TextBlock Text="ID:" Style="{ThemeResource TitleTextBlockStyle}" Margin="0,12,0,0"/>
|
||||
<TextBlock x:Name="UserId" Text="<not set>" Style="{ThemeResource TitleTextBlockStyle}" Margin="0,12,0,0"/>
|
||||
<TextBlock Text="First Name:" Style="{ThemeResource TitleTextBlockStyle}" Margin="0,12,0,0"/>
|
||||
<TextBlock x:Name="UserFirstName" Text="<not set>" Style="{ThemeResource TitleTextBlockStyle}" Margin="0,12,0,0"/>
|
||||
<TextBlock Text="Gender:" Style="{ThemeResource TitleTextBlockStyle}" Margin="0,12,0,0"/>
|
||||
<TextBlock x:Name="UserGender" Text="<not set>" Style="{ThemeResource TitleTextBlockStyle}" Margin="0,12,0,0"/>
|
||||
<TextBlock Text="Last Name" Style="{ThemeResource TitleTextBlockStyle}" Margin="0,12,0,0"/>
|
||||
<TextBlock x:Name="UserLastName" Text="<not set>" Style="{ThemeResource TitleTextBlockStyle}" Margin="0,12,0,0"/>
|
||||
<TextBlock Text="Link:" Style="{ThemeResource TitleTextBlockStyle}" Margin="0,12,0,0"/>
|
||||
<TextBlock x:Name="UserLink" Text="<not set>" Style="{ThemeResource TitleTextBlockStyle}" Margin="0,12,0,0"/>
|
||||
<TextBlock Text="Locale:" Style="{ThemeResource TitleTextBlockStyle}" Margin="0,12,0,0"/>
|
||||
<TextBlock x:Name="UserLocale" Text="<not set>" Style="{ThemeResource TitleTextBlockStyle}" Margin="0,12,-0.5,0"/>
|
||||
<TextBlock Text="Name:" Style="{ThemeResource TitleTextBlockStyle}" Margin="0,12,0,0"/>
|
||||
<TextBlock x:Name="UserName" Text="<not set>" Style="{ThemeResource TitleTextBlockStyle}" Margin="0,12,0,0"/>
|
||||
<TextBlock Text="Timezone (from GMT):" Style="{ThemeResource TitleTextBlockStyle}" Margin="0,12,0,0"/>
|
||||
<TextBlock x:Name="UserTimezone" Text="<not set>" Style="{ThemeResource TitleTextBlockStyle}" Margin="0,12,0,0"/>
|
||||
<TextBlock Text="Updated Time:" Style="{ThemeResource TitleTextBlockStyle}" Margin="0,12,0,0"/>
|
||||
<TextBlock x:Name="UserUpdatedTime" Text="<not set>" Style="{ThemeResource TitleTextBlockStyle}" Margin="0,12,0,0"/>
|
||||
<TextBlock Text="Verified:" Style="{ThemeResource TitleTextBlockStyle}" Margin="0,12,0,0"/>
|
||||
<TextBlock x:Name="UserVerified" Text="<not set>" Style="{ThemeResource TitleTextBlockStyle}" Margin="0,12,0,0"/>
|
||||
<StackPanel Grid.Row="1" x:Name="StackPanel2" Orientation="Vertical" Margin="19,0,19,0">
|
||||
<StackPanel MaxWidth="362" HorizontalAlignment="Left" Width="{Binding ActualWidth, ElementName=StackPanel2}" Margin="0,0,0,12">
|
||||
<fbsdk:ProfilePictureControl Grid.Column="0" CropMode="Square" x:Name="SquarePicture" Width="100" Height="100" HorizontalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
<Button x:Name="UserLikesButton" Content="Show Likes..." HorizontalAlignment="Left" VerticalAlignment="Stretch" Click="UserLikesButton_Click" MaxWidth="362" Height="68" Width="{Binding ActualWidth, ElementName=StackPanel2}"/>
|
||||
</StackPanel>
|
||||
|
||||
<ScrollViewer Grid.Row="2" HorizontalScrollMode="Enabled" HorizontalScrollBarVisibility="Visible">
|
||||
<StackPanel Grid.Row="2" x:Name="ContentRoot" Orientation="Vertical" Margin="19,0,19,0">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="ID:" Margin="0,12,6,0" FontWeight="Bold"/>
|
||||
<TextBlock x:Name="UserId" Text="<not set>" Margin="0,12,0,0" IsRightTapEnabled="True" IsTextSelectionEnabled="True"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="First Name:" Margin="0,12,6,0" FontWeight="Bold"/>
|
||||
<TextBlock x:Name="UserFirstName" Text="<not set>" Margin="0,12,0,0" IsRightTapEnabled="True" IsTextSelectionEnabled="True"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="Gender:" Margin="0,12,6,0" FontWeight="Bold"/>
|
||||
<TextBlock x:Name="UserGender" Text="<not set>" Margin="0,12,0,0" IsRightTapEnabled="True" IsTextSelectionEnabled="True"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="Last Name" Margin="0,12,6,0" FontWeight="Bold"/>
|
||||
<TextBlock x:Name="UserLastName" Text="<not set>" Margin="0,12,0,0" IsRightTapEnabled="True" IsTextSelectionEnabled="True"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="Link:" Margin="0,12,6,0" FontWeight="Bold"/>
|
||||
<TextBlock x:Name="UserLink" Text="<not set>" Margin="0,12,0,0" IsRightTapEnabled="True" IsTextSelectionEnabled="True"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="Locale:" Margin="0,12,6,0" FontWeight="Bold"/>
|
||||
<TextBlock x:Name="UserLocale" Text="<not set>" Margin="0,12,-0.5,0" IsRightTapEnabled="True" IsTextSelectionEnabled="True"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="Name:" Margin="0,12,6,0" FontWeight="Bold"/>
|
||||
<TextBlock x:Name="UserName" Text="<not set>" Margin="0,12,0,0" IsRightTapEnabled="True" IsTextSelectionEnabled="True"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="Timezone (from GMT):" Margin="0,12,6,0" FontWeight="Bold"/>
|
||||
<TextBlock x:Name="UserTimezone" Text="<not set>" Margin="0,12,0,0" IsRightTapEnabled="True" IsTextSelectionEnabled="True"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="Updated Time:" Margin="0,12,6,0" FontWeight="Bold"/>
|
||||
<TextBlock x:Name="UserUpdatedTime" Text="<not set>" Margin="0,12,0,0" IsRightTapEnabled="True" IsTextSelectionEnabled="True"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="Verified:" Margin="0,12,6,0" FontWeight="Bold"/>
|
||||
<TextBlock x:Name="UserVerified" Text="<not set>" Margin="0,12,0,0" IsRightTapEnabled="True" IsTextSelectionEnabled="True"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</Page>
|
||||
|
|
|
@ -7,14 +7,41 @@
|
|||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" RenderTransformOrigin="0.473,0.499">
|
||||
<ListView ItemsSource="{Binding Items}" Background="Black" HorizontalAlignment="Left" Height="563" Margin="10,10,0,0" VerticalAlignment="Top" Width="380" SelectionChanged="ListView_SelectionChanged">
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBox Text="{Binding Name}" Foreground="White" BorderThickness="0" Background="Black"/>
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
</ListView>
|
||||
<TextBlock x:Name="ItemDescription" HorizontalAlignment="Left" Height="564" Margin="403,9,0,0" TextWrapping="Wrap" Text="{Binding SelectedItem.Description}" VerticalAlignment="Top" Width="939"/>
|
||||
</Grid>
|
||||
<ScrollViewer>
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup>
|
||||
<VisualState x:Name="WideView">
|
||||
<VisualState.StateTriggers>
|
||||
<AdaptiveTrigger MinWindowWidth="800" />
|
||||
</VisualState.StateTriggers>
|
||||
<VisualState.Setters>
|
||||
<Setter Target="ResultsStackPanel.Orientation" Value="Horizontal"/>
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
|
||||
<Grid x:Name="LayoutRoot" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<StackPanel Grid.Row="0" Margin="19,0,0,0">
|
||||
<TextBlock Text="Facebook Sample App" Style="{ThemeResource TitleTextBlockStyle}" Margin="0,12,0,0"/>
|
||||
<TextBlock Text="User Likes Results" Margin="0,-6.5,0,26.5" Style="{ThemeResource HeaderTextBlockStyle}" CharacterSpacing="{ThemeResource PivotHeaderItemCharacterSpacing}"/>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="1" Orientation="Vertical" x:Name="ResultsStackPanel" Margin="0,0,19,19">
|
||||
<TextBlock Grid.Row="2" x:Name="BadResultsTextBlock" Margin="19,0,0,0" Text="" Visibility="Collapsed"/>
|
||||
<ListView x:Name="LikesListView" Visibility="Collapsed" ItemsSource="{Binding Items}" Background="Black" HorizontalAlignment="Left" VerticalAlignment="Stretch" Margin="10,10,0,0" Width="362" SelectionMode="Single" IsItemClickEnabled="False" SelectionChanged="ListView_SelectionChanged">
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Name}" Foreground="White" HorizontalAlignment="Stretch"/>
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
</ListView>
|
||||
<TextBlock x:Name="ItemDescription" HorizontalAlignment="Left" Padding="0,0,19,0" Margin="19,10,0,0" TextWrapping="Wrap" Text="{Binding SelectedItem.Description}" VerticalAlignment="Top" MaxWidth="362" Width="{Binding ActualWidth, ElementName=ResultsStackPanel}"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</Page>
|
||||
|
|
|
@ -65,8 +65,7 @@ void UserLikes::AddLikes(
|
|||
IVectorView<Object^>^ NewLikes
|
||||
)
|
||||
{
|
||||
for (IIterator<Object^>^ it = NewLikes->First(); it->HasCurrent;
|
||||
it->MoveNext())
|
||||
for (IIterator<Object^>^ it = NewLikes->First(); it->HasCurrent; it->MoveNext())
|
||||
{
|
||||
FBPageBindable^ page = static_cast<FBPageBindable^>(it->Current);
|
||||
if (page)
|
||||
|
@ -76,21 +75,19 @@ void UserLikes::AddLikes(
|
|||
_listViewItems->Append(page);
|
||||
}
|
||||
}
|
||||
|
||||
// go through the paginated calls here so that we don't have to deal with task chaining
|
||||
if (_likes->HasNext)
|
||||
{
|
||||
create_task(_likes->NextAsync()).then([this](FBResult^ result)
|
||||
{
|
||||
if (result->Succeeded)
|
||||
{
|
||||
IVectorView<Object^>^ items =
|
||||
static_cast<IVectorView<Object^>^>(result->Object);
|
||||
AddLikes(items);
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: Handle FB errors...
|
||||
;
|
||||
IVectorView<Object^>^ items = static_cast<IVectorView<Object^>^> (result->Object);
|
||||
if (items->Size > 0)
|
||||
{
|
||||
AddLikes(items);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -114,14 +111,25 @@ void UserLikes::GetUserLikes(
|
|||
{
|
||||
if (result->Succeeded)
|
||||
{
|
||||
IVectorView<Object^>^ items = static_cast<IVectorView<Object^>^>
|
||||
(result->Object);
|
||||
AddLikes(items);
|
||||
BadResultsTextBlock->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
|
||||
LikesListView->Visibility = Windows::UI::Xaml::Visibility::Visible;
|
||||
IVectorView<Object^>^ items = static_cast<IVectorView<Object^>^> (result->Object);
|
||||
if (items->Size > 0)
|
||||
{
|
||||
AddLikes(items);
|
||||
}
|
||||
else
|
||||
{
|
||||
LikesListView->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
|
||||
BadResultsTextBlock->Visibility = Windows::UI::Xaml::Visibility::Visible;
|
||||
BadResultsTextBlock->Text = L"No User likes found";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: Handle FB errors...
|
||||
;
|
||||
LikesListView->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
|
||||
BadResultsTextBlock->Visibility = Windows::UI::Xaml::Visibility::Visible;
|
||||
BadResultsTextBlock->Text = result->ErrorInfo->Message;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче