inseriti metodi x gestione recupero della dimensione pagine
This commit is contained in:
@@ -34,6 +34,9 @@ namespace MoonProTablet
|
||||
bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
|
||||
"~/Scripts/jquery-ui-{version}.js"));
|
||||
|
||||
bundles.Add(new ScriptBundle("~/bundles/BrowserWindowSize").Include(
|
||||
"~/Scripts/BrowserWindowSize.js"));
|
||||
|
||||
//bundles.Add(new ScriptBundle("~/bundles/jqueryui-i18n").Include(
|
||||
// "~/Scripts/jquery-ui-i18n.min.js"));
|
||||
|
||||
|
||||
@@ -364,6 +364,7 @@
|
||||
<Content Include="Scripts\bootstrap.bundle.min.js" />
|
||||
<Content Include="Scripts\bootstrap.js" />
|
||||
<Content Include="Scripts\bootstrap.min.js" />
|
||||
<Content Include="Scripts\BrowserWindowSize.js" />
|
||||
<Content Include="Scripts\esm\popper-utils.js" />
|
||||
<Content Include="Scripts\esm\popper-utils.min.js" />
|
||||
<Content Include="Scripts\esm\popper.js" />
|
||||
@@ -482,6 +483,7 @@
|
||||
</None>
|
||||
<Content Include="WebMasterPages\Bootstrap.Master" />
|
||||
<Content Include="WebMasterPages\BootstrapNoUpdPnl.Master" />
|
||||
<Content Include="windowSize.ashx" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\VersGen\MoonPro.cs">
|
||||
@@ -746,6 +748,9 @@
|
||||
<Compile Include="WebUserControls\mod_turni.ascx.designer.cs">
|
||||
<DependentUpon>mod_turni.ascx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="windowSize.ashx.cs">
|
||||
<DependentUpon>windowSize.ashx</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="logs\PlaceHolder.file" />
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
// Browser windows size collector
|
||||
window.onresize = function (event) {
|
||||
SetWidthHeight();
|
||||
}
|
||||
function SetWidthHeight() {
|
||||
var height = $(window).height();
|
||||
var width = $(window).width();
|
||||
$.ajax({
|
||||
url: "../windowSize.ashx",
|
||||
data: {
|
||||
'Height': height,
|
||||
'Width': width
|
||||
},
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json"
|
||||
}).done(function (data) {
|
||||
if (data.isFirst) {
|
||||
window.location.reload();
|
||||
};
|
||||
}).fail(function (xhr) {
|
||||
alert("Problem to retrieve browser size.");
|
||||
});
|
||||
|
||||
}
|
||||
$(function () {
|
||||
SetWidthHeight();
|
||||
});
|
||||
@@ -11,7 +11,6 @@ namespace MoonProTablet
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,7 @@
|
||||
<%: Scripts.Render("~/bundles/modernizr") %>
|
||||
<%: Scripts.Render("~/bundles/jquery") %>
|
||||
<%: Scripts.Render("~/bundles/jqueryui") %>
|
||||
<%: Scripts.Render("~/bundles/BrowserWindowSize") %>
|
||||
</asp:PlaceHolder>
|
||||
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
<%: Scripts.Render("~/bundles/modernizr") %>
|
||||
<%: Scripts.Render("~/bundles/jquery") %>
|
||||
<%: Scripts.Render("~/bundles/jqueryui") %>
|
||||
<%: Scripts.Render("~/bundles/BrowserWindowSize") %>
|
||||
</asp:PlaceHolder>
|
||||
<webopt:BundleReference ID="BundleReference1" runat="server" Path="~/Content/css" />
|
||||
<webopt:BundleReference ID="BundleReference2" runat="server" Path="~/Content/themes/base/css" />
|
||||
@@ -68,7 +69,7 @@
|
||||
<strong>MPTAB</strong> -
|
||||
v.<%: currVersion.ToString() %> | <%: DateTime.Now %></div>
|
||||
<div class="d-flex justify-content-center text-center">
|
||||
<%: System.Web.Configuration.WebConfigurationManager.AppSettings["Environment"] %>
|
||||
<%: System.Web.Configuration.WebConfigurationManager.AppSettings["Environment"] %> | <%: videoSize %>
|
||||
</div>
|
||||
<div class="d-flex justify-content-end pr-3 text-right">
|
||||
Powered by <strong>Steamware</strong> s.r.l. - © 2007-<%: DateTime.Now.Year %></div>
|
||||
|
||||
@@ -42,5 +42,20 @@ namespace WebMasterPages
|
||||
private void updateLabels()
|
||||
{
|
||||
}
|
||||
/// <summary>
|
||||
/// Dimensione schermata video attuale
|
||||
/// </summary>
|
||||
public string videoSize
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "?x?";
|
||||
if (Session["BrowserWidth"] != null)
|
||||
{
|
||||
answ = string.Format("{0} x {1}", Session["BrowserWidth"], Session["BrowserHeight"]);
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@
|
||||
v.<%: currVersion.ToString() %> | <asp:Label runat="server" ID="lblDT" Font-Size="0.7em"><%: DateTime.Now %></asp:Label>
|
||||
</div>
|
||||
<div class="d-flex justify-content-center text-center align-self-center">
|
||||
<%: System.Web.Configuration.WebConfigurationManager.AppSettings["Environment"] %>
|
||||
<%: System.Web.Configuration.WebConfigurationManager.AppSettings["Environment"] %> | <%: videoSize %>
|
||||
</div>
|
||||
<div class="d-flex justify-content-end pr-3 text-right align-self-center">
|
||||
Powered by
|
||||
|
||||
@@ -24,5 +24,20 @@ namespace MoonProTablet.WebUserControls
|
||||
private void updateLabels()
|
||||
{
|
||||
}
|
||||
/// <summary>
|
||||
/// Dimensione schermata video attuale
|
||||
/// </summary>
|
||||
public string videoSize
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "?x?";
|
||||
if (Session["BrowserWidth"] != null)
|
||||
{
|
||||
answ = string.Format("{0} x {1}", Session["BrowserWidth"], Session["BrowserHeight"]);
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<%@ WebHandler Language="C#" CodeBehind="windowSize.ashx.cs" Class="MoonProTablet.windowSize" %>
|
||||
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace MoonProTablet
|
||||
{
|
||||
/// <summary>
|
||||
/// Descrizione di riepilogo per windowSize
|
||||
/// vedere https://techbrij.com/browser-height-width-server-responsive-design-asp-net
|
||||
/// </summary>
|
||||
public class windowSize : IHttpHandler, System.Web.SessionState.IRequiresSessionState
|
||||
{
|
||||
/// <summary>
|
||||
/// Processa la richeista andando a recuperare width-height del browser
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
public void ProcessRequest(HttpContext context)
|
||||
{
|
||||
context.Response.ContentType = "application/json";
|
||||
|
||||
var json = new System.Web.Script.Serialization.JavaScriptSerializer();
|
||||
var output = json.Serialize(new { isFirst = context.Session["BrowserWidth"] == null });
|
||||
context.Response.Write(output);
|
||||
|
||||
context.Session["BrowserWidth"] = context.Request.QueryString["Width"];
|
||||
context.Session["BrowserHeight"] = context.Request.QueryString["Height"];
|
||||
// modificare: salvare in REDIS come conteggio... poi emttere in ABOUT PAGE il resoconto dei conteggi...
|
||||
}
|
||||
|
||||
public bool IsReusable
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user