private void BackUp()
        {
            RunTaskAsync backup = new RunTaskAsync(BackupHelper.BackupDatabase);
            IAsyncResult result = backup.BeginInvoke(connString, filePath, chkDifferential.Checked, CallBack, backup);

            PrepareForm();
        }
Beispiel #2
0
        private void Restore()
        {
            if (!File.Exists(filePath))
            {
                MessageBox.Show("No file name specified, Please select a valid path", "Restore", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            RunTaskAsync restore = new RunTaskAsync(RestoreHelper.RestoreDatabase);
            IAsyncResult result  = restore.BeginInvoke(connString, filePath, CallBack, restore);

            PrepareForm();
        }
Beispiel #3
0
        private void CallBack(IAsyncResult results)
        {
            RunTaskAsync restoreDB = results.AsyncState as RunTaskAsync;

            restoreDB.EndInvoke(results);

            try
            {
                MessageBox.Show("Operation completed successfully", "Restore", MessageBoxButtons.OK, MessageBoxIcon.Information);
                complete = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Restore", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void CallBack(IAsyncResult results)
        {
            try
            {
                RunTaskAsync backupDB = results.AsyncState as RunTaskAsync;
                backupDB.EndInvoke(results);

                exitLoop = true;
                endTime  = DateTime.Now.ToShortTimeString();

                SaveBackupDetails();

                UpdateDefaultFileName();
                MessageBox.Show("Operation completed successfully", "Backup", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Backup", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }