├── .gitattributes ├── .gitignore ├── BackgroundTaskComponent ├── BackgroundTaskComponent.csproj ├── Properties │ └── AssemblyInfo.cs ├── ToastNotificationBackgroundTask.cs ├── project.json └── project.lock.json ├── Quickstart-Sending-Local-Toast.sln └── Quickstart-Sending-Local-Toast ├── .vs └── config │ └── applicationhost.config ├── App.xaml ├── App.xaml.cs ├── Assets ├── Andrew.jpg ├── Comment.metrop ├── LockScreenLogo.scale-200.png ├── Reply.png ├── SplashScreen.scale-200.png ├── Square150x150Logo.scale-200.png ├── Square44x44Logo.scale-200.png ├── StoreLogo.png └── Wide310x150Logo.scale-200.png ├── BackButtonPage.cs ├── ClassLibrary ├── ClassLibrary.csproj ├── MyArguments.cs └── Properties │ └── AssemblyInfo.cs ├── ConversationPage.xaml ├── ConversationPage.xaml.cs ├── ImagePage.xaml ├── ImagePage.xaml.cs ├── MainPage.xaml ├── MainPage.xaml.cs ├── Package.appxmanifest ├── Properties ├── AssemblyInfo.cs └── Default.rd.xml ├── Quickstart-Sending-Local-Toast.csproj ├── project.json └── project.lock.json /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /.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 | # Build results 11 | [Dd]ebug/ 12 | [Dd]ebugPublic/ 13 | [Rr]elease/ 14 | [Rr]eleases/ 15 | x64/ 16 | x86/ 17 | build/ 18 | bld/ 19 | [Bb]in/ 20 | [Oo]bj/ 21 | 22 | # Roslyn cache directories 23 | *.ide/ 24 | 25 | # MSTest test Results 26 | [Tt]est[Rr]esult*/ 27 | [Bb]uild[Ll]og.* 28 | 29 | #NUNIT 30 | *.VisualState.xml 31 | TestResult.xml 32 | 33 | # Build Results of an ATL Project 34 | [Dd]ebugPS/ 35 | [Rr]eleasePS/ 36 | dlldata.c 37 | 38 | *_i.c 39 | *_p.c 40 | *_i.h 41 | *.ilk 42 | *.meta 43 | *.obj 44 | *.pch 45 | *.pdb 46 | *.pgc 47 | *.pgd 48 | *.rsp 49 | *.sbr 50 | *.tlb 51 | *.tli 52 | *.tlh 53 | *.tmp 54 | *.tmp_proj 55 | *.log 56 | *.vspscc 57 | *.vssscc 58 | .builds 59 | *.pidb 60 | *.svclog 61 | *.scc 62 | 63 | # Chutzpah Test files 64 | _Chutzpah* 65 | 66 | # Visual C++ cache files 67 | ipch/ 68 | *.aps 69 | *.ncb 70 | *.opensdf 71 | *.sdf 72 | *.cachefile 73 | 74 | # Visual Studio profiler 75 | *.psess 76 | *.vsp 77 | *.vspx 78 | 79 | # TFS 2012 Local Workspace 80 | $tf/ 81 | 82 | # Guidance Automation Toolkit 83 | *.gpState 84 | 85 | # ReSharper is a .NET coding add-in 86 | _ReSharper*/ 87 | *.[Rr]e[Ss]harper 88 | *.DotSettings.user 89 | 90 | # JustCode is a .NET coding addin-in 91 | .JustCode 92 | 93 | # TeamCity is a build add-in 94 | _TeamCity* 95 | 96 | # DotCover is a Code Coverage Tool 97 | *.dotCover 98 | 99 | # NCrunch 100 | _NCrunch_* 101 | .*crunch*.local.xml 102 | 103 | # MightyMoose 104 | *.mm.* 105 | AutoTest.Net/ 106 | 107 | # Web workbench (sass) 108 | .sass-cache/ 109 | 110 | # Installshield output folder 111 | [Ee]xpress/ 112 | 113 | # DocProject is a documentation generator add-in 114 | DocProject/buildhelp/ 115 | DocProject/Help/*.HxT 116 | DocProject/Help/*.HxC 117 | DocProject/Help/*.hhc 118 | DocProject/Help/*.hhk 119 | DocProject/Help/*.hhp 120 | DocProject/Help/Html2 121 | DocProject/Help/html 122 | 123 | # Click-Once directory 124 | publish/ 125 | 126 | # Publish Web Output 127 | *.[Pp]ublish.xml 128 | *.azurePubxml 129 | # TODO: Comment the next line if you want to checkin your web deploy settings 130 | # but database connection strings (with potential passwords) will be unencrypted 131 | *.pubxml 132 | *.publishproj 133 | 134 | # NuGet Packages 135 | *.nupkg 136 | # The packages folder can be ignored because of Package Restore 137 | **/packages/* 138 | # except build/, which is used as an MSBuild target. 139 | !**/packages/build/ 140 | # If using the old MSBuild-Integrated Package Restore, uncomment this: 141 | #!**/packages/repositories.config 142 | 143 | # Windows Azure Build Output 144 | csx/ 145 | *.build.csdef 146 | 147 | # Windows Store app package directory 148 | AppPackages/ 149 | 150 | # Others 151 | sql/ 152 | *.Cache 153 | ClientBin/ 154 | [Ss]tyle[Cc]op.* 155 | ~$* 156 | *~ 157 | *.dbmdl 158 | *.dbproj.schemaview 159 | *.pfx 160 | *.publishsettings 161 | node_modules/ 162 | 163 | # RIA/Silverlight projects 164 | Generated_Code/ 165 | 166 | # Backup & report files from converting an old project file 167 | # to a newer Visual Studio version. Backup files are not needed, 168 | # because we have git ;-) 169 | _UpgradeReport_Files/ 170 | Backup*/ 171 | UpgradeLog*.XML 172 | UpgradeLog*.htm 173 | 174 | # SQL Server files 175 | *.mdf 176 | *.ldf 177 | 178 | # Business Intelligence projects 179 | *.rdl.data 180 | *.bim.layout 181 | *.bim_*.settings 182 | 183 | # Microsoft Fakes 184 | FakesAssemblies/ 185 | 186 | # ========================= 187 | # Operating System Files 188 | # ========================= 189 | 190 | # OSX 191 | # ========================= 192 | 193 | .DS_Store 194 | .AppleDouble 195 | .LSOverride 196 | 197 | # Thumbnails 198 | ._* 199 | 200 | # Files that might appear on external disk 201 | .Spotlight-V100 202 | .Trashes 203 | 204 | # Directories potentially created on remote AFP share 205 | .AppleDB 206 | .AppleDesktop 207 | Network Trash Folder 208 | Temporary Items 209 | .apdisk 210 | 211 | # Windows 212 | # ========================= 213 | 214 | # Windows image file caches 215 | Thumbs.db 216 | ehthumbs.db 217 | 218 | # Folder config file 219 | Desktop.ini 220 | 221 | # Recycle Bin used on file shares 222 | $RECYCLE.BIN/ 223 | 224 | # Windows Installer files 225 | *.cab 226 | *.msi 227 | *.msm 228 | *.msp 229 | 230 | # Windows shortcuts 231 | *.lnk 232 | -------------------------------------------------------------------------------- /BackgroundTaskComponent/BackgroundTaskComponent.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {D16B316B-596A-4D9C-BF4A-05E08D433855} 8 | winmdobj 9 | Properties 10 | BackgroundTaskComponent 11 | BackgroundTaskComponent 12 | en-US 13 | UAP 14 | 10.0.14393.0 15 | 10.0.10240.0 16 | 14 17 | 512 18 | {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 19 | false 20 | 21 | 22 | AnyCPU 23 | true 24 | full 25 | false 26 | bin\Debug\ 27 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP 28 | prompt 29 | 4 30 | 31 | 32 | AnyCPU 33 | pdbonly 34 | true 35 | bin\Release\ 36 | TRACE;NETFX_CORE;WINDOWS_UWP 37 | prompt 38 | 4 39 | 40 | 41 | ARM 42 | true 43 | bin\ARM\Debug\ 44 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP 45 | ;2008 46 | full 47 | ARM 48 | false 49 | prompt 50 | true 51 | 52 | 53 | ARM 54 | bin\ARM\Release\ 55 | TRACE;NETFX_CORE;WINDOWS_UWP 56 | true 57 | ;2008 58 | pdbonly 59 | ARM 60 | false 61 | prompt 62 | true 63 | 64 | 65 | x64 66 | true 67 | bin\x64\Debug\ 68 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP 69 | ;2008 70 | full 71 | x64 72 | false 73 | prompt 74 | true 75 | 76 | 77 | x64 78 | bin\x64\Release\ 79 | TRACE;NETFX_CORE;WINDOWS_UWP 80 | true 81 | ;2008 82 | pdbonly 83 | x64 84 | false 85 | prompt 86 | true 87 | 88 | 89 | x86 90 | true 91 | bin\x86\Debug\ 92 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP 93 | ;2008 94 | full 95 | x86 96 | false 97 | prompt 98 | true 99 | 100 | 101 | x86 102 | bin\x86\Release\ 103 | TRACE;NETFX_CORE;WINDOWS_UWP 104 | true 105 | ;2008 106 | pdbonly 107 | x86 108 | false 109 | prompt 110 | true 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 14.0 122 | 123 | 124 | 131 | -------------------------------------------------------------------------------- /BackgroundTaskComponent/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("BackgroundTaskComponent")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("BackgroundTaskComponent")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Version information for an assembly consists of the following four values: 18 | // 19 | // Major Version 20 | // Minor Version 21 | // Build Number 22 | // Revision 23 | // 24 | // You can specify all the values or you can default the Build and Revision Numbers 25 | // by using the '*' as shown below: 26 | // [assembly: AssemblyVersion("1.0.*")] 27 | [assembly: AssemblyVersion("1.0.0.0")] 28 | [assembly: AssemblyFileVersion("1.0.0.0")] 29 | [assembly: ComVisible(false)] -------------------------------------------------------------------------------- /BackgroundTaskComponent/ToastNotificationBackgroundTask.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.QueryStringDotNET; 2 | using Microsoft.Toolkit.Uwp.Notifications; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Net.Http; 7 | using System.Runtime.Serialization.Json; 8 | using System.Text; 9 | using System.Threading.Tasks; 10 | using Windows.ApplicationModel.Background; 11 | using Windows.Foundation; 12 | using Windows.UI.Notifications; 13 | 14 | namespace BackgroundTaskComponent 15 | { 16 | public sealed class ToastNotificationBackgroundTask : IBackgroundTask 17 | { 18 | public async void Run(IBackgroundTaskInstance taskInstance) 19 | { 20 | // Get a deferral since we're executing async code 21 | var deferral = taskInstance.GetDeferral(); 22 | 23 | try 24 | { 25 | // If it's a toast notification action 26 | if (taskInstance.TriggerDetails is ToastNotificationActionTriggerDetail) 27 | { 28 | // Get the toast activation details 29 | var details = taskInstance.TriggerDetails as ToastNotificationActionTriggerDetail; 30 | 31 | // Deserialize the arguments received from the toast activation 32 | QueryString args = QueryString.Parse(details.Argument); 33 | 34 | // Depending on what action was taken... 35 | switch (args["action"]) 36 | { 37 | // User clicked the reply button (doing a quick reply) 38 | case "reply": 39 | await HandleReply(details, args); 40 | break; 41 | 42 | // User clicked the like button 43 | case "like": 44 | await HandleLike(details, args); 45 | break; 46 | 47 | default: 48 | throw new NotImplementedException(); 49 | } 50 | } 51 | 52 | // Otherwise handle other background activations 53 | else 54 | throw new NotImplementedException(); 55 | } 56 | 57 | finally 58 | { 59 | // And finally release the deferral since we're done 60 | deferral.Complete(); 61 | } 62 | } 63 | 64 | private async Task HandleReply(ToastNotificationActionTriggerDetail details, QueryString args) 65 | { 66 | // Get the conversation the toast is about 67 | int conversationId = int.Parse(args["conversationId"]); 68 | 69 | // Get the message that the user typed in the toast 70 | string message = (string)details.UserInput["tbReply"]; 71 | 72 | // In a real app, this would be making a web request, sending the new message 73 | await Task.Delay(TimeSpan.FromSeconds(2.3)); 74 | 75 | // In a real app, you most likely should NOT notify your user that the request completed (only notify them if there's an error) 76 | SendToast("Your message has been sent! Your message: " + message); 77 | } 78 | 79 | private async Task HandleLike(ToastNotificationActionTriggerDetail details, QueryString args) 80 | { 81 | // Get the conversation the toast is about 82 | int conversationId = int.Parse(args["conversationId"]); 83 | 84 | // In a real app, this would be making a web request, sending the like command 85 | await Task.Delay(TimeSpan.FromSeconds(1.1)); 86 | 87 | // In a real app, you most likely should NOT notify your user that the request completed (only notify them if there's an error) 88 | SendToast("Your like has been sent!"); 89 | } 90 | 91 | /// 92 | /// Simple method to show a basic toast with a message. 93 | /// 94 | /// 95 | private void SendToast(string message) 96 | { 97 | ToastContent content = new ToastContent() 98 | { 99 | Visual = new ToastVisual() 100 | { 101 | BindingGeneric = new ToastBindingGeneric() 102 | { 103 | Children = 104 | { 105 | new AdaptiveText() 106 | { 107 | Text = "Background Task Completed" 108 | }, 109 | 110 | new AdaptiveText() 111 | { 112 | Text = message 113 | } 114 | } 115 | } 116 | } 117 | }; 118 | 119 | ToastNotificationManager.CreateToastNotifier().Show(new ToastNotification(content.GetXml())); 120 | } 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /BackgroundTaskComponent/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "Microsoft.NETCore.UniversalWindowsPlatform": "5.2.2", 4 | "Microsoft.Toolkit.Uwp.Notifications": "1.1.0", 5 | "QueryString.NET": "1.0.0" 6 | }, 7 | "frameworks": { 8 | "uap10.0": {} 9 | }, 10 | "runtimes": { 11 | "win10-arm": {}, 12 | "win10-arm-aot": {}, 13 | "win10-x86": {}, 14 | "win10-x86-aot": {}, 15 | "win10-x64": {}, 16 | "win10-x64-aot": {} 17 | } 18 | } -------------------------------------------------------------------------------- /Quickstart-Sending-Local-Toast.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.23107.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Quickstart-Sending-Local-Toast", "Quickstart-Sending-Local-Toast\Quickstart-Sending-Local-Toast.csproj", "{06A2B906-6AA9-44C6-BC25-6ABA6A3A83E4}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BackgroundTaskComponent", "BackgroundTaskComponent\BackgroundTaskComponent.csproj", "{D16B316B-596A-4D9C-BF4A-05E08D433855}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Debug|ARM = Debug|ARM 14 | Debug|x64 = Debug|x64 15 | Debug|x86 = Debug|x86 16 | Release|Any CPU = Release|Any CPU 17 | Release|ARM = Release|ARM 18 | Release|x64 = Release|x64 19 | Release|x86 = Release|x86 20 | EndGlobalSection 21 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 22 | {06A2B906-6AA9-44C6-BC25-6ABA6A3A83E4}.Debug|Any CPU.ActiveCfg = Debug|x86 23 | {06A2B906-6AA9-44C6-BC25-6ABA6A3A83E4}.Debug|Any CPU.Build.0 = Debug|x86 24 | {06A2B906-6AA9-44C6-BC25-6ABA6A3A83E4}.Debug|Any CPU.Deploy.0 = Debug|x86 25 | {06A2B906-6AA9-44C6-BC25-6ABA6A3A83E4}.Debug|ARM.ActiveCfg = Debug|ARM 26 | {06A2B906-6AA9-44C6-BC25-6ABA6A3A83E4}.Debug|ARM.Build.0 = Debug|ARM 27 | {06A2B906-6AA9-44C6-BC25-6ABA6A3A83E4}.Debug|ARM.Deploy.0 = Debug|ARM 28 | {06A2B906-6AA9-44C6-BC25-6ABA6A3A83E4}.Debug|x64.ActiveCfg = Debug|x64 29 | {06A2B906-6AA9-44C6-BC25-6ABA6A3A83E4}.Debug|x64.Build.0 = Debug|x64 30 | {06A2B906-6AA9-44C6-BC25-6ABA6A3A83E4}.Debug|x64.Deploy.0 = Debug|x64 31 | {06A2B906-6AA9-44C6-BC25-6ABA6A3A83E4}.Debug|x86.ActiveCfg = Debug|x86 32 | {06A2B906-6AA9-44C6-BC25-6ABA6A3A83E4}.Debug|x86.Build.0 = Debug|x86 33 | {06A2B906-6AA9-44C6-BC25-6ABA6A3A83E4}.Debug|x86.Deploy.0 = Debug|x86 34 | {06A2B906-6AA9-44C6-BC25-6ABA6A3A83E4}.Release|Any CPU.ActiveCfg = Release|x86 35 | {06A2B906-6AA9-44C6-BC25-6ABA6A3A83E4}.Release|ARM.ActiveCfg = Release|ARM 36 | {06A2B906-6AA9-44C6-BC25-6ABA6A3A83E4}.Release|ARM.Build.0 = Release|ARM 37 | {06A2B906-6AA9-44C6-BC25-6ABA6A3A83E4}.Release|ARM.Deploy.0 = Release|ARM 38 | {06A2B906-6AA9-44C6-BC25-6ABA6A3A83E4}.Release|x64.ActiveCfg = Release|x64 39 | {06A2B906-6AA9-44C6-BC25-6ABA6A3A83E4}.Release|x64.Build.0 = Release|x64 40 | {06A2B906-6AA9-44C6-BC25-6ABA6A3A83E4}.Release|x64.Deploy.0 = Release|x64 41 | {06A2B906-6AA9-44C6-BC25-6ABA6A3A83E4}.Release|x86.ActiveCfg = Release|x86 42 | {06A2B906-6AA9-44C6-BC25-6ABA6A3A83E4}.Release|x86.Build.0 = Release|x86 43 | {06A2B906-6AA9-44C6-BC25-6ABA6A3A83E4}.Release|x86.Deploy.0 = Release|x86 44 | {D16B316B-596A-4D9C-BF4A-05E08D433855}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 45 | {D16B316B-596A-4D9C-BF4A-05E08D433855}.Debug|Any CPU.Build.0 = Debug|Any CPU 46 | {D16B316B-596A-4D9C-BF4A-05E08D433855}.Debug|ARM.ActiveCfg = Debug|ARM 47 | {D16B316B-596A-4D9C-BF4A-05E08D433855}.Debug|ARM.Build.0 = Debug|ARM 48 | {D16B316B-596A-4D9C-BF4A-05E08D433855}.Debug|x64.ActiveCfg = Debug|x64 49 | {D16B316B-596A-4D9C-BF4A-05E08D433855}.Debug|x64.Build.0 = Debug|x64 50 | {D16B316B-596A-4D9C-BF4A-05E08D433855}.Debug|x86.ActiveCfg = Debug|x86 51 | {D16B316B-596A-4D9C-BF4A-05E08D433855}.Debug|x86.Build.0 = Debug|x86 52 | {D16B316B-596A-4D9C-BF4A-05E08D433855}.Release|Any CPU.ActiveCfg = Release|Any CPU 53 | {D16B316B-596A-4D9C-BF4A-05E08D433855}.Release|Any CPU.Build.0 = Release|Any CPU 54 | {D16B316B-596A-4D9C-BF4A-05E08D433855}.Release|ARM.ActiveCfg = Release|ARM 55 | {D16B316B-596A-4D9C-BF4A-05E08D433855}.Release|ARM.Build.0 = Release|ARM 56 | {D16B316B-596A-4D9C-BF4A-05E08D433855}.Release|x64.ActiveCfg = Release|x64 57 | {D16B316B-596A-4D9C-BF4A-05E08D433855}.Release|x64.Build.0 = Release|x64 58 | {D16B316B-596A-4D9C-BF4A-05E08D433855}.Release|x86.ActiveCfg = Release|x86 59 | {D16B316B-596A-4D9C-BF4A-05E08D433855}.Release|x86.Build.0 = Release|x86 60 | EndGlobalSection 61 | GlobalSection(SolutionProperties) = preSolution 62 | HideSolutionNode = FALSE 63 | EndGlobalSection 64 | EndGlobal 65 | -------------------------------------------------------------------------------- /Quickstart-Sending-Local-Toast/.vs/config/applicationhost.config: -------------------------------------------------------------------------------- 1 |  2 | 20 | 21 | 22 | 23 | 50 | 51 | 52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 | 61 | 62 | 63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 | 81 |
82 |
83 | 84 |
85 |
86 |
87 |
88 |
89 |
90 | 91 |
92 |
93 |
94 |
95 |
96 | 97 |
98 |
99 |
100 | 101 |
102 |
103 | 104 |
105 |
106 | 107 |
108 |
109 |
110 | 111 | 112 |
113 |
114 |
115 |
116 |
117 |
118 | 119 |
120 |
121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | 529 | 530 | 531 | 532 | 533 | 534 | 535 | 536 | 537 | 538 | 539 | 540 | 541 | 542 | 543 | 544 | 545 | 546 | 547 | 548 | 549 | 550 | 551 | 552 | 553 | 554 | 555 | 556 | 557 | 558 | 559 | 560 | 561 | 562 | 563 | 564 | 565 | 566 | 567 | 568 | 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | 665 | 666 | 667 | 668 | 669 | 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 | 678 | 679 | 680 | 681 | 682 | 683 | 684 | 685 | 686 | 687 | 688 | 689 | 690 | 691 | 692 | 693 | 694 | 695 | 696 | 697 | 698 | 699 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 724 | 725 | 726 | 727 | 728 | 729 | 730 | 731 | 732 | 733 | 734 | 735 | 736 | 737 | 738 | 739 | 740 | 741 | 742 | 743 | 744 | 745 | 746 | 747 | 748 | 749 | 750 | 751 | 752 | 753 | 754 | 755 | 756 | 757 | 758 | 759 | 760 | 761 | 762 | 763 | 764 | 765 | 766 | 767 | 768 | 769 | 770 | 771 | 772 | 773 | 774 | 775 | 776 | 777 | 778 | 779 | 780 | 781 | 782 | 783 | 784 | 785 | 786 | 787 | 788 | 789 | 790 | 791 | 792 | 793 | 794 | 795 | 796 | 797 | 798 | 799 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 829 | 830 | 831 | 832 | 833 | 834 | 835 | 836 | 837 | 838 | 839 | 840 | 841 | 842 | 843 | 844 | 845 | 846 | 847 | 848 | 849 | 850 | 851 | 852 | 853 | 854 | 855 | 856 | 857 | 858 | 859 | 860 | 861 | 862 | 863 | 864 | 865 | 866 | 867 | 868 | 869 | 870 | 871 | 872 | 873 | 874 | 875 | 876 | 877 | 878 | 879 | 880 | 881 | 882 | 883 | 884 | 887 | 888 | 889 | 890 | 891 | 892 | 893 | 894 | 895 | 896 | 897 | 898 | 899 | 902 | 903 | 904 | 905 | 906 | 907 | 908 | 909 | 910 | 911 | 912 | 913 | 914 | 915 | 916 | 917 | 918 | 919 | 920 | 921 | 922 | 923 | 924 | 925 | 926 | 927 | 928 | 929 | 930 | 931 | 932 | 933 | 934 | 935 | 936 | 937 | 938 | 939 | 940 | 941 | 942 | 943 | 944 | 945 | 946 | 947 | 948 | 949 | 950 | 951 | 952 | 953 | 954 | 955 | 956 | 957 | 958 | 959 | 960 | 961 | 962 | 963 | 964 | 965 | 966 | 967 | 968 | 969 | 970 | 971 | 972 | 973 | 974 | 975 | 976 | 977 | 978 | 979 | 980 | 981 | 982 | 983 | 984 | 985 | 986 | 987 | 988 | 989 | 990 | 991 | 992 | 993 | 994 | 995 | 996 | 997 | 998 | 999 | 1000 | 1001 | 1002 | 1003 | 1004 | 1005 | 1006 | 1007 | 1008 | 1009 | 1010 | 1011 | 1012 | 1013 | 1014 | 1015 | 1016 | 1017 | 1018 | 1019 | 1020 | -------------------------------------------------------------------------------- /Quickstart-Sending-Local-Toast/App.xaml: -------------------------------------------------------------------------------- 1 |  7 | 8 | 9 | -------------------------------------------------------------------------------- /Quickstart-Sending-Local-Toast/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using BackgroundTaskComponent; 2 | using Microsoft.QueryStringDotNET; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.IO; 6 | using System.Linq; 7 | using System.Runtime.InteropServices.WindowsRuntime; 8 | using System.Threading.Tasks; 9 | using Windows.ApplicationModel; 10 | using Windows.ApplicationModel.Activation; 11 | using Windows.ApplicationModel.Background; 12 | using Windows.Foundation; 13 | using Windows.Foundation.Collections; 14 | using Windows.Storage; 15 | using Windows.UI.Popups; 16 | using Windows.UI.Xaml; 17 | using Windows.UI.Xaml.Controls; 18 | using Windows.UI.Xaml.Controls.Primitives; 19 | using Windows.UI.Xaml.Data; 20 | using Windows.UI.Xaml.Input; 21 | using Windows.UI.Xaml.Media; 22 | using Windows.UI.Xaml.Media.Animation; 23 | using Windows.UI.Xaml.Navigation; 24 | 25 | namespace Quickstart_Sending_Local_Toast 26 | { 27 | /// 28 | /// Provides application-specific behavior to supplement the default Application class. 29 | /// 30 | sealed partial class App : Application 31 | { 32 | /// 33 | /// Initializes the singleton application object. This is the first line of authored code 34 | /// executed, and as such is the logical equivalent of main() or WinMain(). 35 | /// 36 | public App() 37 | { 38 | this.InitializeComponent(); 39 | this.Suspending += OnSuspending; 40 | } 41 | 42 | /// 43 | /// Invoked when the application is launched normally by the end user. Other entry points 44 | /// will be used such as when the application is launched to open a specific file. 45 | /// 46 | /// Details about the launch request and process. 47 | protected override async void OnLaunched(LaunchActivatedEventArgs e) 48 | { 49 | await OnLaunchedOrActivated(e); 50 | } 51 | 52 | /// 53 | /// Invoked when the application is activated by some means other than normal launching. 54 | /// 55 | /// Event data for the event. 56 | protected override async void OnActivated(IActivatedEventArgs e) 57 | { 58 | await OnLaunchedOrActivated(e); 59 | } 60 | 61 | private async Task OnLaunchedOrActivated(IActivatedEventArgs e) 62 | { 63 | // Initialize things like registering background task before the app is loaded 64 | await InitializeApp(); 65 | 66 | #if DEBUG 67 | if (System.Diagnostics.Debugger.IsAttached) 68 | { 69 | this.DebugSettings.EnableFrameRateCounter = true; 70 | } 71 | #endif 72 | 73 | Frame rootFrame = Window.Current.Content as Frame; 74 | 75 | // Do not repeat app initialization when the Window already has content, 76 | // just ensure that the window is active 77 | if (rootFrame == null) 78 | { 79 | // Create a Frame to act as the navigation context and navigate to the first page 80 | rootFrame = new Frame(); 81 | 82 | rootFrame.NavigationFailed += OnNavigationFailed; 83 | 84 | if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) 85 | { 86 | // TODO: Load state from previously suspended application 87 | } 88 | 89 | // Place the frame in the current Window 90 | Window.Current.Content = rootFrame; 91 | } 92 | 93 | // Handle toast activation 94 | if (e is ToastNotificationActivatedEventArgs) 95 | { 96 | var toastActivationArgs = e as ToastNotificationActivatedEventArgs; 97 | 98 | // If empty args, no specific action (just launch the app) 99 | if (toastActivationArgs.Argument.Length == 0) 100 | { 101 | if (rootFrame.Content == null) 102 | rootFrame.Navigate(typeof(MainPage)); 103 | } 104 | 105 | // Otherwise an action is provided 106 | else 107 | { 108 | // Parse the query string 109 | QueryString args = QueryString.Parse(toastActivationArgs.Argument); 110 | 111 | // See what action is being requested 112 | switch (args["action"]) 113 | { 114 | // Open the image 115 | case "viewImage": 116 | 117 | // The URL retrieved from the toast args 118 | string imageUrl = args["imageUrl"]; 119 | 120 | // If we're already viewing that image, do nothing 121 | if (rootFrame.Content is ImagePage && (rootFrame.Content as ImagePage).ImageUrl.Equals(imageUrl)) 122 | break; 123 | 124 | // Otherwise navigate to view it 125 | rootFrame.Navigate(typeof(ImagePage), imageUrl); 126 | break; 127 | 128 | 129 | // Open the conversation 130 | case "viewConversation": 131 | 132 | // The conversation ID retrieved from the toast args 133 | int conversationId = int.Parse(args["conversationId"]); 134 | 135 | // If we're already viewing that conversation, do nothing 136 | if (rootFrame.Content is ConversationPage && (rootFrame.Content as ConversationPage).ConversationId == conversationId) 137 | break; 138 | 139 | // Otherwise navigate to view it 140 | rootFrame.Navigate(typeof(ConversationPage), conversationId); 141 | break; 142 | 143 | 144 | default: 145 | throw new NotImplementedException(); 146 | } 147 | 148 | // If we're loading the app for the first time, place the main page on the back stack 149 | // so that user can go back after they've been navigated to the specific page 150 | if (rootFrame.BackStack.Count == 0) 151 | rootFrame.BackStack.Add(new PageStackEntry(typeof(MainPage), null, null)); 152 | } 153 | } 154 | 155 | // Handle launch activation 156 | else if (e is LaunchActivatedEventArgs) 157 | { 158 | var launchActivationArgs = e as LaunchActivatedEventArgs; 159 | 160 | // If launched with arguments (not a normal primary tile/applist launch) 161 | if (launchActivationArgs.Arguments.Length > 0) 162 | { 163 | // TODO: Handle arguments for cases like launching from secondary Tile, so we navigate to the correct page 164 | throw new NotImplementedException(); 165 | } 166 | 167 | // Otherwise if launched normally 168 | else 169 | { 170 | // If we're currently not on a page, navigate to the main page 171 | if (rootFrame.Content == null) 172 | rootFrame.Navigate(typeof(MainPage)); 173 | } 174 | } 175 | 176 | else 177 | { 178 | // TODO: Handle other types of activation 179 | throw new NotImplementedException(); 180 | } 181 | 182 | 183 | // Ensure the current window is active 184 | Window.Current.Activate(); 185 | } 186 | 187 | private bool _isInitialized = false; 188 | private async Task InitializeApp() 189 | { 190 | if (_isInitialized) 191 | return; 192 | 193 | await SaveProfilePicToAppData(); 194 | 195 | RegisterBackgroundTask(); 196 | 197 | _isInitialized = true; 198 | } 199 | 200 | private void RegisterBackgroundTask() 201 | { 202 | const string taskName = "ToastBackgroundTask"; 203 | 204 | // If background task is already registered, do nothing 205 | if (BackgroundTaskRegistration.AllTasks.Any(i => i.Value.Name.Equals(taskName))) 206 | return; 207 | 208 | // Otherwise create the background task 209 | var builder = new BackgroundTaskBuilder() 210 | { 211 | Name = taskName, 212 | TaskEntryPoint = typeof(ToastNotificationBackgroundTask).FullName 213 | }; 214 | 215 | // And set the toast action trigger 216 | builder.SetTrigger(new ToastNotificationActionTrigger()); 217 | 218 | // And register the task 219 | builder.Register(); 220 | } 221 | 222 | private async Task SaveProfilePicToAppData() 223 | { 224 | // Realistically, this would probably come from the internet and then get cached in the app 225 | StorageFile profilePic = await StorageFile.GetFileFromApplicationUriAsync(new System.Uri("ms-appx:///Assets/Andrew.jpg")); 226 | 227 | // And now cache their profile pic in the app 228 | await profilePic.CopyAsync(ApplicationData.Current.LocalFolder, "Andrew.jpg", NameCollisionOption.ReplaceExisting); 229 | } 230 | 231 | 232 | 233 | /// 234 | /// Invoked when Navigation to a certain page fails 235 | /// 236 | /// The Frame which failed navigation 237 | /// Details about the navigation failure 238 | void OnNavigationFailed(object sender, NavigationFailedEventArgs e) 239 | { 240 | throw new Exception("Failed to load Page " + e.SourcePageType.FullName); 241 | } 242 | 243 | /// 244 | /// Invoked when application execution is being suspended. Application state is saved 245 | /// without knowing whether the application will be terminated or resumed with the contents 246 | /// of memory still intact. 247 | /// 248 | /// The source of the suspend request. 249 | /// Details about the suspend request. 250 | private void OnSuspending(object sender, SuspendingEventArgs e) 251 | { 252 | var deferral = e.SuspendingOperation.GetDeferral(); 253 | //TODO: Save application state and stop any background activity 254 | deferral.Complete(); 255 | } 256 | } 257 | } 258 | -------------------------------------------------------------------------------- /Quickstart-Sending-Local-Toast/Assets/Andrew.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WindowsNotifications/quickstart-sending-local-toast-win10/055c9d046e5cfb874e850746ff746172d7bbbb2c/Quickstart-Sending-Local-Toast/Assets/Andrew.jpg -------------------------------------------------------------------------------- /Quickstart-Sending-Local-Toast/Assets/Comment.metrop: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Quickstart-Sending-Local-Toast/Assets/LockScreenLogo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WindowsNotifications/quickstart-sending-local-toast-win10/055c9d046e5cfb874e850746ff746172d7bbbb2c/Quickstart-Sending-Local-Toast/Assets/LockScreenLogo.scale-200.png -------------------------------------------------------------------------------- /Quickstart-Sending-Local-Toast/Assets/Reply.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WindowsNotifications/quickstart-sending-local-toast-win10/055c9d046e5cfb874e850746ff746172d7bbbb2c/Quickstart-Sending-Local-Toast/Assets/Reply.png -------------------------------------------------------------------------------- /Quickstart-Sending-Local-Toast/Assets/SplashScreen.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WindowsNotifications/quickstart-sending-local-toast-win10/055c9d046e5cfb874e850746ff746172d7bbbb2c/Quickstart-Sending-Local-Toast/Assets/SplashScreen.scale-200.png -------------------------------------------------------------------------------- /Quickstart-Sending-Local-Toast/Assets/Square150x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WindowsNotifications/quickstart-sending-local-toast-win10/055c9d046e5cfb874e850746ff746172d7bbbb2c/Quickstart-Sending-Local-Toast/Assets/Square150x150Logo.scale-200.png -------------------------------------------------------------------------------- /Quickstart-Sending-Local-Toast/Assets/Square44x44Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WindowsNotifications/quickstart-sending-local-toast-win10/055c9d046e5cfb874e850746ff746172d7bbbb2c/Quickstart-Sending-Local-Toast/Assets/Square44x44Logo.scale-200.png -------------------------------------------------------------------------------- /Quickstart-Sending-Local-Toast/Assets/StoreLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WindowsNotifications/quickstart-sending-local-toast-win10/055c9d046e5cfb874e850746ff746172d7bbbb2c/Quickstart-Sending-Local-Toast/Assets/StoreLogo.png -------------------------------------------------------------------------------- /Quickstart-Sending-Local-Toast/Assets/Wide310x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WindowsNotifications/quickstart-sending-local-toast-win10/055c9d046e5cfb874e850746ff746172d7bbbb2c/Quickstart-Sending-Local-Toast/Assets/Wide310x150Logo.scale-200.png -------------------------------------------------------------------------------- /Quickstart-Sending-Local-Toast/BackButtonPage.cs: -------------------------------------------------------------------------------- 1 | using Windows.UI.Core; 2 | using Windows.UI.Xaml.Controls; 3 | using Windows.UI.Xaml.Navigation; 4 | 5 | namespace Quickstart_Sending_Local_Toast 6 | { 7 | public class BackButtonPage : Page 8 | { 9 | protected override void OnNavigatedTo(NavigationEventArgs e) 10 | { 11 | this.BackButtonVisibility = AppViewBackButtonVisibility.Visible; 12 | 13 | SystemNavigationManager.GetForCurrentView().BackRequested += BackButtonPage_BackRequested; 14 | 15 | base.OnNavigatedTo(e); 16 | } 17 | 18 | protected override void OnNavigatedFrom(NavigationEventArgs e) 19 | { 20 | this.BackButtonVisibility = AppViewBackButtonVisibility.Collapsed; 21 | 22 | base.OnNavigatedFrom(e); 23 | 24 | SystemNavigationManager.GetForCurrentView().BackRequested -= BackButtonPage_BackRequested; 25 | } 26 | 27 | private void BackButtonPage_BackRequested(object sender, BackRequestedEventArgs e) 28 | { 29 | OnBackRequested(sender, e); 30 | } 31 | 32 | protected virtual void OnBackRequested(object sender, BackRequestedEventArgs e) 33 | { 34 | if (base.Frame.CanGoBack) 35 | { 36 | e.Handled = true; 37 | base.Frame.GoBack(); 38 | } 39 | } 40 | 41 | public AppViewBackButtonVisibility BackButtonVisibility 42 | { 43 | get { return SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility; } 44 | set { SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = value; } 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Quickstart-Sending-Local-Toast/ClassLibrary/ClassLibrary.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 12.0 6 | Debug 7 | AnyCPU 8 | {333D64C8-1467-4FA5-A25E-ACCB5336A2D7} 9 | Library 10 | Properties 11 | ClassLibrary 12 | ClassLibrary 13 | en-US 14 | 512 15 | {BC8A1FFA-BEE3-4634-8014-F334798102B3};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 16 | Windows 17 | 8.1 18 | 19 | 20 | true 21 | full 22 | false 23 | bin\Debug\ 24 | DEBUG;TRACE;NETFX_CORE;WINDOWS_APP 25 | prompt 26 | 4 27 | 28 | 29 | pdbonly 30 | true 31 | bin\Release\ 32 | TRACE;NETFX_CORE;WINDOWS_APP 33 | prompt 34 | 4 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 51 | -------------------------------------------------------------------------------- /Quickstart-Sending-Local-Toast/ClassLibrary/MyArguments.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using System.Net; 4 | using System.Runtime.Serialization; 5 | using Windows.Foundation; 6 | 7 | namespace ClassLibrary 8 | { 9 | [DataContract] 10 | public class MyArguments : Dictionary 11 | { 12 | public string SerializeToString() 13 | { 14 | return string.Join("&", this.Select(pair => UrlEncode(pair.Key) + "=" + UrlEncode(pair.Value))); 15 | } 16 | 17 | private static string UrlEncode(string str) 18 | { 19 | return WebUtility.UrlEncode(str); 20 | 21 | // Alternatively, Uri.EscapeDataString(str).Replace("%20", "+") can be used if WebUtility isn't available 22 | } 23 | 24 | public static MyArguments Deserialize(string args) 25 | { 26 | var decoder = new WwwFormUrlDecoder(args); 27 | 28 | MyArguments answer = new MyArguments(); 29 | 30 | foreach (var pair in decoder) 31 | { 32 | answer[pair.Name] = pair.Value; 33 | } 34 | 35 | return answer; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Quickstart-Sending-Local-Toast/ClassLibrary/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Resources; 2 | using System.Reflection; 3 | using System.Runtime.CompilerServices; 4 | using System.Runtime.InteropServices; 5 | 6 | // General Information about an assembly is controlled through the following 7 | // set of attributes. Change these attribute values to modify the information 8 | // associated with an assembly. 9 | [assembly: AssemblyTitle("ClassLibrary")] 10 | [assembly: AssemblyDescription("")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyCompany("")] 13 | [assembly: AssemblyProduct("ClassLibrary")] 14 | [assembly: AssemblyCopyright("Copyright © 2015")] 15 | [assembly: AssemblyTrademark("")] 16 | [assembly: AssemblyCulture("")] 17 | [assembly: NeutralResourcesLanguage("en")] 18 | 19 | // Version information for an assembly consists of the following four values: 20 | // 21 | // Major Version 22 | // Minor Version 23 | // Build Number 24 | // Revision 25 | // 26 | // You can specify all the values or you can default the Build and Revision Numbers 27 | // by using the '*' as shown below: 28 | // [assembly: AssemblyVersion("1.0.*")] 29 | [assembly: AssemblyVersion("1.0.0.0")] 30 | [assembly: AssemblyFileVersion("1.0.0.0")] 31 | -------------------------------------------------------------------------------- /Quickstart-Sending-Local-Toast/ConversationPage.xaml: -------------------------------------------------------------------------------- 1 |  10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 | In a real app, this would load the actual conversation. 21 | 22 | 23 | Conversation ID: 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /Quickstart-Sending-Local-Toast/ConversationPage.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Runtime.InteropServices.WindowsRuntime; 6 | using Windows.Foundation; 7 | using Windows.Foundation.Collections; 8 | using Windows.UI.Xaml; 9 | using Windows.UI.Xaml.Controls; 10 | using Windows.UI.Xaml.Controls.Primitives; 11 | using Windows.UI.Xaml.Data; 12 | using Windows.UI.Xaml.Input; 13 | using Windows.UI.Xaml.Media; 14 | using Windows.UI.Xaml.Navigation; 15 | 16 | // The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238 17 | 18 | namespace Quickstart_Sending_Local_Toast 19 | { 20 | /// 21 | /// An empty page that can be used on its own or navigated to within a Frame. 22 | /// 23 | public sealed partial class ConversationPage : BackButtonPage 24 | { 25 | public ConversationPage() 26 | { 27 | this.InitializeComponent(); 28 | } 29 | 30 | public static readonly DependencyProperty ConversationIdProperty = DependencyProperty.Register("ConversationId", typeof(int), typeof(ConversationPage), null); 31 | 32 | public int ConversationId 33 | { 34 | get { return (int)GetValue(ConversationIdProperty); } 35 | private set { SetValue(ConversationIdProperty, value); } 36 | } 37 | 38 | protected override void OnNavigatedTo(NavigationEventArgs e) 39 | { 40 | base.OnNavigatedTo(e); 41 | 42 | // Get the conversation ID 43 | ConversationId = (int)e.Parameter; 44 | 45 | // TODO: A real app would load the conversation and display it 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Quickstart-Sending-Local-Toast/ImagePage.xaml: -------------------------------------------------------------------------------- 1 |  10 | 11 | 12 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Quickstart-Sending-Local-Toast/ImagePage.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Runtime.InteropServices.WindowsRuntime; 6 | using Windows.Foundation; 7 | using Windows.Foundation.Collections; 8 | using Windows.UI.Xaml; 9 | using Windows.UI.Xaml.Controls; 10 | using Windows.UI.Xaml.Controls.Primitives; 11 | using Windows.UI.Xaml.Data; 12 | using Windows.UI.Xaml.Input; 13 | using Windows.UI.Xaml.Media; 14 | using Windows.UI.Xaml.Navigation; 15 | 16 | // The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238 17 | 18 | namespace Quickstart_Sending_Local_Toast 19 | { 20 | /// 21 | /// An empty page that can be used on its own or navigated to within a Frame. 22 | /// 23 | public sealed partial class ImagePage : BackButtonPage 24 | { 25 | public ImagePage() 26 | { 27 | this.InitializeComponent(); 28 | } 29 | 30 | public static readonly DependencyProperty ImageProperty = DependencyProperty.Register("Image", typeof(string), typeof(ImagePage), null); 31 | 32 | public string ImageUrl 33 | { 34 | get { return GetValue(ImageProperty) as string; } 35 | set { SetValue(ImageProperty, value); } 36 | } 37 | 38 | protected override void OnNavigatedTo(NavigationEventArgs e) 39 | { 40 | base.OnNavigatedTo(e); 41 | 42 | // The parameter passed is an image URL that should be displayed 43 | ImageUrl = (string)e.Parameter; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Quickstart-Sending-Local-Toast/MainPage.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 11 | 12 | 13 | 14 | 18 | 19 | 20 | 21 | This app illustrates how to send local toast notifications from your app's code. 22 | 23 | 24 | This app also illustrates how to handle activations from toasts (the user clicking on the toast). The app features both foreground and background activation, and activation from toast buttons in addition to the toast body. 25 | 26 | 27 |