Click here to Skip to main content
16,004,653 members
Home / Discussions / C#
   

C#

 
AnswerRe: Popup shown in backgroundworker thread Pin
PrashantGadhave21-Sep-08 0:38
PrashantGadhave21-Sep-08 0:38 
GeneralRe: Popup shown in backgroundworker thread Pin
Wendelius21-Sep-08 1:09
mentorWendelius21-Sep-08 1:09 
GeneralRe: Popup shown in backgroundworker thread Pin
PrashantGadhave21-Sep-08 1:55
PrashantGadhave21-Sep-08 1:55 
GeneralRe: Popup shown in backgroundworker thread Pin
Wendelius21-Sep-08 3:52
mentorWendelius21-Sep-08 3:52 
GeneralRe: Popup shown in backgroundworker thread Pin
PrashantGadhave22-Sep-08 6:52
PrashantGadhave22-Sep-08 6:52 
GeneralRe: Popup shown in backgroundworker thread Pin
Wendelius22-Sep-08 8:00
mentorWendelius22-Sep-08 8:00 
GeneralRe: Popup shown in backgroundworker thread Pin
Alan N22-Sep-08 8:27
Alan N22-Sep-08 8:27 
GeneralRe: Popup shown in backgroundworker thread Pin
PrashantGadhave24-Sep-08 2:19
PrashantGadhave24-Sep-08 2:19 
Here is how I have implemented the above code:

When I want to show ProgressBar, I create a ProgressBar instance and start a new thread and show ProgressBar using objProgressBar.ShowDialog(). After this a backgroundWorker thread is started and kept running in the ProgressBar, which doe's nothing and just keeps on looping till bContinue (a bool) is false. When I say HideProgressBar() the variable 'bContinue' is set to false and the Progressbar is destroyed.

I have created a thread for running ProgressBar, because the main thread code will keep on working as is, and when I am done with the main thread processing, I will call HideProgressBar() which will destroy ProgressBar form.

These two forms are in separate projects, which are in the same solution file. MainForm is in a project, which is the Shell of my application and is the first form that is going to be loaded. After that, there will be other controls which will be loaded on this form, as and when required. I have used CAB which is provided by Microsoft.Practices.

I can't specify MainForm type in the ProgressBar's constuctor (as MainForm project's output is exe and not lib and the second thing is it would create cyclic reference). I stored the reference to MainForm (this) instance in the AppGlobals file and used this reference for subscribing to the mainForm's resize event using reflection, in the ProgressBar class. and I am getting the events also.

But when I try to set WindowState of ProgressBar, after I get the event of MainForm resized, the effect is not seen in the ProgressBar form. Also, if I click on some other application in taskbar, still the ProgressBar is shown, even if MainForm is minimized (or sometimes MainForm is in painting / hanged situation)

If I try to set Parent in the Progressbar form I get 'Top-level control cannot be added to a control'.

If I set Owner and add CheckForIllegalCrossThreadCalls = false, the problem is solved temporarily but the application starts behaving abnormally, like the main window after the aplication is started is minimised, or if I click on some other tabs in the main window, still the main Window gets minimised. So I think I will have to go with the solution without Owner property.

Could you please suggest a solution for this. Waiting for your replySmile | :)
Questioncan someone help me in this program.. Pin
cutedrew20-Sep-08 21:38
cutedrew20-Sep-08 21:38 
AnswerRe: can someone help me in this program.. Pin
zafersavas21-Sep-08 0:50
zafersavas21-Sep-08 0:50 
AnswerRe: can someone help me in this program.. Pin
Ashfield21-Sep-08 21:41
Ashfield21-Sep-08 21:41 
QuestionSOA & C# Pin
Gil Shimer20-Sep-08 21:14
Gil Shimer20-Sep-08 21:14 
AnswerRe: SOA & C# Pin
Wendelius21-Sep-08 0:41
mentorWendelius21-Sep-08 0:41 
GeneralRe: SOA & C# Pin
Gil Shimer21-Sep-08 23:13
Gil Shimer21-Sep-08 23:13 
GeneralRe: SOA & C# Pin
Wendelius22-Sep-08 7:45
mentorWendelius22-Sep-08 7:45 
GeneralRe: SOA & C# Pin
Gil Shimer22-Sep-08 20:41
Gil Shimer22-Sep-08 20:41 
GeneralRe: SOA & C# Pin
Wendelius23-Sep-08 5:45
mentorWendelius23-Sep-08 5:45 
AnswerRe: SOA & C# Pin
Kevin McFarlane21-Sep-08 5:47
Kevin McFarlane21-Sep-08 5:47 
GeneralRe: SOA & C# Pin
Gil Shimer21-Sep-08 23:20
Gil Shimer21-Sep-08 23:20 
GeneralRe: SOA & C# Pin
Kevin McFarlane22-Sep-08 0:12
Kevin McFarlane22-Sep-08 0:12 
GeneralRe: SOA & C# Pin
Gil Shimer22-Sep-08 0:26
Gil Shimer22-Sep-08 0:26 
QuestionSOAP header Pin
George_George20-Sep-08 20:15
George_George20-Sep-08 20:15 
AnswerRe: SOAP header Pin
Wendelius21-Sep-08 0:48
mentorWendelius21-Sep-08 0:48 
GeneralRe: SOAP header Pin
George_George21-Sep-08 20:57
George_George21-Sep-08 20:57 
GeneralRe: SOAP header Pin
Wendelius22-Sep-08 9:55
mentorWendelius22-Sep-08 9:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.