示例#1
0
        private void menuItemServices_Click(object sender, System.EventArgs e)
        {
            var machineParms = QuickDialog2.DoQuickDialog("Services", "Machine Name", ".", "Pattern ^(Enable|EPX)", "");
            if (machineParms == null)
            {
                machineParms = new string[2];
            }
            //
            // TODO: Add any constructor code after InitializeComponent call
            //
            ServicesPanel newPanel =  new ServicesPanel( this);

            newPanel.MainForm = this;

            TabPage x = new TabPage("Services");

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

            x.Controls.Add( newPanel);

            this.tabControl1.TabPages.Add( x );

            ServiceMgrWorkUnit worker = new ServiceMgrWorkUnit( newPanel, newPanel );

            newPanel.Manager = worker;

            worker.InitalizeControl(null,machineParms[0],machineParms[1]);

            this.tabControl1.SelectedTab = x;
        }
示例#2
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;

                    }
                }

            }
        }