-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(InAppNotifications): improve control #1441
Merged
nmetulev
merged 24 commits into
CommunityToolkit:master
from
Odonno:inAppNotificationImprovements
Nov 7, 2017
Merged
Changes from 9 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
844a176
feat(InAppNotifications): add events Opening, Opened and Dismissing
Odonno 4af5fb8
docs(InAppNotifications): add docs on new events
Odonno 348ab1c
feat(InAppNotifications): add details on Dismissing event args
Odonno 4514004
feat(InAppNotifications): improve animations
Odonno 13dbd44
refactor(InAppNotifications): split styles into separate files
Odonno 8b2722a
refactor(InAppNotifications): improve docs and code
Odonno a8965f6
feat(InAppNotifications): add ability to cancel the opening/closing
Odonno 27539f5
docs(InAppNotifications): update animation part
Odonno 562ac87
docs(InAppNotifications): add styling part
Odonno 9676d3b
docs(InAppNotifications): fix typos and improve animation property de…
Odonno fb86ea9
merge
Odonno ad14b9b
fix(InAppNotifications): update animation properties on the control w…
Odonno 227619a
fix(InAppNotifications): add default values for animation in default …
Odonno 828c517
feat(InAppNotification): mark Dimiss events as obsolete and replace t…
Odonno 99ccc76
Moved animation properties to template
nmetulev 31d2568
merge
Odonno 0b0dfb2
Merge branch 'nmetulev/InAppNotifications' of https://github.com/Micr…
Odonno 1178f6b
docs(InAppNotification): update code blocks
Odonno f5e38ef
docs(InAppNotification): change type of AnimationDuration property
Odonno fb5282f
docs(InAppNotification): use Note block
Odonno 2093c1a
docs(SampleApp): fix docs on TimeSpan
Odonno b8c5e5f
refactor(InAppNotification): remove Dismissing event
Odonno 33a1c3e
docs(InAppNotification): add missing header
Odonno f9ec93a
feat(InAppNotification): add dismiss kind info on closed event
Odonno File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,14 +20,49 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls | |
/// </summary> | ||
public partial class InAppNotification | ||
{ | ||
/// <summary> | ||
/// Event raised when the notification is opening | ||
/// </summary> | ||
public event InAppNotificationOpeningEventHandler Opening; | ||
|
||
/// <summary> | ||
/// Event raised when the notification is opened | ||
/// </summary> | ||
public event EventHandler Opened; | ||
|
||
/// <summary> | ||
/// Event raised when the notification is dismissing | ||
/// </summary> | ||
public event InAppNotificationDismissingEventHandler Dismissing; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No need to add this event if it wasn't there before |
||
|
||
/// <summary> | ||
/// Event raised when the notification is dismissed | ||
/// </summary> | ||
public event EventHandler Dismissed; | ||
|
||
private void DismissButton_Click(object sender, RoutedEventArgs e) | ||
{ | ||
Dismiss(); | ||
Dismiss(InAppNotificationDismissKind.User); | ||
} | ||
|
||
private void DismissTimer_Tick(object sender, object e) | ||
{ | ||
Dismiss(InAppNotificationDismissKind.Timeout); | ||
_dismissTimer.Stop(); | ||
} | ||
|
||
private void OpenAnimationTimer_Tick(object sender, object e) | ||
{ | ||
_animationTimer.Stop(); | ||
Opened?.Invoke(this, EventArgs.Empty); | ||
_animationTimer.Tick -= OpenAnimationTimer_Tick; | ||
} | ||
|
||
private void DismissAnimationTimer_Tick(object sender, object e) | ||
{ | ||
_animationTimer.Stop(); | ||
Dismissed?.Invoke(this, EventArgs.Empty); | ||
_animationTimer.Tick -= DismissAnimationTimer_Tick; | ||
} | ||
} | ||
} |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Later we may want to discuss if these should be Closing/Closed to align with FlyoutBase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of course. I did not wanted to make a breaking change because the Dismissed event was already available in 2.0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, makes sense. Just wanted to make sure we have something tracking it for a later release.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to decide on this. @nmetulev may have an opinion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Closed/Closing does fit in better with the Opened/Opening events. If you do want to change it, I recommend marking Dismissed deprecated and adding the new events.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok.