Esempio n. 1
0
        private void _CopyForm_FormClosed(object sender, FormClosedEventArgs e)
        {
            if (SourceSaveTimer.Enabled)
            {
                SourceSaveTimer.Stop();

                SourceSaveTimer_Elapsed(this, null);

                SourceSaveTimer.Dispose();
            }

            if (DestinationSaveTimer.Enabled)
            {
                DestinationSaveTimer.Stop();

                DestinationSaveTimer_Elapsed(this, null);

                DestinationSaveTimer.Dispose();
            }

            _CopyForm.Dispose();
            _CopyForm = null;

            CopyButton.Enabled = true;
        }
Esempio n. 2
0
        private void CopyButton_Click(object sender, EventArgs e)
        {
            // Source/destination empty?
            if (string.IsNullOrEmpty(Source.Text))
            {
                MessageBox.Show("Source is not set.");

                Source.Focus();

                return;
            }

            if (string.IsNullOrEmpty(Destination.Text))
            {
                MessageBox.Show("Destination is not set.");

                Destination.Focus();

                return;
            }

            // Source/destination exists?
            if (!Directory.Exists(Source.Text))
            {
                MessageBox.Show("Source does not exist.");

                Source.Focus();

                return;
            }

            if (!Directory.Exists(Destination.Text))
            {
                Directory.CreateDirectory(Destination.Text);
            }

            CopyButton.Enabled = false;

            // Open Copy form
            _CopyForm             = new CopyForm();
            _CopyForm.FormClosed += _CopyForm_FormClosed;
            _CopyForm.Show();
        }