|
Hi
I have been busy getting my skills up with C# Windows development because I been working with ASP.NET for ways too long.
I have been looking into Remoting with C# , and I would like to know is there a way I can use Visual Studio's databinding tools with the development of a Remoting site.
As in a Server tier that contains the database , with a remote layer between that and multiple client applications ?
I have worked with Java RMI before So I am not that new to Remoting or CORBA.
Le Roux Viljoen
Web Developer
PCW New Media
South African Branch
www.pcwnewmedia.com
|
|
|
|
|
Chona1171 wrote: s there a way I can use Visual Studio's databinding tools with the development of a Remoting site.
A remoting site? What do you mean by "remoting site"?
And no, Visual Studio's databinding tools don't work with remoting at all. Instead, you use remoting to get data to and from the server, then you can bind to the resulting objects as necessary.
|
|
|
|
|
Sorry what I meant to say was a remote server application
Le Roux Viljoen
Web Developer
PCW New Media
South African Branch
www.pcwnewmedia.com
|
|
|
|
|
Ok. Given that you're going to be working with a .NET remoting server, what is your question?
|
|
|
|
|
I am trying to fetch some data from the net. I want to show the progress bar to show the percentage of download.
How can i effectively set the value of progress bar,according to the download
My small attempt...
|
|
|
|
|
Well, which bit do you need help with ? How are you doing the download ? Do you know how big the file is, and how much you've downloaded ? If so, it's trivial to set a progress bar. If not, it's not possible.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Actually i am try to do one web service.
My c# application will fetch a dataset with two tables from the server. I cant tell the size of the dataset.
i just want to see a progress bar to show the progress of this operation,like download in windows
My small attempt...
|
|
|
|
|
sujithkumarsl wrote: I cant tell the size of the dataset.
i just want to see a progress bar to show the progress of this operation,like download in windows
Windows knows the size of the downlaod. How can you tell someone how close they are to finishing, if you don't know the size ? You can do a progress bar that just moves back and forth, but not one that tells people how long it will take.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
yes. i know that.....
Actually i am getting the dataset as a return type by the webservice.....
Is there any relevent method to sortout my problem?
My small attempt...
|
|
|
|
|
No, again, if you're just getting a dataset, then there's no point writing the code to send it a bit at a time, so you can do proper progress, so just do a dummy one.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
hi,
i'm having a silly problem and i'm trying to describe it as simple as possible
i'm accessing a device which takes images. this device has a timeout property, which i have to set high (for some seconds). if a timeout occurs, it is "catched". after an image is taken, it is shown in my gui window.
so, i put the device accessing part in a thread which is getting the images and sending the images to the gui. in code it looks like this:
public delegate void newimg_handler(object sender, newimage_args e);
public class camerathread
{
public event newimg_handler newimg;
bool quitthread;
imageobject img;
public camerathread()
{
img = new imageobject();
quitthread = false;
OpenImageDevice();
}
public void exithread()
{
quitthread = true;
}
public void run()
{
while (!quitthread)
{
try
{
GetImage(out img);
if(newimg != null)
{
newimage_args nia = new newimage_args();
nia.img = img;
newimg(this, nia);
}
}
catch
{
}
}
}
}
public class newimage_args : EventArgs
{
public imageobject img;
public newimage_args()
{
}
}
and in the main form it's called like this:
public Form1()
{
...
ct = new camerathread();
ct.newimg += new newimg_handler(ct_newimg);
camerawork = new System.Threading.Thread(new System.Threading.ThreadStart(ct.run));
camerawork.Priority = System.Threading.ThreadPriority.AboveNormal;
camerawork.Start();
...
}
void ct_newimg(object sender, newimage_args e)
{
img = e.img;
display(img);
}
my BIG problem is, that the gui form is not responding while the thread is waiting for an image from the device (it can be many seconds, according to the timeout property). but why? i wrote the same application in c++ and everything is working fine (but c++ is at the moment not an option, the application has to be in c#.net). i also tried asynchron BeginInvoke calls on a method which is taking the images, but the same result. it looks like it's working sequentially, like i would use a timer for getting the images.
how can i make the thread completely independent working from the gui form, so i can also interact with the gui? i'm confused about the threading under .net. any hint is welcome. help
regards,
criss
|
|
|
|
|
Explain to us what makes you believe that you're starting a seperate thread ? All I see is a seperate class, which ,being on the same thread, would indeed lock the UI.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
hi christian,
in the forms constructor i'm having the following lines of code earlier listed, which should start my camerathread (the another/seperate thread) or am i wrong? and if this is not doing what i'm thinking it should do, how should it be?
ct = new camerathread();
ct.newimg += new newimg_handler(ct_newimg);
camerawork = new System.Threading.Thread(new System.Threading.ThreadStart(ct.run));
camerawork.Priority = System.Threading.ThreadPriority.AboveNormal;
camerawork.Start();
criss
|
|
|
|
|
OK, yes, that should work.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi,
it seems like you have a thread with a priority above normal (hence above the UI
thread) and with a "busy loop" (while !quitthread GetImage). It is not
apparent from the code shown that this loop ever relinquishes the CPU;
if it does not, there is a design error (not a language issue) and I would
suggest you add a Thread.Sleep(100) somewhere, possibly in the else of your
newimg test.
Hope this helps.
|
|
|
|
|
hi luc,
yes correct, but also if i'm not using the priority above normal, it's showing the busy gui. and on my side it's not safe to use a sleep in this infinite loop, because i'm waiting for trigger signals from the device and using the sleep could miss some signals.
i mean, i tried exactly the same in c++ without any sleep, with and without higher priority and it's working nicely. so what's the difference between c++'s and .net's threading?
criss
|
|
|
|
|
Hi Criss,
I know of no major difference between the threading model available in .NET and
the one in C++; they both are built on top of the Windows kernel capabilities.
The scheduler's behavior varies from one Windows version to the next;
the theoretical "highest ready process gets all, highest ready thread gets all"
is not followed, Microsoft has decided long time ago to reserve some CPU cycles
to the lower-priority ready processes/threads (but not enough to keep your
UI really responsive !). Nevertheless it is a bad idea to have a busy thread,
i.e. a thread that loops without explicitly relinquishing the CPU (as with a
Thread.Sleep or some semaphore wait or something).
So if you claim you have two implementations (C# and C++) that, running on the
same machine, behave quite differently, I am puzzled, that is the only
explanation I can offer is you have a bug somewhere.
I am worried about your "not missing some signals": you cannot prevent a Windows PC
from focusing on something else (networking, floppy/CD access, whatever).
To be safe, you should have full handshake (in my opinion that means the
"4 arrow" model) for all events you want to be sure to see. The only real
alternative is to have a real-time thread, which definitely is not supposed
to execute infinite loops...
BTW: what is the hardware interface and the comm protocol you are using ?
and what is the OS, and the .NET version ?
|
|
|
|
|
Krzysztof Gorgolewski wrote: and on my side it's not safe to use a sleep in this infinite loop, because i'm waiting for trigger signals from the device and using the sleep could miss some signals.
If the code would be so time critical, then it would not be possible to maintain a GUI at all while it's running, as the thread does not get any CPU cycles while the GUI is being updated.
Try to put a Thread.Sleep(0) in the loop to allow any CPU time at all to go to the GUI thread.
---
single minded; short sighted; long gone;
|
|
|
|
|
the blocking method is the "taking image" (GetImage) method. it's waiting till a signal is triggering the device DIRECTLY. for the device i can setup a "timeout" which i have to set to some seconds. so my problem is not the entire infinite busy loop, it's the GetImage method, which is not returning until it gets a trigger or a timeout occurs. because of this i put it in a seperate thread, to get the gui not blocked.
i'm also confused
btw: i'm using: winxp + .net 2 + usb connected camera device
criss
-- modified at 5:41 Monday 16th April, 2007
|
|
|
|
|
Then it depends on how the GetImage is implemented. If it doesn't allow other threads to run while it's waiting, it won't make any difference that it runs in a different thread than the GUI.
If I understand it correctly, the process scheduler can fully handle the time sharing between applications, but it depends on all the threads in an application to cooperate for the time sharing to work between the threads within the application.
---
single minded; short sighted; long gone;
|
|
|
|
|
hm... i see, so that means, there is a difference between the implementation for c++ and c#.net (which is an activex control) for this method/class. i think, i should directly contact the support for the device because it's not more looking as a .net problem, more like the implementation...
thanks guffa
criss
|
|
|
|
|
Hello,
I think you also have to invoke the display method, as you are getting the image instance from an other thread!
All the best,
Martin
|
|
|
|
|
hi martin,
worth to try, but i don't think so... the image is displayed correctly. just the "taking image" method causes the problem, it's waiting the whole "timeout" time for a signal (trigger) and if any occurs, then the image is coming. because of the waiting (and blocking the gui) i'm forced to use a thread.
criss
|
|
|
|
|
Hello,
Yes I know that this is not going to solfe your problem.
I just think if your thread is finished (and you display this image which you are getting from the thread) you will see the original image before you started the thread.
For your problem:
Mabe a Application.DoEvents() helps you.
All the best,
Martin
|
|
|
|
|
thanks to all i bothered with my problem. i could solve it by contacting the devices support... it really just depends on my GetImage method.
anyway. greetings
criss
|
|
|
|