This is a migrated thread and some comments may be shown as answers.

XlsxFormatProvider and busyindicator

3 Answers 69 Views
Spreadsheet
This is a migrated thread and some comments may be shown as answers.
Leonard
Top achievements
Rank 1
Leonard asked on 18 Jun 2015, 02:38 PM

Good morning, 

 I have the following code

            Document = null;
            IWorkbookFormatProvider provider = new XlsxFormatProvider();
            var openDialog = new OpenFileDialog
                {
                    Multiselect = false,
                    Filter = GetExtension()
                };
            bool? dialogResult = openDialog.ShowDialog();
            string fileName = string.Empty;
            if (dialogResult == true)
            {
                try
                {
                    using (Stream stream = openDialog.File.OpenRead())
                    {
                        Messenger.Default.Send(new ProgressBar(true));
                        
                        Document = provider.Import(stream);
                        fileName = openDialog.File.Name;
                        
                        Messenger.Default.Send(newProgressBar(false));
                    }
                }
                catch (Exception e)
                {
                    Error = e.Message;
                }
                
            }
            FileName = fileName;

 

when I import a file I get an error about thrads in same line.

How can I show a busyindicator while is importing?

Thanks.

3 Answers, 1 is accepted

Sort by
0
Anna
Telerik team
answered on 22 Jun 2015, 10:45 AM
Hello,

Both the progress bar and the format provider use the UI thread and, unfortunately, this means that showing a progress bar during import is not possible at this stage.

Regards,
Anna
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Sergey
Top achievements
Rank 1
Iron
answered on 20 Aug 2015, 03:22 PM

Is there any plans on resolving this? Very small file Import takes about 1 second. It very quickly might become a problem.

Using BackGroundWorker isn't helping either as it throws cross thread exception.

0
Anna
Telerik team
answered on 25 Aug 2015, 02:34 PM
Hi Sergey,

Do you think that you could open a support ticket and send us the file with which you reproduce this behavior so that we can investigate? A whole second indeed sounds like a long time for a small file. Moreover, you should be able to use a background worker for the import with the last version of RadSpreadsheet, so if you could send us the code throwing the cross thread exception it would also be really helpful.

Regards,
Anna
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Spreadsheet
Asked by
Leonard
Top achievements
Rank 1
Answers by
Anna
Telerik team
Sergey
Top achievements
Rank 1
Iron
Share this question
or