コード例 #1
0
        void Install()
        {
            insSeparator.Visible = true;
            boxProgress.Visible  = true;
            buttonOk.Sensitive   = false;

            string txt;
            string errmessage;
            string warnmessage;

            ThreadStart oper;

            if (uninstallIds == null)
            {
                installMonitor = new InstallMonitor(globalProgressLabel, mainProgressBar, Catalog.GetString("Installing Add-ins"));
                oper           = new ThreadStart(RunInstall);
                errmessage     = Catalog.GetString("The installation failed!");
                warnmessage    = Catalog.GetString("The installation has completed with warnings.");
            }
            else
            {
                installMonitor = new InstallMonitor(globalProgressLabel, mainProgressBar, Catalog.GetString("Uninstalling Add-ins"));
                oper           = new ThreadStart(RunUninstall);
                errmessage     = Catalog.GetString("The uninstallation failed!");
                warnmessage    = Catalog.GetString("The uninstallation has completed with warnings.");
            }

            installing = true;
            oper();
            installing = false;

            buttonCancel.Visible = false;
            buttonOk.Label       = Gtk.Stock.Close;
            buttonOk.UseStock    = true;

            if (installMonitor.Success && installMonitor.Warnings.Count == 0)
            {
                Respond(Gtk.ResponseType.Ok);
                return;
            }
            else if (installMonitor.Success)
            {
                txt = "<b>" + warnmessage + "</b>\n\n";
                foreach (string s in installMonitor.Warnings)
                {
                    txt += GLib.Markup.EscapeText(s) + "\n";
                }
                response           = Gtk.ResponseType.Ok;
                buttonOk.Sensitive = true;
            }
            else
            {
                buttonCancel.Label    = Gtk.Stock.Close;
                buttonCancel.UseStock = true;
                txt = "<span foreground=\"red\"><b>" + errmessage + "</b></span>\n\n";
                foreach (string s in installMonitor.Errors)
                {
                    txt += GLib.Markup.EscapeText(s) + "\n";
                }
                response           = Gtk.ResponseType.Cancel;
                buttonOk.Sensitive = true;
            }

            ShowMessage(txt);
        }
コード例 #2
0
		void Install ()
		{
			insSeparator.Visible = true;
			boxProgress.Visible = true;
			buttonOk.Sensitive = false;
			
			string txt;
			string errmessage;
			string warnmessage;
			
			ThreadStart oper;
				
			if (uninstallIds == null) {
				installMonitor = new InstallMonitor (globalProgressLabel, mainProgressBar, Catalog.GetString ("Installing Add-ins"));
				oper = new ThreadStart (RunInstall);
				errmessage = Catalog.GetString ("The installation failed!");
				warnmessage = Catalog.GetString ("The installation has completed with warnings.");
			} else {
				installMonitor = new InstallMonitor (globalProgressLabel, mainProgressBar, Catalog.GetString ("Uninstalling Add-ins"));
				oper = new ThreadStart (RunUninstall);
				errmessage = Catalog.GetString ("The uninstallation failed!");
				warnmessage = Catalog.GetString ("The uninstallation has completed with warnings.");
			}
			
			installing = true;
			oper ();
			installing = false;
			
			buttonCancel.Visible = false;
			buttonOk.Label = Gtk.Stock.Close;
			buttonOk.UseStock = true;
			
			if (installMonitor.Success && installMonitor.Warnings.Count == 0) {
				Respond (Gtk.ResponseType.Ok);
				return;
			} else if (installMonitor.Success) {
				txt = "<b>" + warnmessage + "</b>\n\n";
				foreach (string s in installMonitor.Warnings)
					txt += GLib.Markup.EscapeText (s) + "\n";
				response = Gtk.ResponseType.Ok;
				buttonOk.Sensitive = true;
			} else {
				buttonCancel.Label = Gtk.Stock.Close;
				buttonCancel.UseStock = true;
				txt = "<span foreground=\"red\"><b>" + errmessage + "</b></span>\n\n";
				foreach (string s in installMonitor.Errors)
					txt += GLib.Markup.EscapeText (s) + "\n";
				response = Gtk.ResponseType.Cancel;
				buttonOk.Sensitive = true;
			}
			
			ShowMessage (txt);
		}
コード例 #3
0
        void FillSummaryPage()
        {
            PackageCollection packs = new PackageCollection();

            if (filesToInstall != null)
            {
                foreach (string file in filesToInstall)
                {
                    packs.Add(Package.FromFile(file));
                }
            }
            else
            {
                foreach (AddinRepositoryEntry arep in addinsToInstall)
                {
                    packs.Add(Package.FromRepository(arep));
                }
            }

            packagesToInstall = new PackageCollection(packs);

            PackageCollection    toUninstall;
            DependencyCollection unresolved;
            bool res;

            InstallMonitor m = new InstallMonitor();

            res = service.ResolveDependencies(m, packs, out toUninstall, out unresolved);

            StringBuilder sb = new StringBuilder();

            if (!res)
            {
                sb.Append("<b><span foreground=\"red\">").Append(Catalog.GetString("The selected add-ins can't be installed because there are dependency conflicts.")).Append("</span></b>\n");
                foreach (string s in m.Errors)
                {
                    sb.Append("<b><span foreground=\"red\">" + s + "</span></b>\n");
                }
                sb.Append("\n");
            }

            if (m.Warnings.Count != 0)
            {
                foreach (string w in m.Warnings)
                {
                    sb.Append("<b><span foreground=\"red\">" + w + "</span></b>\n");
                }
                sb.Append("\n");
            }

            sb.Append("<b>").Append(Catalog.GetString("The following packages will be installed:")).Append("</b>\n\n");
            foreach (Package p in packs)
            {
                sb.Append(p.Name);
                if (!p.SharedInstall)
                {
                    sb.Append(Catalog.GetString(" (in user directory)"));
                }
                sb.Append("\n");
            }
            sb.Append("\n");

            if (toUninstall.Count > 0)
            {
                sb.Append("<b>").Append(Catalog.GetString("The following packages need to be uninstalled:")).Append("</b>\n\n");
                foreach (Package p in toUninstall)
                {
                    sb.Append(p.Name + "\n");
                }
                sb.Append("\n");
            }

            if (unresolved.Count > 0)
            {
                sb.Append("<b>").Append(Catalog.GetString("The following dependencies could not be resolved:")).Append("</b>\n\n");
                foreach (Dependency p in unresolved)
                {
                    sb.Append(p.Name + "\n");
                }
                sb.Append("\n");
            }
            buttonOk.Sensitive = res;
            ShowMessage(sb.ToString());
        }
コード例 #4
0
		void FillSummaryPage ()
		{
			PackageCollection packs = new PackageCollection ();
			
			if (filesToInstall != null) {
				foreach (string file in filesToInstall) {
					packs.Add (Package.FromFile (file));
				}
			}
			else {
				foreach (AddinRepositoryEntry arep in addinsToInstall) {
					packs.Add (Package.FromRepository (arep));
				}
			}
			
			packagesToInstall = new PackageCollection (packs);
			
			PackageCollection toUninstall;
			DependencyCollection unresolved;
			bool res;
			
			InstallMonitor m = new InstallMonitor ();
			res = service.ResolveDependencies (m, packs, out toUninstall, out unresolved);
			
			StringBuilder sb = new StringBuilder ();
			if (!res) {
				sb.Append ("<b><span foreground=\"red\">").Append (Catalog.GetString ("The selected add-ins can't be installed because there are dependency conflicts.")).Append ("</span></b>\n");
				foreach (string s in m.Errors) {
					sb.Append ("<b><span foreground=\"red\">" + s + "</span></b>\n");
				}
				sb.Append ("\n");
			}
			
			if (m.Warnings.Count != 0) {
				foreach (string w in m.Warnings) {
					sb.Append ("<b><span foreground=\"red\">" + w + "</span></b>\n");
				}
				sb.Append ("\n");
			}
			
			sb.Append ("<b>").Append (Catalog.GetString ("The following packages will be installed:")).Append ("</b>\n\n");
			foreach (Package p in packs) {
				sb.Append (p.Name);
				if (!p.SharedInstall)
					sb.Append (Catalog.GetString (" (in user directory)"));
				sb.Append ("\n");
			}
			sb.Append ("\n");
			
			if (toUninstall.Count > 0) {
				sb.Append ("<b>").Append (Catalog.GetString ("The following packages need to be uninstalled:")).Append ("</b>\n\n");
				foreach (Package p in toUninstall) {
					sb.Append (p.Name + "\n");
				}
				sb.Append ("\n");
			}
			
			if (unresolved.Count > 0) {
				sb.Append ("<b>").Append (Catalog.GetString ("The following dependencies could not be resolved:")).Append ("</b>\n\n");
				foreach (Dependency p in unresolved) {
					sb.Append (p.Name + "\n");
				}
				sb.Append ("\n");
			}
			buttonOk.Sensitive = res;
			ShowMessage (sb.ToString ());
		}