/// <summary> /// Starts import process with given settings. Returns true if import was started successfully, false otherwise (error label is set in this case). /// </summary> /// <param name="settings">Import settings</param> /// <returns>Returns true if import was started successfully, false otherwise.</returns> private bool StartImport(SiteImportSettings settings) { if (!string.IsNullOrEmpty(ImportExportControl.CheckLicenses(settings))) { // License is missing, let's try to import some from package. EnsureLicenseFromPackage(settings); } // Check licences string error = ImportExportControl.CheckLicenses(settings); if (!string.IsNullOrEmpty(error)) { SetErrorLabel(error); return(false); } // Start asynchronnous Import if (settings.SiteIsIncluded) { settings.EventLogSource = String.Format(settings.GetAPIString("ImportSite.EventLogSiteSource", "Import '{0}' site"), ResHelper.LocalizeString(settings.SiteDisplayName)); } var manager = ImportManager; settings.LogContext = ctlAsyncImport.CurrentLog; manager.Settings = settings; ctlAsyncImport.RunAsync(manager.Import, WindowsIdentity.GetCurrent()); return(true); }
/// <summary> /// Starts import process with given settings. Returns true if import was started successfully, false otherwise (error label is set in this case). /// </summary> /// <param name="settings">Import settings</param> /// <returns>Returns true if import was started successfully, false otherwise.</returns> private bool StartImport(SiteImportSettings settings) { // Check licences string error = ImportExportControl.CheckLicenses(settings); if (!string.IsNullOrEmpty(error)) { SetErrorLabel(error); return false; } // Start asynchronnous Import if (settings.SiteIsIncluded) { settings.EventLogSource = string.Format(settings.GetAPIString("ImportSite.EventLogSiteSource", "Import '{0}' site"), ResHelper.LocalizeString(settings.SiteDisplayName)); } var manager = ImportManager; settings.LogContext = ctlAsyncImport.CurrentLog; manager.Settings = settings; ctlAsyncImport.RunAsync(manager.Import, WindowsIdentity.GetCurrent()); return true; }
/// <summary> /// Starts import process with given settings. Returns true if import was started successfully, false otherwise (error label is set in this case). /// </summary> /// <param name="importSettings">Import settings</param> /// <returns>Returns true if import was started successfully, false otherwise.</returns> private bool StartImport(SiteImportSettings importSettings) { // Check licences string error = ImportExportControl.CheckLicenses(importSettings); if (!string.IsNullOrEmpty(error)) { SetErrorLabel(error); return false; } // Init the Mimetype helper (required for the Import) MimeTypeHelper.LoadMimeTypes(); // Start asynchronnous Import if (importSettings.SiteIsIncluded) { importSettings.EventLogSource = string.Format(importSettings.GetAPIString("ImportSite.EventLogSiteSource", "Import '{0}' site"), ResHelper.LocalizeString(importSettings.SiteDisplayName)); } ImportManager.Settings = importSettings; AsyncWorker worker = new AsyncWorker(); worker.OnFinished += worker_OnFinished; worker.OnError += worker_OnError; worker.RunAsync(ImportManager.Import, WindowsIdentity.GetCurrent()); return true; }