private async Task <bool> InstallSampleSnippets()
        {
            // Install some sample snippets
            MessageDialog dlg;

            try
            {
                if (await FileSystemUtils.FolderExistsAsync(RootSnippetPath + "\\Samples"))
                {
                    return(true);  // Samples have been previously installed
                }
                var folder = await FileSystemUtils.CreateFolderAsync(RootSnippetPath, "Samples");

                if (folder == null)
                {
                    throw new Exception();
                }

                var repository = new SnippetRepository();

                // /////////////
                // Snippet #1...
                var sampleSnippet = await CodeSnippet.CreateNew();

                sampleSnippet.Filename        = "ReadTextFile.snippet";
                sampleSnippet.Title           = "Read a text file";
                sampleSnippet.Description     = "Read a text file from the Documents library";
                sampleSnippet.Author          = "Russell Archer";
                sampleSnippet.Code            = "// Get a file in the Documents library by specifying a relative path\r\nvar file = await KnownFolders.DocumentsLibrary.GetFileAsync($relativePath$\\$filename$);\r\n\r\n// Read the contents of the as one long string\r\nvar txt = await FileIO.ReadTextAsync(file);\r\n\r\n// Display the text\r\ntbTextBlock.Text = txt;\r\n";
                sampleSnippet.DeclarationList = new ObservableCollection <Declaration>();
                sampleSnippet.DeclarationList.Add(new Declaration
                {
                    DeclarationType = DeclarationTypes.Literal,
                    Editable        = true,
                    ID      = "relativePath",
                    ToolTip = "Relative path",
                    Default = "relativePath"
                });

                sampleSnippet.DeclarationList.Add(new Declaration
                {
                    DeclarationType = DeclarationTypes.Literal,
                    Editable        = true,
                    ID      = "filename",
                    ToolTip = "Filename",
                    Default = "filename"
                });

                if (!await repository.WriteSnippetAsync(folder, sampleSnippet))
                {
                    throw new Exception();
                }

                // /////////////
                // Snippet #2...
                sampleSnippet = await CodeSnippet.CreateNew();

                sampleSnippet.Filename        = "ReadJsonFile.snippet";
                sampleSnippet.Title           = "Read a JSON file";
                sampleSnippet.Description     = "Read a static text file containing JSON from a subdirectory in the app's location";
                sampleSnippet.Author          = "Russell Archer";
                sampleSnippet.Code            = "var file = await Package.Current.InstalledLocation.GetFileAsync($appFolder$\\$filename$);\r\nvar txt = await FileIO.ReadTextAsync(file);\r\n\r\n// Here we use Newtonsoft Json.net to deserialize the json\r\nvar results = await JsonConvert.DeserializeObjectAsync<ObservableCollection<t>>(txt);";
                sampleSnippet.DeclarationList = new ObservableCollection <Declaration>();
                sampleSnippet.DeclarationList.Add(new Declaration
                {
                    DeclarationType = DeclarationTypes.Literal,
                    Editable        = true,
                    ID      = "appFolder",
                    ToolTip = "App Folder",
                    Default = "appFolder"
                });

                sampleSnippet.DeclarationList.Add(new Declaration
                {
                    DeclarationType = DeclarationTypes.Literal,
                    Editable        = true,
                    ID      = "filename",
                    ToolTip = "Filename",
                    Default = "filename"
                });

                if (!await repository.WriteSnippetAsync(folder, sampleSnippet))
                {
                    throw new Exception();
                }

                // /////////////
                // Snippet #3...
                sampleSnippet = await CodeSnippet.CreateNew();

                sampleSnippet.Filename    = "ReadTextFileOpenPicker.snippet";
                sampleSnippet.Title       = "Read text file selected by user";
                sampleSnippet.Description = "Read a text file selected by the user via the FileOpenPicker";
                sampleSnippet.Author      = "Russell Archer";
                sampleSnippet.Code        = "// Create the file open picker\r\nvar picker = new FileOpenPicker();\r\n\r\n// Set the type of file to pick\r\npicker.FileTypeFilter.Add(\".txt\");\r\n\r\n// Single-file selection\r\nvar file = await picker.PickSingleFileAsync();\r\n\r\n// If the user chose something, read it into a string var\r\nif (file != null)\r\n    var myText = await FileIO.ReadTextAsync(file);\r\n";

                if (!await repository.WriteSnippetAsync(folder, sampleSnippet))
                {
                    throw new Exception();
                }

                // End of sample snippet creation

                dlg = new MessageDialog("A small selection of sample code snippets has been created in the \"Samples\" folder of your snippet library. \n\nYou may also wish to use the \"Import\" command to import existing Visual Studio code snippets from your Documents library. If you modify snippets you can use the \"Export\" command. \n\nAlternatively, add your snippet library path to Visual Studio using Tools > Code Snippets Manager. This will give Visual Studio direct access to your snippet library. The path to the snippet library may be copied from this app's Preferences page.");
                await dlg.ShowAsync();

                CurrentSnippetPath = folder.Path;  // Jump to the samples folder
                FileSystemUserControl.CurrentSnippetFolder = CurrentSnippetPath;

                return(true);
            }
            catch
            {
            }

            dlg = new MessageDialog("Unable to create sample snippets");
            await dlg.ShowAsync();

            return(false);
        }