invite: start new thread to not freeze the UI when accepting

This commit is contained in:
Hylke Bons 2012-07-27 18:00:55 +02:00
parent a323575d5c
commit 1c350575a3
3 changed files with 15 additions and 12 deletions

View file

@ -29,7 +29,7 @@
<body>
<div>
<b>hbons's stuff</b> on <b>Github</b>
<a href="sparkleshare://www.sparkleshare.org/test-invite.xml">
<a href="sparkleshare://raw.github.com/hbons/SparkleShare/master/SparkleShare/Common/HTML/protocol-handler-test/invite.xml">
<img src="add-to-sparkleshare-button.png" alt="Add to SparkleShare">
</a>
</div>

View file

@ -417,11 +417,11 @@ namespace SparkleShare {
// fully downloaded yet, so we try to read it several times
int tries = 0;
while (!invite.IsValid) {
Thread.Sleep (250);
Thread.Sleep (100);
invite = new SparkleInvite (args.FullPath);
tries++;
if (tries > 20) {
if (tries > 10) {
AlertNotificationRaised ("Oh noes!", "This invite seems screwed up...");
break;
}

View file

@ -429,17 +429,20 @@ namespace SparkleShare {
ChangePageEvent (PageType.Syncing, null);
if (!PendingInvite.Accept ()) {
ChangePageEvent (PageType.Error, null);
return;
}
new Thread (() => {
if (!PendingInvite.Accept ()) {
ChangePageEvent (PageType.Error, null);
return;
}
Program.Controller.FolderFetched += InvitePageFetchedDelegate;
Program.Controller.FolderFetchError += InvitePageFetchErrorDelegate;
Program.Controller.FolderFetching += SyncingPageFetchingDelegate;
Program.Controller.FolderFetched += InvitePageFetchedDelegate;
Program.Controller.FolderFetchError += InvitePageFetchErrorDelegate;
Program.Controller.FolderFetching += SyncingPageFetchingDelegate;
Program.Controller.StartFetcher (PendingInvite.Address, PendingInvite.Fingerprint,
PendingInvite.RemotePath, PendingInvite.AnnouncementsUrl, false); // TODO: checkbox on invite page
Program.Controller.StartFetcher (PendingInvite.Address, PendingInvite.Fingerprint,
PendingInvite.RemotePath, PendingInvite.AnnouncementsUrl, false); // TODO: checkbox on invite page
}).Start ();
}
// The following private methods are