Prototipo SIgnalR funzionante!
- usa la pagina MBC.aspx x ricevere info da qualsiasi URL e propagarli all'HUB
- da GMW si chiama un URL esterno passando parametri come get..
This commit is contained in:
Samuele Locatelli
2014-04-03 10:53:38 +02:00
parent 2688b5f854
commit 61dc11675e
14 changed files with 97 additions and 8 deletions
+8
View File
@@ -81,6 +81,7 @@
<None Include="Properties\PublishProfiles\218.pubxml" />
<None Include="Scripts\jquery-1.8.2.intellisense.js" />
<Content Include="index.html" />
<Content Include="MBC.aspx" />
<Content Include="Scripts\jquery-1.8.2.js" />
<Content Include="Scripts\jquery-1.8.2.min.js" />
<Content Include="Scripts\jquery.signalR-2.0.3.js" />
@@ -91,6 +92,13 @@
<ItemGroup>
<Compile Include="Broad.cs" />
<Compile Include="ChatHub.cs" />
<Compile Include="MBC.aspx.cs">
<DependentUpon>MBC.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="MBC.aspx.designer.cs">
<DependentUpon>MBC.aspx</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Startup.cs" />
<Compile Include="TestSend.aspx.cs">
+16
View File
@@ -0,0 +1,16 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MBC.aspx.cs" Inherits="GMW_RT.MBC" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
OK
</div>
</form>
</body>
</html>
+23
View File
@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace GMW_RT
{
public partial class MBC : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
// se ho un messaggio (mittente, messaggio) lo invio...
string mittente = Request.QueryString["mittente"];
string messaggio = Request.QueryString["messaggio"];
if (mittente != "" && messaggio != "")
{
Broad.cast.sendMess(mittente, messaggio);
}
}
}
}
+26
View File
@@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace GMW_RT
{
public partial class MBC
{
/// <summary>
/// form1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
}
}
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+20 -4
View File
@@ -6,6 +6,8 @@ using System.Web.UI;
using System.Web.UI.WebControls;
using SteamWare;
using GMW_RT;
using System.Net;
using System.IO;
namespace GMW
{
@@ -23,10 +25,24 @@ namespace GMW
}
protected void invioMessaggio()
{
Broad.cast.sendMess("GMW", txtMessage.Text.Trim());
lblMess.Text = string.Format("Messaggio inviato! {0}", txtMessage.Text.Trim());
txtMessage.Text = "";
txtMessage.Focus();
// chiamo un URL!
string answ = callUrl(string.Format(@"http://10.74.82.218/GMW-RT/MBC.aspx?mittente={0}&messaggio={1}", "GMW", txtMessage.Text.Trim()));
Response.Redirect("test");
//Broad.cast.sendMess("GMW", txtMessage.Text.Trim());
//lblMess.Text = string.Format("Messaggio inviato! {0}, risposta: {1}", txtMessage.Text.Trim(), answ);
//txtMessage.Text = "";
//txtMessage.Focus();
}
public string callUrl(string url)
{
string answ = "";
WebRequest request = HttpWebRequest.Create(url);
WebResponse response = request.GetResponse();
StreamReader reader = new StreamReader(response.GetResponseStream());
//answ = reader.ReadToEnd(); // it takes the response from your url. now you can use as your need
return answ;
}
protected void txtMessage_TextChanged(object sender, EventArgs e)
+2 -2
View File
@@ -5,7 +5,7 @@
using System.Reflection;
[assembly: AssemblyVersion("2.5.652.1552")]
[assembly: AssemblyFileVersion("2.5.652.1552")]
[assembly: AssemblyVersion("2.5.653.1553")]
[assembly: AssemblyFileVersion("2.5.653.1553")]
//[assembly: AssemblyCopyright("© Steamware 2007-2014")]
//[assembly: AssemblyCompany("Steamware")]
+2 -2
View File
@@ -6,8 +6,8 @@
using System.Reflection;
[assembly: AssemblyVersion("2.5.652.<#= this.RevisionNumber #>")]
[assembly: AssemblyFileVersion("2.5.652.<#= this.RevisionNumber #>")]
[assembly: AssemblyVersion("2.5.653.<#= this.RevisionNumber #>")]
[assembly: AssemblyFileVersion("2.5.653.<#= this.RevisionNumber #>")]
//[assembly: AssemblyCopyright("© Steamware 2007-<#= DateTime.Now.Year #>")]
//[assembly: AssemblyCompany("Steamware")]
<#+