/// <summary>
        /// Merges all the book's background images with their corresponding language images, and save the resulting images.
        /// </summary>
        /// <param name="path">The path in which to store the resulting images</param>
        public void MergeImage(string path)
        {
            Dispatcher.Invoke((Action)(() => txtStatus.Text = "Merging and copying pictures"));
            Dispatcher.Invoke((Action)(() => progressBar.Value = 16));

            // Create and add the book's pages
            int index = 1;

            foreach (var page in BookManager.getSingleton().Pages)
            {
                foreach (var pair in page.Images)
                {
                    MargeBitmap.Source = (Bitmap)Bitmap.FromFile(page.Background);

                    MargeBitmap.ToMarge = (Bitmap)Bitmap.FromFile(pair.Value);

                    MargeBitmap.Merge();

                    // Save image as pic[index]_[language].png
                    MargeBitmap.Save(path + "\\pic" + index + "_" + pair.Key + ".png");

                    MargeBitmap.CreateWhitePage(path + "\\pic" + index + "_" + pair.Key + "_white.png");
                }
                index++;
            }

            MargeBitmap.Source  = null;
            MargeBitmap.ToMarge = null;
        }
        /// <summary>
        /// Copy the the rest of the images that make up the book in the given path, renaming them accordingly
        /// </summary>
        /// <param name="path">Root directory of output project</param>
        public void CopyIcons(string path)
        {
            Dispatcher.Invoke((Action)(() => txtStatus.Text = "Copying other files"));
            Dispatcher.Invoke((Action)(() => progressBar.Value = 50));

            try
            {
                File.Copy(BookManager.getSingleton().StartPage.Background, path + @"\img\first_page.png", true);
                MargeBitmap.Source = new Bitmap(BookManager.getSingleton().StartPage.Background);
                MargeBitmap.CreateWhitePage(path + @"\img\first_page_white.png");
                MargeBitmap.Source = null;
                File.Copy(BookManager.getSingleton().StartPage.ReadImage, path + @"\img\read.png", true);
                File.Copy(BookManager.getSingleton().StartPage.ReadImageClicked, path + @"\img\read_selected.png", true);
                File.Copy(BookManager.getSingleton().StartPage.ListenImage, path + @"\img\listen.png", true);
                File.Copy(BookManager.getSingleton().StartPage.ListenImageClicked, path + @"\img\listen_selected.png", true);
                File.Copy(BookManager.getSingleton().PlayIcon, path + @"\img\icon_play_selected.png", true);
                File.Copy(BookManager.getSingleton().PlayIcon, path + @"\img\icon_play_unselected.png", true);
                File.Copy(BookManager.getSingleton().PauseIcon, path + @"\img\icon_pause_selected.png", true);
                File.Copy(BookManager.getSingleton().PauseIcon, path + @"\img\icon_pause_unselected.png", true);
                File.Copy(BookManager.getSingleton().SmallIcon, path + "ApplicationIcon.png", true);
                File.Copy(BookManager.getSingleton().LargeIcon, path + "Background.png", true);
                File.Copy(BookManager.getSingleton().LoadIcon, path + "SplashScreenImage.jpg", true);
            }
            catch (Exception e)
            {
                showBuildError(e, "when trying to copy the icons");
            }
        }