Example #1
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Program.formCrash = new FormCrash();
            Application.ThreadException += Program.OnThreadException;

            ToolStripManager.Renderer = new ThemeRenderer(ThemeSettings.Blue);

            try
            {
                using (Crawler crawler = new Crawler(Registry.CurrentUser, Resources.ConfigRootPath))
                {
                    using (FormMain formMain = new FormMain(crawler))
                    {
                        Application.Run(formMain);
                    }
                }
            }
            catch (Exception exception)
            {
                Program.formCrash.ShowDialog(exception);
            }
            finally
            {
                Program.formCrash.Dispose();
            }
        }
 // Public methods.
 /// <summary>
 /// Initializes the control.
 /// </summary>
 /// <param name="crawler">The crawler.</param>
 public void Initialize(Crawler crawler)
 {
     // Set the crawler.
     this.crawler = crawler;
     // Enable the control.
     this.Enabled = true;
 }
 /// <summary>
 /// Initializes the control.
 /// </summary>
 /// <param name="crawler">A crawler object.</param>
 public void Initialize(Crawler crawler)
 {
     this.crawler = crawler;
     this.Enabled = true;
     this.LoadSettings();
     this.buttonSave.Enabled = false;
     this.buttonUndo.Enabled = false;
 }
        // Public methods.
        /// <summary>
        /// Initializes the control with a crawler instance.
        /// </summary>
        /// <param name="crawler">The crawler instance.</param>
        public void Initialize(Crawler crawler)
        {
            // Set the crawler.
            this.crawler = crawler;

            // Update the list of categories.
            this.OnUpdateList();
        }
 // Public methods.
 /// <summary>
 /// Opens the modal dialog to select a PlanetLab object.
 /// </summary>
 /// <param name="crawler">The crawler configuration.</param>
 /// <returns>The dialog result.</returns>
 public DialogResult ShowDialog(Crawler crawler)
 {
     // Reset the result.
     this.Result = null;
     // Refresh the results list.
     this.control.Refresh(crawler);
     // Show the dialog.
     return base.ShowDialog();
 }
        // Public methods.
        /// <summary>
        /// Initializes the control.
        /// </summary>
        /// <param name="crawler">The crawler.</param>
        /// <param name="treeNode">The root tree node.</param>
        /// <param name="controls">The controls collection.</param>
        public void Initialize(Crawler crawler, ImageList imageList, TreeNode treeNode, Control.ControlCollection controls)
        {
            // Set the parameters.
            this.crawler = crawler;
            this.imageList = imageList;
            this.treeNode = treeNode;
            this.controls = controls;

            // Enable the control.
            this.Enabled = true;

            // Set the image list.
            this.listView.SmallImageList = this.imageList;

            // Set the toolbox event handlers.
            this.crawler.Toolbox.ToolAdded += this.OnToolAdded;
            this.crawler.Toolbox.ToolRemoved += this.OnToolRemoved;

            // Load the current tools from the toolset.
            foreach (Tool tool in this.crawler.Toolbox)
            {
                this.OnAddTool(tool);
            }
        }
        /// <summary>
        /// Initializes the control with a crawler instance.
        /// </summary>
        /// <param name="crawler">The crawler instance.</param>
        /// <param name="treeNode">The root tree node for the database servers.</param>
        /// <param name="controls">The panel where to add the server control.</param>
        /// <param name="imageList">The image list.</param>
        public void Initialize(Crawler crawler, TreeNode treeNode, Control.ControlCollection controls, ImageList imageList)
        {
            // Set the crawler.
            this.crawler = crawler;
            // Set the root tree node.
            this.treeNode = treeNode;
            // Set the image list.
            this.listView.SmallImageList = imageList;
            // Set the controls collection.
            this.controls = controls;

            // Set the log event handler for the database servers.
            this.crawler.Database.Sql.EventLogged += this.OnEventLogged;

            // Add all the servers in the configuration.
            foreach (DbServerSql server in this.crawler.Database.Sql)
            {
                this.AddServer(server);
            }

            // Add the event handlers for the servers.
            this.crawler.Database.Sql.ServerAdded += this.OnServerAdded;
            this.crawler.Database.Sql.ServerChanged += this.OnServerChanged;
            this.crawler.Database.Sql.ServerStateChanged += this.OnServerStateChanged;
            this.crawler.Database.Sql.PrimaryServerChanged += this.OnPrimaryServerChanged;
            this.crawler.Database.Sql.ServerRemoved += this.OnServerRemoved;

            // Reload the server configurations.
            this.crawler.Database.Sql.Reload();
        }
        /// <summary>
        /// Initializes the control.
        /// </summary>
        /// <param name="crawler">The crawler instance.</param>
        /// <param name="server">The database server.</param>
        /// <param name="treeNode">The tree node corresponding to this server.</param>
        public void Initialize(Crawler crawler, DbServerSql server, TreeNode treeNode)
        {
            // Set the crawler.
            this.crawler = crawler;
            // Set the server.
            this.server = server;
            // Set the tree node and the tree node tag.
            this.treeNode = treeNode;

            // Set the title.
            this.panelServer.Title = "Database Server ({0})".FormatWith(server.Name);

            // Add the event handlers for the database server.
            this.server.ServerChanged += this.OnServerChanged;
            this.server.StateChanged += this.OnServerStateChanged;
            this.server.DatabaseChanged += this.OnDatabaseChanged;
            this.server.TableAdded += this.OnTableAdded;
            this.server.TableRemoved += this.OnTableRemoved;
            this.server.TableChanged += this.OnTableChanged;
            this.server.RelationshipAdded += this.OnRelationshipAdded;
            this.server.RelationshipRemoved += this.OnRelationshipRemoved;
            this.server.EventLogged += this.OnEventLogged;
            this.crawler.Database.Sql.PrimaryServerChanged += this.OnPrimaryServerChanged;

            // Initialize the contols.
            this.OnServerChanged(this, new DbServerEventArgs(this.server));
            this.OnServerStateChanged(this.server, null);

            // Initialize the server database.
            this.OnDatabaseChanged(this, new DbServerDatabaseChangedEventArgs(this.server, null, this.server.Database));

            // Initialize the server database tables.
            this.OnTablesChanged();

            // Initialize the server database relationships.
            this.OnRelationshipsChanged();
        }
 // 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>
        /// Initializes the control with a crawler object.
        /// </summary>
        /// <param name="crawler">The crawler object.</param>
        /// <param name="slice">The slice.</param>
        /// <param name="controls">The controls collection.</param>
        /// <param name="treeNode">The tree node corresponding to this control.</param>
        public void Initialize(Crawler crawler, PlSlice slice, Control.ControlCollection controls, TreeNode treeNode)
        {
            // Save the parameters.
            this.crawler = crawler;

            // Get the status handler.
            this.status = this.crawler.Status.GetHandler(this);

            // Set the slice.
            this.slice = slice;
            this.slice.Changed += this.OnSliceChanged;

            // Set the controls.
            this.controls = controls;

            // Set the tree node.
            this.treeNodeSlice = treeNode;

            // Set the slice configuration.
            this.config = this.crawler.PlanetLab.GetSliceConfiguration(this.slice);

            // Set the title.
            this.panelSlice.Title = "PlanetLab Slice ({0})".FormatWith(this.slice.Name);

            // Enable the control.
            this.Enabled = true;

            // Update the information of the PlanetLab slice.
            this.OnUpdateSlice();

            // Create the run option.
            this.OnCreateRun();

            // Create the log option.
            this.OnCreateLog();
        }
 /// <summary>
 /// Opens the modal dialog to select a PlanetLab object.
 /// </summary>
 /// <param name="owner">The window owner.</param>
 /// <param name="crawler">The crawler configuration.</param>
 /// <returns>The dialog result.</returns>
 public DialogResult ShowDialog(IWin32Window owner, Crawler crawler)
 {
     // Reset the result.
     this.Result = null;
     // Refresh the control.
     this.control.Refresh(crawler);
     // Show the dialog.
     return base.ShowDialog(owner);
 }
 // Public methods.
 /// <summary>
 /// Initializes the control with the specified crawler object.
 /// </summary>
 /// <param name="crawler">The crawler.</param>
 public void Initialize(Crawler crawler)
 {
     // Set the settings crawler.
     this.settings.Crawler = crawler;
 }
 // Public methods.
 /// <summary>
 /// Initializes the control with the specified crawler object.
 /// </summary>
 /// <param name="crawler">The crawler.</param>
 /// <param name="imageList">The image list.</param>
 /// <param name="treeNode">The root tree node.</param>
 /// <param name="controls">The controls collection.</param>
 public void Initialize(Crawler crawler, ImageList imageList, TreeNode treeNode, Control.ControlCollection controls)
 {
     // Initialize the settings.
     this.settings.Initialize(crawler, imageList, treeNode, controls);
 }
        // Public methods.
        /// <summary>
        /// Initializes the control with a crawler object.
        /// </summary>
        /// <param name="crawler">The crawler object.</param>
        /// <param name="treeNode">The root tree node for the database servers.</param>
        /// <param name="controls">The panel where to add the server control.</param>
        public void Initialize(Crawler crawler, TreeNode treeNode, Control.ControlCollection controls)
        {
            // Save the parameters.
            this.crawler = crawler;

            // Set the slices list event handler.
            this.crawler.PlanetLab.LocalSlices.Updated += this.OnSlicesUpdated;
            this.crawler.PlanetLab.LocalSlices.Cleared += this.OnSlicesCleared;
            this.crawler.PlanetLab.LocalSlices.Added += this.OnSlicesAdded;
            this.crawler.PlanetLab.LocalSlices.Removed += this.OnSlicesRemoved;

            // Get the status handler.
            this.status = this.crawler.Status.GetHandler(this);

            // Set the tree node.
            this.treeNode = treeNode;

            // Set the control collection.
            this.controls = controls;

            // Enable the control.
            this.Enabled = true;

            // Update the list of PlanetLab slices.
            this.OnSlicesUpdated(this, EventArgs.Empty);
        }
        /// <summary>
        /// Initializes the control.
        /// </summary>
        /// <param name="crawler">The crawler instance.</param>
        /// <param name="server">The database server.</param>
        public void Initialize(Crawler crawler, DbServerSql server)
        {
            // Set the crawler.
            this.crawler = crawler;
            // Set the server.
            this.server = server;

            // Add the event handlers for the database server.
            this.server.StateChanged += this.OnServerStateChanged;

            // Initialize the contols.
            this.OnServerStateChanged(this.server, null);
        }
        /// <summary>
        /// Initializes the control with a crawler object.
        /// </summary>
        /// <param name="crawler">The crawler object.</param>
        public void Initialize(Crawler crawler)
        {
            // Save the parameters.
            this.crawler = crawler;

            // Enable the control.
            this.Enabled = true;

            // Set the button enabled state.
            this.buttonStart.Enabled = this.crawler.Spiders.StandardFeeds.State == Spider.CrawlState.Stopped;
            this.buttonStop.Enabled = this.crawler.Spiders.StandardFeeds.State == Spider.CrawlState.Running;
            this.buttonFeeds.Enabled = this.crawler.Spiders.StandardFeeds.State == Spider.CrawlState.Stopped;

            // Create the event handlers.
            this.crawler.Spiders.StandardFeeds.StateChanged += this.OnSpiderStateChanged;
            this.crawler.Spiders.StandardFeeds.CrawlStarted += this.OnSpiderCrawlStarted;
            this.crawler.Spiders.StandardFeeds.CrawlFinished += this.OnSpiderCrawlFinished;
            this.crawler.Spiders.StandardFeeds.FeedsCrawlStarted += this.OnFeedsCrawlStarted;
            this.crawler.Spiders.StandardFeeds.FeedsCrawlFinished += this.OnFeedsCrawlFinished;
            this.crawler.Spiders.StandardFeeds.FeedCrawlStarted += this.OnFeedCrawlStarted;
            this.crawler.Spiders.StandardFeeds.FeedCrawlFinished += this.OnFeedCrawlFinished;

            // Initialize the progress list box and checked list.
            for (int index = 0; index < YouTubeUri.StandardFeedNames.Length; index++)
            {
                // Get whether the feed is selected.
                bool selected = this.crawler.Spiders.StandardFeeds.GetFeedSelected(InetApi.YouTube.Api.V2.YouTube.StandardFeeds[index]);
                // Initialize the progress item.
                progressItems[index].Enabled = selected;
                // Initialize the checked item.
                this.checkedListFeeds.AddItem(
                    index,
                    YouTubeUri.StandardFeedNames[index],
                    selected ? CheckState.Checked : CheckState.Unchecked);
            }
        }
        // Public methods.
        /// <summary>
        /// Initializes the control with a crawler object.
        /// </summary>
        /// <param name="crawler">The crawler object.</param>
        public void Initialize(Crawler crawler)
        {
            // Save the parameters.
            this.crawler = crawler;
            this.request = new YouTubeRequestFeed<Video>(this.crawler.YouTube.Settings);

            // Enable the control.
            this.Enabled = true;

            // Update the categories.
            this.OnUpdateCategories(this, EventArgs.Empty);
        }
        /// <summary>
        /// Initializes the control with a crawler object.
        /// </summary>
        /// <param name="crawler">The crawler object.</param>
        /// <param name="delegateFeed">The feed event handler.</param>
        /// <param name="idName">The ID name.</param>
        /// <param name="feedName">The feed name.</param>
        /// <param name="objectName">The object name.</param>
        /// <param name="logSource">The log source.</param>
        public void Initialize(Crawler crawler, VideosFeedEventHandler delegateFeed, string idName, string feedName, string objectName, string logSource)
        {
            // Save the parameters.
            this.crawler = crawler;
            this.delegateFeed = delegateFeed;
            this.labelId.Text = idName;
            this.feedName = feedName;
            this.objectName = objectName;
            this.logSource = logSource;
            this.request = new YouTubeRequestFeed<Video>(this.crawler.YouTube.Settings);

            // Enable the control
            this.Enabled = true;
        }
        // Public methods.
        /// <summary>
        /// Refreshes the current slice information.
        /// </summary>
        /// <param name="crawler">The crawler configuration.</param>
        /// <param name="slice">The current slice.</param>
        public void Refresh(Crawler crawler, PlSlice slice)
        {
            // Set the slices database.
            this.slices = crawler.PlanetLab.DbSlices;
            // Set the slice.
            this.slice = slice;

            // Clear the buttons state.
            this.buttonRefresh.Enabled = true;
            this.buttonCancel.Enabled = false;
            this.buttonRenew.Enabled = false;
            this.buttonClose.Enabled = true;

            // Clear the status.
            this.labelStatus.Text = "Ready.";

            // Update the slice information.
            this.OnUpdateSlice();
        }
Example #20
0
        /// <summary>
        /// Constructor for main form window.
        /// </summary>
        public FormMain(Crawler crawler)
        {
            // Initialize the component.
            this.InitializeComponent();

            // Get the theme settings.
            this.themeSettings = ToolStripManager.Renderer is ThemeRenderer ? (ToolStripManager.Renderer as ThemeRenderer).Settings : ThemeSettings.Default;

            // Initialize the crawler
            this.crawler = crawler;

            // Create the tree view items.
            this.treeNodePlanetLabSites = new TreeNode("Sites",
                this.imageList.Images.IndexOfKey("FolderClosedGlobe"),
                this.imageList.Images.IndexOfKey("FolderOpenGlobe"));
            this.treeNodePlanetLabNodes = new TreeNode("Nodes",
                this.imageList.Images.IndexOfKey("FolderClosedGlobe"),
                this.imageList.Images.IndexOfKey("FolderOpenGlobe"));
            this.treeNodePlanetLabSlices = new TreeNode("Slices",
                this.imageList.Images.IndexOfKey("FolderClosedGlobe"),
                this.imageList.Images.IndexOfKey("FolderOpenGlobe"));
            this.treeNodePlanetLab = new TreeNode("PlanetLab",
                this.imageList.Images.IndexOfKey("ServersGlobe"),
                this.imageList.Images.IndexOfKey("ServersGlobe"),
                new TreeNode[] {
                    this.treeNodePlanetLabSites,
                    this.treeNodePlanetLabNodes,
                    this.treeNodePlanetLabSlices
                });

            this.treeNodeToolboxInfo = new TreeNode("Toolbox",
                this.imageList.Images.IndexOfKey("ServerToolbox"),
                this.imageList.Images.IndexOfKey("ServerToolbox")
                );

            this.treeNodeDatabaseServers = new TreeNode("Servers",
                this.imageList.Images.IndexOfKey("ServersDatabase"),
                this.imageList.Images.IndexOfKey("ServersDatabase"));

            this.treeNodeSpiderStandardFeeds = new TreeNode("Standard feeds",
                this.imageList.Images.IndexOfKey("Cube"),
                this.imageList.Images.IndexOfKey("Cube"));
            this.treeNodeSpidersLocal = new TreeNode("Local spiders",
                this.imageList.Images.IndexOfKey("ServerCube"),
                this.imageList.Images.IndexOfKey("ServerCube"),
                new TreeNode[] {
                    this.treeNodeSpiderStandardFeeds
                });

            this.treeNodeYouTubeApi2VideoComments = new TreeNode("Comments",
                this.imageList.Images.IndexOfKey("FolderClosedComment"),
                this.imageList.Images.IndexOfKey("FolderOpenComment"));
            this.treeNodeYouTubeApi2Video = new TreeNode("Video",
                this.imageList.Images.IndexOfKey("FileVideo"),
                this.imageList.Images.IndexOfKey("FileVideo"),
                new TreeNode[] {
                    this.treeNodeYouTubeApi2VideoComments
                });
            this.treeNodeYouTubeApi2SearchFeed = new TreeNode("Search",
                this.imageList.Images.IndexOfKey("FolderClosedVideo"),
                this.imageList.Images.IndexOfKey("FolderOpenVideo"));
            this.treeNodeYouTubeApi2StandardFeed = new TreeNode("Standard feeds",
                this.imageList.Images.IndexOfKey("FolderClosedVideo"),
                this.imageList.Images.IndexOfKey("FolderOpenVideo"));
            this.treeNodeYouTubeApi2RelatedVideosFeed = new TreeNode("Related videos feed",
                this.imageList.Images.IndexOfKey("FolderClosedVideo"),
                this.imageList.Images.IndexOfKey("FolderOpenVideo"));
            this.treeNodeYouTubeApi2ResponseVideosFeed = new TreeNode("Response videos feed",
                this.imageList.Images.IndexOfKey("FolderClosedVideo"),
                this.imageList.Images.IndexOfKey("FolderOpenVideo"));
            this.treeNodeYouTubeApi2VideosFeedsInfo = new TreeNode("Global videos",
                this.imageList.Images.IndexOfKey("FolderClosedVideo"),
                this.imageList.Images.IndexOfKey("FolderOpenVideo"),
                new TreeNode[] {
                    this.treeNodeYouTubeApi2Video,
                    this.treeNodeYouTubeApi2SearchFeed,
                    this.treeNodeYouTubeApi2StandardFeed,
                    this.treeNodeYouTubeApi2RelatedVideosFeed,
                    this.treeNodeYouTubeApi2ResponseVideosFeed
                });
            this.treeNodeYouTubeApi2UploadsFeed = new TreeNode("Uploads feed",
                this.imageList.Images.IndexOfKey("FolderClosedVideo"),
                this.imageList.Images.IndexOfKey("FolderOpenVideo"));
            this.treeNodeYouTubeApi2PlaylistFeed = new TreeNode("Playlist feed",
                this.imageList.Images.IndexOfKey("FolderClosedVideo"),
                this.imageList.Images.IndexOfKey("FolderOpenVideo"));
            this.treeNodeYouTubeApi2Playlists = new TreeNode("Playlists",
                this.imageList.Images.IndexOfKey("FolderClosedPlayBlue"),
                this.imageList.Images.IndexOfKey("FolderOpenPlayBlue"),
                new TreeNode[] {
                    this.treeNodeYouTubeApi2PlaylistFeed
                });
            this.treeNodeYouTubeApi2FavoritesFeed = new TreeNode("Favorites feed",
                this.imageList.Images.IndexOfKey("FolderClosedVideo"),
                this.imageList.Images.IndexOfKey("FolderOpenVideo"));
            this.treeNodeYouTubeApi2User = new TreeNode("User",
                this.imageList.Images.IndexOfKey("FileUser"),
                this.imageList.Images.IndexOfKey("FileUser"),
                new TreeNode[] {
                    this.treeNodeYouTubeApi2UploadsFeed,
                    this.treeNodeYouTubeApi2FavoritesFeed,
                    this.treeNodeYouTubeApi2Playlists
                });
            this.treeNodeYouTubeApi2UserFeedsInfo = new TreeNode("User videos",
                this.imageList.Images.IndexOfKey("FolderClosedUser"),
                this.imageList.Images.IndexOfKey("FolderOpenUser"),
                new TreeNode[] {
                    this.treeNodeYouTubeApi2User
                });
            this.treeNodeYouTubeApi2VideoCategories = new TreeNode("Video categories",
                this.imageList.Images.IndexOfKey("Categories"),
                this.imageList.Images.IndexOfKey("Categories"));
            this.treeNodeYouTubeApi2 = new TreeNode("YouTube API version 2",
                this.imageList.Images.IndexOfKey("ServerBrowse"),
                this.imageList.Images.IndexOfKey("ServerBrowse"),
                new TreeNode[] {
                    this.treeNodeYouTubeApi2VideosFeedsInfo,
                    this.treeNodeYouTubeApi2UserFeedsInfo,
                    this.treeNodeYouTubeApi2VideoCategories
                });
            this.treeNodeYouTubeApi3Videos = new TreeNode("Videos",
                this.imageList.Images.IndexOfKey("FolderClosedVideo"),
                this.imageList.Images.IndexOfKey("FolderOpenVideo"));
            this.treeNodeYouTubeApi3 = new TreeNode("YouTube API version 3",
                this.imageList.Images.IndexOfKey("ServerBrowse"),
                this.imageList.Images.IndexOfKey("ServerBrowse"),
                new TreeNode[] {
                    this.treeNodeYouTubeApi3Videos
                });
            this.treeNodeYouTubeWebVideos = new TreeNode("Videos",
                this.imageList.Images.IndexOfKey("FileGraphLine"),
                this.imageList.Images.IndexOfKey("FileGraphLine"));
            this.treeNodeYouTubeWeb = new TreeNode("YouTube Web",
                this.imageList.Images.IndexOfKey("GlobeBrowse"),
                this.imageList.Images.IndexOfKey("GlobeBrowse"),
                new TreeNode[] {
                    this.treeNodeYouTubeWebVideos
                });

            this.treeNodeTasksRunning = new TreeNode("Running tasks",
                this.imageList.Images.IndexOfKey("FolderClosedPlayGreen"),
                this.imageList.Images.IndexOfKey("FolderOpenPlayGreen"));
            this.treeNodeTasksScheduled = new TreeNode("Scheduled tasks",
                this.imageList.Images.IndexOfKey("FolderClosedClock"),
                this.imageList.Images.IndexOfKey("FolderOpenClock"));
            this.treeNodeTasksAll = new TreeNode("All tasks",
                this.imageList.Images.IndexOfKey("FolderClosedTask"),
                this.imageList.Images.IndexOfKey("FolderOpenTask"));
            this.treeNodeTasksInfo = new TreeNode("Tasks",
                this.imageList.Images.IndexOfKey("ServerTask"),
                this.imageList.Images.IndexOfKey("ServerTask"),
                new TreeNode[] {
                    this.treeNodeTasksRunning,
                    this.treeNodeTasksScheduled,
                    this.treeNodeTasksAll
                });

            this.treeNodeSettings = new TreeNode("Settings",
                this.imageList.Images.IndexOfKey("Settings"),
                this.imageList.Images.IndexOfKey("Settings"));

            this.treeNodeCommentsVideos = new TreeNode("Videos",
                this.imageList.Images.IndexOfKey("CommentVideo"),
                this.imageList.Images.IndexOfKey("CommentVideo"));
            this.treeNodeCommentsUsers = new TreeNode("Users",
                this.imageList.Images.IndexOfKey("CommentUser"),
                this.imageList.Images.IndexOfKey("CommentUser"));
            this.treeNodeCommentsPlaylists = new TreeNode("Playlists",
                this.imageList.Images.IndexOfKey("CommentPlay"),
                this.imageList.Images.IndexOfKey("CommentPlay"));
            this.treeNodeComments = new TreeNode("Comments",
                this.imageList.Images.IndexOfKey("Comments"),
                this.imageList.Images.IndexOfKey("Comments"),
                new TreeNode[] {
                    this.treeNodeCommentsVideos,
                    this.treeNodeCommentsUsers,
                    this.treeNodeCommentsPlaylists
                });

            // Add the panel controls to the split container.
            this.splitContainer.Panel2.Controls.Add(this.controlPlanetLab);
            this.splitContainer.Panel2.Controls.Add(this.controlPlanetLabSites);
            this.splitContainer.Panel2.Controls.Add(this.controlPlanetLabNodes);
            this.splitContainer.Panel2.Controls.Add(this.controlPlanetLabSlices);
            this.splitContainer.Panel2.Controls.Add(this.controlDatabaseServers);
            this.splitContainer.Panel2.Controls.Add(this.controlToolboxInfo);
            this.splitContainer.Panel2.Controls.Add(this.controlSpiderInfo);
            this.splitContainer.Panel2.Controls.Add(this.controlSpiderStandardFeeds);
            this.splitContainer.Panel2.Controls.Add(this.controlYtApi2);
            this.splitContainer.Panel2.Controls.Add(this.controlYtApi2VideosFeedsInfo);
            this.splitContainer.Panel2.Controls.Add(this.controlYtApi2Video);
            this.splitContainer.Panel2.Controls.Add(this.controlYtApi2CommentsFeed);
            this.splitContainer.Panel2.Controls.Add(this.controlYtApi2StandardFeed);
            this.splitContainer.Panel2.Controls.Add(this.controlYtApi2Search);
            this.splitContainer.Panel2.Controls.Add(this.controlYtApi2RelatedFeed);
            this.splitContainer.Panel2.Controls.Add(this.controlYtApi2ResponseFeed);
            this.splitContainer.Panel2.Controls.Add(this.controlYtApi2UserFeedInfo);
            this.splitContainer.Panel2.Controls.Add(this.controlYtApi2Profile);
            this.splitContainer.Panel2.Controls.Add(this.controlYtApi2UploadsFeed);
            this.splitContainer.Panel2.Controls.Add(this.controlYtApi2PlaylistsFeed);
            this.splitContainer.Panel2.Controls.Add(this.controlYtApi2FavoritesFeed);
            this.splitContainer.Panel2.Controls.Add(this.controlYtApi2PlaylistFeed);
            this.splitContainer.Panel2.Controls.Add(this.controlYtApi2Categories);
            this.splitContainer.Panel2.Controls.Add(this.controlYtApi3);
            this.splitContainer.Panel2.Controls.Add(this.controlYtWeb);
            this.splitContainer.Panel2.Controls.Add(this.controlYtWebStatistics);
            this.splitContainer.Panel2.Controls.Add(this.controlSettings);
            this.splitContainer.Panel2.Controls.Add(this.controlLog);
            this.splitContainer.Panel2.Controls.Add(this.controlCommentsInfo);
            this.splitContainer.Panel2.Controls.Add(this.controlCommentsVideos);
            this.splitContainer.Panel2.Controls.Add(this.controlCommentsUsers);
            this.splitContainer.Panel2.Controls.Add(this.controlCommentsPlaylists);

            // Add the panel controls as tags.
            this.treeNodePlanetLab.Tag = this.controlPlanetLab;
            this.treeNodePlanetLabSites.Tag = this.controlPlanetLabSites;
            this.treeNodePlanetLabNodes.Tag = this.controlPlanetLabNodes;
            this.treeNodePlanetLabSlices.Tag = this.controlPlanetLabSlices;

            this.treeNodeDatabaseServers.Tag = this.controlDatabaseServers;

            this.treeNodeToolboxInfo.Tag = this.controlToolboxInfo;

            this.treeNodeSpidersLocal.Tag = this.controlSpiderInfo;
            this.treeNodeSpiderStandardFeeds.Tag = this.controlSpiderStandardFeeds;

            this.treeNodeYouTubeApi2.Tag = this.controlYtApi2;
            this.treeNodeYouTubeApi2VideosFeedsInfo.Tag = this.controlYtApi2VideosFeedsInfo;
            this.treeNodeYouTubeApi2Video.Tag = this.controlYtApi2Video;
            this.treeNodeYouTubeApi2VideoComments.Tag = this.controlYtApi2CommentsFeed;
            this.treeNodeYouTubeApi2SearchFeed.Tag = this.controlYtApi2Search;
            this.treeNodeYouTubeApi2StandardFeed.Tag = this.controlYtApi2StandardFeed;
            this.treeNodeYouTubeApi2RelatedVideosFeed.Tag = this.controlYtApi2RelatedFeed;
            this.treeNodeYouTubeApi2ResponseVideosFeed.Tag = this.controlYtApi2ResponseFeed;
            this.treeNodeYouTubeApi2UserFeedsInfo.Tag = this.controlYtApi2UserFeedInfo;
            this.treeNodeYouTubeApi2User.Tag = this.controlYtApi2Profile;
            this.treeNodeYouTubeApi2UploadsFeed.Tag = this.controlYtApi2UploadsFeed;
            this.treeNodeYouTubeApi2Playlists.Tag = this.controlYtApi2PlaylistsFeed;
            this.treeNodeYouTubeApi2FavoritesFeed.Tag = this.controlYtApi2FavoritesFeed;
            this.treeNodeYouTubeApi2PlaylistFeed.Tag = this.controlYtApi2PlaylistFeed;
            this.treeNodeYouTubeApi2VideoCategories.Tag = this.controlYtApi2Categories;
            this.treeNodeYouTubeApi3.Tag = this.controlYtApi3;
            this.treeNodeYouTubeWeb.Tag = this.controlYtWeb;
            this.treeNodeYouTubeWebVideos.Tag = this.controlYtWebStatistics;

            this.treeNodeSettings.Tag = this.controlSettings;
            this.controlSideLog.Tag = this.controlLog;
            this.treeNodeComments.Tag = this.controlCommentsInfo;
            this.treeNodeCommentsVideos.Tag = this.controlCommentsVideos;
            this.treeNodeCommentsUsers.Tag = this.controlCommentsUsers;
            this.treeNodeCommentsPlaylists.Tag = this.controlCommentsPlaylists;

            // Add the tree nodes to the side panel tree views.
            this.controlSidePlanetLab.Nodes.Add(this.treeNodePlanetLab);
            this.controlSideToolbox.Nodes.Add(this.treeNodeToolboxInfo);
            this.controlSideDatabase.Nodes.Add(this.treeNodeDatabaseServers);
            this.controlSideSpiders.Nodes.Add(this.treeNodeSpidersLocal);
            this.controlSideYouTube.Nodes.AddRange(
                new TreeNode[] {
                    this.treeNodeYouTubeApi2,
                    this.treeNodeYouTubeApi3,
                    this.treeNodeYouTubeWeb
                });
            this.controlSideTasks.Nodes.Add(this.treeNodeTasksInfo);
            this.controlSideConfiguration.Nodes.Add(this.treeNodeSettings);
            this.controlSideComments.Nodes.Add(this.treeNodeComments);

            // Set the status event handler.
            this.crawler.Status.MessageChanged += this.OnStatusMessageChanged;
            this.crawler.Status.LockChanged += this.OnStatusLockChanged;

            // Set the crawler event handlers.

            this.crawler.Events.PageSelected += this.OnPageSelected;

            this.crawler.Events.PlanetLabSitesSelected += this.OnPlanetLabSitesSelected;
            this.crawler.Events.PlanetLabNodesSelected += this.OnPlanetLabNodesSelected;
            this.crawler.Events.PlanetLabSlicesSelected += this.OnPlanetLabSlicesSelected;

            this.crawler.Events.YouTubeVideoFeedsSelected += this.OnYouTubeApiV2VideosFeedsInfoSelected;
            this.crawler.Events.YouTubeUserFeedsSelected += this.OnYouTubeApiV2UserFeedsInfoSelected;
            this.crawler.Events.YouTubeCategoriesSelected += this.OnYouTubeApi2VideoCategoriesSelected;

            this.crawler.Events.YouTubeVideoSelected += this.OnYouTubeApiV2VideoSelected;
            this.crawler.Events.YouTubeVideoCommentsSelected += this.OnYouTubeApiV2VideoCommentsSelected;
            this.crawler.Events.YouTubeSearchFeedSelected += this.OnYouTubeApiV2SearchFeedSelected;
            this.crawler.Events.YouTubeStandardFeedSelected += this.OnYouTubeApiV2StandardFeedSelected;
            this.crawler.Events.YouTubeRelatedVideosFeedSelected += this.OnYouTubeApiV2RelatedVideosFeedSelected;
            this.crawler.Events.YouTubeResponseVideosFeedSelected += this.OnYouTubeApiV2ResponseVideosFeedSelected;

            this.crawler.Events.YouTubeUserSelected += this.OnYouTubeApiV2UserSelected;
            this.crawler.Events.YouTubeUploadsFeedSelected += this.OnYouTubeApiV2UserUploadsSelected;
            this.crawler.Events.YouTubeFavoritesFeedSelected += this.OnYouTubeApiV2UserFavoritesSelected;
            this.crawler.Events.YouTubePlaylistsFeedSelected += this.OnYouTubeApiV2UserPlaylistsSelected;
            this.crawler.Events.YouTubePlaylistFeedSelected += this.OnYouTubeApiV2PlaylistVideosSelected;

            this.crawler.Events.YouTubeApiV2VideoOpened += this.OnYouTubeApiV2VideoOpened;
            this.crawler.Events.YouTubeApiV2VideoCommentOpened += this.OnYouTubeApiV2VideoCommentOpened;
            this.crawler.Events.YouTubeApiV2RelatedVideosOpened += this.OnYouTubeApiV2RelatedVideosOpened;
            this.crawler.Events.YouTubeApiV2ResponseVideosOpened += this.OnYouTubeApiV2ResponseVideosOpened;

            this.crawler.Events.YouTubeApiV2UserOpened += this.OnYouTubeApiV2AuthorOpened;
            this.crawler.Events.YouTubeApiV2UserUploadsOpened += this.OnYouTubeApiV2UserUploadsOpened;
            this.crawler.Events.YouTubeApiV2UserFavoritesOpened += this.OnYouTubeApiV2UserFavoritesOpened;
            this.crawler.Events.YouTubeApiV2UserPlaylistsOpened += this.OnYouTubeApiV2UserPlaylistsOpened;

            this.crawler.Events.YouTubeApiV2PlaylistOpened += this.OnYouTubeApiV2PlaylistOpened;

            this.crawler.Events.YouTubeWebVideosSelected += this.OnYouTubeWebVideosSelected;
            this.crawler.Events.YouTubeWebVideoOpened += this.OnYouTubeWebVideoOpened;

            this.crawler.Events.CommentsYouTubeVideosSelected += this.OnYouTubeCommentsVideosSelected;
            this.crawler.Events.CommentsYouTubeUsersSelected += this.OnYouTubeCommentsUsersSelected;
            this.crawler.Events.CommentsYouTubePlaylistsSelected += this.OnYouTubeCommentsPlaylistsSelected;

            this.crawler.Events.YouTubeVideoCommented += this.OnYouTubeVideoCommented;
            this.crawler.Events.YouTubeUserCommented += this.OnYouTubeUserCommented;
            this.crawler.Events.YouTubePlaylistCommented += this.OnYouTubePlaylistCommented;

            this.crawler.Events.SpiderStandardFeedsSelected += this.OnSpiderStandardFeedsSelected;

            // Initialize the controls.
            this.controlPlanetLab.Initialize(this.crawler);
            this.controlPlanetLabSites.Initialize(this.crawler);
            this.controlPlanetLabNodes.Initialize(this.crawler);
            this.controlPlanetLabSlices.Initialize(this.crawler, this.treeNodePlanetLabSlices, this.splitContainer.Panel2.Controls);
            this.controlDatabaseServers.Initialize(this.crawler, this.treeNodeDatabaseServers, this.splitContainer.Panel2.Controls, this.imageList);
            this.controlToolboxInfo.Initialize(this.crawler, this.imageList, this.treeNodeToolboxInfo, this.splitContainer.Panel2.Controls);
            this.controlSpiderStandardFeeds.Initialize(this.crawler);
            this.controlYtApi2.Initialize(this.crawler);
            this.controlYtApi2VideosFeedsInfo.Initialize(this.crawler);
            this.controlYtApi2Video.Initialize(this.crawler);
            this.controlYtApi2CommentsFeed.Initialize(this.crawler);
            this.controlYtApi2StandardFeed.Initialize(this.crawler);
            this.controlYtApi2Search.Initialize(this.crawler);
            this.controlYtApi2RelatedFeed.Initialize(this.crawler, new VideosFeedEventHandler(YouTubeUri.GetRelatedVideosFeed), "&Video:", "related videos feed", "video", "APIv2 Related Videos Feed");
            this.controlYtApi2ResponseFeed.Initialize(this.crawler, new VideosFeedEventHandler(YouTubeUri.GetResponseVideosFeed), "&Video:", "response videos feed", "video", "APIv2 Response Videos Feed");
            this.controlYtApi2UserFeedInfo.Initailize(this.crawler);
            this.controlYtApi2Profile.Initialize(this.crawler);
            this.controlYtApi2PlaylistsFeed.Initialize(this.crawler);
            this.controlYtApi2UploadsFeed.Initialize(this.crawler, new VideosFeedEventHandler(YouTubeUri.GetUploadsFeed), "&User:"******"uploads video feed", "user", "APIv2 Uploads Videos Feed");
            this.controlYtApi2FavoritesFeed.Initialize(this.crawler, new VideosFeedEventHandler(YouTubeUri.GetFavoritesFeed), "&User:"******"favorites video feed", "user", "APIv2 Favorites Videos Feed");
            this.controlYtApi2PlaylistFeed.Initialize(this.crawler, new VideosFeedEventHandler(YouTubeUri.GetPlaylistFeed), "&Playlist:", "playlist video feed", "user", "APIv2 Playlist Videos Feed");
            this.controlYtApi2Categories.Initialize(this.crawler);
            this.controlYtWeb.Initialize(this.crawler);
            this.controlYtWebStatistics.Initialize(this.crawler);
            this.controlSettings.Initialize(this.crawler);
            this.controlLog.Initialize(this.crawler.Config, this.crawler.Log);
            this.controlCommentsVideos.Initialize(this.crawler.Comments.Videos, InetCrawler.Comments.CrawlerComment.CommentType.Video);
            this.controlCommentsUsers.Initialize(this.crawler.Comments.Users, InetCrawler.Comments.CrawlerComment.CommentType.User);
            this.controlCommentsPlaylists.Initialize(this.crawler.Comments.Playlists, InetCrawler.Comments.CrawlerComment.CommentType.Playlist);

            // Set the selected control.
            this.controlPanel = this.labelNotAvailable;

            // Initialize the side controls.
            this.controlSidePlanetLab.Initialize();
            this.controlSideToolbox.Initialize();
            this.controlSideDatabase.Initialize();
            this.controlSideSpiders.Initialize();
            this.controlSideYouTube.Initialize();
            this.controlSideTasks.Initialize();
            this.controlSideLog.Initialize();
            this.controlSideConfiguration.Initialize();
            this.controlSideComments.Initialize();

            // Configure the side menu with the last saved configuration.
            this.sideMenu.VisibleItems = this.crawler.Config.ConsoleSideMenuVisibleItems;
            this.sideMenu.SelectedIndex = this.crawler.Config.ConsoleSideMenuSelectedItem;
            if (this.sideMenu.SelectedItem.HasControl && this.sideMenu.SelectedItem.Control.HasSelected())
            {
                this.sideMenu.SelectedItem.Control.SetSelected(this.crawler.Config.ConsoleSideMenuSelectedNode);
            }

            // Create the network status event handler.
            this.actionNetworkStatusChanged = new EventHandler(this.OnNetworkStatusChanged);
            this.actionNetworkStatusChecked = new EventHandler(this.OnNetworkStatusChecked);
            // Set the network availability event handler.
            NetworkStatus.NetworkChanged += this.actionNetworkStatusChanged;
            NetworkStatus.NetworkChecked += this.actionNetworkStatusChecked;
            // Update the network status.
            this.OnNetworkStatusChanged(this, EventArgs.Empty);

            // Set the font.
            Window.SetFont(this);
        }
        // Public methods.
        /// <summary>
        /// Initializes the control with a crawler object.
        /// </summary>
        /// <param name="crawler">The crawler object.</param>
        /// <param name="slice">The slice.</param>
        /// <param name="config">The slice configuration.</param>
        /// <param name="treeNode">The tree node.</param>
        public void Initialize(Crawler crawler, PlSlice slice, PlConfigSlice config, TreeNode treeNode)
        {
            // Save the parameters.
            this.crawler = crawler;

            // Get the status handler.
            this.status = this.crawler.Status.GetHandler(this);

            // Set the slice.
            this.slice = slice;
            this.slice.Changed += this.OnSliceChanged;

            // Set the slice configuration.
            this.config = config;

            // Set the commands event handlers.
            this.config.Commands.CommandAdded += this.OnCommandAdded;
            this.config.Commands.CommandRemoved += this.OnCommandRemoved;

            // Create the manager.
            this.manager = new PlManager(this.crawler);

            // Add the PlanetLab manager event handlers.
            this.manager.Starting += this.OnRunStarting;
            this.manager.Started += this.OnRunStarted;
            this.manager.Pausing += this.OnRunPausing;
            this.manager.Paused += this.OnRunPaused;
            this.manager.Resuming += this.OnRunResuming;
            this.manager.Resumed += this.OnRunResumed;
            this.manager.Stopping += this.OnRunStopping;
            this.manager.Stopped += this.OnRunStopped;

            this.manager.NodesUpdateStarted += this.OnNodesUpdateStarted;
            this.manager.NodesUpdateCanceled += this.OnNodesUpdateCanceled;
            this.manager.NodesUpdateFinishedSuccess += this.OnNodesUpdateFinishedSuccess;
            this.manager.NodesUpdateFinishedFail += this.OnNodesUpdateFinishedFail;

            this.manager.NodeEnabled += this.OnNodeEnabled;
            this.manager.NodeDisabled += this.OnNodeDisabled;
            this.manager.NodeSkipped += this.OnNodeSkipped;
            this.manager.NodeStarted += this.OnNodeStarted;
            this.manager.NodeCanceled += this.OnNodeCanceled;
            this.manager.NodeFinishedSuccess += this.OnNodeFinishedSuccess;
            this.manager.NodeFinishedFail += this.OnNodeFinishedFail;

            this.manager.CommandStarted += this.OnCommandStarted;
            this.manager.CommandCanceled += this.OnCommandCanceled;
            this.manager.CommandFinishedSuccess += this.OnCommandFinishedSuccess;
            this.manager.CommandFinishedFail += this.OnCommandFinishedFail;

            this.manager.SubcommandSuccess += this.OnSubcommandSuccess;
            this.manager.SubcommandFail += this.OnSubcommandFail;

            // Create the manager history.
            this.managerHistory = new PlManagerHistory(slice);

            // Set the tree node.
            this.treeNode = treeNode;

            // Set the title.
            this.panelRun.Title = "Run on PlanetLab Slice ({0})".FormatWith(this.slice.Name);

            // Enable the control.
            this.Enabled = true;

            // Initialize the tools control.
            this.controlMethods.Initialize(this.crawler.Toolbox, this.config.ToolMethods, ControlSliceRun.toolTriggers);

            // Load the configuration.
            this.OnLoadConfiguration(this, EventArgs.Empty);

            // Update the information of the PlanetLab slice.
            this.OnUpdateSlice();

            // Update the information of the PlanetLab commands.
            this.OnUpdateCommands();

            // Update the information of the PlanetLab history.
            this.OnUpdateHistory();
        }
        /// <summary>
        /// Initializes the control with a crawler object.
        /// </summary>
        /// <param name="crawler">The crawler object.</param>
        public void Initialize(Crawler crawler)
        {
            // Save the parameters.
            this.crawler = crawler;
            this.request = new YouTubeRequestFeed<Video>(this.crawler.YouTube.Settings);

            // Enable the control
            this.Enabled = true;
        }
 // Public methods.
 /// <summary>
 /// Initializes the control.
 /// </summary>
 /// <param name="crawler">A crawler object.</param>
 public void Initialize(Crawler crawler)
 {
     this.crawler = crawler;
     this.request = new AjaxRequestStatistics();
     this.Enabled = true;
 }
 // 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 a crawler object.
        /// </summary>
        /// <param name="crawler">The crawler object.</param>
        public void Initialize(Crawler crawler)
        {
            // Save the parameters.
            this.crawler = crawler;

            // Set the site list event handler.
            this.crawler.PlanetLab.Sites.Cleared += this.OnSitesCleared;
            this.crawler.PlanetLab.Sites.Updated += this.OnSitesUpdated;
            this.crawler.PlanetLab.Sites.Added += this.OnSitesAdded;
            this.crawler.PlanetLab.Sites.Removed += this.OnSitesRemoved;

            // Get the status handler.
            this.status = this.crawler.Status.GetHandler(this);

            // Enable the control.
            this.Enabled = true;

            // Update the list of PlanetLab sites.
            this.OnSitesUpdated(this, EventArgs.Empty);
        }
 // Public methods.
 /// <summary>
 /// Initializes the control with a crawler instance.
 /// </summary>
 /// <param name="crawler">The crawler instance.</param>
 public void Initialize(Crawler crawler)
 {
     this.crawler = crawler;
     this.request = new YouTubeRequestProfile(this.crawler.YouTube.Settings);
 }
        // Public methods.
        /// <summary>
        /// Initialized the control with the specified crawler.
        /// </summary>
        /// <param name="crawler">The crawler.</param>
        /// <param name="config">The slice configuration.</param>
        /// <param name="node">The PlanetLab node.</param>
        public void Initialize(Crawler crawler, PlConfigSlice config, PlNode node)
        {
            // Set the crawler.
            this.crawler = crawler;

            // Set the slice configuration.
            this.config = config;

            // Set the node.
            this.node = node;

            // Set the title.
            this.panelConsole.Title = "Secure Shell Connection to {0}".FormatWith(node.Hostname);

            // Set the slice configuration event handlers.
            this.config.Changed += this.OnConfigurationChanged;
            this.config.Disposed += this.OnConfigurationChanged;

            // Set the node event handlers.
            this.node.Changed += this.OnConfigurationChanged;

            // Set the node hostname.
            this.labelHostname.Text = this.node.Hostname;

            // Get the crawler status.
            this.status = this.crawler.Status.GetHandler(this);
            this.status.Send(ApplicationStatus.StatusType.Normal, "Disconnected.", Resources.Server_16);

            // Enable the control.
            this.Enabled = true;
        }