|
Hi,
you seem to reuse the same crlfProcess object for all files; I dont think this is OK,
especially since Process.Start() does not wait for the process to terminate, so you
would end up with one process object representing a bunch of processes...
|
|
|
|
|
Luc Pattyn wrote: you seem to reuse the same crlfProcess object for all files; I dont think this is OK,
especially since Process.Start() does not wait for the process to terminate, so you
would end up with one process object representing a bunch of processes...
If I use crlfProcess.WaitForExit() it will wait for the process to end before moving onto the next item, no?
|
|
|
|
|
Hi,
yes, but even then I am not sure you can simply reuse the process object for another process without taking special precautions.
For one there is a Process.Dispose() method; furthermore have a look at
Process.Refresh() which indicates things get cached...
Did you ever try with one Process object per file ?
|
|
|
|
|
Hello everyone,
I am working on an Windows Application which runs process that may take sometimes for it to be completed such as connecting to a remote DataBase server.
I wish to keep the user informed when they are communicating with the remote server. I have realised if I use a TextBox to tell the user what is happening it works fine but when I write the same text in toolStripStatusLabel the the text is NOT displayed till the process is finished. The same thing happens when I use a ProgressBar to show there are things happening and the user needs to wait for the complition of the process.
Can someone tell me how I can solve this problem?
Thank you very much and have a great day.
Khoramdin
|
|
|
|
|
You should use multithreading. Have a look at BackGroundWorker component, MSDN has got quite a good and useful example
|
|
|
|
|
You'll need to use theading for this, perhaps the easiest would be it you look a look at the BackgroundWorker component. This allows you to start the database connection off in a background thread and then you can immediately move onto updated the toolstrip etc. The component also has the capability to notify the parent thread of it's progress so that you can maintain a view of this for the user.
|
|
|
|
|
In your method that updates the progress bar add Application.DoEvents(); to force a redraw of the control. I had that same problem before and considered multithreading, but just adding that worked just fine.
|
|
|
|
|
I have an existing console application that I want to extend with an optional GUI front end. I would like for this to all exist in a single executable rather than writing two separate versions (a console app and a windows app). If the user runs the executable normally, I want the application to run in a command window. If the user runs the executable with a specific parameter, say:
program.exe -visual
I want the program to run at the command line, but open a windows form where it spits out various output (different output than that going to stdout, so I'm not looking for a redirect solution).
My first instinct was to have the console application start up the GUI and then update a textbox via a delegate function. Of course, for the GUI to update itself, and for the console app to continue its work, the GUI would need to be in its own thread.
What is the best way of going about this? Should the console app spawn a thread which then calls Application.Run(...)? What then is the best way for the console app to send data over for the GUI to display?
I'm open to all suggestions. Thanks.
|
|
|
|
|
You can simply add forms to a console program, if you detect the -visual argument you can simply call Application.Run rather than processing the command line.
|
|
|
|
|
Create a common data class, have it implement INotifyPropertyChanged and code the GUI (and possibly the Console class) to handle the event.
At least thats how I'd do it.
------------------------------------------------
I'm largely language agnostic -
After a while they all bug me
------------------------------------------------
|
|
|
|
|
Thanks for the suggestions. I got more suggestions elsewhere, some similar, some different. I will process them all now
|
|
|
|
|
hi ...
i want to encrypt content of my page and then send by socket to my friend
and then he decrypt it (by a program) in the other client
until now i can encrypt the content but i don't know how can encrypt ...
my algorithm to encrypt in simple . i just 1 to each byte as follow :
sBuffer = sBuffer + sHttpVersion + sStatusCode + "\r\n";
sBuffer = sBuffer + "Server: cx1193719-b\r\n";
sBuffer = sBuffer + "Content-Type: " + sMIMEHeader + "\r\n";
sBuffer = sBuffer + "Accept-Ranges: bytes\r\n";
sBuffer = sBuffer + "Content-Length: " + iTotBytes + "\r\n\r\n";
Byte[] bSendData = Encoding.ASCII.GetBytes(sBuffer);
//encrypt content ...
for (int i = 0; i < bSendData.Length; i++)
{
bSendData[i] += 1;
}
SendToBrowser(bSendData, ref mySocket);
|
|
|
|
|
Unless you write a specialised plugin or browser you're friend won't be able to decrypt this in IE or Firefox by default. You'll have to write your own "browser".
BTW what's the problem with using HTTPS, performs the same function?
|
|
|
|
|
hi
i was looking for a c# code that uses tapi3
to control the status(specially when connected and disconnected) of a call
and also that detects the numbers that the caller pressed on the handset
befor making the call.if any one have such sample code please send me .
i relly need it.
thank u.
thanks
|
|
|
|
|
hi
i need a dataGridView footer source Code that study about how to implement and draw footer at bottom of Standard DatagridView, thanks
|
|
|
|
|
It's already there. RTFM
only two letters away from being an asset
|
|
|
|
|
Hi,
I'm trying to move a control while clicking on it. it works but very bad!
When i click the control down (panel), and start moving it, it is continuosly swaping between two position and i cant find a reason for that behaviour.
This is my code (only the event handlers):
<br />
private void panel_MouseDown(object sender, MouseEventArgs e)<br />
{<br />
Console.WriteLine("mouse down");<br />
Panel region = (Panel)sender;<br />
<br />
drag = true;<br />
}<br />
<br />
private void panel_MouseUp(object sender, MouseEventArgs e)<br />
{<br />
Console.WriteLine("mouse up");<br />
drag = false;<br />
}<br />
<br />
private void panel_MouseMove(object sender, MouseEventArgs e)<br />
{<br />
if (drag)<br />
{<br />
this.SuspendLayout();<br />
Panel region = (Panel)sender;<br />
<br />
region.Location = new Point(e.X, e.Y);<br />
<br />
Console.WriteLine("Panel position: (" + region.Left + "," + region.Top + ")" + "mouse position: (" + e.X + "," + e.Y + ")");<br />
this.ResumeLayout();<br />
}<br />
}<br />
Someone has given me an answer to this problem using user32.dll but i want to have more control of the thing.
Can anyone help me?
Thx
Nuno
|
|
|
|
|
Hello,
At the MouseDown you have to store the starting point:
_startDragPoint = new Point(e.X, e.Y);
At the MouseMove I suggest you to use a timer which only changes the Location every 100ms.
And add this logic:
if(TimerMovePad == null)
{
this.TimerMovePad = new System.Timers.Timer();
this.TimerMovePad.Interval = 100;
this.TimerMovePad.Elapsed +=new System.Timers.ElapsedEventHandler(TimerMovePad_Elapsed);
}
if (TimerMovePad.Enabled == false)
{
TimerMovePad.Enabled = true;
}
if(_movementok == true)
{
_movementok = false;
int delta_x = e.X - _startDragPoint.X;
int delta_y = e.Y - _startDragPoint.Y;
region.Location = new Point((region.Location.X + delta_x), (region.Location.Y + delta_y));
}
At the timer Elapsed, you then set the flag.
private void TimerMovePad_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
TimerMovePad.Enabled = false;
_movementok = true;
}
Hope it helps!
All the best,
Martin
|
|
|
|
|
Hi Martin,
While i was waiting for an answer i kept trying.
I got it! And it was pretty simple!
New code:
<br />
private void panel_MouseDown(object sender, MouseEventArgs e)<br />
{<br />
Panel region = (Panel)sender;<br />
<br />
xi = e.X;<br />
yi = e.Y;<br />
<br />
drag = true;<br />
}<br />
<br />
private void panel_MouseUp(object sender, MouseEventArgs e)<br />
{<br />
drag = false;<br />
}<br />
<br />
private void panel_MouseMove(object sender, MouseEventArgs e)<br />
{<br />
if (drag)<br />
{<br />
Panel region = (Panel)sender;<br />
<br />
region.Location = new Point((region.Left + (e.X - xi)), (region.Top + (e.Y - yi)));<br />
}<br />
}<br />
Basicly i think the problem is the diference between the coordinate system from the mouse and control
Other thing i dont understand is how does suspend/resume layout works as they weren't doing a thing.
Thx anyway,
Nuno
|
|
|
|
|
Use the Capture property of the control. That makes the control capture all mouse movement, even if you manage move the mouse fast enough to slip outside of the control:
private Point start;
private void movable_MouseDown(object sender, MouseEventArgs e) {
Control c = (Control)sender;
start = c.PointToScreen(e.Location);
c.Capture = true;
}
private void movable_MouseUp(object sender, MouseEventArgs e) {
Control c = (Control)sender;
c.Capture = false;
}
private void movable_MouseMove(object sender, MouseEventArgs e) {
Control c = (Control)sender;
if (c.Capture) {
Point mouse = c.PointToScreen(e.Location);
c.Left += mouse.X - start.X;
c.Top += mouse.Y - start.Y;
start = mouse;
}
}
Note: As this code uses the sender argument to reference the control, the code can be reused for the events of several controls that you want to be able to move.
sinosoidal wrote: Other thing i dont understand is how does suspend/resume layout works as they weren't doing a thing.
It's used for more complex controls, for example when you want to add a lot of items to a list without having the list redraw itself for every item.
---
single minded; short sighted; long gone;
|
|
|
|
|
Hi all,
If anybody could tell me that how to select text area or image on the viewer control(miDocView) of MODI using TextSelection property and ImageSelection property in c# .NET.
If you know,please let me know as soon as possible.
Thanks in advance.
|
|
|
|
|
Please let me know what should go in the second loop below.
Thanks
List<list<forward>> ForwardCurves = new List<list<forward>>();
foreach (List<forward> forwardCurve in ForwardCurves)
{
//another loop to go through the next collection...?
//????
foreach(List<forward> f in forwardCurve)
{
}
}
|
|
|
|
|
i don't understand what you are trying to do here.
Do you want to have a List of Lists of List?
put code in the second loop that does whatever you want done to each of the lists in fowardcurve.
Maybe if you explain what you are trying to do I can help more.
HTH
Russ
|
|
|
|
|
yes, to put code in the second loop that does whatever you want done to each of the lists in fowardcurve.
Thanks
|
|
|
|
|
Hello
I am writing a file. The text of file is not in English, but it can be in chinese, arabic, spanish etc language. Currently i am testing for chinese language. But when the file is written, i can not find the exact text i have written. I mean after writing the file, when i open the file, it dowsn't display me the original text i have sent to be written. I think there is some problem in writing that file. Can someone tell me how can i write a file in any other language other than english???
Regards
sAqIb
"Our scientific power has outrun our spiritual power. We have guided missiles and misguided men."
Dr. Martin Luther King Jr.
|
|
|
|