├── .gitignore
├── Build
├── DevCrew.ToastNotifications_TemporaryKey.snk
├── generate-nuget.ps1
└── nuget.exe
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── Docs
├── Configuration.md
├── CustomNotificatios.md
├── Migration.md
├── ReleaseNotes.md
└── StronglyNamedAssemblies.md
├── ISSUE_TEMPLATE.md
├── Media
├── demo.gif
├── project-icon.ico
└── project-icon.png
├── README.md
├── Src
├── Examples
│ ├── BasicUsageExample
│ │ ├── App.config
│ │ ├── App.xaml
│ │ ├── App.xaml.cs
│ │ ├── BasicUsageExample.csproj
│ │ ├── MainWindow.xaml
│ │ ├── MainWindow.xaml.cs
│ │ ├── Properties
│ │ │ ├── AssemblyInfo.cs
│ │ │ ├── Resources.Designer.cs
│ │ │ ├── Resources.resx
│ │ │ ├── Settings.Designer.cs
│ │ │ └── Settings.settings
│ │ ├── ToastViewModel.cs
│ │ └── toast-notifications-icon.ico
│ ├── ConfigurationExample
│ │ ├── App.config
│ │ ├── App.xaml
│ │ ├── App.xaml.cs
│ │ ├── ConfigurationExample.csproj
│ │ ├── MainViewModel.cs
│ │ ├── MainWindow.xaml
│ │ ├── MainWindow.xaml.cs
│ │ ├── Properties
│ │ │ ├── AssemblyInfo.cs
│ │ │ ├── Resources.Designer.cs
│ │ │ ├── Resources.resx
│ │ │ ├── Settings.Designer.cs
│ │ │ └── Settings.settings
│ │ ├── Utilities
│ │ │ ├── EnumBooleanConverter.cs
│ │ │ ├── NotificationLifetimeType.cs
│ │ │ └── PositionProviderType.cs
│ │ └── toast-notifications-icon.ico
│ ├── CustomNotificationsExample
│ │ ├── App.config
│ │ ├── App.xaml
│ │ ├── App.xaml.cs
│ │ ├── CustomCommand
│ │ │ ├── CustomCommandDisplayPart.xaml
│ │ │ ├── CustomCommandDisplayPart.xaml.cs
│ │ │ ├── CustomCommandExtensions.cs
│ │ │ └── CustomCommandNotification.cs
│ │ ├── CustomInput
│ │ │ ├── CustomCommandExtensions.cs
│ │ │ ├── CustomInputDisplayPart.xaml
│ │ │ ├── CustomInputDisplayPart.xaml.cs
│ │ │ └── CustomInputNotification.cs
│ │ ├── CustomMessage
│ │ │ ├── CustomDisplayPart.xaml
│ │ │ ├── CustomDisplayPart.xaml.cs
│ │ │ ├── CustomMessageExtensions.cs
│ │ │ └── CustomNotification.cs
│ │ ├── CustomNotificationsExample.csproj
│ │ ├── MahAppsNotification
│ │ │ ├── MahAppsDisplayPart.xaml
│ │ │ ├── MahAppsDisplayPart.xaml.cs
│ │ │ ├── MahAppsNotification.cs
│ │ │ └── MahAppsNotificationExtensions.cs
│ │ ├── MainWindow.xaml
│ │ ├── MainWindow.xaml.cs
│ │ ├── Properties
│ │ │ ├── AssemblyInfo.cs
│ │ │ ├── Resources.Designer.cs
│ │ │ ├── Resources.resx
│ │ │ ├── Settings.Designer.cs
│ │ │ └── Settings.settings
│ │ ├── Utilities
│ │ │ └── RelayCommand.cs
│ │ └── packages.config
│ └── DotNetCoreUsageExample
│ │ ├── App.xaml
│ │ ├── App.xaml.cs
│ │ ├── DotNetCoreUsageExample.csproj
│ │ ├── MainWindow.xaml
│ │ ├── MainWindow.xaml.cs
│ │ ├── ToastViewModel.cs
│ │ └── toast-notifications-icon.ico
├── ToastNotifications.Messages
│ ├── Core
│ │ └── MessageBase.cs
│ ├── Error
│ │ ├── ErrorDisplayPart.xaml
│ │ ├── ErrorDisplayPart.xaml.cs
│ │ └── ErrorMessage.cs
│ ├── ErrorExtensions.cs
│ ├── Information
│ │ ├── InformationDisplayPart.xaml
│ │ ├── InformationDisplayPart.xaml.cs
│ │ └── InformationMessage.cs
│ ├── InformationExtensions.cs
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ ├── Resources.resx
│ │ ├── Settings.Designer.cs
│ │ └── Settings.settings
│ ├── Success
│ │ ├── SuccessDisplayPart.xaml
│ │ ├── SuccessDisplayPart.xaml.cs
│ │ └── SuccessMessage.cs
│ ├── SuccessExtensions.cs
│ ├── Themes
│ │ └── Default.xaml
│ ├── ToastNotifications.Messages.csproj
│ ├── ToastNotifications.Messages.nuspec
│ ├── Warning
│ │ ├── WarningDisplayPart.xaml
│ │ ├── WarningDisplayPart.xaml.cs
│ │ └── WarningMessage.cs
│ ├── WarningExtensions.cs
│ └── toast-notifications-icon.ico
├── ToastNotifications.sln
└── ToastNotifications
│ ├── Core
│ ├── DisplayOptions.cs
│ ├── EjectDirection.cs
│ ├── INotification.cs
│ ├── INotificationAnimator.cs
│ ├── IPositionProvider.cs
│ ├── MessageOptions.cs
│ ├── NotificationBase.cs
│ ├── NotificationDisplayPart.cs
│ ├── NotifierConfiguration.cs
│ └── WindowsTaskBarLocation.cs
│ ├── Display
│ ├── NotificationAnimator.cs
│ ├── NotificationsDisplaySupervisor.cs
│ ├── NotificationsItemsControl.cs
│ ├── NotificationsWindow.xaml
│ └── NotificationsWindow.xaml.cs
│ ├── Events
│ ├── AllowedSourcesInputEventHandler.cs
│ ├── BlockAllKeyInputEventHandler.cs
│ ├── DelegatedInputEventHandler.cs
│ └── IKeyboardEventHandler.cs
│ ├── Lifetime
│ ├── Clear
│ │ ├── ClearAll.cs
│ │ ├── ClearByMessage.cs
│ │ ├── ClearByTag.cs
│ │ ├── ClearFirst.cs
│ │ ├── ClearLast.cs
│ │ └── IClearStrategy.cs
│ ├── CloseNotificationEventArgs.cs
│ ├── CountBasedLifetimeSupervisor.cs
│ ├── INotificationsLifeTimeSupervisor.cs
│ ├── MaximumNotificationCount.cs
│ ├── NotificationMetaData.cs
│ ├── NotificationsList.cs
│ ├── ShowNotificationEventArgs.cs
│ └── TimeAndCountBasedLifetimeSupervisor.cs
│ ├── Notifier.cs
│ ├── Position
│ ├── ControlPositionProvider.cs
│ ├── Corner.cs
│ ├── GdiPrimaryScreenPositionProvider.cs
│ ├── PositionExtensions.cs
│ ├── PrimaryScreenPositionProvider.cs
│ └── WindowPositionProvider.cs
│ ├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
│ ├── ToastNotifications.csproj
│ ├── ToastNotifications.nuspec
│ ├── Utilities
│ ├── DateTimeNow.cs
│ ├── DateTimeProvider.cs
│ ├── DelayAction.cs
│ ├── IDateTimeProvider.cs
│ ├── IInterval.cs
│ ├── Interval.cs
│ ├── VisualTreeHelper.cs
│ └── WinApi.cs
│ ├── readme.txt
│ └── toast-notifications-icon.ico
└── license
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.userosscache
8 | *.sln.docstates
9 |
10 | # User-specific files (MonoDevelop/Xamarin Studio)
11 | *.userprefs
12 |
13 | # Build results
14 | [Dd]ebug/
15 | [Dd]ebugPublic/
16 | [Rr]elease/
17 | [Rr]eleases/
18 | x64/
19 | x86/
20 | bld/
21 | [Bb]in/
22 | [Oo]bj/
23 | [Ll]og/
24 |
25 | # Visual Studio 2015 cache/options directory
26 | .vs/
27 | # Uncomment if you have tasks that create the project's static files in wwwroot
28 | #wwwroot/
29 |
30 | # MSTest test Results
31 | [Tt]est[Rr]esult*/
32 | [Bb]uild[Ll]og.*
33 |
34 | # NUNIT
35 | *.VisualState.xml
36 | TestResult.xml
37 |
38 | # Build Results of an ATL Project
39 | [Dd]ebugPS/
40 | [Rr]eleasePS/
41 | dlldata.c
42 |
43 | # DNX
44 | project.lock.json
45 | artifacts/
46 |
47 | *_i.c
48 | *_p.c
49 | *_i.h
50 | *.ilk
51 | *.meta
52 | *.obj
53 | *.pch
54 | *.pdb
55 | *.pgc
56 | *.pgd
57 | *.rsp
58 | *.sbr
59 | *.tlb
60 | *.tli
61 | *.tlh
62 | *.tmp
63 | *.tmp_proj
64 | *.log
65 | *.vspscc
66 | *.vssscc
67 | .builds
68 | *.pidb
69 | *.svclog
70 | *.scc
71 |
72 | # Chutzpah Test files
73 | _Chutzpah*
74 |
75 | # Visual C++ cache files
76 | ipch/
77 | *.aps
78 | *.ncb
79 | *.opendb
80 | *.opensdf
81 | *.sdf
82 | *.cachefile
83 |
84 | # Visual Studio profiler
85 | *.psess
86 | *.vsp
87 | *.vspx
88 | *.sap
89 |
90 | # TFS 2012 Local Workspace
91 | $tf/
92 |
93 | # Guidance Automation Toolkit
94 | *.gpState
95 |
96 | # ReSharper is a .NET coding add-in
97 | _ReSharper*/
98 | *.[Rr]e[Ss]harper
99 | *.DotSettings.user
100 |
101 | # JustCode is a .NET coding add-in
102 | .JustCode
103 |
104 | # TeamCity is a build add-in
105 | _TeamCity*
106 |
107 | # DotCover is a Code Coverage Tool
108 | *.dotCover
109 |
110 | # NCrunch
111 | _NCrunch_*
112 | .*crunch*.local.xml
113 | nCrunchTemp_*
114 |
115 | # MightyMoose
116 | *.mm.*
117 | AutoTest.Net/
118 |
119 | # Web workbench (sass)
120 | .sass-cache/
121 |
122 | # Installshield output folder
123 | [Ee]xpress/
124 |
125 | # DocProject is a documentation generator add-in
126 | DocProject/buildhelp/
127 | DocProject/Help/*.HxT
128 | DocProject/Help/*.HxC
129 | DocProject/Help/*.hhc
130 | DocProject/Help/*.hhk
131 | DocProject/Help/*.hhp
132 | DocProject/Help/Html2
133 | DocProject/Help/html
134 |
135 | # Click-Once directory
136 | publish/
137 |
138 | # Publish Web Output
139 | *.[Pp]ublish.xml
140 | *.azurePubxml
141 | # Comment the next line if you want to checkin your web deploy settings
142 | # but database connection strings (with potential passwords) will be unencrypted
143 | *.pubxml
144 | *.publishproj
145 |
146 | # NuGet Packages
147 | *.nupkg
148 | # The packages folder can be ignored because of Package Restore
149 | **/packages/*
150 | # except build/, which is used as an MSBuild target.
151 | !**/packages/build/
152 | # Uncomment if necessary however generally it will be regenerated when needed
153 | #!**/packages/repositories.config
154 | # NuGet v3's project.json files produces more ignoreable files
155 | *.nuget.props
156 | *.nuget.targets
157 |
158 | # Microsoft Azure Build Output
159 | csx/
160 | *.build.csdef
161 |
162 | # Microsoft Azure Emulator
163 | ecf/
164 | rcf/
165 |
166 | # Windows Store app package directories and files
167 | AppPackages/
168 | BundleArtifacts/
169 | Package.StoreAssociation.xml
170 | _pkginfo.txt
171 |
172 | # Visual Studio cache files
173 | # files ending in .cache can be ignored
174 | *.[Cc]ache
175 | # but keep track of directories ending in .cache
176 | !*.[Cc]ache/
177 |
178 | # Others
179 | ClientBin/
180 | ~$*
181 | *~
182 | *.dbmdl
183 | *.dbproj.schemaview
184 | *.pfx
185 | *.publishsettings
186 | node_modules/
187 | orleans.codegen.cs
188 |
189 | # Since there are multiple workflows, uncomment next line to ignore bower_components
190 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
191 | #bower_components/
192 |
193 | # RIA/Silverlight projects
194 | Generated_Code/
195 |
196 | # Backup & report files from converting an old project file
197 | # to a newer Visual Studio version. Backup files are not needed,
198 | # because we have git ;-)
199 | _UpgradeReport_Files/
200 | Backup*/
201 | UpgradeLog*.XML
202 | UpgradeLog*.htm
203 |
204 | # SQL Server files
205 | *.mdf
206 | *.ldf
207 |
208 | # Business Intelligence projects
209 | *.rdl.data
210 | *.bim.layout
211 | *.bim_*.settings
212 |
213 | # Microsoft Fakes
214 | FakesAssemblies/
215 |
216 | # GhostDoc plugin setting file
217 | *.GhostDoc.xml
218 |
219 | # Node.js Tools for Visual Studio
220 | .ntvs_analysis.dat
221 |
222 | # Visual Studio 6 build log
223 | *.plg
224 |
225 | # Visual Studio 6 workspace options file
226 | *.opt
227 |
228 | # Visual Studio LightSwitch build output
229 | **/*.HTMLClient/GeneratedArtifacts
230 | **/*.DesktopClient/GeneratedArtifacts
231 | **/*.DesktopClient/ModelManifest.xml
232 | **/*.Server/GeneratedArtifacts
233 | **/*.Server/ModelManifest.xml
234 | _Pvt_Extensions
235 |
236 | # Paket dependency manager
237 | .paket/paket.exe
238 |
239 | # FAKE - F# Make
240 | .fake/
241 |
242 | # JetBrains Rider
243 | .idea/
244 | *.sln.iml
245 | ToastNotifications/output/ToastNotifications.dll
246 | ToastNotifications/nuget.exe
247 |
--------------------------------------------------------------------------------
/Build/DevCrew.ToastNotifications_TemporaryKey.snk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rafallopatka/ToastNotifications/95ab84fe76fdf1380c52cacdb861ee0aa0280d29/Build/DevCrew.ToastNotifications_TemporaryKey.snk
--------------------------------------------------------------------------------
/Build/generate-nuget.ps1:
--------------------------------------------------------------------------------
1 | param([string]$version="2.0.0.0")
2 |
3 | $env:Path += ";C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE"
4 | $projects = "ToastNotifications", "ToastNotifications.Messages"
5 | $solution = "../Src/ToastNotifications.sln"
6 |
7 | $versionRegexp = "(\d+\.\d+\.\d+\.\d+)"
8 |
9 | foreach ($project in $projects) {
10 | $assemblyInfoFile = "../Src/"+$project+"/Properties/AssemblyInfo.cs"
11 | (Get-Content $assemblyInfoFile) -replace $versionRegexp, $version | Set-Content $assemblyInfoFile
12 | }
13 |
14 | devenv $solution /rebuild Release
15 |
16 | foreach ($project in $projects) {
17 | $csprojFile = "../Src/"+$project+"/"+$project+".csproj"
18 | ./nuget.exe pack $csprojFile -Prop Configuration=Release
19 | }
20 |
21 |
--------------------------------------------------------------------------------
/Build/nuget.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rafallopatka/ToastNotifications/95ab84fe76fdf1380c52cacdb861ee0aa0280d29/Build/nuget.exe
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Contributor Covenant Code of Conduct
2 |
3 | ## Our Pledge
4 |
5 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
6 |
7 | ## Our Standards
8 |
9 | Examples of behavior that contributes to creating a positive environment include:
10 |
11 | * Using welcoming and inclusive language
12 | * Being respectful of differing viewpoints and experiences
13 | * Gracefully accepting constructive criticism
14 | * Focusing on what is best for the community
15 | * Showing empathy towards other community members
16 |
17 | Examples of unacceptable behavior by participants include:
18 |
19 | * The use of sexualized language or imagery and unwelcome sexual attention or advances
20 | * Trolling, insulting/derogatory comments, and personal or political attacks
21 | * Public or private harassment
22 | * Publishing others' private information, such as a physical or electronic address, without explicit permission
23 | * Other conduct which could reasonably be considered inappropriate in a professional setting
24 |
25 | ## Our Responsibilities
26 |
27 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
28 |
29 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
30 |
31 | ## Scope
32 |
33 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
34 |
35 | ## Enforcement
36 |
37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at github@devcrew.pl. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
38 |
39 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
40 |
41 | ## Attribution
42 |
43 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
44 |
45 | [homepage]: http://contributor-covenant.org
46 | [version]: http://contributor-covenant.org/version/1/4/
47 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Thank you for contributing
2 |
3 | Any help, suggestions, finding issues, pull requests are really appreciated.
4 |
5 | If you crate an enhancement or bug fix to the library, and you would like to share it with the community, please send a pull request
6 | I will test, merge and release nuget
7 |
--------------------------------------------------------------------------------
/Docs/Migration.md:
--------------------------------------------------------------------------------
1 | ```
2 | _______ _ _ _ _ _ __ _ _ _ ___
3 | |__ __| | | | \ | | | | (_)/ _(_) | | (_) |__ \
4 | | | ___ __ _ ___| |_| \| | ___ | |_ _| |_ _ ___ __ _| |_ _ ___ _ __ ___ __ __ ) |
5 | | |/ _ \ / _` / __| __| . ` |/ _ \| __| | _| |/ __/ _` | __| |/ _ \| '_ \/ __| \ \ / // /
6 | | | (_) | (_| \__ \ |_| |\ | (_) | |_| | | | | (_| (_| | |_| | (_) | | | \__ \ \ V // /_
7 | |_|\___/ \__,_|___/\__|_| \_|\___/ \__|_|_| |_|\___\__,_|\__|_|\___/|_| |_|___/ \_/|____|
8 |
9 | ```
10 |
11 | # ToastNotifications v2
12 |
13 | #### Migrating from v1
14 |
15 | ToastNotifications v2 is completely new implementation and it's not compatibile with version 1.
16 | Instead of creating NotificationsSource and NotificationTray now you have single service called Notifier.
17 | Notifier is core mechanism used to configure and display different type of messages.
18 | These messages are now plugins and they are sitting now in separate nugget "ToastNotification.Messages"
19 | You have to install it, if you want to use predefined messages like Error, Warning, Success, Information.
20 | You can also create now your own messages, or create different theme for built-in messages.
21 |
22 | ##### Migration instructions
23 | 1. Remove old version references and usings
24 | 2. Remove NotificationTray from xaml
25 | 3. Remove NotificationSource from viewModel
26 | 4. Now follow [install instructions for v2](https://github.com/raflop/ToastNotifications)
27 |
--------------------------------------------------------------------------------
/Docs/ReleaseNotes.md:
--------------------------------------------------------------------------------
1 | ```
2 | _______ _ _ _ _ _ __ _ _ _ ___
3 | |__ __| | | | \ | | | | (_)/ _(_) | | (_) |__ \
4 | | | ___ __ _ ___| |_| \| | ___ | |_ _| |_ _ ___ __ _| |_ _ ___ _ __ ___ __ __ ) |
5 | | |/ _ \ / _` / __| __| . ` |/ _ \| __| | _| |/ __/ _` | __| |/ _ \| '_ \/ __| \ \ / // /
6 | | | (_) | (_| \__ \ |_| |\ | (_) | |_| | | | | (_| (_| | |_| | (_) | | | \__ \ \ V // /_
7 | |_|\___/ \__,_|___/\__|_| \_|\___/ \__|_|_| |_|\___\__,_|\__|_|\___/|_| |_|___/ \_/|____|
8 |
9 | ```
10 |
11 | # ToastNotifications v2
12 | #### Toast notifications for WPF
13 |
14 | ## v 2.5.1
15 | ### Bug fixes
16 | ClearByMessage and ClearByTag do not work. #83
17 | Black dialog is appearing when i use the notifications #81
18 | ### Breaking changes
19 | Internal refactoring, removed duplicated or unused methods.
20 | Changed some internal functions to properties.
21 |
22 | ## v 2.5.0
23 | ### New features
24 | Completely new mechanism of clearing selected toast notifications via Notifier instance.
25 | ### Bug fixes
26 | ClearMessages(string) does not work #75
27 | ### Breaking changes
28 | Changed signature of Notifier.ClearMessages, it takes now as a parameter an instance of IClearStrategy instead of string.
29 | Library provides built in strategies: ClearAll, ClearByMessage, ClearByTag, ClearFirst, ClearLast
30 |
31 | ## v 2.4.0
32 | Rolled back due to lots of breaking changes, delayed and moved to v3
--------------------------------------------------------------------------------
/Docs/StronglyNamedAssemblies.md:
--------------------------------------------------------------------------------
1 | ```
2 | _______ _ _ _ _ _ __ _ _ _ ___
3 | |__ __| | | | \ | | | | (_)/ _(_) | | (_) |__ \
4 | | | ___ __ _ ___| |_| \| | ___ | |_ _| |_ _ ___ __ _| |_ _ ___ _ __ ___ __ __ ) |
5 | | |/ _ \ / _` / __| __| . ` |/ _ \| __| | _| |/ __/ _` | __| |/ _ \| '_ \/ __| \ \ / // /
6 | | | (_) | (_| \__ \ |_| |\ | (_) | |_| | | | | (_| (_| | |_| | (_) | | | \__ \ \ V // /_
7 | |_|\___/ \__,_|___/\__|_| \_|\___/ \__|_|_| |_|\___\__,_|\__|_|\___/|_| |_|___/ \_/|____|
8 |
9 | ```
10 |
11 | # ToastNotifications v2
12 | #### Toast notifications for WPF
13 |
14 | ### Strongly named assemblies
15 |
16 | ToastNotifications v2 assemblies are strongly named using pfx file which is not included in repo.
17 | Snk file stored in repository is used only in development and continues build, and it is not used to produce official nuget.
18 |
19 | Development (via SNK):
20 | ```sha1
21 | Public key (hash algorithm: sha1):
22 | 002400000480000094000000060200000024000052534131000400000100010003fa196e46deb8
23 | 0be6daa22a58b9810c8fe593d239f3cd24a4765b1830538c3d7f98b5386d03e8e2c28def79c571
24 | 062c36e65119f656949c1003ffdc2373b05858560e3f94790ad5ab832ac372b76fddb84ca36530
25 | 6a9dbebe68cbaa2dc45950a722297fa9aacac3970e9695e1022f5735a2c9a37987f847a86dde47
26 | 8d7474dd
27 |
28 | Public key token is c8166e8e02d32210
29 | ```
30 | Release (via PFX):
31 | ```sha1
32 | Public key (hash algorithm: sha1):
33 | 002400000480000094000000060200000024000052534131000400000100010041e364d228daad
34 | 36e196e7107c6f462568cafe9b0e625e8afbda5db7725e1cdcca788304083b1a92846b372e002c
35 | 06c6f74d9466d93f1fceb6a6b207625a515b3790a9d541edc40b3e2d987ea25cff0e5bb9208046
36 | efc04b7e726d8b56b0d4974071e3db0c1f139888e582c72da6659fbfcf1801fdcdca2449013ae5
37 | d0426dce
38 |
39 | Public key token is e89d9d7314a7c797
40 | ```
41 |
--------------------------------------------------------------------------------
/ISSUE_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | ### Library version
2 |
3 | ### Expected behaviour
4 |
5 | ### Actual behaviour
6 |
7 | ### Steps to reproduce behaviour
8 |
9 | ### Code to reproduce behaviour
10 |
11 | ### Questions
12 |
--------------------------------------------------------------------------------
/Media/demo.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rafallopatka/ToastNotifications/95ab84fe76fdf1380c52cacdb861ee0aa0280d29/Media/demo.gif
--------------------------------------------------------------------------------
/Media/project-icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rafallopatka/ToastNotifications/95ab84fe76fdf1380c52cacdb861ee0aa0280d29/Media/project-icon.ico
--------------------------------------------------------------------------------
/Media/project-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rafallopatka/ToastNotifications/95ab84fe76fdf1380c52cacdb861ee0aa0280d29/Media/project-icon.png
--------------------------------------------------------------------------------
/Src/Examples/BasicUsageExample/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Src/Examples/BasicUsageExample/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/Src/Examples/BasicUsageExample/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | namespace BasicUsageExample
4 | {
5 | ///
6 | /// Interaction logic for App.xaml
7 | ///
8 | public partial class App : Application
9 | {
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Src/Examples/BasicUsageExample/BasicUsageExample.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {D63A8852-2028-4E0E-8FF1-F95D0066843F}
8 | WinExe
9 | Properties
10 | BasicUsageExample
11 | BasicUsageExample
12 | v4.0
13 | 512
14 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
15 | 4
16 | true
17 |
18 |
19 |
20 | AnyCPU
21 | true
22 | full
23 | false
24 | bin\Debug\
25 | DEBUG;TRACE
26 | prompt
27 | 4
28 |
29 |
30 | AnyCPU
31 | pdbonly
32 | true
33 | bin\Release\
34 | TRACE
35 | prompt
36 | 4
37 |
38 |
39 | toast-notifications-icon.ico
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 | 4.0
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 | MSBuild:Compile
57 | Designer
58 |
59 |
60 | App.xaml
61 | Code
62 |
63 |
64 |
65 |
66 |
67 | MainWindow.xaml
68 |
69 |
70 | Code
71 |
72 |
73 | True
74 | True
75 | Resources.resx
76 |
77 |
78 | True
79 | Settings.settings
80 | True
81 |
82 |
83 | ResXFileCodeGenerator
84 | Resources.Designer.cs
85 |
86 |
87 | SettingsSingleFileGenerator
88 | Settings.Designer.cs
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 | MSBuild:Compile
98 | Designer
99 |
100 |
101 |
102 |
103 | {4de2f314-b19f-423e-92d8-7d3a7d9acea2}
104 | ToastNotifications.Messages
105 |
106 |
107 | {4a8879fc-9a6e-4904-910b-5c13fa5ed5be}
108 | ToastNotifications
109 |
110 |
111 |
112 |
113 |
114 |
115 |
122 |
--------------------------------------------------------------------------------
/Src/Examples/BasicUsageExample/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/Src/Examples/BasicUsageExample/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows;
3 | using ToastNotifications.Core;
4 |
5 | namespace BasicUsageExample
6 | {
7 | ///
8 | /// Interaction logic for MainWindow.xaml
9 | ///
10 | public partial class MainWindow : Window
11 | {
12 | public MainWindow()
13 | {
14 | InitializeComponent();
15 | _vm = new ToastViewModel();
16 |
17 | Unloaded += OnUnload;
18 | }
19 |
20 | private int _count = 0;
21 | private readonly ToastViewModel _vm;
22 |
23 | private void OnUnload(object sender, RoutedEventArgs e)
24 | {
25 | _vm.OnUnloaded();
26 | }
27 |
28 | private void Button_ShowInformationClick(object sender, RoutedEventArgs e)
29 | {
30 | ShowMessage(_vm.ShowInformation, "Information");
31 | }
32 |
33 | private void Button_ShowSuccessClick(object sender, RoutedEventArgs e)
34 | {
35 | ShowMessage(_vm.ShowSuccess, "Success");
36 | }
37 |
38 | private void Button_ShowWarningClick(object sender, RoutedEventArgs e)
39 | {
40 | ShowMessage(_vm.ShowWarning, "Warning");
41 | }
42 |
43 | private void Button_ShowErrorClick(object sender, RoutedEventArgs e)
44 | {
45 | ShowMessage(_vm.ShowError, "Error");
46 | }
47 |
48 | string _lastMessage;
49 | void ShowMessage(Action action, string name)
50 | {
51 | MessageOptions opts = new MessageOptions
52 | {
53 | CloseClickAction = CloseAction,
54 | Tag = $"[This is Tag Value ({++_count})]",
55 | FreezeOnMouseEnter = cbFreezeOnMouseEnter.IsChecked.GetValueOrDefault(),
56 | UnfreezeOnMouseLeave = cbUnfreezeOnMouseLeave.IsChecked.GetValueOrDefault(),
57 | ShowCloseButton = cbShowCloseButton.IsChecked.GetValueOrDefault()
58 | };
59 | _lastMessage = $"{_count} {name}";
60 | action(_lastMessage, opts);
61 | bClearLast.IsEnabled = true;
62 | }
63 |
64 | private void CloseAction(NotificationBase obj)
65 | {
66 | var opts = obj.DisplayPart.Notification.Options;
67 | _vm.ShowInformation($"Notification close clicked, Tag: {opts.Tag}");
68 | }
69 |
70 |
71 | private void Button_ClearClick(object sender, RoutedEventArgs e)
72 | {
73 | _vm.ClearAll();
74 | }
75 |
76 | private void Button_ClearLastClick(object sender, RoutedEventArgs e)
77 | {
78 | _vm.ClearMessages(_lastMessage);
79 | bClearLast.IsEnabled = false;
80 | }
81 |
82 | private void Button_SameContentClick(object sender, RoutedEventArgs e)
83 | {
84 | const string sameContent = "Same Content - not duplicated";
85 | _vm.ClearMessages(sameContent);
86 | MessageOptions opts = new MessageOptions
87 | {
88 | CloseClickAction = CloseAction,
89 | Tag = "[This is Tag Value]",
90 | FreezeOnMouseEnter = cbFreezeOnMouseEnter.IsChecked.GetValueOrDefault(),
91 | ShowCloseButton = cbShowCloseButton.IsChecked.GetValueOrDefault()
92 | };
93 | _vm.ShowSuccess(sameContent, opts);
94 | _lastMessage = sameContent;
95 | bClearLast.IsEnabled = true;
96 | }
97 | }
98 | }
99 |
--------------------------------------------------------------------------------
/Src/Examples/BasicUsageExample/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 | using System.Windows;
6 |
7 | // General Information about an assembly is controlled through the following
8 | // set of attributes. Change these attribute values to modify the information
9 | // associated with an assembly.
10 | [assembly: AssemblyTitle("BasicUsageExample")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("")]
14 | [assembly: AssemblyProduct("BasicUsageExample")]
15 | [assembly: AssemblyCopyright("Copyright © Rafał Łopatka 2019")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | // Setting ComVisible to false makes the types in this assembly not visible
20 | // to COM components. If you need to access a type in this assembly from
21 | // COM, set the ComVisible attribute to true on that type.
22 | [assembly: ComVisible(false)]
23 |
24 | //In order to begin building localizable applications, set
25 | //CultureYouAreCodingWith in your .csproj file
26 | //inside a . For example, if you are using US english
27 | //in your source files, set the to en-US. Then uncomment
28 | //the NeutralResourceLanguage attribute below. Update the "en-US" in
29 | //the line below to match the UICulture setting in the project file.
30 |
31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32 |
33 |
34 | [assembly: ThemeInfo(
35 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
36 | //(used if a resource is not found in the page,
37 | // or application resource dictionaries)
38 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
39 | //(used if a resource is not found in the page,
40 | // app, or any theme specific resource dictionaries)
41 | )]
42 |
43 |
44 | // Version information for an assembly consists of the following four values:
45 | //
46 | // Major Version
47 | // Minor Version
48 | // Build Number
49 | // Revision
50 | //
51 | // You can specify all the values or you can default the Build and Revision Numbers
52 | // by using the '*' as shown below:
53 | // [assembly: AssemblyVersion("1.0.*")]
54 | [assembly: AssemblyVersion("1.0.0.0")]
55 | [assembly: AssemblyFileVersion("1.0.0.0")]
56 |
--------------------------------------------------------------------------------
/Src/Examples/BasicUsageExample/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace BasicUsageExample.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// Returns the cached ResourceManager instance used by this class.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("BasicUsageExample.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Overrides the current thread's CurrentUICulture property for all
51 | /// resource lookups using this strongly typed resource class.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/Src/Examples/BasicUsageExample/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace BasicUsageExample.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Src/Examples/BasicUsageExample/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Src/Examples/BasicUsageExample/ToastViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel;
3 | using System.Windows;
4 | using ToastNotifications;
5 | using ToastNotifications.Core;
6 | using ToastNotifications.Lifetime;
7 | using ToastNotifications.Lifetime.Clear;
8 | using ToastNotifications.Messages;
9 | using ToastNotifications.Position;
10 |
11 | namespace BasicUsageExample
12 | {
13 | public class ToastViewModel : INotifyPropertyChanged
14 | {
15 | private readonly Notifier _notifier;
16 |
17 | public ToastViewModel()
18 | {
19 | _notifier = new Notifier(cfg =>
20 | {
21 | cfg.PositionProvider = new WindowPositionProvider(
22 | parentWindow: Application.Current.MainWindow,
23 | corner: Corner.BottomRight,
24 | offsetX: 25,
25 | offsetY: 100);
26 |
27 | cfg.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor(
28 | notificationLifetime: TimeSpan.FromSeconds(6),
29 | maximumNotificationCount: MaximumNotificationCount.FromCount(6));
30 |
31 | cfg.Dispatcher = Application.Current.Dispatcher;
32 |
33 | cfg.DisplayOptions.TopMost = false;
34 | cfg.DisplayOptions.Width = 250;
35 | });
36 |
37 | _notifier.ClearMessages(new ClearAll());
38 | }
39 |
40 | public void OnUnloaded()
41 | {
42 | _notifier.Dispose();
43 | }
44 |
45 | public void ShowInformation(string message)
46 | {
47 | _notifier.ShowInformation(message);
48 | }
49 |
50 | public void ShowInformation(string message, MessageOptions opts)
51 | {
52 | _notifier.ShowInformation(message, opts);
53 | }
54 |
55 | public void ShowSuccess(string message)
56 | {
57 | _notifier.ShowSuccess(message);
58 | }
59 |
60 | public void ShowSuccess(string message, MessageOptions opts)
61 | {
62 | _notifier.ShowSuccess(message, opts);
63 | }
64 |
65 | internal void ClearMessages(string msg)
66 | {
67 | _notifier.ClearMessages(new ClearByMessage(msg));
68 | }
69 |
70 | public void ShowWarning(string message, MessageOptions opts)
71 | {
72 | _notifier.ShowWarning(message, opts);
73 | }
74 |
75 | public void ShowError(string message)
76 | {
77 | _notifier.ShowError(message);
78 | }
79 |
80 | public void ShowError(string message, MessageOptions opts)
81 | {
82 | _notifier.ShowError(message, opts);
83 | }
84 |
85 |
86 | public event PropertyChangedEventHandler PropertyChanged;
87 |
88 | protected virtual void OnPropertyChanged(string propertyName = null)
89 | {
90 | var handler = PropertyChanged;
91 | if (handler != null)
92 | handler.Invoke(this, new PropertyChangedEventArgs(propertyName));
93 | }
94 |
95 | public void ClearAll()
96 | {
97 | _notifier.ClearMessages(new ClearAll());
98 | }
99 | }
100 | }
--------------------------------------------------------------------------------
/Src/Examples/BasicUsageExample/toast-notifications-icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rafallopatka/ToastNotifications/95ab84fe76fdf1380c52cacdb861ee0aa0280d29/Src/Examples/BasicUsageExample/toast-notifications-icon.ico
--------------------------------------------------------------------------------
/Src/Examples/ConfigurationExample/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Src/Examples/ConfigurationExample/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/Src/Examples/ConfigurationExample/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | namespace ConfigurationExample
4 | {
5 | ///
6 | /// Interaction logic for App.xaml
7 | ///
8 | public partial class App : Application
9 | {
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Src/Examples/ConfigurationExample/ConfigurationExample.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {F50D1BE4-2FF7-4E83-A149-104646FD6AC9}
8 | WinExe
9 | Properties
10 | ConfigurationExample
11 | ConfigurationExample
12 | v4.5.2
13 | 512
14 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
15 | 4
16 | true
17 |
18 |
19 | AnyCPU
20 | true
21 | full
22 | false
23 | bin\Debug\
24 | DEBUG;TRACE
25 | prompt
26 | 4
27 |
28 |
29 | AnyCPU
30 | pdbonly
31 | true
32 | bin\Release\
33 | TRACE
34 | prompt
35 | 4
36 |
37 |
38 | toast-notifications-icon.ico
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | 4.0
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 | MSBuild:Compile
56 | Designer
57 |
58 |
59 | App.xaml
60 | Code
61 |
62 |
63 |
64 |
65 |
66 |
67 | MainWindow.xaml
68 |
69 |
70 |
71 |
72 | Code
73 |
74 |
75 | True
76 | True
77 | Resources.resx
78 |
79 |
80 | True
81 | Settings.settings
82 | True
83 |
84 |
85 | ResXFileCodeGenerator
86 | Resources.Designer.cs
87 |
88 |
89 | SettingsSingleFileGenerator
90 | Settings.Designer.cs
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 | MSBuild:Compile
100 | Designer
101 |
102 |
103 |
104 |
105 | {4de2f314-b19f-423e-92d8-7d3a7d9acea2}
106 | ToastNotifications.Messages
107 |
108 |
109 | {4a8879fc-9a6e-4904-910b-5c13fa5ed5be}
110 | ToastNotifications
111 |
112 |
113 |
114 |
115 |
116 |
117 |
124 |
--------------------------------------------------------------------------------
/Src/Examples/ConfigurationExample/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | namespace ConfigurationExample
4 | {
5 | ///
6 | /// Interaction logic for MainWindow.xaml
7 | ///
8 | public partial class MainWindow : Window
9 | {
10 | public MainWindow()
11 | {
12 | InitializeComponent();
13 | DataContext = _vm = new MainViewModel();
14 | }
15 |
16 | private int _count = 0;
17 | private readonly MainViewModel _vm;
18 |
19 | private string CreateMessage()
20 | {
21 | return $"{_count++} {SampleTextInput.Text}";
22 | }
23 |
24 | private void Button_ShowInformationClick(object sender, RoutedEventArgs e)
25 | {
26 | _vm.ShowInformation(CreateMessage());
27 | }
28 |
29 | private void Button_ShowSuccessClick(object sender, RoutedEventArgs e)
30 | {
31 | _vm.ShowSuccess(CreateMessage());
32 | }
33 |
34 | private void Button_ShowWarningClick(object sender, RoutedEventArgs e)
35 | {
36 | _vm.ShowWarning(CreateMessage());
37 | }
38 |
39 | private void Button_ShowErrorClick(object sender, RoutedEventArgs e)
40 | {
41 | _vm.ShowError(CreateMessage());
42 | }
43 |
44 | private void Button_ShowCustomizedMessageClick(object sender, RoutedEventArgs e)
45 | {
46 | _vm.ShowCustomizedMessage(CreateMessage());
47 | }
48 |
49 | private void Button_ClearLastClick(object sender, RoutedEventArgs e)
50 | {
51 | _vm.ClearLast();
52 | }
53 |
54 | private void Button_ClearAllClick(object sender, RoutedEventArgs e)
55 | {
56 | _vm.ClearAll();
57 | }
58 |
59 | private void Button_ClearByTag(object sender, RoutedEventArgs e)
60 | {
61 | _vm.ClearByTag();
62 | }
63 |
64 | private void Button_ClearByMessage(object sender, RoutedEventArgs e)
65 | {
66 | _vm.ClearByMessage();
67 | }
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/Src/Examples/ConfigurationExample/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 | using System.Windows;
6 |
7 | // General Information about an assembly is controlled through the following
8 | // set of attributes. Change these attribute values to modify the information
9 | // associated with an assembly.
10 | [assembly: AssemblyTitle("ConfigurationExample")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("")]
14 | [assembly: AssemblyProduct("ConfigurationExample")]
15 | [assembly: AssemblyCopyright("Copyright © Rafał Łopatka 2019")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | // Setting ComVisible to false makes the types in this assembly not visible
20 | // to COM components. If you need to access a type in this assembly from
21 | // COM, set the ComVisible attribute to true on that type.
22 | [assembly: ComVisible(false)]
23 |
24 | //In order to begin building localizable applications, set
25 | //CultureYouAreCodingWith in your .csproj file
26 | //inside a . For example, if you are using US english
27 | //in your source files, set the to en-US. Then uncomment
28 | //the NeutralResourceLanguage attribute below. Update the "en-US" in
29 | //the line below to match the UICulture setting in the project file.
30 |
31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32 |
33 |
34 | [assembly: ThemeInfo(
35 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
36 | //(used if a resource is not found in the page,
37 | // or application resource dictionaries)
38 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
39 | //(used if a resource is not found in the page,
40 | // app, or any theme specific resource dictionaries)
41 | )]
42 |
43 |
44 | // Version information for an assembly consists of the following four values:
45 | //
46 | // Major Version
47 | // Minor Version
48 | // Build Number
49 | // Revision
50 | //
51 | // You can specify all the values or you can default the Build and Revision Numbers
52 | // by using the '*' as shown below:
53 | // [assembly: AssemblyVersion("1.0.*")]
54 | [assembly: AssemblyVersion("1.0.0.0")]
55 | [assembly: AssemblyFileVersion("1.0.0.0")]
56 |
--------------------------------------------------------------------------------
/Src/Examples/ConfigurationExample/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace ConfigurationExample.Properties
12 | {
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources
26 | {
27 |
28 | private static global::System.Resources.ResourceManager resourceMan;
29 |
30 | private static global::System.Globalization.CultureInfo resourceCulture;
31 |
32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
33 | internal Resources()
34 | {
35 | }
36 |
37 | ///
38 | /// Returns the cached ResourceManager instance used by this class.
39 | ///
40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
41 | internal static global::System.Resources.ResourceManager ResourceManager
42 | {
43 | get
44 | {
45 | if ((resourceMan == null))
46 | {
47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ConfigurationExample.Properties.Resources", typeof(Resources).Assembly);
48 | resourceMan = temp;
49 | }
50 | return resourceMan;
51 | }
52 | }
53 |
54 | ///
55 | /// Overrides the current thread's CurrentUICulture property for all
56 | /// resource lookups using this strongly typed resource class.
57 | ///
58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
59 | internal static global::System.Globalization.CultureInfo Culture
60 | {
61 | get
62 | {
63 | return resourceCulture;
64 | }
65 | set
66 | {
67 | resourceCulture = value;
68 | }
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/Src/Examples/ConfigurationExample/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace ConfigurationExample.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 | {
19 |
20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21 |
22 | public static Settings Default
23 | {
24 | get
25 | {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Src/Examples/ConfigurationExample/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Src/Examples/ConfigurationExample/Utilities/EnumBooleanConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows;
3 | using System.Windows.Data;
4 |
5 | namespace ConfigurationExample.Utilities
6 | {
7 | public class EnumBooleanConverter : IValueConverter
8 | {
9 | #region IValueConverter Members
10 | public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
11 | {
12 | string parameterString = parameter as string;
13 | if (parameterString == null)
14 | return DependencyProperty.UnsetValue;
15 |
16 | if (Enum.IsDefined(value.GetType(), value) == false)
17 | return DependencyProperty.UnsetValue;
18 |
19 | object parameterValue = Enum.Parse(value.GetType(), parameterString);
20 |
21 | return parameterValue.Equals(value);
22 | }
23 |
24 | public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
25 | {
26 | string parameterString = parameter as string;
27 | if (parameterString == null)
28 | return DependencyProperty.UnsetValue;
29 |
30 | return Enum.Parse(targetType, parameterString);
31 | }
32 | #endregion
33 | }
34 | }
--------------------------------------------------------------------------------
/Src/Examples/ConfigurationExample/Utilities/NotificationLifetimeType.cs:
--------------------------------------------------------------------------------
1 | namespace ConfigurationExample.Utilities
2 | {
3 | public enum NotificationLifetimeType
4 | {
5 | Basic,
6 | TimeBased
7 | }
8 | }
--------------------------------------------------------------------------------
/Src/Examples/ConfigurationExample/Utilities/PositionProviderType.cs:
--------------------------------------------------------------------------------
1 | namespace ConfigurationExample.Utilities
2 | {
3 | public enum PositionProviderType
4 | {
5 | Window,
6 | Screen,
7 | Control
8 | }
9 | }
--------------------------------------------------------------------------------
/Src/Examples/ConfigurationExample/toast-notifications-icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rafallopatka/ToastNotifications/95ab84fe76fdf1380c52cacdb861ee0aa0280d29/Src/Examples/ConfigurationExample/toast-notifications-icon.ico
--------------------------------------------------------------------------------
/Src/Examples/CustomNotificationsExample/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Src/Examples/CustomNotificationsExample/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/Src/Examples/CustomNotificationsExample/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | namespace CustomNotificationsExample
4 | {
5 | ///
6 | /// Interaction logic for App.xaml
7 | ///
8 | public partial class App : Application
9 | {
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Src/Examples/CustomNotificationsExample/CustomCommand/CustomCommandDisplayPart.xaml:
--------------------------------------------------------------------------------
1 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Src/Examples/CustomNotificationsExample/CustomCommand/CustomCommandDisplayPart.xaml.cs:
--------------------------------------------------------------------------------
1 | using ToastNotifications.Core;
2 |
3 | namespace CustomNotificationsExample.CustomCommand
4 | {
5 | ///
6 | /// Interaction logic for CustomCommandDisplayPart.xaml
7 | ///
8 | public partial class CustomCommandDisplayPart : NotificationDisplayPart
9 | {
10 | public CustomCommandDisplayPart(CustomCommandNotification notification)
11 | {
12 | InitializeComponent();
13 | Bind(notification);
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Src/Examples/CustomNotificationsExample/CustomCommand/CustomCommandExtensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using ToastNotifications;
3 | using ToastNotifications.Core;
4 |
5 | namespace CustomNotificationsExample.CustomCommand
6 | {
7 | public static class CustomCommandExtensions
8 | {
9 | public static void ShowCustomCommand(this Notifier notifier,
10 | string message,
11 | Action confirmAction,
12 | Action declineAction,
13 | MessageOptions messageOptions = null)
14 | {
15 | notifier.Notify(() => new CustomCommandNotification(message, confirmAction, declineAction, messageOptions));
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Src/Examples/CustomNotificationsExample/CustomCommand/CustomCommandNotification.cs:
--------------------------------------------------------------------------------
1 | using CustomNotificationsExample.Utilities;
2 | using System;
3 | using System.ComponentModel;
4 | using System.Runtime.CompilerServices;
5 | using System.Windows.Input;
6 | using ToastNotifications.Core;
7 |
8 | namespace CustomNotificationsExample.CustomCommand
9 | {
10 | public class CustomCommandNotification : NotificationBase, INotifyPropertyChanged
11 | {
12 | private CustomCommandDisplayPart _displayPart;
13 |
14 | private Action _confirmAction;
15 | private Action _declineAction;
16 |
17 | public ICommand ConfirmCommand { get; set; }
18 | public ICommand DeclineCommand { get; set; }
19 |
20 | public CustomCommandNotification(string message,
21 | Action confirmAction,
22 | Action declineAction,
23 | MessageOptions messageOptions)
24 | : base(message, messageOptions)
25 | {
26 | Message = message;
27 | _confirmAction = confirmAction;
28 | _declineAction = declineAction;
29 |
30 | ConfirmCommand = new RelayCommand(x => _confirmAction(this));
31 | DeclineCommand = new RelayCommand(x => _declineAction(this));
32 | }
33 |
34 | public override NotificationDisplayPart DisplayPart => _displayPart ?? (_displayPart = new CustomCommandDisplayPart(this));
35 |
36 | #region binding properties
37 |
38 | private string _message;
39 |
40 | public string Message
41 | {
42 | get
43 | {
44 | return _message;
45 | }
46 | set
47 | {
48 | _message = value;
49 | OnPropertyChanged();
50 | }
51 | }
52 |
53 | public event PropertyChangedEventHandler PropertyChanged;
54 |
55 | protected virtual void OnPropertyChanged([CallerMemberName]string propertyName = null)
56 | {
57 | var handler = PropertyChanged;
58 | if (handler != null)
59 | handler.Invoke(this, new PropertyChangedEventArgs(propertyName));
60 | }
61 | #endregion
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/Src/Examples/CustomNotificationsExample/CustomInput/CustomCommandExtensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using ToastNotifications;
3 | using ToastNotifications.Core;
4 |
5 | namespace CustomNotificationsExample.CustomInput
6 | {
7 | public static class CustomInputExtensions
8 | {
9 | public static void ShowCustomInput(this Notifier notifier,
10 | string message,
11 | MessageOptions messageOptions = null)
12 | {
13 | notifier.Notify(() => new CustomInputNotification(message, message, messageOptions));
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Src/Examples/CustomNotificationsExample/CustomInput/CustomInputDisplayPart.xaml:
--------------------------------------------------------------------------------
1 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/Src/Examples/CustomNotificationsExample/CustomInput/CustomInputDisplayPart.xaml.cs:
--------------------------------------------------------------------------------
1 | using ToastNotifications.Core;
2 |
3 | namespace CustomNotificationsExample.CustomInput
4 | {
5 | ///
6 | /// Interaction logic for CustomCommandDisplayPart.xaml
7 | ///
8 | public partial class CustomInputDisplayPart : NotificationDisplayPart
9 | {
10 | public CustomInputDisplayPart(CustomInputNotification notification)
11 | {
12 | InitializeComponent();
13 | Bind(notification);
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Src/Examples/CustomNotificationsExample/CustomInput/CustomInputNotification.cs:
--------------------------------------------------------------------------------
1 | using CustomNotificationsExample.Utilities;
2 | using System;
3 | using System.ComponentModel;
4 | using System.Runtime.CompilerServices;
5 | using System.Windows.Input;
6 | using ToastNotifications.Core;
7 |
8 | namespace CustomNotificationsExample.CustomInput
9 | {
10 | public class CustomInputNotification : NotificationBase, INotifyPropertyChanged
11 | {
12 | private CustomInputDisplayPart _displayPart;
13 |
14 | public CustomInputNotification(string message, string initialText, MessageOptions messageOptions) : base(message, messageOptions)
15 | {
16 | Message = message;
17 | InputText = initialText;
18 | }
19 |
20 | public override NotificationDisplayPart DisplayPart => _displayPart ?? (_displayPart = new CustomInputDisplayPart(this));
21 |
22 | #region binding properties
23 |
24 | private string _message;
25 |
26 | public string Message
27 | {
28 | get
29 | {
30 | return _message;
31 | }
32 | set
33 | {
34 | _message = value;
35 | OnPropertyChanged();
36 | }
37 | }
38 |
39 | private string _inputText;
40 |
41 | public string InputText
42 | {
43 | get
44 | {
45 | return _inputText;
46 | }
47 | set
48 | {
49 | _inputText = value;
50 | OnPropertyChanged();
51 | }
52 | }
53 |
54 | public event PropertyChangedEventHandler PropertyChanged;
55 |
56 | protected virtual void OnPropertyChanged([CallerMemberName]string propertyName = null)
57 | {
58 | var handler = PropertyChanged;
59 | if (handler != null)
60 | handler.Invoke(this, new PropertyChangedEventArgs(propertyName));
61 | }
62 | #endregion
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/Src/Examples/CustomNotificationsExample/CustomMessage/CustomDisplayPart.xaml:
--------------------------------------------------------------------------------
1 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/Src/Examples/CustomNotificationsExample/CustomMessage/CustomDisplayPart.xaml.cs:
--------------------------------------------------------------------------------
1 | using ToastNotifications.Core;
2 |
3 | namespace CustomNotificationsExample.CustomMessage
4 | {
5 | ///
6 | /// Interaction logic for CustomDisplayPart.xaml
7 | ///
8 | public partial class CustomDisplayPart : NotificationDisplayPart
9 | {
10 | public CustomDisplayPart(CustomNotification customNotification)
11 | {
12 | InitializeComponent();
13 | Bind(customNotification);
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Src/Examples/CustomNotificationsExample/CustomMessage/CustomMessageExtensions.cs:
--------------------------------------------------------------------------------
1 | using ToastNotifications;
2 | using ToastNotifications.Core;
3 |
4 | namespace CustomNotificationsExample.CustomMessage
5 | {
6 | public static class CustomMessageExtensions
7 | {
8 | public static void ShowCustomMessage(this Notifier notifier,
9 | string title,
10 | string message,
11 | MessageOptions messageOptions = null)
12 | {
13 | notifier.Notify(() => new CustomNotification(title, message, messageOptions));
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Src/Examples/CustomNotificationsExample/CustomMessage/CustomNotification.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel;
2 | using System.Runtime.CompilerServices;
3 | using ToastNotifications.Core;
4 |
5 | namespace CustomNotificationsExample.CustomMessage
6 | {
7 | public class CustomNotification : NotificationBase, INotifyPropertyChanged
8 | {
9 | private CustomDisplayPart _displayPart;
10 |
11 | public override NotificationDisplayPart DisplayPart => _displayPart ?? (_displayPart = new CustomDisplayPart(this));
12 |
13 | public CustomNotification(string title, string message, MessageOptions messageOptions) : base(message, messageOptions)
14 | {
15 | Title = title;
16 | Message = message;
17 | }
18 |
19 | #region binding properties
20 | private string _title;
21 | public string Title
22 | {
23 | get
24 | {
25 | return _title;
26 | }
27 | set
28 | {
29 | _title = value;
30 | OnPropertyChanged();
31 | }
32 | }
33 |
34 | private string _message;
35 | public string Message
36 | {
37 | get
38 | {
39 | return _message;
40 | }
41 | set
42 | {
43 | _message = value;
44 | OnPropertyChanged();
45 | }
46 | }
47 |
48 | public event PropertyChangedEventHandler PropertyChanged;
49 |
50 | protected virtual void OnPropertyChanged([CallerMemberName]string propertyName = null)
51 | {
52 | var handler = PropertyChanged;
53 | if (handler != null)
54 | handler.Invoke(this, new PropertyChangedEventArgs(propertyName));
55 | }
56 | #endregion
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/Src/Examples/CustomNotificationsExample/MahAppsNotification/MahAppsDisplayPart.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/Src/Examples/CustomNotificationsExample/MahAppsNotification/MahAppsDisplayPart.xaml.cs:
--------------------------------------------------------------------------------
1 | using ToastNotifications.Core;
2 |
3 | namespace CustomNotificationsExample.MahAppsNotification
4 | {
5 | ///
6 | /// Interaction logic for MahAppsDisplayPart.xaml
7 | ///
8 | public partial class MahAppsDisplayPart : NotificationDisplayPart
9 | {
10 | public MahAppsDisplayPart(MahAppsNotification notification)
11 | {
12 | InitializeComponent();
13 | Bind(notification);
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Src/Examples/CustomNotificationsExample/MahAppsNotification/MahAppsNotification.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel;
2 | using System.Runtime.CompilerServices;
3 | using ToastNotifications.Core;
4 |
5 | namespace CustomNotificationsExample.MahAppsNotification
6 | {
7 | public class MahAppsNotification : NotificationBase, INotifyPropertyChanged
8 | {
9 | private MahAppsDisplayPart _displayPart;
10 |
11 | public override NotificationDisplayPart DisplayPart => _displayPart ?? (_displayPart = new MahAppsDisplayPart(this));
12 |
13 | public MahAppsNotification(string title, string message, MessageOptions messageOptions) : base(message, messageOptions)
14 | {
15 | Title = title;
16 | Message = message;
17 | }
18 |
19 | #region binding properties
20 | private string _title;
21 | public string Title
22 | {
23 | get
24 | {
25 | return _title;
26 | }
27 | set
28 | {
29 | _title = value;
30 | OnPropertyChanged();
31 | }
32 | }
33 |
34 | private string _message;
35 | public string Message
36 | {
37 | get
38 | {
39 | return _message;
40 | }
41 | set
42 | {
43 | _message = value;
44 | OnPropertyChanged();
45 | }
46 | }
47 |
48 | public event PropertyChangedEventHandler PropertyChanged;
49 |
50 | protected virtual void OnPropertyChanged([CallerMemberName]string propertyName = null)
51 | {
52 | var handler = PropertyChanged;
53 | if (handler != null)
54 | handler.Invoke(this, new PropertyChangedEventArgs(propertyName));
55 | }
56 | #endregion
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/Src/Examples/CustomNotificationsExample/MahAppsNotification/MahAppsNotificationExtensions.cs:
--------------------------------------------------------------------------------
1 | using ToastNotifications;
2 | using ToastNotifications.Core;
3 |
4 | namespace CustomNotificationsExample.MahAppsNotification
5 | {
6 | public static class MahAppsNotificationExtensions
7 | {
8 | public static void ShowMahAppsNotification(this Notifier notifier,
9 | string title,
10 | string message,
11 | MessageOptions messageOptions = null)
12 | {
13 | notifier.Notify(() => new MahAppsNotification(title, message, messageOptions));
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Src/Examples/CustomNotificationsExample/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/Src/Examples/CustomNotificationsExample/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using CustomNotificationsExample.CustomMessage;
2 | using CustomNotificationsExample.MahAppsNotification;
3 | using MahApps.Metro.Controls;
4 | using System;
5 | using System.Windows;
6 | using CustomNotificationsExample.CustomCommand;
7 | using CustomNotificationsExample.CustomInput;
8 | using ToastNotifications;
9 | using ToastNotifications.Events;
10 | using ToastNotifications.Lifetime;
11 | using ToastNotifications.Position;
12 |
13 | namespace CustomNotificationsExample
14 | {
15 | ///
16 | /// Interaction logic for MainWindow.xaml
17 | ///
18 | public partial class MainWindow : MetroWindow
19 | {
20 | private readonly Notifier _notifier;
21 |
22 | public MainWindow()
23 | {
24 | InitializeComponent();
25 |
26 | Unloaded += OnUnload;
27 |
28 | _notifier = new Notifier(cfg =>
29 | {
30 | cfg.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor(TimeSpan.FromSeconds(15), MaximumNotificationCount.FromCount(15));
31 | cfg.PositionProvider = new PrimaryScreenPositionProvider(Corner.BottomRight, 10, 10);
32 | cfg.KeyboardEventHandler = new AllowedSourcesInputEventHandler(new []{ typeof(CustomInputDisplayPart) });
33 | });
34 | }
35 |
36 | private void OnUnload(object sender, RoutedEventArgs e)
37 | {
38 | _notifier.Dispose();
39 | }
40 |
41 | private void CustomMessage_Click(object sender, RoutedEventArgs e)
42 | {
43 | _notifier.ShowCustomMessage("Custom notificaton", "This is custom notification based on user control");
44 | }
45 |
46 | private void CustomCommand_Click(object sender, RoutedEventArgs e)
47 | {
48 | _notifier.ShowCustomCommand("Custom command example",
49 | confirmAction: n => n.Close(), // do something usefull here
50 | declineAction: n => n.Close());
51 | }
52 |
53 | private void CustomInput_Click(object sender, RoutedEventArgs e)
54 | {
55 | _notifier.ShowCustomInput("Custom input example");
56 | }
57 |
58 | private void MahApps_Click(object sender, RoutedEventArgs e)
59 | {
60 | _notifier.ShowMahAppsNotification("MahApps notification", "This is custom notification with MahApps styles");
61 | }
62 |
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/Src/Examples/CustomNotificationsExample/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 | using System.Windows;
6 |
7 | // General Information about an assembly is controlled through the following
8 | // set of attributes. Change these attribute values to modify the information
9 | // associated with an assembly.
10 | [assembly: AssemblyTitle("CustomNotificationsExample")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("")]
14 | [assembly: AssemblyProduct("CustomNotificationsExample")]
15 | [assembly: AssemblyCopyright("Copyright © Rafał Łopatka 2018")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | // Setting ComVisible to false makes the types in this assembly not visible
20 | // to COM components. If you need to access a type in this assembly from
21 | // COM, set the ComVisible attribute to true on that type.
22 | [assembly: ComVisible(false)]
23 |
24 | //In order to begin building localizable applications, set
25 | //CultureYouAreCodingWith in your .csproj file
26 | //inside a . For example, if you are using US english
27 | //in your source files, set the to en-US. Then uncomment
28 | //the NeutralResourceLanguage attribute below. Update the "en-US" in
29 | //the line below to match the UICulture setting in the project file.
30 |
31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32 |
33 |
34 | [assembly: ThemeInfo(
35 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
36 | //(used if a resource is not found in the page,
37 | // or application resource dictionaries)
38 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
39 | //(used if a resource is not found in the page,
40 | // app, or any theme specific resource dictionaries)
41 | )]
42 |
43 |
44 | // Version information for an assembly consists of the following four values:
45 | //
46 | // Major Version
47 | // Minor Version
48 | // Build Number
49 | // Revision
50 | //
51 | // You can specify all the values or you can default the Build and Revision Numbers
52 | // by using the '*' as shown below:
53 | // [assembly: AssemblyVersion("1.0.*")]
54 | [assembly: AssemblyVersion("1.0.0.0")]
55 | [assembly: AssemblyFileVersion("1.0.0.0")]
56 |
--------------------------------------------------------------------------------
/Src/Examples/CustomNotificationsExample/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace CustomNotificationsExample.Properties
12 | {
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources
26 | {
27 |
28 | private static global::System.Resources.ResourceManager resourceMan;
29 |
30 | private static global::System.Globalization.CultureInfo resourceCulture;
31 |
32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
33 | internal Resources()
34 | {
35 | }
36 |
37 | ///
38 | /// Returns the cached ResourceManager instance used by this class.
39 | ///
40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
41 | internal static global::System.Resources.ResourceManager ResourceManager
42 | {
43 | get
44 | {
45 | if ((resourceMan == null))
46 | {
47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CustomNotificationsExample.Properties.Resources", typeof(Resources).Assembly);
48 | resourceMan = temp;
49 | }
50 | return resourceMan;
51 | }
52 | }
53 |
54 | ///
55 | /// Overrides the current thread's CurrentUICulture property for all
56 | /// resource lookups using this strongly typed resource class.
57 | ///
58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
59 | internal static global::System.Globalization.CultureInfo Culture
60 | {
61 | get
62 | {
63 | return resourceCulture;
64 | }
65 | set
66 | {
67 | resourceCulture = value;
68 | }
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/Src/Examples/CustomNotificationsExample/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace CustomNotificationsExample.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 | {
19 |
20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21 |
22 | public static Settings Default
23 | {
24 | get
25 | {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Src/Examples/CustomNotificationsExample/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Src/Examples/CustomNotificationsExample/Utilities/RelayCommand.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Input;
3 |
4 | namespace CustomNotificationsExample.Utilities
5 | {
6 | public class RelayCommand : ICommand
7 | {
8 | private Action