removed outdated sample application

This commit is contained in:
Austin Diviness 2016-01-12 13:17:45 -08:00
Родитель b00c4ff8b8
Коммит 9db8974f3a
1 изменённых файлов: 0 добавлений и 137 удалений

Просмотреть файл

@ -1,137 +0,0 @@
//
// MainPage.xaml.cpp
// Implementation of the MainPage class.
//
#include "pch.h"
#include "MainPage.xaml.h"
#include "UserInfo.xaml.h"
using namespace concurrency;
using namespace Facebook;
using namespace LoginCpp;
using namespace Platform;
using namespace Windows::ApplicationModel;
using namespace Windows::ApplicationModel::Activation;
using namespace Windows::ApplicationModel::Core;
using namespace Windows::ApplicationModel::Resources;
using namespace Windows::Foundation;
using namespace Windows::Foundation::Collections;
using namespace Windows::Security::Authentication::Web;
using namespace Windows::UI::Core;
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=402352&clcid=0x409
#define FBAppIDName L"FBApplicationId"
#define FBStoreAppIDName L"FBWindowsAppId"
MainPage::MainPage()
{
InitializeComponent();
FBSession^ s = FBSession::ActiveSession;
String^ whatever = WebAuthenticationBroker::GetCurrentApplicationCallbackUri()->DisplayUri + L"\n";
OutputDebugString(whatever->Data());
// Assumes the Facebook App ID and Windows Phone Store ID have been saved
// in the default resource file.
// TODO: Commenting this out for now - resource loader isn't working for me in UAP app.
ResourceLoader^ rl = ResourceLoader::GetForCurrentView();
String^ appId = rl->GetString(FBAppIDName);
String^ winAppId = rl->GetString(FBStoreAppIDName);
// IDs are both sent to FB app, so it can validate us.
s->FBAppId = appId;
s->WinAppId = winAppId;
}
void MainPage::login_OnClicked(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
FBSession^ sess = FBSession::ActiveSession;
if (sess->LoggedIn)
{
sess->Logout();
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
{
sess->AddPermission("public_profile");
sess->AddPermission("user_friends");
sess->AddPermission("user_likes");
sess->AddPermission("user_groups");
sess->AddPermission("user_location");
create_task(sess->LoginAsync()).then([=](FBResult^ result)
{
if (result)
{
if (result->Succeeded)
{
LoginButton->Content = L"Logout";
// We're redirecting to a page that shows simple user info, so
// have to dispatch back to the UI thread.
CoreWindow^ wind = CoreApplication::MainView->CoreWindow;
if (wind)
{
CoreDispatcher^ disp = wind->Dispatcher;
if (disp)
{
disp->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);
}));
}
}
}
else
{
String^ msg = L"Login failed! Error info:\n";
OutputDebugString(msg->Data());
if (result->ErrorInfo->Message)
{
msg = L" Message: " + result->ErrorInfo->Message + L"\n";
OutputDebugString(msg->Data());
}
if (result->ErrorInfo->Type)
{
msg = L" Type: " + result->ErrorInfo->Type + L"\n";
OutputDebugString(msg->Data());
}
if (result->ErrorInfo->ErrorUserTitle)
{
msg = L" ErrorUserTitle: " + result->ErrorInfo->ErrorUserTitle + L"\n";
OutputDebugString(msg->Data());
}
if (result->ErrorInfo->ErrorUserMessage)
{
msg = L" ErrorUserMessage: " + result->ErrorInfo->ErrorUserMessage + L"\n";
OutputDebugString(msg->Data());
}
}
}
});
}
}