invite: start new thread to not freeze the UI when accepting
This commit is contained in:
parent
a323575d5c
commit
1c350575a3
|
@ -29,7 +29,7 @@
|
||||||
<body>
|
<body>
|
||||||
<div>
|
<div>
|
||||||
<b>hbons's stuff</b> on <b>Github</b>
|
<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">
|
<img src="add-to-sparkleshare-button.png" alt="Add to SparkleShare">
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -417,11 +417,11 @@ namespace SparkleShare {
|
||||||
// fully downloaded yet, so we try to read it several times
|
// fully downloaded yet, so we try to read it several times
|
||||||
int tries = 0;
|
int tries = 0;
|
||||||
while (!invite.IsValid) {
|
while (!invite.IsValid) {
|
||||||
Thread.Sleep (250);
|
Thread.Sleep (100);
|
||||||
invite = new SparkleInvite (args.FullPath);
|
invite = new SparkleInvite (args.FullPath);
|
||||||
tries++;
|
tries++;
|
||||||
|
|
||||||
if (tries > 20) {
|
if (tries > 10) {
|
||||||
AlertNotificationRaised ("Oh noes!", "This invite seems screwed up...");
|
AlertNotificationRaised ("Oh noes!", "This invite seems screwed up...");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -429,17 +429,20 @@ namespace SparkleShare {
|
||||||
|
|
||||||
ChangePageEvent (PageType.Syncing, null);
|
ChangePageEvent (PageType.Syncing, null);
|
||||||
|
|
||||||
if (!PendingInvite.Accept ()) {
|
new Thread (() => {
|
||||||
ChangePageEvent (PageType.Error, null);
|
if (!PendingInvite.Accept ()) {
|
||||||
return;
|
ChangePageEvent (PageType.Error, null);
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Program.Controller.FolderFetched += InvitePageFetchedDelegate;
|
Program.Controller.FolderFetched += InvitePageFetchedDelegate;
|
||||||
Program.Controller.FolderFetchError += InvitePageFetchErrorDelegate;
|
Program.Controller.FolderFetchError += InvitePageFetchErrorDelegate;
|
||||||
Program.Controller.FolderFetching += SyncingPageFetchingDelegate;
|
Program.Controller.FolderFetching += SyncingPageFetchingDelegate;
|
||||||
|
|
||||||
Program.Controller.StartFetcher (PendingInvite.Address, PendingInvite.Fingerprint,
|
Program.Controller.StartFetcher (PendingInvite.Address, PendingInvite.Fingerprint,
|
||||||
PendingInvite.RemotePath, PendingInvite.AnnouncementsUrl, false); // TODO: checkbox on invite page
|
PendingInvite.RemotePath, PendingInvite.AnnouncementsUrl, false); // TODO: checkbox on invite page
|
||||||
|
|
||||||
|
}).Start ();
|
||||||
}
|
}
|
||||||
|
|
||||||
// The following private methods are
|
// The following private methods are
|
||||||
|
|
Loading…
Reference in a new issue