protected override void OnInit(EventArgs e) { base.OnInit(e); this.cancelEvent = this.OpenEvent(); this.settings = BXIBlockExportXmlSettings.Load(); if (this.settings == null) { this.settings = new BXIBlockExportXmlSettings(); this.settings.DestinationFile = BXConfigurationUtility.Options.UploadFolderPath + "export_file_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xml"; } this.DestinationFile.Text = this.settings.DestinationFile; var siteTypes = TypeCB.Items; siteTypes.Clear(); siteTypes.Add(new ListItem(GetMessageRaw("SelectItem.IBlockType"), string.Empty)); foreach (var type in this.helper.AllTypes) { var name = this.helper.GetTypeName(type); siteTypes.Add(new ListItem(name, type.Id.ToString())); } int typeId = -1; if (!string.IsNullOrEmpty(settings.TypeName)) { var item = TypeCB.Items.FindByValue(settings.TypeName); if (item != null) { item.Selected = true; } Int32.TryParse(settings.TypeName, out typeId); } this.UpdateBlocks(typeId); this.UpdateControls(); if (!string.IsNullOrEmpty(settings.BlockName)) { var item = BlockCB.Items.FindByValue(settings.BlockName); if (item != null) { item.Selected = true; } } this.Sections.SelectedIndex = (int)this.settings.SectionsMode; this.Elements.SelectedIndex = (int)this.settings.ElementsMode; }
protected void OnStartExport(object sender, EventArgs e) { if (this.TypeCB.SelectedIndex == 0) { this.ProgressLabel.Text = GetMessageRaw("SelectItem.IBlockType"); return; } var blockId = this.GetSelectedComboValue(this.BlockCB); if (blockId != -1) { this.cancelEvent = this.OpenEvent(); if (this.cancelEvent != null) { this.cancelEvent.Reset(); } this.cancelEvent = new EventWaitHandle(false, EventResetMode.ManualReset, this.EventName); BXIBlockExportXmlSettings.Delete(BXIdentity.Current.Id, BXSite.Current.Id); this.settings = new BXIBlockExportXmlSettings(BXIdentity.Current.Id, BXSite.Current.Id); this.settings.Locale = BXLoc.CurrentLocale; this.settings.BlockId = blockId; this.settings.ExportMode = XmlExportMode.Catalog; this.settings.BlockName = this.BlockCB.SelectedValue; this.settings.TypeName = this.TypeCB.SelectedValue; this.settings.DestinationFile = this.DestinationFile.Text; this.settings.SectionsMode = (BXIBlockExportMode)this.Sections.SelectedIndex; this.settings.ElementsMode = (BXIBlockExportMode)this.Elements.SelectedIndex; this.settings.Save(); this.StartExport(); this.UpdateControls(); } else { this.ProgressLabel.Text = GetMessageRaw("SelectItem.IBlock"); } }