Example #1
0
        private async void buttonZip_Click(object sender, EventArgs e)
        {
            EnterName formName = new EnterName("Новый архив", this);

            formName.ShowDialog();
            if (formName.result == DialogResult.OK)
            {
                await Compress(formName.textBox1.Text);
            }
        }
Example #2
0
        void NewFolder()
        {
            EnterName nameForm = new EnterName("Новая папка", this);

            nameForm.ShowDialog();
            if (nameForm.result == DialogResult.OK)
            {
                Directory.CreateDirectory(Path.Combine(ActiveList.addressText.Text, nameForm.textBox1.Text));
                ActiveList.UpdateContent();
            }
        }
Example #3
0
        private void buttonRename_Click(object sender, EventArgs e)
        {
            object obj = ActiveList.SelectedItem;

            if (obj != null)
            {
                EnterName nameForm = new EnterName(obj.ToString(), this);
                nameForm.ShowDialog();
                if (nameForm.result == DialogResult.OK)
                {
                    string newPath = Path.Combine(ActiveList.addressText.Text, nameForm.textBox1.Text);
                    try
                    {
                        if (File.Exists(newPath))
                        {
                            MessageBox.Show("Файл с таким именем уже существует", "", MessageBoxButtons.OK);
                        }
                        else
                        {
                            File.Move(Path.Combine(ActiveList.addressText.Text, ActiveList.SelectedItem.ToString()), newPath);
                        }
                    }
                    catch
                    {
                        if (Directory.Exists(newPath))
                        {
                            MessageBox.Show("Папка с таким именем уже существует", "", MessageBoxButtons.OK);
                        }
                        else
                        {
                            Directory.Move(Path.Combine(ActiveList.addressText.Text, ActiveList.SelectedItem.ToString()), newPath);
                        }
                    }
                    ActiveList.UpdateContent();
                }
            }
        }