Esempio n. 1
0
        public override void OnExport()
        {
            base.OnExport();
            ExportDialog frmExport = new ExportDialog(fpView);

            frmExport.ShowDialog(this);
        }
Esempio n. 2
0
        private void Export_Click(object sender, EventArgs e)
        {
            try
            {
                String ExportPath = Path.Combine(ApplicationInfo.ApplicationDocumentPath, "Export");
                if (!Directory.Exists(ExportPath))
                {
                    Directory.CreateDirectory(ExportPath);
                }
                ExportDialog exportDialog = new ExportDialog(new ReportExportInfo()
                {
                    ReportName = this.ReportCategory.ToString(), ReportFormat = EnumHelper.ExportFormat.HTML.ToString(), FileLocation = ExportPath
                });
                if (exportDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    ExportInfo item = new ExportInfo()
                    {
                        ReportDetails = new ReportInfo()
                        {
                            ExportFormat = exportDialog.reportExportInfo.ReportFormat, ReportName = exportDialog.reportExportInfo.ReportName, GeneratorName = "Adminstrator", ProductName = "AMT", ReportDate = DateTime.Now.ToString(), ExportPath = exportDialog.txtLocation.Text
                        },
                        MachineInfo = wmimachineInfo
                    };

                    ReportObject.ExportReportData(item);

                    MessageBox.Show("Report exported successfully.");
                }
            }
            catch (Exception ex)
            {
                AMTLogger.WriteToLog(ex.Message, MethodBase.GetCurrentMethod().Name, 0, AMTLogger.LogInfo.Error);
            }
        }
Esempio n. 3
0
        public override void OnExecute(CommandEventArgs e)
        {
            using (ExportDialog dlg = new ExportDialog(e.Context))
            {
                dlg.OriginPath = EnumTools.GetSingle(e.Selection.GetSelectedSvnItems(false)).FullPath;

                if (dlg.ShowDialog(e.Context) != DialogResult.OK)
                {
                    return;
                }

                SvnDepth depth = dlg.NonRecursive ? SvnDepth.Empty : SvnDepth.Infinity;

                e.GetService <IProgressRunner>().RunModal(CommandStrings.Exporting,
                                                          delegate(object sender, ProgressWorkerArgs wa)
                {
                    SvnExportArgs args = new SvnExportArgs();
                    args.Depth         = depth;
                    args.Revision      = dlg.Revision;
                    args.Overwrite     = true;

                    wa.Client.Export(dlg.ExportSource, dlg.LocalPath, args);
                });
            }
        }
Esempio n. 4
0
        public override void OnExport()
        {
            base.OnExport();
            ExportDialog frmExport = new ExportDialog(fpInventorySummary);

            frmExport.ShowDialog(this);
        }
Esempio n. 5
0
 private void ExportPasswords_Click(object sender, EventArgs e)
 {
     if (ExportDialog.ShowDialog() == DialogResult.OK)
     {
         passwords.SaveToFile(ExportDialog.FileName);
     }
 }
Esempio n. 6
0
 private void ExportToolStripMenuItem_Click(object sender, EventArgs e)
 {
     using (var dialog = new ExportDialog(this._annotationPackageProvider))
     {
         dialog.StartPosition = FormStartPosition.CenterParent;
         dialog.ShowDialog(this);
     }
 }
Esempio n. 7
0
        private void OnExportAction()
        {
            string       key    = GetSelectedKey();
            ExportDialog dialog = new ExportDialog();

            dialog.cmbBranch.Text = key;
            dialog.ShowDialog(this);
        }
Esempio n. 8
0
        private void ExportMany(OneNote one, List <string> pageIDs)
        {
            OneNote.ExportFormat format;
            string path;

            using (var dialog = new ExportDialog(pageIDs.Count))
            {
                if (dialog.ShowDialog(owner) != DialogResult.OK)
                {
                    return;
                }

                path   = dialog.FolderPath;
                format = dialog.Format;
            }

            string ext = null;

            switch (format)
            {
            case OneNote.ExportFormat.HTML: ext = ".htm"; break;

            case OneNote.ExportFormat.PDF: ext = ".pdf"; break;

            case OneNote.ExportFormat.Word: ext = ".docx"; break;

            case OneNote.ExportFormat.XML: ext = ".xml"; break;
            }

            string formatName = format.ToString();

            using (var progress = new ProgressDialog())
            {
                progress.SetMaximum(pageIDs.Count);
                progress.Show(owner);

                foreach (var pageID in pageIDs)
                {
                    var page     = one.GetPage(pageID);
                    var filename = Path.Combine(path, page.Title.Replace(' ', '_') + ext);

                    progress.SetMessage(filename);
                    progress.Increment();

                    if (format == OneNote.ExportFormat.XML)
                    {
                        SaveAsXML(page.Root, filename);
                    }
                    else
                    {
                        SaveAs(one, page.PageId, filename, format, formatName);
                    }
                }
            }

            UIHelper.ShowMessage(string.Format(Resx.SaveAsMany_Success, pageIDs.Count, path));
        }
        public void ExportAllToExcelCommandExecuted()
        {
            ExportViewModel exportViewModel = new ExportViewModel();

            var exportDialog = new ExportDialog {
                DataContext = exportViewModel
            };

            if (exportDialog.ShowDialog() == true)
            {
                var exporter = new ExcelExporter(this.Tabs[selectedTabIndex]);
                exporter.SaveTo(exportViewModel.FilePath);
            }
        }
Esempio n. 10
0
        private void btnExportLibrary_Click(object sender, RoutedEventArgs e)
        {
            //System.Windows.Forms.SaveFileDialog dialog = new System.Windows.Forms.SaveFileDialog();
            //dialog.CheckPathExists = true;
            //dialog.OverwritePrompt = true;
            //dialog.AutoUpgradeEnabled = true;
            //dialog.DefaultExt = ".xls";
            //dialog.Title = Resource.Get("ExportTitle");
            //if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            //    Database.ExportToExcel(dialog.FileName);

            ExportDialog dialog = new ExportDialog();

            dialog.ExportClick += new ExportHandler(ExportLibrary);
            dialog.ShowDialog();
        }
Esempio n. 11
0
        private void ExportCost()
        {
            try
            {
                InventoryOnhandController ctlInvent = new InventoryOnhandController();
                if (shtView.Rows.Count == 0)
                {
                    return;
                }
                int row = shtView.Rows.Count;
                //int rowfilter= shtView.RowFilter.SheetView.Rows.Count;

                List <string> ItemCodes = new List <string>();
                for (int i = 0; i < row; i++)
                {
                    if (shtView.Cells[i, (int)eColView.ITEM_CODE].Value != null)
                    {
                        if (!ItemCodes.Contains(shtView.Cells[i, (int)eColView.ITEM_CODE].Value.ToString()))
                        {
                            ItemCodes.Add(shtView.Cells[i, (int)eColView.ITEM_CODE].Value.ToString());
                        }
                    }
                }

                DataTable dtCostView = ctlInvent.GetCostView(ItemCodes);
                if (dtCostView == null)
                {
                    return;
                }
                FarPoint.Win.Spread.FpSpread  fpCost  = new FarPoint.Win.Spread.FpSpread();
                FarPoint.Win.Spread.SheetView shtCost = new FarPoint.Win.Spread.SheetView();
                shtCost.DataSource          = dtCostView;
                shtCost.Columns[0].CellType = CtrlUtil.CreateDateTimeCellType();

                fpCost.Sheets.Add(shtCost);
                ExportDialog frmExport = new ExportDialog(fpCost);
                frmExport.DefaultExcel_Filename = Environment.CurrentDirectory + "\\Cost View.xls";
                //frmExport.de
                frmExport.ShowDialog(this);
            }
            catch (Exception ex)
            {
                MessageDialog.ShowBusiness(this, ex.Message);
            }
        }
Esempio n. 12
0
        private void btnExport_Click(object sender, EventArgs e)
        {
            var exportDlg = new ExportDialog(AppSettings.CsvExportPath, AppSettings.CsvExportItems);

            DialogResult result = exportDlg.ShowDialog(this);

            if (result != DialogResult.OK)
            {
                return;
            }

            // save settings
            AppSettings.CsvExportPath  = exportDlg.ExportPath;
            AppSettings.CsvExportItems = exportDlg.ItemsToExport;

            // perform export for user
            StartExport(exportDlg.ItemsToExport);
        }
Esempio n. 13
0
 private void tsbExport_Click(object sender, EventArgs e)
 {
     if (ExportGrid != null)
     {
         if (ExportGrid.Rows.Count > 0)
         {
             try
             {
                 using (ExportDialog expDlg = new ExportDialog(ExportGrid))
                 {
                     expDlg.ShowDialog(this);
                 }
             }
             catch (Exception ex)
             {
                 rMessageBox.ShowException(this, ex);
             }
         }
         else
         {
             rMessageBox.ShowInfomation(this, MessageCode.INF0001);
         }
     }
 }
Esempio n. 14
0
        private void ExpBtn_Click(object sender, EventArgs e)
        {
            String FName = "";
            long   RecNo = 1;

            try
            {
                StatusLabel.Text      = Localizate.getMessage(Word.PLEASE_WAIT);
                FileNameCombo.Enabled = false;
                Enabled = false;

                if (DatDatas.Count == 0)
                {
                    StatusLabel.Text = Localizate.getMessage(Word.ERROR) +
                                       Localizate.getMessage(Word.SYSTEM_FOLDER_IS_EMPTY);
                    return;
                }

                ExportDialog.InitialDirectory = Application.StartupPath;
                ExportDialog.FileName         = selectedComboName.Substring(0, selectedComboName.LastIndexOf("."));

                ExportDialog.Filter      = "Tab-SeparatedValues files (*.tsv)|*.tsv";
                ExportDialog.FilterIndex = 1;

                ExportDialog.RestoreDirectory = true;

                if (ExportDialog.ShowDialog() == DialogResult.OK)
                {
                    Encoding enc = Encoding.GetEncoding(RConfig.Instance.TextEncoding);
                    var      sr  = new StreamWriter(ExportDialog.FileName, false, enc);

                    // Write Headers
                    sr.Write("# ");
                    for (int i = 0; i < DatInfo.getFieldNames().Count; i++)
                    {
                        Definition info = DatDatas[0];
                        FName = DatInfo.getFieldNames()[i];
                        FieldInfo FType = DatInfo.getDefinition().GetType().GetField(FName);

                        if (FType == null)
                        {
                            continue;
                        }

                        Object obj = FType.GetValue(info);
                        if (obj == null)
                        {
                            continue;
                        }

                        if (obj is IType)
                        {
                            var type = (IType)obj;

                            type.writeHeader(FName, sr);
                        }
                        else
                        {
                            throw new NotImplementedException("Type " + obj.GetType().Name + " is not implement IType");
                        }
                    }
                    sr.Write("\r\n");

                    onStart(DatDatas.Count);

                    // Write Datas
                    for (int i = 0; i < DatDatas.Count; i++)
                    {
                        Definition info = DatDatas[i];
                        for (int j = 0; j < DatInfo.getFieldNames().Count; j++)
                        {
                            FName = DatInfo.getFieldNames()[j];
                            FieldInfo FType = DatInfo.getDefinition().GetType().GetField(FName);
                            if (FType == null)
                            {
                                continue;
                            }
                            String TmpStr = "";

                            if (FType.GetValue(info) != null)
                            {
                                Object obj = FType.GetValue(info);

                                if (obj is IType)
                                {
                                    var type = (IType)obj;
                                    TmpStr = type.ToString();
                                }
                                else
                                {
                                    throw new NotImplementedException("Type " + obj.GetType().Name +
                                                                      " is not implement IType");
                                }

                                sr.Write(TmpStr);

                                if (j < DatInfo.getFieldNames().Count - 1)
                                {
                                    sr.Write('\t');
                                }
                            }
                        }

                        sr.Write("\r\n");

                        setValue(i);

                        RecNo++;
                    }
                    sr.Close();
                }
                else
                {
                    return;
                }
            }
            catch (Exception ex)
            {
                _log.Info("Exception: " + ex, ex);
            }
            finally
            {
                Enabled = true;
                FileNameCombo.Enabled = true;

                onEnd();
            }

            StatusLabel.Text = Localizate.getMessage(Word.COMPLETE) +
                               String.Format(Localizate.getMessage(Word.EXPORTED_DATA), DatDatas.Count);
        }
Esempio n. 15
0
        // xml запись сцены в файл
        private void ExportScene_Click(object sender, EventArgs e)
        {
            if (ExportDialog.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    IFormatProvider format = new System.Globalization.CultureInfo("en-us");

                    XDocument document = new XDocument();

                    XElement scene = new XElement("scene");
                    scene.SetAttributeValue("ViewMode", Scene.Mode);

                    var      camera        = Scene.Camera;
                    XElement cameraElement = new XElement("camera");

                    cameraElement.SetElementValue("central-projection", camera.IsCentralProjection);

                    XElement position = new XElement("position");
                    position.SetAttributeValue("x", string.Format(format, "{0:0.00}", camera.Position.X));
                    position.SetAttributeValue("y", string.Format(format, "{0:0.00}", camera.Position.Y));
                    position.SetAttributeValue("z", string.Format(format, "{0:0.00}", camera.Position.Z));
                    cameraElement.Add(position);

                    XElement target = new XElement("target");
                    target.SetAttributeValue("x", string.Format(format, "{0:0.00}", camera.Target.X));
                    target.SetAttributeValue("y", string.Format(format, "{0:0.00}", camera.Target.Y));
                    target.SetAttributeValue("z", string.Format(format, "{0:0.00}", camera.Target.Z));
                    cameraElement.Add(target);

                    XElement clippingplanes = new XElement("clipping-planes");
                    clippingplanes.SetAttributeValue("near", camera.NearClipZ);
                    clippingplanes.SetAttributeValue("far", camera.FarClipZ);
                    cameraElement.Add(clippingplanes);

                    cameraElement.SetElementValue("fov", camera.FOV);

                    scene.Add(cameraElement);

                    var      light        = Scene.Light;
                    XElement lightElement = new XElement("light");

                    XElement lightPosition = new XElement("position");
                    lightPosition.SetAttributeValue("x", string.Format(format, "{0:0.00}", light.X));
                    lightPosition.SetAttributeValue("y", string.Format(format, "{0:0.00}", light.Y));
                    lightPosition.SetAttributeValue("z", string.Format(format, "{0:0.00}", light.Z));
                    lightElement.Add(lightPosition);

                    scene.Add(lightElement);

                    XElement objects = new XElement("objects");
                    foreach (TelescopeObject radio in Scene.Objects)
                    {
                        XElement objectelement;

                        objectelement = new XElement("Telescope");

                        objectelement.SetElementValue("Basis1CylinderRadius", string.Format(format, "{0:0.00}", radio.Basis1CylinderRadius));
                        objectelement.SetElementValue("PrimaryLegsLength", string.Format(format, "{0:0.00}", radio.PrimaryLegsLength));
                        objectelement.SetElementValue("Basis2CylinderRadius", string.Format(format, "{0:0.00}", radio.Basis2CylinderRadius));
                        objectelement.SetElementValue("Basis3CylinderRadius", string.Format(format, "{0:0.00}", radio.Basis3CylinderRadius));
                        objectelement.SetElementValue("LenseRadius", string.Format(format, "{0:0.00}", radio.LenseRadius));
                        objectelement.SetElementValue("SecondaryLegsLength", string.Format(format, "{0:0.00}", radio.SecondaryLegsLength));
                        objectelement.SetElementValue("PrimaryLegsCount", string.Format(format, "{0:0.00}", radio.PrimaryLegsCount));
                        objectelement.SetElementValue("SecondaryLegsCount", string.Format(format, "{0:0.00}", radio.SecondaryLegsCount));
                        objectelement.SetElementValue("HandsCount", radio.HandsCount);
                        objectelement.SetElementValue("HandsRadius", radio.HandsRadius);

                        objectelement.SetAttributeValue("name", radio.ObjectName);

                        XElement objectposition = new XElement("position");
                        objectposition.SetAttributeValue("x", string.Format(format, "{0:0.00}", radio.BasePoint.X));
                        objectposition.SetAttributeValue("y", string.Format(format, "{0:0.00}", radio.BasePoint.Y));
                        objectposition.SetAttributeValue("z", string.Format(format, "{0:0.00}", radio.BasePoint.Z));
                        objectelement.Add(objectposition);

                        XElement objectrotate = new XElement("rotate");
                        objectrotate.SetAttributeValue("x", radio.AngleX);
                        objectrotate.SetAttributeValue("y", radio.AngleY);
                        objectrotate.SetAttributeValue("z", radio.AngleZ);
                        objectelement.Add(objectrotate);

                        XElement objectscale = new XElement("scale");
                        objectscale.SetAttributeValue("x", string.Format(format, "{0:0.00}", radio.ScaleX));
                        objectscale.SetAttributeValue("y", string.Format(format, "{0:0.00}", radio.ScaleY));
                        objectscale.SetAttributeValue("z", string.Format(format, "{0:0.00}", radio.ScaleZ));
                        objectelement.Add(objectscale);

                        objects.Add(objectelement);
                    }
                    scene.Add(objects);

                    document.Add(scene);
                    document.Save(ExportDialog.FileName);
                }
                catch (Exception)
                {
                    MessageBox.Show("Не получается экспортировать сцену!", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
        private void ExportConfig_Click(object sender, EventArgs e)
        {
            try
            {
                if (ExportDialog.ShowDialog() == DialogResult.OK)
                {
                    StringBuilder SettingsToText = new StringBuilder();

                    SettingsToText.AppendLine(String.Format("ConfName = {0}", Path.GetFileNameWithoutExtension(ExportDialog.FileName)));
                    SettingsToText.AppendLine();
                    SettingsToText.AppendLine("// Banks");
                    SettingsToText.AppendLine(String.Format("BC1 = {0}", BC1.Value));
                    SettingsToText.AppendLine(String.Format("BC2 = {0}", BC2.Value));
                    SettingsToText.AppendLine(String.Format("BC3 = {0}", BC3.Value));
                    SettingsToText.AppendLine(String.Format("BC4 = {0}", BC4.Value));
                    SettingsToText.AppendLine(String.Format("BC5 = {0}", BC5.Value));
                    SettingsToText.AppendLine(String.Format("BC6 = {0}", BC6.Value));
                    SettingsToText.AppendLine(String.Format("BC7 = {0}", BC7.Value));
                    SettingsToText.AppendLine(String.Format("BC8 = {0}", BC8.Value));
                    SettingsToText.AppendLine(String.Format("BC9 = {0}", BC9.Value));
                    SettingsToText.AppendLine(String.Format("BCD = {0}", BCD.Value));
                    SettingsToText.AppendLine(String.Format("BC11 = {0}", BC11.Value));
                    SettingsToText.AppendLine(String.Format("BC12 = {0}", BC12.Value));
                    SettingsToText.AppendLine(String.Format("BC13 = {0}", BC13.Value));
                    SettingsToText.AppendLine(String.Format("BC14 = {0}", BC14.Value));
                    SettingsToText.AppendLine(String.Format("BC15 = {0}", BC15.Value));
                    SettingsToText.AppendLine(String.Format("BC16 = {0}", BC16.Value));
                    SettingsToText.AppendLine();
                    SettingsToText.AppendLine("// Presets");
                    SettingsToText.AppendLine(String.Format("PC1 = {0}", PC1.Value));
                    SettingsToText.AppendLine(String.Format("PC2 = {0}", PC2.Value));
                    SettingsToText.AppendLine(String.Format("PC3 = {0}", PC3.Value));
                    SettingsToText.AppendLine(String.Format("PC4 = {0}", PC4.Value));
                    SettingsToText.AppendLine(String.Format("PC5 = {0}", PC5.Value));
                    SettingsToText.AppendLine(String.Format("PC6 = {0}", PC6.Value));
                    SettingsToText.AppendLine(String.Format("PC7 = {0}", PC7.Value));
                    SettingsToText.AppendLine(String.Format("PC8 = {0}", PC8.Value));
                    SettingsToText.AppendLine(String.Format("PC9 = {0}", PC9.Value));
                    SettingsToText.AppendLine(String.Format("PCD = {0}", PCD.Value));
                    SettingsToText.AppendLine(String.Format("PC11 = {0}", PC11.Value));
                    SettingsToText.AppendLine(String.Format("PC12 = {0}", PC12.Value));
                    SettingsToText.AppendLine(String.Format("PC13 = {0}", PC13.Value));
                    SettingsToText.AppendLine(String.Format("PC14 = {0}", PC14.Value));
                    SettingsToText.AppendLine(String.Format("PC15 = {0}", PC15.Value));
                    SettingsToText.AppendLine(String.Format("PC16 = {0}", PC16.Value));

                    File.WriteAllText(ExportDialog.FileName, SettingsToText.ToString());

                    MessageBox.Show(
                        String.Format("The setting file \"{0}\" has been saved to:\n\n{1}",
                                      Path.GetFileNameWithoutExtension(ExportDialog.FileName),
                                      ExportDialog.FileName),
                        "Keppy's Synthesizer - Export settings", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                // Something bad happened hehe
                MessageBox.Show(
                    "Fatal error",
                    String.Format("Fatal error during the execution of the program.\n\nPress OK to quit.\n\nException:\n{0}", ex.ToString()),
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error
                    );

                Application.Exit();
            }
        }
 private void exportToolStripMenuItem_Click(object sender, EventArgs e)
 {
     ExportDialog.ShowDialog();
 }
Esempio n. 18
0
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            UIApplication uiapp = commandData.Application;

            DestinationPath = string.Empty;
            Documents       = new List <string>();
            Splash          = string.Empty;
            Errors          = new List <string[]>();

            string date = DateTime.Now.ToString("dd/MM/yyyy");

            int completed = 0;

            int failed = 0;

            ExportDialog exportdialog = new ExportDialog();

            System.Windows.Forms.DialogResult dialog = exportdialog.ShowDialog();

            if (dialog != System.Windows.Forms.DialogResult.OK)
            {
                return(Result.Cancelled);
            }

            WorksetConfiguration openconfig  = new WorksetConfiguration(WorksetConfigurationOption.CloseAllWorksets);
            OpenOptions          openoptions = new OpenOptions();

            openoptions.SetOpenWorksetsConfiguration(openconfig);
            if (exportdialog.DiscardRadioButton.Checked)
            {
                openoptions.DetachFromCentralOption = DetachFromCentralOption.DetachAndDiscardWorksets;
            }
            else
            {
                openoptions.DetachFromCentralOption = DetachFromCentralOption.DetachAndPreserveWorksets;
            }

            SaveAsOptions            worksharedsaveas = new SaveAsOptions();
            WorksharingSaveAsOptions saveConfig       = new WorksharingSaveAsOptions
            {
                SaveAsCentral = true
            };

            worksharedsaveas.SetWorksharingOptions(saveConfig);
            worksharedsaveas.OverwriteExistingFile = true;

            SaveAsOptions regularsaveas = new SaveAsOptions
            {
                OverwriteExistingFile = true
            };

            if (exportdialog.AuditCheckBox.Checked)
            {
                openoptions.Audit = true;
            }

            if (exportdialog.SafeNameTextbox.Text.Trim() != string.Empty)
            {
                Splash = exportdialog.SafeNameTextbox.Text.Trim();
            }

            string customdate = exportdialog.DateTimePickerIssue.Value.ToString("yyyy/MM/dd");

            string nameprefix = exportdialog.PrefixTextBox.Text.Trim();

            string namesuffix = exportdialog.SuffixTextBox.Text.Trim();

            bool samepath = false;

            List <string[]> results = new List <string[]>();

            foreach (string path in Documents)
            {
                string destdoc = nameprefix + Path.GetFileNameWithoutExtension(path) + namesuffix + ".rvt";

                if (File.Exists(DestinationPath + destdoc))
                {
                    samepath = true;
                    break;
                }

                string pathonly = Path.GetDirectoryName(path) + "\\";

                if (pathonly == DestinationPath)
                {
                    samepath = true;
                    break;
                }
            }

            if (samepath)
            {
                TaskDialog td = new TaskDialog("Export")
                {
                    MainInstruction = "Some documents already exist in the destination path.",
                    MainContent     = "The files will be overritten, do you wish to continue?"
                };

                td.AddCommandLink(TaskDialogCommandLinkId.CommandLink1, "Continue");
                td.AddCommandLink(TaskDialogCommandLinkId.CommandLink2, "Cancel");

                switch (td.Show())
                {
                case TaskDialogResult.CommandLink1:
                    break;

                case TaskDialogResult.CommandLink2:
                    return(Result.Cancelled);

                default:
                    return(Result.Cancelled);
                }
            }

            uiapp.DialogBoxShowing += new EventHandler <DialogBoxShowingEventArgs>(OnDialogBoxShowing);
            uiapp.Application.FailuresProcessing += FailureProcessor;

            DateTime start = DateTime.Now;

            foreach (string path in Documents)
            {
                string[] result        = new string[6];
                string   resultmessage = string.Empty;

                if (!File.Exists(path))
                {
                    result[0] = Path.GetFileName(path);
                    result[1] = "File Not Found";
                    result[2] = string.Empty;
                    results.Add(result);
                    failed++;
                    continue;
                }

                DateTime s1 = DateTime.Now;

                Document doc = null;

                //try
                //{
                doc = uiapp.Application.OpenDocumentFile(ModelPathUtils.ConvertUserVisiblePathToModelPath(path), openoptions);

                string docname = nameprefix + Path.GetFileNameWithoutExtension(path) + namesuffix;

                using (Transaction t = new Transaction(doc, "Export"))
                {
                    t.Start();

                    if (exportdialog.AutoCheckBox.Checked)
                    {
                        doc.ProjectInformation.IssueDate = date;
                    }
                    else
                    {
                        doc.ProjectInformation.IssueDate = customdate;
                    }

                    if (exportdialog.RemoveCADLinksCheckBox.Checked)
                    {
                        DeleteCADLinks(doc);
                    }
                    if (exportdialog.RemoveCADImportsCheckBox.Checked)
                    {
                        DeleteCADImports(doc);
                    }
                    if (exportdialog.RemoveRVTLinksCheckBox.Checked)
                    {
                        DeleteRVTLinks(doc);
                    }
                    DeleteViewsAndSheets(doc, exportdialog.ViewsONSheetsCheckBox.Checked, exportdialog.ViewsNOTSheetsCheckBox.Checked, exportdialog.SheetsCheckBox.Checked, exportdialog.TemplatesCheckBox.Checked);
                    if (exportdialog.RemoveSchedulesCheckBox.Checked)
                    {
                        DeleteSchedules(doc);
                    }
                    if (exportdialog.UngroupCheckBox.Checked)
                    {
                        UngroupGroups(doc);
                    }
                    if (exportdialog.PurgeCheckBox.Checked)
                    {
                        PurgeDocument(doc);
                    }

                    t.Commit();
                }


                if (doc.IsWorkshared)
                {
                    doc.SaveAs(DestinationPath + docname + ".rvt", worksharedsaveas);
                }
                else
                {
                    doc.SaveAs(DestinationPath + docname + ".rvt", regularsaveas);
                }

                doc.Close(false);

                string backupfolder = DestinationPath + docname + "_backup";
                string tempfolder   = DestinationPath + "Revit_temp";

                if (Directory.Exists(backupfolder))
                {
                    Directory.Delete(backupfolder, true);
                }
                if (Directory.Exists(tempfolder))
                {
                    Directory.Delete(tempfolder, true);
                }

                resultmessage = "Completed";
                completed++;
                //}
                // catch (Exception e)
                //{
                //    try
                //    {
                //        doc.Close(false);
                //    }
                //    catch { }

                //    resultmessage = e.Message;
                //    failed++;
                //}

                DateTime e1 = DateTime.Now;

                int h = (e1 - s1).Hours;
                int m = (e1 - s1).Minutes;
                int s = (e1 - s1).Seconds;

                result[0] = Path.GetFileName(path);
                result[1] = resultmessage;
                result[2] = h.ToString() + ":" + m.ToString() + ":" + s.ToString();
                results.Add(result);
            }

            uiapp.DialogBoxShowing -= OnDialogBoxShowing;
            uiapp.Application.FailuresProcessing -= FailureProcessor;

            DateTime end = DateTime.Now;

            int hours = (end - start).Hours;

            int minutes = (end - start).Minutes;

            int seconds = (end - start).Seconds;

            TaskDialog rd = new TaskDialog("Export")
            {
                MainInstruction = "Results",
                MainContent     = "Exported to: " + DestinationPath + "\n" + "Completed: " + completed.ToString() + "\nFailed: " + failed.ToString() + "\nTotal Time: " + hours.ToString() + " h " + minutes.ToString() + " m " + seconds.ToString() + " s"
            };

            rd.AddCommandLink(TaskDialogCommandLinkId.CommandLink1, "Close");
            rd.AddCommandLink(TaskDialogCommandLinkId.CommandLink2, "Show Details");

            switch (rd.Show())
            {
            case TaskDialogResult.CommandLink1:
                return(Result.Succeeded);

            case TaskDialogResult.CommandLink2:

                ResultsDialog resultsdialog = new ResultsDialog();

                foreach (string[] r in results)
                {
                    var item = new System.Windows.Forms.ListViewItem(r);
                    resultsdialog.ResultsView.Items.Add(item);
                }

                var rdialog = resultsdialog.ShowDialog();

                return(Result.Succeeded);

            default:
                return(Result.Succeeded);
            }
        }