From 4746bae7307a4387df2ff65afe8b78b071497ee0 Mon Sep 17 00:00:00 2001 From: "Andy (Steve) De George" <67293991+adegeo@users.noreply.github.com> Date: Mon, 3 Oct 2022 00:57:33 -0700 Subject: [PATCH] Add links to each step's code in the tutorial (#955) * adjust code; add link to sample * Update gitignore to include vscode * Update AllNotes.cs --- .gitignore | 1 + docs/tutorials/notes-app/includes/navigation.md | 4 +++- docs/tutorials/notes-app/includes/note.md | 2 ++ docs/tutorials/notes-app/includes/project.md | 2 ++ docs/tutorials/notes-app/includes/shell.md | 2 ++ .../snippets/navigation/csharp/Notes/Models/AllNotes.cs | 2 +- .../snippets/navigation/csharp/Notes/Views/NotePage.xaml.cs | 2 +- .../notes-app/snippets/note/csharp/Notes/NotePage.xaml.cs | 2 +- 8 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 1fc80445..f4efcad3 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ _site/ _themes*/ _repo.*/ .vs/ +.vscode/ .openpublishing.buildcore.ps1 .DS_Store diff --git a/docs/tutorials/notes-app/includes/navigation.md b/docs/tutorials/notes-app/includes/navigation.md index 188f7592..613def29 100644 --- a/docs/tutorials/notes-app/includes/navigation.md +++ b/docs/tutorials/notes-app/includes/navigation.md @@ -238,7 +238,7 @@ Currently the **note** view displays a single note, and there isn't a view that 01. In the **Solution Explorer** pane, right-click on the **Views** folder and select **Add** > **New Item...** 01. In the **Add New Item** dialog, select **.NET MAUI** in the template list on the left-side of the window. Next, select the **.NET MAUI ContentPage (XAML)** template. Name the file _AllNotesPage.xaml_, and then select **Add**. 01. In the **Solution Explorer** pane, right-click on the **Models** folder and select **Add** > **Class...** -01. Name the class **AllNotes.cs** and press **Add**. +01. Name the class _AllNotes.cs_ and press **Add**. ### Code the AllNotes model @@ -337,3 +337,5 @@ The `Routing.RegisterRoute` method takes two parameters: - The second parameter is the type of page to load when `"NotePage"` is navigated to. Now you can run your app. Try adding new notes, navigating back and forth between notes, and deleting notes. + +[![Explore the code.](~/media/code-sample.png) Explore the code for this step of the tutorial.](https://github.com/dotnet/maui-samples/tree/main/6.0/Tutorials/CreateNetMauiApp/step4) diff --git a/docs/tutorials/notes-app/includes/note.md b/docs/tutorials/notes-app/includes/note.md index 6f834b27..953c1e31 100644 --- a/docs/tutorials/notes-app/includes/note.md +++ b/docs/tutorials/notes-app/includes/note.md @@ -94,3 +94,5 @@ Now that **note page** is finished, you need a way to present it to the user. Op Save the file and run the app. Try typing into the entry box and press the **Save** button. Close the app, and reopen it. The note you entered should be loaded from the device's storage. :::image type="content" source="../media/note/final.png" alt-text="Note entry page in .NET MAUI app."::: + +[![Explore the code.](~/media/code-sample.png) Explore the code for this step of the tutorial.](https://github.com/dotnet/maui-samples/tree/main/6.0/Tutorials/CreateNetMauiApp/step3) diff --git a/docs/tutorials/notes-app/includes/project.md b/docs/tutorials/notes-app/includes/project.md index 1adaf0a8..464dbfbf 100644 --- a/docs/tutorials/notes-app/includes/project.md +++ b/docs/tutorials/notes-app/includes/project.md @@ -28,3 +28,5 @@ Set the **Debug Target** in the Visual Studio toolbar to the device you want to 01. Select the **Debug Target** dropdown button. 01. Select the **Android Emulators** item. 01. Select the emulator device. + +[![Explore the code.](~/media/code-sample.png) Explore the code for this step of the tutorial.](https://github.com/dotnet/maui-samples/tree/main/6.0/Tutorials/CreateNetMauiApp/step1) diff --git a/docs/tutorials/notes-app/includes/shell.md b/docs/tutorials/notes-app/includes/shell.md index 34c0c723..0cef3d13 100644 --- a/docs/tutorials/notes-app/includes/shell.md +++ b/docs/tutorials/notes-app/includes/shell.md @@ -147,3 +147,5 @@ You'll see that there are two tabs: **Notes** and **About**. Press the **About** Close the app and return to Visual Studio. If you're using the Android emulator, terminate the app in the virtual device or press the stop button at the top of Visual Studio: :::image type="content" source="../media/shell/vs-stop-button.png" alt-text="Visual Studio's stop debugging button."::: + +[![Explore the code.](~/media/code-sample.png) Explore the code for this step of the tutorial.](https://github.com/dotnet/maui-samples/tree/main/6.0/Tutorials/CreateNetMauiApp/step2) diff --git a/docs/tutorials/notes-app/snippets/navigation/csharp/Notes/Models/AllNotes.cs b/docs/tutorials/notes-app/snippets/navigation/csharp/Notes/Models/AllNotes.cs index d3c722f9..35f2dfb5 100644 --- a/docs/tutorials/notes-app/snippets/navigation/csharp/Notes/Models/AllNotes.cs +++ b/docs/tutorials/notes-app/snippets/navigation/csharp/Notes/Models/AllNotes.cs @@ -14,7 +14,7 @@ internal class AllNotes Notes.Clear(); // Get the folder where the notes are stored. - string appDataPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); + string appDataPath = FileSystem.AppDataDirectory; // Use Linq extensions to load the *.notes.txt files. IEnumerable notes = Directory diff --git a/docs/tutorials/notes-app/snippets/navigation/csharp/Notes/Views/NotePage.xaml.cs b/docs/tutorials/notes-app/snippets/navigation/csharp/Notes/Views/NotePage.xaml.cs index b59ae8a7..a893e2b9 100644 --- a/docs/tutorials/notes-app/snippets/navigation/csharp/Notes/Views/NotePage.xaml.cs +++ b/docs/tutorials/notes-app/snippets/navigation/csharp/Notes/Views/NotePage.xaml.cs @@ -17,7 +17,7 @@ public partial class NotePage : ContentPage { InitializeComponent(); - string appDataPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); + string appDataPath = FileSystem.AppDataDirectory; string randomFileName = $"{Path.GetRandomFileName()}.notes.txt"; LoadNote(Path.Combine(appDataPath, randomFileName)); diff --git a/docs/tutorials/notes-app/snippets/note/csharp/Notes/NotePage.xaml.cs b/docs/tutorials/notes-app/snippets/note/csharp/Notes/NotePage.xaml.cs index d7e591d4..618757c3 100644 --- a/docs/tutorials/notes-app/snippets/note/csharp/Notes/NotePage.xaml.cs +++ b/docs/tutorials/notes-app/snippets/note/csharp/Notes/NotePage.xaml.cs @@ -4,7 +4,7 @@ namespace Notes; // public partial class NotePage : ContentPage { - string _fileName = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "notes.txt"); + string _fileName = Path.Combine(FileSystem.AppDataDirectory, "notes.txt"); // //