I have a Static DataSet in a class file that I am using globally between a
few forms. The main form populates the dataset through a menu option which
invokes ReadXML in the class file to populate the DataSet. The ReadXML is a
rather lengthy operation with >5mb xml files (I am reading in the schema and
ignoreschema on read). This has presented several problems
1) What kind of progress bar can I show during load since I can't increment
while ReadXML is reading the xml file, do I have to override the base class
for read xml or is their a simpler way, the progress bar wouldn't have to be
exact?
2) I am thinking I need to start a seperate thread from the main form
calling the CreateDataSetFromXML in my class file. I don't know alot about
threading and right now the delegate works to call the createDataSet but
does not sync correctly to bind the datagrid on the main form. It basically
leads me to ask how can I struture serial operations within a thread. Also
how can I fire an event from a thread once a particular part (the ReadXML)
has finished, so I could, for instance, stop the progress bar.
3) I am fairly new to windows forms and am looking for a good tutorial on
how I can have a seperate form with a progress bar have the front focus and
recieve msg's from functions in other class/form files and put the
application into a "wait" state until the processing is finished so I
prevent "application not responding".
Anyways I know this is probably alot of info, and I can find alot of this on
the web but I need a really good functional overview, i.e. I feel like I
have a big puzzle , most of the pieces, but no finished picture to work
from. I'll post whatever samples from the code you would like to see. 5 2112
Hi James 1) What kind of progress bar can I show during load since I can't
increment while ReadXML is reading the xml file, do I have to override the base
class for read xml or is their a simpler way, the progress bar wouldn't have to
be exact?
Do you really have to indicate the exact progress? Even as this would be
the best maybe with just an animated icon or image is enough for the user to
understand the app is working and not hanged. think like the windows
explorer when you are copying files.
2) I am thinking I need to start a seperate thread from the main form calling the CreateDataSetFromXML in my class file. I don't know alot about threading and right now the delegate works to call the createDataSet but does not sync correctly to bind the datagrid on the main form. It
basically leads me to ask how can I struture serial operations within a thread. Also how can I fire an event from a thread once a particular part (the ReadXML) has finished, so I could, for instance, stop the progress bar.
You have to create a thread from where the dataset will be read from, I
assume that in your class where the dataset reside you will have a Load()
kind of method.
under this escenario I would do this:
1- Create a form like the "copying
3) I am fairly new to windows forms and am looking for a good tutorial on how I can have a seperate form with a progress bar have the front focus
and recieve msg's from functions in other class/form files and put the application into a "wait" state until the processing is finished so I prevent "application not responding".
Anyways I know this is probably alot of info, and I can find alot of this
on the web but I need a really good functional overview, i.e. I feel like I have a big puzzle , most of the pieces, but no finished picture to work from. I'll post whatever samples from the code you would like to see.
Sorry I think alot of your msg got cut off
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote
in message news:OS**************@TK2MSFTNGP09.phx.gbl... Hi James 1) What kind of progress bar can I show during load since I can't increment while ReadXML is reading the xml file, do I have to override the base class for read xml or is their a simpler way, the progress bar wouldn't have
to be exact? Do you really have to indicate the exact progress? Even as this would be the best maybe with just an animated icon or image is enough for the user
to understand the app is working and not hanged. think like the windows explorer when you are copying files.
2) I am thinking I need to start a seperate thread from the main form calling the CreateDataSetFromXML in my class file. I don't know alot
about threading and right now the delegate works to call the createDataSet but does not sync correctly to bind the datagrid on the main form. It basically leads me to ask how can I struture serial operations within a thread.
Also how can I fire an event from a thread once a particular part (the
ReadXML) has finished, so I could, for instance, stop the progress bar.
You have to create a thread from where the dataset will be read from, I assume that in your class where the dataset reside you will have a Load() kind of method. under this escenario I would do this: 1- Create a form like the "copying
3) I am fairly new to windows forms and am looking for a good tutorial
on how I can have a seperate form with a progress bar have the front focus and recieve msg's from functions in other class/form files and put the application into a "wait" state until the processing is finished so I prevent "application not responding".
Anyways I know this is probably alot of info, and I can find alot of
this on the web but I need a really good functional overview, i.e. I feel like I have a big puzzle , most of the pieces, but no finished picture to work from. I'll post whatever samples from the code you would like to see.
Hi James 1) What kind of progress bar can I show during load since I can't
increment while ReadXML is reading the xml file, do I have to override the base
class for read xml or is their a simpler way, the progress bar wouldn't have to
be exact?
I think that having a exact progress bar is too expensive here, unless that
it's 100% needed i would suggest you using some animation aka windows
explorer's copying files.
2) I am thinking I need to start a seperate thread from the main form calling the CreateDataSetFromXML in my class file. I don't know alot about threading and right now the delegate works to call the createDataSet but does not sync correctly to bind the datagrid on the main form. It
basically leads me to ask how can I struture serial operations within a thread. Also how can I fire an event from a thread once a particular part (the ReadXML) has finished, so I could, for instance, stop the progress bar.
a possible escenario is this, for sure you have a public static void Load()
method where your static dataset lives.
assumig that you create a new form with the animation and stuff, in the Load
method you create the new thread , this thread calls the Load method and
after that it should call a method to be executed in the main thread, you
do this by using Control.Invoke just before ends the thread. in this method
you can simply close the form.
I can send you code for this if you want
Cheers,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
Hi james,
sorry for that, a windows popup on my screen and I kind of confused some
keys combination and I sent the message without mean it.
Did you solve your problem?
Here is the code I'm using to do a similar thing, Please note that I removed
ALL but the 3 methods involved so the code will not compile !!!
cheers,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
public delegate void ProcessedFileHandler( );
Thread workingThread;
private System.Windows.Forms.ProgressBar progressBar1;
void Done()
{
MessageBox.Show("Done");
}
void ImportImage( )
{
foreach(string imageURL in files)
{
//Do my processing
}
//inform the UI that I'm done
this.progressBar1.Invoke( new ProcessedFileHandler( this.Done), null);
}
private void ImportImages_Load(object sender, System.EventArgs e)
{
this.workingThread = new Thread(new ThreadStart(this.ImportImage));
this.workingThread.Start();
}
"James Morton" <ja**********@hotmail.com> wrote in message
news:Oq**************@TK2MSFTNGP11.phx.gbl... Sorry I think alot of your msg got cut off "Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us>
wrote in message news:OS**************@TK2MSFTNGP09.phx.gbl... Hi James 1) What kind of progress bar can I show during load since I can't increment while ReadXML is reading the xml file, do I have to override the base class for read xml or is their a simpler way, the progress bar wouldn't have to be exact?
Do you really have to indicate the exact progress? Even as this would
be the best maybe with just an animated icon or image is enough for the
user to understand the app is working and not hanged. think like the windows explorer when you are copying files.
2) I am thinking I need to start a seperate thread from the main form calling the CreateDataSetFromXML in my class file. I don't know alot about threading and right now the delegate works to call the createDataSet
but does not sync correctly to bind the datagrid on the main form. It basically leads me to ask how can I struture serial operations within a thread. Also how can I fire an event from a thread once a particular part (the ReadXML) has finished, so I could, for instance, stop the progress bar.
You have to create a thread from where the dataset will be read from, I assume that in your class where the dataset reside you will have a
Load() kind of method. under this escenario I would do this: 1- Create a form like the "copying
3) I am fairly new to windows forms and am looking for a good tutorial on how I can have a seperate form with a progress bar have the front
focus and recieve msg's from functions in other class/form files and put the application into a "wait" state until the processing is finished so I prevent "application not responding".
Anyways I know this is probably alot of info, and I can find alot of this on the web but I need a really good functional overview, i.e. I feel like
I have a big puzzle , most of the pieces, but no finished picture to
work from. I'll post whatever samples from the code you would like to see.
Yep that does help I have been reading up on Control.Invoke and getting a
better understanding of how delegates and threads work together. i probably
won't have 100% efficient code the first go but will post it all her so
everyone can analyze it.
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote
in message news:uq**************@TK2MSFTNGP11.phx.gbl... Hi james,
sorry for that, a windows popup on my screen and I kind of confused some keys combination and I sent the message without mean it.
Did you solve your problem?
Here is the code I'm using to do a similar thing, Please note that I
removed ALL but the 3 methods involved so the code will not compile !!!
cheers,
-- Ignacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation
public delegate void ProcessedFileHandler( ); Thread workingThread;
private System.Windows.Forms.ProgressBar progressBar1;
void Done() { MessageBox.Show("Done"); }
void ImportImage( ) { foreach(string imageURL in files) { //Do my processing } //inform the UI that I'm done this.progressBar1.Invoke( new ProcessedFileHandler( this.Done), null); }
private void ImportImages_Load(object sender, System.EventArgs e) { this.workingThread = new Thread(new ThreadStart(this.ImportImage)); this.workingThread.Start(); }
"James Morton" <ja**********@hotmail.com> wrote in message news:Oq**************@TK2MSFTNGP11.phx.gbl... Sorry I think alot of your msg got cut off "Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote in message news:OS**************@TK2MSFTNGP09.phx.gbl... Hi James > 1) What kind of progress bar can I show during load since I can't increment > while ReadXML is reading the xml file, do I have to override the
base class > for read xml or is their a simpler way, the progress bar wouldn't
have to be > exact?
Do you really have to indicate the exact progress? Even as this would be the best maybe with just an animated icon or image is enough for the user to understand the app is working and not hanged. think like the windows explorer when you are copying files.
> 2) I am thinking I need to start a seperate thread from the main
form > calling the CreateDataSetFromXML in my class file. I don't know alot about > threading and right now the delegate works to call the createDataSet but > does not sync correctly to bind the datagrid on the main form. It basically > leads me to ask how can I struture serial operations within a
thread. Also > how can I fire an event from a thread once a particular part (the ReadXML) > has finished, so I could, for instance, stop the progress bar.
You have to create a thread from where the dataset will be read from,
I assume that in your class where the dataset reside you will have a Load() kind of method. under this escenario I would do this: 1- Create a form like the "copying
> 3) I am fairly new to windows forms and am looking for a good
tutorial on > how I can have a seperate form with a progress bar have the front focus and > recieve msg's from functions in other class/form files and put the > application into a "wait" state until the processing is finished so
I > prevent "application not responding". > > Anyways I know this is probably alot of info, and I can find alot of this on > the web but I need a really good functional overview, i.e. I feel
like I > have a big puzzle , most of the pieces, but no finished picture to work > from. I'll post whatever samples from the code you would like to
see. > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Jon Skeet [C# MVP] |
last post by:
Please excuse the cross-post - I'm pretty sure I've had interest in the
article on all the groups this is posted to.
I've finally managed to finish my article on multi-threading - at least
for...
|
by: Frank Rizzo |
last post by:
Hello,
I have a class with all static methods that is called by multiple
threads. I was wondering what effect that has on the competing threads.
Does Thread2 have to wait until Thread1 is done...
|
by: Keith Mills |
last post by:
Hello, please find attached a basic outline of what I am attempting to
accomplish... basically I want to create a number of THREADS (which I can do
fine), but I then need a method for them to be...
|
by: hzgt9b |
last post by:
Using VS 2003, .NET:
I developed a windows application that performs several actions based on an
input file. The application displays a progress bar as each action executes.
Based on new...
|
by: Miro |
last post by:
I will try my best to ask this question correctly. I think in the end the
code will make more sence of what I am trying to accomplish. I am just not
sure of what to search for on the net.
I...
|
by: smimon |
last post by:
Hi
I'm trying to run a DTS package from a ASP.NET web page using System.Diagnostics.Process. This DTS takes up to 10 minutes to complete, during which, output is generated which i would like to...
|
by: Mike P |
last post by:
I am trying to write my first program using threading..basically I am
moving messages from an Outlook inbox and want to show the user where
the process is up to without having to wait until it has...
|
by: Lothar Behrens |
last post by:
Hi,
I am thinking about using classes to encapsulate threads for my
application.
My requirements are the following:
The thread implementation sould not know what has to be implemented in...
|
by: CCLeasing |
last post by:
For an application I'm creating I want to create a 'fake' progress
bar.
By fake I mean a progress bar that looks like it's doing something but
actually isn't.
I know philosophically this isn't...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
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,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
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...
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
| |