Skip to content

Commit

Permalink
Add UwpAddOn project and updated README.md files. (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
samco-msft authored Oct 8, 2019
1 parent 54cfe16 commit d91d752
Show file tree
Hide file tree
Showing 28 changed files with 884 additions and 16 deletions.
30 changes: 30 additions & 0 deletions DiceWebSampleApps.sln
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Scripts", "Scripts", "{B8A1
Scripts\DiceWebUtils.ps1 = Scripts\DiceWebUtils.ps1
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UwpAddOn", "UwpAddOn\UwpAddOn.vcxproj", "{EC04DA50-C53C-45DE-BB5D-D825C9D66D26}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{0DFFDF7D-B218-46DB-BEF2-4B7AF56A6DB0}"
ProjectSection(SolutionItems) = preProject
CODE_OF_CONDUCT.md = CODE_OF_CONDUCT.md
LICENSE = LICENSE
README.md = README.md
SECURITY.md = SECURITY.md
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|ARM = Debug|ARM
Expand Down Expand Up @@ -72,6 +82,26 @@ Global
{C1127118-934E-4B73-81AC-4FD8DA7F2C96}.Release|x86.ActiveCfg = Release|Win32
{C1127118-934E-4B73-81AC-4FD8DA7F2C96}.Release|x86.Build.0 = Release|Win32
{C1127118-934E-4B73-81AC-4FD8DA7F2C96}.Release|x86.Deploy.0 = Release|Win32
{EC04DA50-C53C-45DE-BB5D-D825C9D66D26}.Debug|ARM.ActiveCfg = Debug|ARM
{EC04DA50-C53C-45DE-BB5D-D825C9D66D26}.Debug|ARM.Build.0 = Debug|ARM
{EC04DA50-C53C-45DE-BB5D-D825C9D66D26}.Debug|ARM.Deploy.0 = Debug|ARM
{EC04DA50-C53C-45DE-BB5D-D825C9D66D26}.Debug|ARM64.ActiveCfg = Debug|Win32
{EC04DA50-C53C-45DE-BB5D-D825C9D66D26}.Debug|x64.ActiveCfg = Debug|x64
{EC04DA50-C53C-45DE-BB5D-D825C9D66D26}.Debug|x64.Build.0 = Debug|x64
{EC04DA50-C53C-45DE-BB5D-D825C9D66D26}.Debug|x64.Deploy.0 = Debug|x64
{EC04DA50-C53C-45DE-BB5D-D825C9D66D26}.Debug|x86.ActiveCfg = Debug|Win32
{EC04DA50-C53C-45DE-BB5D-D825C9D66D26}.Debug|x86.Build.0 = Debug|Win32
{EC04DA50-C53C-45DE-BB5D-D825C9D66D26}.Debug|x86.Deploy.0 = Debug|Win32
{EC04DA50-C53C-45DE-BB5D-D825C9D66D26}.Release|ARM.ActiveCfg = Release|ARM
{EC04DA50-C53C-45DE-BB5D-D825C9D66D26}.Release|ARM.Build.0 = Release|ARM
{EC04DA50-C53C-45DE-BB5D-D825C9D66D26}.Release|ARM.Deploy.0 = Release|ARM
{EC04DA50-C53C-45DE-BB5D-D825C9D66D26}.Release|ARM64.ActiveCfg = Release|Win32
{EC04DA50-C53C-45DE-BB5D-D825C9D66D26}.Release|x64.ActiveCfg = Release|x64
{EC04DA50-C53C-45DE-BB5D-D825C9D66D26}.Release|x64.Build.0 = Release|x64
{EC04DA50-C53C-45DE-BB5D-D825C9D66D26}.Release|x64.Deploy.0 = Release|x64
{EC04DA50-C53C-45DE-BB5D-D825C9D66D26}.Release|x86.ActiveCfg = Release|Win32
{EC04DA50-C53C-45DE-BB5D-D825C9D66D26}.Release|x86.Build.0 = Release|Win32
{EC04DA50-C53C-45DE-BB5D-D825C9D66D26}.Release|x86.Deploy.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
23 changes: 13 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,24 @@ This repository contains sample projects to generate apps, games and other conte
## Prerequisites

- [Visual Studio](https://visualstudio.microsoft.com/downloads/)
- [Microsoft Partner Center account](https://partner.microsoft.com/en-us/dashboard/home)

## Setup

- Open the DiceWebSampleApps.sln in Visual Studio
- Associate the project with your store account
- Select the project in the Solution Explorer
- Select menu Project -> Publish -> Associate app with the store ...
- Open the **DiceWebSampleApps.sln** in Visual Studio
- Review specific setup steps for each project
- [UwpCppApp](UwpCppApp/README.md)
- [UwpNetNativeApp](UwpNetNativeApp/README.md)
- [UwpAddOn](UwpAddOn/README.md)

## Running the sample

- Open the DiceWebSampleApps.sln in Visual Studio
- Create packages for upload to Partner Center
- Select the project in the Solution Explorer
- Select menu Project -> Publish -> Create app packages ...
- Choose "Microsoft Store as {AppName} by {AppPublisher}". Do not choose side-loading
- When finished, visit the output location for the packages.
- Open the **DiceWebSampleApps.sln** in Visual Studio
- Verify all setup tasks have been completed
- Review specific steps to run each project
- [UwpCppApp](UwpCppApp/README.md)
- [UwpNetNativeApp](UwpNetNativeApp/README.md)
- [UwpAddOn](UwpAddOn/README.md)

## Contents

Expand All @@ -50,6 +52,7 @@ Outline the file contents of the repository. It helps users navigate the codebas
|-------------------|--------------------------------------------|
| `UwpCppApp` | Sample UWP app using C++. |
| `UwpNetNativeApp` | Sample UWP app using CSharp. |
| `UwpAddOn` | Sample UWP AddOn app using C++. |
| `.gitignore` | Define what to ignore at commit time. |
| `CHANGELOG.md` | List of changes to the sample. |
| `CONTRIBUTING.md` | Guidelines for contributing to the sample. |
Expand Down
10 changes: 10 additions & 0 deletions UwpAddOn/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!-- Copyright (c) Microsoft Corporation.
Licensed under the MIT License. -->
<Application
x:Class="UwpAddOn.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:UwpAddOn"
RequestedTheme="Light">

</Application>
126 changes: 126 additions & 0 deletions UwpAddOn/App.xaml.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
//
// App.xaml.cpp
// Implementation of the App class.
//

#include "pch.h"
#include "MainPage.xaml.h"

using namespace UwpAddOn;

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::Navigation;

/// <summary>
/// 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().
/// </summary>
App::App()
{
InitializeComponent();
Suspending += ref new SuspendingEventHandler(this, &App::OnSuspending);
}

/// <summary>
/// Invoked when the application is launched normally by the end user. Other entry points
/// will be used such as when the application is launched to open a specific file.
/// </summary>
/// <param name="e">Details about the launch request and process.</param>
void App::OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ e)
{
#if _DEBUG
// Show graphics profiling information while debugging.
if (IsDebuggerPresent())
{
// Display the current frame rate counters
DebugSettings->EnableFrameRateCounter = true;
}
#endif
auto rootFrame = dynamic_cast<Frame^>(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();

rootFrame->NavigationFailed += ref new Windows::UI::Xaml::Navigation::NavigationFailedEventHandler(this, &App::OnNavigationFailed);

if (e->PreviousExecutionState == ApplicationExecutionState::Terminated)
{
// TODO: Restore the saved session state only when appropriate, scheduling the
// final launch steps after the restore is complete

}

if (e->PrelaunchActivated == false)
{
if (rootFrame->Content == nullptr)
{
// When the navigation stack isn't restored navigate to the first page,
// configuring the new page by passing required information as a navigation
// parameter
rootFrame->Navigate(TypeName(MainPage::typeid), e->Arguments);
}
// Place the frame in the current Window
Window::Current->Content = rootFrame;
// Ensure the current window is active
Window::Current->Activate();
}
}
else
{
if (e->PrelaunchActivated == false)
{
if (rootFrame->Content == nullptr)
{
// When the navigation stack isn't restored navigate to the first page,
// configuring the new page by passing required information as a navigation
// parameter
rootFrame->Navigate(TypeName(MainPage::typeid), e->Arguments);
}
// Ensure the current window is active
Window::Current->Activate();
}
}
}

/// <summary>
/// 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.
/// </summary>
/// <param name="sender">The source of the suspend request.</param>
/// <param name="e">Details about the suspend request.</param>
void App::OnSuspending(Object^ sender, SuspendingEventArgs^ e)
{
(void) sender; // Unused parameter
(void) e; // Unused parameter

//TODO: Save application state and stop any background activity
}

/// <summary>
/// Invoked when Navigation to a certain page fails
/// </summary>
/// <param name="sender">The Frame which failed navigation</param>
/// <param name="e">Details about the navigation failure</param>
void App::OnNavigationFailed(Platform::Object ^sender, Windows::UI::Xaml::Navigation::NavigationFailedEventArgs ^e)
{
throw ref new FailureException("Failed to load Page " + e->SourcePageType.Name);
}
29 changes: 29 additions & 0 deletions UwpAddOn/App.xaml.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
//
// App.xaml.h
// Declaration of the App class.
//

#pragma once

#include "App.g.h"

namespace UwpAddOn
{
/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
/// </summary>
ref class App sealed
{
protected:
virtual void OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ e) override;

internal:
App();

private:
void OnSuspending(Platform::Object^ sender, Windows::ApplicationModel::SuspendingEventArgs^ e);
void OnNavigationFailed(Platform::Object ^sender, Windows::UI::Xaml::Navigation::NavigationFailedEventArgs ^e);
};
}
Binary file added UwpAddOn/Assets/LockScreenLogo.scale-200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added UwpAddOn/Assets/SplashScreen.scale-200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added UwpAddOn/Assets/Square150x150Logo.scale-200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added UwpAddOn/Assets/Square44x44Logo.scale-200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added UwpAddOn/Assets/StoreLogo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added UwpAddOn/Assets/Wide310x150Logo.scale-200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions UwpAddOn/MainPage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!-- Copyright (c) Microsoft Corporation.
Licensed under the MIT License. -->
<Page
x:Class="UwpAddOn.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:UwpAddOn"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

</Grid>
</Page>
29 changes: 29 additions & 0 deletions UwpAddOn/MainPage.xaml.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
//
// MainPage.xaml.cpp
// Implementation of the MainPage class.
//

#include "pch.h"
#include "MainPage.xaml.h"

using namespace UwpAddOn;

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=402352&clcid=0x409

MainPage::MainPage()
{
InitializeComponent();
}
23 changes: 23 additions & 0 deletions UwpAddOn/MainPage.xaml.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
//
// MainPage.xaml.h
// Declaration of the MainPage class.
//

#pragma once

#include "MainPage.g.h"

namespace UwpAddOn
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public ref class MainPage sealed
{
public:
MainPage();

};
}
40 changes: 40 additions & 0 deletions UwpAddOn/Package.appxmanifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
xmlns:uap3="http://schemas.microsoft.com/appx/manifest/uap/windows10/3"
IgnorableNamespaces="uap mp uap3">
<Identity
Name="PublisherName.UwpAddOn"
Publisher="CN=PublisherName"
Version="1.0.0.0" />
<mp:PhoneIdentity PhoneProductId="84ae4f41-f92e-40cb-bb32-94c35856bff3" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
<Properties>
<DisplayName>UwpAddOn</DisplayName>
<PublisherDisplayName>PublisherName</PublisherDisplayName>
<Logo>Assets\StoreLogo.png</Logo>
</Properties>
<Dependencies>
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.14311.0" MaxVersionTested="10.0.14380.0" />
<PackageDependency Name="Microsoft.VCLibs.140.00" MinVersion="14.0.23918.0" Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" />
<uap3:MainPackageDependency Name="PublisherName.ParentApp" />
</Dependencies>
<Resources>
<Resource Language="x-generate" />
</Resources>
<Applications>
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="UwpAddOn.App">
<uap:VisualElements
AppListEntry="none"
DisplayName="UwpAddOn"
Square150x150Logo="Assets\Square150x150Logo.png"
Square44x44Logo="Assets\Square44x44Logo.png"
Description="AddOn1"
BackgroundColor="transparent">
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png">
</uap:DefaultTile>
<uap:SplashScreen Image="Assets\SplashScreen.png" />
</uap:VisualElements>
</Application>
</Applications>
</Package>
Loading

0 comments on commit d91d752

Please sign in to comment.