forked from petabridge/akka-bootcamp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRepoResultsForm.cs
39 lines (33 loc) · 1.25 KB
/
RepoResultsForm.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using System.Windows.Forms;
using Akka.Actor;
using GithubActors.Actors;
namespace GithubActors
{
public partial class RepoResultsForm : Form
{
private IActorRef _formActor;
private IActorRef _githubCoordinator;
private RepoKey _repo;
public RepoResultsForm(IActorRef githubCoordinator, RepoKey repo)
{
_githubCoordinator = githubCoordinator;
_repo = repo;
InitializeComponent();
}
private void RepoResultsForm_Load(object sender, System.EventArgs e)
{
_formActor =
Program.GithubActors.ActorOf(
Props.Create(() => new RepoResultsActor(dgUsers, tsStatus, tsProgress))
.WithDispatcher("akka.actor.synchronized-dispatcher")); //run on the UI thread
Text = string.Format("Repos Similar to {0} / {1}", _repo.Owner, _repo.Repo);
//start subscribing to updates
_githubCoordinator.Tell(new GithubCoordinatorActor.SubscribeToProgressUpdates(_formActor));
}
private void RepoResultsForm_FormClosing(object sender, FormClosingEventArgs e)
{
//kill the form actor
_formActor.Tell(PoisonPill.Instance);
}
}
}