473,386 Members | 1,962 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

interface and refresh

I have an interface I am using to get access to some of the objects on my
form: a textbox (Status) and my statusbar (StatusBar). In my class, which
is actually in another class from my form I have the following:

public interface IStatusDisplay
{
string Status { get; set; }
string StatusBar { get; set; }
}

In my class (which is the form), I have:
*****************************************
public partial class FieldSetup : Form, IStatusDisplay

.....

#region IStatusDisplay Members

string IStatusDisplay.Status
{
get
{
return Status.Text;
}
set
{
Status.Text = value;
}
}

string IStatusDisplay.StatusBar
{
get
{
return toolStripStatusLabel1.Text;
}
set
{
toolStripStatusLabel1.Text = value;
}
}
********************************************

In my form code I pass: this. In my other classes, I use:

void function(IStatusDisplay display)
{
display.StatusBar = "This is a test";
}

This works fine, except it won't return until you return from the function
( I am not threading this, at this point).

But in the form itself, I can do a this.refresh - but how do I change my
code so I can do a refresh from my other classes?

Thanks,

Tom
Jul 23 '08 #1
5 2405
I figured it out.

I can just put this.refresh in the "set" portion of the property - or just
create a method in the interface called refresh() and in that method do a
this.refresh().

Tom
"tshad" <ts***@dslextreme.comwrote in message
news:uU****************@TK2MSFTNGP04.phx.gbl...
>I have an interface I am using to get access to some of the objects on my
form: a textbox (Status) and my statusbar (StatusBar). In my class, which
is actually in another class from my form I have the following:

public interface IStatusDisplay
{
string Status { get; set; }
string StatusBar { get; set; }
}

In my class (which is the form), I have:
*****************************************
public partial class FieldSetup : Form, IStatusDisplay

....

#region IStatusDisplay Members

string IStatusDisplay.Status
{
get
{
return Status.Text;
}
set
{
Status.Text = value;
}
}

string IStatusDisplay.StatusBar
{
get
{
return toolStripStatusLabel1.Text;
}
set
{
toolStripStatusLabel1.Text = value;
}
}
********************************************

In my form code I pass: this. In my other classes, I use:

void function(IStatusDisplay display)
{
display.StatusBar = "This is a test";
}

This works fine, except it won't return until you return from the function
( I am not threading this, at this point).

But in the form itself, I can do a this.refresh - but how do I change my
code so I can do a refresh from my other classes?

Thanks,

Tom

Jul 23 '08 #2
Well, it almost works.

I have the function set as:

*****************************************
public partial class FieldSetup : Form, IStatusDisplay

.....

#region IStatusDisplay Members

string IStatusDisplay.Status
{
get
{
return Status.Text;
}
set
{
Status.Text = value;
}
}

string IStatusDisplay.StatusBar
{
get
{
return toolStripStatusLabel1.Text;
}
set
{
toolStripStatusLabel1.Text = value;
this.Refresh();
}
}
********************************************

It works most of the time. But then it stops refreshing the screen - no
matter how many time it does:

display.StatusBar = "Now Processing... " + xmlFile;

Which does a this.Refresh() after setting the value.

Not sure why it quits working. I know it is doing it as I step through it
and see it hit the this.Refresh().

Tom
"tshad" <ts***@dslextreme.comwrote in message
news:uv**************@TK2MSFTNGP02.phx.gbl...
>I figured it out.

I can just put this.refresh in the "set" portion of the property - or just
create a method in the interface called refresh() and in that method do a
this.refresh().

Tom
"tshad" <ts***@dslextreme.comwrote in message
news:uU****************@TK2MSFTNGP04.phx.gbl...
>>I have an interface I am using to get access to some of the objects on my
form: a textbox (Status) and my statusbar (StatusBar). In my class, which
is actually in another class from my form I have the following:

public interface IStatusDisplay
{
string Status { get; set; }
string StatusBar { get; set; }
}

In my class (which is the form), I have:
*****************************************
public partial class FieldSetup : Form, IStatusDisplay

....

#region IStatusDisplay Members

string IStatusDisplay.Status
{
get
{
return Status.Text;
}
set
{
Status.Text = value;
}
}

string IStatusDisplay.StatusBar
{
get
{
return toolStripStatusLabel1.Text;
}
set
{
toolStripStatusLabel1.Text = value;
}
}
********************************************

In my form code I pass: this. In my other classes, I use:

void function(IStatusDisplay display)
{
display.StatusBar = "This is a test";
}

This works fine, except it won't return until you return from the
function ( I am not threading this, at this point).

But in the form itself, I can do a this.refresh - but how do I change my
code so I can do a refresh from my other classes?

Thanks,

Tom


Jul 23 '08 #3
On Wed, 23 Jul 2008 14:35:46 -0700, tshad <ts***@dslextreme.comwrote:
[...]
It works most of the time. But then it stops refreshing the screen - no
matter how many time it does:

display.StatusBar = "Now Processing... " + xmlFile;

Which does a this.Refresh() after setting the value.

Not sure why it quits working. I know it is doing it as I step through
it
and see it hit the this.Refresh().
I don't know why it's not working either. I didn't see enough code in
your posts to demonstrate what you're actually doing.

That said, if you need to call Refresh() to get your UI to redraw, then
your design is wrong anyway. You should just call Invalidate() and let
the repainting happen normally.

You say "I am not threading this, at this point". But rather than waste a
lot of time trying to figure out why Refresh() isn't doing what you
expect, you should spend that time getting the threading design to work so
that you don't need to call Refresh() at all.

Pete
Jul 23 '08 #4
On Wed, 23 Jul 2008 16:21:02 -0700, Peter Duniho wrote:
That said, if you need to call Refresh() to get your UI to redraw, then
your design is wrong anyway. You should just call Invalidate() and let
the repainting happen normally.
What is the difference?
Jul 24 '08 #5
On Thu, 24 Jul 2008 03:30:05 -0700, Ken Foskey
<rm**********@optushome.com.auwrote:
On Wed, 23 Jul 2008 16:21:02 -0700, Peter Duniho wrote:
>That said, if you need to call Refresh() to get your UI to redraw, then
your design is wrong anyway. You should just call Invalidate() and let
the repainting happen normally.

What is the difference?
Calling Refresh() forces the repainting to happen immediately. If doing
so is necessary, that means you've blocked your GUI thread somehow, which
is bad design. If doing so is not necessary, then obviously doing it
makes no sense. Let Windows work the way it was designed to.
Jul 24 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: JGH | last post by:
I want to create a web page that allows a user to run an oracle stored procedure. That's easy enough but the problem is that the procedure might take several seconds to complete. I don't want...
2
by: sys | last post by:
I have a Web service and I want it to implement an interface that I specified, say IService. So my Web service class looks like this public class Service1 : System.Web.Services.WebService, IServic...
5
by: Ajar | last post by:
Hi, I have a stand alone application which does some scientific computations. I want to provide a web interface for this app. The app is computationally intensive and may take long time for...
2
by: David | last post by:
hello... how can i use IActiveDesktop COM interface from shell32.dll? thanx...
11
by: Andy | last post by:
Make the story short, I have a VB.NET client interface calling .NET webservice, written in VB.NET as well. I am trying to make the client as thin as possible so I let the webservice part to...
0
by: Rick | last post by:
I use VB .Net and try to do som intensive actions on a database (in a seperate module). I defined an Interface for updating a progressbar on the main form. When I test it from a procedure within...
1
by: =?Utf-8?B?S2VuIEFkZW5pamk=?= | last post by:
I read, How can I update my user interface from a thread that did not create it? http://blogs.msdn.com/csharpfaq/archive/2004/03/17/91685.aspx I have a postback event handler, that requests user...
4
by: Zoubidoo | last post by:
Many applications require a high-speed interface such as supermarket checkouts, busy points of sale, doctors' surgeries etc. The problem with graphical interfaces is that they are too slow for...
0
by: DKn | last post by:
Hello All, Please have a look in to this link. http://msdn.microsoft.com/en-us/library/aa392091(VS.85).aspx In the above link , they are talking about Wbemperf.dll contains Refresh method....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.