Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Panda-Sharp committed Jun 8, 2020
1 parent bdb5cb8 commit 185eb13
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 21 deletions.
6 changes: 6 additions & 0 deletions Yugen.Mosaic.Uwp/Strings/en-US/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,12 @@
<data name="MainShowGridCheckBox.Content" xml:space="preserve">
<value>Show Grid</value>
</data>
<data name="MainTeachingTip.ActionButtonContent" xml:space="preserve">
<value>Skip Tutorial</value>
</data>
<data name="MainTeachingTip.CloseButtonContent" xml:space="preserve">
<value>Next</value>
</data>
<data name="MainTileProperties.Text" xml:space="preserve">
<value>Tile Properties</value>
</data>
Expand Down
16 changes: 11 additions & 5 deletions Yugen.Mosaic.Uwp/ViewModels/MainViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Microsoft.Toolkit.Uwp.Helpers;
using Microsoft.UI.Xaml.Controls;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.PixelFormats;
using System;
Expand Down Expand Up @@ -57,6 +56,9 @@ public class MainViewModel : ViewModelBase
private ICommand _resetCommand;
private ICommand _helpCommand;
private ICommand _settingsCommand;
private ICommand _teachingTipActionButtonCommand;
private ICommand _teachingTipClosingCommand;
private ICommand _teachingTipClosedCommand;

public MainViewModel()
{
Expand Down Expand Up @@ -177,6 +179,10 @@ public int TileWidth
public ICommand ResetCommand => _resetCommand ?? (_resetCommand = new RelayCommand(ResetCommandBehavior));
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));

private Size OutputSize => new Size(_outputWidth, _outputHeight);
private Size TileSize => new Size(_tileWidth, _tileHeight);

Expand Down Expand Up @@ -205,22 +211,22 @@ public void ShowTeachingTip()
IsTeachingTipOpen = true;
}

public void TeachingTip_ActionButtonClick(TeachingTip sender, object args)
public void TeachingTipActionButtonCommandBehavior()
{
OnboardingHelper.IsDisabled = true;
IsTeachingTipOpen = false;
}

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

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

public void TeachingTipClosedCommandBehavior() => ShowTeachingTip();

private async Task AddMasterImmageCommandBehavior()
{
StorageFile masterFile = await FilePickerHelper.OpenFile(
Expand Down
38 changes: 22 additions & 16 deletions Yugen.Mosaic.Uwp/Views/MainPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
xmlns:models="using:Yugen.Mosaic.Uwp.Models"
xmlns:validation="using:Yugen.Toolkit.Uwp.Controls.Validation"
xmlns:controls="using:Yugen.Toolkit.Uwp.Controls.UI"
xmlns:winUiControls="using:Microsoft.UI.Xaml.Controls"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
xmlns:core="using:Microsoft.Xaml.Interactions.Core"
xmlns:viewmodels="using:Yugen.Mosaic.Uwp.ViewModels"
Expand Down Expand Up @@ -318,7 +318,7 @@

<CheckBox x:Uid="MainShowGridCheckBox"
IsChecked="{x:Bind ViewModel.IsAlignmentGridVisibile,Mode=TwoWay}"
Margin="4,0,0,0"/>
Margin="4,0,0,0" />

<Grid Margin="4,0,0,0">

Expand Down Expand Up @@ -353,11 +353,11 @@

</Grid>

<ProgressRing IsActive="{x:Bind ViewModel.IsLoading, Mode=OneWay}"
Height="80"
Margin="2"
Style="{StaticResource YugenProgressRingStyle}"
Width="80" />
<muxc:ProgressRing IsActive="{x:Bind ViewModel.IsLoading, Mode=OneWay}"
Height="80"
Margin="2"
Width="80" />
<!--Style="{StaticResource YugenProgressRingStyle}"-->

<!--<toolkitControls:RadialProgressBar x:Name="RadialProgressBarControl"
Foreground="Firebrick"
Expand Down Expand Up @@ -405,15 +405,21 @@

</Grid>

<winUiControls:TeachingTip 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}"
Closing="{x:Bind ViewModel.TeachingTip_Closing}"
Closed="{x:Bind ViewModel.TeachingTip_Closed}"
CloseButtonContent="Next"
ActionButtonContent="Skip Tutorial"
ActionButtonClick="{x:Bind ViewModel.TeachingTip_ActionButtonClick}" />
<muxc:TeachingTip x:Uid="MainTeachingTip"
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>
<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>
</muxc:TeachingTip>

</Grid>

Expand Down

0 comments on commit 185eb13

Please sign in to comment.