Ejemplo n.º 1
0
        private void buttonExport_Click(object sender, EventArgs e)
        {
            if (listViewTransactionsList.Items.Count == 0)
            {
                Notify("PrepareTransactionBeforeExport.Text");
                return;
            }

            if (listViewTransactionsList.Items.Count > 0)
            {
                progressBarExport.Maximum = listViewTransactionsList.Items.Count;
                progressBarExport.Step    = 1;
                progressBarExport.Minimum = 0;
                progressBarExport.Value   = 0;
                string fileName = ExportFile.SaveTextToNewPath();

                if (string.IsNullOrEmpty(fileName))
                {
                    btnSelectAll.Enabled   = true;
                    btnDeselectAll.Enabled = true;
                    return;
                }

                _bwExportToFile = new BackgroundWorker
                {
                    WorkerReportsProgress      = true,
                    WorkerSupportsCancellation = true
                };
                _bwExportToFile.DoWork             += BwExportToFile_DoWork;
                _bwExportToFile.RunWorkerCompleted += BwExportToFile_WorkCompleted;
                _bwExportToFile.RunWorkerAsync(fileName);
            }
        }