SetMessage() public method

public SetMessage ( string msg ) : void
msg string
return void
Ejemplo n.º 1
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 ();
			}
		}
Ejemplo n.º 2
0
        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 ();
        }
Ejemplo n.º 3
0
        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 ();
        }
Ejemplo n.º 4
0
		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();
            }
        }