-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from RadekVyM/dev
SimpleShell 2.1.0
- Loading branch information
Showing
12 changed files
with
162 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
src/SimpleToolkit.SimpleShell/Extensions/SimpleShellTransitionExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
using System; | ||
using SimpleToolkit.SimpleShell.Transitions; | ||
|
||
namespace SimpleToolkit.SimpleShell.Extensions | ||
{ | ||
public static class SimpleShellTransitionExtensions | ||
{ | ||
/// <summary> | ||
/// Combines two page transitions. | ||
/// </summary> | ||
/// <param name="originalTransition">Default page transition</param> | ||
/// <param name="transition">Page transition which should be combined with the default one</param> | ||
/// <param name="when">When the second page transition should be used</param> | ||
/// <returns>New page transition</returns> | ||
public static SimpleShellTransition CombinedWith( | ||
this SimpleShellTransition originalTransition, | ||
SimpleShellTransition transition, | ||
Func<SimpleShellTransitionArgs, bool> when) | ||
{ | ||
return new SimpleShellTransition( | ||
callback: args => | ||
{ | ||
if (when?.Invoke(args) ?? false) | ||
transition?.Callback?.Invoke(args); | ||
else | ||
originalTransition?.Callback?.Invoke(args); | ||
}, | ||
duration: args => | ||
{ | ||
if (when?.Invoke(args) ?? false) | ||
return transition?.Duration?.Invoke(args) ?? SimpleShellTransition.DefaultDuration; | ||
else | ||
return originalTransition?.Duration?.Invoke(args) ?? SimpleShellTransition.DefaultDuration; | ||
}, | ||
starting: args => | ||
{ | ||
if (when?.Invoke(args) ?? false) | ||
transition?.Starting?.Invoke(args); | ||
else | ||
originalTransition?.Starting?.Invoke(args); | ||
}, | ||
finished: args => | ||
{ | ||
if (when?.Invoke(args) ?? false) | ||
transition?.Finished?.Invoke(args); | ||
else | ||
originalTransition?.Finished?.Invoke(args); | ||
}, | ||
destinationPageInFront: args => | ||
{ | ||
if (when?.Invoke(args) ?? false) | ||
return transition?.DestinationPageInFront?.Invoke(args) ?? false; | ||
else | ||
return originalTransition?.DestinationPageInFront?.Invoke(args) ?? false; | ||
}); | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters