private void wzdExport_NextButtonClick(object sender, WizardNavigationEventArgs e) { switch (e.CurrentStepIndex) { case 0: // Apply settings if (!configExport.ApplySettings()) { e.Cancel = true; return; } // Update settings ExportSettings = configExport.Settings; if (!configExport.ExportHistory) { ltlScriptAfter.Text = ScriptHelper.GetScript( @"var actDiv = document.getElementById('actDiv'); if (actDiv != null) { actDiv.style.display='block'; } var buttonsDiv = document.getElementById('buttonsDiv'); if (buttonsDiv != null) { buttonsDiv.disabled=true; } BTN_Disable('" + NextButton.ClientID + @"'); StartSelectionTimer();"); // Select objects asynchronously ctrlAsyncSelection.RunAsync(SelectObjects, WindowsIdentity.GetCurrent()); e.Cancel = true; } else { pnlExport.Settings = ExportSettings; pnlExport.ReloadData(); wzdExport.ActiveStepIndex = e.NextStepIndex; } break; case 1: // Apply settings if (!pnlExport.ApplySettings()) { e.Cancel = true; return; } ExportSettings = pnlExport.Settings; // Delete temporary files try { ExportProvider.DeleteTemporaryFiles(ExportSettings, true); } catch (Exception ex) { SetErrorLabel(ex.Message); e.Cancel = true; return; } try { // Save export history ExportHistoryInfo history = new ExportHistoryInfo { ExportDateTime = DateTime.Now, ExportFileName = ExportSettings.TargetFileName, ExportSettings = ExportSettings.GetXML(), ExportSiteID = ExportSettings.SiteId, ExportUserID = MembershipContext.AuthenticatedUser.UserID }; ExportHistoryInfoProvider.SetExportHistoryInfo(history); } catch (Exception ex) { SetErrorLabel(ex.Message); pnlError.ToolTip = EventLogProvider.GetExceptionLogMessage(ex); e.Cancel = true; return; } if (ExportSettings.SiteId > 0) { ExportSettings.EventLogSource = String.Format(ExportSettings.GetAPIString("ExportSite.EventLogSiteSource", "Export '{0}' site"), ResHelper.LocalizeString(ExportSettings.SiteInfo.DisplayName)); } // Start asynchronous export var manager = ExportManager; ExportSettings.LogContext = ctlAsyncExport.CurrentLog; manager.Settings = ExportSettings; ctlAsyncExport.RunAsync(manager.Export, WindowsIdentity.GetCurrent()); wzdExport.ActiveStepIndex = e.NextStepIndex; break; } }
private void wzdExport_NextButtonClick(object sender, WizardNavigationEventArgs e) { switch (e.CurrentStepIndex) { case 0: // Apply settings if (!configExport.ApplySettings()) { e.Cancel = true; return; } // Update settings ExportSettings = configExport.Settings; if (!configExport.ExportHistory) { ltlScriptAfter.Text = ScriptHelper.GetScript( "var actDiv = document.getElementById('actDiv'); \n" + "if (actDiv != null) { actDiv.style.display='block'; } \n" + "var buttonsDiv = document.getElementById('buttonsDiv'); if (buttonsDiv != null) { buttonsDiv.disabled=true; } \n" + "BTN_Disable('" + NextButton.ClientID + "'); \n" + "StartSelectionTimer();" ); // Select objects asynchronously ctrlAsync.RunAsync(SelectObjects, WindowsIdentity.GetCurrent()); e.Cancel = true; } else { pnlExport.Settings = ExportSettings; pnlExport.ReloadData(); } break; case 1: // Apply settings if (!pnlExport.ApplySettings()) { e.Cancel = true; return; } ExportSettings = pnlExport.Settings; // Delete temporary files try { ExportProvider.DeleteTemporaryFiles(ExportSettings, true); } catch (Exception ex) { SetErrorLabel(ex.Message); e.Cancel = true; return; } try { // Save export history ExportHistoryInfo history = new ExportHistoryInfo(); history.ExportDateTime = DateTime.Now; history.ExportFileName = ExportSettings.TargetFileName; history.ExportSettings = ExportSettings.GetXML(); history.ExportSiteID = ExportSettings.SiteId; history.ExportUserID = MembershipContext.AuthenticatedUser.UserID; ExportHistoryInfoProvider.SetExportHistoryInfo(history); } catch (Exception ex) { SetErrorLabel(ex.Message); pnlError.ToolTip = EventLogProvider.GetExceptionLogMessage(ex); e.Cancel = true; return; } // Init the Mimetype helper (required for the export) MimeTypeHelper.LoadMimeTypes(); if (ExportSettings.SiteId > 0) { ExportSettings.EventLogSource = string.Format(ExportSettings.GetAPIString("ExportSite.EventLogSiteSource", "Export '{0}' site"), ResHelper.LocalizeString(ExportSettings.SiteInfo.DisplayName)); } // Start asynchronnous export ExportManager.Settings = ExportSettings; AsyncWorker worker = new AsyncWorker(); worker.OnFinished += worker_OnFinished; worker.OnError += worker_OnError; worker.RunAsync(ExportManager.Export, WindowsIdentity.GetCurrent()); lblProgress.Text = GetString("SiteExport.PreparingExport"); break; } ReloadSteps(); wzdExport.ActiveStepIndex = e.NextStepIndex; }