Skip to content

Commit 55da781

Browse files
committed
Reply to current chat
1 parent a199732 commit 55da781

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

GitChat/MainStage.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ public MainStage(State state) : base(state) {
99
KeyMapping[ConsoleKey.L] = NextRepo;
1010
KeyMapping[ConsoleKey.O] = ChangeToOpen;
1111
KeyMapping[ConsoleKey.Y] = RemoveCurrent;
12+
KeyMapping[ConsoleKey.I] = ReplyCurrent;
1213
}
1314

1415
public override void Update() {
@@ -87,6 +88,10 @@ void RemoveCurrent() {
8788
State.Storage.Clear(service.RepoName);
8889
State.Services.Remove(service.RepoName);
8990
}
91+
92+
void ReplyCurrent() {
93+
NewStage = new ReplyStage(State);
94+
}
9095

9196
void PrevRepo() {
9297
var newIndex = State.SelectedService - 1;

GitChat/ReplyStage.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using System;
2+
using GitChat.Library;
3+
4+
namespace GitChat {
5+
class ReplyStage : Stage {
6+
public ReplyStage(State state) : base(state) {}
7+
8+
public override void Render() {
9+
base.Render();
10+
Console.WriteLine("Your reply:");
11+
}
12+
13+
public override void Input() {
14+
var message = Console.ReadLine();
15+
State.CurrentService.SendMessage(message);
16+
NewStage = new MainStage(State);
17+
}
18+
}
19+
}

0 commit comments

Comments
 (0)