/// <summary> /// This function is the callback used to execute the command when the menu item is clicked. /// See the constructor to see how the menu item is associated with this function using /// OleMenuCommandService service and MenuCommand class. /// </summary> /// <param name="sender">Event sender.</param> /// <param name="e">Event args.</param> private void GenerateTiles(object sender, EventArgs e) { TileCallback((path, project) => { var selectedFileName = Path.GetFileName(path); ImageGeneration.TileSizes.Keys.AsParallel().ForAll((i) => { if (selectedFileName != i) { var newImagePath = ImageGeneration.GenerateImage(path, i); project.ProjectItems.AddFromFile(newImagePath); _outputWindow.OutputString($"Added {newImagePath} to the project \n"); } }); }, PackageManifestEditor.ManipulatePackageManifestForTiles); _outputWindow.OutputString("Tile generation complete. \n"); }
/// <summary> /// Generates Badge images. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> /// <exception cref="Exception">No file was selected</exception> private void GenerateBadgeTiles(object sender, EventArgs e) { TileCallback((path, project) => { var selectedFileName = Path.GetFileName(path); ImageGeneration.BadgeSizes.Keys.AsParallel().ForAll(i => { // I don't resize the selected file. if (selectedFileName == i) { return; } var newImagePath = ImageGeneration.GenerateImage(path, i); project.ProjectItems.AddFromFile(newImagePath); _outputWindow.OutputString($"Added {newImagePath} to the project \n"); }); }, PackageManifestEditor.ManipulatePackageManifestForBadge); _outputWindow.OutputString("Splash generation complete. \n"); }