Пример #1
0
 // Public methods.
 /// <summary>
 /// Shows the form as a dialog to export the list of PlanetLab nodes.
 /// </summary>
 /// <param name="owner">The owner window.</param>
 /// <param name="nodes">The list PlanetLab nodes.</param>
 /// <returns>The dialog result.</returns>
 public DialogResult ShowDialog(IWin32Window owner, PlDatabaseList<PlNode> nodes)
 {
     // Initialize the control.
     if (this.control.Initialize(nodes))
     {
         // Call the base class methods.
         return base.ShowDialog(owner);
     }
     else return DialogResult.Cancel;
 }
Пример #2
0
 // Public methods.
 /// <summary>
 /// Refreshes the list of PlanetLab slices.
 /// </summary>
 /// <param name="crawler">The crawler configuration.</param>
 public void Refresh(Crawler crawler)
 {
     // Set the slices.
     this.slices = crawler.PlanetLab.Slices;
     // Clear the filter.
     this.textBoxFilter.Clear();
     // Clear the buttons state.
     this.buttonRefresh.Enabled = true;
     this.buttonCancel.Enabled = false;
     this.buttonSelect.Enabled = false;
     this.buttonClose.Enabled = true;
     // If the slices list is empty.
     if (this.slices.Count == 0)
     {
         // Begin refreshing the slices list.
         this.OnRefreshStarted(this, EventArgs.Empty);
     }
     else
     {
         // Update the list view.
         this.OnUpdateList();
     }
 }
 // Public methods.
 /// <summary>
 /// Refreshes the control using the PlanetLab sites from the current configuration.
 /// </summary>
 /// <param name="crawler">The crawler configuration.</param>
 public void Refresh(Crawler crawler)
 {
     // Update the sites list.
     this.sites = crawler.PlanetLab.Sites;
     // Clear the list view.
     this.listViewSites.Items.Clear();
     this.listViewNodes.Items.Clear();
     // Clear the map markers.
     this.mapControl.Markers.Clear();
     // Reset the filters.
     this.textBoxFilterSite.Clear();
     this.textBoxFilterNode.Clear();
     // Clear the lists.
     this.nodes.Clear();
     this.selectedNodes.Clear();
     // Reset the wizard.
     this.wizard.SelectedIndex = 0;
     this.wizardPageSite.NextEnabled = false;
     // Update the sites.
     this.OnUpdateSites();
 }
        // Public methods.
        /// <summary>
        /// Initializes the control with the list of nodes.
        /// </summary>
        /// <param name="nodes">The list of PlanetLab nodes.</param>
        /// <returns><b>True</b> if the user selected to save the nodes, <b>false</b> otherwise.</returns>
        public bool Initialize(PlDatabaseList<PlNode> nodes)
        {
            // Set the nodes.
            this.Nodes = nodes;

            // Reset the controls.
            this.progressBar.Minimum = 0;
            this.progressBar.Maximum = nodes.Count;
            this.progressBar.Value = 0;

            this.buttonClose.Enabled = true;

            this.labelProgress.Text = string.Empty;

            // Set the dialog result.
            this.Result = DialogResult.Cancel;

            // Save the list.
            return this.OnSave();
        }
Пример #5
0
        /// <summary>
        /// Creates a PlanetLab configuration instance at the specified registry key.
        /// </summary>
        /// <param name="rootKey">The root registry key.</param>
        /// <param name="path">The registry key.</param>
        public PlConfig(RegistryKey rootKey, string path)
        {
            // Open the PlanetLab configuration key.
            if (null == (this.key = rootKey.OpenSubKey(path, RegistryKeyPermissionCheck.ReadWriteSubTree)))
            {
                this.key = rootKey.CreateSubKey(path, RegistryKeyPermissionCheck.ReadWriteSubTree);
            }
            // Open the PlanetLab slices configuration key.
            if (null == (this.keySlices = this.key.OpenSubKey("Slices", RegistryKeyPermissionCheck.ReadWriteSubTree)))
            {
                this.keySlices = this.key.CreateSubKey("Slices", RegistryKeyPermissionCheck.ReadWriteSubTree);
            }

            // Set the root path.
            this.root = @"{0}\{1}".FormatWith(rootKey.Name, path);

            // Create the PlanetLab lists.
            this.listSites = new PlDatabaseList<PlSite>(this.dbSites);
            this.listNodes = new PlDatabaseList<PlNode>(this.dbNodes);
            this.listSlices = new PlDatabaseList<PlSlice>(this.dbSlices);
            this.listLocalPersons = new PlDatabaseList<PlPerson>(this.dbPersons);
            this.listLocalSlices = new PlDatabaseList<PlSlice>(this.dbSlices);

            // Set the lists event handlers.
            this.listLocalSlices.Cleared += this.OnSlicesCleared;
            this.listLocalSlices.Updated += this.OnSlicesUpdated;
            this.listLocalSlices.Added += this.OnSlicesAdded;
            this.listLocalSlices.Removed += this.OnSlicesRemoved;

            // Initialize the static configuration.
            CrawlerConfig.Static.PlanetLabUsername = this.Username;
            CrawlerConfig.Static.PlanetLabPassword = this.Password;
            CrawlerConfig.Static.PlanetLabPersonId = this.PersonId;
            CrawlerConfig.Static.PlanetLabSitesFileName = this.SitesFileName;
            CrawlerConfig.Static.PlanetLabNodesFileName = this.NodesFileName;
            CrawlerConfig.Static.PlanetLabLocalPersonsFileName = this.LocalPersonsFileName;
            CrawlerConfig.Static.PlanetLabLocalSlicesFileName = this.LocalSlicesFileName;
            CrawlerConfig.Static.PlanetLabSlicesFolder = this.SlicesFolder;
            CrawlerConfig.Static.PlanetLabSlicesLogFileName = this.SlicesLogFileName;
            CrawlerConfig.Static.PlanetLabCommandsFolder = this.CommandsFolder;
            CrawlerConfig.Static.PlanetLabHistoryFileName = this.HistoryFileName;
            CrawlerConfig.Static.PlanetLabHistoryRunFileName = this.HistoryRunFileName;

            // Load the PlanetLab sites configuration.
            try { this.listSites.LoadFromFile(this.SitesFileName); }
            catch { }

            // Load the PlanetLab nodes configuration.
            try { this.listNodes.LoadFromFile(this.NodesFileName); }
            catch { }

            // Load the PlanetLab slices configuration.
            try { this.listSlices.LoadFromFile(this.SlicesFileName); }
            catch { }

            // Load the PlanetLab local persons configuration.
            try { this.listLocalPersons.LoadFromFile(this.LocalPersonsFileName); }
            catch { }

            // Load the PlanetLab local slices configuration.
            try { this.listLocalSlices.LoadFromFile(this.LocalSlicesFileName); }
            catch { }
        }