From 1c350575a3c0066b9ae7f62f7eea12ab60affc55 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Fri, 27 Jul 2012 18:00:55 +0200 Subject: [PATCH] invite: start new thread to not freeze the UI when accepting --- .../protocol-handler-test.htm | 2 +- SparkleShare/SparkleControllerBase.cs | 4 ++-- SparkleShare/SparkleSetupController.cs | 21 +++++++++++-------- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/SparkleShare/Common/HTML/protocol-handler-test/protocol-handler-test.htm b/SparkleShare/Common/HTML/protocol-handler-test/protocol-handler-test.htm index 9e0a1226..75da7cb5 100644 --- a/SparkleShare/Common/HTML/protocol-handler-test/protocol-handler-test.htm +++ b/SparkleShare/Common/HTML/protocol-handler-test/protocol-handler-test.htm @@ -29,7 +29,7 @@
hbons's stuff on Github - + Add to SparkleShare
diff --git a/SparkleShare/SparkleControllerBase.cs b/SparkleShare/SparkleControllerBase.cs index 4a1ace17..56b2fd1a 100644 --- a/SparkleShare/SparkleControllerBase.cs +++ b/SparkleShare/SparkleControllerBase.cs @@ -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; } diff --git a/SparkleShare/SparkleSetupController.cs b/SparkleShare/SparkleSetupController.cs index a06506ea..29a83eb8 100755 --- a/SparkleShare/SparkleSetupController.cs +++ b/SparkleShare/SparkleSetupController.cs @@ -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