Use Prism6 to create a common program for Windows 10., prism6windows
Use Prism6 to create a common program for Windows 10.
Objective: to create a Windows general program project using prism6.
1. solution-add new project-General-blank application-enter name-OK-OK
2. Right-click the reference and choose manage NuGet packages. Click Browse and enter Prism. unity to find and install the NuGet package. Then click confirm to install the program.
3. Open App. xaml and change Application to PrismUnityApplication.
4. Open the App. xaml. cs code file.
Delete 32 rows. this. Suspending + = OnSuspending;
Delete 35 ~ 104 rows
Add: using Prism. Unity. Windows; using System. Threading. Tasks;
Change Application to PrismUnityApplication
Add method:
Protected override Task OnLaunchApplicationAsync (LaunchActivatedEventArgs args)
{
NavigationService. Navigate ("Homepage", null );
Return Task. FromResult <object> (null );
}
5. Create the Views directory and add the blank Page "homepage Page" (Note that there must be several words behind the Page, and the navigation name is not written here)
After adding text to the homepage, you can start the program to check the effect.
Summary:
1. Use Nuget to reference Prism. Unity.
2. Change the Application in the App file to PrismUnityApplication, and change both the foreground and background.
3. Override the OnLaunchApplicationAsync method. This method is required for program startup.
Moving forward to a general program...