diff --git a/Yugen.Mosaic.Uwp/App.xaml b/Yugen.Mosaic.Uwp/App.xaml index ec16e0b..11c9251 100644 --- a/Yugen.Mosaic.Uwp/App.xaml +++ b/Yugen.Mosaic.Uwp/App.xaml @@ -1,9 +1,8 @@  + xmlns:validation="using:Yugen.Toolkit.Standard.Validation" + xmlns:converters="using:Yugen.Toolkit.Uwp.Converters"> @@ -284,9 +283,7 @@ - - @@ -318,7 +315,6 @@ #242424 White #242424 - @@ -348,9 +344,7 @@ #dcdcdc #262626 #dcdcdc - - @@ -360,9 +354,6 @@ - - - - + \ No newline at end of file diff --git a/Yugen.Mosaic.Uwp/Controls/SettingsDialog.xaml b/Yugen.Mosaic.Uwp/Controls/SettingsDialog.xaml index 92cc31e..6934713 100644 --- a/Yugen.Mosaic.Uwp/Controls/SettingsDialog.xaml +++ b/Yugen.Mosaic.Uwp/Controls/SettingsDialog.xaml @@ -1,12 +1,12 @@  @@ -86,5 +86,4 @@ Margin="0,-4,0,0" Style="{ThemeResource YugenHyperlinkButtonStyle}" /> - \ No newline at end of file diff --git a/Yugen.Mosaic.Uwp/Controls/WhatsNewDialog.xaml b/Yugen.Mosaic.Uwp/Controls/WhatsNewDialog.xaml index 0254249..d90086b 100644 --- a/Yugen.Mosaic.Uwp/Controls/WhatsNewDialog.xaml +++ b/Yugen.Mosaic.Uwp/Controls/WhatsNewDialog.xaml @@ -1,9 +1,8 @@  - + - @@ -34,7 +33,5 @@ FontStyle="Italic" HorizontalAlignment="Center" Style="{ThemeResource YugenHyperlinkButtonStyle}" /> - - - + \ No newline at end of file diff --git a/Yugen.Mosaic.Uwp/Controls/WhatsNewDialog.xaml.cs b/Yugen.Mosaic.Uwp/Controls/WhatsNewDialog.xaml.cs index 038fbec..994aecb 100644 --- a/Yugen.Mosaic.Uwp/Controls/WhatsNewDialog.xaml.cs +++ b/Yugen.Mosaic.Uwp/Controls/WhatsNewDialog.xaml.cs @@ -17,4 +17,4 @@ public WhatsNewDialog() private WhatsNewViewModel ViewModel => (WhatsNewViewModel)DataContext; } -} +} \ No newline at end of file diff --git a/Yugen.Mosaic.Uwp/Helpers/OnboardingHelper.cs b/Yugen.Mosaic.Uwp/Helpers/OnboardingHelper.cs index 77598bc..c7fad8c 100644 --- a/Yugen.Mosaic.Uwp/Helpers/OnboardingHelper.cs +++ b/Yugen.Mosaic.Uwp/Helpers/OnboardingHelper.cs @@ -1,5 +1,4 @@ -using System; -using Windows.UI.Xaml; +using Windows.UI.Xaml; using Yugen.Mosaic.Uwp.Enums; using Yugen.Mosaic.Uwp.Models; using Yugen.Toolkit.Uwp.Helpers; diff --git a/Yugen.Mosaic.Uwp/Models/OnboardingElement.cs b/Yugen.Mosaic.Uwp/Models/OnboardingElement.cs index c42248a..0fc3ee9 100644 --- a/Yugen.Mosaic.Uwp/Models/OnboardingElement.cs +++ b/Yugen.Mosaic.Uwp/Models/OnboardingElement.cs @@ -15,8 +15,11 @@ public OnboardingElement(FrameworkElement target, OnboardingStage stage) } public OnboardingStage Stage { get; set; } + public string Subtitle { get; set; } + public FrameworkElement Target { get; set; } + public string Title { get; set; } } } \ No newline at end of file diff --git a/Yugen.Mosaic.Uwp/Models/Tile.cs b/Yugen.Mosaic.Uwp/Models/Tile.cs index 651b042..1ac3899 100644 --- a/Yugen.Mosaic.Uwp/Models/Tile.cs +++ b/Yugen.Mosaic.Uwp/Models/Tile.cs @@ -28,7 +28,7 @@ public void Process(Size tileSize, IRandomAccessStream RandomAccessStream) { using (var stream = RandomAccessStream.AsStreamForRead()) { - ResizedImage = Image.Load(stream); + ResizedImage = Image.Load(stream); } ResizedImage.Mutate(x => x.Resize(tileSize)); diff --git a/Yugen.Mosaic.Uwp/Models/TileFound.cs b/Yugen.Mosaic.Uwp/Models/TileFound.cs index 64f3d70..457e5cd 100644 --- a/Yugen.Mosaic.Uwp/Models/TileFound.cs +++ b/Yugen.Mosaic.Uwp/Models/TileFound.cs @@ -9,6 +9,7 @@ public TileFound(Tile tile, int difference) } public Tile Tile { get; set; } + public int Difference { get; set; } } } \ No newline at end of file diff --git a/Yugen.Mosaic.Uwp/Properties/AssemblyInfo.cs b/Yugen.Mosaic.Uwp/Properties/AssemblyInfo.cs index d53b0dd..910cf9e 100644 --- a/Yugen.Mosaic.Uwp/Properties/AssemblyInfo.cs +++ b/Yugen.Mosaic.Uwp/Properties/AssemblyInfo.cs @@ -1,7 +1,7 @@ using System.Reflection; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Yugen.Mosaic.Uwp")] @@ -16,11 +16,11 @@ // Version information for an assembly consists of the following four values: // // Major Version -// Minor Version +// Minor Version // Build Number // Revision // -// You can specify all the values or you can default the Build and Revision Numbers +// You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] diff --git a/Yugen.Mosaic.Uwp/Properties/Default.rd.xml b/Yugen.Mosaic.Uwp/Properties/Default.rd.xml index e43f18f..7454086 100644 --- a/Yugen.Mosaic.Uwp/Properties/Default.rd.xml +++ b/Yugen.Mosaic.Uwp/Properties/Default.rd.xml @@ -6,7 +6,7 @@ Runtime Directives are documented at https://go.microsoft.com/fwlink/?LinkID=391919 To fully enable reflection for App1.MyClass and all of its public/private members - + To enable dynamic creation of the specific instantiation of AppClass over System.Int32 @@ -21,9 +21,8 @@ An Assembly element with Name="*Application*" applies to all assemblies in the application package. The asterisks are not wildcards. --> - - - + + \ No newline at end of file diff --git a/Yugen.Mosaic.Uwp/Services/MosaicService.cs b/Yugen.Mosaic.Uwp/Services/MosaicService.cs index be4660b..527ff8d 100644 --- a/Yugen.Mosaic.Uwp/Services/MosaicService.cs +++ b/Yugen.Mosaic.Uwp/Services/MosaicService.cs @@ -22,19 +22,19 @@ namespace Yugen.Mosaic.Uwp.Services public class MosaicService : IMosaicService { private readonly IProgressService _progressService; - - private readonly List _tileImageList = new List(); private readonly ISearchAndReplaceAsciiArtService _searchAndReplaceAsciiArtService; + private readonly ISearchAndReplaceServiceFactory _searchAndReplaceServiceFactory; + private readonly List _tileImageList = new List(); + private Rgba32[,] _avgsMaster; private int _tX; private int _tY; private Image _masterImage; private Size _tileSize; private ISearchAndReplaceService _searchAndReplaceService; - private readonly ISearchAndReplaceServiceFactory _searchAndReplaceServiceFactory; public MosaicService( - IProgressService progressService, + IProgressService progressService, ISearchAndReplaceAsciiArtService searchAndReplaceAsciiArtService, ISearchAndReplaceServiceFactory searchAndReplaceServiceFactory) { diff --git a/Yugen.Mosaic.Uwp/Services/SearchAndReplaceServiceFactory.cs b/Yugen.Mosaic.Uwp/Services/SearchAndReplaceServiceFactory.cs index 75c9a07..572a5dc 100644 --- a/Yugen.Mosaic.Uwp/Services/SearchAndReplaceServiceFactory.cs +++ b/Yugen.Mosaic.Uwp/Services/SearchAndReplaceServiceFactory.cs @@ -29,12 +29,16 @@ public ISearchAndReplaceService Create(MosaicTypeEnum type) { case MosaicTypeEnum.AdjustHue: return _adjusthue(); + case MosaicTypeEnum.Classic: return _classic(); + case MosaicTypeEnum.PlainColor: return _plainColor(); + case MosaicTypeEnum.Random: return _random(); + default: throw new InvalidOperationException(); } diff --git a/Yugen.Mosaic.Uwp/ViewModels/MainViewModel.cs b/Yugen.Mosaic.Uwp/ViewModels/MainViewModel.cs index 951ea2e..4cc5fd6 100644 --- a/Yugen.Mosaic.Uwp/ViewModels/MainViewModel.cs +++ b/Yugen.Mosaic.Uwp/ViewModels/MainViewModel.cs @@ -301,6 +301,8 @@ private async Task AddMasterImageCommandBehavior() { StartProgressRing(true); + ResetSizes(); + using (var inputStream = await masterFile.OpenReadAsync()) { var dispatcherQueue = DispatcherQueue.GetForCurrentThread(); @@ -309,10 +311,11 @@ await dispatcherQueue.EnqueueAsync(async () => { var bmp = new BitmapImage { - DecodePixelHeight = 400 + DecodePixelHeight = 400, + DecodePixelType = DecodePixelType.Logical }; - await bmp.SetSourceAsync(inputStream); MasterBpmSource = bmp; + await bmp.SetSourceAsync(inputStream); }); } @@ -395,18 +398,25 @@ await Task.Run(() => { try { - using (StorageItemThumbnail thumbnail = await file.GetThumbnailAsync( - ThumbnailMode.SingleItem, 120, ThumbnailOptions.None)) + StorageItemThumbnail thumbnail = await file.GetThumbnailAsync( + ThumbnailMode.SingleItem, 120, ThumbnailOptions.None); + + if(thumbnail.Type == ThumbnailType.Icon) { - await dispatcherQueue.EnqueueAsync(async () => - { - BitmapImage bitmapImage = new BitmapImage(); - await bitmapImage.SetSourceAsync(thumbnail); - - TileBmpCollection.Add(new TileBmp(file.DisplayName, bitmapImage)); - }); + thumbnail.Dispose(); + thumbnail = await file.GetThumbnailAsync( + ThumbnailMode.SingleItem, 120, ThumbnailOptions.None); } + await dispatcherQueue.EnqueueAsync(async () => + { + BitmapImage bitmapImage = new BitmapImage(); + TileBmpCollection.Add(new TileBmp(file.DisplayName, bitmapImage)); + await bitmapImage.SetSourceAsync(thumbnail); + }); + + thumbnail.Dispose(); + _mosaicService.AddTileImage(file.DisplayName, file); } catch (Exception exception) @@ -498,8 +508,8 @@ private async Task SaveCommandBehavior() } StopProgressRing(); - } - + } + private async Task SaveAsTextCommandBehavior() { StartProgressRing(false); @@ -531,11 +541,21 @@ private void ResetCommandBehavior() MasterBpmSource = new BitmapImage(); TileBmpCollection = new ObservableCollection(); + ResetSizes(); + GC.Collect(); UpdateIsAddMasterUIVisible(); } + private void ResetSizes() + { + OutputHeight = 1000; + OutputWidth = 1000; + TileHeight = 25; + TileWidth = 25; + } + private void HelpCommandBehavior() { OnboardingHelper.Reset(); diff --git a/Yugen.Mosaic.Uwp/ViewModels/SettingsViewModel.cs b/Yugen.Mosaic.Uwp/ViewModels/SettingsViewModel.cs index 121fc2c..8064328 100644 --- a/Yugen.Mosaic.Uwp/ViewModels/SettingsViewModel.cs +++ b/Yugen.Mosaic.Uwp/ViewModels/SettingsViewModel.cs @@ -17,13 +17,15 @@ public SettingsViewModel(IThemeSelectorService themeSelectorService) { _themeSelectorService = themeSelectorService; - _elementTheme = _themeSelectorService.Theme; - + _elementTheme = _themeSelectorService.Theme; + SwitchThemeCommand = new AsyncRelayCommand(SwitchThemeCommandBehavior); } public string AppVersion => SystemHelper.AppVersion; + public string Publisher => SystemHelper.Publisher; + public string RateAndReviewUri => SystemHelper.RateAndReviewUri; public ElementTheme ElementTheme diff --git a/Yugen.Mosaic.Uwp/Views/MainPage.xaml b/Yugen.Mosaic.Uwp/Views/MainPage.xaml index 8c281ba..e8d7fff 100644 --- a/Yugen.Mosaic.Uwp/Views/MainPage.xaml +++ b/Yugen.Mosaic.Uwp/Views/MainPage.xaml @@ -1,16 +1,16 @@  @@ -41,9 +41,7 @@ - - - - - - - - + VerticalAlignment="Top" /> - - - + - - - - @@ -379,7 +366,6 @@ - - - + - - + - - --> - - - + \ No newline at end of file diff --git a/Yugen.Mosaic.Uwp/Yugen.Mosaic.Uwp.csproj b/Yugen.Mosaic.Uwp/Yugen.Mosaic.Uwp.csproj index b6c3866..7ab1b65 100644 --- a/Yugen.Mosaic.Uwp/Yugen.Mosaic.Uwp.csproj +++ b/Yugen.Mosaic.Uwp/Yugen.Mosaic.Uwp.csproj @@ -244,10 +244,10 @@ - 4.2.0 + 4.3.0 - 4.2.0 + 4.3.0 6.2.12 @@ -262,7 +262,7 @@ 7.0.2 - 2.5.0 + 2.6.1 2.0.1 @@ -280,13 +280,13 @@ 1.6.7 - 1.0.42 + 1.0.44 - 1.0.42 + 1.0.44 - 1.0.42 + 1.0.44 3.0.1 @@ -295,7 +295,7 @@ 2.0.0 - 4.1.0 + 5.0.0 4.3.0