public string ExecuteCommand(string commandLine) { var bundles = context.GetBundles(); StringBuilder sb = new StringBuilder(); sb.Append("Index".PadLeft(5)); sb.Append("|"); sb.Append("State".PadRight(12)); sb.Append("|"); sb.Append("Name"); sb.AppendLine(); var index = 0; foreach (IBundle bundle in bundles) { sb.Append(index.ToString().PadLeft(5)); sb.Append("|"); sb.Append(BundleUtils.GetBundleStateString(bundle.GetState()).PadRight(12)); sb.Append("|"); sb.Append(String.Format("{0} ({1}) \"{2}\"", bundle.GetSymbolicName(), bundle.GetVersion(), bundle.GetManifest()["Name"])); sb.AppendLine(); index++; } return(sb.ToString()); }
public string ExecuteCommand(string commandLine) { try { var framework = context.GetBundles()[0] as IFramework; if (framework != null) { framework.Stop(); } Application.ExitThread(); Application.Exit(); Application.Restart(); Process.GetCurrentProcess().Kill(); } catch { } return("正在重启..."); }