Exemple #1
0
 void UpdateRepos()
 {
     progressBar.Show();
     setup.Repositories.UpdateAllRepositories(this);
     progressBar.Hide();
     addinsNotFound = CheckAddins(false);
     if (errMessage != null)
     {
         Services.ShowError(null, errMessage, this, true);
         errMessage = null;
     }
 }
Exemple #2
0
 public void ReportError(string message, Exception exception)
 {
     Log("Error: " + message);
     if (exception != null)
     {
         Log(exception.ToString());
     }
     Gtk.Application.Invoke(delegate {
         Services.ShowError(exception, message, null, true);
     });
     hadError = true;
 }
Exemple #3
0
 protected virtual void OnEnableDisableClicked(object sender, System.EventArgs e)
 {
     try {
         foreach (Addin a in ((AddinInfoView)sender).SelectedAddins)
         {
             a.Enabled = !a.Enabled;
         }
         LoadAll();
     }
     catch (Exception ex) {
         Services.ShowError(ex, null, this, true);
     }
 }
 internal void OnDisable(object sender, EventArgs e)
 {
     try {
         Addin sinfo = (Addin)tree.ActiveAddinData;
         if (sinfo == null)
         {
             return;
         }
         sinfo.Enabled = false;
         LoadAddins();
     }
     catch (Exception ex) {
         Services.ShowError(ex, null, this, true);
     }
 }
Exemple #5
0
 public void ReportError(string message, Exception exception)
 {
     Log("Error: " + message);
     if (exception != null)
     {
         Log(exception.ToString());
     }
     Gtk.Application.Invoke((o, args) => {
         if (parent.TryGetTarget(out var parentWindow))
         {
             Services.ShowError(exception, message, parentWindow, true);
         }
     });
     hadError = true;
 }
Exemple #6
0
        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();
            }
        }