Esempio n. 1
0
        public static void Restore()
        {
            if (!CanBackupOrRestore())
            {
                MessageBoxHelper.ShowError(Resources.EXC_CANNOT_BACKUP_DATABASE);
                return;
            }

            string databasePath = GetDatabasePath();

            //Restore:  /r <dbpath> <restorepath> <processname>
            DialogHelperResult result = DialogHelper.OpenFile(DialogFilter.SQLServerCEDatabaseFile, string.Empty);

            if (result.Result == true)
            {
                Run($@"/r ""{result.FileName}"" ""{databasePath}"" ""{Assembly.GetExecutingAssembly().GetName().CodeBase}""", false);
            }
        }
Esempio n. 2
0
        public static void BackUp()
        {
            if (!CanBackupOrRestore())
            {
                MessageBoxHelper.ShowError(Resources.EXC_CANNOT_BACKUP_DATABASE);
                return;
            }

            string databasePath = GetDatabasePath();

            if (!File.Exists(databasePath))
            {
                MessageBoxHelper.ShowError(Resources.EXC_UNABLE_VERIFY_DATABASE_PATH);
                return;
            }

            //Backup:   /b <dbpath> <backuppath>
            DialogHelperResult result = DialogHelper.SaveFile(DialogFilter.SQLServerCEDatabaseFile, string.Empty);

            if (result.Result == true)
            {
                Run($@"/b ""{databasePath}"" ""{result.FileName}""", false);
            }
        }