Label does not Get Updated
-
Good Day i have a code which is fired on the Button click even
//Part 1 -- its not Getting updated
Status.Background = new SolidColorBrush(Colors.Orange);
Status.Content = "Exporting, please wait...";//Part 2 is working Logger.ExportLogToExcel(); //Part 3 is Working Status.Background = new SolidColorBrush(Colors.Yellow); Status.Content = "Exported to Excel Successfully";
What is Part 1 not working. Basically , i am Exporting to Excel , and i am changing the Label that shows the status, i am changing the color and also the contents. but the Dont change i only see "Exported to Excel Successfully" I thought might be that the Export is quick to a point that it immediately jump to Success message. i added a thread to make to sleep for a few seconds before it can export so i see a different background. Thanks
Vuyiswa Maseko, Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code. C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vimalsoft.com vuyiswa[at]vimalsoft.com
-
Good Day i have a code which is fired on the Button click even
//Part 1 -- its not Getting updated
Status.Background = new SolidColorBrush(Colors.Orange);
Status.Content = "Exporting, please wait...";//Part 2 is working Logger.ExportLogToExcel(); //Part 3 is Working Status.Background = new SolidColorBrush(Colors.Yellow); Status.Content = "Exported to Excel Successfully";
What is Part 1 not working. Basically , i am Exporting to Excel , and i am changing the Label that shows the status, i am changing the color and also the contents. but the Dont change i only see "Exported to Excel Successfully" I thought might be that the Export is quick to a point that it immediately jump to Success message. i added a thread to make to sleep for a few seconds before it can export so i see a different background. Thanks
Vuyiswa Maseko, Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code. C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vimalsoft.com vuyiswa[at]vimalsoft.com
I am guessing that everything is done on the main thread so the UI thread locks until the method is completed and the last colour change is effected. Unless you do the export on a separate thread you are not going to see the initial colour change. putting in a delay does not help, move the export to a BGW thread.
Never underestimate the power of human stupidity RAH
-
I am guessing that everything is done on the main thread so the UI thread locks until the method is completed and the last colour change is effected. Unless you do the export on a separate thread you are not going to see the initial colour change. putting in a delay does not help, move the export to a BGW thread.
Never underestimate the power of human stupidity RAH
i actually tried that initially. by setting the color from another Thread and the Export is obviously in another thread. but still the issue remains , let me keep trying something will post the feedback if i get to the solution.
Vuyiswa Maseko, Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code. C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vimalsoft.com vuyiswa[at]vimalsoft.com
-
i actually tried that initially. by setting the color from another Thread and the Export is obviously in another thread. but still the issue remains , let me keep trying something will post the feedback if i get to the solution.
Vuyiswa Maseko, Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code. C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vimalsoft.com vuyiswa[at]vimalsoft.com
No no no, you set the colour BEFORE you launch the BGW that exports the excel, in the BGW compleate method you set the colour the second time. This allows the UI to refresh while the BGW is working.
Never underestimate the power of human stupidity RAH
-
No no no, you set the colour BEFORE you launch the BGW that exports the excel, in the BGW compleate method you set the colour the second time. This allows the UI to refresh while the BGW is working.
Never underestimate the power of human stupidity RAH
You are 100% Right, i was missing Something. its now working like charm.
Vuyiswa Maseko, Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code. C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vimalsoft.com vuyiswa[at]vimalsoft.com