Esempio n. 1
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Restore a project.
		/// </summary>
		/// <param name="dialogOwner">The dialog owner.</param>
		/// <param name="fwApp">The FieldWorks application.</param>
		/// ------------------------------------------------------------------------------------
		internal static void RestoreProject(Form dialogOwner, FwApp fwApp)
		{
			string databaseName = (Cache != null) ? Cache.ProjectId.Name : string.Empty;
			using (RestoreProjectDlg dlg = new RestoreProjectDlg(databaseName, fwApp.ApplicationName, fwApp))
			{
				if (dlg.ShowDialog(dialogOwner) != DialogResult.OK)
					return;

				HandleRestoreRequest(dialogOwner, new FwRestoreProjectSettings(GetCommandLineAbbrevForAppName(fwApp.ApplicationName),
					dlg.Settings));
			}
		}
Esempio n. 2
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Restore a project.
		/// </summary>
		/// <param name="dialogOwner">The dialog owner.</param>
		/// <param name="backupFile">The file to restore from.</param>
		/// ------------------------------------------------------------------------------------
		internal static void RestoreProject(Form dialogOwner, string backupFile)
		{
			BackupFileSettings settings = null;
			if (!RestoreProjectDlg.HandleRestoreFileErrors(null, FwUtils.ksSuiteName, backupFile,
				() => settings = new BackupFileSettings(backupFile, true)))
			{
				return;
			}

			using (RestoreProjectDlg dlg = new RestoreProjectDlg(settings, FwUtils.ksSuiteName,
				GetHelpTopicProvider(settings.AppAbbrev)))
			{
				dlg.ShowInTaskbar = true;
				if (dlg.ShowDialog(dialogOwner) != DialogResult.OK)
					return;

				HandleRestoreRequest(dialogOwner, new FwRestoreProjectSettings(settings.AppAbbrev, dlg.Settings));
			}
		}