diff --git a/.bowerrc b/.bowerrc new file mode 100644 index 0000000..78d4e9d --- /dev/null +++ b/.bowerrc @@ -0,0 +1,3 @@ +{ + "directory": "wwwroot/lib" +} diff --git a/.gitignore/.gitignore b/.gitignore similarity index 99% rename from .gitignore/.gitignore rename to .gitignore index 940794e..c472ce5 100644 --- a/.gitignore/.gitignore +++ b/.gitignore @@ -286,3 +286,7 @@ __pycache__/ *.btm.cs *.odx.cs *.xsd.cs + +.vscode/ +.node_modules/ +wwwroot/lib/ \ No newline at end of file diff --git a/Chat.cs b/Chat.cs new file mode 100644 index 0000000..ecfb6ad --- /dev/null +++ b/Chat.cs @@ -0,0 +1,13 @@ +using System.Threading.Tasks; +using Microsoft.AspNetCore.SignalR; + +namespace SignalRYo +{ + public class Chat : Hub + { + public Task Send(string message) + { + return Clients.All.InvokeAsync("Send", "From Server " + message); + } + } +} \ No newline at end of file diff --git a/Controllers/HomeController.cs b/Controllers/HomeController.cs new file mode 100644 index 0000000..97ae109 --- /dev/null +++ b/Controllers/HomeController.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using SignalRYo.Models; + +namespace SignalRYo.Controllers +{ + public class HomeController : Controller + { + public IActionResult Index() + { + return View(); + } + + public IActionResult About() + { + ViewData["Message"] = "Your application description page."; + + return View(); + } + + public IActionResult Contact() + { + ViewData["Message"] = "Your contact page."; + + return View(); + } + + public IActionResult Error() + { + return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier }); + } + } +} diff --git a/Models/ErrorViewModel.cs b/Models/ErrorViewModel.cs new file mode 100644 index 0000000..b4a87ec --- /dev/null +++ b/Models/ErrorViewModel.cs @@ -0,0 +1,11 @@ +using System; + +namespace SignalRYo.Models +{ + public class ErrorViewModel + { + public string RequestId { get; set; } + + public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); + } +} \ No newline at end of file diff --git a/Program.cs b/Program.cs new file mode 100644 index 0000000..55c9385 --- /dev/null +++ b/Program.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Logging; + +namespace SignalRYo +{ + public class Program + { + public static void Main(string[] args) + { + BuildWebHost(args).Run(); + } + + public static IWebHost BuildWebHost(string[] args) => + WebHost.CreateDefaultBuilder(args) + .UseStartup() + .Build(); + } +} diff --git a/Readme.md b/Readme.md new file mode 100644 index 0000000..7e66211 --- /dev/null +++ b/Readme.md @@ -0,0 +1,25 @@ +Messing about with signalr. Just for myself, here are some notes....carry on! + +```sh +dotnet new mvc --name SignalRYo --auth None +dotnet add package Microsoft.AspNetCore.SignalR --version 1.0.0-alpha1-final +npm init +npm install --save @aspnet/signalr-client + +``` + +add to csproj + +``xml + + + + + + + + + +``` + +Created Chat.cs, added some js to the home page \ No newline at end of file diff --git a/SignalRYo.csproj b/SignalRYo.csproj new file mode 100644 index 0000000..59c78a4 --- /dev/null +++ b/SignalRYo.csproj @@ -0,0 +1,19 @@ + + + netcoreapp2.0 + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Startup.cs b/Startup.cs new file mode 100644 index 0000000..9c0f23e --- /dev/null +++ b/Startup.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; + +namespace SignalRYo +{ + public class Startup + { + public Startup(IConfiguration configuration) + { + Configuration = configuration; + } + + public IConfiguration Configuration { get; } + + // This method gets called by the runtime. Use this method to add services to the container. + public void ConfigureServices(IServiceCollection services) + { + services.AddMvc(); + services.AddSignalR(); + } + + // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. + public void Configure(IApplicationBuilder app, IHostingEnvironment env) + { + if (env.IsDevelopment()) + { + app.UseDeveloperExceptionPage(); + } + else + { + app.UseExceptionHandler("/Home/Error"); + } + + app.UseStaticFiles(); + app.UseSignalR(routes => { + routes.MapHub("chat"); + }); + app.UseMvc(routes => + { + routes.MapRoute( + name: "default", + template: "{controller=Home}/{action=Index}/{id?}"); + }); + } + } +} diff --git a/Views/Home/About.cshtml b/Views/Home/About.cshtml new file mode 100644 index 0000000..d6c9ce5 --- /dev/null +++ b/Views/Home/About.cshtml @@ -0,0 +1,7 @@ +@{ + ViewData["Title"] = "About"; +} +

@ViewData["Title"]

+

@ViewData["Message"]

+ +

Use this area to provide additional information.

diff --git a/Views/Home/Contact.cshtml b/Views/Home/Contact.cshtml new file mode 100644 index 0000000..57b40cc --- /dev/null +++ b/Views/Home/Contact.cshtml @@ -0,0 +1,17 @@ +@{ + ViewData["Title"] = "Contact"; +} +

@ViewData["Title"]

+

@ViewData["Message"]

+ +
+ One Microsoft Way
+ Redmond, WA 98052-6399
+ P: + 425.555.0100 +
+ +
+ Support: Support@example.com
+ Marketing: Marketing@example.com +
diff --git a/Views/Home/Index.cshtml b/Views/Home/Index.cshtml new file mode 100644 index 0000000..0f99d59 --- /dev/null +++ b/Views/Home/Index.cshtml @@ -0,0 +1,122 @@ +@{ + ViewData["Title"] = "Home Page"; +} + + + +
+
+

Application uses

+
    +
  • Sample pages using ASP.NET Core MVC
  • +
  • Bower for managing client-side libraries
  • +
  • Theming using Bootstrap
  • +
+
+ + + + @section Scripts { + + + } + +
diff --git a/Views/Shared/Error.cshtml b/Views/Shared/Error.cshtml new file mode 100644 index 0000000..75e2d51 --- /dev/null +++ b/Views/Shared/Error.cshtml @@ -0,0 +1,22 @@ +@model ErrorViewModel +@{ + ViewData["Title"] = "Error"; +} + +

Error.

+

An error occurred while processing your request.

+ +@if (Model.ShowRequestId) +{ +

+ Request ID: @Model.RequestId +

+} + +

Development Mode

+

+ Swapping to Development environment will display more detailed information about the error that occurred. +

+

+ Development environment should not be enabled in deployed applications, as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the ASPNETCORE_ENVIRONMENT environment variable to Development, and restarting the application. +

diff --git a/Views/Shared/_Layout.cshtml b/Views/Shared/_Layout.cshtml new file mode 100644 index 0000000..3f84824 --- /dev/null +++ b/Views/Shared/_Layout.cshtml @@ -0,0 +1,71 @@ + + + + + + @ViewData["Title"] - SignalRYo + + + + + + + + + + + + +
+ @RenderBody() +
+
+

© 2017 - SignalRYo

+
+
+ + + + + + + + + + + + + @RenderSection("Scripts", required: false) + + diff --git a/Views/Shared/_ValidationScriptsPartial.cshtml b/Views/Shared/_ValidationScriptsPartial.cshtml new file mode 100644 index 0000000..3a13d89 --- /dev/null +++ b/Views/Shared/_ValidationScriptsPartial.cshtml @@ -0,0 +1,18 @@ + + + + + + + + diff --git a/Views/_ViewImports.cshtml b/Views/_ViewImports.cshtml new file mode 100644 index 0000000..04d42ac --- /dev/null +++ b/Views/_ViewImports.cshtml @@ -0,0 +1,3 @@ +@using SignalRYo +@using SignalRYo.Models +@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers diff --git a/Views/_ViewStart.cshtml b/Views/_ViewStart.cshtml new file mode 100644 index 0000000..6e88aa3 --- /dev/null +++ b/Views/_ViewStart.cshtml @@ -0,0 +1,3 @@ +@{ + Layout = "_Layout"; +} diff --git a/appsettings.Development.json b/appsettings.Development.json new file mode 100644 index 0000000..f334029 --- /dev/null +++ b/appsettings.Development.json @@ -0,0 +1,10 @@ +{ + "Logging": { + "IncludeScopes": false, + "LogLevel": { + "Default": "Debug", + "System": "Information", + "Microsoft": "Information" + } + } +} diff --git a/appsettings.json b/appsettings.json new file mode 100644 index 0000000..5766595 --- /dev/null +++ b/appsettings.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "IncludeScopes": false, + "LogLevel": { + "Default": "Warning" + } + } +} diff --git a/bower.json b/bower.json new file mode 100644 index 0000000..f8f4302 --- /dev/null +++ b/bower.json @@ -0,0 +1,10 @@ +{ + "name": "asp.net", + "private": true, + "dependencies": { + "bootstrap": "3.3.7", + "jquery": "2.2.0", + "jquery-validation": "1.14.0", + "jquery-validation-unobtrusive": "3.2.6" + } +} diff --git a/bundleconfig.json b/bundleconfig.json new file mode 100644 index 0000000..c09bf8e --- /dev/null +++ b/bundleconfig.json @@ -0,0 +1,24 @@ +// Configure bundling and minification for the project. +// More info at https://go.microsoft.com/fwlink/?LinkId=808241 +[ + { + "outputFileName": "wwwroot/css/site.min.css", + // An array of relative input file paths. Globbing patterns supported + "inputFiles": [ + "wwwroot/css/site.css" + ] + }, + { + "outputFileName": "wwwroot/js/site.min.js", + "inputFiles": [ + "wwwroot/js/site.js" + ], + // Optionally specify minification options + "minify": { + "enabled": true, + "renameLocals": true + }, + // Optionally generate .map file + "sourceMap": false + } +] diff --git a/package.json b/package.json new file mode 100644 index 0000000..ebac581 --- /dev/null +++ b/package.json @@ -0,0 +1,14 @@ +{ + "name": "signalryo", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "ISC", + "dependencies": { + "@aspnet/signalr-client": "^1.0.0-alpha2-final" + } +} diff --git a/wwwroot/css/site.css b/wwwroot/css/site.css new file mode 100644 index 0000000..a30e58d --- /dev/null +++ b/wwwroot/css/site.css @@ -0,0 +1,35 @@ +body { + padding-top: 50px; + padding-bottom: 20px; +} + +/* Wrapping element */ +/* Set some basic padding to keep content from hitting the edges */ +.body-content { + padding-left: 15px; + padding-right: 15px; +} + +/* Carousel */ +.carousel-caption p { + font-size: 20px; + line-height: 1.4; +} + +/* Make .svg files in the carousel display properly in older browsers */ +.carousel-inner .item img[src$=".svg"] { + width: 100%; +} + +/* QR code generator */ +#qrCode { + margin: 15px; +} + +/* Hide/rearrange for smaller screens */ +@media screen and (max-width: 767px) { + /* Hide captions */ + .carousel-caption { + display: none; + } +} diff --git a/wwwroot/css/site.min.css b/wwwroot/css/site.min.css new file mode 100644 index 0000000..5e93e30 --- /dev/null +++ b/wwwroot/css/site.min.css @@ -0,0 +1 @@ +body{padding-top:50px;padding-bottom:20px}.body-content{padding-left:15px;padding-right:15px}.carousel-caption p{font-size:20px;line-height:1.4}.carousel-inner .item img[src$=".svg"]{width:100%}#qrCode{margin:15px}@media screen and (max-width:767px){.carousel-caption{display:none}} \ No newline at end of file diff --git a/wwwroot/favicon.ico b/wwwroot/favicon.ico new file mode 100644 index 0000000..a3a7999 Binary files /dev/null and b/wwwroot/favicon.ico differ diff --git a/wwwroot/images/banner1.svg b/wwwroot/images/banner1.svg new file mode 100644 index 0000000..1ab32b6 --- /dev/null +++ b/wwwroot/images/banner1.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/wwwroot/images/banner2.svg b/wwwroot/images/banner2.svg new file mode 100644 index 0000000..9679c60 --- /dev/null +++ b/wwwroot/images/banner2.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/wwwroot/images/banner3.svg b/wwwroot/images/banner3.svg new file mode 100644 index 0000000..9be2c25 --- /dev/null +++ b/wwwroot/images/banner3.svg @@ -0,0 +1 @@ +banner3b \ No newline at end of file diff --git a/wwwroot/images/banner4.svg b/wwwroot/images/banner4.svg new file mode 100644 index 0000000..38b3d7c --- /dev/null +++ b/wwwroot/images/banner4.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/wwwroot/js/site.js b/wwwroot/js/site.js new file mode 100644 index 0000000..0f3411a --- /dev/null +++ b/wwwroot/js/site.js @@ -0,0 +1 @@ +// Write your JavaScript code. diff --git a/wwwroot/js/site.min.js b/wwwroot/js/site.min.js new file mode 100644 index 0000000..e69de29