Example #1
0
        private void btNewFolder_Click(object sender, EventArgs e)
        {
            NewNameForm dlg = new NewNameForm("New Folder");

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    if (_serverListSelected)
                    {
                        _ftp.CreateDirectory(dlg.NewName);
                        UpdateServerList(tbxServerFolder.Text.TrimEnd('/', '\\') + "/" + dlg.NewName);
                    }
                    else
                    {
                        Directory.CreateDirectory(Path.Combine(tbxLocalFolder.Text, dlg.NewName));
                        UpdateLocalList(tbxLocalFolder.Text);
                    }
                }
                catch (Exception ex)
                {
                    Log(ex);
                }
            }
        }
Example #2
0
        private void btnRename_Click(object sender, System.EventArgs e)
        {
            // initialize the renaming form
            NewNameForm formNewName = new NewNameForm();

            // set the current file name
            string oldName = Path.GetFileName(_arguments.LocalPath);

            formNewName.NewName = oldName;

            // show the form
            DialogResult result = formNewName.ShowDialog(this);

            // get the new name
            string newName = formNewName.NewName;

            // check whether the user clicked on OK and insert something nonempty and something else
            if (result != DialogResult.OK || newName.Length == 0 || newName == oldName)
            {
                return;
            }

            // set the appropriate action and new name to the event arguments
            _arguments.Rename(newName);
            Close();
        }