Exemple #1
0
        public void Initialize(ISimpleKexplorerGUI newForm, FtpSite ftpSite)
        {
            this.isFtpSite = true;
            this.form      = newForm;

            this.pipeline = new Pipeline(this.form);
            this.pipeline.StartWork();

            this.drivePipelines = new Hashtable();

            Pipeline drivePipeline = new Pipeline(this.form);

            this.drivePipelines[ftpSite.host] = drivePipeline;
            drivePipeline.StartWork();

            KexplorerFtpNode createdNode = new KexplorerFtpNode(ftpSite);

            this.form.TreeView1.Nodes.Add(createdNode);

            drivePipeline.AddJob(new FtpLoaderWorkUnit(createdNode, ftpSite, this.form, this));

            this.form.TreeView1.ContextMenu.Popup += new EventHandler(this.ContextMenu_Popup);

            this.form.TreeView1.AfterExpand += new TreeViewEventHandler(TreeView1_AfterExpand);


            this.form.TreeView1.KeyDown += new KeyEventHandler(TreeView1_KeyDown);


            this.form.TreeView1.AfterSelect += new TreeViewEventHandler(TreeView1_AfterFtpSelect);


            this.InitializeScriptManager();
        }
Exemple #2
0
        public IWorkUnit DoJob()
        {
            IWorkUnit moreWork = null;

            KExplorerNode[] tempNodes = this.startNodes;
            foreach (KExplorerNode node in tempNodes)
            {
                if (node.DirInfo != null && this.pathToLookFor.Equals(node.DirInfo.FullName))
                {
                    this.expandThisNode = node;
                    this.form.MainForm.Invoke(new InvokeDelegate(this.ExpandNode));
                    break;
                }
                else if (node.DirInfo != null && this.pathToLookFor.StartsWith(node.DirInfo.FullName))
                {
                    ///  The node may or may not be loaded.  If not, make sure to at least expand
                    ///  out to here.  Then that will cause another job to get loaded to load it's
                    ///  sub nodes.  Then, we just re-add this task.
                    if (node.Nodes.Count == 0)
                    {
                        this.expandThisNode = node;

                        this.form.MainForm.Invoke(new InvokeDelegate(this.ExpandNode));



                        Pipeline drivePipeline = (Pipeline)this.controller.DrivePipelines[this.pathToLookFor.Substring(0, 1)];

                        drivePipeline.AddJob(new FolderWorkUnit(node, this.form, (IWorkGUIFlagger)this.controller));

                        moreWork = this;
                    }
                    else
                    {
                        /// If the sub-nodes are already created.  We re-add this job, but set it
                        /// to look a the sub-nodes.
                        KExplorerNode[] nextStartNodes = new KExplorerNode[node.Nodes.Count];
                        for (int i = 0; i < node.Nodes.Count; i++)
                        {
                            nextStartNodes[i] = (KExplorerNode)node.Nodes[i];
                        }
                        this.startNodes = nextStartNodes;
                        moreWork        = this;
                    }

                    break;
                }
            }
            return(moreWork);
        }
Exemple #3
0
 //-----------------------------------------------------------------------------//
 /// <summary>
 /// After Expanding a node, make sure two levels deeper are expanded.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void TreeView1_AfterExpand(object sender, TreeViewEventArgs e)
 {
     if (!this.isGuiBeingChanged)
     {
         if (e.Node is KExplorerNode)
         {
             KExplorerNode kNode         = (KExplorerNode)e.Node;
             string        drive         = kNode.DirInfo.FullName.Substring(0, 1);
             Pipeline      drivePipeline = (Pipeline)this.drivePipelines[drive];
             drivePipeline.AddJob(new FolderWorkUnit(kNode, this.form, this));
         }
         else
         {
             KexplorerFtpNode ftpNode     = (KexplorerFtpNode)e.Node;
             Pipeline         ftppipeline = (Pipeline)this.drivePipelines[ftpNode.Site.host];
             ftppipeline.AddJob(new FtpFolderWorkUnit(ftpNode, this.form, this));
         }
     }
 }
Exemple #4
0
        //-----------------------------------------------------------------------------//
        /// <summary>
        /// Initialize with a Form1
        /// </summary>
        /// <param name="newForm"></param>
        public void Initialize(ISimpleKexplorerGUI newForm, string currentFolderName, ArrayList onlyTheseDrives)
        {
            this.form = newForm;

            this.pipeline = new Pipeline(this.form);
            this.pipeline.StartWork();

            this.drivePipelines = new Hashtable();

            newForm.WatchingForFolder = currentFolderName;


            string[] drives = null;

            if (onlyTheseDrives != null && onlyTheseDrives.Count > 0)
            {
                drives = (string[])onlyTheseDrives.ToArray(typeof(string));
            }
            else
            {
                drives = System.IO.Directory.GetLogicalDrives();
            }

            foreach (string drive in drives)
            {
                //this.pipeline.AddJob(
                //	new DriveLoaderWorkUnit( drive.Substring( 0, 1), this.form, this ) );

                Pipeline drivePipeline = new Pipeline(this.form);
                this.drivePipelines[drive.Substring(0, 1)] = drivePipeline;
                drivePipeline.StartWork();

                KExplorerNode createdNode = new KExplorerNode(drive.Substring(0, 1));
                this.form.TreeView1.Nodes.Add(createdNode);

                drivePipeline.AddJob(new DriveLoaderWorkUnit(createdNode, drive.Substring(0, 1), this.form, this));
            }

            this.launcher = new Launcher();

            this.launcher.Initialize();


            this.form.TreeView1.AfterExpand += new TreeViewEventHandler(TreeView1_AfterExpand);


            this.form.TreeView1.KeyDown += new KeyEventHandler(TreeView1_KeyDown);


            this.form.TreeView1.AfterSelect += new TreeViewEventHandler(TreeView1_AfterSelect);


            this.form.DataGridView1.KeyDown += new KeyEventHandler(DataGrid1_KeyDown);

            this.form.TreeView1.DoubleClick += new EventHandler(TreeView1_DoubleClick);

            this.form.DataGridView1.DoubleClick += new EventHandler(DataGrid1_DoubleClick);



            this.form.TreeView1.MouseDown += new MouseEventHandler(TreeView1_MouseDown);


            this.InitializeScriptManager();



            this.form.TreeView1.ContextMenu.Popup += new EventHandler(ContextMenu_Popup);

            this.form.DataGridView1.ContextMenuStrip          = this.form.FileGridMenuStrip;
            this.form.DataGridView1.ContextMenuStrip.Opening += new System.ComponentModel.CancelEventHandler(ContextMenuStrip_Opening);


            if (currentFolderName != null && currentFolderName.Length > 0)
            {
                KExplorerNode driveNode = null;
                foreach (KExplorerNode node in this.form.TreeView1.Nodes)
                {
                    if (currentFolderName.StartsWith(node.Text))
                    {
                        driveNode = node;
                        break;
                    }
                }
                Pipeline drivePipeline = (Pipeline)this.drivePipelines[currentFolderName.Substring(0, 1)];

                drivePipeline.AddJob(new FolderFinderWorkUnit(
                                         currentFolderName, new KExplorerNode[] { driveNode }
                                         , this.form
                                         , this
                                         ));
            }
        }
        public void Initialize(ISimpleKexplorerGUI newForm, FtpSite ftpSite)
        {
            this.isFtpSite = true;
            this.form = newForm;

            this.pipeline = new Pipeline(this.form);
            this.pipeline.StartWork();

               this.drivePipelines = new Hashtable();

            Pipeline drivePipeline = new Pipeline(this.form);
            this.drivePipelines[ftpSite.host] = drivePipeline;
            drivePipeline.StartWork();

            KexplorerFtpNode createdNode = new KexplorerFtpNode(ftpSite);
            this.form.TreeView1.Nodes.Add(createdNode);

            drivePipeline.AddJob(new FtpLoaderWorkUnit(createdNode, ftpSite, this.form, this));

            this.form.TreeView1.ContextMenu.Popup += new EventHandler(this.ContextMenu_Popup);

            this.form.TreeView1.AfterExpand += new TreeViewEventHandler(TreeView1_AfterExpand);

            this.form.TreeView1.KeyDown += new KeyEventHandler(TreeView1_KeyDown);

            this.form.TreeView1.AfterSelect += new TreeViewEventHandler(TreeView1_AfterFtpSelect);

            this.InitializeScriptManager();
        }
        //-----------------------------------------------------------------------------//
        /// <summary>
        /// Initialize with a Form1
        /// </summary>
        /// <param name="newForm"></param>
        public void Initialize(ISimpleKexplorerGUI newForm, string currentFolderName, ArrayList onlyTheseDrives )
        {
            this.form = newForm;

            this.pipeline = new Pipeline( this.form);
            this.pipeline.StartWork();

            this.drivePipelines = new Hashtable();

            newForm.WatchingForFolder = currentFolderName;

            string[] drives = null;

            if ( onlyTheseDrives != null && onlyTheseDrives.Count > 0 )
            {
                drives = (string[])onlyTheseDrives.ToArray(typeof(string));
            }
            else
            {
                drives = System.IO.Directory.GetLogicalDrives();
            }

            foreach( string drive in drives )
            {
                //this.pipeline.AddJob(
                //	new DriveLoaderWorkUnit( drive.Substring( 0, 1), this.form, this ) );

                Pipeline drivePipeline = new Pipeline( this.form );
                this.drivePipelines[ drive.Substring(0,1) ] = drivePipeline;
                drivePipeline.StartWork();

                KExplorerNode createdNode = new KExplorerNode( drive.Substring( 0, 1) );
                this.form.TreeView1.Nodes.Add( createdNode );

                drivePipeline.AddJob(new DriveLoaderWorkUnit( createdNode, drive.Substring( 0, 1), this.form, this ) );

            }

            this.launcher = new Launcher();

            this.launcher.Initialize();

            this.form.TreeView1.AfterExpand += new TreeViewEventHandler(TreeView1_AfterExpand);

            this.form.TreeView1.KeyDown += new KeyEventHandler(TreeView1_KeyDown);

            this.form.TreeView1.AfterSelect += new TreeViewEventHandler(TreeView1_AfterSelect);

            this.form.DataGridView1.KeyDown += new KeyEventHandler(DataGrid1_KeyDown);

            this.form.TreeView1.DoubleClick += new EventHandler(TreeView1_DoubleClick);

            this.form.DataGridView1.DoubleClick += new EventHandler(DataGrid1_DoubleClick);

            this.form.TreeView1.MouseDown += new MouseEventHandler(TreeView1_MouseDown);

            this.InitializeScriptManager();

            this.form.TreeView1.ContextMenu.Popup +=new EventHandler(ContextMenu_Popup );

            this.form.DataGridView1.ContextMenuStrip = this.form.FileGridMenuStrip;
            this.form.DataGridView1.ContextMenuStrip.Opening +=new System.ComponentModel.CancelEventHandler(ContextMenuStrip_Opening);

            if ( currentFolderName != null && currentFolderName.Length > 0 )
            {
                KExplorerNode driveNode = null;
                foreach ( KExplorerNode node in this.form.TreeView1.Nodes )
                {
                    if ( currentFolderName.StartsWith( node.Text ))
                    {
                        driveNode = node;
                        break;
                    }
                }
                Pipeline drivePipeline = (Pipeline)this.drivePipelines[currentFolderName.Substring(0,1)];

                drivePipeline.AddJob( new FolderFinderWorkUnit(
                    currentFolderName, new KExplorerNode[]{driveNode}
                                        , this.form
                                        , this
                                                    ));

            }
        }