//
// MainPage.xaml.cpp
// Implementation of the MainPage class.
//
#include "pch.h"
#include "MainPage.xaml.h"
#include <ppltasks.h>
using namespace App1;
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;
using namespace Windows::Storage;
using namespace Windows::Storage::Pickers;
using namespace Windows::Storage::Streams;
using namespace concurrency;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
MainPage::MainPage()
{
InitializeComponent();
auto picker= ref new FileOpenPicker();
picker->CommitButtonText= "Read from a file with ifstream";
picker->ViewMode = PickerViewMode::List;
picker->SuggestedStartLocation = PickerLocationId::DocumentsLibrary;
picker->FileTypeFilter->Append(".txt"); // Required
picker->FileTypeFilter->Append("*");
Windows::Storage::StorageFolder ^ localFolder= Windows::Storage::ApplicationData::Current->LocalFolder;
task< StorageFile^ > getFileTask ( picker->PickSingleFileAsync() );
getFileTask.then( [=] ( StorageFile^ storageFile )
{
if ( nullptr == storageFile ) return;
Platform::String ^ destfilename = storageFile->Name;
auto option= Windows::Storage::NameCollisionOption::ReplaceExisting;
create_task( storageFile->CopyAsync( localFolder, destfilename, option)).then([=](StorageFile^ sampleFileCopy)
{
});
});
}
/// <summary>
/// Invoked when this page is about to be displayed in a Frame.
/// </summary>
/// <param name="e">Event data that describes how this page was reached. The Parameter
/// property is typically used to configure the page.</param>
void MainPage::OnNavigatedTo(NavigationEventArgs^ e)
{
(void) e; // Unused parameter
}
// MainPage.xaml.cpp
// Implementation of the MainPage class.
//
#include "pch.h"
#include "MainPage.xaml.h"
#include <ppltasks.h>
using namespace App1;
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;
using namespace Windows::Storage;
using namespace Windows::Storage::Pickers;
using namespace Windows::Storage::Streams;
using namespace concurrency;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
MainPage::MainPage()
{
InitializeComponent();
auto picker= ref new FileOpenPicker();
picker->CommitButtonText= "Read from a file with ifstream";
picker->ViewMode = PickerViewMode::List;
picker->SuggestedStartLocation = PickerLocationId::DocumentsLibrary;
picker->FileTypeFilter->Append(".txt"); // Required
picker->FileTypeFilter->Append("*");
Windows::Storage::StorageFolder ^ localFolder= Windows::Storage::ApplicationData::Current->LocalFolder;
task< StorageFile^ > getFileTask ( picker->PickSingleFileAsync() );
getFileTask.then( [=] ( StorageFile^ storageFile )
{
if ( nullptr == storageFile ) return;
Platform::String ^ destfilename = storageFile->Name;
auto option= Windows::Storage::NameCollisionOption::ReplaceExisting;
create_task( storageFile->CopyAsync( localFolder, destfilename, option)).then([=](StorageFile^ sampleFileCopy)
{
});
});
}
/// <summary>
/// Invoked when this page is about to be displayed in a Frame.
/// </summary>
/// <param name="e">Event data that describes how this page was reached. The Parameter
/// property is typically used to configure the page.</param>
void MainPage::OnNavigatedTo(NavigationEventArgs^ e)
{
(void) e; // Unused parameter
}