Exemplo n.º 1
0
        protected override void internal_command_proc()
        {
            QueryPanelInfoEventArgs e_current = new QueryPanelInfoEventArgs();

            OnQueryCurrentPanel(e_current);
            FtpDirectoryList ftp_list = (FtpDirectoryList)e_current.ItemCollection;

            string current_dir = ftp_list.DirectoryPath;

            //show dialog
            CreateDirectoryDialog dialog = new CreateDirectoryDialog();

            dialog.Text = Options.GetLiteral(Options.LANG_DIRECTORY_CREATE);
            dialog.labelParentDir.Text              = current_dir;
            dialog.checkBoxUseTemplate.Enabled      = false;
            dialog.textBoxTemplateDirectory.Enabled = false;

            if (dialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            string new_dir = FtpPath.Combine(current_dir, dialog.textBoxDirectoryName.Text);

            //create dir tree
            if (ftp_list.MainWindow != null)
            {
                ftp_list.MainWindow.NotifyLongOperation
                    (string.Format
                        (Options.GetLiteral(Options.LANG_DIRECTORY_CREATE_0),
                        new_dir),
                    true);
            }

            try
            {
                ftp_list.Connection.CreateDirectoryTree(new_dir);
            }
            catch (Exception ex)
            {
                Messages.ShowException(ex);
            }

            if (ftp_list.MainWindow != null)
            {
                ftp_list.MainWindow.NotifyLongOperation
                    (string.Empty,
                    false);
            }

            ftp_list.Refill();
        }
Exemplo n.º 2
0
        private void show_ftp_server(mFilePanel target_panel)
        {
            var opts   = Options.FtpOptions;
            var dialog = new FtpConnectionDialog();

            dialog.FtpConnectionOptions = opts;
            dialog.Text = Options.GetLiteral(Options.LANG_CONNECT_TO_FTP_SERVER);

            if (dialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            opts = dialog.FtpConnectionOptions;
            Options.FtpOptions = opts;

            if (!opts.Anonymous)
            {
                var user = opts.UserName;
                var pass = opts.Password;
                Messages.AskCredentials
                    (Options.GetLiteral(Options.LANG_LOGIN_TO_FTP_SERVER), opts.ServerName, ref user, ref pass);
                opts.UserName = user;
                opts.Password = pass;
            }

            var conn = new FtpConnection(opts);
            var fl   = new FtpDirectoryList(0, false, conn);

            try
            {
                fl.MainWindow = this;
                fl.Refill();
                target_panel.Source = fl;
                target_panel.Refresh();
            }
            catch (Exception ex)
            {
                Messages.ShowException(ex);
            }
        }