Progress maximum value on XML serialisation

M

Manikandan

Hi,
I'm working with XML serialization.
I'm writing a xml file of huge size(above 500MB)
I need to show the user the progress of writing to file using progress
bar.
For this i need to create a thread and first start the thread and then
writing process, after writing to file stop the thread
My doubt is how to set the value for progress bar, some times file
size is 100MB and some other time 2GB like, I don't know how to set
the progress bar maximum value
Kindly help me to solve problem

Thanks & Regards,
Mani
 
Z

zacks

Hi,
I'm working with XML serialization.
I'm writing a xml file of huge size(above 500MB)
I need to show the user the progress of writing to file using progress
bar.
For this i need to create a thread and first start the thread and then
writing process, after writing to file stop the thread
My doubt is how to set the value for progress bar, some times file
size is 100MB and some other time 2GB like, I don't know how to set
the progress bar maximum value
Kindly help me to solve problem

Since the writing of an XML file with the XMLSerialization Serialize
method, I doubt if you could implement a progress bar showing the
progress of writing the file.
 
N

Nicholas Paldino [.NET/C# MVP]

Well, it would be kind of possible, but you would have to guess, at
best.

You can create a facade for the Stream that is being written to, passing
that to the XmlSerializer, which delegates calls to an underlying stream.
The facade would convey how many bytes were written to the underlying stream
through events, or some other mechanism.

However, it becomes moot, because you ultimately don't know the size of
the serialized instance until it is done. You could make a guess, but in
the end, that's all it is.

The best you can do is tell how many bytes were currently written.
 
M

Manikandan

Well, it would be kind of possible, but you would have to guess, at
best.

You can create a facade for the Stream that is being written to, passing
that to the XmlSerializer, which delegates calls to an underlying stream.
The facade would convey how many bytes were written to the underlying stream
through events, or some other mechanism.

However, it becomes moot, because you ultimately don't know the size of
the serialized instance until it is done. You could make a guess, but in
the end, that's all it is.

The best you can do is tell how many bytes were currently written.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)


Since the writing of an XML file with the XMLSerialization Serialize
method, I doubt if you could implement a progress bar showing the
progress of writing the file.

Hi,
How about showing a processing message in label using timer
Any idea of doing the processing text in label(procesing.....) with
timer

Thanks,
Mani
 
N

Nicholas Paldino [.NET/C# MVP]

The timer really doesn't do anything for you here, as your stream facade
would fire events when there is a write to the underlying stream you are
serializing to. You would only use a timer when you have to poll for the
event, which a facade eliminates the need for.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Manikandan said:
Well, it would be kind of possible, but you would have to guess, at
best.

You can create a facade for the Stream that is being written to,
passing
that to the XmlSerializer, which delegates calls to an underlying stream.
The facade would convey how many bytes were written to the underlying
stream
through events, or some other mechanism.

However, it becomes moot, because you ultimately don't know the size
of
the serialized instance until it is done. You could make a guess, but in
the end, that's all it is.

The best you can do is tell how many bytes were currently written.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)


Hi,
I'm working with XML serialization.
I'm writing a xml file of huge size(above 500MB)
I need to show the user the progress of writing to file using progress
bar.
For this i need to create a thread and first start the thread and then
writing process, after writing to file stop the thread
My doubt is how to set the value for progress bar, some times file
size is 100MB and some other time 2GB like, I don't know how to set
the progress bar maximum value
Kindly help me to solve problem
Since the writing of an XML file with the XMLSerialization Serialize
method, I doubt if you could implement a progress bar showing the
progress of writing the file.

Hi,
How about showing a processing message in label using timer
Any idea of doing the processing text in label(procesing.....) with
timer

Thanks,
Mani
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top