Skip to content

Commit a680167

Browse files
authored
Stwhi master/cs 3 (#2045)
* review edoits * corrections, and fixing typo
1 parent 1160696 commit a680167

File tree

3 files changed

+14
-17
lines changed

3 files changed

+14
-17
lines changed

hub/apps/windows-app-sdk/migrate-to-windows-app-sdk/case-study-1.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Begin by [cloning the UWP sample app's repo](https://github.com/microsoft/window
2020
2121
## Install the Windows App SDK VSIX
2222

23-
If you haven't already, then download the Windows App SDK Visual Studio extension (VSIX) installer, and run to install it. See from [Windows App SDK release channels](/windows/apps/windows-app-sdk/release-channels).
23+
If you haven't already, then download the Windows App SDK Visual Studio extension (VSIX) installer, and run to install it. See [Windows App SDK release channels](/windows/apps/windows-app-sdk/release-channels).
2424

2525
> [!IMPORTANT]
2626
> You'll find release notes topics along with the [Windows App SDK release channels](/windows/apps/windows-app-sdk/release-channels) topic. There are release notes for each channel. Be sure to check any *limitations and known issues* in those release notes, since those might affect the results of following along with this case study and/or running the migrated app.

hub/apps/windows-app-sdk/migrate-to-windows-app-sdk/case-study-2.md

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Begin by [cloning the UWP sample app's repo](https://github.com/microsoft/window
2020
2121
## Install the Windows App SDK VSIX
2222

23-
If you haven't already, then download the Windows App SDK Visual Studio extension (VSIX) installer, and run to install it. See from [Windows App SDK release channels](/windows/apps/windows-app-sdk/release-channels).
23+
If you haven't already, then download the Windows App SDK Visual Studio extension (VSIX) installer, and run to install it. See [Windows App SDK release channels](/windows/apps/windows-app-sdk/release-channels).
2424

2525
> [!IMPORTANT]
2626
> You'll find release notes topics along with the [Windows App SDK release channels](/windows/apps/windows-app-sdk/release-channels) topic. There are release notes for each channel. Be sure to check any *limitations and known issues* in those release notes, since those might affect the results of following along with this case study and/or running the migrated app.
@@ -38,7 +38,7 @@ In Visual Studio, create a new C++/WinRT project from the **Blank App, Packaged
3838

3939
* We'll begin by copying over the asset files.
4040
* Then we'll migrate the **Photo** model.
41-
* Next we'll migrate the **App** class (since that needs some members adding to it that **DetailPage** and **MainPage** will depend on).
41+
* Next we'll migrate the **App** class (because that needs some members adding to it that **DetailPage** and **MainPage** will depend on).
4242
* Then we'll begin migrating the views, starting with **DetailPage** first.
4343
* And we'll finish up by migrating the **MainPage** view.
4444

@@ -108,7 +108,7 @@ Now confirm that you can build the target solution (but don't run yet).
108108

109109
## Migrate the App class
110110

111-
No changes are necessary to the target project's `App.idl` and `App.xaml`. But we do need to edit `App.xaml.h` and App`.xaml.cpp` to add some new members to the **App** class. We'll do so in a way that lets us build after each section.
111+
No changes are necessary to the target project's `App.idl` and `App.xaml`. But we do need to edit `App.xaml.h` and App`.xaml.cpp` to add some new members to the **App** class. We'll do so in a way that lets us build after each section (with the exception of the last section).
112112

113113
### Making the main window object available
114114

@@ -170,18 +170,17 @@ void App::OnLaunched(LaunchActivatedEventArgs const&)
170170
}
171171
```
172172

173-
The code above gives **App** a dependency on **MainPage**, so we won't be able to build yet.
173+
The code above gives **App** a dependency on **MainPage**, so we won't be able to build from this point until we've migrated **DetailPage** and then **MainPage**. When we're able to build again, we'll say so.
174174

175175
## Migrate the DetailPage view
176176

177177
**DetailPage** is the class that represents the photo editor page, where Win2D effects are toggled, set, and chained together. You get to the photo editor page by selecting a photo thumbnail on **MainPage**. **DetailPage** is a *view* (in the sense of models, views, and viewmodels).
178178

179179
### Reference the Win2D NuGet package
180180

181-
To support code in **DetailPage**, the source project has a dependency on [Win2D](https://microsoft.github.io/Win2D/WinUI3/html/Introduction.htm). So we'll also need a dependency on Win2D in our target project. But Win2D itself has a dependency on [DWriteCore](/windows/win32/directwrite/dwritecore-overview). So let's add the NuGet packages in the following order.
181+
To support code in **DetailPage**, the source project has a dependency on [Win2D](https://microsoft.github.io/Win2D/WinUI3/html/Introduction.htm). So we'll also need a dependency on Win2D in our target project.
182182

183-
* In the target solution in Visual Studio, click **Tools** > **NuGet Package Manager** > **Manage NuGet Packages for Solution...** > **Browse**, and type or paste *Microsoft.WindowsAppSDK.DWrite*. Select the correct item in search results, check the *PhotoEditor* project, and click **Install** to install the package into that project.
184-
* Repeat those steps for the *Microsoft.Graphics.Win2D* NuGet package.
183+
* In the target solution in Visual Studio, click **Tools** > **NuGet Package Manager** > **Manage NuGet Packages for Solution...** > **Browse**. Make sure that **Include prerelease** is unchecked, and type or paste *Microsoft.Graphics.Win2D* into the search box. Select the correct item in search results, check the *PhotoEditor* project, and click **Install** to install the package.
185184

186185
### Copy DetailPage source code files
187186

@@ -213,7 +212,7 @@ Save and close the project file. When you set focus back to Visual Studio, click
213212

214213
In `DetailPage.idl`, search for `Windows.UI.Xaml`, and change that to `Microsoft.UI.Xaml`.
215214

216-
In `DetailPage.xaml.cpp`, change `#include "DetailPage.h"` to `#include "DetailPage.xaml.h"`. Immediately below that, add `#include "DetailPage.g.cpp"`. And (for the call to the static **App::Window** method to compile), add `#include "App.xaml.h"` immediately before `#include "Photo.h"`.
215+
In `DetailPage.xaml.cpp`, change `#include "DetailPage.h"` to `#include "DetailPage.xaml.h"`. Immediately below that, add `#include "DetailPage.g.cpp"`. And (for the call to the static **App::Window** method, which we're about to add, to compile), add `#include "App.xaml.h"` immediately before `#include "Photo.h"`.
217216

218217
Make the following find/replacements (match case and whole word) in the contents of all of the source code in the files that you just copied and pasted.
219218

@@ -224,7 +223,9 @@ Make the following find/replacements (match case and whole word) in the contents
224223
From `pch.h` in the source project, copy the following includes, and paste them into `pch.h` in the target project.
225224

226225
```cppwinrt
226+
#include <winrt/Windows.Graphics.Effects.h>
227227
#include <winrt/Microsoft.Graphics.Canvas.Effects.h>
228+
#include <winrt/Microsoft.Graphics.Canvas.UI.Xaml.h>
228229
#include <winrt/Microsoft.UI.Composition.h>
229230
#include <winrt/Microsoft.UI.Xaml.Input.h>
230231
#include <winrt/Windows.Graphics.Imaging.h>
@@ -247,7 +248,7 @@ The main page of the app represents the view that you see first when you run the
247248

248249
### Copy MainPage source code files
249250

250-
Similar to what you did with **DetailPage**, now copy over `MainPage.idl`, `MainPage.xaml`, `MainPage.h`, and `MainPage.cpp`. Rename the `.h` and `.cpp` files to `.xaml.h` and `.xaml.cpp`, respectively. Include all four files in the target project.
251+
Similar to what you did with **DetailPage**, now copy over `MainPage.idl`, `MainPage.xaml`, `MainPage.h`, and `MainPage.cpp`. Rename the `.h` and `.cpp` files to `.xaml.h` and `.xaml.cpp`, respectively. Include all four files in the target project like before.
251252

252253
In the source project, in **Solution Explorer**, `MainPage.idl` is nested under `MainPage.xaml`. If you like that arrangement, then you can do the same thing in the target project by manually editing `\PhotoEditor\PhotoEditor\PhotoEditor\PhotoEditor.vcxproj`. Find the following:
253254

@@ -269,7 +270,7 @@ In `MainPage.idl`, search for `Windows.UI.Xaml`, and change both occurrences to
269270

270271
In `MainPage.xaml.cpp`, change `#include "MainPage.h"` to `#include "MainPage.xaml.h"`.
271272

272-
Immediately below that, add `#include "MainPage.g.cpp"`. And (for the call to the static **App::Window** method to compile) add `#include "App.xaml.h"` immediately before `#include "Photo.h"`.
273+
Immediately below that, add `#include "MainPage.g.cpp"`. And (for the call to the static **App::Window** method, which we're about to add, to compile) add `#include "App.xaml.h"` immediately before `#include "Photo.h"`.
273274

274275
For the next step, we'll make the change that's explained in [ContentDialog, and Popup](guides/winui3.md#contentdialog-and-popup). So, still in `MainPage.xaml.cpp`, in the **MainPage::GetItemsAsync** method, immediately after the line `ContentDialog unsupportedFilesDialog{};`, add this line of code.
275276

@@ -301,7 +302,7 @@ In `MainWindow.idl`, delete the placeholder `Int32 MyProperty;`, leaving only th
301302

302303
In `MainWindow.xaml.h` and `MainWindow.xaml.cpp`, delete the declarations and definitions of the placeholder **MyProperty** and **myButton_Click**, leaving only the constructor.
303304

304-
Those are the last of the changes we need to make to migrate the *Photo Editor* sample app. In the next section we'll confirm that we've correctly followed the steps.
305+
Those are the last of the changes we need to make to migrate the *Photo Editor* sample app. In the **Test the migrated app** section we'll confirm that we've correctly followed the steps.
305306

306307
## Known issues
307308

@@ -360,10 +361,6 @@ The following listing identifies file names, methods, and lines of code that nee
360361
}
361362
```
362363

363-
### The Win2D NuGet package, and Preview 3
364-
365-
The *Microsoft.Graphics.Win2D* NuGet package isn't compatible with the Windows App SDK [version 1.0 Preview 3 (1.0.0-preview3)](/windows/apps/windows-app-sdk/preview-channel). If you're using that version, then remove the reference to the NuGet package, and comment out the source code that depends on it (specifically, the use of **Microsoft::Graphics::Canvas::Effects** types in **DetailPage**).
366-
367364
## Test the migrated app
368365

369366
Now build the project, and run the app to test it. Select an image, set a zoom level, choose effects, and configure them.

hub/apps/windows-app-sdk/reference-framework-package-run-time.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ For background information about framework packages, see [MSIX framework package
1515
> [!NOTE]
1616
> In addition to the bootstrapper API, the Windows App SDK also provides an implementation of the *dynamic dependency API*. This API enables your unpackaged apps to take a dependency on *any* framework package (not just the Windows App SDK framework package), and it is used internally by the bootstrapper API. For more information about the dynamic dependency API, see [Reference framework packages at run time](../desktop/modernize/framework-packages/use-the-dynamic-dependency-api.md).
1717
18-
## Using the bootrapper API
18+
## Using the bootstrapper API
1919

2020
The bootstrapper API consists of two C/C++ functions that are declared in the [mddbootstrap.h](/windows/windows-app-sdk/api/win32/mddbootstrap) header file in the Windows App SDK: [MddBootstrapInitialize](/windows/windows-app-sdk/api/win32/mddbootstrap/nf-mddbootstrap-mddbootstrapinitialize) and [MddBootstrapShutdown](/windows/windows-app-sdk/api/win32/mddbootstrap/nf-mddbootstrap-mddbootstrapshutdown). These functions are provided by the [bootstrapper](deployment-architecture.md#bootstrapper) library in the Windows App SDK. This library is a small DLL that must be distributed with your app; it is not part of the framework package itself.
2121

0 commit comments

Comments
 (0)