protected virtual void OnButtonRefreshClicked(object sender, System.EventArgs e) { ProgressDialog pdlg = new ProgressDialog(this); pdlg.Show(); pdlg.SetMessage(AddinManager.CurrentLocalizer.GetString("Updating repository")); bool updateDone = false; Thread t = new Thread(delegate() { try { service.Repositories.UpdateAllRepositories(pdlg); } finally { updateDone = true; } }); t.Start(); while (!updateDone) { while (Gtk.Application.EventsPending()) { Gtk.Application.RunIteration(); } Thread.Sleep(50); } pdlg.Destroy(); LoadGallery(); LoadUpdates(); }
void UpdateRepositories() { ProgressDialog pdlg = new ProgressDialog(this); if (!firstLoad) { pdlg.Show(); } pdlg.SetMessage(AddinManager.CurrentLocalizer.GetString("Updating repository")); bool updateDone = buttonRefresh.Sensitive = false; Thread t = new Thread(delegate() { try { service.Repositories.UpdateAllRepositories(pdlg); } finally { updateDone = true; } }); t.Start(); while (!updateDone) { while (Gtk.Application.EventsPending()) { Gtk.Application.RunIteration(); } Thread.Sleep(50); } buttonRefresh.Sensitive = true; pdlg.Destroy(); }
protected void OnAdd (object sender, EventArgs e) { NewSiteDialog dlg = new NewSiteDialog (this); try { if (dlg.Run ()) { string url = dlg.Url; if (!url.StartsWith ("http://") && !url.StartsWith ("https://") && !url.StartsWith ("file://")) { url = "http://" + url; } try { new Uri (url); } catch { Services.ShowError (null, "Invalid url: " + url, null, true); } if (!service.Repositories.ContainsRepository (url)) { ProgressDialog pdlg = new ProgressDialog (this); pdlg.Show (); pdlg.SetMessage (AddinManager.CurrentLocalizer.GetString ("Registering repository")); bool done = false; AddinRepository rr = null; Exception error = null; ThreadPool.QueueUserWorkItem (delegate { try { rr = service.Repositories.RegisterRepository (pdlg, url, true); } catch (System.Exception ex) { error = ex; } finally { done = true; } }); while (!done) { if (Gtk.Application.EventsPending ()) Gtk.Application.RunIteration (); else Thread.Sleep (100); } pdlg.Destroy (); if (pdlg.HadError) { if (rr != null) service.Repositories.RemoveRepository (rr.Url); return; } if (error != null) { Services.ShowError (error, "The repository could not be registered", null, true); return; } AppendRepository (rr); } } } finally { dlg.Destroy (); } }
protected void OnAdd(object sender, EventArgs e) { NewSiteDialog dlg = new NewSiteDialog(this); try { if (dlg.Run()) { string url = dlg.Url; if (!url.StartsWith("http://") && !url.StartsWith("https://") && !url.StartsWith("file://")) { url = "http://" + url; } try { new Uri(url); } catch { Services.ShowError(null, "Invalid url: " + url, null, true); } if (!service.Repositories.ContainsRepository(url)) { ProgressDialog pdlg = new ProgressDialog(this); pdlg.Show(); pdlg.SetMessage(AddinManager.CurrentLocalizer.GetString("Registering repository")); bool done = false; AddinRepository rr = null; Exception error = null; ThreadPool.QueueUserWorkItem(delegate { try { rr = service.Repositories.RegisterRepository(pdlg, url, true); } catch (System.Exception ex) { error = ex; } finally { done = true; } }); while (!done) { if (Gtk.Application.EventsPending()) { Gtk.Application.RunIteration(); } else { Thread.Sleep(100); } } pdlg.Destroy(); if (pdlg.HadError) { if (rr != null) { service.Repositories.RemoveRepository(rr.Url); } return; } if (error != null) { Services.ShowError(error, "The repository could not be registered", null, true); return; } AppendRepository(rr); } } } finally { dlg.Destroy(); } }
protected virtual void OnButtonRefreshClicked(object sender, System.EventArgs e) { ProgressDialog pdlg = new ProgressDialog (this); pdlg.Show (); pdlg.SetMessage (AddinManager.CurrentLocalizer.GetString ("Updating repository")); bool updateDone = false; Thread t = new Thread (delegate () { try { service.Repositories.UpdateAllRepositories (pdlg); } finally { updateDone = true; } }); t.Start (); while (!updateDone) { while (Gtk.Application.EventsPending ()) Gtk.Application.RunIteration (); Thread.Sleep (50); } pdlg.Destroy (); LoadGallery (); LoadUpdates (); }
void UpdateRepositories () { ProgressDialog pdlg = new ProgressDialog (this); if (!firstLoad) pdlg.Show (); pdlg.SetMessage (AddinManager.CurrentLocalizer.GetString ("Updating repository")); bool updateDone = buttonRefresh.Sensitive = false; Thread t = new Thread (delegate () { try { service.Repositories.UpdateAllRepositories (pdlg); } finally { updateDone = true; } }); t.Start (); while (!updateDone) { while (Gtk.Application.EventsPending ()) Gtk.Application.RunIteration (); Thread.Sleep (50); } buttonRefresh.Sensitive = true; pdlg.Destroy (); }
protected void OnUpdateRepo(object sender, EventArgs e) { ProgressDialog pdlg = new ProgressDialog (); pdlg.Show (); pdlg.SetMessage (AddinManager.CurrentLocalizer.GetString ("Updating repository")); updateMonitor = pdlg; Thread t = new Thread (new ThreadStart (RunUpdate)); t.Start (); updateDone = false; while (!updateDone) { while (Gtk.Application.EventsPending ()) Gtk.Application.RunIteration (); Thread.Sleep (50); } pdlg.Destroy (); LoadAddins (); }