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); }
public static object DoQuickDialog( string title, string label1, object[] items ) { QuickSelectListDialog qd = new QuickSelectListDialog(); qd.Text = title; qd.label1.Text = label1; qd.comboBox1.Items.AddRange(items); qd.comboBox1.SelectedItem = items[0]; if ( qd.ShowDialog( KMultiForm.Instance()) == DialogResult.OK ) { return qd.comboBox1.SelectedItem; } return null; }
public static object DoQuickDialog(string title, string label1, object[] items) { QuickSelectListDialog qd = new QuickSelectListDialog(); qd.Text = title; qd.label1.Text = label1; qd.comboBox1.Items.AddRange(items); qd.comboBox1.SelectedItem = items[0]; if (qd.ShowDialog(KMultiForm.Instance()) == DialogResult.OK) { return(qd.comboBox1.SelectedItem); } return(null); }