the problem in create f_in_box form at multithreading

.NET Edition of the F-IN-BOX
alpha
Posts: 3
Joined: Mon Mar 30, 2009 6:46 am

the problem in create f_in_box form at multithreading

Postby alpha » Mon Mar 30, 2009 7:07 am

hi,can anybody help me?
when i create a common form at work thread(not main thread),it works like this:

Code: Select all

Form1 form = new Form1();
ISynchronizeInvoke synchronizer;
synchronizer = form;
MethodInvoker invoker = new MethodInvoker(form.Show);
Global.mainForm.Invoke(invoker, null);


but,if the Form1 extend f_in_box__lib.f_in_box__form,it doesn‘t work.


why?

Softanics
Site Admin
Posts: 1402
Joined: Sat Sep 18, 2004 3:03 am
Location: Russia, St. Petersburg
Contact:

Postby Softanics » Mon Mar 30, 2009 8:09 am

Thank you for your question.

Could you please send me a sample to test to support (at) f-in-box.com ?

Thank you.
Best regards, Artem A. Razin,
F-IN-BOX support
Ask your question here: http://www.f-in-box.com/support.html

alpha
Posts: 3
Joined: Mon Mar 30, 2009 6:46 am

Postby alpha » Tue Mar 31, 2009 12:59 am

The thread was create by quartz(.net),I want to show a new flash form within a work thread.like this:

Code: Select all

class WidgetJob : IJob
    {
         public virtual void Execute(JobExecutionContext context) {
            try {
                JobDataMap data = context.JobDetail.JobDataMap;
            //string xml = data.GetString("swf");            
         
            
            Form1 form = new Form1();
            ISynchronizeInvoke synchronizer;
            synchronizer = form;
            MethodInvoker invoker = new MethodInvoker(form.Show);
            Global.mainForm.Invoke(invoker, null);

            } catch (JobExecutionException e) {
                throw new NotImplementedException();
            }
        }
      
    }


the quartz configure like this:
properties["quartz.scheduler.instanceName"] = "PriorityExampleScheduler";
properties["quartz.threadPool.threadCount"] = "1";
properties["quartz.threadPool.type"] = "Quartz.Simpl.SimpleThreadPool, Quartz";
properties["quartz.jobStore.type"] = "Quartz.Simpl.RAMJobStore, Quartz";

Softanics
Site Admin
Posts: 1402
Joined: Sat Sep 18, 2004 3:03 am
Location: Russia, St. Petersburg
Contact:

Postby Softanics » Tue Mar 31, 2009 1:51 pm

So Form1 form is created in one thread and form.Show is called from another, right?

Thank you.
Best regards, Artem A. Razin,

F-IN-BOX support

Ask your question here: http://www.f-in-box.com/support.html

alpha
Posts: 3
Joined: Mon Mar 30, 2009 6:46 am

Postby alpha » Wed Apr 01, 2009 2:09 am

Yes,it is. the instance of WidgetJob was create by quartz.net and run in a single thread,but it is not the message queue thread.so,if I want to show the form ,I must invoke the form.Show() method in the message queue thread. But it seems that when a flashform extend f_in_box__form,it auto show without flashform.Show() method.(the flashform.Show() do nothing?) ,
therefore, the question arises。

here some info;
http://www.codeproject.com/KB/cs/threadsafeforms.aspx

Softanics
Site Admin
Posts: 1402
Joined: Sat Sep 18, 2004 3:03 am
Location: Russia, St. Petersburg
Contact:

Postby Softanics » Wed Apr 01, 2009 1:23 pm

But you call

Form1 form = new Form1();

not using Global.mainForm.Invoke...
Best regards, Artem A. Razin,

F-IN-BOX support

Ask your question here: http://www.f-in-box.com/support.html


Return to “.NET Edition”

Who is online

Users browsing this forum: No registered users and 11 guests

cron