public static async Task<Look> Save(PortableImage image, string name, ImageDimension dimension, string projectPath)
        {
            using (var storage = StorageSystem.GetStorage())
            {
                var imagePath = Path.Combine(projectPath, StorageConstants.ProgramLooksPath);
                if (!await storage.DirectoryExistsAsync(imagePath))
                    await storage.CreateDirectoryAsync(imagePath);
            }

            var resizedImage = await ServiceLocator.ImageResizeService.ResizeImage(image, dimension.Width, dimension.Height);
            var look = new Look(name);
            var absoluteFileName = Path.Combine(projectPath, StorageConstants.ProgramLooksPath, look.FileName);

            await resizedImage.WriteAsPng(absoluteFileName);

            //look.Image = resizedImage;

            return look;
        }
 private void InitDesignData()
 {
     Dimension = new ImageDimension { Width = 500, Height = 500 };
     _selectedSize = ImageSizes[1];
 }
 private void LookImageReceivedMessageAction(GenericMessage<PortableImage> message)
 {
     Image = message.Content;
     Dimension = new ImageDimension { Height = Image.Height, Width = Image.Width };
 }
        private async Task SaveAction()
        {
            string validName = await ServiceLocator.ContextService.ConvertToValidFileName(LookName);
            List<string> nameList = new List<string>();
            foreach (var lookItem in _receivedSelectedSprite.Looks)
            {
                nameList.Add(lookItem.Name);
            }
            _lookName = await ServiceLocator.ContextService.FindUniqueName(validName, nameList);
            var message = new GenericMessage<PortableImage>(Image);
            Messenger.Default.Send(message, ViewModelMessagingToken.LookImageToSaveListener);

            ServiceLocator.DispatcherService.RunOnMainThread(() =>
            {
                ServiceLocator.NavigationService.RemoveBackEntry();
                ServiceLocator.NavigationService.NavigateBack(this.GetType());
            });

            //ServiceLocator.DispatcherService.RunOnMainThread(() =>
            //    ServiceLocator.NavigationService.NavigateTo<LookSavingViewModel>());

            var newDimention = new ImageDimension
            {
                Height = SelectedSize.NewHeight,
                Width = SelectedSize.NewWidth
            };

            var look = await LookHelper.Save(Image, LookName, newDimention, CurrentProgram.BasePath);

            ServiceLocator.DispatcherService.RunOnMainThread(() =>
            {
                _receivedSelectedSprite.Looks.Add(look);
                //ServiceLocator.NavigationService.RemoveBackEntryForPlatform(NavigationPlatform.WindowsPhone);
                //ServiceLocator.NavigationService.RemoveBackEntryForPlatform(NavigationPlatform.WindowsPhone);
                ResetViewModel();
                //ServiceLocator.NavigationService.NavigateBack(
                //    new List<NavigationPlatform>{NavigationPlatform.WindowsStore});
            });
        }