Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Panda-Sharp committed Aug 8, 2020
2 parents b59ae99 + 5e8f600 commit fb1921d
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
- Resharper Help: [Sergio](https://github.com/Sergio0694)
23 changes: 14 additions & 9 deletions Yugen.Mosaic.Uwp/ViewModels/MainViewModel.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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()
{
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -233,15 +235,15 @@ public void TeachingTipActionButtonCommandBehavior()
IsTeachingTipOpen = false;
}

public void TeachingTipClosingCommandBehavior()
public void TeachingTip_Closing(TeachingTip sender, TeachingTipClosingEventArgs args)
{
TeachingTipTitle = "";
TeachingTipSubTitle = "";
TeachingTipTarget = null;
IsTeachingTipOpen = false;
}

public void TeachingTipClosedCommandBehavior() => ShowTeachingTip();
public void TeachingTip_Closed(TeachingTip sender, TeachingTipClosedEventArgs args) => ShowTeachingTip();

private async Task AddMasterImmageCommandBehavior()
{
Expand Down Expand Up @@ -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();
Expand All @@ -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<StorageFile> files)
private async Task AddTiles(IEnumerable<StorageFile> files)
{
IsButtonEnabled = false;
IsIndeterminateLoading = true;
Expand Down
6 changes: 4 additions & 2 deletions Yugen.Mosaic.Uwp/Views/MainPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -420,19 +420,21 @@
</Grid>

<muxc:TeachingTip x:Uid="MainTeachingTip"
Closing="{x:Bind ViewModel.TeachingTip_Closing}"
Closed="{x:Bind ViewModel.TeachingTip_Closed}"
IsOpen="{x:Bind ViewModel.IsTeachingTipOpen, Mode=OneWay}"
Target="{x:Bind ViewModel.TeachingTipTarget, Mode=OneWay}"
Title="{x:Bind ViewModel.TeachingTipTitle, Mode=OneWay}"
Subtitle="{x:Bind ViewModel.TeachingTipSubTitle, Mode=OneWay}"
ActionButtonCommand="{x:Bind ViewModel.TeachingTipActionButtonCommand}">
<interactivity:Interaction.Behaviors>
<!--<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="Closed">
<core:InvokeCommandAction Command="{x:Bind ViewModel.TeachingTipClosedCommand}" />
</core:EventTriggerBehavior>
<core:EventTriggerBehavior EventName="Closing">
<core:InvokeCommandAction Command="{x:Bind ViewModel.TeachingTipClosingCommand}" />
</core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>
</interactivity:Interaction.Behaviors>-->
</muxc:TeachingTip>

</Grid>
Expand Down
2 changes: 1 addition & 1 deletion Yugen.Mosaic.Uwp/Yugen.Mosaic.Uwp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@
<Version>2.4.2</Version>
</PackageReference>
<PackageReference Include="SixLabors.ImageSharp">
<Version>1.0.0-rc0001</Version>
<Version>1.0.0-rc0003</Version>
</PackageReference>
<PackageReference Include="WriteableBitmapEx">
<Version>1.6.7</Version>
Expand Down

0 comments on commit fb1921d

Please sign in to comment.