示例#1
0
        private void RunRestore()
        {
            isProcess = true;
            try
            {
                var backupKit = new BackupKit(usernameBox.Text, passwordBox.Text, tbServer.Text, Decimal.ToInt16(numPort.Value));
                backupKit.Restore(restoreSrcBox.Text, restoreDestBox.Text, tbLogOut);
            }
            catch (ArgumentException ex)
            {
                MessageBox.Show(ex.Message);
            }
            catch (IOException ex)
            {
                MessageBox.Show(ex.Message);
            }


            ResetDBUser();

            if (cbIsResetPassword.Checked)
            {
                ResetPassword();
            }
            if (cbIsDeleteBK.Checked)
            {
                DeleteBackup();
            }

            GenNewDBID();

            DialogResult dialogResult = MessageBox.Show("Закончен процесс восстановления базы данных!\nПодключиться к базе данных?", "Внимание!", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (dialogResult == DialogResult.Yes)
            {
                Process          p  = new Process();
                ProcessStartInfo pi = new ProcessStartInfo
                {
                    UseShellExecute = true,
                    FileName        = restoreDestBox.Text
                };
                p.StartInfo = pi;

                try
                {
                    p.Start();
                    Application.Exit();
                }
                catch (Exception Ex)
                {
                    MessageBox.Show(Ex.Message);
                }
            }
            isProcess = false;
        }
示例#2
0
        private void copyBtn_Click(object sender, EventArgs e)
        {
            try
            {
                var backupKit = new BackupKit(usernameBox.Text, passwordBox.Text);

                backupKit.Copy(copySrcBox.Text, copyDestBox.Text);
            }
            catch (ArgumentException ex)
            {
                MessageBox.Show(ex.Message);
            }
            catch (IOException ex)
            {
                MessageBox.Show(ex.Message);
            }
        }