Phaser game library with javascript and VS 2013 web express - asp.net-mvc

So I'm totally new to the Phaser game library and I'm trying to setup a project using VS 2013 web express in a MVC project. I'm wanting to use javascript (not typescript) and I'm assuming I can just use the IISExpress web service that VS creates when it starts. Most of the tutorials I've seen talk about getting apache setup, but I'd prefer to just use IISExpress when I click run from VS as it's just easier because I don't have to do anything.
So I added phaser to my project. It complained about pixi. So I added pixi to my project, and when I have the following line I get the following error:
var game = new Phaser.Game(500, 600, Phaser.AUTO, 'game_div');
"JavaScript runtime error: Object doesn't support this action"
Is my setup of Phaser OK? Can I not use IISExpress from VS to run phaser?
My Index.cshtml is
#section scripts{
<script src="~/Scripts/pixi/Pixi.js"></script>
<script src="~/Scripts/phaser/src/Phaser.js"></script>
<script src="~/Scripts/main.js"></script>
}
<div id="game_div">
</div>

Related

Incorporating Blazor custom elements into an ASP.NET MVC application

I am interested in using custom elements as a means of strangling a legacy ASP.NET MVC website so that I can gradually port it to Blazor. However apart from the official documents, here I can't find any decent documentation. So it may be that I have misunderstood this technology. What I would like to do is create a Blazor WASM component called HelloWorldComponent, like so:
<p>Hello, world!</p>
And register this custom element in Program.cs like so:
builder.RootComponents.RegisterCustomElement<HelloWorldComponent>("hello-world");
And then in a separate ASP.NET MVC project use this component in a view, like so:
#{
ViewData["Title"] = "Home Page";
}
<hello-world />
Is this possible? And if so how do I reference the Blazor custom element within the ASP.NET MVC app?
You are missing some steps:
You have to publish the blazor wasm stand-alone project to generate the bin folder.
Copy the bin/xx/net7.0 subfolders to the old app on the root of your content folder (_framework, _content, etc)
On your old app you have to add some lines to the html layout to load the blazor component (also resources if needed (css/js/etc)):
<script src="_framework/blazor.webassembly.js"></script>
<script src="_content/Microsoft.AspNetCore.Components.CustomElements/BlazorCustomElements.js"></script>
Must been added before the html body end
There is another option to use Blazor without using web component as I explain in the following link
https://medium.com/#santiagoc_33226/using-blazor-wasm-with-net-framework-mvc-or-another-old-external-site-7fc0884fcfca
I am interested in using custom elements as a means of strangling a
legacy ASP.NET MVC website so that I can gradually port it to Blazor.
Well, you are certainly misunderstanding the compatibility version between blazor web assembly and asp.net MVC app.
Currently,Blazor WebAssembly Integration supports ASP.NET Core in .NET 5 or later. Thus, your legacy application will encounter compatibility issue.
Note: For more details you can have a look our official document here.
In addition, for asp.net core and blazor server and web assembly app integration you could check these official document that might be resourceful.

Determine which Kendo UI version and product I"m working with

I've started as a new dev in a team where all previous devs have left and as usual it's not easy to find information.
The project is asp.net MVC 4.
There is a reference to a dll : Kendo.Mvc.dll
The project has the following script files:
kendo.aspnetmvc.min
kendo.core.min
kendo.data.min
kendo.data.odata.min
kendo.data.xml.min
kendo.grid.min
kendo.web.min
And also includes jquery and jquery-ui (1.10).
Question:
How do I know if the product was purchased or the kind of licence this is ? (all dependencies have been put into source control, I can't find any obvious key file or something like that in the config).
How do I know which version of the product it is ? (this one I think I've got the answer, the DLL version says: 2013.2.xxx so that's probably it)
Where can I download the old versions of the scripts ?
I'm very confused about the state of those components. It seems like Telerik acquired Kendo a while ago and this project has old version.
Thanks
Yes, the DLL version is the Kendo UI version (or more precisely, the UI for ASP.NET MVC version). In more recent versions, the DLL description explicitly states if it is a trial version or not.
In addition, Kendo UI JavaScript files and CSS files have their version in a comment at the top of the file contents, e.g.
http://kendo.cdn.telerik.com/2016.3.914/styles/kendo.common.min.css
/**
* Kendo UI v2016.3.914 (http://www.telerik.com/kendo-ui)
* Copyright 2016 Telerik AD. All rights reserved.
Another possible way to check the scripts version in the web application or browser console is via kendo.version - the API docs also explains the meaning of the version number.
The DLL version should always match the version of the JavaScript and CSS files (except the last part of the DLL version, which is related to the ASP.NET MVC version).
It seems like Telerik acquired Kendo a while ago
Kendo UI has always been a product of Telerik.
It is possible to download previous versions' installers from telerik.com if you have the email for account that has held the commercial license.
you can print it in the console
<!-- Telerik KendoUI Default v2 CDN 2019 -->
<link href="https://kendo.cdn.telerik.com/2019.2.619/styles/kendo.common-empty.min.css" rel="stylesheet-disabled" />
<link href="https://kendo.cdn.telerik.com/2019.2.619/styles/kendo.rtl.min.css" rel="stylesheet-disabled" />
<link href="https://kendo.cdn.telerik.com/2019.2.619/styles/kendo.default-v2.min.css" rel="stylesheet" />
<link href="https://kendo.cdn.telerik.com/2019.2.619/styles/kendo.default-v2.mobile.min.css" rel="stylesheet-disabled" />
<!-- jQuery -->
<script src="/scripts/jquery/jquery-3.4.1.min.js"></script>
<script>
// Print jQuery, kendoUI version
$(document).ready(function(){
console.log('Detected jQuery version: %o', $().jquery);
console.log('Detected Telerik KendoUI version: %o', kendo.version);
});
</script>
The version is indeed in the DLL.
Missing scripts can be found and downloaded from cdn.kendostatic.com
Only mistery remaining is the licence... not sure it's worth investigating.

Tutorial: Server Broadcast with SignalR 2

I read this excellent tutorial : http://www.asp.net/signalr/overview/getting-started/tutorial-server-broadcast-with-signalr.
I then downloaded the NuGet example package Microsoft.AspNet.SignalR.Sample 2.2.0 (https://www.nuget.org/packages/microsoft.aspnet.signalr.sample), and then I created new asp.net mvc 5 project with vs 2015 with an index page.
I assume that app.MapSignalR() is called in the Startup.Configuration method.
Like lots of people I got the error: ticker.client is undefined.
The real problem is the var ticker = $.connection.stockTicker, is always null because $.connection has no stockTicker property defined - because the hub can't instantiate it.
Does anybody know the reason for this error?
The orignial tutorial is http://www.asp.net/signalr/overview/getting-started/tutorial-server-broadcast-with-signalr I hosted my sample project zip to my open onedrive : https://onedrive.live.com/embed?cid=11357B31E08CCFEE&resid=11357B31E08CCFEE%21107&authkey=ALMOtmTFdCdsyV8
The "SignalR.Sample" directory content in the solution is the basic Template to integrate in asp.net mvc 4/5/6 project. So I integrate it in Views/Home/Index.cshtml page. Js refernces are in file Views/Shared/_Layout.cshtml .
Exact problem is var ticker = $.connection.stockTicker is null (no initialize connection done with the server).
If you can help me, i thank you.
Yes, you added the jQuery and Stockticker scripts in your _Layout, but you didn't add the signalr/hubs. The scripts must be loaded in this exact order:
<script src="~/Scripts/jquery.signalR-2.2.0.js"></script>
<script src="~/signalr/hubs"></script>
<script src="~/Scripts/SignalR.StockTicker.js"></script>
Reference:
ASP.NET SignalR Hubs API Guide - JavaScript Client
Make sure that the JavaScript file references in StockTicker.html are correct. That is, make sure that the jQuery version in your script tag (1.10.2 in the example) is the same as the jQuery version in your project's Scripts folder, and make sure that the SignalR version in your script tag is the same as the SignalR version in your project's Scripts folder. Change the file names in the script tags if necessary.
Make sure you have Any CPU as your active solution platform. I switched it to x64 and that made it so SignalR could not load since it had an incorrect platform.

PhoneGap asp.net MVC 4 network error

I publish my asp.net MVC project with visual studio then zip it and upload (with default page index.html )to build.phonegap.com it build project without errors.Then i download .apk but when store to my android mobile devices it gives this error what should i do?
this is my published project folder
folder
this is error : error
this is my index.html code
<html>
<head>
<script language="javascript">
window.location.href = "Home/Index"
</head>
<body>
</body>
</html>
Phonegap expects only html. You can't upload asp.net (or any other technology for that matter) project and expect it to work.
I suggest reading the documentation, starting here: https://build.phonegap.com/docs/preparing-your-app

jquery not working in asp.net mvc after publishing to server

I've built an mvc application which contains some jquery code. When I run the app from my ide, everything works perfectly. When I publish to the server and open the page, the jquery does not work. I get object expected errors.
Could this be due to my file mappings? here is a sample of my mapping in the app -
<script type="text/javascript" href="../../Scripts/jquery-1.3.2.js"></script>
I published the app to iis7 successfully, but the jquery is broken. I did publish to an application within an existing web site.
Any thoughts?
You may be experiencing problems with your relative path.
You can try this, which is a path from the application root:
<script type="text/javascript" href="/Scripts/jquery-1.3.2.js"></script>
Or this C# solution:
<script src="<%= Url.Content("~/Scripts/jquery-1.3.2.js") %>" type="text/javascript"></script>

Resources