Skip to content

Commit

Permalink
[azure] update iOS (remove 'Task')
Browse files Browse the repository at this point in the history
  • Loading branch information
conceptdev committed Aug 30, 2014
1 parent b96f732 commit 7f91ca6
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 20 deletions.
22 changes: 11 additions & 11 deletions Azure/iOS/Core/AzureWebService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ public static class AzureWebService
/// <summary>
/// GET /tables/TodoItem
/// </summary>
public static List<Task> LoadTodos(Action whenDone)
public static List<TodoItem> LoadTodos(Action whenDone)
{
var tasks = new List<Task>();
var tasks = new List<TodoItem>();
WebClient client = new WebClient();
try {
// make it synchronous
Expand All @@ -45,10 +45,10 @@ public static List<Task> LoadTodos(Action whenDone)

if (responseJson != null)
{
tasks = new List<Task>();
tasks = new List<TodoItem>();
for (var j = 0;j <responseJson.Count; j++) {
var t = responseJson[j];// as JsonValue;
var task = new Task(t);
var task = new TodoItem(t);

tasks.Add (task);
}
Expand All @@ -66,9 +66,9 @@ public static List<Task> LoadTodos(Action whenDone)
/// <summary>
/// GET /tables/TodoItem/{id}
/// </summary>
public static Task GetTodo(int id)
public static TodoItem GetTodo(int id)
{
Task task = null;
TodoItem task = null;
WebClient client = new WebClient();
try {
// make it synchronous
Expand All @@ -85,7 +85,7 @@ public static Task GetTodo(int id)
{
for (var j = 0; j < responseJson.Count; j++) {
var t = responseJson[j];// as JsonValue;
task = new Task(t);
task = new TodoItem(t);
break; // just one required :)
}
}
Expand All @@ -102,7 +102,7 @@ public static Task GetTodo(int id)
/// PATCH /tables/TodoItem/{id}
/// {"id":1,"text":"updated task text","complete":false}
/// </summary>
public static void UpdateTodo(Task t)
public static void UpdateTodo(TodoItem t)
{
WebClient client = new WebClient();
try {
Expand All @@ -128,7 +128,7 @@ public static void UpdateTodo(Task t)
/// POST /tables/TodoItem
/// {"text":"new task text","complete":false}
/// </summary>
public static Task AddTodo(Task t)
public static TodoItem AddTodo(TodoItem t)
{
WebClient client = new WebClient();
try {
Expand All @@ -145,7 +145,7 @@ public static Task AddTodo(Task t)
Console.WriteLine ("Add Json response => " + responseString);

var responseJson = JsonValue.Parse (responseString);
return new Task(responseJson);
return new TodoItem(responseJson);

} catch (System.Net.WebException e) {
Console.WriteLine ("X-ZUMO-APPLICATION add failed" + e.Message);
Expand All @@ -156,7 +156,7 @@ public static Task AddTodo(Task t)
/// <summary>
/// DELETE /tables/TodoItem/{id}
/// </summary>
public static void DeleteTodo(Task t)
public static void DeleteTodo(TodoItem t)
{
WebClient client = new WebClient();
try {
Expand Down
2 changes: 1 addition & 1 deletion Azure/iOS/Core/Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<Compile Include="AzureWebService.cs" />
<Compile Include="Task.cs" />
<Compile Include="TodoItem.cs" />
</ItemGroup>
</Project>
6 changes: 3 additions & 3 deletions Azure/iOS/Core/Task.cs → Azure/iOS/Core/TodoItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@

namespace Azure {
[Preserve]
public class Task {
public Task ()
public class TodoItem {
public TodoItem ()
{
Id = -1;
}
public Task (JsonValue json)
public TodoItem (JsonValue json)
{
Id = json["id"];
Title = json["text"];
Expand Down
6 changes: 3 additions & 3 deletions Azure/iOS/TaskListScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ public class TaskListScreen : DialogViewController {

UIBarButtonItem addButton, refreshButton;

List<Task> tasks; // local copy of task list
List<TodoItem> tasks; // local copy of task list

public TaskListScreen () : base (UITableViewStyle.Plain, new RootElement("Loading..."))
{
Title = "TaskyAzure";
tasks = new List<Task>();
tasks = new List<TodoItem>();
}

public override void ViewDidLoad ()
{
base.ViewDidLoad ();
addButton = new UIBarButtonItem(UIBarButtonSystemItem.Add, (s,e) =>{
var task = new Task() {Title="<new task>"};
var task = new TodoItem() {Title="<new task>"};
// Save to Azure
var added = AzureWebService.AddTodo (task);
tasks.Add (added);
Expand Down
4 changes: 2 additions & 2 deletions Azure/iOS/TaskScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ public class TaskScreen : UIViewController {
UISwitch doneSwitch;
UITextView descriptionText, titleText;

Task task;
TodoItem task;

public TaskScreen (Task t) {
public TaskScreen (TodoItem t) {
task = t;
}

Expand Down

0 comments on commit 7f91ca6

Please sign in to comment.