[IronPython] WPF Window vs. Application

Lukáš Duběda loocas at duber.cz
Tue May 4 10:13:46 PDT 2010


Hmm, that's what I'm afraid of. Never done any threaded app
so far.

Could you, please, give me a hint as to how to set this up
so that the Application() runs from within the host app
without problems, i.e. as if it was just a host app's Window.

Thanks a lot, I appretiate it.

Lukáš Duběda
Director
[T] +420 602 444 164

duber studio(tm)
[M] info at duber.cz
[W] http://www.duber.cz

[A] R.A.Dvorského 601, Praha 10
[A] 10900, Czech Republic, Europe

Lukas Cenovsky wrote:
> Lukáš Duběda wrote:
>> Hi there everybody.
>>
>> I have yet another question.
>>
>> This time, since I'm trying to strictly use WPF for my GUI
>> etc... and what I do here is I host IronPython within another
>> application that calls it and IPy serves the GUI and
>> program logic, I bumped into a problem when calling the
>>
>> Application().Run(LoadedXaml)
>>
>> The problem seems to be that the app runs in its own thread
>> separately from the host app and thus doesn't communicate
>> with the host app, until I close the Application (then
>> it performs the last task I wanted it to).
>>
>> So, I was thinking, since I already have most of the gory
>> Application stuff already up and running, courtesy of the
>> host app, is there a way to actually only use WPF to
>> display the GUI and have the program logic taken care of by
>> IPy? Such as WinForms provides using the Window.Show()
>> method.
>>
>> A friend of mine suggested if I could change the Data Type
>> of the XamlReader.Load... object to a Window object. I don't
>> know C#, but he suggested this:
>>
>> Window myWindow;
>> object result = XamlReader.Load( source );
>> myWindow = (Window)result;
>> myWindow.Show();
>>
>> Is this somehow achieveable via IPy scripting or directly in
>> the Xaml? Or somehow else?
> 
> I doubt this would work - WinForms Window is not the same as WPF Window. 
> I think you have to run you WPF app in background STA thread to be able 
> to control in from the main thread.
> 
> -- 
> -- Lukáš
> 
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


More information about the Users mailing list