This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
using System.Web.Mvc; | |
using JSONPhoneApp1.Web.Models; | |
public class TeamController : Controller | |
{ | |
// Our Team data; fake data is loaded in the constructor. | |
private static TeamRepository _teams = new TeamRepository(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Serializer loader | |
$extAssembly = [Reflection.Assembly]::LoadWithPartialName("System.Web.Extensions") | |
$serializer = New-Object System.Web.Script.Serialization.JavaScriptSerializer | |
# Url's formatted | |
$gistUserListUrlForm = "http://gist.github.com/api/v1/json/gists/{0}"; | |
$gistInfoUrlForm = "http://gist.github.com/api/v1/json/{0}"; | |
$gistContentsUrlForm = "http://gist.github.com/raw/{0}/{1}"; | |
# Json downloader |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
/// <summary> | |
/// Our Hello response object; /Index action | |
/// </summary> | |
public class HelloWorldResponse | |
{ | |
public bool Success { get; set; } | |
public DateTime Time { get; set; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
public class HelloWorldService : JsonService<HelloWorldResponse> | |
{ | |
private static string Url = "http://localhost:59527/Team"; | |
public void GetHello(Action<HelloWorldResponse> onResult, Action<Exception> onError) | |
{ | |
StartServiceCall(Url, onResult, onError); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Windows; | |
using System.Windows.Input; | |
using System.Collections.ObjectModel; | |
using System.Collections.Generic; | |
#region TeamServices | |
/// <summary> | |
/// Our Hello response object; /Index action |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Original code by Joachim Lykke Andersen; http://devtalk.dk/2011/02/16/Workaround+EF+Code+First+On+AppHabour.aspx | |
using System.Data.Entity; | |
using System.Data.Entity.Database; | |
using System.Data.Entity.Design; | |
using System.Data.Entity.Infrastructure; | |
using System.Data.Metadata.Edm; | |
using System.Data.Objects; | |
using System.Globalization; | |
using System.Linq; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Web.MVC | |
public class ChatController : AsyncController | |
{ | |
[AsyncTimeout(ChatServer.MaxWaitSeconds * 1002)] | |
public void IndexAsync() | |
{ | |
AsyncManager.OutstandingOperations.Increment(); | |
ChatServer.CheckForMessagesAsync(msgs => |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Threading; | |
public class ChatResponse | |
{ | |
public List<MessageInfo> messages { get; set; } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@model MotherEffinChatSite.Models.HomeVM | |
@{ | |
Page.Title = "MVC Chat Example"; | |
} | |
@section ScriptSection { | |
<!-- The new message template... TODO: make it sexy --> | |
<script id="msgTmpl" type="text/x-jquery-tmpl"> | |
<li><p style="margin-bottom:-2px; color: black;"><strong>${user.name}</strong></p><p>${message}</p></li> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Author: | |
Jacob Gable, http://jacob4u2.posterous.com | |
License: | |
MS-PL | |
*/ | |
jQuery.any = function (collection, compareFunc) { | |
if (!$.isArray(collection) || !$.isFunction(compareFunc)) { | |
return false; | |
} |