/// <summary>Constructor.</summary> /// <param name="testPackage">The test-package this node represents.</param> public PackageListItem(PackageInfo testPackage) { // Setup initial conditions. this.testPackage = testPackage; // Set default values. Text = testPackage.Name; }
/// <summary>Adds a test-package to the controller.</summary> /// <param name="testPackage">The test-package to add.</param> public void AddPackage(PackageInfo testPackage) { // Setup initial conditions. if (testPackage == null) return; // Create the list-item node and insert it within the tree. PackageListItem node = new PackageListItem(testPackage); listRoot.InsertChild(listRoot.ChildCount == 0 ? 0 : listRoot.ChildCount - 1, node); // Insert before last node. // Create the controller. PackageController controller = new PackageController(node); packageControllers.Add(controller); controller.Loaded += delegate { // When the controller loads, reveal it in the list. view.RootList.SelectedParent = controller.RootNode; }; }
public PackageEventArgs(PackageInfo packageInfo) { PackageInfo = packageInfo; }
internal void FireAddPackage(PackageInfo packageInfo) { if (AddPackage != null) AddPackage(this, new PackageEventArgs(packageInfo)); }
/// <summary>Retrieves (or creates) the singleton instance of the definition for the given package type.</summary> /// <param name="initMethod">The entry point method to invoke upon load completion.</param> /// <param name="scriptUrl">The URL to the JavaScript file to load.</param> public static PackageInfo SingletonFromUrl(string initMethod, string scriptUrl) { // Retrieve the existing singleton (if there is one). PackageInfo def = Helper.Collection.First(singletons, delegate(object o) { return ((PackageInfo)o).Id == scriptUrl.ToLowerCase(); }) as PackageInfo; // Create and return the package-def. if (def == null) { def = new PackageInfo(initMethod, scriptUrl); singletons.Add(def); } // Finish up. return def; }
/// <summary>Removes the specified package.</summary> /// <param name="testPackage">The test-package to remove.</param> public void RemovePackage(PackageInfo testPackage) { // Setup initial conditions. if (testPackage == null) return; PackageController controller = GetController(testPackage); if (controller == null) return; // Remove from tree. view.RootList.RootNode.RemoveChild(controller.RootNode); // Finish up. Log.Info(string.Format("Test package unloaded: {0}", Html.ToHyperlink(testPackage.Id, null, LinkTarget.Blank))); Log.LineBreak(); }
private PackageController GetController(PackageInfo testPackage) { return Helper.Collection.First(packageControllers, delegate(object o) { return ((PackageController) o).TestPackage == testPackage; }) as PackageController; }