Exemplo n.º 1
0
        private void menuItemFtp_Click(object sender, System.EventArgs e)
        {
            ScriptHelper helper = new ScriptHelper(null, null, null, null);

            List <String> ftpSites = helper.GetValueList("//ftpsites/ftpsite/@name");

            if (ftpSites == null || ftpSites.Count == 0)
            {
                XmlDocumentFragment xfrag = helper.ScriptHelperDoc.CreateDocumentFragment();
                xfrag.InnerXml = "<ftpsites>\n"
                                 + "<ftpsite name=\"Enterworks\" host=\"ewftp.com\" username=\"xxx\" pwd=\"xxx\" folder=\"/Outgoing\" type=\"win\" />\n"
                                 + " <ftpsite name=\"Kimbonics\" host=\"kimbonics.com\" username=\"xxxxx\" pwd=\"XXXX\" folder=\"\" type=\"unix\" />\n"
                                 + " </ftpsites>";

                helper.ScriptHelperDoc.FirstChild.AppendChild(xfrag);

                helper.ScriptHelperDoc.Save("scripthelper.xml");

                MessageBox.Show("FTP Site Examples have been added to your scripthelper.xml.  You must edit them with correct information",
                                "Kexplorer");



                return;
            }


            String siteName = (String)QuickSelectListDialog.DoQuickDialog("Kexplorer Easy FTP", "Select a site:", ftpSites.ToArray());

            if (siteName == null)
            {
                return;
            }

            String host     = helper.GetValueList("//ftpsites/ftpsite[@name='" + siteName + "']/@host")[0];
            String username = helper.GetValueList("//ftpsites/ftpsite[@name='" + siteName + "']/@username")[0];
            String pwd      = helper.GetValueList("//ftpsites/ftpsite[@name='" + siteName + "']/@pwd")[0];

            String targetfolder = helper.GetValueList("//ftpsites/ftpsite[@name='" + siteName + "']/@folder")[0];
            String type         = helper.GetValueList("//ftpsites/ftpsite[@name='" + siteName + "']/@type")[0];

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
            KexplorerPanel newPanel = new KexplorerPanel(this, new FtpSite(host, username, pwd, targetfolder, type));


            newPanel.MainForm = this;


            TabPage y = new TabPage("ftp:" + siteName);


            newPanel.Dock = System.Windows.Forms.DockStyle.Fill;

            y.Controls.Add(newPanel);


            this.tabControl1.TabPages.Add(y);
        }
Exemplo n.º 2
0
        private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
        {
            TabPage page = this.tabControl1.SelectedTab;

            KexplorerPanel panel = null;

            foreach (Control control in page.Controls)
            {
                if (control is KexplorerPanel)
                {
                    panel = (KexplorerPanel)control;
                    break;
                }
            }
            if (panel != null)
            {
                panel.InitializeOnce();
            }
        }
Exemplo n.º 3
0
        private void AddNewPanel()
        {
            //
            // TODO: Add any constructor code after InitializeComponent call
            //
            KexplorerPanel newPanel = new KexplorerPanel(this);


            newPanel.MainForm = this;



            TabPage x = new TabPage(this.tabControl1.TabPages.Count.ToString());


            newPanel.Dock = System.Windows.Forms.DockStyle.Fill;

            x.Controls.Add(newPanel);


            this.tabControl1.TabPages.Add(x);
        }
Exemplo n.º 4
0
        private void menuItemFtp_Click(object sender, System.EventArgs e)
        {
            ScriptHelper helper = new ScriptHelper(null, null, null, null);

            List<String> ftpSites = helper.GetValueList("//ftpsites/ftpsite/@name");

            if (ftpSites == null || ftpSites.Count == 0)
            {

                XmlDocumentFragment xfrag = helper.ScriptHelperDoc.CreateDocumentFragment();
                xfrag.InnerXml ="<ftpsites>\n"
                     + "<ftpsite name=\"Enterworks\" host=\"ewftp.com\" username=\"xxx\" pwd=\"xxx\" folder=\"/Outgoing\" type=\"win\" />\n"
                    + " <ftpsite name=\"Kimbonics\" host=\"kimbonics.com\" username=\"xxxxx\" pwd=\"XXXX\" folder=\"\" type=\"unix\" />\n"
                   + " </ftpsites>";

                helper.ScriptHelperDoc.FirstChild.AppendChild(xfrag);

                helper.ScriptHelperDoc.Save( "scripthelper.xml");

                MessageBox.Show("FTP Site Examples have been added to your scripthelper.xml.  You must edit them with correct information",
                    "Kexplorer" );

                return;
            }

            String siteName = (String)QuickSelectListDialog.DoQuickDialog("Kexplorer Easy FTP", "Select a site:", ftpSites.ToArray());

            if (siteName == null)
            {
                return;
            }

            String host = helper.GetValueList("//ftpsites/ftpsite[@name='" + siteName + "']/@host")[0];
            String username = helper.GetValueList("//ftpsites/ftpsite[@name='" + siteName + "']/@username")[0];
            String pwd = helper.GetValueList("//ftpsites/ftpsite[@name='" + siteName + "']/@pwd")[0];

            String targetfolder = helper.GetValueList("//ftpsites/ftpsite[@name='" + siteName + "']/@folder")[0];
            String type = helper.GetValueList("//ftpsites/ftpsite[@name='" + siteName + "']/@type")[0];

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
            KexplorerPanel newPanel = new KexplorerPanel(this, new FtpSite(host, username, pwd, targetfolder, type));

            newPanel.MainForm = this;

            TabPage y = new TabPage("ftp:"+siteName);

            newPanel.Dock = System.Windows.Forms.DockStyle.Fill;

            y.Controls.Add(newPanel);

            this.tabControl1.TabPages.Add(y);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Load state, or, start with a fresh new panel.
        /// </summary>
        private void LoadSavedPanels()
        {
            string saveFile = Application.StartupPath + "\\KexplorerStateSave.xml";
            if (!File.Exists( saveFile ) )
            {
                this.AddNewPanel();
            } else {

                XmlDocument savedDoc = new XmlDocument();
                savedDoc.Load( saveFile );

                XmlNodeList panels = savedDoc.SelectNodes("/KexplorerState/KexplorerTab");

                if ( panels.Count == 0 )
                {
                    this.AddNewPanel();

                }
                else
                {

                    TabPage selectedPage = null;
                    foreach ( XmlNode panel in panels )
                    {

                        XmlNode nameNode = panel.SelectSingleNode("TabName");

                        XmlNode servicesNode = panel.SelectSingleNode("ServicesTab");

                        XmlNode ftpSiteNode = panel.SelectSingleNode("FtpTab");

                        if ( servicesNode != null )
                        {

                            XmlNodeList visibleServices = panel.SelectNodes("Service");
                            ArrayList serviceNames = new ArrayList();
                            foreach ( XmlNode serviceNode in visibleServices )
                            {
                                serviceNames.Add( serviceNode.InnerText );
                            }

                            TabPage x = new TabPage( nameNode.InnerText);

                            if ( panel.SelectSingleNode( "Selected" ) != null )
                            {
                                selectedPage = x;

                            }
                            ServicesPanel servicesPanel = new ServicesPanel( this );

                            ServiceMgrWorkUnit worker = new ServiceMgrWorkUnit( servicesPanel, servicesPanel);
                            servicesPanel.Manager = worker;

                            servicesPanel.Dock = System.Windows.Forms.DockStyle.Fill;

                            this.tabControl1.TabPages.Add( x );

                            x.Controls.Add( servicesPanel);
                            worker.InitalizeControl( serviceNames,null,null );

                        }
                        else if (ftpSiteNode != null)
                        {
                            //
                            // TODO: Add any constructor code after InitializeComponent call
                            //
                            var hostNode = ftpSiteNode.SelectSingleNode("Host");
                            var userNameNode = ftpSiteNode.SelectSingleNode("UserName");
                            var pwdNode = ftpSiteNode.SelectSingleNode("Pwd");
                            var targetFolderNode = ftpSiteNode.SelectSingleNode("TargetFolder");
                            var typeNode = ftpSiteNode.SelectSingleNode("Type");

                            KexplorerPanel newPanel = new KexplorerPanel(this
                                , new FtpSite(
                                    hostNode.InnerText
                                    , userNameNode.InnerText
                                    , pwdNode.InnerText
                                    , targetFolderNode.InnerText
                                    , typeNode.InnerText

                                    ));

                            newPanel.MainForm = this;

                            TabPage y = new TabPage(nameNode.InnerText);

                            newPanel.Dock = System.Windows.Forms.DockStyle.Fill;

                            y.Controls.Add(newPanel);

                            this.tabControl1.TabPages.Add(y);
                        }
                        else
                        {

                            XmlNode currentFolderNode = panel.SelectSingleNode("CurrentFolder");

                            XmlNodeList driveNodes = panel.SelectNodes("Drive");
                            ArrayList drives = new ArrayList();
                            foreach (XmlNode node in driveNodes)
                            {
                                drives.Add(node.InnerText);
                            }

                            KexplorerPanel newPanel = new KexplorerPanel(this, currentFolderNode.InnerText, drives);

                            newPanel.MainForm = this;

                            TabPage x = new TabPage(nameNode.InnerText);

                            newPanel.Dock = System.Windows.Forms.DockStyle.Fill;

                            x.Controls.Add(newPanel);

                            this.tabControl1.TabPages.Add(x);

                            if (panel.SelectSingleNode("Selected") != null)
                            {
                                selectedPage = x;
                                newPanel.InitializeOnce();
                            }
                        }

                    }

                    if ( selectedPage != null )
                    {
                        this.tabControl1.SelectedTab = selectedPage;

                    }
                }

            }
        }
Exemplo n.º 6
0
        private void AddNewPanel()
        {
            //
            // TODO: Add any constructor code after InitializeComponent call
            //
            KexplorerPanel newPanel =  new KexplorerPanel( this );

            newPanel.MainForm = this;

            TabPage x = new TabPage(this.tabControl1.TabPages.Count.ToString());

            newPanel.Dock = System.Windows.Forms.DockStyle.Fill;

            x.Controls.Add( newPanel);

            this.tabControl1.TabPages.Add( x );
        }
Exemplo n.º 7
0
        /// <summary>
        /// Load state, or, start with a fresh new panel.
        /// </summary>
        private void LoadSavedPanels()
        {
            string saveFile = Application.StartupPath + "\\KexplorerStateSave.xml";

            if (!File.Exists(saveFile))
            {
                this.AddNewPanel();
            }
            else
            {
                XmlDocument savedDoc = new XmlDocument();
                savedDoc.Load(saveFile);


                XmlNodeList panels = savedDoc.SelectNodes("/KexplorerState/KexplorerTab");

                if (panels.Count == 0)
                {
                    this.AddNewPanel();
                }
                else
                {
                    TabPage selectedPage = null;
                    foreach (XmlNode panel in panels)
                    {
                        XmlNode nameNode = panel.SelectSingleNode("TabName");

                        XmlNode servicesNode = panel.SelectSingleNode("ServicesTab");

                        XmlNode ftpSiteNode = panel.SelectSingleNode("FtpTab");

                        if (servicesNode != null)
                        {
                            XmlNodeList visibleServices = panel.SelectNodes("Service");
                            ArrayList   serviceNames    = new ArrayList();
                            foreach (XmlNode serviceNode in visibleServices)
                            {
                                serviceNames.Add(serviceNode.InnerText);
                            }


                            TabPage x = new TabPage(nameNode.InnerText);


                            if (panel.SelectSingleNode("Selected") != null)
                            {
                                selectedPage = x;
                            }
                            ServicesPanel servicesPanel = new ServicesPanel(this);

                            ServiceMgrWorkUnit worker = new ServiceMgrWorkUnit(servicesPanel, servicesPanel);
                            servicesPanel.Manager = worker;

                            servicesPanel.Dock = System.Windows.Forms.DockStyle.Fill;

                            this.tabControl1.TabPages.Add(x);

                            x.Controls.Add(servicesPanel);
                            worker.InitalizeControl(serviceNames, null, null);
                        }
                        else if (ftpSiteNode != null)
                        {
                            //
                            // TODO: Add any constructor code after InitializeComponent call
                            //
                            var hostNode         = ftpSiteNode.SelectSingleNode("Host");
                            var userNameNode     = ftpSiteNode.SelectSingleNode("UserName");
                            var pwdNode          = ftpSiteNode.SelectSingleNode("Pwd");
                            var targetFolderNode = ftpSiteNode.SelectSingleNode("TargetFolder");
                            var typeNode         = ftpSiteNode.SelectSingleNode("Type");

                            KexplorerPanel newPanel = new KexplorerPanel(this
                                                                         , new FtpSite(
                                                                             hostNode.InnerText
                                                                             , userNameNode.InnerText
                                                                             , pwdNode.InnerText
                                                                             , targetFolderNode.InnerText
                                                                             , typeNode.InnerText

                                                                             ));


                            newPanel.MainForm = this;


                            TabPage y = new TabPage(nameNode.InnerText);


                            newPanel.Dock = System.Windows.Forms.DockStyle.Fill;

                            y.Controls.Add(newPanel);


                            this.tabControl1.TabPages.Add(y);
                        }
                        else
                        {
                            XmlNode currentFolderNode = panel.SelectSingleNode("CurrentFolder");

                            XmlNodeList driveNodes = panel.SelectNodes("Drive");
                            ArrayList   drives     = new ArrayList();
                            foreach (XmlNode node in driveNodes)
                            {
                                drives.Add(node.InnerText);
                            }

                            KexplorerPanel newPanel = new KexplorerPanel(this, currentFolderNode.InnerText, drives);


                            newPanel.MainForm = this;


                            TabPage x = new TabPage(nameNode.InnerText);


                            newPanel.Dock = System.Windows.Forms.DockStyle.Fill;

                            x.Controls.Add(newPanel);


                            this.tabControl1.TabPages.Add(x);

                            if (panel.SelectSingleNode("Selected") != null)
                            {
                                selectedPage = x;
                                newPanel.InitializeOnce();
                            }
                        }
                    }

                    if (selectedPage != null)
                    {
                        this.tabControl1.SelectedTab = selectedPage;
                    }
                }
            }
        }