Example #1
0
        private void BuildFolderIco(IFilmFromFolder film)
        {
            new PosterService().Download(film.Poster, film.PathTo("folder.jpg"), (url, path) =>
                                         MessageBox.Show("Couldn't download folder.jpg for '" + film.Title + "' from url '" + film.Poster + "' to '" + film.PathTo("folder.jpg") + "'", "Error downloading folder.jpg", MessageBoxButton.OK, MessageBoxImage.Error));

            if (!System.IO.File.Exists(film.PathTo("folder.jpg")))
            {
                return;
            }

            Task <Bitmap> task = StaTask.Start <Bitmap>(() => new IconLayout(new IconLayoutViewModel(film.PathTo("folder.jpg"), film.Rating)).RenderToBitmap());

            task.Wait();
            Bitmap icon = task.Result;

            new PngToIcoService().Convert(icon, film.PathTo("folder.ico"));
        }
Example #2
0
 public Task <string> GenerateXaml(double width, double height, IEnumerable <PointCollection> shapes)
 {
     // Need to create the task on the STA thread, otherwise it fails
     // to create the WPF controls.
     return(StaTask.Start <string>(() => InternalGenerateXaml(width, height, shapes)));;
 }