Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial commit - in a fully working state and submitted to the app store
- Loading branch information
Alex York
committed
May 8, 2010
0 parents
commit 0a45980
Showing
69 changed files
with
5,355 additions
and
0 deletions.
There are no files selected for viewing
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 file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
obj | ||
bin | ||
*.pidb | ||
test-results | ||
.userprefs |
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 file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using System; | ||
|
||
namespace NDC2010.Logic | ||
{ | ||
public static class FriendlyDateTime | ||
{ | ||
public static string Get(DateTime dateInThePast, DateTime dateNow) | ||
{ | ||
if (dateInThePast > dateNow) return ""; | ||
|
||
var timeDifference = dateNow - dateInThePast; | ||
|
||
/* | ||
var differenceInMonths = dateNow.Month - dateInThePast.Month; | ||
if (timeDifference.Days > 0) | ||
return string.Format("{0} months ago", differenceInMonths); | ||
*/ | ||
|
||
if (timeDifference.Days == 1) | ||
return "yesterday"; | ||
else if (timeDifference.Days > 0) | ||
return string.Format("{0} days ago", timeDifference.Days); | ||
|
||
if (timeDifference.Hours == 1) | ||
return "an hour ago"; | ||
else if (timeDifference.Hours > 0) | ||
return string.Format("{0} hours ago", timeDifference.Hours); | ||
|
||
if (timeDifference.Minutes <= 1) | ||
return "1 min ago"; | ||
|
||
return string.Format("{0} mins ago", timeDifference.Minutes); | ||
} | ||
} | ||
} |
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 file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project DefaultTargets="Build" ToolsVersion="3.5" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform> | ||
<ProductVersion>9.0.21022</ProductVersion> | ||
<SchemaVersion>2.0</SchemaVersion> | ||
<ProjectGuid>{F4090AB0-145B-4BE8-9962-81D10B815A91}</ProjectGuid> | ||
<ProjectTypeGuids>{E613F3A2-FE9C-494F-B74E-F63BCB86FEA6};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> | ||
<OutputType>Library</OutputType> | ||
<RootNamespace>NDC2010.Logic</RootNamespace> | ||
<AssemblyName>NDC2010.Logic</AssemblyName> | ||
<MtouchSdkVersion>3.0</MtouchSdkVersion> | ||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\iPhoneSimulator\Debug</OutputPath> | ||
<DefineConstants>DEBUG</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
<MtouchLink>None</MtouchLink> | ||
<MtouchDebug>True</MtouchDebug> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' "> | ||
<DebugType>none</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\iPhoneSimulator\Release</OutputPath> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
<MtouchDebug>False</MtouchDebug> | ||
<MtouchLink>None</MtouchLink> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\iPhone\Debug</OutputPath> | ||
<DefineConstants>DEBUG</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
<CodesignKey>iPhone Developer</CodesignKey> | ||
<MtouchDebug>True</MtouchDebug> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' "> | ||
<DebugType>none</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\iPhone\Release</OutputPath> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
<MtouchDebug>False</MtouchDebug> | ||
<CodesignKey>iPhone Developer</CodesignKey> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Distribution|iPhone' "> | ||
<DebugType>none</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin</OutputPath> | ||
<WarningLevel>4</WarningLevel> | ||
<MtouchDebug>False</MtouchDebug> | ||
<CodesignKey>iPhone Developer</CodesignKey> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Xml" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Xml.Linq" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Folder Include="Presenters\" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="SpeakerComparer.cs" /> | ||
<Compile Include="SessionConverter.cs" /> | ||
<Compile Include="Presenters\DaysPresenter.cs" /> | ||
<Compile Include="Presenters\SessionsPresenter.cs" /> | ||
<Compile Include="Presenters\SessionPresenter.cs" /> | ||
<Compile Include="Presenters\SpeakersPresenter.cs" /> | ||
<Compile Include="Presenters\SpeakerPresenter.cs" /> | ||
<Compile Include="TweetConverter.cs" /> | ||
<Compile Include="FriendlyDateTime.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\NDC2010.Model\NDC2010.Model.csproj"> | ||
<Project>{7DA1FBBF-1EB5-4D22-A5E1-49BA1219D9EB}</Project> | ||
<Name>NDC2010.Model</Name> | ||
</ProjectReference> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> | ||
<ProjectExtensions> | ||
<MonoDevelop> | ||
<Properties InternalTargetFrameworkVersion="IPhone" /> | ||
</MonoDevelop> | ||
</ProjectExtensions> | ||
</Project> |
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 file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using System; | ||
|
||
namespace NDC2010.Logic.Presenters | ||
{ | ||
public class DaysPresenter | ||
{ | ||
private string[] _days; | ||
|
||
public DaysPresenter() | ||
{ | ||
_days = new string[] | ||
{ | ||
"Wednesday, June 16", | ||
"Thursday, June 17", | ||
"Friday, June 18" | ||
}; | ||
} | ||
|
||
public string GetTextForDay(int index) | ||
{ | ||
return _days[index]; | ||
} | ||
|
||
public int GetNumberOfDays() | ||
{ | ||
return _days.Length; | ||
} | ||
|
||
public string GetTitle() | ||
{ | ||
return "Select day"; | ||
} | ||
} | ||
} |
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 file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
using System; | ||
using NDC2010.Model; | ||
|
||
namespace NDC2010.Logic.Presenters | ||
{ | ||
public class SessionPresenter | ||
{ | ||
public Session Session { get; set; } | ||
|
||
public SessionPresenter() | ||
{ | ||
} | ||
|
||
public string GetCellTextForSection(int section) | ||
{ | ||
string cellText; | ||
|
||
switch (section) | ||
{ | ||
case 0: | ||
cellText = Session.Title; | ||
break; | ||
case 1: | ||
cellText = Session.Description; | ||
break; | ||
default: | ||
throw new Exception("Cannot get text for section " + section); | ||
} | ||
|
||
return string.IsNullOrEmpty(cellText) ? "TBA" : cellText; | ||
} | ||
|
||
public string GetSectionHeadingText(int section) | ||
{ | ||
switch (section) | ||
{ | ||
case 0: | ||
return "Title"; | ||
case 1: | ||
return "Description"; | ||
default: | ||
throw new Exception("Can't find text for section " + section); | ||
} | ||
} | ||
} | ||
} |
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 file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using NDC2010.Model; | ||
|
||
namespace NDC2010.Logic.Presenters | ||
{ | ||
public class SessionsPresenter | ||
{ | ||
public IEnumerable<Session> Sessions { get; set; } | ||
public int Day { get; set; } | ||
|
||
public SessionsPresenter() | ||
: this(new Session[] { }, 1) | ||
{ | ||
} | ||
|
||
public SessionsPresenter(IEnumerable<Session> sessions, int day) | ||
{ | ||
Sessions = sessions; | ||
Day = day; | ||
} | ||
|
||
public IEnumerable<Session> GetSessionsForDay(int day) | ||
{ | ||
var query = from session in Sessions | ||
where session.Day == day | ||
select session; | ||
|
||
return query.ToArray(); | ||
} | ||
|
||
public string GetTimeForSection(int section) | ||
{ | ||
switch (section) | ||
{ | ||
case 0: return "9:00 - 10:00"; | ||
case 1: return "10:20 - 11:20"; | ||
case 2: return "11:40 - 12:40"; | ||
case 3: return "13:40 - 14:40"; | ||
case 4: return "15:00 - 16:00"; | ||
case 5: return "16:20 - 17:20"; | ||
case 6: return "17:40 - 18:40"; | ||
default: return ""; | ||
} | ||
} | ||
|
||
public IEnumerable<Session> GetSessionsForSection(int section) | ||
{ | ||
var query = from session in Sessions | ||
where session.Day == Day && | ||
session.Time == GetTimeForSection(section) | ||
select session; | ||
|
||
return query.ToArray(); | ||
} | ||
|
||
public int GetNumberOfDailyTimeslots() | ||
{ | ||
return 7; | ||
} | ||
} | ||
} |
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 file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using System; | ||
using NDC2010.Model; | ||
|
||
namespace NDC2010.Logic.Presenters | ||
{ | ||
public class SpeakerPresenter | ||
{ | ||
public Speaker Speaker { get; set; } | ||
|
||
public SpeakerPresenter() | ||
{ | ||
} | ||
|
||
public string GetSectionHeadingText(int section) | ||
{ | ||
switch (section) | ||
{ | ||
case 0: | ||
return "Name"; | ||
case 1: | ||
return "Bio"; | ||
case 2: | ||
return "Sessions"; | ||
default: | ||
throw new Exception("No heading text for section " + section); | ||
} | ||
} | ||
|
||
public string GetCellTextForSection(int section) | ||
{ | ||
switch (section) | ||
{ | ||
case 0: | ||
return Speaker.Name; | ||
case 1: | ||
return Speaker.Info; | ||
default: | ||
throw new Exception("Cannot get cell text for section " + section); | ||
} | ||
} | ||
} | ||
} |
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 file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using NDC2010.Model; | ||
using NDC2010.Logic; | ||
|
||
namespace NDC2010.Logic.Presenters | ||
{ | ||
public class SpeakersPresenter | ||
{ | ||
public IEnumerable<Session> Sessions { get; set; } | ||
|
||
public SpeakersPresenter() | ||
: this(new Session [] { }) | ||
{ | ||
} | ||
|
||
public SpeakersPresenter(IEnumerable<Session> sessions) | ||
{ | ||
Sessions = sessions; | ||
} | ||
|
||
public Speaker[] GetAllSpeakers() | ||
{ | ||
var query = from session in Sessions | ||
from speaker in session.Speakers | ||
select speaker; | ||
|
||
return query.Distinct(SpeakerComparer.Instance).OrderBy(s => s.Name).ToArray(); | ||
} | ||
} | ||
} |
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 file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System; | ||
using System.Linq; | ||
using System.Xml.Linq; | ||
using NDC2010.Model; | ||
|
||
namespace NDC2010.Logic | ||
{ | ||
public static class SessionConverter | ||
{ | ||
public static Session FromXml(XElement xml) | ||
{ | ||
return new Session | ||
{ | ||
Title = (string) xml.Element("title"), | ||
Speakers = (from speaker in xml.Element("speakers").Elements("speaker") | ||
select new Speaker | ||
{ | ||
Name = (string) speaker.Element("name"), | ||
Info = (string) speaker.Element("info") | ||
}).ToArray(), | ||
Day = (int) xml.Element("day"), | ||
Track = (int) xml.Element("track"), | ||
Time = (string) xml.Element("time"), | ||
Description = (string) xml.Element("description") | ||
}; | ||
} | ||
} | ||
} |
Oops, something went wrong.