Skip to content

Commit d655943

Browse files
Revert "new C# features"
This reverts commit 64483f5. Conflicts: ViewModels/CardViewModel.cs
1 parent e75389f commit d655943

23 files changed

Lines changed: 98 additions & 58 deletions

Entities/Card.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ public sealed class Card
99
public int SecondNumber { get; set; }
1010
public Operation Operation { get; set; }
1111

12-
public int Answer => _answerStrategy[Operation](FirstNumber, SecondNumber);
12+
public int Answer
13+
{
14+
get { return _answerStrategy[Operation](FirstNumber, SecondNumber); }
15+
}
1316

1417
private readonly Dictionary<Operation, Func<int, int, int>> _answerStrategy = new Dictionary<Operation, Func<int, int, int>>
1518
{

Entities/Deck.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ public sealed class Deck
1414
public Card CurrentCard { get; set; }
1515
public List<Card> Cards { get; set; }
1616

17-
public int CurrentIndex => Cards.IndexOf(CurrentCard);
18-
public bool HasCurrentCard => CurrentCard != null;
19-
public bool IsLastCard => CurrentCard == Cards.Last();
17+
public int CurrentIndex { get { return Cards.IndexOf(CurrentCard); } }
18+
public bool HasCurrentCard { get { return CurrentCard != null; } }
19+
public bool IsLastCard { get { return CurrentCard == Cards.Last(); } }
2020

2121
public Card Deal()
2222
{

Entities/Record.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ public Record(Deck deck, decimal seconds)
2222
public int Order { get; set; }
2323
public decimal Seconds { get; set; }
2424

25-
public string DisplayTime => Seconds.GetTiming();
25+
public string DisplayTime
26+
{
27+
get { return Seconds.GetTiming(); }
28+
}
2629
}
2730
}

Entities/User.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ public User(string name)
1515
private List<Record> _records;
1616
public List<Record> Records
1717
{
18-
get => _records ?? (_records = new List<Record>());
19-
set => _records = value;
18+
get { return _records ?? (_records = new List<Record>()); }
19+
set { _records = value; }
2020
}
2121

2222
public bool UpdateRecord(Record record)

Utilities/Container/AutoSubscriptionModule.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ protected override void AttachToComponentRegistration(IComponentRegistry registr
1313

1414
private static void OnComponentActivated(object sender, ActivatedEventArgs<object> e)
1515
{
16-
var handler = e?.Instance as IHandle;
16+
if (e == null) return;
17+
var handler = e.Instance as IHandle;
1718
if (handler != null) e.Context.Resolve<IEventAggregator>().Subscribe(handler);
1819
}
1920
}

Utilities/Container/ContainerBootstrapper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ protected override object GetInstance(Type service, string key)
8686
if (_container.TryResolveNamed(key, service, out instance)) return instance;
8787
}
8888

89-
throw new Exception($"Could not locate any instances of {key ?? service.Name}.");
89+
throw new Exception(string.Format("Could not locate any instances of {0}.", key ?? service.Name));
9090
}
9191

9292
protected override void OnStartup(object sender, StartupEventArgs e)

Utilities/Extensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public static class Extensions
1010
[DebuggerStepThrough]
1111
public static void ForEach<T>(this IEnumerable<T> enumerable, Action<T> action)
1212
{
13-
foreach (var x in enumerable) action(x);
13+
foreach (T x in enumerable) action(x);
1414
}
1515

1616
[DebuggerStepThrough]
@@ -27,7 +27,7 @@ public static string GetTiming(this decimal value)
2727
if (value <= 0) return "";
2828
var minutes = (int)value / 60;
2929
var seconds = value - (minutes * 60);
30-
return $"{minutes:D2}:{seconds:00.0}";
30+
return string.Format("{0:D2}:{1:00.0}", minutes, seconds);
3131
}
3232
}
3333
}

Utilities/Game/DeckConfiguration.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ namespace CodeConcussion.KVL.Utilities.Game
99
internal static class DeckConfiguration
1010
{
1111
private static List<Deck> _decks;
12-
public static List<Deck> Decks => _decks ?? (_decks = CreateDecks());
12+
public static List<Deck> Decks
13+
{
14+
get { return _decks ?? (_decks = CreateDecks()); }
15+
}
1316

1417
private static List<Deck> CreateDecks()
1518
{

Utilities/Game/GameManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ public GameManager(MessageDispatch dispatcher)
1616

1717
private readonly MessageDispatch _dispatcher;
1818

19-
public List<Deck> AllDecks => DeckConfiguration.Decks;
2019
public User User { get; set; }
20+
public List<Deck> AllDecks { get { return DeckConfiguration.Decks; } }
2121
public Color BackgroundColor { get; set; }
2222
public bool PlayErrorSound { get; set; }
2323

Utilities/Game/UserMessageConfiguration.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ namespace CodeConcussion.KVL.Utilities.Game
88
internal static class UserMessageConfiguration
99
{
1010
private static Dictionary<UserMessage, string> _messages;
11-
public static Dictionary<UserMessage, string> Messages => _messages ?? (_messages = GetMessages());
11+
public static Dictionary<UserMessage, string> Messages
12+
{
13+
get { return _messages ?? (_messages = GetMessages()); }
14+
}
1215

1316
private static Dictionary<UserMessage, string> GetMessages()
1417
{

0 commit comments

Comments
 (0)