PC Review


Reply
Thread Tools Rate Thread

Compact framework threads and forms problem

 
 
Piotrek \Alchemik\
Guest
Posts: n/a
 
      29th Apr 2005
I have small problem with my project for Windows Ce, i'm using some threads and
i'd like them to paint something on my form. The problem is, that only way i can
do that is using invoke, unfortunetly in compact framework there is no way how
to pass parameters through invoke. I was trying to create a small class
with a public method (the delegate), and a few public properties (the
parameters).

-Instantiate the class
-set the properties
-Call Form.Invoke and pass it a reference to the class' public method

when the delegate gets called, your code can then reference the
properties you set but it didn't work as well. Maybe there is a way to do that
in different way?
Thanks a lot :-)

--
Piotrek "Alchemik" gg:183441 kilobyte[at]tlen[dot]pl
/o|o\/o|o\/o|o\/o|o\/o|o\/o|o\/o|o\/o|o\/o|o\/o|o\/o|o\/o|o\/o|o\/o|o\/o|o\/o|o\
"I am not in this world to live up to other people's expectations, nor
do I feel that the world must live up to mine." /Fritz Perls
 
Reply With Quote
 
 
 
 
Tim Wilson
Guest
Posts: n/a
 
      29th Apr 2005
Have a look through the archives to see if anything helps.
http://groups-beta.google.com/groups...mpactframework

If not, try posting this question to the official CF newsgroup.
microsoft.public.dotnet.framework.compactframework

--
Tim Wilson
..Net Compact Framework MVP

"Piotrek "Alchemik"" <(E-Mail Removed)> wrote in message
news:d4s0e0$bu0$(E-Mail Removed)...
> I have small problem with my project for Windows Ce, i'm using some

threads and
> i'd like them to paint something on my form. The problem is, that only way

i can
> do that is using invoke, unfortunetly in compact framework there is no way

how
> to pass parameters through invoke. I was trying to create a small class
> with a public method (the delegate), and a few public properties (the
> parameters).
>
> -Instantiate the class
> -set the properties
> -Call Form.Invoke and pass it a reference to the class' public method
>
> when the delegate gets called, your code can then reference the
> properties you set but it didn't work as well. Maybe there is a way to do

that
> in different way?
> Thanks a lot :-)
>
> --
> Piotrek "Alchemik" gg:183441

kilobyte[at]tlen[dot]pl
>

/o|o\/o|o\/o|o\/o|o\/o|o\/o|o\/o|o\/o|o\/o|o\/o|o\/o|o\/o|o\/o|o\/o|o\/o|o\/
o|o\
> "I am not in this world to live up to other people's expectations, nor
> do I feel that the world must live up to mine." /Fritz Perls



 
Reply With Quote
 
Piotrek \Alchemik\
Guest
Posts: n/a
 
      29th Apr 2005
Tim Wilson wrote:
> Have a look through the archives to see if anything helps.
> http://groups-beta.google.com/groups...mpactframework
>
> If not, try posting this question to the official CF newsgroup.
> microsoft.public.dotnet.framework.compactframework
>


I was already trying to find an answer there. I was looking for answer here, i
don't even why. I tried all the combinations, i made for example small project
only with this and i get the same problem as above. Maybe i should add some code:

namespace Przyklad
{
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Label label1;
private Thread t1;
private ThreadStart starter1;
private System.Windows.Forms.Button button1;
public Linia ln;

public Form1()
{
InitializeComponent();
}
protected override void Dispose( bool disposing )
{
base.Dispose( disposing );
}
#region Windows Form Designer generated code
#endregion
static void Main()
{
Application.Run(new Form1());
}

private void button1_Click(object sender, System.EventArgs e)
{
starter1 = new ThreadStart(akcja);
t1 = new Thread(starter1);
t1.Start();
}

private void akcja()
{
ln.a="zmiana";
this.Invoke(new EventHandler(Zmiana));
Console.WriteLine(ln.a);
}

private void Zmiana (Object o, EventArgs e)
{
this.label1.Text = ln.a;
}
}


public class Linia
{
public String a;

Linia()
{
a="cos";
}
}
}

Maybe i got something with my system and this code works on others?
Thanks a lot
--
Piotrek "Alchemik" gg:183441 kilobyte[at]tlen[dot]pl
/o|o\/o|o\/o|o\/o|o\/o|o\/o|o\/o|o\/o|o\/o|o\/o|o\/o|o\/o|o\/o|o\/o|o\/o|o\/o|o\
"I am not in this world to live up to other people's expectations, nor
do I feel that the world must live up to mine." /Fritz Perls
 
Reply With Quote
 
Tim Wilson
Guest
Posts: n/a
 
      29th Apr 2005
I would suggest posting this question in the official CF newsgroup.
microsoft.public.dotnet.framework.compactframework

--
Tim Wilson
..Net Compact Framework MVP

"Piotrek "Alchemik"" <(E-Mail Removed)> wrote in message
news:d4snvm$skp$(E-Mail Removed)...
> Tim Wilson wrote:
> > Have a look through the archives to see if anything helps.
> >

http://groups-beta.google.com/groups...mpactframework
> >
> > If not, try posting this question to the official CF newsgroup.
> > microsoft.public.dotnet.framework.compactframework
> >

>
> I was already trying to find an answer there. I was looking for answer

here, i
> don't even why. I tried all the combinations, i made for example small

project
> only with this and i get the same problem as above. Maybe i should add

some code:
>
> namespace Przyklad
> {
> public class Form1 : System.Windows.Forms.Form
> {
> private System.Windows.Forms.Label label1;
> private Thread t1;
> private ThreadStart starter1;
> private System.Windows.Forms.Button button1;
> public Linia ln;
>
> public Form1()
> {
> InitializeComponent();
> }
> protected override void Dispose( bool disposing )
> {
> base.Dispose( disposing );
> }
> #region Windows Form Designer generated code
> #endregion
> static void Main()
> {
> Application.Run(new Form1());
> }
>
> private void button1_Click(object sender, System.EventArgs e)
> {
> starter1 = new ThreadStart(akcja);
> t1 = new Thread(starter1);
> t1.Start();
> }
>
> private void akcja()
> {
> ln.a="zmiana";
> this.Invoke(new EventHandler(Zmiana));
> Console.WriteLine(ln.a);
> }
>
> private void Zmiana (Object o, EventArgs e)
> {
> this.label1.Text = ln.a;
> }
> }
>
>
> public class Linia
> {
> public String a;
>
> Linia()
> {
> a="cos";
> }
> }
> }
>
> Maybe i got something with my system and this code works on others?
> Thanks a lot
> --
> Piotrek "Alchemik" gg:183441

kilobyte[at]tlen[dot]pl
>

/o|o\/o|o\/o|o\/o|o\/o|o\/o|o\/o|o\/o|o\/o|o\/o|o\/o|o\/o|o\/o|o\/o|o\/o|o\/
o|o\
> "I am not in this world to live up to other people's expectations, nor
> do I feel that the world must live up to mine." /Fritz Perls



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Resizing forms at runtime using Compact Framework 2.0 Mike Microsoft Dot NET Framework Forms 1 25th Jan 2008 12:42 PM
Compact Framework , Pictures , forms,.... info@it-design.biz Microsoft Dot NET Compact Framework 1 23rd May 2005 06:11 PM
Forms in Compact Framework David Microsoft Dot NET Compact Framework 1 1st Aug 2004 10:13 AM
Windows.Forms Issue (compact framework) Brett Miller Microsoft Dot NET Compact Framework 1 16th Jul 2004 11:22 PM
Unload forms in .Net Compact Framework Red Microsoft Dot NET Compact Framework 4 28th Feb 2004 05:00 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:06 AM.