diff --git a/samples/winrt_universal/.gitignore b/samples/winrt_universal/.gitignore new file mode 100644 index 0000000000..d4b2f0f455 --- /dev/null +++ b/samples/winrt_universal/.gitignore @@ -0,0 +1,87 @@ +# Ignore thumbnails created by windows +Thumbs.db + +#ignore winrt copies of opencv files +opencl_kernels.cpp +opencl_kernels.hpp + +# Ignore files build by Visual Studio +*.obj +*.exe +*.pdb +*.aps +*.vcproj.*.user +*.vcxproj.user +*.vspscc +*_i.c +*.i +*.icf +*_p.c +*.ncb +*.suo +*.tlb +*.tlh +*.bak +*.cache +*.ilk +*.log +*.winmd +[Bb]in +[Dd]ebug*/ +*.sbr +*.sdf +obj/ +[Rr]elease*/ +_ReSharper*/ +[Tt]est[Rr]esult* +ipch/ +*.opensdf +Generated Files +AppPackages +SubmissionInfo +*.hps + +# Ignore files build by ndk and eclipse +libs/ +bin/ +obj/ +gen/ +local.properties + +# Ignore python compiled files +*.pyc + +# Ignore files build by airplay and marmalade +build_*_xcode/ +build_*_vc10/ + +# Ignore files built by xcode +*.mode*v* +*.pbxuser +*.xcbkptlist +*.xcscheme +*.xcworkspacedata +*.xcuserstate +xcschememanagement.plist +build/ +.DS_Store +._.* +xcuserdata/ +DerivedData/ +*.xccheckout + +# Ignore files built by bada +.Simulator-Debug/ +.Target-Debug/ +.Target-Release/ + +# Ignore files built by blackberry +Simulator/ +Device-Debug/ +Device-Release/ + +# Ignore vim swaps +*.swp + +# CTags +tags diff --git a/samples/winrt_universal/PhoneTutorial/App.xaml b/samples/winrt_universal/PhoneTutorial/App.xaml new file mode 100644 index 0000000000..2f1febe3bd --- /dev/null +++ b/samples/winrt_universal/PhoneTutorial/App.xaml @@ -0,0 +1,7 @@ + + + \ No newline at end of file diff --git a/samples/winrt_universal/PhoneTutorial/App.xaml.cpp b/samples/winrt_universal/PhoneTutorial/App.xaml.cpp new file mode 100644 index 0000000000..2e8f3577ea --- /dev/null +++ b/samples/winrt_universal/PhoneTutorial/App.xaml.cpp @@ -0,0 +1,137 @@ +// +// App.xaml.cpp +// Implementation of the App class. +// + +#include "pch.h" +#include "MainPage.xaml.h" + +using namespace PhoneTutorial; + +using namespace Platform; +using namespace Windows::ApplicationModel; +using namespace Windows::ApplicationModel::Activation; +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::Interop; +using namespace Windows::UI::Xaml::Media; +using namespace Windows::UI::Xaml::Media::Animation; +using namespace Windows::UI::Xaml::Navigation; + +// The Blank Application template is documented at http://go.microsoft.com/fwlink/?LinkID=391641 + +/// +/// Initializes the singleton application object. This is the first line of authored code +/// executed, and as such is the logical equivalent of main() or WinMain(). +/// +App::App() +{ + InitializeComponent(); + Suspending += ref new SuspendingEventHandler(this, &App::OnSuspending); +} + +/// +/// Invoked when the application is launched normally by the end user. Other entry points +/// will be used when the application is launched to open a specific file, to display +/// search results, and so forth. +/// +/// Details about the launch request and process. +void App::OnLaunched(LaunchActivatedEventArgs^ e) +{ +#if _DEBUG + if (IsDebuggerPresent()) + { + DebugSettings->EnableFrameRateCounter = true; + } +#endif + + auto rootFrame = dynamic_cast(Window::Current->Content); + + // Do not repeat app initialization when the Window already has content, + // just ensure that the window is active. + if (rootFrame == nullptr) + { + // Create a Frame to act as the navigation context and associate it with + // a SuspensionManager key + rootFrame = ref new Frame(); + + // TODO: Change this value to a cache size that is appropriate for your application. + rootFrame->CacheSize = 1; + + if (e->PreviousExecutionState == ApplicationExecutionState::Terminated) + { + // TODO: Restore the saved session state only when appropriate, scheduling the + // final launch steps after the restore is complete. + } + + // Place the frame in the current Window + Window::Current->Content = rootFrame; + } + + if (rootFrame->Content == nullptr) + { + // Removes the turnstile navigation for startup. + if (rootFrame->ContentTransitions != nullptr) + { + _transitions = ref new TransitionCollection(); + for (auto transition : rootFrame->ContentTransitions) + { + _transitions->Append(transition); + } + } + + rootFrame->ContentTransitions = nullptr; + _firstNavigatedToken = rootFrame->Navigated += ref new NavigatedEventHandler(this, &App::RootFrame_FirstNavigated); + + // When the navigation stack isn't restored navigate to the first page, + // configuring the new page by passing required information as a navigation + // parameter. + if (!rootFrame->Navigate(MainPage::typeid, e->Arguments)) + { + throw ref new FailureException("Failed to create initial page"); + } + } + + // Ensure the current window is active + Window::Current->Activate(); +} + +/// +/// Restores the content transitions after the app has launched. +/// +void App::RootFrame_FirstNavigated(Object^ sender, NavigationEventArgs^ e) +{ + auto rootFrame = safe_cast(sender); + + TransitionCollection^ newTransitions; + if (_transitions == nullptr) + { + newTransitions = ref new TransitionCollection(); + newTransitions->Append(ref new NavigationThemeTransition()); + } + else + { + newTransitions = _transitions; + } + + rootFrame->ContentTransitions = newTransitions; + rootFrame->Navigated -= _firstNavigatedToken; +} + +/// +/// Invoked when application execution is being suspended. Application state is saved +/// without knowing whether the application will be terminated or resumed with the contents +/// of memory still intact. +/// +void App::OnSuspending(Object^ sender, SuspendingEventArgs^ e) +{ + (void) sender; // Unused parameter + (void) e; // Unused parameter + + // TODO: Save application state and stop any background activity +} \ No newline at end of file diff --git a/samples/winrt_universal/PhoneTutorial/App.xaml.h b/samples/winrt_universal/PhoneTutorial/App.xaml.h new file mode 100644 index 0000000000..3e68792ac6 --- /dev/null +++ b/samples/winrt_universal/PhoneTutorial/App.xaml.h @@ -0,0 +1,29 @@ +// +// App.xaml.h +// Declaration of the App class. +// + +#pragma once + +#include "App.g.h" + +namespace PhoneTutorial +{ + /// + /// Provides application-specific behavior to supplement the default Application class. + /// + ref class App sealed + { + public: + App(); + + virtual void OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ e) override; + + private: + Windows::UI::Xaml::Media::Animation::TransitionCollection^ _transitions; + Windows::Foundation::EventRegistrationToken _firstNavigatedToken; + + void OnSuspending(Platform::Object^ sender, Windows::ApplicationModel::SuspendingEventArgs^ e); + void RootFrame_FirstNavigated(Platform::Object^ sender, Windows::UI::Xaml::Navigation::NavigationEventArgs^ e); + }; +} diff --git a/samples/winrt_universal/PhoneTutorial/Assets/Logo.scale-240.png b/samples/winrt_universal/PhoneTutorial/Assets/Logo.scale-240.png new file mode 100644 index 0000000000..76921ca997 Binary files /dev/null and b/samples/winrt_universal/PhoneTutorial/Assets/Logo.scale-240.png differ diff --git a/samples/winrt_universal/PhoneTutorial/Assets/SmallLogo.scale-240.png b/samples/winrt_universal/PhoneTutorial/Assets/SmallLogo.scale-240.png new file mode 100644 index 0000000000..316630124f Binary files /dev/null and b/samples/winrt_universal/PhoneTutorial/Assets/SmallLogo.scale-240.png differ diff --git a/samples/winrt_universal/PhoneTutorial/Assets/SplashScreen.scale-240.png b/samples/winrt_universal/PhoneTutorial/Assets/SplashScreen.scale-240.png new file mode 100644 index 0000000000..33f26b3310 Binary files /dev/null and b/samples/winrt_universal/PhoneTutorial/Assets/SplashScreen.scale-240.png differ diff --git a/samples/winrt_universal/PhoneTutorial/Assets/Square71x71Logo.scale-240.png b/samples/winrt_universal/PhoneTutorial/Assets/Square71x71Logo.scale-240.png new file mode 100644 index 0000000000..cfa54bee03 Binary files /dev/null and b/samples/winrt_universal/PhoneTutorial/Assets/Square71x71Logo.scale-240.png differ diff --git a/samples/winrt_universal/PhoneTutorial/Assets/StoreLogo.scale-240.png b/samples/winrt_universal/PhoneTutorial/Assets/StoreLogo.scale-240.png new file mode 100644 index 0000000000..47e084b593 Binary files /dev/null and b/samples/winrt_universal/PhoneTutorial/Assets/StoreLogo.scale-240.png differ diff --git a/samples/winrt_universal/PhoneTutorial/Assets/WideLogo.scale-240.png b/samples/winrt_universal/PhoneTutorial/Assets/WideLogo.scale-240.png new file mode 100644 index 0000000000..6249d29db0 Binary files /dev/null and b/samples/winrt_universal/PhoneTutorial/Assets/WideLogo.scale-240.png differ diff --git a/samples/winrt_universal/PhoneTutorial/Lena.png b/samples/winrt_universal/PhoneTutorial/Lena.png new file mode 100644 index 0000000000..3e8668734a Binary files /dev/null and b/samples/winrt_universal/PhoneTutorial/Lena.png differ diff --git a/samples/winrt_universal/PhoneTutorial/MainPage.xaml b/samples/winrt_universal/PhoneTutorial/MainPage.xaml new file mode 100644 index 0000000000..428b2fa99c --- /dev/null +++ b/samples/winrt_universal/PhoneTutorial/MainPage.xaml @@ -0,0 +1,17 @@ + + + + +