// Public declarations
        /// <summary>
        /// Creates a new control instance.
        /// </summary>
        /// <param name="config">The tool configuration.</param>
        public ControlSshClient(SshClientConfig config)
        {
            // Initialize component.
            this.InitializeComponent();

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

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

            // Load the settings.
            this.OnLoad();
        }
        /// <summary>
        /// Creates a new control instance.
        /// </summary>
        /// <param name="config">The configuration.</param>
        public ControlMercuryClient(MercuryConfig config)
        {
            // Initialize the component.
            this.InitializeComponent();

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

            // Load the configuration.
            this.OnLoadConfiguration();

            // Set the status.
            this.status = this.config.Api.Status.GetHandler(this);
            this.status.Send(ApplicationStatus.StatusType.Normal, "Ready.", Resources.Information_16);
        }
        /// <summary>
        /// Creates a new control instance.
        /// </summary>
        /// <param name="config">The tool configuration.</param>
        public ControlCdnFinder(CdnFinderConfig config)
        {
            // Initialize the component.
            this.InitializeComponent();

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

            // Set the status.
            this.status = this.config.Api.Status.GetHandler(this);
            this.status.Send(ApplicationStatus.StatusType.Normal, "Ready.", Resources.Information_16);

            // Create the request.
            this.request = new CdnFinderRequest(this.config);

            // Load the configuration.
            this.textBoxUrl.Text = this.config.ServerUrl;
        }
        /// <summary>
        /// Creates a new control instance.
        /// </summary>
        /// <param name="api">The tools API.</param>
        public ControlAlexaTopSites(IToolApi api)
        {
            // Initialize the component.
            this.InitializeComponent();

            // Set the API.
            this.api = api;

            // Set the status.
            this.status = this.api.Status.GetHandler(this);
            this.status.Send(ApplicationStatus.StatusType.Normal, "Ready.", Resources.Information_16);

            // Initialize the number of pages.
            this.comboBoxPages.SelectedIndex = 0;

            // Initialize the list of countries.
            this.OnUpdateCountries();
        }
        // Public declarations
        /// <summary>
        /// Creates a new control instance.
        /// </summary>
        /// <param name="config">The configuration.</param>
        public ControlWebClient(WebClientConfig config)
        {
            // Initialize component.
            this.InitializeComponent();

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

            // Get the crawler status.
            this.status = this.config.Api.Status.GetHandler(this);
            this.status.Send(ApplicationStatus.StatusType.Normal, "Ready.", Resources.Information_16);

            // Populate the encoding combo box.
            this.encodings = Encoding.GetEncodings();
            for (int index = 0; index < this.encodings.Length; index++)
            {
                this.comboBoxEncoding.Items.Add("({0}) {1}".FormatWith(this.encodings[index].CodePage, this.encodings[index].DisplayName));
                this.encodingPages.Add(this.encodings[index].CodePage, index);
            }

            // Load the settings.
            this.OnLoad();
        }
        /// <summary>
        /// Initializes the control.
        /// </summary>
        /// <param name="application">The application.</param>
        public void Initialize(TracerouteApplication application)
        {
            // Set the application.
            this.application = application;
            // Set the control status.
            this.status = this.application.Status.GetHandler(this);

            // Set the network addresses changed event handler.
            NetworkConfiguration.NetworkAddressesChanged += this.OnRefresh;

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

            // Update the list of interface addresses.
            this.OnRefresh(true);
        }
        // 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);
        }
        /// <summary>
        /// An event handler called when receiving a status message from a handler.
        /// </summary>
        /// <param name="handler">The handler that changed the message.</param>
        private void OnMessageChanged(ApplicationStatusHandler handler)
        {
            // If the object is disposed, do nothing.
            if (this.disposed) return;

            lock (this.sync)
            {
                // If this is the currenty selected handler, raise an event.
                if (this.handler == handler)
                {
                    this.OnMessageChanged();
                }
            }
        }
 /// <summary>
 /// An event handler called when a status handler changes the lock state.
 /// </summary>
 /// <param name="handler">The handler that changed the lock.</param>
 private void OnLockChanged(ApplicationStatusHandler handler)
 {
     lock (this.sync)
     {
         // If the handler lock is set.
         if (handler.Locked)
         {
             // Add the handler owner to the list of locks.
             if (this.locks.Add(handler.Owner))
             {
                 this.OnLockChanged();
             }
         }
         else
         {
             // Remove the handler owner from the list of locks.
             if (this.locks.Remove(handler.Owner))
             {
                 this.OnLockChanged();
             }
         }
     }
 }
 /// <summary>
 /// Activates the notification handler attached to the specified object.
 /// </summary>
 /// <param name="owner">The owner object.</param>
 public void Activate(object owner)
 {
     lock (this.sync)
     {
         ApplicationStatusHandler handler;
         // Try and get the handler for the specified owner.
         if (this.handlers.TryGetValue(owner, out handler))
         {
             this.handler = handler;
         }
         else
         {
             this.handler = null;
         }
         // Send a notification.
         this.OnMessageChanged();
     }
 }
示例#11
0
        // 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="application">The application.</param>
        public void Initialize(TracerouteApplication application)
        {
            // Set the application.
            this.application = application;
            // Set the control status.
            this.status = this.application.Status.GetHandler(this);

            // Enable the control.
            this.Enabled = true;
        }
示例#13
0
        // 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();
        }
        // 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>
        /// Creates a new control instance.
        /// </summary>
        /// <param name="config">The tool configuration.</param>
        public ControlTraceroute(TracerouteConfig config)
        {
            // Initialize the component.
            this.InitializeComponent();

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

            // Create the traceroute settings.
            this.settings = new TracerouteSettings();
            // Create the traceroute instance.
            this.traceroute = new Traceroute(this.settings);

            // Load the configuration.
            this.OnLoadConfiguration();

            // Set the status.
            this.status = this.config.Api.Status.GetHandler(this);
            this.status.Send(ApplicationStatus.StatusType.Normal, "Ready.", Resources.Information_16);
        }
示例#16
0
 /// <summary>
 /// Initializes the control with the current application.
 /// </summary>
 /// <param name="application">The application.</param>
 public void Initialize(TracerouteApplication application)
 {
     // Set the application.
     this.application = application;
     // Set the application status handler.
     this.status = this.application.Status.GetHandler(this);
     // Enable the control.
     this.Enabled = true;
     // Refresh the log.
     this.OnCalendarDateChanged(null, new DateRangeEventArgs(this.calendar.Calendar.SelectionStart, this.calendar.Calendar.SelectionEnd));
 }
 /// <summary>
 /// Deactivates the notification handler attached to the specified object.
 /// </summary>
 /// <param name="owner">The owner object.</param>
 public void Deactivate(object owner)
 {
     lock (this.sync)
     {
         // If there exists a current handler.
         if (null != this.handler)
         {
             // If handler owner is the specified owner.
             if (this.handler.Owner.Equals(owner))
             {
                 // Set the handler to null.
                 this.handler = null;
                 // Send a notification.
                 this.OnMessageChanged();
             }
         }
     }
 }
 /// <summary>
 /// Returns a new notification handler attached to the specified object.
 /// </summary>
 /// <param name="owner">The object.</param>
 /// <returns>The notification handler.</returns>
 public ApplicationStatusHandler GetHandler(object owner)
 {
     ApplicationStatusHandler handler;
     // Try get the handler from the current collection.
     if (!this.handlers.TryGetValue(owner, out handler))
     {
         // If the handler is not found, create a new handler for the given owner.
         handler = new ApplicationStatusHandler(owner, this.OnMessageChanged, this.OnLockChanged);
         // Add the handler to the collection.
         this.handlers.Add(owner, handler);
     }
     // Return the handler.
     return handler;
 }
        // 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;
        }