├── .gitignore ├── C#5 async and ASP.NET - Slides.pptx ├── ChatAndVote ├── AsyncCtpLibrary.dll ├── ChatAndVote.sln ├── ChatAndVote │ ├── ChatAndVote.csproj │ ├── Content │ │ └── Site.css │ ├── Controllers │ │ ├── ChatController.cs │ │ └── VotingController.cs │ ├── Global.asax │ ├── Global.asax.cs │ ├── Models │ │ └── Question.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Scripts │ │ ├── MicrosoftAjax.debug.js │ │ ├── MicrosoftAjax.js │ │ ├── MicrosoftMvcAjax.debug.js │ │ ├── MicrosoftMvcAjax.js │ │ ├── MicrosoftMvcValidation.debug.js │ │ ├── MicrosoftMvcValidation.js │ │ ├── jquery-1.5.1-vsdoc.js │ │ ├── jquery-1.5.1.js │ │ ├── jquery-1.5.1.min.js │ │ ├── jquery.unobtrusive-ajax.js │ │ ├── jquery.unobtrusive-ajax.min.js │ │ ├── jquery.validate-vsdoc.js │ │ ├── jquery.validate.js │ │ ├── jquery.validate.min.js │ │ ├── jquery.validate.unobtrusive.js │ │ ├── jquery.validate.unobtrusive.min.js │ │ ├── knockout.mapping.js │ │ ├── ko-1.3ctp.js │ │ ├── modernizr-1.7.js │ │ └── modernizr-1.7.min.js │ ├── Views │ │ ├── Chat │ │ │ └── Index.cshtml │ │ ├── Home │ │ │ ├── About.cshtml │ │ │ └── Index.cshtml │ │ ├── Shared │ │ │ ├── Error.cshtml │ │ │ ├── _Layout.cshtml │ │ │ └── _LogOnPartial.cshtml │ │ ├── Voting │ │ │ └── Index.cshtml │ │ ├── Web.config │ │ └── _ViewStart.cshtml │ ├── Web.Debug.config │ ├── Web.Release.config │ ├── Web.config │ └── packages.config └── packages │ ├── EntityFramework.4.1.10331.0 │ ├── EntityFramework.4.1.10331.0.nupkg │ └── lib │ │ ├── EntityFramework.dll │ │ └── EntityFramework.xml │ ├── Modernizr.1.7 │ ├── Content │ │ └── Scripts │ │ │ ├── modernizr-1.7.js │ │ │ └── modernizr-1.7.min.js │ └── Modernizr.1.7.nupkg │ ├── SignalR.0.1 │ ├── SignalR.0.1.nupkg │ └── lib │ │ └── net40 │ │ └── SignalR.dll │ ├── jQuery.1.5.1 │ ├── Content │ │ └── Scripts │ │ │ ├── jquery-1.5.1.js │ │ │ └── jquery-1.5.1.min.js │ └── jQuery.1.5.1.nupkg │ ├── jQuery.Validation.1.8.0 │ ├── Content │ │ └── Scripts │ │ │ ├── jquery.validate-vsdoc.js │ │ │ ├── jquery.validate.js │ │ │ └── jquery.validate.min.js │ └── jQuery.Validation.1.8.0.nupkg │ ├── jQuery.vsdoc.1.5.1 │ ├── Content │ │ └── Scripts │ │ │ └── jquery-1.5.1-vsdoc.js │ └── jQuery.vsdoc.1.5.1.nupkg │ └── repositories.config ├── MvcAsyncDemo ├── FlightInfoWebService │ ├── Controllers │ │ └── FlightDataController.cs │ ├── FlightInfoWebService.csproj │ ├── FlightInfoWebService.csproj.orig │ ├── Global.asax │ ├── Global.asax.cs │ ├── Models │ │ └── Flight.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── SignalR.dll │ ├── Web.Debug.config │ ├── Web.Release.config │ ├── Web.config │ ├── packages.config │ └── packages.config.orig ├── MvcAsyncDemo.sln ├── MvcAsyncDemo │ ├── AsyncCtpLibrary.dll │ ├── AsyncCtpLibrary.xml │ ├── Content │ │ └── Site.css │ ├── Controllers │ │ └── CheapFlightsController.cs │ ├── Global.asax │ ├── Global.asax.cs │ ├── Models │ │ └── Flight.cs │ ├── MvcAsyncDemo.csproj │ ├── MvcAsyncDemo.csproj.orig │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Scripts │ │ ├── MicrosoftAjax.debug.js │ │ ├── MicrosoftAjax.js │ │ ├── MicrosoftMvcAjax.debug.js │ │ ├── MicrosoftMvcAjax.js │ │ ├── MicrosoftMvcValidation.debug.js │ │ ├── MicrosoftMvcValidation.js │ │ ├── jquery-1.5.1-vsdoc.js │ │ ├── jquery-1.5.1.js │ │ ├── jquery-1.5.1.min.js │ │ ├── jquery.unobtrusive-ajax.js │ │ ├── jquery.unobtrusive-ajax.min.js │ │ ├── jquery.validate-vsdoc.js │ │ ├── jquery.validate.js │ │ ├── jquery.validate.min.js │ │ ├── jquery.validate.unobtrusive.js │ │ ├── jquery.validate.unobtrusive.min.js │ │ ├── modernizr-1.7.js │ │ └── modernizr-1.7.min.js │ ├── Views │ │ ├── Shared │ │ │ ├── Error.cshtml │ │ │ ├── FlightList.cshtml │ │ │ └── _Layout.cshtml │ │ ├── Web.config │ │ └── _ViewStart.cshtml │ ├── Web.Debug.config │ ├── Web.Release.config │ ├── Web.config │ ├── packages.config │ └── packages.config.orig └── packages │ ├── EntityFramework.4.1.10331.0 │ ├── EntityFramework.4.1.10331.0.nupkg │ └── lib │ │ ├── EntityFramework.dll │ │ └── EntityFramework.xml │ ├── Modernizr.1.7 │ ├── Content │ │ └── Scripts │ │ │ ├── modernizr-1.7.js │ │ │ └── modernizr-1.7.min.js │ └── Modernizr.1.7.nupkg │ ├── SignalR.0.1 │ ├── SignalR.0.1.nupkg │ └── lib │ │ └── net40 │ │ └── SignalR.dll │ ├── jQuery.1.5.1 │ ├── Content │ │ └── Scripts │ │ │ ├── jquery-1.5.1.js │ │ │ └── jquery-1.5.1.min.js │ └── jQuery.1.5.1.nupkg │ ├── jQuery.UI.Combined.1.8.11 │ ├── Content │ │ ├── Content │ │ │ └── themes │ │ │ │ └── base │ │ │ │ ├── images │ │ │ │ ├── ui-bg_flat_0_aaaaaa_40x100.png │ │ │ │ ├── ui-bg_flat_75_ffffff_40x100.png │ │ │ │ ├── ui-bg_glass_55_fbf9ee_1x400.png │ │ │ │ ├── ui-bg_glass_65_ffffff_1x400.png │ │ │ │ ├── ui-bg_glass_75_dadada_1x400.png │ │ │ │ ├── ui-bg_glass_75_e6e6e6_1x400.png │ │ │ │ ├── ui-bg_glass_95_fef1ec_1x400.png │ │ │ │ ├── ui-bg_highlight-soft_75_cccccc_1x100.png │ │ │ │ ├── ui-icons_222222_256x240.png │ │ │ │ ├── ui-icons_2e83ff_256x240.png │ │ │ │ ├── ui-icons_454545_256x240.png │ │ │ │ ├── ui-icons_888888_256x240.png │ │ │ │ └── ui-icons_cd0a0a_256x240.png │ │ │ │ ├── jquery.ui.accordion.css │ │ │ │ ├── jquery.ui.all.css │ │ │ │ ├── jquery.ui.autocomplete.css │ │ │ │ ├── jquery.ui.base.css │ │ │ │ ├── jquery.ui.button.css │ │ │ │ ├── jquery.ui.core.css │ │ │ │ ├── jquery.ui.datepicker.css │ │ │ │ ├── jquery.ui.dialog.css │ │ │ │ ├── jquery.ui.progressbar.css │ │ │ │ ├── jquery.ui.resizable.css │ │ │ │ ├── jquery.ui.selectable.css │ │ │ │ ├── jquery.ui.slider.css │ │ │ │ ├── jquery.ui.tabs.css │ │ │ │ └── jquery.ui.theme.css │ │ └── Scripts │ │ │ ├── jquery-ui-1.8.11.js │ │ │ └── jquery-ui-1.8.11.min.js │ └── jQuery.UI.Combined.1.8.11.nupkg │ ├── jQuery.Validation.1.8.0 │ ├── Content │ │ └── Scripts │ │ │ ├── jquery.validate-vsdoc.js │ │ │ ├── jquery.validate.js │ │ │ └── jquery.validate.min.js │ └── jQuery.Validation.1.8.0.nupkg │ ├── jQuery.vsdoc.1.5.1 │ ├── Content │ │ └── Scripts │ │ │ └── jquery-1.5.1-vsdoc.js │ └── jQuery.vsdoc.1.5.1.nupkg │ └── repositories.config ├── README.md └── TapExamples ├── AsyncCtpLibrary.dll ├── FakeWebServices ├── Controllers │ └── FakeWebServiceController.cs ├── FakeWebServices.csproj ├── Global.asax ├── Global.asax.cs ├── Properties │ └── AssemblyInfo.cs ├── Web.Debug.config ├── Web.Release.config ├── Web.config └── packages.config ├── TapExamples.sln ├── TapExamples ├── Content │ └── Site.css ├── Controllers │ └── HomeController.cs ├── Global.asax ├── Global.asax.cs ├── Models │ └── NewsSource.cs ├── Properties │ └── AssemblyInfo.cs ├── Scripts │ ├── MicrosoftAjax.debug.js │ ├── MicrosoftAjax.js │ ├── MicrosoftMvcAjax.debug.js │ ├── MicrosoftMvcAjax.js │ ├── MicrosoftMvcValidation.debug.js │ ├── MicrosoftMvcValidation.js │ ├── jquery-1.5.1-vsdoc.js │ ├── jquery-1.5.1.js │ ├── jquery-1.5.1.min.js │ ├── jquery.unobtrusive-ajax.js │ ├── jquery.unobtrusive-ajax.min.js │ ├── jquery.validate-vsdoc.js │ ├── jquery.validate.js │ ├── jquery.validate.min.js │ ├── jquery.validate.unobtrusive.js │ ├── jquery.validate.unobtrusive.min.js │ ├── modernizr-1.7.js │ └── modernizr-1.7.min.js ├── TapExamples.csproj ├── Views │ ├── Home │ │ └── Results.cshtml │ ├── Shared │ │ ├── Error.cshtml │ │ ├── _Layout.cshtml │ │ └── _LogOnPartial.cshtml │ ├── Web.config │ └── _ViewStart.cshtml ├── Web.Debug.config ├── Web.Release.config ├── Web.config └── packages.config └── packages ├── EntityFramework.4.1.10331.0 ├── EntityFramework.4.1.10331.0.nupkg └── lib │ ├── EntityFramework.dll │ └── EntityFramework.xml ├── Modernizr.1.7 ├── Content │ └── Scripts │ │ ├── modernizr-1.7.js │ │ └── modernizr-1.7.min.js └── Modernizr.1.7.nupkg ├── SignalR.0.1 ├── SignalR.0.1.nupkg └── lib │ └── net40 │ └── SignalR.dll ├── jQuery.1.5.1 ├── Content │ └── Scripts │ │ ├── jquery-1.5.1.js │ │ └── jquery-1.5.1.min.js └── jQuery.1.5.1.nupkg ├── jQuery.Validation.1.8.0 ├── Content │ └── Scripts │ │ ├── jquery.validate-vsdoc.js │ │ ├── jquery.validate.js │ │ └── jquery.validate.min.js └── jQuery.Validation.1.8.0.nupkg ├── jQuery.vsdoc.1.5.1 ├── Content │ └── Scripts │ │ └── jquery-1.5.1-vsdoc.js └── jQuery.vsdoc.1.5.1.nupkg └── repositories.config /.gitignore: -------------------------------------------------------------------------------- 1 | *.suo 2 | *.csproj.user 3 | bin 4 | obj 5 | *.pdb 6 | _ReSharper* 7 | *.ReSharper.user 8 | *.ReSharper 9 | desktop.ini 10 | .eprj 11 | -------------------------------------------------------------------------------- /C#5 async and ASP.NET - Slides.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SteveSanderson/ASP.NET-MVC-async-demos/e8ee086737919b9d94d63ac6dc92ef94ab1fb818/C#5 async and ASP.NET - Slides.pptx -------------------------------------------------------------------------------- /ChatAndVote/AsyncCtpLibrary.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SteveSanderson/ASP.NET-MVC-async-demos/e8ee086737919b9d94d63ac6dc92ef94ab1fb818/ChatAndVote/AsyncCtpLibrary.dll -------------------------------------------------------------------------------- /ChatAndVote/ChatAndVote.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChatAndVote", "ChatAndVote\ChatAndVote.csproj", "{C7622DC5-F898-4825-918B-A6F3B6906A35}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Any CPU = Debug|Any CPU 9 | Release|Any CPU = Release|Any CPU 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {C7622DC5-F898-4825-918B-A6F3B6906A35}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 13 | {C7622DC5-F898-4825-918B-A6F3B6906A35}.Debug|Any CPU.Build.0 = Debug|Any CPU 14 | {C7622DC5-F898-4825-918B-A6F3B6906A35}.Release|Any CPU.ActiveCfg = Release|Any CPU 15 | {C7622DC5-F898-4825-918B-A6F3B6906A35}.Release|Any CPU.Build.0 = Release|Any CPU 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /ChatAndVote/ChatAndVote/Content/Site.css: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------- 2 | The base color for this template is #5c87b2. If you'd like 3 | to use a different color start by replacing all instances of 4 | #5c87b2 with your new color. 5 | ----------------------------------------------------------*/ 6 | body { 7 | background-color: #5c87b2; 8 | font-size: .85em; 9 | font-family: "Trebuchet MS", Verdana, Helvetica, Sans-Serif; 10 | margin: 0; 11 | padding: 0; 12 | color: #696969; 13 | } 14 | 15 | a:link { 16 | color: #034af3; 17 | text-decoration: underline; 18 | } 19 | 20 | a:visited { 21 | color: #505abc; 22 | } 23 | 24 | a:hover { 25 | color: #1d60ff; 26 | text-decoration: none; 27 | } 28 | 29 | a:active { 30 | color: #12eb87; 31 | } 32 | 33 | p, ul { 34 | margin-bottom: 20px; 35 | line-height: 1.6em; 36 | } 37 | 38 | header, 39 | footer, 40 | nav, 41 | section { 42 | display: block; 43 | } 44 | 45 | /* HEADINGS 46 | ----------------------------------------------------------*/ 47 | h1, h2, h3, h4, h5, h6 { 48 | font-size: 1.5em; 49 | color: #000; 50 | } 51 | 52 | h1 { 53 | font-size: 2em; 54 | padding-bottom: 0; 55 | margin-bottom: 0; 56 | } 57 | 58 | h2 { 59 | padding: 0 0 10px 0; 60 | } 61 | 62 | h3 { 63 | font-size: 1.2em; 64 | } 65 | 66 | h4 { 67 | font-size: 1.1em; 68 | } 69 | 70 | h5, h6 { 71 | font-size: 1em; 72 | } 73 | 74 | /* PRIMARY LAYOUT ELEMENTS 75 | ----------------------------------------------------------*/ 76 | 77 | /* you can specify a greater or lesser percentage for the 78 | page width. Or, you can specify an exact pixel width. */ 79 | .page { 80 | width: 90%; 81 | margin-left: auto; 82 | margin-right: auto; 83 | } 84 | 85 | header, #header { 86 | position: relative; 87 | margin-bottom: 0px; 88 | color: #000; 89 | padding: 0; 90 | } 91 | 92 | header h1, #header h1 { 93 | font-weight: bold; 94 | padding: 5px 0; 95 | margin: 0; 96 | color: #fff; 97 | border: none; 98 | line-height: 2em; 99 | font-size: 32px !important; 100 | text-shadow: 1px 1px 2px #111; 101 | } 102 | 103 | #main { 104 | padding: 30px 30px 15px 30px; 105 | background-color: #fff; 106 | border-radius: 4px 0 0 0; 107 | -webkit-border-radius: 4px 0 0 0; 108 | -moz-border-radius: 4px 0 0 0; 109 | } 110 | 111 | footer, 112 | #footer { 113 | background-color: #fff; 114 | color: #999; 115 | padding: 10px 0; 116 | text-align: center; 117 | line-height: normal; 118 | margin: 0 0 30px 0; 119 | font-size: .9em; 120 | border-radius: 0 0 4px 4px; 121 | -webkit-border-radius: 0 0 4px 4px; 122 | -moz-border-radius: 0 0 4px 4px; 123 | } 124 | 125 | /* TAB MENU 126 | ----------------------------------------------------------*/ 127 | ul#menu { 128 | border-bottom: 1px #5C87B2 solid; 129 | padding: 0 0 2px; 130 | position: relative; 131 | margin: 0; 132 | text-align: right; 133 | } 134 | 135 | ul#menu li { 136 | display: inline; 137 | list-style: none; 138 | } 139 | 140 | ul#menu li#greeting { 141 | padding: 10px 20px; 142 | font-weight: bold; 143 | text-decoration: none; 144 | line-height: 2.8em; 145 | color: #fff; 146 | } 147 | 148 | ul#menu li a { 149 | padding: 10px 20px; 150 | font-weight: bold; 151 | text-decoration: none; 152 | line-height: 2.8em; 153 | background-color: #e8eef4; 154 | color: #034af3; 155 | border-radius: 4px 4px 0 0; 156 | -webkit-border-radius: 4px 4px 0 0; 157 | -moz-border-radius: 4px 4px 0 0; 158 | } 159 | 160 | ul#menu li a:hover { 161 | background-color: #fff; 162 | text-decoration: none; 163 | } 164 | 165 | ul#menu li a:active { 166 | background-color: #a6e2a6; 167 | text-decoration: none; 168 | } 169 | 170 | ul#menu li.selected a { 171 | background-color: #fff; 172 | color: #000; 173 | } 174 | 175 | /* FORM LAYOUT ELEMENTS 176 | ----------------------------------------------------------*/ 177 | 178 | fieldset { 179 | border: 1px solid #ddd; 180 | padding: 0 1.4em 1.4em 1.4em; 181 | margin: 0 0 1.5em 0; 182 | } 183 | 184 | legend { 185 | font-size: 1.2em; 186 | font-weight: bold; 187 | } 188 | 189 | textarea { 190 | min-height: 75px; 191 | } 192 | 193 | input[type="text"], 194 | input[type="password"] { 195 | border: 1px solid #ccc; 196 | padding: 2px; 197 | font-size: 1.2em; 198 | color: #444; 199 | width: 200px; 200 | } 201 | 202 | select { 203 | border: 1px solid #ccc; 204 | padding: 2px; 205 | font-size: 1.2em; 206 | color: #444; 207 | } 208 | 209 | input[type="submit"] { 210 | font-size: 1.2em; 211 | padding: 5px; 212 | } 213 | 214 | /* TABLE 215 | ----------------------------------------------------------*/ 216 | 217 | table { 218 | border: solid 1px #e8eef4; 219 | border-collapse: collapse; 220 | } 221 | 222 | table td { 223 | padding: 5px; 224 | border: solid 1px #e8eef4; 225 | } 226 | 227 | table th { 228 | padding: 6px 5px; 229 | text-align: left; 230 | background-color: #e8eef4; 231 | border: solid 1px #e8eef4; 232 | } 233 | 234 | /* MISC 235 | ----------------------------------------------------------*/ 236 | .clear { 237 | clear: both; 238 | } 239 | 240 | .error { 241 | color: Red; 242 | } 243 | 244 | nav, 245 | #menucontainer { 246 | margin-top: 40px; 247 | } 248 | 249 | div#title { 250 | display: block; 251 | float: left; 252 | text-align: left; 253 | } 254 | 255 | #logindisplay { 256 | font-size: 1.1em; 257 | display: block; 258 | text-align: right; 259 | margin: 10px; 260 | color: White; 261 | } 262 | 263 | #logindisplay a:link { 264 | color: white; 265 | text-decoration: underline; 266 | } 267 | 268 | #logindisplay a:visited { 269 | color: white; 270 | text-decoration: underline; 271 | } 272 | 273 | #logindisplay a:hover { 274 | color: white; 275 | text-decoration: none; 276 | } 277 | 278 | /* Styles for validation helpers 279 | -----------------------------------------------------------*/ 280 | .field-validation-error { 281 | color: #ff0000; 282 | } 283 | 284 | .field-validation-valid { 285 | display: none; 286 | } 287 | 288 | .input-validation-error { 289 | border: 1px solid #ff0000; 290 | background-color: #ffeeee; 291 | } 292 | 293 | .validation-summary-errors { 294 | font-weight: bold; 295 | color: #ff0000; 296 | } 297 | 298 | .validation-summary-valid { 299 | display: none; 300 | } 301 | 302 | /* Styles for editor and display helpers 303 | ----------------------------------------------------------*/ 304 | .display-label, 305 | .editor-label { 306 | margin: 1em 0 0 0; 307 | } 308 | 309 | .display-field, 310 | .editor-field { 311 | margin: 0.5em 0 0 0; 312 | } 313 | 314 | .text-box { 315 | width: 30em; 316 | } 317 | 318 | .text-box.multi-line { 319 | height: 6.5em; 320 | } 321 | 322 | .tri-state { 323 | width: 6em; 324 | } 325 | 326 | .answer { display: inline-block; width: 12em; } 327 | .voteBar { display: inline-block; height: 1em; background-color: Green } -------------------------------------------------------------------------------- /ChatAndVote/ChatAndVote/Controllers/ChatController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using SignalR.Web; 7 | using System.Threading.Tasks; 8 | using System.Threading; 9 | 10 | namespace ChatAndVote.Controllers 11 | { 12 | public class ChatController : TaskAsyncController 13 | { 14 | private static TaskCompletionSource nextMessage = new TaskCompletionSource(); 15 | 16 | public ActionResult Index() 17 | { 18 | return View(); 19 | } 20 | 21 | public async Task GetNextMessage() 22 | { 23 | return await nextMessage.Task; 24 | } 25 | 26 | public void PostMessage(string message) 27 | { 28 | nextMessage.SetResult(message); 29 | nextMessage = new TaskCompletionSource(); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /ChatAndVote/ChatAndVote/Controllers/VotingController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using ChatAndVote.Models; 7 | using System.Threading.Tasks; 8 | using SignalR.Web; 9 | 10 | namespace ChatAndVote.Controllers 11 | { 12 | public class VotingController : TaskAsyncController 13 | { 14 | static TaskCompletionSource hasNewVote = new TaskCompletionSource(); 15 | 16 | // Could load this from a DB 17 | static Question question = new Question { 18 | QuestionText = "What's your favourite upcoming technology?", 19 | Answers = new List { 20 | new Answer { AnswerId = 1, AnswerText = "C# 5" }, 21 | new Answer { AnswerId = 2, AnswerText = "WebSockets" }, 22 | new Answer { AnswerId = 3, AnswerText = "Windows 8" }, 23 | new Answer { AnswerId = 5, AnswerText = "Magic rainbow unicorns" }, 24 | } 25 | }; 26 | 27 | public ActionResult Index() 28 | { 29 | return View(question); 30 | } 31 | 32 | public void SubmitVote(int answerId) 33 | { 34 | question.Answers.Single(x => x.AnswerId == answerId).NumVotes++; 35 | hasNewVote.SetResult(true); 36 | hasNewVote = new TaskCompletionSource(); 37 | } 38 | 39 | public async Task GetUpdatedState() { 40 | await hasNewVote.Task; 41 | return Json(question); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /ChatAndVote/ChatAndVote/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Codebehind="Global.asax.cs" Inherits="ChatAndVote.MvcApplication" Language="C#" %> 2 | -------------------------------------------------------------------------------- /ChatAndVote/ChatAndVote/Global.asax.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using System.Web.Routing; 7 | 8 | namespace ChatAndVote 9 | { 10 | // Note: For instructions on enabling IIS6 or IIS7 classic mode, 11 | // visit http://go.microsoft.com/?LinkId=9394801 12 | 13 | public class MvcApplication : System.Web.HttpApplication 14 | { 15 | public static void RegisterGlobalFilters(GlobalFilterCollection filters) 16 | { 17 | filters.Add(new HandleErrorAttribute()); 18 | } 19 | 20 | public static void RegisterRoutes(RouteCollection routes) 21 | { 22 | routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 23 | 24 | routes.MapRoute( 25 | "Default", // Route name 26 | "{controller}/{action}/{id}", // URL with parameters 27 | new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults 28 | ); 29 | 30 | } 31 | 32 | protected void Application_Start() 33 | { 34 | AreaRegistration.RegisterAllAreas(); 35 | 36 | RegisterGlobalFilters(GlobalFilters.Filters); 37 | RegisterRoutes(RouteTable.Routes); 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /ChatAndVote/ChatAndVote/Models/Question.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | 6 | namespace ChatAndVote.Models 7 | { 8 | public class Question 9 | { 10 | public string QuestionText { get; set; } 11 | public ICollection Answers { get; set; } 12 | } 13 | 14 | public class Answer 15 | { 16 | public int AnswerId { get; set; } 17 | public string AnswerText { get; set; } 18 | public int NumVotes { get; set; } 19 | } 20 | } -------------------------------------------------------------------------------- /ChatAndVote/ChatAndVote/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("ChatAndVote")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("ChatAndVote")] 13 | [assembly: AssemblyCopyright("Copyright © 2011")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("0efdf117-7cd0-471e-944b-ef63e6c01fa6")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Revision and Build Numbers 33 | // by using the '*' as shown below: 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /ChatAndVote/ChatAndVote/Scripts/MicrosoftMvcAjax.js: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------- 2 | // Copyright (C) Microsoft Corporation. All rights reserved. 3 | //---------------------------------------------------------- 4 | // MicrosoftMvcAjax.js 5 | 6 | Type.registerNamespace('Sys.Mvc');Sys.Mvc.$create_AjaxOptions=function(){return {};} 7 | Sys.Mvc.InsertionMode=function(){};Sys.Mvc.InsertionMode.prototype = {replace:0,insertBefore:1,insertAfter:2} 8 | Sys.Mvc.InsertionMode.registerEnum('Sys.Mvc.InsertionMode',false);Sys.Mvc.AjaxContext=function(request,updateTarget,loadingElement,insertionMode){this.$3=request;this.$4=updateTarget;this.$1=loadingElement;this.$0=insertionMode;} 9 | Sys.Mvc.AjaxContext.prototype={$0:0,$1:null,$2:null,$3:null,$4:null,get_data:function(){if(this.$2){return this.$2.get_responseData();}else{return null;}},get_insertionMode:function(){return this.$0;},get_loadingElement:function(){return this.$1;},get_object:function(){var $0=this.get_response();return ($0)?$0.get_object():null;},get_response:function(){return this.$2;},set_response:function(value){this.$2=value;return value;},get_request:function(){return this.$3;},get_updateTarget:function(){return this.$4;}} 10 | Sys.Mvc.AsyncHyperlink=function(){} 11 | Sys.Mvc.AsyncHyperlink.handleClick=function(anchor,evt,ajaxOptions){evt.preventDefault();Sys.Mvc.MvcHelpers.$2(anchor.href,'post','',anchor,ajaxOptions);} 12 | Sys.Mvc.MvcHelpers=function(){} 13 | Sys.Mvc.MvcHelpers.$0=function($p0,$p1,$p2){if($p0.disabled){return null;}var $0=$p0.name;if($0){var $1=$p0.tagName.toUpperCase();var $2=encodeURIComponent($0);var $3=$p0;if($1==='INPUT'){var $4=$3.type;if($4==='submit'){return $2+'='+encodeURIComponent($3.value);}else if($4==='image'){return $2+'.x='+$p1+'&'+$2+'.y='+$p2;}}else if(($1==='BUTTON')&&($0.length)&&($3.type==='submit')){return $2+'='+encodeURIComponent($3.value);}}return null;} 14 | Sys.Mvc.MvcHelpers.$1=function($p0){var $0=$p0.elements;var $1=new Sys.StringBuilder();var $2=$0.length;for(var $4=0;$4<$2;$4++){var $5=$0[$4];var $6=$5.name;if(!$6||!$6.length){continue;}var $7=$5.tagName.toUpperCase();if($7==='INPUT'){var $8=$5;var $9=$8.type;if(($9==='text')||($9==='password')||($9==='hidden')||((($9==='checkbox')||($9==='radio'))&&$5.checked)){$1.append(encodeURIComponent($6));$1.append('=');$1.append(encodeURIComponent($8.value));$1.append('&');}}else if($7==='SELECT'){var $A=$5;var $B=$A.options.length;for(var $C=0;$C<$B;$C++){var $D=$A.options[$C];if($D.selected){$1.append(encodeURIComponent($6));$1.append('=');$1.append(encodeURIComponent($D.value));$1.append('&');}}}else if($7==='TEXTAREA'){$1.append(encodeURIComponent($6));$1.append('=');$1.append(encodeURIComponent(($5.value)));$1.append('&');}}var $3=$p0._additionalInput;if($3){$1.append($3);$1.append('&');}return $1.toString();} 15 | Sys.Mvc.MvcHelpers.$2=function($p0,$p1,$p2,$p3,$p4){if($p4.confirm){if(!confirm($p4.confirm)){return;}}if($p4.url){$p0=$p4.url;}if($p4.httpMethod){$p1=$p4.httpMethod;}if($p2.length>0&&!$p2.endsWith('&')){$p2+='&';}$p2+='X-Requested-With=XMLHttpRequest';var $0=$p1.toUpperCase();var $1=($0==='GET'||$0==='POST');if(!$1){$p2+='&';$p2+='X-HTTP-Method-Override='+$0;}var $2='';if($0==='GET'||$0==='DELETE'){if($p0.indexOf('?')>-1){if(!$p0.endsWith('&')){$p0+='&';}$p0+=$p2;}else{$p0+='?';$p0+=$p2;}}else{$2=$p2;}var $3=new Sys.Net.WebRequest();$3.set_url($p0);if($1){$3.set_httpVerb($p1);}else{$3.set_httpVerb('POST');$3.get_headers()['X-HTTP-Method-Override']=$0;}$3.set_body($2);if($p1.toUpperCase()==='PUT'){$3.get_headers()['Content-Type']='application/x-www-form-urlencoded;';}$3.get_headers()['X-Requested-With']='XMLHttpRequest';var $4=null;if($p4.updateTargetId){$4=$get($p4.updateTargetId);}var $5=null;if($p4.loadingElementId){$5=$get($p4.loadingElementId);}var $6=new Sys.Mvc.AjaxContext($3,$4,$5,$p4.insertionMode);var $7=true;if($p4.onBegin){$7=$p4.onBegin($6)!==false;}if($5){Sys.UI.DomElement.setVisible($6.get_loadingElement(),true);}if($7){$3.add_completed(Function.createDelegate(null,function($p1_0){ 16 | Sys.Mvc.MvcHelpers.$3($3,$p4,$6);}));$3.invoke();}} 17 | Sys.Mvc.MvcHelpers.$3=function($p0,$p1,$p2){$p2.set_response($p0.get_executor());if($p1.onComplete&&$p1.onComplete($p2)===false){return;}var $0=$p2.get_response().get_statusCode();if(($0>=200&&$0<300)||$0===304||$0===1223){if($0!==204&&$0!==304&&$0!==1223){var $1=$p2.get_response().getResponseHeader('Content-Type');if(($1)&&($1.indexOf('application/x-javascript')!==-1)){eval($p2.get_data());}else{Sys.Mvc.MvcHelpers.updateDomElement($p2.get_updateTarget(),$p2.get_insertionMode(),$p2.get_data());}}if($p1.onSuccess){$p1.onSuccess($p2);}}else{if($p1.onFailure){$p1.onFailure($p2);}}if($p2.get_loadingElement()){Sys.UI.DomElement.setVisible($p2.get_loadingElement(),false);}} 18 | Sys.Mvc.MvcHelpers.updateDomElement=function(target,insertionMode,content){if(target){switch(insertionMode){case 0:target.innerHTML=content;break;case 1:if(content&&content.length>0){target.innerHTML=content+target.innerHTML.trimStart();}break;case 2:if(content&&content.length>0){target.innerHTML=target.innerHTML.trimEnd()+content;}break;}}} 19 | Sys.Mvc.AsyncForm=function(){} 20 | Sys.Mvc.AsyncForm.handleClick=function(form,evt){var $0=Sys.Mvc.MvcHelpers.$0(evt.target,evt.offsetX,evt.offsetY);form._additionalInput = $0;} 21 | Sys.Mvc.AsyncForm.handleSubmit=function(form,evt,ajaxOptions){evt.preventDefault();var $0=form.validationCallbacks;if($0){for(var $2=0;$2<$0.length;$2++){var $3=$0[$2];if(!$3()){return;}}}var $1=Sys.Mvc.MvcHelpers.$1(form);Sys.Mvc.MvcHelpers.$2(form.action,form.method||'post',$1,form,ajaxOptions);} 22 | Sys.Mvc.AjaxContext.registerClass('Sys.Mvc.AjaxContext');Sys.Mvc.AsyncHyperlink.registerClass('Sys.Mvc.AsyncHyperlink');Sys.Mvc.MvcHelpers.registerClass('Sys.Mvc.MvcHelpers');Sys.Mvc.AsyncForm.registerClass('Sys.Mvc.AsyncForm'); 23 | // ---- Do not remove this footer ---- 24 | // Generated using Script# v0.5.0.0 (http://projects.nikhilk.net) 25 | // ----------------------------------- 26 | -------------------------------------------------------------------------------- /ChatAndVote/ChatAndVote/Scripts/jquery.unobtrusive-ajax.js: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | /*! 4 | ** Unobtrusive Ajax support library for jQuery 5 | ** Copyright (C) Microsoft Corporation. All rights reserved. 6 | */ 7 | 8 | /*jslint white: true, browser: true, onevar: true, undef: true, nomen: true, eqeqeq: true, plusplus: true, bitwise: true, regexp: true, newcap: true, immed: true, strict: false */ 9 | /*global window: false, jQuery: false */ 10 | 11 | (function ($) { 12 | var data_click = "unobtrusiveAjaxClick", 13 | data_validation = "unobtrusiveValidation"; 14 | 15 | function getFunction(code, argNames) { 16 | var fn = window, parts = (code || "").split("."); 17 | while (fn && parts.length) { 18 | fn = fn[parts.shift()]; 19 | } 20 | if (typeof (fn) === "function") { 21 | return fn; 22 | } 23 | argNames.push(code); 24 | return Function.constructor.apply(null, argNames); 25 | } 26 | 27 | function isMethodProxySafe(method) { 28 | return method === "GET" || method === "POST"; 29 | } 30 | 31 | function asyncOnBeforeSend(xhr, method) { 32 | if (!isMethodProxySafe(method)) { 33 | xhr.setRequestHeader("X-HTTP-Method-Override", method); 34 | } 35 | } 36 | 37 | function asyncOnSuccess(element, data, contentType) { 38 | var mode; 39 | 40 | if (contentType.indexOf("application/x-javascript") !== -1) { // jQuery already executes JavaScript for us 41 | return; 42 | } 43 | 44 | mode = (element.getAttribute("data-ajax-mode") || "").toUpperCase(); 45 | $(element.getAttribute("data-ajax-update")).each(function (i, update) { 46 | var top; 47 | 48 | switch (mode) { 49 | case "BEFORE": 50 | top = update.firstChild; 51 | $("
").html(data).contents().each(function () { 52 | update.insertBefore(this, top); 53 | }); 54 | break; 55 | case "AFTER": 56 | $("
").html(data).contents().each(function () { 57 | update.appendChild(this); 58 | }); 59 | break; 60 | default: 61 | $(update).html(data); 62 | break; 63 | } 64 | }); 65 | } 66 | 67 | function asyncRequest(element, options) { 68 | var confirm, loading, method, duration; 69 | 70 | confirm = element.getAttribute("data-ajax-confirm"); 71 | if (confirm && !window.confirm(confirm)) { 72 | return; 73 | } 74 | 75 | loading = $(element.getAttribute("data-ajax-loading")); 76 | duration = element.getAttribute("data-ajax-loading-duration") || 0; 77 | 78 | $.extend(options, { 79 | type: element.getAttribute("data-ajax-method") || undefined, 80 | url: element.getAttribute("data-ajax-url") || undefined, 81 | beforeSend: function (xhr) { 82 | var result; 83 | asyncOnBeforeSend(xhr, method); 84 | result = getFunction(element.getAttribute("data-ajax-begin"), ["xhr"]).apply(this, arguments); 85 | if (result !== false) { 86 | loading.show(duration); 87 | } 88 | return result; 89 | }, 90 | complete: function () { 91 | loading.hide(duration); 92 | getFunction(element.getAttribute("data-ajax-complete"), ["xhr", "status"]).apply(this, arguments); 93 | }, 94 | success: function (data, status, xhr) { 95 | asyncOnSuccess(element, data, xhr.getResponseHeader("Content-Type") || "text/html"); 96 | getFunction(element.getAttribute("data-ajax-success"), ["data", "status", "xhr"]).apply(this, arguments); 97 | }, 98 | error: getFunction(element.getAttribute("data-ajax-failure"), ["xhr", "status", "error"]) 99 | }); 100 | 101 | options.data.push({ name: "X-Requested-With", value: "XMLHttpRequest" }); 102 | 103 | method = options.type.toUpperCase(); 104 | if (!isMethodProxySafe(method)) { 105 | options.type = "POST"; 106 | options.data.push({ name: "X-HTTP-Method-Override", value: method }); 107 | } 108 | 109 | $.ajax(options); 110 | } 111 | 112 | function validate(form) { 113 | var validationInfo = $(form).data(data_validation); 114 | return !validationInfo || !validationInfo.validate || validationInfo.validate(); 115 | } 116 | 117 | $("a[data-ajax=true]").live("click", function (evt) { 118 | evt.preventDefault(); 119 | asyncRequest(this, { 120 | url: this.href, 121 | type: "GET", 122 | data: [] 123 | }); 124 | }); 125 | 126 | $("form[data-ajax=true] input[type=image]").live("click", function (evt) { 127 | var name = evt.target.name, 128 | $target = $(evt.target), 129 | form = $target.parents("form")[0], 130 | offset = $target.offset(); 131 | 132 | $(form).data(data_click, [ 133 | { name: name + ".x", value: Math.round(evt.pageX - offset.left) }, 134 | { name: name + ".y", value: Math.round(evt.pageY - offset.top) } 135 | ]); 136 | 137 | setTimeout(function () { 138 | $(form).removeData(data_click); 139 | }, 0); 140 | }); 141 | 142 | $("form[data-ajax=true] :submit").live("click", function (evt) { 143 | var name = evt.target.name, 144 | form = $(evt.target).parents("form")[0]; 145 | 146 | $(form).data(data_click, name ? [{ name: name, value: evt.target.value }] : []); 147 | 148 | setTimeout(function () { 149 | $(form).removeData(data_click); 150 | }, 0); 151 | }); 152 | 153 | $("form[data-ajax=true]").live("submit", function (evt) { 154 | var clickInfo = $(this).data(data_click) || []; 155 | evt.preventDefault(); 156 | if (!validate(this)) { 157 | return; 158 | } 159 | asyncRequest(this, { 160 | url: this.action, 161 | type: this.method || "GET", 162 | data: clickInfo.concat($(this).serializeArray()) 163 | }); 164 | }); 165 | }(jQuery)); -------------------------------------------------------------------------------- /ChatAndVote/ChatAndVote/Scripts/jquery.unobtrusive-ajax.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | ** Unobtrusive Ajax support library for jQuery 3 | ** Copyright (C) Microsoft Corporation. All rights reserved. 4 | */ 5 | (function(a){var b="unobtrusiveAjaxClick",g="unobtrusiveValidation";function c(d,b){var a=window,c=(d||"").split(".");while(a&&c.length)a=a[c.shift()];if(typeof a==="function")return a;b.push(d);return Function.constructor.apply(null,b)}function d(a){return a==="GET"||a==="POST"}function f(b,a){!d(a)&&b.setRequestHeader("X-HTTP-Method-Override",a)}function h(c,b,e){var d;if(e.indexOf("application/x-javascript")!==-1)return;d=(c.getAttribute("data-ajax-mode")||"").toUpperCase();a(c.getAttribute("data-ajax-update")).each(function(f,c){var e;switch(d){case"BEFORE":e=c.firstChild;a("
").html(b).contents().each(function(){c.insertBefore(this,e)});break;case"AFTER":a("
").html(b).contents().each(function(){c.appendChild(this)});break;default:a(c).html(b)}})}function e(b,e){var j,k,g,i;j=b.getAttribute("data-ajax-confirm");if(j&&!window.confirm(j))return;k=a(b.getAttribute("data-ajax-loading"));i=b.getAttribute("data-ajax-loading-duration")||0;a.extend(e,{type:b.getAttribute("data-ajax-method")||undefined,url:b.getAttribute("data-ajax-url")||undefined,beforeSend:function(d){var a;f(d,g);a=c(b.getAttribute("data-ajax-begin"),["xhr"]).apply(this,arguments);a!==false&&k.show(i);return a},complete:function(){k.hide(i);c(b.getAttribute("data-ajax-complete"),["xhr","status"]).apply(this,arguments)},success:function(a,e,d){h(b,a,d.getResponseHeader("Content-Type")||"text/html");c(b.getAttribute("data-ajax-success"),["data","status","xhr"]).apply(this,arguments)},error:c(b.getAttribute("data-ajax-failure"),["xhr","status","error"])});e.data.push({name:"X-Requested-With",value:"XMLHttpRequest"});g=e.type.toUpperCase();if(!d(g)){e.type="POST";e.data.push({name:"X-HTTP-Method-Override",value:g})}a.ajax(e)}function i(c){var b=a(c).data(g);return!b||!b.validate||b.validate()}a("a[data-ajax=true]").live("click",function(a){a.preventDefault();e(this,{url:this.href,type:"GET",data:[]})});a("form[data-ajax=true] input[type=image]").live("click",function(c){var g=c.target.name,d=a(c.target),f=d.parents("form")[0],e=d.offset();a(f).data(b,[{name:g+".x",value:Math.round(c.pageX-e.left)},{name:g+".y",value:Math.round(c.pageY-e.top)}]);setTimeout(function(){a(f).removeData(b)},0)});a("form[data-ajax=true] :submit").live("click",function(c){var e=c.target.name,d=a(c.target).parents("form")[0];a(d).data(b,e?[{name:e,value:c.target.value}]:[]);setTimeout(function(){a(d).removeData(b)},0)});a("form[data-ajax=true]").live("submit",function(d){var c=a(this).data(b)||[];d.preventDefault();if(!i(this))return;e(this,{url:this.action,type:this.method||"GET",data:c.concat(a(this).serializeArray())})})})(jQuery); -------------------------------------------------------------------------------- /ChatAndVote/ChatAndVote/Scripts/jquery.validate.unobtrusive.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | ** Unobtrusive validation support library for jQuery and jQuery Validate 3 | ** Copyright (C) Microsoft Corporation. All rights reserved. 4 | */ 5 | (function(a){var d=a.validator,b,f="unobtrusiveValidation";function c(a,b,c){a.rules[b]=c;if(a.message)a.messages[b]=a.message}function i(a){return a.replace(/^\s+|\s+$/g,"").split(/\s*,\s*/g)}function g(a){return a.substr(0,a.lastIndexOf(".")+1)}function e(a,b){if(a.indexOf("*.")===0)a=a.replace("*.",b);return a}function l(c,d){var b=a(this).find("[data-valmsg-for='"+d[0].name+"']"),e=a.parseJSON(b.attr("data-valmsg-replace"))!==false;b.removeClass("field-validation-valid").addClass("field-validation-error");c.data("unobtrusiveContainer",b);if(e){b.empty();c.removeClass("input-validation-error").appendTo(b)}else c.hide()}function k(e,d){var c=a(this).find("[data-valmsg-summary=true]"),b=c.find("ul");if(b&&b.length&&d.errorList.length){b.empty();c.addClass("validation-summary-errors").removeClass("validation-summary-valid");a.each(d.errorList,function(){a("
  • ").html(this.message).appendTo(b)})}}function j(c){var b=c.data("unobtrusiveContainer"),d=a.parseJSON(b.attr("data-valmsg-replace"));if(b){b.addClass("field-validation-valid").removeClass("field-validation-error");c.removeData("unobtrusiveContainer");d&&b.empty()}}function h(d){var b=a(d),c=b.data(f);if(!c){c={options:{errorClass:"input-validation-error",errorElement:"span",errorPlacement:a.proxy(l,d),invalidHandler:a.proxy(k,d),messages:{},rules:{},success:a.proxy(j,d)},attachValidation:function(){b.validate(this.options)},validate:function(){b.validate();return b.valid()}};b.data(f,c)}return c}d.unobtrusive={adapters:[],parseElement:function(b,i){var d=a(b),f=d.parents("form")[0],c,e,g;if(!f)return;c=h(f);c.options.rules[b.name]=e={};c.options.messages[b.name]=g={};a.each(this.adapters,function(){var c="data-val-"+this.name,i=d.attr(c),h={};if(i!==undefined){c+="-";a.each(this.params,function(){h[this]=d.attr(c+this)});this.adapt({element:b,form:f,message:i,params:h,rules:e,messages:g})}});jQuery.extend(e,{__dummy__:true});!i&&c.attachValidation()},parse:function(b){a(b).find(":input[data-val=true]").each(function(){d.unobtrusive.parseElement(this,true)});a("form").each(function(){var a=h(this);a&&a.attachValidation()})}};b=d.unobtrusive.adapters;b.add=function(c,a,b){if(!b){b=a;a=[]}this.push({name:c,params:a,adapt:b});return this};b.addBool=function(a,b){return this.add(a,function(d){c(d,b||a,true)})};b.addMinMax=function(e,g,f,a,d,b){return this.add(e,[d||"min",b||"max"],function(b){var e=b.params.min,d=b.params.max;if(e&&d)c(b,a,[e,d]);else if(e)c(b,g,e);else d&&c(b,f,d)})};b.addSingleVal=function(a,b,d){return this.add(a,[b||"val"],function(e){c(e,d||a,e.params[b])})};d.addMethod("__dummy__",function(){return true});d.addMethod("regex",function(b,c,d){var a;if(this.optional(c))return true;a=(new RegExp(d)).exec(b);return a&&a.index===0&&a[0].length===b.length});b.addSingleVal("accept","exts").addSingleVal("regex","pattern");b.addBool("creditcard").addBool("date").addBool("digits").addBool("email").addBool("number").addBool("url");b.addMinMax("length","minlength","maxlength","rangelength").addMinMax("range","min","max","range");b.add("equalto",["other"],function(b){var h=g(b.element.name),i=b.params.other,d=e(i,h),f=a(b.form).find(":input[name="+d+"]")[0];c(b,"equalTo",f)});b.add("required",function(a){(a.element.tagName.toUpperCase()!=="INPUT"||a.element.type.toUpperCase()!=="CHECKBOX")&&c(a,"required",true)});b.add("remote",["url","type","additionalfields"],function(b){var d={url:b.params.url,type:b.params.type||"GET",data:{}},f=g(b.element.name);a.each(i(b.params.additionalfields||b.element.name),function(h,g){var c=e(g,f);d.data[c]=function(){return a(b.form).find(":input[name='"+c+"']").val()}});c(b,"remote",d)});a(function(){d.unobtrusive.parse(document)})})(jQuery); -------------------------------------------------------------------------------- /ChatAndVote/ChatAndVote/Views/Chat/Index.cshtml: -------------------------------------------------------------------------------- 1 | @{ ViewBag.Title = "Index"; } 2 | 3 |

    Chat

    4 | 5 |
      6 | 7 | @using (Ajax.BeginForm("PostMessage", new AjaxOptions { OnBegin = "clearBox" })) 8 | { 9 |

      10 | Say: @Html.TextBox("message") 11 | 12 |

      13 | } 14 | 15 | -------------------------------------------------------------------------------- /ChatAndVote/ChatAndVote/Views/Home/About.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "About Us"; 3 | } 4 | 5 |

      About

      6 |

      7 | Put content here. 8 |

      9 | -------------------------------------------------------------------------------- /ChatAndVote/ChatAndVote/Views/Home/Index.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Home Page"; 3 | } 4 | 5 |

      @ViewBag.Message

      6 |

      7 | To learn more about ASP.NET MVC visit http://asp.net/mvc. 8 |

      9 | -------------------------------------------------------------------------------- /ChatAndVote/ChatAndVote/Views/Shared/Error.cshtml: -------------------------------------------------------------------------------- 1 | @model System.Web.Mvc.HandleErrorInfo 2 | 3 | @{ 4 | ViewBag.Title = "Error"; 5 | } 6 | 7 |

      8 | Sorry, an error occurred while processing your request. 9 |

      10 | -------------------------------------------------------------------------------- /ChatAndVote/ChatAndVote/Views/Shared/_Layout.cshtml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | @ViewBag.Title 5 | 6 | 7 | 8 | 9 | 10 |
      11 | 25 |
      26 | @RenderBody() 27 |
      28 | 30 |
      31 | 32 | 33 | -------------------------------------------------------------------------------- /ChatAndVote/ChatAndVote/Views/Shared/_LogOnPartial.cshtml: -------------------------------------------------------------------------------- 1 | @if(Request.IsAuthenticated) { 2 | Welcome @User.Identity.Name! 3 | [ @Html.ActionLink("Log Off", "LogOff", "Account") ] 4 | } 5 | else { 6 | @:[ @Html.ActionLink("Log On", "LogOn", "Account") ] 7 | } 8 | -------------------------------------------------------------------------------- /ChatAndVote/ChatAndVote/Views/Voting/Index.cshtml: -------------------------------------------------------------------------------- 1 | @model ChatAndVote.Models.Question 2 | @{ ViewBag.Title = "Voting"; } 3 | 4 | 5 | 6 |

      Please vote:

      7 | 8 |
        9 |
      • 10 | 11 | ( votes) 12 | 13 |
        14 |
      • 15 |
      16 | 17 | 18 | -------------------------------------------------------------------------------- /ChatAndVote/ChatAndVote/Views/Web.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 |
      7 |
      8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 40 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /ChatAndVote/ChatAndVote/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "~/Views/Shared/_Layout.cshtml"; 3 | } -------------------------------------------------------------------------------- /ChatAndVote/ChatAndVote/Web.Debug.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 17 | 18 | 29 | 30 | -------------------------------------------------------------------------------- /ChatAndVote/ChatAndVote/Web.Release.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 17 | 18 | 19 | 30 | 31 | -------------------------------------------------------------------------------- /ChatAndVote/ChatAndVote/Web.config: -------------------------------------------------------------------------------- 1 |  2 | 6 | 7 | 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 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 | -------------------------------------------------------------------------------- /ChatAndVote/ChatAndVote/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ChatAndVote/packages/EntityFramework.4.1.10331.0/EntityFramework.4.1.10331.0.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SteveSanderson/ASP.NET-MVC-async-demos/e8ee086737919b9d94d63ac6dc92ef94ab1fb818/ChatAndVote/packages/EntityFramework.4.1.10331.0/EntityFramework.4.1.10331.0.nupkg -------------------------------------------------------------------------------- /ChatAndVote/packages/EntityFramework.4.1.10331.0/lib/EntityFramework.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SteveSanderson/ASP.NET-MVC-async-demos/e8ee086737919b9d94d63ac6dc92ef94ab1fb818/ChatAndVote/packages/EntityFramework.4.1.10331.0/lib/EntityFramework.dll -------------------------------------------------------------------------------- /ChatAndVote/packages/Modernizr.1.7/Modernizr.1.7.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SteveSanderson/ASP.NET-MVC-async-demos/e8ee086737919b9d94d63ac6dc92ef94ab1fb818/ChatAndVote/packages/Modernizr.1.7/Modernizr.1.7.nupkg -------------------------------------------------------------------------------- /ChatAndVote/packages/SignalR.0.1/SignalR.0.1.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SteveSanderson/ASP.NET-MVC-async-demos/e8ee086737919b9d94d63ac6dc92ef94ab1fb818/ChatAndVote/packages/SignalR.0.1/SignalR.0.1.nupkg -------------------------------------------------------------------------------- /ChatAndVote/packages/SignalR.0.1/lib/net40/SignalR.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SteveSanderson/ASP.NET-MVC-async-demos/e8ee086737919b9d94d63ac6dc92ef94ab1fb818/ChatAndVote/packages/SignalR.0.1/lib/net40/SignalR.dll -------------------------------------------------------------------------------- /ChatAndVote/packages/jQuery.1.5.1/jQuery.1.5.1.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SteveSanderson/ASP.NET-MVC-async-demos/e8ee086737919b9d94d63ac6dc92ef94ab1fb818/ChatAndVote/packages/jQuery.1.5.1/jQuery.1.5.1.nupkg -------------------------------------------------------------------------------- /ChatAndVote/packages/jQuery.Validation.1.8.0/jQuery.Validation.1.8.0.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SteveSanderson/ASP.NET-MVC-async-demos/e8ee086737919b9d94d63ac6dc92ef94ab1fb818/ChatAndVote/packages/jQuery.Validation.1.8.0/jQuery.Validation.1.8.0.nupkg -------------------------------------------------------------------------------- /ChatAndVote/packages/jQuery.vsdoc.1.5.1/jQuery.vsdoc.1.5.1.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SteveSanderson/ASP.NET-MVC-async-demos/e8ee086737919b9d94d63ac6dc92ef94ab1fb818/ChatAndVote/packages/jQuery.vsdoc.1.5.1/jQuery.vsdoc.1.5.1.nupkg -------------------------------------------------------------------------------- /ChatAndVote/packages/repositories.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /MvcAsyncDemo/FlightInfoWebService/Controllers/FlightDataController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading; 5 | using System.Web; 6 | using System.Web.Mvc; 7 | using FlightInfoWebService.Models; 8 | using System.Threading.Tasks; 9 | using SignalR.Web; 10 | 11 | namespace FlightInfoWebService.Controllers 12 | { 13 | public class FlightDataController : TaskAsyncController 14 | { 15 | public async Task Index() 16 | { 17 | await TaskEx.Delay(1000); 18 | return Json(GetFlightsData(), JsonRequestBehavior.AllowGet); 19 | } 20 | 21 | private static IEnumerable GetFlightsData() { 22 | return new[] { 23 | new Flight { FlightId = 38434, FromCity = "London", ToCity = "New York", Price = 755.95M }, 24 | new Flight { FlightId = 38434, FromCity = "London", ToCity = "Singapore", Price = 1270.00M }, 25 | new Flight { FlightId = 38434, FromCity = "Paris", ToCity = "Tokyo", Price = 820.50M }, 26 | new Flight { FlightId = 38434, FromCity = "Stockholm", ToCity = "Chicago", Price = 475.20M }, 27 | new Flight { FlightId = 38434, FromCity = "Glasgow", ToCity = "Barcelona", Price = 185.00M }, 28 | }; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /MvcAsyncDemo/FlightInfoWebService/FlightInfoWebService.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | 7 | 8 | 2.0 9 | {998BA5FD-B777-4249-91F1-DB4DD54382CD} 10 | {E53F8FEA-EAE0-44A6-8774-FFD645390401};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} 11 | Library 12 | Properties 13 | FlightInfoWebService 14 | FlightInfoWebService 15 | v4.0 16 | false 17 | true 18 | 19 | 20 | true 21 | full 22 | false 23 | bin\ 24 | DEBUG;TRACE 25 | prompt 26 | 4 27 | 28 | 29 | pdbonly 30 | true 31 | bin\ 32 | TRACE 33 | prompt 34 | 4 35 | 36 | 37 | 38 | ..\MvcAsyncDemo\AsyncCtpLibrary.dll 39 | 40 | 41 | ..\packages\EntityFramework.4.1.10331.0\lib\EntityFramework.dll 42 | 43 | 44 | False 45 | .\SignalR.dll 46 | 47 | 48 | 49 | 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 | Global.asax 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | Web.config 84 | 85 | 86 | Web.config 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | False 109 | False 110 | 8089 111 | / 112 | http://localhost:38089/ 113 | False 114 | False 115 | 116 | 117 | False 118 | 119 | 120 | 121 | 122 | -------------------------------------------------------------------------------- /MvcAsyncDemo/FlightInfoWebService/FlightInfoWebService.csproj.orig: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | 7 | 8 | 2.0 9 | {998BA5FD-B777-4249-91F1-DB4DD54382CD} 10 | {E53F8FEA-EAE0-44A6-8774-FFD645390401};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} 11 | Library 12 | Properties 13 | FlightInfoWebService 14 | FlightInfoWebService 15 | v4.0 16 | false 17 | true 18 | 19 | 20 | true 21 | full 22 | false 23 | bin\ 24 | DEBUG;TRACE 25 | prompt 26 | 4 27 | 28 | 29 | pdbonly 30 | true 31 | bin\ 32 | TRACE 33 | prompt 34 | 4 35 | 36 | 37 | 38 | ..\MvcAsyncDemo\AsyncCtpLibrary.dll 39 | 40 | 41 | ..\packages\EntityFramework.4.1.10331.0\lib\EntityFramework.dll 42 | 43 | 44 | ..\packages\SignalR.0.1\lib\net40\SignalR.dll 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | Global.asax 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | Web.config 83 | 84 | 85 | Web.config 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | True 108 | False 109 | 8089 110 | / 111 | http://localhost:8089/ 112 | False 113 | False 114 | 115 | 116 | False 117 | 118 | 119 | 120 | 121 | -------------------------------------------------------------------------------- /MvcAsyncDemo/FlightInfoWebService/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Codebehind="Global.asax.cs" Inherits="FlightInfoWebService.MvcApplication" Language="C#" %> 2 | -------------------------------------------------------------------------------- /MvcAsyncDemo/FlightInfoWebService/Global.asax.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using System.Web.Routing; 7 | 8 | namespace FlightInfoWebService 9 | { 10 | // Note: For instructions on enabling IIS6 or IIS7 classic mode, 11 | // visit http://go.microsoft.com/?LinkId=9394801 12 | 13 | public class MvcApplication : System.Web.HttpApplication 14 | { 15 | public static void RegisterGlobalFilters(GlobalFilterCollection filters) 16 | { 17 | filters.Add(new HandleErrorAttribute()); 18 | } 19 | 20 | public static void RegisterRoutes(RouteCollection routes) 21 | { 22 | routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 23 | 24 | routes.MapRoute( 25 | "Default", // Route name 26 | "{controller}/{action}/{id}", // URL with parameters 27 | new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults 28 | ); 29 | 30 | } 31 | 32 | protected void Application_Start() 33 | { 34 | AreaRegistration.RegisterAllAreas(); 35 | 36 | RegisterGlobalFilters(GlobalFilters.Filters); 37 | RegisterRoutes(RouteTable.Routes); 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /MvcAsyncDemo/FlightInfoWebService/Models/Flight.cs: -------------------------------------------------------------------------------- 1 | namespace FlightInfoWebService.Models 2 | { 3 | public class Flight 4 | { 5 | public int FlightId { get; set; } 6 | public string FromCity { get; set; } 7 | public string ToCity { get; set; } 8 | public decimal Price { get; set; } 9 | } 10 | } -------------------------------------------------------------------------------- /MvcAsyncDemo/FlightInfoWebService/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("FlightInfoWebService")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("FlightInfoWebService")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2011")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("e49bab9b-6714-4b5e-adf0-58932d85d634")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Revision and Build Numbers 33 | // by using the '*' as shown below: 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /MvcAsyncDemo/FlightInfoWebService/SignalR.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SteveSanderson/ASP.NET-MVC-async-demos/e8ee086737919b9d94d63ac6dc92ef94ab1fb818/MvcAsyncDemo/FlightInfoWebService/SignalR.dll -------------------------------------------------------------------------------- /MvcAsyncDemo/FlightInfoWebService/Web.Debug.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 17 | 18 | 29 | 30 | -------------------------------------------------------------------------------- /MvcAsyncDemo/FlightInfoWebService/Web.Release.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 17 | 18 | 19 | 30 | 31 | -------------------------------------------------------------------------------- /MvcAsyncDemo/FlightInfoWebService/Web.config: -------------------------------------------------------------------------------- 1 |  2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /MvcAsyncDemo/FlightInfoWebService/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /MvcAsyncDemo/FlightInfoWebService/packages.config.orig: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /MvcAsyncDemo/MvcAsyncDemo.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MvcAsyncDemo", "MvcAsyncDemo\MvcAsyncDemo.csproj", "{FA2174F7-B548-4F89-B361-4FD9840E4084}" 5 | EndProject 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FlightInfoWebService", "FlightInfoWebService\FlightInfoWebService.csproj", "{998BA5FD-B777-4249-91F1-DB4DD54382CD}" 7 | EndProject 8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WebService", "WebService", "{7918CEF4-1676-4664-B3CF-065393BF134D}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Release|Any CPU = Release|Any CPU 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {FA2174F7-B548-4F89-B361-4FD9840E4084}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 17 | {FA2174F7-B548-4F89-B361-4FD9840E4084}.Debug|Any CPU.Build.0 = Debug|Any CPU 18 | {FA2174F7-B548-4F89-B361-4FD9840E4084}.Release|Any CPU.ActiveCfg = Release|Any CPU 19 | {FA2174F7-B548-4F89-B361-4FD9840E4084}.Release|Any CPU.Build.0 = Release|Any CPU 20 | {998BA5FD-B777-4249-91F1-DB4DD54382CD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {998BA5FD-B777-4249-91F1-DB4DD54382CD}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {998BA5FD-B777-4249-91F1-DB4DD54382CD}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {998BA5FD-B777-4249-91F1-DB4DD54382CD}.Release|Any CPU.Build.0 = Release|Any CPU 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(NestedProjects) = preSolution 29 | {998BA5FD-B777-4249-91F1-DB4DD54382CD} = {7918CEF4-1676-4664-B3CF-065393BF134D} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /MvcAsyncDemo/MvcAsyncDemo/AsyncCtpLibrary.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SteveSanderson/ASP.NET-MVC-async-demos/e8ee086737919b9d94d63ac6dc92ef94ab1fb818/MvcAsyncDemo/MvcAsyncDemo/AsyncCtpLibrary.dll -------------------------------------------------------------------------------- /MvcAsyncDemo/MvcAsyncDemo/Content/Site.css: -------------------------------------------------------------------------------- 1 | body 2 | { 3 | font-size: .85em; 4 | font-family: "Trebuchet MS", Verdana, Helvetica, Sans-Serif; 5 | color: #232323; 6 | background-color: #fff; 7 | } 8 | 9 | header, 10 | footer, 11 | nav, 12 | section { 13 | display: block; 14 | } 15 | 16 | /* Styles for basic forms 17 | -----------------------------------------------------------*/ 18 | 19 | fieldset 20 | { 21 | border:1px solid #ddd; 22 | padding:0 1.4em 1.4em 1.4em; 23 | margin:0 0 1.5em 0; 24 | } 25 | 26 | legend 27 | { 28 | font-size:1.2em; 29 | font-weight: bold; 30 | } 31 | 32 | textarea 33 | { 34 | min-height: 75px; 35 | } 36 | 37 | .editor-label 38 | { 39 | margin: 1em 0 0 0; 40 | } 41 | 42 | .editor-field 43 | { 44 | margin:0.5em 0 0 0; 45 | } 46 | 47 | 48 | /* Styles for validation helpers 49 | -----------------------------------------------------------*/ 50 | .field-validation-error 51 | { 52 | color: #ff0000; 53 | } 54 | 55 | .field-validation-valid 56 | { 57 | display: none; 58 | } 59 | 60 | .input-validation-error 61 | { 62 | border: 1px solid #ff0000; 63 | background-color: #ffeeee; 64 | } 65 | 66 | .validation-summary-errors 67 | { 68 | font-weight: bold; 69 | color: #ff0000; 70 | } 71 | 72 | .validation-summary-valid 73 | { 74 | display: none; 75 | } 76 | 77 | div.clear { clear: both; } 78 | div.flight { clear: both; background-color: #DDD; height: 5em; padding: 0.4em; border-bottom: 2px solid gray; } 79 | div.price { font-size: 4em; display: inline-block; width: 5em; float: left; margin: 0 0.5em 0.3em 0; text-align: right } 80 | div.cities { float: left; padding-top: 0.4em; font-size: 1.6em; font-style: italic; } 81 | span.city { color: #337722; font-weight: bold; font-style: normal } -------------------------------------------------------------------------------- /MvcAsyncDemo/MvcAsyncDemo/Controllers/CheapFlightsController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using System.Net; 7 | using MvcAsyncDemo.Models; 8 | using System.Web.Script.Serialization; 9 | using System.Threading.Tasks; 10 | using SignalR.Web; 11 | 12 | namespace MvcAsyncDemo.Controllers 13 | { 14 | public class CheapFlightsController : Controller 15 | { 16 | public ActionResult Index() 17 | { 18 | string json = new WebClient().DownloadString(FlightsService.Url); 19 | Flight[] flights = new JavaScriptSerializer().Deserialize(json); 20 | return View("FlightList", flights); 21 | } 22 | } 23 | 24 | public class CheapFlightsAsyncController : AsyncController 25 | { 26 | public void IndexAsync() 27 | { 28 | AsyncManager.OutstandingOperations.Increment(); 29 | var webClient = new WebClient(); 30 | 31 | webClient.DownloadStringCompleted += (sender, evt) => { 32 | // When the web service request completes, capture the result 33 | AsyncManager.Parameters["json"] = evt.Result; 34 | AsyncManager.OutstandingOperations.Decrement(); 35 | }; 36 | 37 | // Commence the web service request asynchronously 38 | webClient.DownloadStringAsync(new Uri(FlightsService.Url)); 39 | } 40 | 41 | public ActionResult IndexCompleted(string json) 42 | { 43 | Flight[] flights = new JavaScriptSerializer().Deserialize(json); 44 | return View("FlightList", flights); 45 | } 46 | } 47 | 48 | public class CheapFlightsTaskAsyncController : TaskAsyncController 49 | { 50 | public async Task Index() 51 | { 52 | string json = await new WebClient().DownloadStringTaskAsync(FlightsService.Url); 53 | Flight[] flights = new JavaScriptSerializer().Deserialize(json); 54 | return View("FlightList", flights); 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /MvcAsyncDemo/MvcAsyncDemo/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Codebehind="Global.asax.cs" Inherits="MvcAsyncDemo.MvcApplication" Language="C#" %> 2 | -------------------------------------------------------------------------------- /MvcAsyncDemo/MvcAsyncDemo/Global.asax.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading; 5 | using System.Web; 6 | using System.Web.Mvc; 7 | using System.Web.Routing; 8 | using System.Net; 9 | 10 | namespace MvcAsyncDemo 11 | { 12 | // Note: For instructions on enabling IIS6 or IIS7 classic mode, 13 | // visit http://go.microsoft.com/?LinkId=9394801 14 | 15 | public class MvcApplication : System.Web.HttpApplication 16 | { 17 | public static void RegisterGlobalFilters(GlobalFilterCollection filters) 18 | { 19 | filters.Add(new HandleErrorAttribute()); 20 | } 21 | 22 | public static void RegisterRoutes(RouteCollection routes) 23 | { 24 | routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 25 | 26 | routes.MapRoute( 27 | "Default", // Route name 28 | "{controller}/{action}/{id}", // URL with parameters 29 | new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults 30 | ); 31 | 32 | } 33 | 34 | protected void Application_Start() 35 | { 36 | AreaRegistration.RegisterAllAreas(); 37 | 38 | RegisterGlobalFilters(GlobalFilters.Filters); 39 | RegisterRoutes(RouteTable.Routes); 40 | 41 | ServicePointManager.DefaultConnectionLimit = 1000; // Max # concurrent outbound HTTP requests 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /MvcAsyncDemo/MvcAsyncDemo/Models/Flight.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using System.Web.Script.Serialization; 7 | 8 | namespace MvcAsyncDemo.Models 9 | { 10 | public class Flight 11 | { 12 | public int FlightId { get; set; } 13 | public string FromCity { get; set; } 14 | public string ToCity { get; set; } 15 | public decimal Price { get; set; } 16 | } 17 | 18 | public class FlightsService 19 | { 20 | public readonly static string Url = "http://localhost:8089/flightdata"; 21 | } 22 | } -------------------------------------------------------------------------------- /MvcAsyncDemo/MvcAsyncDemo/MvcAsyncDemo.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | 7 | 8 | 2.0 9 | {FA2174F7-B548-4F89-B361-4FD9840E4084} 10 | {E53F8FEA-EAE0-44A6-8774-FFD645390401};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} 11 | Library 12 | Properties 13 | MvcAsyncDemo 14 | MvcAsyncDemo 15 | v4.0 16 | false 17 | true 18 | 19 | 20 | true 21 | full 22 | false 23 | bin\ 24 | DEBUG;TRACE 25 | prompt 26 | 4 27 | 28 | 29 | pdbonly 30 | true 31 | bin\ 32 | TRACE 33 | prompt 34 | 4 35 | 36 | 37 | 38 | .\AsyncCtpLibrary.dll 39 | 40 | 41 | ..\packages\EntityFramework.4.1.10331.0\lib\EntityFramework.dll 42 | 43 | 44 | ..\packages\SignalR.0.1\lib\net40\SignalR.dll 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | Global.asax 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | Web.config 92 | 93 | 94 | Web.config 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 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | False 134 | True 135 | 46805 136 | / 137 | http://localhost:46805/ 138 | False 139 | False 140 | 141 | 142 | False 143 | 144 | 145 | 146 | 147 | -------------------------------------------------------------------------------- /MvcAsyncDemo/MvcAsyncDemo/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("MvcAsyncDemo")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("MvcAsyncDemo")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2011")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("e92727bf-e2a2-4327-8616-ef1caf3b257c")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Revision and Build Numbers 33 | // by using the '*' as shown below: 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /MvcAsyncDemo/MvcAsyncDemo/Scripts/MicrosoftMvcAjax.js: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------- 2 | // Copyright (C) Microsoft Corporation. All rights reserved. 3 | //---------------------------------------------------------- 4 | // MicrosoftMvcAjax.js 5 | 6 | Type.registerNamespace('Sys.Mvc');Sys.Mvc.$create_AjaxOptions=function(){return {};} 7 | Sys.Mvc.InsertionMode=function(){};Sys.Mvc.InsertionMode.prototype = {replace:0,insertBefore:1,insertAfter:2} 8 | Sys.Mvc.InsertionMode.registerEnum('Sys.Mvc.InsertionMode',false);Sys.Mvc.AjaxContext=function(request,updateTarget,loadingElement,insertionMode){this.$3=request;this.$4=updateTarget;this.$1=loadingElement;this.$0=insertionMode;} 9 | Sys.Mvc.AjaxContext.prototype={$0:0,$1:null,$2:null,$3:null,$4:null,get_data:function(){if(this.$2){return this.$2.get_responseData();}else{return null;}},get_insertionMode:function(){return this.$0;},get_loadingElement:function(){return this.$1;},get_object:function(){var $0=this.get_response();return ($0)?$0.get_object():null;},get_response:function(){return this.$2;},set_response:function(value){this.$2=value;return value;},get_request:function(){return this.$3;},get_updateTarget:function(){return this.$4;}} 10 | Sys.Mvc.AsyncHyperlink=function(){} 11 | Sys.Mvc.AsyncHyperlink.handleClick=function(anchor,evt,ajaxOptions){evt.preventDefault();Sys.Mvc.MvcHelpers.$2(anchor.href,'post','',anchor,ajaxOptions);} 12 | Sys.Mvc.MvcHelpers=function(){} 13 | Sys.Mvc.MvcHelpers.$0=function($p0,$p1,$p2){if($p0.disabled){return null;}var $0=$p0.name;if($0){var $1=$p0.tagName.toUpperCase();var $2=encodeURIComponent($0);var $3=$p0;if($1==='INPUT'){var $4=$3.type;if($4==='submit'){return $2+'='+encodeURIComponent($3.value);}else if($4==='image'){return $2+'.x='+$p1+'&'+$2+'.y='+$p2;}}else if(($1==='BUTTON')&&($0.length)&&($3.type==='submit')){return $2+'='+encodeURIComponent($3.value);}}return null;} 14 | Sys.Mvc.MvcHelpers.$1=function($p0){var $0=$p0.elements;var $1=new Sys.StringBuilder();var $2=$0.length;for(var $4=0;$4<$2;$4++){var $5=$0[$4];var $6=$5.name;if(!$6||!$6.length){continue;}var $7=$5.tagName.toUpperCase();if($7==='INPUT'){var $8=$5;var $9=$8.type;if(($9==='text')||($9==='password')||($9==='hidden')||((($9==='checkbox')||($9==='radio'))&&$5.checked)){$1.append(encodeURIComponent($6));$1.append('=');$1.append(encodeURIComponent($8.value));$1.append('&');}}else if($7==='SELECT'){var $A=$5;var $B=$A.options.length;for(var $C=0;$C<$B;$C++){var $D=$A.options[$C];if($D.selected){$1.append(encodeURIComponent($6));$1.append('=');$1.append(encodeURIComponent($D.value));$1.append('&');}}}else if($7==='TEXTAREA'){$1.append(encodeURIComponent($6));$1.append('=');$1.append(encodeURIComponent(($5.value)));$1.append('&');}}var $3=$p0._additionalInput;if($3){$1.append($3);$1.append('&');}return $1.toString();} 15 | Sys.Mvc.MvcHelpers.$2=function($p0,$p1,$p2,$p3,$p4){if($p4.confirm){if(!confirm($p4.confirm)){return;}}if($p4.url){$p0=$p4.url;}if($p4.httpMethod){$p1=$p4.httpMethod;}if($p2.length>0&&!$p2.endsWith('&')){$p2+='&';}$p2+='X-Requested-With=XMLHttpRequest';var $0=$p1.toUpperCase();var $1=($0==='GET'||$0==='POST');if(!$1){$p2+='&';$p2+='X-HTTP-Method-Override='+$0;}var $2='';if($0==='GET'||$0==='DELETE'){if($p0.indexOf('?')>-1){if(!$p0.endsWith('&')){$p0+='&';}$p0+=$p2;}else{$p0+='?';$p0+=$p2;}}else{$2=$p2;}var $3=new Sys.Net.WebRequest();$3.set_url($p0);if($1){$3.set_httpVerb($p1);}else{$3.set_httpVerb('POST');$3.get_headers()['X-HTTP-Method-Override']=$0;}$3.set_body($2);if($p1.toUpperCase()==='PUT'){$3.get_headers()['Content-Type']='application/x-www-form-urlencoded;';}$3.get_headers()['X-Requested-With']='XMLHttpRequest';var $4=null;if($p4.updateTargetId){$4=$get($p4.updateTargetId);}var $5=null;if($p4.loadingElementId){$5=$get($p4.loadingElementId);}var $6=new Sys.Mvc.AjaxContext($3,$4,$5,$p4.insertionMode);var $7=true;if($p4.onBegin){$7=$p4.onBegin($6)!==false;}if($5){Sys.UI.DomElement.setVisible($6.get_loadingElement(),true);}if($7){$3.add_completed(Function.createDelegate(null,function($p1_0){ 16 | Sys.Mvc.MvcHelpers.$3($3,$p4,$6);}));$3.invoke();}} 17 | Sys.Mvc.MvcHelpers.$3=function($p0,$p1,$p2){$p2.set_response($p0.get_executor());if($p1.onComplete&&$p1.onComplete($p2)===false){return;}var $0=$p2.get_response().get_statusCode();if(($0>=200&&$0<300)||$0===304||$0===1223){if($0!==204&&$0!==304&&$0!==1223){var $1=$p2.get_response().getResponseHeader('Content-Type');if(($1)&&($1.indexOf('application/x-javascript')!==-1)){eval($p2.get_data());}else{Sys.Mvc.MvcHelpers.updateDomElement($p2.get_updateTarget(),$p2.get_insertionMode(),$p2.get_data());}}if($p1.onSuccess){$p1.onSuccess($p2);}}else{if($p1.onFailure){$p1.onFailure($p2);}}if($p2.get_loadingElement()){Sys.UI.DomElement.setVisible($p2.get_loadingElement(),false);}} 18 | Sys.Mvc.MvcHelpers.updateDomElement=function(target,insertionMode,content){if(target){switch(insertionMode){case 0:target.innerHTML=content;break;case 1:if(content&&content.length>0){target.innerHTML=content+target.innerHTML.trimStart();}break;case 2:if(content&&content.length>0){target.innerHTML=target.innerHTML.trimEnd()+content;}break;}}} 19 | Sys.Mvc.AsyncForm=function(){} 20 | Sys.Mvc.AsyncForm.handleClick=function(form,evt){var $0=Sys.Mvc.MvcHelpers.$0(evt.target,evt.offsetX,evt.offsetY);form._additionalInput = $0;} 21 | Sys.Mvc.AsyncForm.handleSubmit=function(form,evt,ajaxOptions){evt.preventDefault();var $0=form.validationCallbacks;if($0){for(var $2=0;$2<$0.length;$2++){var $3=$0[$2];if(!$3()){return;}}}var $1=Sys.Mvc.MvcHelpers.$1(form);Sys.Mvc.MvcHelpers.$2(form.action,form.method||'post',$1,form,ajaxOptions);} 22 | Sys.Mvc.AjaxContext.registerClass('Sys.Mvc.AjaxContext');Sys.Mvc.AsyncHyperlink.registerClass('Sys.Mvc.AsyncHyperlink');Sys.Mvc.MvcHelpers.registerClass('Sys.Mvc.MvcHelpers');Sys.Mvc.AsyncForm.registerClass('Sys.Mvc.AsyncForm'); 23 | // ---- Do not remove this footer ---- 24 | // Generated using Script# v0.5.0.0 (http://projects.nikhilk.net) 25 | // ----------------------------------- 26 | -------------------------------------------------------------------------------- /MvcAsyncDemo/MvcAsyncDemo/Scripts/jquery.unobtrusive-ajax.js: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | /*! 4 | ** Unobtrusive Ajax support library for jQuery 5 | ** Copyright (C) Microsoft Corporation. All rights reserved. 6 | */ 7 | 8 | /*jslint white: true, browser: true, onevar: true, undef: true, nomen: true, eqeqeq: true, plusplus: true, bitwise: true, regexp: true, newcap: true, immed: true, strict: false */ 9 | /*global window: false, jQuery: false */ 10 | 11 | (function ($) { 12 | var data_click = "unobtrusiveAjaxClick", 13 | data_validation = "unobtrusiveValidation"; 14 | 15 | function getFunction(code, argNames) { 16 | var fn = window, parts = (code || "").split("."); 17 | while (fn && parts.length) { 18 | fn = fn[parts.shift()]; 19 | } 20 | if (typeof (fn) === "function") { 21 | return fn; 22 | } 23 | argNames.push(code); 24 | return Function.constructor.apply(null, argNames); 25 | } 26 | 27 | function isMethodProxySafe(method) { 28 | return method === "GET" || method === "POST"; 29 | } 30 | 31 | function asyncOnBeforeSend(xhr, method) { 32 | if (!isMethodProxySafe(method)) { 33 | xhr.setRequestHeader("X-HTTP-Method-Override", method); 34 | } 35 | } 36 | 37 | function asyncOnSuccess(element, data, contentType) { 38 | var mode; 39 | 40 | if (contentType.indexOf("application/x-javascript") !== -1) { // jQuery already executes JavaScript for us 41 | return; 42 | } 43 | 44 | mode = (element.getAttribute("data-ajax-mode") || "").toUpperCase(); 45 | $(element.getAttribute("data-ajax-update")).each(function (i, update) { 46 | var top; 47 | 48 | switch (mode) { 49 | case "BEFORE": 50 | top = update.firstChild; 51 | $("
      ").html(data).contents().each(function () { 52 | update.insertBefore(this, top); 53 | }); 54 | break; 55 | case "AFTER": 56 | $("
      ").html(data).contents().each(function () { 57 | update.appendChild(this); 58 | }); 59 | break; 60 | default: 61 | $(update).html(data); 62 | break; 63 | } 64 | }); 65 | } 66 | 67 | function asyncRequest(element, options) { 68 | var confirm, loading, method, duration; 69 | 70 | confirm = element.getAttribute("data-ajax-confirm"); 71 | if (confirm && !window.confirm(confirm)) { 72 | return; 73 | } 74 | 75 | loading = $(element.getAttribute("data-ajax-loading")); 76 | duration = element.getAttribute("data-ajax-loading-duration") || 0; 77 | 78 | $.extend(options, { 79 | type: element.getAttribute("data-ajax-method") || undefined, 80 | url: element.getAttribute("data-ajax-url") || undefined, 81 | beforeSend: function (xhr) { 82 | var result; 83 | asyncOnBeforeSend(xhr, method); 84 | result = getFunction(element.getAttribute("data-ajax-begin"), ["xhr"]).apply(this, arguments); 85 | if (result !== false) { 86 | loading.show(duration); 87 | } 88 | return result; 89 | }, 90 | complete: function () { 91 | loading.hide(duration); 92 | getFunction(element.getAttribute("data-ajax-complete"), ["xhr", "status"]).apply(this, arguments); 93 | }, 94 | success: function (data, status, xhr) { 95 | asyncOnSuccess(element, data, xhr.getResponseHeader("Content-Type") || "text/html"); 96 | getFunction(element.getAttribute("data-ajax-success"), ["data", "status", "xhr"]).apply(this, arguments); 97 | }, 98 | error: getFunction(element.getAttribute("data-ajax-failure"), ["xhr", "status", "error"]) 99 | }); 100 | 101 | options.data.push({ name: "X-Requested-With", value: "XMLHttpRequest" }); 102 | 103 | method = options.type.toUpperCase(); 104 | if (!isMethodProxySafe(method)) { 105 | options.type = "POST"; 106 | options.data.push({ name: "X-HTTP-Method-Override", value: method }); 107 | } 108 | 109 | $.ajax(options); 110 | } 111 | 112 | function validate(form) { 113 | var validationInfo = $(form).data(data_validation); 114 | return !validationInfo || !validationInfo.validate || validationInfo.validate(); 115 | } 116 | 117 | $("a[data-ajax=true]").live("click", function (evt) { 118 | evt.preventDefault(); 119 | asyncRequest(this, { 120 | url: this.href, 121 | type: "GET", 122 | data: [] 123 | }); 124 | }); 125 | 126 | $("form[data-ajax=true] input[type=image]").live("click", function (evt) { 127 | var name = evt.target.name, 128 | $target = $(evt.target), 129 | form = $target.parents("form")[0], 130 | offset = $target.offset(); 131 | 132 | $(form).data(data_click, [ 133 | { name: name + ".x", value: Math.round(evt.pageX - offset.left) }, 134 | { name: name + ".y", value: Math.round(evt.pageY - offset.top) } 135 | ]); 136 | 137 | setTimeout(function () { 138 | $(form).removeData(data_click); 139 | }, 0); 140 | }); 141 | 142 | $("form[data-ajax=true] :submit").live("click", function (evt) { 143 | var name = evt.target.name, 144 | form = $(evt.target).parents("form")[0]; 145 | 146 | $(form).data(data_click, name ? [{ name: name, value: evt.target.value }] : []); 147 | 148 | setTimeout(function () { 149 | $(form).removeData(data_click); 150 | }, 0); 151 | }); 152 | 153 | $("form[data-ajax=true]").live("submit", function (evt) { 154 | var clickInfo = $(this).data(data_click) || []; 155 | evt.preventDefault(); 156 | if (!validate(this)) { 157 | return; 158 | } 159 | asyncRequest(this, { 160 | url: this.action, 161 | type: this.method || "GET", 162 | data: clickInfo.concat($(this).serializeArray()) 163 | }); 164 | }); 165 | }(jQuery)); -------------------------------------------------------------------------------- /MvcAsyncDemo/MvcAsyncDemo/Scripts/jquery.unobtrusive-ajax.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | ** Unobtrusive Ajax support library for jQuery 3 | ** Copyright (C) Microsoft Corporation. All rights reserved. 4 | */ 5 | (function(a){var b="unobtrusiveAjaxClick",g="unobtrusiveValidation";function c(d,b){var a=window,c=(d||"").split(".");while(a&&c.length)a=a[c.shift()];if(typeof a==="function")return a;b.push(d);return Function.constructor.apply(null,b)}function d(a){return a==="GET"||a==="POST"}function f(b,a){!d(a)&&b.setRequestHeader("X-HTTP-Method-Override",a)}function h(c,b,e){var d;if(e.indexOf("application/x-javascript")!==-1)return;d=(c.getAttribute("data-ajax-mode")||"").toUpperCase();a(c.getAttribute("data-ajax-update")).each(function(f,c){var e;switch(d){case"BEFORE":e=c.firstChild;a("
      ").html(b).contents().each(function(){c.insertBefore(this,e)});break;case"AFTER":a("
      ").html(b).contents().each(function(){c.appendChild(this)});break;default:a(c).html(b)}})}function e(b,e){var j,k,g,i;j=b.getAttribute("data-ajax-confirm");if(j&&!window.confirm(j))return;k=a(b.getAttribute("data-ajax-loading"));i=b.getAttribute("data-ajax-loading-duration")||0;a.extend(e,{type:b.getAttribute("data-ajax-method")||undefined,url:b.getAttribute("data-ajax-url")||undefined,beforeSend:function(d){var a;f(d,g);a=c(b.getAttribute("data-ajax-begin"),["xhr"]).apply(this,arguments);a!==false&&k.show(i);return a},complete:function(){k.hide(i);c(b.getAttribute("data-ajax-complete"),["xhr","status"]).apply(this,arguments)},success:function(a,e,d){h(b,a,d.getResponseHeader("Content-Type")||"text/html");c(b.getAttribute("data-ajax-success"),["data","status","xhr"]).apply(this,arguments)},error:c(b.getAttribute("data-ajax-failure"),["xhr","status","error"])});e.data.push({name:"X-Requested-With",value:"XMLHttpRequest"});g=e.type.toUpperCase();if(!d(g)){e.type="POST";e.data.push({name:"X-HTTP-Method-Override",value:g})}a.ajax(e)}function i(c){var b=a(c).data(g);return!b||!b.validate||b.validate()}a("a[data-ajax=true]").live("click",function(a){a.preventDefault();e(this,{url:this.href,type:"GET",data:[]})});a("form[data-ajax=true] input[type=image]").live("click",function(c){var g=c.target.name,d=a(c.target),f=d.parents("form")[0],e=d.offset();a(f).data(b,[{name:g+".x",value:Math.round(c.pageX-e.left)},{name:g+".y",value:Math.round(c.pageY-e.top)}]);setTimeout(function(){a(f).removeData(b)},0)});a("form[data-ajax=true] :submit").live("click",function(c){var e=c.target.name,d=a(c.target).parents("form")[0];a(d).data(b,e?[{name:e,value:c.target.value}]:[]);setTimeout(function(){a(d).removeData(b)},0)});a("form[data-ajax=true]").live("submit",function(d){var c=a(this).data(b)||[];d.preventDefault();if(!i(this))return;e(this,{url:this.action,type:this.method||"GET",data:c.concat(a(this).serializeArray())})})})(jQuery); -------------------------------------------------------------------------------- /MvcAsyncDemo/MvcAsyncDemo/Scripts/jquery.validate.unobtrusive.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | ** Unobtrusive validation support library for jQuery and jQuery Validate 3 | ** Copyright (C) Microsoft Corporation. All rights reserved. 4 | */ 5 | (function(a){var d=a.validator,b,f="unobtrusiveValidation";function c(a,b,c){a.rules[b]=c;if(a.message)a.messages[b]=a.message}function i(a){return a.replace(/^\s+|\s+$/g,"").split(/\s*,\s*/g)}function g(a){return a.substr(0,a.lastIndexOf(".")+1)}function e(a,b){if(a.indexOf("*.")===0)a=a.replace("*.",b);return a}function l(c,d){var b=a(this).find("[data-valmsg-for='"+d[0].name+"']"),e=a.parseJSON(b.attr("data-valmsg-replace"))!==false;b.removeClass("field-validation-valid").addClass("field-validation-error");c.data("unobtrusiveContainer",b);if(e){b.empty();c.removeClass("input-validation-error").appendTo(b)}else c.hide()}function k(e,d){var c=a(this).find("[data-valmsg-summary=true]"),b=c.find("ul");if(b&&b.length&&d.errorList.length){b.empty();c.addClass("validation-summary-errors").removeClass("validation-summary-valid");a.each(d.errorList,function(){a("
    • ").html(this.message).appendTo(b)})}}function j(c){var b=c.data("unobtrusiveContainer"),d=a.parseJSON(b.attr("data-valmsg-replace"));if(b){b.addClass("field-validation-valid").removeClass("field-validation-error");c.removeData("unobtrusiveContainer");d&&b.empty()}}function h(d){var b=a(d),c=b.data(f);if(!c){c={options:{errorClass:"input-validation-error",errorElement:"span",errorPlacement:a.proxy(l,d),invalidHandler:a.proxy(k,d),messages:{},rules:{},success:a.proxy(j,d)},attachValidation:function(){b.validate(this.options)},validate:function(){b.validate();return b.valid()}};b.data(f,c)}return c}d.unobtrusive={adapters:[],parseElement:function(b,i){var d=a(b),f=d.parents("form")[0],c,e,g;if(!f)return;c=h(f);c.options.rules[b.name]=e={};c.options.messages[b.name]=g={};a.each(this.adapters,function(){var c="data-val-"+this.name,i=d.attr(c),h={};if(i!==undefined){c+="-";a.each(this.params,function(){h[this]=d.attr(c+this)});this.adapt({element:b,form:f,message:i,params:h,rules:e,messages:g})}});jQuery.extend(e,{__dummy__:true});!i&&c.attachValidation()},parse:function(b){a(b).find(":input[data-val=true]").each(function(){d.unobtrusive.parseElement(this,true)});a("form").each(function(){var a=h(this);a&&a.attachValidation()})}};b=d.unobtrusive.adapters;b.add=function(c,a,b){if(!b){b=a;a=[]}this.push({name:c,params:a,adapt:b});return this};b.addBool=function(a,b){return this.add(a,function(d){c(d,b||a,true)})};b.addMinMax=function(e,g,f,a,d,b){return this.add(e,[d||"min",b||"max"],function(b){var e=b.params.min,d=b.params.max;if(e&&d)c(b,a,[e,d]);else if(e)c(b,g,e);else d&&c(b,f,d)})};b.addSingleVal=function(a,b,d){return this.add(a,[b||"val"],function(e){c(e,d||a,e.params[b])})};d.addMethod("__dummy__",function(){return true});d.addMethod("regex",function(b,c,d){var a;if(this.optional(c))return true;a=(new RegExp(d)).exec(b);return a&&a.index===0&&a[0].length===b.length});b.addSingleVal("accept","exts").addSingleVal("regex","pattern");b.addBool("creditcard").addBool("date").addBool("digits").addBool("email").addBool("number").addBool("url");b.addMinMax("length","minlength","maxlength","rangelength").addMinMax("range","min","max","range");b.add("equalto",["other"],function(b){var h=g(b.element.name),i=b.params.other,d=e(i,h),f=a(b.form).find(":input[name="+d+"]")[0];c(b,"equalTo",f)});b.add("required",function(a){(a.element.tagName.toUpperCase()!=="INPUT"||a.element.type.toUpperCase()!=="CHECKBOX")&&c(a,"required",true)});b.add("remote",["url","type","additionalfields"],function(b){var d={url:b.params.url,type:b.params.type||"GET",data:{}},f=g(b.element.name);a.each(i(b.params.additionalfields||b.element.name),function(h,g){var c=e(g,f);d.data[c]=function(){return a(b.form).find(":input[name='"+c+"']").val()}});c(b,"remote",d)});a(function(){d.unobtrusive.parse(document)})})(jQuery); -------------------------------------------------------------------------------- /MvcAsyncDemo/MvcAsyncDemo/Views/Shared/Error.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = null; 3 | } 4 | 5 | 6 | 7 | 8 | Error 9 | 10 | 11 |

      12 | Sorry, an error occurred while processing your request. 13 |

      14 | 15 | -------------------------------------------------------------------------------- /MvcAsyncDemo/MvcAsyncDemo/Views/Shared/FlightList.cshtml: -------------------------------------------------------------------------------- 1 | @model IEnumerable 2 | 3 | @{ 4 | ViewBag.Title = "Index"; 5 | } 6 | 7 | @foreach(var flight in Model) { 8 |
      9 |
      @flight.Price.ToString("c")
      10 |
      11 | @flight.FromCity 12 |
      to 13 | @flight.ToCity 14 |
      15 |
      16 | } 17 |
      18 |

      Total: @Model.Count() cheap flights today

      19 |
      20 | -------------------------------------------------------------------------------- /MvcAsyncDemo/MvcAsyncDemo/Views/Shared/_Layout.cshtml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | @ViewBag.Title 5 | 6 | 7 | 8 | 9 | 10 |

      Cheap Flights for You

      11 | @RenderBody() 12 | 13 | 14 | -------------------------------------------------------------------------------- /MvcAsyncDemo/MvcAsyncDemo/Views/Web.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 |
      7 |
      8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 39 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /MvcAsyncDemo/MvcAsyncDemo/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "~/Views/Shared/_Layout.cshtml"; 3 | } -------------------------------------------------------------------------------- /MvcAsyncDemo/MvcAsyncDemo/Web.Debug.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 17 | 18 | 29 | 30 | -------------------------------------------------------------------------------- /MvcAsyncDemo/MvcAsyncDemo/Web.Release.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 17 | 18 | 19 | 30 | 31 | -------------------------------------------------------------------------------- /MvcAsyncDemo/MvcAsyncDemo/Web.config: -------------------------------------------------------------------------------- 1 |  2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /MvcAsyncDemo/MvcAsyncDemo/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /MvcAsyncDemo/MvcAsyncDemo/packages.config.orig: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /MvcAsyncDemo/packages/EntityFramework.4.1.10331.0/EntityFramework.4.1.10331.0.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SteveSanderson/ASP.NET-MVC-async-demos/e8ee086737919b9d94d63ac6dc92ef94ab1fb818/MvcAsyncDemo/packages/EntityFramework.4.1.10331.0/EntityFramework.4.1.10331.0.nupkg -------------------------------------------------------------------------------- /MvcAsyncDemo/packages/EntityFramework.4.1.10331.0/lib/EntityFramework.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SteveSanderson/ASP.NET-MVC-async-demos/e8ee086737919b9d94d63ac6dc92ef94ab1fb818/MvcAsyncDemo/packages/EntityFramework.4.1.10331.0/lib/EntityFramework.dll -------------------------------------------------------------------------------- /MvcAsyncDemo/packages/Modernizr.1.7/Modernizr.1.7.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SteveSanderson/ASP.NET-MVC-async-demos/e8ee086737919b9d94d63ac6dc92ef94ab1fb818/MvcAsyncDemo/packages/Modernizr.1.7/Modernizr.1.7.nupkg -------------------------------------------------------------------------------- /MvcAsyncDemo/packages/SignalR.0.1/SignalR.0.1.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SteveSanderson/ASP.NET-MVC-async-demos/e8ee086737919b9d94d63ac6dc92ef94ab1fb818/MvcAsyncDemo/packages/SignalR.0.1/SignalR.0.1.nupkg -------------------------------------------------------------------------------- /MvcAsyncDemo/packages/SignalR.0.1/lib/net40/SignalR.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SteveSanderson/ASP.NET-MVC-async-demos/e8ee086737919b9d94d63ac6dc92ef94ab1fb818/MvcAsyncDemo/packages/SignalR.0.1/lib/net40/SignalR.dll -------------------------------------------------------------------------------- /MvcAsyncDemo/packages/jQuery.1.5.1/jQuery.1.5.1.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SteveSanderson/ASP.NET-MVC-async-demos/e8ee086737919b9d94d63ac6dc92ef94ab1fb818/MvcAsyncDemo/packages/jQuery.1.5.1/jQuery.1.5.1.nupkg -------------------------------------------------------------------------------- /MvcAsyncDemo/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/images/ui-bg_flat_0_aaaaaa_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SteveSanderson/ASP.NET-MVC-async-demos/e8ee086737919b9d94d63ac6dc92ef94ab1fb818/MvcAsyncDemo/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/images/ui-bg_flat_0_aaaaaa_40x100.png -------------------------------------------------------------------------------- /MvcAsyncDemo/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/images/ui-bg_flat_75_ffffff_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SteveSanderson/ASP.NET-MVC-async-demos/e8ee086737919b9d94d63ac6dc92ef94ab1fb818/MvcAsyncDemo/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/images/ui-bg_flat_75_ffffff_40x100.png -------------------------------------------------------------------------------- /MvcAsyncDemo/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/images/ui-bg_glass_55_fbf9ee_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SteveSanderson/ASP.NET-MVC-async-demos/e8ee086737919b9d94d63ac6dc92ef94ab1fb818/MvcAsyncDemo/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/images/ui-bg_glass_55_fbf9ee_1x400.png -------------------------------------------------------------------------------- /MvcAsyncDemo/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/images/ui-bg_glass_65_ffffff_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SteveSanderson/ASP.NET-MVC-async-demos/e8ee086737919b9d94d63ac6dc92ef94ab1fb818/MvcAsyncDemo/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/images/ui-bg_glass_65_ffffff_1x400.png -------------------------------------------------------------------------------- /MvcAsyncDemo/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/images/ui-bg_glass_75_dadada_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SteveSanderson/ASP.NET-MVC-async-demos/e8ee086737919b9d94d63ac6dc92ef94ab1fb818/MvcAsyncDemo/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/images/ui-bg_glass_75_dadada_1x400.png -------------------------------------------------------------------------------- /MvcAsyncDemo/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/images/ui-bg_glass_75_e6e6e6_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SteveSanderson/ASP.NET-MVC-async-demos/e8ee086737919b9d94d63ac6dc92ef94ab1fb818/MvcAsyncDemo/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/images/ui-bg_glass_75_e6e6e6_1x400.png -------------------------------------------------------------------------------- /MvcAsyncDemo/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/images/ui-bg_glass_95_fef1ec_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SteveSanderson/ASP.NET-MVC-async-demos/e8ee086737919b9d94d63ac6dc92ef94ab1fb818/MvcAsyncDemo/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/images/ui-bg_glass_95_fef1ec_1x400.png -------------------------------------------------------------------------------- /MvcAsyncDemo/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/images/ui-bg_highlight-soft_75_cccccc_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SteveSanderson/ASP.NET-MVC-async-demos/e8ee086737919b9d94d63ac6dc92ef94ab1fb818/MvcAsyncDemo/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/images/ui-bg_highlight-soft_75_cccccc_1x100.png -------------------------------------------------------------------------------- /MvcAsyncDemo/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/images/ui-icons_222222_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SteveSanderson/ASP.NET-MVC-async-demos/e8ee086737919b9d94d63ac6dc92ef94ab1fb818/MvcAsyncDemo/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/images/ui-icons_222222_256x240.png -------------------------------------------------------------------------------- /MvcAsyncDemo/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/images/ui-icons_2e83ff_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SteveSanderson/ASP.NET-MVC-async-demos/e8ee086737919b9d94d63ac6dc92ef94ab1fb818/MvcAsyncDemo/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/images/ui-icons_2e83ff_256x240.png -------------------------------------------------------------------------------- /MvcAsyncDemo/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/images/ui-icons_454545_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SteveSanderson/ASP.NET-MVC-async-demos/e8ee086737919b9d94d63ac6dc92ef94ab1fb818/MvcAsyncDemo/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/images/ui-icons_454545_256x240.png -------------------------------------------------------------------------------- /MvcAsyncDemo/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/images/ui-icons_888888_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SteveSanderson/ASP.NET-MVC-async-demos/e8ee086737919b9d94d63ac6dc92ef94ab1fb818/MvcAsyncDemo/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/images/ui-icons_888888_256x240.png -------------------------------------------------------------------------------- /MvcAsyncDemo/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/images/ui-icons_cd0a0a_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SteveSanderson/ASP.NET-MVC-async-demos/e8ee086737919b9d94d63ac6dc92ef94ab1fb818/MvcAsyncDemo/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/images/ui-icons_cd0a0a_256x240.png -------------------------------------------------------------------------------- /MvcAsyncDemo/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/jquery.ui.accordion.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Note: While Microsoft is not the author of this file, Microsoft is 3 | * offering you a license subject to the terms of the Microsoft Software 4 | * License Terms for Microsoft ASP.NET Model View Controller 3. 5 | * Microsoft reserves all other rights. The notices below are provided 6 | * for informational purposes only and are not the license terms under 7 | * which Microsoft distributed this file. 8 | * 9 | * jQuery UI Accordion 1.8.11 10 | * 11 | * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) 12 | * 13 | * http://docs.jquery.com/UI/Accordion#theming 14 | */ 15 | /* IE/Win - Fix animation bug - #4615 */ 16 | .ui-accordion { width: 100%; } 17 | .ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; } 18 | .ui-accordion .ui-accordion-li-fix { display: inline; } 19 | .ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; } 20 | .ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em .7em; } 21 | .ui-accordion-icons .ui-accordion-header a { padding-left: 2.2em; } 22 | .ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; } 23 | .ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; zoom: 1; } 24 | .ui-accordion .ui-accordion-content-active { display: block; } 25 | -------------------------------------------------------------------------------- /MvcAsyncDemo/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/jquery.ui.all.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Note: While Microsoft is not the author of this file, Microsoft is 3 | * offering you a license subject to the terms of the Microsoft Software 4 | * License Terms for Microsoft ASP.NET Model View Controller 3. 5 | * Microsoft reserves all other rights. The notices below are provided 6 | * for informational purposes only and are not the license terms under 7 | * which Microsoft distributed this file. 8 | * 9 | * jQuery UI CSS Framework 1.8.11 10 | * 11 | * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) 12 | * 13 | * http://docs.jquery.com/UI/Theming 14 | */ 15 | @import "jquery.ui.base.css"; 16 | @import "jquery.ui.theme.css"; 17 | -------------------------------------------------------------------------------- /MvcAsyncDemo/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/jquery.ui.autocomplete.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Note: While Microsoft is not the author of this file, Microsoft is 3 | * offering you a license subject to the terms of the Microsoft Software 4 | * License Terms for Microsoft ASP.NET Model View Controller 3. 5 | * Microsoft reserves all other rights. The notices below are provided 6 | * for informational purposes only and are not the license terms under 7 | * which Microsoft distributed this file. 8 | * 9 | * jQuery UI Autocomplete 1.8.11 10 | * 11 | * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) 12 | * http://docs.jquery.com/UI/Autocomplete#theming 13 | */ 14 | .ui-autocomplete { position: absolute; cursor: default; } 15 | 16 | /* workarounds */ 17 | * html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */ 18 | 19 | /* 20 | * Note: While Microsoft is not the author of this file, Microsoft is 21 | * offering you a license subject to the terms of the Microsoft Software 22 | * License Terms for Microsoft ASP.NET Model View Controller 3. 23 | * Microsoft reserves all other rights. The notices below are provided 24 | * for informational purposes only and are not the license terms under 25 | * which Microsoft distributed this file. 26 | * 27 | * jQuery UI Menu 1.8.11 28 | * 29 | * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) 30 | * 31 | * http://docs.jquery.com/UI/Menu#theming 32 | */ 33 | .ui-menu { 34 | list-style:none; 35 | padding: 2px; 36 | margin: 0; 37 | display:block; 38 | float: left; 39 | } 40 | .ui-menu .ui-menu { 41 | margin-top: -3px; 42 | } 43 | .ui-menu .ui-menu-item { 44 | margin:0; 45 | padding: 0; 46 | zoom: 1; 47 | float: left; 48 | clear: left; 49 | width: 100%; 50 | } 51 | .ui-menu .ui-menu-item a { 52 | text-decoration:none; 53 | display:block; 54 | padding:.2em .4em; 55 | line-height:1.5; 56 | zoom:1; 57 | } 58 | .ui-menu .ui-menu-item a.ui-state-hover, 59 | .ui-menu .ui-menu-item a.ui-state-active { 60 | font-weight: normal; 61 | margin: -1px; 62 | } 63 | -------------------------------------------------------------------------------- /MvcAsyncDemo/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/jquery.ui.base.css: -------------------------------------------------------------------------------- 1 | @import url("jquery.ui.core.css"); 2 | @import url("jquery.ui.resizable.css"); 3 | @import url("jquery.ui.selectable.css"); 4 | @import url("jquery.ui.accordion.css"); 5 | @import url("jquery.ui.autocomplete.css"); 6 | @import url("jquery.ui.button.css"); 7 | @import url("jquery.ui.dialog.css"); 8 | @import url("jquery.ui.slider.css"); 9 | @import url("jquery.ui.tabs.css"); 10 | @import url("jquery.ui.datepicker.css"); 11 | @import url("jquery.ui.progressbar.css"); -------------------------------------------------------------------------------- /MvcAsyncDemo/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/jquery.ui.button.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Note: While Microsoft is not the author of this file, Microsoft is 3 | * offering you a license subject to the terms of the Microsoft Software 4 | * License Terms for Microsoft ASP.NET Model View Controller 3. 5 | * Microsoft reserves all other rights. The notices below are provided 6 | * for informational purposes only and are not the license terms under 7 | * which Microsoft distributed this file. 8 | * 9 | * jQuery UI Button 1.8.11 10 | * 11 | * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) 12 | * 13 | * http://docs.jquery.com/UI/Button#theming 14 | */ 15 | .ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */ 16 | .ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */ 17 | button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */ 18 | .ui-button-icons-only { width: 3.4em; } 19 | button.ui-button-icons-only { width: 3.7em; } 20 | 21 | /*button text element */ 22 | .ui-button .ui-button-text { display: block; line-height: 1.4; } 23 | .ui-button-text-only .ui-button-text { padding: .4em 1em; } 24 | .ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; } 25 | .ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; } 26 | .ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; } 27 | .ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; } 28 | /* no icon support for input elements, provide padding by default */ 29 | input.ui-button { padding: .4em 1em; } 30 | 31 | /*button icon element(s) */ 32 | .ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; } 33 | .ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; } 34 | .ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; } 35 | .ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; } 36 | .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; } 37 | 38 | /*button sets*/ 39 | .ui-buttonset { margin-right: 7px; } 40 | .ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; } 41 | 42 | /* workarounds */ 43 | button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */ 44 | -------------------------------------------------------------------------------- /MvcAsyncDemo/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/jquery.ui.core.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Note: While Microsoft is not the author of this file, Microsoft is 3 | * offering you a license subject to the terms of the Microsoft Software 4 | * License Terms for Microsoft ASP.NET Model View Controller 3. 5 | * Microsoft reserves all other rights. The notices below are provided 6 | * for informational purposes only and are not the license terms under 7 | * which Microsoft distributed this file. 8 | * 9 | * jQuery UI CSS Framework 1.8.11 10 | * 11 | * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) 12 | * 13 | * http://docs.jquery.com/UI/Theming/API 14 | */ 15 | 16 | /* Layout helpers 17 | ----------------------------------*/ 18 | .ui-helper-hidden { display: none; } 19 | .ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); } 20 | .ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; } 21 | .ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } 22 | .ui-helper-clearfix { display: inline-block; } 23 | /* required comment for clearfix to work in Opera \*/ 24 | * html .ui-helper-clearfix { height:1%; } 25 | .ui-helper-clearfix { display:block; } 26 | /* end clearfix */ 27 | .ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); } 28 | 29 | 30 | /* Interaction Cues 31 | ----------------------------------*/ 32 | .ui-state-disabled { cursor: default !important; } 33 | 34 | 35 | /* Icons 36 | ----------------------------------*/ 37 | 38 | /* states and images */ 39 | .ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; } 40 | 41 | 42 | /* Misc visuals 43 | ----------------------------------*/ 44 | 45 | /* Overlays */ 46 | .ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } 47 | -------------------------------------------------------------------------------- /MvcAsyncDemo/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/jquery.ui.datepicker.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Note: While Microsoft is not the author of this file, Microsoft is 3 | * offering you a license subject to the terms of the Microsoft Software 4 | * License Terms for Microsoft ASP.NET Model View Controller 3. 5 | * Microsoft reserves all other rights. The notices below are provided 6 | * for informational purposes only and are not the license terms under 7 | * which Microsoft distributed this file. 8 | * 9 | * jQuery UI Datepicker 1.8.11 10 | * 11 | * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) 12 | * 13 | * http://docs.jquery.com/UI/Datepicker#theming 14 | */ 15 | .ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; } 16 | .ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; } 17 | .ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; } 18 | .ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; } 19 | .ui-datepicker .ui-datepicker-prev { left:2px; } 20 | .ui-datepicker .ui-datepicker-next { right:2px; } 21 | .ui-datepicker .ui-datepicker-prev-hover { left:1px; } 22 | .ui-datepicker .ui-datepicker-next-hover { right:1px; } 23 | .ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; } 24 | .ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; } 25 | .ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; } 26 | .ui-datepicker select.ui-datepicker-month-year {width: 100%;} 27 | .ui-datepicker select.ui-datepicker-month, 28 | .ui-datepicker select.ui-datepicker-year { width: 49%;} 29 | .ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; } 30 | .ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; } 31 | .ui-datepicker td { border: 0; padding: 1px; } 32 | .ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; } 33 | .ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; } 34 | .ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; } 35 | .ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; } 36 | 37 | /* with multiple calendars */ 38 | .ui-datepicker.ui-datepicker-multi { width:auto; } 39 | .ui-datepicker-multi .ui-datepicker-group { float:left; } 40 | .ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; } 41 | .ui-datepicker-multi-2 .ui-datepicker-group { width:50%; } 42 | .ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; } 43 | .ui-datepicker-multi-4 .ui-datepicker-group { width:25%; } 44 | .ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; } 45 | .ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; } 46 | .ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; } 47 | .ui-datepicker-row-break { clear:both; width:100%; } 48 | 49 | /* RTL support */ 50 | .ui-datepicker-rtl { direction: rtl; } 51 | .ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; } 52 | .ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; } 53 | .ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; } 54 | .ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; } 55 | .ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; } 56 | .ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; } 57 | .ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; } 58 | .ui-datepicker-rtl .ui-datepicker-group { float:right; } 59 | .ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; } 60 | .ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; } 61 | 62 | /* IE6 IFRAME FIX (taken from datepicker 1.5.3 */ 63 | .ui-datepicker-cover { 64 | display: none; /*sorry for IE5*/ 65 | display/**/: block; /*sorry for IE5*/ 66 | position: absolute; /*must have*/ 67 | z-index: -1; /*must have*/ 68 | filter: mask(); /*must have*/ 69 | top: -4px; /*must have*/ 70 | left: -4px; /*must have*/ 71 | width: 200px; /*must have*/ 72 | height: 200px; /*must have*/ 73 | } -------------------------------------------------------------------------------- /MvcAsyncDemo/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/jquery.ui.dialog.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Note: While Microsoft is not the author of this file, Microsoft is 3 | * offering you a license subject to the terms of the Microsoft Software 4 | * License Terms for Microsoft ASP.NET Model View Controller 3. 5 | * Microsoft reserves all other rights. The notices below are provided 6 | * for informational purposes only and are not the license terms under 7 | * which Microsoft distributed this file. 8 | * 9 | * jQuery UI Dialog 1.8.11 10 | * 11 | * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) 12 | * 13 | * http://docs.jquery.com/UI/Dialog#theming 14 | */ 15 | .ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; } 16 | .ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative; } 17 | .ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .1em 0; } 18 | .ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; } 19 | .ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; } 20 | .ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; } 21 | .ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; } 22 | .ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; } 23 | .ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; } 24 | .ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; } 25 | .ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; } 26 | .ui-draggable .ui-dialog-titlebar { cursor: move; } 27 | -------------------------------------------------------------------------------- /MvcAsyncDemo/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/jquery.ui.progressbar.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Note: While Microsoft is not the author of this file, Microsoft is 3 | * offering you a license subject to the terms of the Microsoft Software 4 | * License Terms for Microsoft ASP.NET Model View Controller 3. 5 | * Microsoft reserves all other rights. The notices below are provided 6 | * for informational purposes only and are not the license terms under 7 | * which Microsoft distributed this file. 8 | * 9 | * jQuery UI Progressbar 1.8.11 10 | * 11 | * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) 12 | * 13 | * http://docs.jquery.com/UI/Progressbar#theming 14 | */ 15 | .ui-progressbar { height:2em; text-align: left; } 16 | .ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; } -------------------------------------------------------------------------------- /MvcAsyncDemo/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/jquery.ui.resizable.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Note: While Microsoft is not the author of this file, Microsoft is 3 | * offering you a license subject to the terms of the Microsoft Software 4 | * License Terms for Microsoft ASP.NET Model View Controller 3. 5 | * Microsoft reserves all other rights. The notices below are provided 6 | * for informational purposes only and are not the license terms under 7 | * which Microsoft distributed this file. 8 | * 9 | * jQuery UI Resizable 1.8.11 10 | * 11 | * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)] 12 | * 13 | * http://docs.jquery.com/UI/Resizable#theming 14 | */ 15 | .ui-resizable { position: relative;} 16 | .ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block;} 17 | .ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; } 18 | .ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; } 19 | .ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; } 20 | .ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; } 21 | .ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; } 22 | .ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; } 23 | .ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; } 24 | .ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; } 25 | .ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;} -------------------------------------------------------------------------------- /MvcAsyncDemo/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/jquery.ui.selectable.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Note: While Microsoft is not the author of this file, Microsoft is 3 | * offering you a license subject to the terms of the Microsoft Software 4 | * License Terms for Microsoft ASP.NET Model View Controller 3. 5 | * Microsoft reserves all other rights. The notices below are provided 6 | * for informational purposes only and are not the license terms under 7 | * which Microsoft distributed this file. 8 | * 9 | * jQuery UI Selectable 1.8.11 10 | * 11 | * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) 12 | * 13 | * http://docs.jquery.com/UI/Selectable#theming 14 | */ 15 | .ui-selectable-helper { position: absolute; z-index: 100; border:1px dotted black; } 16 | -------------------------------------------------------------------------------- /MvcAsyncDemo/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/jquery.ui.slider.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Note: While Microsoft is not the author of this file, Microsoft is 3 | * offering you a license subject to the terms of the Microsoft Software 4 | * License Terms for Microsoft ASP.NET Model View Controller 3. 5 | * Microsoft reserves all other rights. The notices below are provided 6 | * for informational purposes only and are not the license terms under 7 | * which Microsoft distributed this file. 8 | * 9 | * jQuery UI Slider 1.8.11 10 | * 11 | * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) 12 | * 13 | * http://docs.jquery.com/UI/Slider#theming 14 | */ 15 | .ui-slider { position: relative; text-align: left; } 16 | .ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; } 17 | .ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; } 18 | 19 | .ui-slider-horizontal { height: .8em; } 20 | .ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; } 21 | .ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; } 22 | .ui-slider-horizontal .ui-slider-range-min { left: 0; } 23 | .ui-slider-horizontal .ui-slider-range-max { right: 0; } 24 | 25 | .ui-slider-vertical { width: .8em; height: 100px; } 26 | .ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; } 27 | .ui-slider-vertical .ui-slider-range { left: 0; width: 100%; } 28 | .ui-slider-vertical .ui-slider-range-min { bottom: 0; } 29 | .ui-slider-vertical .ui-slider-range-max { top: 0; } -------------------------------------------------------------------------------- /MvcAsyncDemo/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/jquery.ui.tabs.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Note: While Microsoft is not the author of this file, Microsoft is 3 | * offering you a license subject to the terms of the Microsoft Software 4 | * License Terms for Microsoft ASP.NET Model View Controller 3. 5 | * Microsoft reserves all other rights. The notices below are provided 6 | * for informational purposes only and are not the license terms under 7 | * which Microsoft distributed this file. 8 | * 9 | * jQuery UI Tabs 1.8.11 10 | * 11 | * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) 12 | * 13 | * http://docs.jquery.com/UI/Tabs#theming 14 | */ 15 | .ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */ 16 | .ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; } 17 | .ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 1px; margin: 0 .2em 1px 0; border-bottom: 0 !important; padding: 0; white-space: nowrap; } 18 | .ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; } 19 | .ui-tabs .ui-tabs-nav li.ui-tabs-selected { margin-bottom: 0; padding-bottom: 1px; } 20 | .ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; } 21 | .ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */ 22 | .ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; } 23 | .ui-tabs .ui-tabs-hide { display: none !important; } 24 | -------------------------------------------------------------------------------- /MvcAsyncDemo/packages/jQuery.UI.Combined.1.8.11/jQuery.UI.Combined.1.8.11.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SteveSanderson/ASP.NET-MVC-async-demos/e8ee086737919b9d94d63ac6dc92ef94ab1fb818/MvcAsyncDemo/packages/jQuery.UI.Combined.1.8.11/jQuery.UI.Combined.1.8.11.nupkg -------------------------------------------------------------------------------- /MvcAsyncDemo/packages/jQuery.Validation.1.8.0/jQuery.Validation.1.8.0.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SteveSanderson/ASP.NET-MVC-async-demos/e8ee086737919b9d94d63ac6dc92ef94ab1fb818/MvcAsyncDemo/packages/jQuery.Validation.1.8.0/jQuery.Validation.1.8.0.nupkg -------------------------------------------------------------------------------- /MvcAsyncDemo/packages/jQuery.vsdoc.1.5.1/jQuery.vsdoc.1.5.1.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SteveSanderson/ASP.NET-MVC-async-demos/e8ee086737919b9d94d63ac6dc92ef94ab1fb818/MvcAsyncDemo/packages/jQuery.vsdoc.1.5.1/jQuery.vsdoc.1.5.1.nupkg -------------------------------------------------------------------------------- /MvcAsyncDemo/packages/repositories.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Demonstrates some ways of handling requests asynchronously with ASP.NET MVC and C#5's 'await' keyword. 2 | 3 | **You'll only be able to compile this code if you install the Visual Studio Async CTP (SP1 Refresh) from http://www.microsoft.com/downloads/en/details.aspx?FamilyID=4738205d-5682-47bf-b62e-641f6441735b&displaylang=en** -------------------------------------------------------------------------------- /TapExamples/AsyncCtpLibrary.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SteveSanderson/ASP.NET-MVC-async-demos/e8ee086737919b9d94d63ac6dc92ef94ab1fb818/TapExamples/AsyncCtpLibrary.dll -------------------------------------------------------------------------------- /TapExamples/FakeWebServices/FakeWebServices.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | 7 | 8 | 2.0 9 | {A83D32D5-687A-4687-AE4B-3AE0C2736881} 10 | {E53F8FEA-EAE0-44A6-8774-FFD645390401};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} 11 | Library 12 | Properties 13 | FakeWebServices 14 | FakeWebServices 15 | v4.0 16 | false 17 | false 18 | 19 | 20 | true 21 | full 22 | false 23 | bin\ 24 | DEBUG;TRACE 25 | prompt 26 | 4 27 | 28 | 29 | pdbonly 30 | true 31 | bin\ 32 | TRACE 33 | prompt 34 | 4 35 | 36 | 37 | 38 | ..\AsyncCtpLibrary.dll 39 | 40 | 41 | ..\packages\EntityFramework.4.1.10331.0\lib\EntityFramework.dll 42 | 43 | 44 | ..\packages\SignalR.0.1\lib\net40\SignalR.dll 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | Global.asax 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | Web.config 82 | 83 | 84 | Web.config 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | False 107 | False 108 | 8088 109 | / 110 | 111 | 112 | False 113 | False 114 | 115 | 116 | False 117 | 118 | 119 | 120 | 121 | -------------------------------------------------------------------------------- /TapExamples/FakeWebServices/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Codebehind="Global.asax.cs" Inherits="FakeWebServices.MvcApplication" Language="C#" %> 2 | -------------------------------------------------------------------------------- /TapExamples/FakeWebServices/Global.asax.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using System.Web.Routing; 7 | 8 | namespace FakeWebServices 9 | { 10 | // Note: For instructions on enabling IIS6 or IIS7 classic mode, 11 | // visit http://go.microsoft.com/?LinkId=9394801 12 | 13 | public class MvcApplication : System.Web.HttpApplication 14 | { 15 | public static void RegisterGlobalFilters(GlobalFilterCollection filters) 16 | { 17 | filters.Add(new HandleErrorAttribute()); 18 | } 19 | 20 | public static void RegisterRoutes(RouteCollection routes) 21 | { 22 | routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 23 | 24 | routes.MapRoute(null, "scottgu/rss.aspx", new { controller = "FakeWebService", action = "FetchData", preset = "http://weblogs.asp.net/scottgu/rss.aspx", contentType = "application/xml" }); 25 | routes.MapRoute(null, "presspass/rss/RSSFeed.aspx", new { controller = "FakeWebService", action = "FetchData", preset = "http://www.microsoft.co.uk/presspass/rss/RSSFeed.aspx", contentType = "application/xml" }); 26 | routes.MapRoute(null, "status/user_timeline/billgates.json", new { controller = "FakeWebService", action = "FetchData", preset = "http://twitter.com/status/user_timeline/billgates.json?count=10", contentType = "application/json" }); 27 | routes.MapRoute(null, "status/user_timeline/bbcnews.json", new { controller = "FakeWebService", action = "FetchData", preset = "http://twitter.com/status/user_timeline/bbcnews.json?count=6", contentType = "application/json" }); 28 | 29 | routes.MapRoute( 30 | "Default", // Route name 31 | "{controller}/{action}/{id}", // URL with parameters 32 | new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults 33 | ); 34 | 35 | } 36 | 37 | protected void Application_Start() 38 | { 39 | AreaRegistration.RegisterAllAreas(); 40 | 41 | RegisterGlobalFilters(GlobalFilters.Filters); 42 | RegisterRoutes(RouteTable.Routes); 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /TapExamples/FakeWebServices/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("FakeWebServices")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("FakeWebServices")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2011")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("2fd665a5-82cf-4ed4-a201-f04d51515de6")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Revision and Build Numbers 33 | // by using the '*' as shown below: 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /TapExamples/FakeWebServices/Web.Debug.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 17 | 18 | 29 | 30 | -------------------------------------------------------------------------------- /TapExamples/FakeWebServices/Web.Release.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 17 | 18 | 19 | 30 | 31 | -------------------------------------------------------------------------------- /TapExamples/FakeWebServices/Web.config: -------------------------------------------------------------------------------- 1 |  2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /TapExamples/FakeWebServices/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /TapExamples/TapExamples.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TapExamples", "TapExamples\TapExamples.csproj", "{2DC85A71-F57D-4CC4-AF8D-9983095918DD}" 5 | EndProject 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FakeWebServices", "FakeWebServices\FakeWebServices.csproj", "{A83D32D5-687A-4687-AE4B-3AE0C2736881}" 7 | EndProject 8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WebServices", "WebServices", "{0E533A94-F852-4597-8351-E89B11CAF792}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Release|Any CPU = Release|Any CPU 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {2DC85A71-F57D-4CC4-AF8D-9983095918DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 17 | {2DC85A71-F57D-4CC4-AF8D-9983095918DD}.Debug|Any CPU.Build.0 = Debug|Any CPU 18 | {2DC85A71-F57D-4CC4-AF8D-9983095918DD}.Release|Any CPU.ActiveCfg = Release|Any CPU 19 | {2DC85A71-F57D-4CC4-AF8D-9983095918DD}.Release|Any CPU.Build.0 = Release|Any CPU 20 | {A83D32D5-687A-4687-AE4B-3AE0C2736881}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {A83D32D5-687A-4687-AE4B-3AE0C2736881}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {A83D32D5-687A-4687-AE4B-3AE0C2736881}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {A83D32D5-687A-4687-AE4B-3AE0C2736881}.Release|Any CPU.Build.0 = Release|Any CPU 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(NestedProjects) = preSolution 29 | {A83D32D5-687A-4687-AE4B-3AE0C2736881} = {0E533A94-F852-4597-8351-E89B11CAF792} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /TapExamples/TapExamples/Content/Site.css: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------- 2 | The base color for this template is #5c87b2. If you'd like 3 | to use a different color start by replacing all instances of 4 | #5c87b2 with your new color. 5 | ----------------------------------------------------------*/ 6 | body { 7 | background-color: #5c87b2; 8 | font-size: .85em; 9 | font-family: "Trebuchet MS", Verdana, Helvetica, Sans-Serif; 10 | margin: 0; 11 | padding: 0; 12 | color: #696969; 13 | } 14 | 15 | a:link { 16 | color: #034af3; 17 | text-decoration: underline; 18 | } 19 | 20 | a:visited { 21 | color: #505abc; 22 | } 23 | 24 | a:hover { 25 | color: #1d60ff; 26 | text-decoration: none; 27 | } 28 | 29 | a:active { 30 | color: #12eb87; 31 | } 32 | 33 | p, ul { 34 | margin-bottom: 20px; 35 | line-height: 1.6em; 36 | } 37 | 38 | header, 39 | footer, 40 | nav, 41 | section { 42 | display: block; 43 | } 44 | 45 | /* HEADINGS 46 | ----------------------------------------------------------*/ 47 | h1, h2, h3, h4, h5, h6 { 48 | font-size: 1.5em; 49 | color: #000; 50 | } 51 | 52 | h1 { 53 | font-size: 2em; 54 | padding-bottom: 0; 55 | margin-bottom: 0; 56 | } 57 | 58 | h2 { 59 | padding: 0 0 10px 0; 60 | } 61 | 62 | h3 { 63 | font-size: 1.2em; 64 | } 65 | 66 | h4 { 67 | font-size: 1.1em; 68 | } 69 | 70 | h5, h6 { 71 | font-size: 1em; 72 | } 73 | 74 | /* PRIMARY LAYOUT ELEMENTS 75 | ----------------------------------------------------------*/ 76 | 77 | /* you can specify a greater or lesser percentage for the 78 | page width. Or, you can specify an exact pixel width. */ 79 | .page { 80 | width: 90%; 81 | margin-left: auto; 82 | margin-right: auto; 83 | } 84 | 85 | header, #header { 86 | position: relative; 87 | margin-bottom: 0px; 88 | color: #000; 89 | padding: 0; 90 | } 91 | 92 | header h1, #header h1 { 93 | font-weight: bold; 94 | padding: 5px 0; 95 | margin: 0; 96 | color: #fff; 97 | border: none; 98 | line-height: 2em; 99 | font-size: 32px !important; 100 | text-shadow: 1px 1px 2px #111; 101 | } 102 | 103 | #main { 104 | padding: 30px 30px 15px 30px; 105 | background-color: #fff; 106 | border-radius: 4px 0 0 0; 107 | -webkit-border-radius: 4px 0 0 0; 108 | -moz-border-radius: 4px 0 0 0; 109 | } 110 | 111 | footer, 112 | #footer { 113 | background-color: #fff; 114 | color: #999; 115 | padding: 10px 0; 116 | text-align: center; 117 | line-height: normal; 118 | margin: 0 0 30px 0; 119 | font-size: .9em; 120 | border-radius: 0 0 4px 4px; 121 | -webkit-border-radius: 0 0 4px 4px; 122 | -moz-border-radius: 0 0 4px 4px; 123 | } 124 | 125 | /* TAB MENU 126 | ----------------------------------------------------------*/ 127 | ul#menu { 128 | border-bottom: 1px #5C87B2 solid; 129 | padding: 0 0 2px; 130 | position: relative; 131 | margin: 0; 132 | text-align: right; 133 | } 134 | 135 | ul#menu li { 136 | display: inline; 137 | list-style: none; 138 | } 139 | 140 | ul#menu li#greeting { 141 | padding: 10px 20px; 142 | font-weight: bold; 143 | text-decoration: none; 144 | line-height: 2.8em; 145 | color: #fff; 146 | } 147 | 148 | ul#menu li a { 149 | padding: 10px 20px; 150 | font-weight: bold; 151 | text-decoration: none; 152 | line-height: 2.8em; 153 | background-color: #e8eef4; 154 | color: #034af3; 155 | border-radius: 4px 4px 0 0; 156 | -webkit-border-radius: 4px 4px 0 0; 157 | -moz-border-radius: 4px 4px 0 0; 158 | } 159 | 160 | ul#menu li a:hover { 161 | background-color: #fff; 162 | text-decoration: none; 163 | } 164 | 165 | ul#menu li a:active { 166 | background-color: #a6e2a6; 167 | text-decoration: none; 168 | } 169 | 170 | ul#menu li.selected a { 171 | background-color: #fff; 172 | color: #000; 173 | } 174 | 175 | /* FORM LAYOUT ELEMENTS 176 | ----------------------------------------------------------*/ 177 | 178 | fieldset { 179 | border: 1px solid #ddd; 180 | padding: 0 1.4em 1.4em 1.4em; 181 | margin: 0 0 1.5em 0; 182 | } 183 | 184 | legend { 185 | font-size: 1.2em; 186 | font-weight: bold; 187 | } 188 | 189 | textarea { 190 | min-height: 75px; 191 | } 192 | 193 | input[type="text"], 194 | input[type="password"] { 195 | border: 1px solid #ccc; 196 | padding: 2px; 197 | font-size: 1.2em; 198 | color: #444; 199 | width: 200px; 200 | } 201 | 202 | select { 203 | border: 1px solid #ccc; 204 | padding: 2px; 205 | font-size: 1.2em; 206 | color: #444; 207 | } 208 | 209 | input[type="submit"] { 210 | font-size: 1.2em; 211 | padding: 5px; 212 | } 213 | 214 | /* TABLE 215 | ----------------------------------------------------------*/ 216 | 217 | table { 218 | border: solid 1px #e8eef4; 219 | border-collapse: collapse; 220 | } 221 | 222 | table td { 223 | padding: 5px; 224 | border: solid 1px #e8eef4; 225 | } 226 | 227 | table th { 228 | padding: 6px 5px; 229 | text-align: left; 230 | background-color: #e8eef4; 231 | border: solid 1px #e8eef4; 232 | } 233 | 234 | /* MISC 235 | ----------------------------------------------------------*/ 236 | .clear { 237 | clear: both; 238 | } 239 | 240 | .error { 241 | color: Red; 242 | } 243 | 244 | nav, 245 | #menucontainer { 246 | margin-top: 40px; 247 | } 248 | 249 | div#title { 250 | display: block; 251 | float: left; 252 | text-align: left; 253 | } 254 | 255 | #logindisplay { 256 | font-size: 1.1em; 257 | display: block; 258 | text-align: right; 259 | margin: 10px; 260 | color: White; 261 | } 262 | 263 | #logindisplay a:link { 264 | color: white; 265 | text-decoration: underline; 266 | } 267 | 268 | #logindisplay a:visited { 269 | color: white; 270 | text-decoration: underline; 271 | } 272 | 273 | #logindisplay a:hover { 274 | color: white; 275 | text-decoration: none; 276 | } 277 | 278 | /* Styles for validation helpers 279 | -----------------------------------------------------------*/ 280 | .field-validation-error { 281 | color: #ff0000; 282 | } 283 | 284 | .field-validation-valid { 285 | display: none; 286 | } 287 | 288 | .input-validation-error { 289 | border: 1px solid #ff0000; 290 | background-color: #ffeeee; 291 | } 292 | 293 | .validation-summary-errors { 294 | font-weight: bold; 295 | color: #ff0000; 296 | } 297 | 298 | .validation-summary-valid { 299 | display: none; 300 | } 301 | 302 | /* Styles for editor and display helpers 303 | ----------------------------------------------------------*/ 304 | .display-label, 305 | .editor-label { 306 | margin: 1em 0 0 0; 307 | } 308 | 309 | .display-field, 310 | .editor-field { 311 | margin: 0.5em 0 0 0; 312 | } 313 | 314 | .text-box { 315 | width: 30em; 316 | } 317 | 318 | .text-box.multi-line { 319 | height: 6.5em; 320 | } 321 | 322 | .tri-state { 323 | width: 6em; 324 | } 325 | -------------------------------------------------------------------------------- /TapExamples/TapExamples/Controllers/HomeController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using TapExamples; 7 | using TapExamples.Models; 8 | using System.Net; 9 | using System.Threading.Tasks; 10 | using System.Collections.Concurrent; 11 | using System.Threading; 12 | using System.IO; 13 | using SignalR.Web; 14 | 15 | namespace TapExamples.Controllers 16 | { 17 | public class HomeController : TaskAsyncController 18 | { 19 | #region Data sources 20 | 21 | // Could be loaded from a database (asynchronously!) 22 | private ICollection _newsSources = new List { 23 | new NewsSource { Name = "Bill Gates' Twitter feed", DataFormat = DataFormat.TwitterJson, Url = "http://localhost:8088/status/user_timeline/billgates.json?count=10" }, 24 | new NewsSource { Name = "BBC News Twitter feed", DataFormat = DataFormat.TwitterJson, Url = "http://localhost:8088/status/user_timeline/bbcnews.json?count=6" }, 25 | new NewsSource { Name = "ScottGu's blog RSS feed", DataFormat = DataFormat.Rss, Url = "http://localhost:8088/scottgu/rss.aspx" }, 26 | new NewsSource { Name = "MS Press Releases RSS feed", DataFormat = DataFormat.Rss, Url = "http://localhost:8088/presspass/rss/RSSFeed.aspx" }, 27 | }; 28 | 29 | #endregion 30 | 31 | public async Task FetchAsynchronously() 32 | { 33 | var resultItems = new List(); 34 | 35 | foreach (var newsSource in _newsSources) 36 | { 37 | string rawData = await new WebClient().DownloadStringTaskAsync(newsSource.Url); 38 | resultItems.AddRange(ParserUtils.ExtractHeadlines(newsSource, rawData)); 39 | } 40 | 41 | return View("results", resultItems); 42 | } 43 | 44 | public async Task FetchAsynchronouslyParallel() 45 | { 46 | var resultItems = new List(); 47 | 48 | var allTasks = from newsSource in _newsSources 49 | select FetchHeadlinesTaskAsync(newsSource); 50 | Headline[][] results = await TaskEx.WhenAll(allTasks); 51 | 52 | return View("results", results.SelectMany(x => x)); 53 | } 54 | 55 | public async Task FetchFirstAsynchronouslyParallel() 56 | { 57 | var resultItems = new List(); 58 | 59 | var allTasks = from newsSource in _newsSources 60 | select FetchHeadlinesTaskAsync(newsSource); 61 | Task firstCompleted = await TaskEx.WhenAny(allTasks); 62 | 63 | return View("results", firstCompleted.Result); 64 | } 65 | 66 | private async Task FetchHeadlinesTaskAsync(NewsSource newsSource) 67 | { 68 | string rawData = await new WebClient().DownloadStringTaskAsync(newsSource.Url); 69 | return ParserUtils.ExtractHeadlines(newsSource, rawData); 70 | } 71 | 72 | private Task FetchStringEventually() 73 | { 74 | var completionSource = new TaskCompletionSource(); 75 | return completionSource.Task; 76 | 77 | // Later.. 78 | completionSource.SetResult("Some string"); 79 | } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /TapExamples/TapExamples/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Codebehind="Global.asax.cs" Inherits="TapExamples.MvcApplication" Language="C#" %> 2 | -------------------------------------------------------------------------------- /TapExamples/TapExamples/Global.asax.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using System.Web.Routing; 7 | using System.Net; 8 | 9 | namespace TapExamples 10 | { 11 | // Note: For instructions on enabling IIS6 or IIS7 classic mode, 12 | // visit http://go.microsoft.com/?LinkId=9394801 13 | 14 | public class MvcApplication : System.Web.HttpApplication 15 | { 16 | public static void RegisterGlobalFilters(GlobalFilterCollection filters) 17 | { 18 | filters.Add(new HandleErrorAttribute()); 19 | } 20 | 21 | public static void RegisterRoutes(RouteCollection routes) 22 | { 23 | routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 24 | 25 | routes.MapRoute( 26 | "Default", // Route name 27 | "{controller}/{action}/{id}", // URL with parameters 28 | new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults 29 | ); 30 | 31 | } 32 | 33 | protected void Application_Start() 34 | { 35 | AreaRegistration.RegisterAllAreas(); 36 | 37 | RegisterGlobalFilters(GlobalFilters.Filters); 38 | RegisterRoutes(RouteTable.Routes); 39 | 40 | // Max # concurrent outbound HTTP requests 41 | ServicePointManager.DefaultConnectionLimit = 1000; 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /TapExamples/TapExamples/Models/NewsSource.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Xml.Linq; 6 | using System.Collections; 7 | using System.Web.Script.Serialization; 8 | 9 | namespace TapExamples.Models 10 | { 11 | public enum DataFormat { Rss = 1, TwitterJson = 2 } 12 | 13 | public class NewsSource 14 | { 15 | public string Name { get; set; } 16 | public string Url { get; set; } 17 | public DataFormat DataFormat { get; set; } 18 | } 19 | 20 | public class Headline 21 | { 22 | public NewsSource Source { get; set; } 23 | public string HeadlineText { get; set; } 24 | 25 | public Headline(NewsSource source, string headlineText) 26 | { 27 | Source = source; 28 | HeadlineText = headlineText; 29 | } 30 | } 31 | 32 | public static class ParserUtils 33 | { 34 | public static Headline[] ExtractHeadlines(NewsSource newsSource, string rawData) 35 | { 36 | switch (newsSource.DataFormat) 37 | { 38 | case DataFormat.Rss: 39 | var xmlDoc = XDocument.Parse(rawData); 40 | return (from channel in xmlDoc.Root.Elements("channel") 41 | from item in channel.Elements("item") 42 | select new Headline(newsSource, item.Element("title").Value)).ToArray(); 43 | 44 | case DataFormat.TwitterJson: 45 | var javaScriptObject = (IEnumerable)new JavaScriptSerializer().DeserializeObject(rawData); 46 | return (from tweetInfo in javaScriptObject.Cast>() 47 | select new Headline(newsSource, (string)tweetInfo["text"])).ToArray(); 48 | 49 | default: 50 | return null; 51 | } 52 | } 53 | } 54 | } -------------------------------------------------------------------------------- /TapExamples/TapExamples/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("TapExamples")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("TapExamples")] 13 | [assembly: AssemblyCopyright("Copyright © 2011")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("e35c4ca4-e68f-4224-b01c-c333d833f083")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Revision and Build Numbers 33 | // by using the '*' as shown below: 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /TapExamples/TapExamples/Scripts/MicrosoftMvcAjax.js: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------- 2 | // Copyright (C) Microsoft Corporation. All rights reserved. 3 | //---------------------------------------------------------- 4 | // MicrosoftMvcAjax.js 5 | 6 | Type.registerNamespace('Sys.Mvc');Sys.Mvc.$create_AjaxOptions=function(){return {};} 7 | Sys.Mvc.InsertionMode=function(){};Sys.Mvc.InsertionMode.prototype = {replace:0,insertBefore:1,insertAfter:2} 8 | Sys.Mvc.InsertionMode.registerEnum('Sys.Mvc.InsertionMode',false);Sys.Mvc.AjaxContext=function(request,updateTarget,loadingElement,insertionMode){this.$3=request;this.$4=updateTarget;this.$1=loadingElement;this.$0=insertionMode;} 9 | Sys.Mvc.AjaxContext.prototype={$0:0,$1:null,$2:null,$3:null,$4:null,get_data:function(){if(this.$2){return this.$2.get_responseData();}else{return null;}},get_insertionMode:function(){return this.$0;},get_loadingElement:function(){return this.$1;},get_object:function(){var $0=this.get_response();return ($0)?$0.get_object():null;},get_response:function(){return this.$2;},set_response:function(value){this.$2=value;return value;},get_request:function(){return this.$3;},get_updateTarget:function(){return this.$4;}} 10 | Sys.Mvc.AsyncHyperlink=function(){} 11 | Sys.Mvc.AsyncHyperlink.handleClick=function(anchor,evt,ajaxOptions){evt.preventDefault();Sys.Mvc.MvcHelpers.$2(anchor.href,'post','',anchor,ajaxOptions);} 12 | Sys.Mvc.MvcHelpers=function(){} 13 | Sys.Mvc.MvcHelpers.$0=function($p0,$p1,$p2){if($p0.disabled){return null;}var $0=$p0.name;if($0){var $1=$p0.tagName.toUpperCase();var $2=encodeURIComponent($0);var $3=$p0;if($1==='INPUT'){var $4=$3.type;if($4==='submit'){return $2+'='+encodeURIComponent($3.value);}else if($4==='image'){return $2+'.x='+$p1+'&'+$2+'.y='+$p2;}}else if(($1==='BUTTON')&&($0.length)&&($3.type==='submit')){return $2+'='+encodeURIComponent($3.value);}}return null;} 14 | Sys.Mvc.MvcHelpers.$1=function($p0){var $0=$p0.elements;var $1=new Sys.StringBuilder();var $2=$0.length;for(var $4=0;$4<$2;$4++){var $5=$0[$4];var $6=$5.name;if(!$6||!$6.length){continue;}var $7=$5.tagName.toUpperCase();if($7==='INPUT'){var $8=$5;var $9=$8.type;if(($9==='text')||($9==='password')||($9==='hidden')||((($9==='checkbox')||($9==='radio'))&&$5.checked)){$1.append(encodeURIComponent($6));$1.append('=');$1.append(encodeURIComponent($8.value));$1.append('&');}}else if($7==='SELECT'){var $A=$5;var $B=$A.options.length;for(var $C=0;$C<$B;$C++){var $D=$A.options[$C];if($D.selected){$1.append(encodeURIComponent($6));$1.append('=');$1.append(encodeURIComponent($D.value));$1.append('&');}}}else if($7==='TEXTAREA'){$1.append(encodeURIComponent($6));$1.append('=');$1.append(encodeURIComponent(($5.value)));$1.append('&');}}var $3=$p0._additionalInput;if($3){$1.append($3);$1.append('&');}return $1.toString();} 15 | Sys.Mvc.MvcHelpers.$2=function($p0,$p1,$p2,$p3,$p4){if($p4.confirm){if(!confirm($p4.confirm)){return;}}if($p4.url){$p0=$p4.url;}if($p4.httpMethod){$p1=$p4.httpMethod;}if($p2.length>0&&!$p2.endsWith('&')){$p2+='&';}$p2+='X-Requested-With=XMLHttpRequest';var $0=$p1.toUpperCase();var $1=($0==='GET'||$0==='POST');if(!$1){$p2+='&';$p2+='X-HTTP-Method-Override='+$0;}var $2='';if($0==='GET'||$0==='DELETE'){if($p0.indexOf('?')>-1){if(!$p0.endsWith('&')){$p0+='&';}$p0+=$p2;}else{$p0+='?';$p0+=$p2;}}else{$2=$p2;}var $3=new Sys.Net.WebRequest();$3.set_url($p0);if($1){$3.set_httpVerb($p1);}else{$3.set_httpVerb('POST');$3.get_headers()['X-HTTP-Method-Override']=$0;}$3.set_body($2);if($p1.toUpperCase()==='PUT'){$3.get_headers()['Content-Type']='application/x-www-form-urlencoded;';}$3.get_headers()['X-Requested-With']='XMLHttpRequest';var $4=null;if($p4.updateTargetId){$4=$get($p4.updateTargetId);}var $5=null;if($p4.loadingElementId){$5=$get($p4.loadingElementId);}var $6=new Sys.Mvc.AjaxContext($3,$4,$5,$p4.insertionMode);var $7=true;if($p4.onBegin){$7=$p4.onBegin($6)!==false;}if($5){Sys.UI.DomElement.setVisible($6.get_loadingElement(),true);}if($7){$3.add_completed(Function.createDelegate(null,function($p1_0){ 16 | Sys.Mvc.MvcHelpers.$3($3,$p4,$6);}));$3.invoke();}} 17 | Sys.Mvc.MvcHelpers.$3=function($p0,$p1,$p2){$p2.set_response($p0.get_executor());if($p1.onComplete&&$p1.onComplete($p2)===false){return;}var $0=$p2.get_response().get_statusCode();if(($0>=200&&$0<300)||$0===304||$0===1223){if($0!==204&&$0!==304&&$0!==1223){var $1=$p2.get_response().getResponseHeader('Content-Type');if(($1)&&($1.indexOf('application/x-javascript')!==-1)){eval($p2.get_data());}else{Sys.Mvc.MvcHelpers.updateDomElement($p2.get_updateTarget(),$p2.get_insertionMode(),$p2.get_data());}}if($p1.onSuccess){$p1.onSuccess($p2);}}else{if($p1.onFailure){$p1.onFailure($p2);}}if($p2.get_loadingElement()){Sys.UI.DomElement.setVisible($p2.get_loadingElement(),false);}} 18 | Sys.Mvc.MvcHelpers.updateDomElement=function(target,insertionMode,content){if(target){switch(insertionMode){case 0:target.innerHTML=content;break;case 1:if(content&&content.length>0){target.innerHTML=content+target.innerHTML.trimStart();}break;case 2:if(content&&content.length>0){target.innerHTML=target.innerHTML.trimEnd()+content;}break;}}} 19 | Sys.Mvc.AsyncForm=function(){} 20 | Sys.Mvc.AsyncForm.handleClick=function(form,evt){var $0=Sys.Mvc.MvcHelpers.$0(evt.target,evt.offsetX,evt.offsetY);form._additionalInput = $0;} 21 | Sys.Mvc.AsyncForm.handleSubmit=function(form,evt,ajaxOptions){evt.preventDefault();var $0=form.validationCallbacks;if($0){for(var $2=0;$2<$0.length;$2++){var $3=$0[$2];if(!$3()){return;}}}var $1=Sys.Mvc.MvcHelpers.$1(form);Sys.Mvc.MvcHelpers.$2(form.action,form.method||'post',$1,form,ajaxOptions);} 22 | Sys.Mvc.AjaxContext.registerClass('Sys.Mvc.AjaxContext');Sys.Mvc.AsyncHyperlink.registerClass('Sys.Mvc.AsyncHyperlink');Sys.Mvc.MvcHelpers.registerClass('Sys.Mvc.MvcHelpers');Sys.Mvc.AsyncForm.registerClass('Sys.Mvc.AsyncForm'); 23 | // ---- Do not remove this footer ---- 24 | // Generated using Script# v0.5.0.0 (http://projects.nikhilk.net) 25 | // ----------------------------------- 26 | -------------------------------------------------------------------------------- /TapExamples/TapExamples/Scripts/jquery.unobtrusive-ajax.js: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | /*! 4 | ** Unobtrusive Ajax support library for jQuery 5 | ** Copyright (C) Microsoft Corporation. All rights reserved. 6 | */ 7 | 8 | /*jslint white: true, browser: true, onevar: true, undef: true, nomen: true, eqeqeq: true, plusplus: true, bitwise: true, regexp: true, newcap: true, immed: true, strict: false */ 9 | /*global window: false, jQuery: false */ 10 | 11 | (function ($) { 12 | var data_click = "unobtrusiveAjaxClick", 13 | data_validation = "unobtrusiveValidation"; 14 | 15 | function getFunction(code, argNames) { 16 | var fn = window, parts = (code || "").split("."); 17 | while (fn && parts.length) { 18 | fn = fn[parts.shift()]; 19 | } 20 | if (typeof (fn) === "function") { 21 | return fn; 22 | } 23 | argNames.push(code); 24 | return Function.constructor.apply(null, argNames); 25 | } 26 | 27 | function isMethodProxySafe(method) { 28 | return method === "GET" || method === "POST"; 29 | } 30 | 31 | function asyncOnBeforeSend(xhr, method) { 32 | if (!isMethodProxySafe(method)) { 33 | xhr.setRequestHeader("X-HTTP-Method-Override", method); 34 | } 35 | } 36 | 37 | function asyncOnSuccess(element, data, contentType) { 38 | var mode; 39 | 40 | if (contentType.indexOf("application/x-javascript") !== -1) { // jQuery already executes JavaScript for us 41 | return; 42 | } 43 | 44 | mode = (element.getAttribute("data-ajax-mode") || "").toUpperCase(); 45 | $(element.getAttribute("data-ajax-update")).each(function (i, update) { 46 | var top; 47 | 48 | switch (mode) { 49 | case "BEFORE": 50 | top = update.firstChild; 51 | $("
      ").html(data).contents().each(function () { 52 | update.insertBefore(this, top); 53 | }); 54 | break; 55 | case "AFTER": 56 | $("
      ").html(data).contents().each(function () { 57 | update.appendChild(this); 58 | }); 59 | break; 60 | default: 61 | $(update).html(data); 62 | break; 63 | } 64 | }); 65 | } 66 | 67 | function asyncRequest(element, options) { 68 | var confirm, loading, method, duration; 69 | 70 | confirm = element.getAttribute("data-ajax-confirm"); 71 | if (confirm && !window.confirm(confirm)) { 72 | return; 73 | } 74 | 75 | loading = $(element.getAttribute("data-ajax-loading")); 76 | duration = element.getAttribute("data-ajax-loading-duration") || 0; 77 | 78 | $.extend(options, { 79 | type: element.getAttribute("data-ajax-method") || undefined, 80 | url: element.getAttribute("data-ajax-url") || undefined, 81 | beforeSend: function (xhr) { 82 | var result; 83 | asyncOnBeforeSend(xhr, method); 84 | result = getFunction(element.getAttribute("data-ajax-begin"), ["xhr"]).apply(this, arguments); 85 | if (result !== false) { 86 | loading.show(duration); 87 | } 88 | return result; 89 | }, 90 | complete: function () { 91 | loading.hide(duration); 92 | getFunction(element.getAttribute("data-ajax-complete"), ["xhr", "status"]).apply(this, arguments); 93 | }, 94 | success: function (data, status, xhr) { 95 | asyncOnSuccess(element, data, xhr.getResponseHeader("Content-Type") || "text/html"); 96 | getFunction(element.getAttribute("data-ajax-success"), ["data", "status", "xhr"]).apply(this, arguments); 97 | }, 98 | error: getFunction(element.getAttribute("data-ajax-failure"), ["xhr", "status", "error"]) 99 | }); 100 | 101 | options.data.push({ name: "X-Requested-With", value: "XMLHttpRequest" }); 102 | 103 | method = options.type.toUpperCase(); 104 | if (!isMethodProxySafe(method)) { 105 | options.type = "POST"; 106 | options.data.push({ name: "X-HTTP-Method-Override", value: method }); 107 | } 108 | 109 | $.ajax(options); 110 | } 111 | 112 | function validate(form) { 113 | var validationInfo = $(form).data(data_validation); 114 | return !validationInfo || !validationInfo.validate || validationInfo.validate(); 115 | } 116 | 117 | $("a[data-ajax=true]").live("click", function (evt) { 118 | evt.preventDefault(); 119 | asyncRequest(this, { 120 | url: this.href, 121 | type: "GET", 122 | data: [] 123 | }); 124 | }); 125 | 126 | $("form[data-ajax=true] input[type=image]").live("click", function (evt) { 127 | var name = evt.target.name, 128 | $target = $(evt.target), 129 | form = $target.parents("form")[0], 130 | offset = $target.offset(); 131 | 132 | $(form).data(data_click, [ 133 | { name: name + ".x", value: Math.round(evt.pageX - offset.left) }, 134 | { name: name + ".y", value: Math.round(evt.pageY - offset.top) } 135 | ]); 136 | 137 | setTimeout(function () { 138 | $(form).removeData(data_click); 139 | }, 0); 140 | }); 141 | 142 | $("form[data-ajax=true] :submit").live("click", function (evt) { 143 | var name = evt.target.name, 144 | form = $(evt.target).parents("form")[0]; 145 | 146 | $(form).data(data_click, name ? [{ name: name, value: evt.target.value }] : []); 147 | 148 | setTimeout(function () { 149 | $(form).removeData(data_click); 150 | }, 0); 151 | }); 152 | 153 | $("form[data-ajax=true]").live("submit", function (evt) { 154 | var clickInfo = $(this).data(data_click) || []; 155 | evt.preventDefault(); 156 | if (!validate(this)) { 157 | return; 158 | } 159 | asyncRequest(this, { 160 | url: this.action, 161 | type: this.method || "GET", 162 | data: clickInfo.concat($(this).serializeArray()) 163 | }); 164 | }); 165 | }(jQuery)); -------------------------------------------------------------------------------- /TapExamples/TapExamples/Scripts/jquery.unobtrusive-ajax.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | ** Unobtrusive Ajax support library for jQuery 3 | ** Copyright (C) Microsoft Corporation. All rights reserved. 4 | */ 5 | (function(a){var b="unobtrusiveAjaxClick",g="unobtrusiveValidation";function c(d,b){var a=window,c=(d||"").split(".");while(a&&c.length)a=a[c.shift()];if(typeof a==="function")return a;b.push(d);return Function.constructor.apply(null,b)}function d(a){return a==="GET"||a==="POST"}function f(b,a){!d(a)&&b.setRequestHeader("X-HTTP-Method-Override",a)}function h(c,b,e){var d;if(e.indexOf("application/x-javascript")!==-1)return;d=(c.getAttribute("data-ajax-mode")||"").toUpperCase();a(c.getAttribute("data-ajax-update")).each(function(f,c){var e;switch(d){case"BEFORE":e=c.firstChild;a("
      ").html(b).contents().each(function(){c.insertBefore(this,e)});break;case"AFTER":a("
      ").html(b).contents().each(function(){c.appendChild(this)});break;default:a(c).html(b)}})}function e(b,e){var j,k,g,i;j=b.getAttribute("data-ajax-confirm");if(j&&!window.confirm(j))return;k=a(b.getAttribute("data-ajax-loading"));i=b.getAttribute("data-ajax-loading-duration")||0;a.extend(e,{type:b.getAttribute("data-ajax-method")||undefined,url:b.getAttribute("data-ajax-url")||undefined,beforeSend:function(d){var a;f(d,g);a=c(b.getAttribute("data-ajax-begin"),["xhr"]).apply(this,arguments);a!==false&&k.show(i);return a},complete:function(){k.hide(i);c(b.getAttribute("data-ajax-complete"),["xhr","status"]).apply(this,arguments)},success:function(a,e,d){h(b,a,d.getResponseHeader("Content-Type")||"text/html");c(b.getAttribute("data-ajax-success"),["data","status","xhr"]).apply(this,arguments)},error:c(b.getAttribute("data-ajax-failure"),["xhr","status","error"])});e.data.push({name:"X-Requested-With",value:"XMLHttpRequest"});g=e.type.toUpperCase();if(!d(g)){e.type="POST";e.data.push({name:"X-HTTP-Method-Override",value:g})}a.ajax(e)}function i(c){var b=a(c).data(g);return!b||!b.validate||b.validate()}a("a[data-ajax=true]").live("click",function(a){a.preventDefault();e(this,{url:this.href,type:"GET",data:[]})});a("form[data-ajax=true] input[type=image]").live("click",function(c){var g=c.target.name,d=a(c.target),f=d.parents("form")[0],e=d.offset();a(f).data(b,[{name:g+".x",value:Math.round(c.pageX-e.left)},{name:g+".y",value:Math.round(c.pageY-e.top)}]);setTimeout(function(){a(f).removeData(b)},0)});a("form[data-ajax=true] :submit").live("click",function(c){var e=c.target.name,d=a(c.target).parents("form")[0];a(d).data(b,e?[{name:e,value:c.target.value}]:[]);setTimeout(function(){a(d).removeData(b)},0)});a("form[data-ajax=true]").live("submit",function(d){var c=a(this).data(b)||[];d.preventDefault();if(!i(this))return;e(this,{url:this.action,type:this.method||"GET",data:c.concat(a(this).serializeArray())})})})(jQuery); -------------------------------------------------------------------------------- /TapExamples/TapExamples/Scripts/jquery.validate.unobtrusive.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | ** Unobtrusive validation support library for jQuery and jQuery Validate 3 | ** Copyright (C) Microsoft Corporation. All rights reserved. 4 | */ 5 | (function(a){var d=a.validator,b,f="unobtrusiveValidation";function c(a,b,c){a.rules[b]=c;if(a.message)a.messages[b]=a.message}function i(a){return a.replace(/^\s+|\s+$/g,"").split(/\s*,\s*/g)}function g(a){return a.substr(0,a.lastIndexOf(".")+1)}function e(a,b){if(a.indexOf("*.")===0)a=a.replace("*.",b);return a}function l(c,d){var b=a(this).find("[data-valmsg-for='"+d[0].name+"']"),e=a.parseJSON(b.attr("data-valmsg-replace"))!==false;b.removeClass("field-validation-valid").addClass("field-validation-error");c.data("unobtrusiveContainer",b);if(e){b.empty();c.removeClass("input-validation-error").appendTo(b)}else c.hide()}function k(e,d){var c=a(this).find("[data-valmsg-summary=true]"),b=c.find("ul");if(b&&b.length&&d.errorList.length){b.empty();c.addClass("validation-summary-errors").removeClass("validation-summary-valid");a.each(d.errorList,function(){a("
    • ").html(this.message).appendTo(b)})}}function j(c){var b=c.data("unobtrusiveContainer"),d=a.parseJSON(b.attr("data-valmsg-replace"));if(b){b.addClass("field-validation-valid").removeClass("field-validation-error");c.removeData("unobtrusiveContainer");d&&b.empty()}}function h(d){var b=a(d),c=b.data(f);if(!c){c={options:{errorClass:"input-validation-error",errorElement:"span",errorPlacement:a.proxy(l,d),invalidHandler:a.proxy(k,d),messages:{},rules:{},success:a.proxy(j,d)},attachValidation:function(){b.validate(this.options)},validate:function(){b.validate();return b.valid()}};b.data(f,c)}return c}d.unobtrusive={adapters:[],parseElement:function(b,i){var d=a(b),f=d.parents("form")[0],c,e,g;if(!f)return;c=h(f);c.options.rules[b.name]=e={};c.options.messages[b.name]=g={};a.each(this.adapters,function(){var c="data-val-"+this.name,i=d.attr(c),h={};if(i!==undefined){c+="-";a.each(this.params,function(){h[this]=d.attr(c+this)});this.adapt({element:b,form:f,message:i,params:h,rules:e,messages:g})}});jQuery.extend(e,{__dummy__:true});!i&&c.attachValidation()},parse:function(b){a(b).find(":input[data-val=true]").each(function(){d.unobtrusive.parseElement(this,true)});a("form").each(function(){var a=h(this);a&&a.attachValidation()})}};b=d.unobtrusive.adapters;b.add=function(c,a,b){if(!b){b=a;a=[]}this.push({name:c,params:a,adapt:b});return this};b.addBool=function(a,b){return this.add(a,function(d){c(d,b||a,true)})};b.addMinMax=function(e,g,f,a,d,b){return this.add(e,[d||"min",b||"max"],function(b){var e=b.params.min,d=b.params.max;if(e&&d)c(b,a,[e,d]);else if(e)c(b,g,e);else d&&c(b,f,d)})};b.addSingleVal=function(a,b,d){return this.add(a,[b||"val"],function(e){c(e,d||a,e.params[b])})};d.addMethod("__dummy__",function(){return true});d.addMethod("regex",function(b,c,d){var a;if(this.optional(c))return true;a=(new RegExp(d)).exec(b);return a&&a.index===0&&a[0].length===b.length});b.addSingleVal("accept","exts").addSingleVal("regex","pattern");b.addBool("creditcard").addBool("date").addBool("digits").addBool("email").addBool("number").addBool("url");b.addMinMax("length","minlength","maxlength","rangelength").addMinMax("range","min","max","range");b.add("equalto",["other"],function(b){var h=g(b.element.name),i=b.params.other,d=e(i,h),f=a(b.form).find(":input[name="+d+"]")[0];c(b,"equalTo",f)});b.add("required",function(a){(a.element.tagName.toUpperCase()!=="INPUT"||a.element.type.toUpperCase()!=="CHECKBOX")&&c(a,"required",true)});b.add("remote",["url","type","additionalfields"],function(b){var d={url:b.params.url,type:b.params.type||"GET",data:{}},f=g(b.element.name);a.each(i(b.params.additionalfields||b.element.name),function(h,g){var c=e(g,f);d.data[c]=function(){return a(b.form).find(":input[name='"+c+"']").val()}});c(b,"remote",d)});a(function(){d.unobtrusive.parse(document)})})(jQuery); -------------------------------------------------------------------------------- /TapExamples/TapExamples/Views/Home/Results.cshtml: -------------------------------------------------------------------------------- 1 | @model IEnumerable 2 | @{ ViewBag.Title = "Results"; } 3 | 4 |

      Results

      5 | 6 |
        7 | @foreach (var item in Model) { 8 |
      • @item.Source.Name - @item.HeadlineText
      • 9 | } 10 |
      11 | 12 | 13 | @{ var errors = (IEnumerable)ViewBag.AllErrors; } 14 | @if (errors != null) { 15 |

      Errors: @errors.Count()

      16 |
        17 | @foreach (var item in errors) { 18 |
      • @item.ToString()
      • 19 | } 20 |
      21 | } -------------------------------------------------------------------------------- /TapExamples/TapExamples/Views/Shared/Error.cshtml: -------------------------------------------------------------------------------- 1 | @model System.Web.Mvc.HandleErrorInfo 2 | 3 | @{ 4 | ViewBag.Title = "Error"; 5 | } 6 | 7 |

      8 | Sorry, an error occurred while processing your request. 9 |

      10 | -------------------------------------------------------------------------------- /TapExamples/TapExamples/Views/Shared/_Layout.cshtml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | @ViewBag.Title 5 | 6 | 7 | 8 | 9 |
      10 | 24 |
      25 | @RenderBody() 26 |
      27 | 29 |
      30 | 31 | 32 | -------------------------------------------------------------------------------- /TapExamples/TapExamples/Views/Shared/_LogOnPartial.cshtml: -------------------------------------------------------------------------------- 1 | @if(Request.IsAuthenticated) { 2 | Welcome @User.Identity.Name! 3 | [ @Html.ActionLink("Log Off", "LogOff", "Account") ] 4 | } 5 | else { 6 | @:[ @Html.ActionLink("Log On", "LogOn", "Account") ] 7 | } 8 | -------------------------------------------------------------------------------- /TapExamples/TapExamples/Views/Web.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 |
      7 |
      8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 39 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /TapExamples/TapExamples/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "~/Views/Shared/_Layout.cshtml"; 3 | } -------------------------------------------------------------------------------- /TapExamples/TapExamples/Web.Debug.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 17 | 18 | 29 | 30 | -------------------------------------------------------------------------------- /TapExamples/TapExamples/Web.Release.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 17 | 18 | 19 | 30 | 31 | -------------------------------------------------------------------------------- /TapExamples/TapExamples/Web.config: -------------------------------------------------------------------------------- 1 |  2 | 6 | 7 | 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 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 | -------------------------------------------------------------------------------- /TapExamples/TapExamples/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /TapExamples/packages/EntityFramework.4.1.10331.0/EntityFramework.4.1.10331.0.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SteveSanderson/ASP.NET-MVC-async-demos/e8ee086737919b9d94d63ac6dc92ef94ab1fb818/TapExamples/packages/EntityFramework.4.1.10331.0/EntityFramework.4.1.10331.0.nupkg -------------------------------------------------------------------------------- /TapExamples/packages/EntityFramework.4.1.10331.0/lib/EntityFramework.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SteveSanderson/ASP.NET-MVC-async-demos/e8ee086737919b9d94d63ac6dc92ef94ab1fb818/TapExamples/packages/EntityFramework.4.1.10331.0/lib/EntityFramework.dll -------------------------------------------------------------------------------- /TapExamples/packages/Modernizr.1.7/Modernizr.1.7.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SteveSanderson/ASP.NET-MVC-async-demos/e8ee086737919b9d94d63ac6dc92ef94ab1fb818/TapExamples/packages/Modernizr.1.7/Modernizr.1.7.nupkg -------------------------------------------------------------------------------- /TapExamples/packages/SignalR.0.1/SignalR.0.1.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SteveSanderson/ASP.NET-MVC-async-demos/e8ee086737919b9d94d63ac6dc92ef94ab1fb818/TapExamples/packages/SignalR.0.1/SignalR.0.1.nupkg -------------------------------------------------------------------------------- /TapExamples/packages/SignalR.0.1/lib/net40/SignalR.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SteveSanderson/ASP.NET-MVC-async-demos/e8ee086737919b9d94d63ac6dc92ef94ab1fb818/TapExamples/packages/SignalR.0.1/lib/net40/SignalR.dll -------------------------------------------------------------------------------- /TapExamples/packages/jQuery.1.5.1/jQuery.1.5.1.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SteveSanderson/ASP.NET-MVC-async-demos/e8ee086737919b9d94d63ac6dc92ef94ab1fb818/TapExamples/packages/jQuery.1.5.1/jQuery.1.5.1.nupkg -------------------------------------------------------------------------------- /TapExamples/packages/jQuery.Validation.1.8.0/jQuery.Validation.1.8.0.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SteveSanderson/ASP.NET-MVC-async-demos/e8ee086737919b9d94d63ac6dc92ef94ab1fb818/TapExamples/packages/jQuery.Validation.1.8.0/jQuery.Validation.1.8.0.nupkg -------------------------------------------------------------------------------- /TapExamples/packages/jQuery.vsdoc.1.5.1/jQuery.vsdoc.1.5.1.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SteveSanderson/ASP.NET-MVC-async-demos/e8ee086737919b9d94d63ac6dc92ef94ab1fb818/TapExamples/packages/jQuery.vsdoc.1.5.1/jQuery.vsdoc.1.5.1.nupkg -------------------------------------------------------------------------------- /TapExamples/packages/repositories.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | --------------------------------------------------------------------------------