diff --git a/README.md b/README.md index 3c3319d..505adef 100644 --- a/README.md +++ b/README.md @@ -28,4 +28,4 @@ The licence for this repository is a [GNU Affero General Public Licence version ## Special Thanks - Icon: [Yoshi](https://github.com/yoshiask) - UI: [Leisvan](https://twitter.com/leisvanCT) -- Code Help: [Sergio](https://github.com/Sergio0694) \ No newline at end of file +- Resharper Help: [Sergio](https://github.com/Sergio0694) diff --git a/Yugen.Mosaic.Uwp/ViewModels/MainViewModel.cs b/Yugen.Mosaic.Uwp/ViewModels/MainViewModel.cs index 60985ba..b6330b8 100644 --- a/Yugen.Mosaic.Uwp/ViewModels/MainViewModel.cs +++ b/Yugen.Mosaic.Uwp/ViewModels/MainViewModel.cs @@ -1,10 +1,12 @@ using Microsoft.Toolkit.Uwp.Helpers; +using Microsoft.UI.Xaml.Controls; using SixLabors.ImageSharp; using SixLabors.ImageSharp.PixelFormats; using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.IO; +using System.Linq; using System.Threading.Tasks; using System.Windows.Input; using Windows.Storage; @@ -60,8 +62,8 @@ public class MainViewModel : ViewModelBase private ICommand _helpCommand; private ICommand _settingsCommand; private ICommand _teachingTipActionButtonCommand; - private ICommand _teachingTipClosingCommand; - private ICommand _teachingTipClosedCommand; + //private ICommand _teachingTipClosingCommand; + //private ICommand _teachingTipClosedCommand; public MainViewModel() { @@ -196,8 +198,8 @@ public int Progress public ICommand HelpCommand => _helpCommand ?? (_helpCommand = new RelayCommand(HelpCommandBehavior)); public ICommand SettingsCommand => _settingsCommand ?? (_settingsCommand = new AsyncRelayCommand(SettingsCommandBehavior)); public ICommand TeachingTipActionButtonCommand => _teachingTipActionButtonCommand ?? (_teachingTipActionButtonCommand = new RelayCommand(TeachingTipActionButtonCommandBehavior)); - public ICommand TeachingTipClosingCommand => _teachingTipClosingCommand ?? (_teachingTipClosingCommand = new RelayCommand(TeachingTipClosingCommandBehavior)); - public ICommand TeachingTipClosedCommand => _teachingTipClosedCommand ?? (_teachingTipClosedCommand = new RelayCommand(TeachingTipClosedCommandBehavior)); + //public ICommand TeachingTipClosingCommand => _teachingTipClosingCommand ?? (_teachingTipClosingCommand = new RelayCommand(TeachingTipClosingCommandBehavior)); + //public ICommand TeachingTipClosedCommand => _teachingTipClosedCommand ?? (_teachingTipClosedCommand = new RelayCommand(TeachingTipClosedCommandBehavior)); private Size OutputSize => new Size(_outputWidth, _outputHeight); private Size TileSize => new Size(_tileWidth, _tileHeight); @@ -233,7 +235,7 @@ public void TeachingTipActionButtonCommandBehavior() IsTeachingTipOpen = false; } - public void TeachingTipClosingCommandBehavior() + public void TeachingTip_Closing(TeachingTip sender, TeachingTipClosingEventArgs args) { TeachingTipTitle = ""; TeachingTipSubTitle = ""; @@ -241,7 +243,7 @@ public void TeachingTipClosingCommandBehavior() IsTeachingTipOpen = false; } - public void TeachingTipClosedCommandBehavior() => ShowTeachingTip(); + public void TeachingTip_Closed(TeachingTip sender, TeachingTipClosedEventArgs args) => ShowTeachingTip(); private async Task AddMasterImmageCommandBehavior() { @@ -307,7 +309,7 @@ private async Task AddTilesFolderCommandBehavior() SuggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.PicturesLibrary }; folderPicker.FileTypeFilter.Add(FileFormat.Jpg.GetStringRepresentation()); - folderPicker.FileTypeFilter.Add(FileFormat.Jpg.GetStringRepresentation()); + folderPicker.FileTypeFilter.Add(FileFormat.Jpeg.GetStringRepresentation()); folderPicker.FileTypeFilter.Add(FileFormat.Png.GetStringRepresentation()); StorageFolder folder = await folderPicker.PickSingleFolderAsync(); @@ -318,11 +320,14 @@ private async Task AddTilesFolderCommandBehavior() Windows.Storage.AccessCache.StorageApplicationPermissions.FutureAccessList.AddOrReplace("PickedFolderToken", folder); var files = await folder.GetFilesAsync(); - await AddTiles(files); + var filteredFiles = files.Where(file => file.FileType.Contains(FileFormat.Jpg.GetStringRepresentation(), StringComparison.InvariantCultureIgnoreCase) + || file.FileType.Contains(FileFormat.Jpeg.GetStringRepresentation(), StringComparison.InvariantCultureIgnoreCase) + || file.FileType.Contains(FileFormat.Png.GetStringRepresentation(), StringComparison.InvariantCultureIgnoreCase)); + await AddTiles(filteredFiles); } } - private async Task AddTiles(IReadOnlyList files) + private async Task AddTiles(IEnumerable files) { IsButtonEnabled = false; IsIndeterminateLoading = true; diff --git a/Yugen.Mosaic.Uwp/Views/MainPage.xaml b/Yugen.Mosaic.Uwp/Views/MainPage.xaml index 77b4d77..45955fd 100644 --- a/Yugen.Mosaic.Uwp/Views/MainPage.xaml +++ b/Yugen.Mosaic.Uwp/Views/MainPage.xaml @@ -420,19 +420,21 @@ - + diff --git a/Yugen.Mosaic.Uwp/Yugen.Mosaic.Uwp.csproj b/Yugen.Mosaic.Uwp/Yugen.Mosaic.Uwp.csproj index a1ba929..40fd417 100644 --- a/Yugen.Mosaic.Uwp/Yugen.Mosaic.Uwp.csproj +++ b/Yugen.Mosaic.Uwp/Yugen.Mosaic.Uwp.csproj @@ -253,7 +253,7 @@ 2.4.2 - 1.0.0-rc0001 + 1.0.0-rc0003 1.6.7