|
Hi
I had a BHO through which I had to convert the web page content from English to other language (say Hindi). I am able to retrieve the web page content and replace it with other language text, but the problem is the original text visible to user for a fraction of second (which is < 1sec), I want the converted page should be directly visible to user. For this what can I do?
I had trying for this since longtime?
If there are any advises, please post it here, thanks...
|
|
|
|
|
Hello. I am new to C# (used Java originally), and I was wondering what would be the best way to handle file events in a console application. Specifically, I need to monitor a bunch of directories to see if new files are being added, and then do something with them if so. I guess I'm confused because I need to thread the watchers, but am unsure how/where to handle their corresponding events. I have been looking around for resources but am coming up on threading samples and event samples but not any combination of the two and so I don't know exactly where to start. If anybody has a suggestion or resource, I would greatly appreciate it!!
|
|
|
|
|
start by reading about "System.IO.FileSystemWatcher".
|
|
|
|
|
Thank you, that helped clarify some of the event concepts for me.
I guess I'm wondering now whether the filesystemwatcher acts as a thread... meaning does it listen indefinitely while the main program works until it hears something? Or does it have to be wrapped in a thread to do so?
|
|
|
|
|
I believe it works on its own thread, then invokes the events to the UI thread. If your GUI is going to stay responsive, you don't have to worry about threading at all. Just create it, set the needed properties (Path, NotifyFilter, Filter), turn on EnableRaisingEvents, hook the events you want, and handle them as needed. If I remember right, this is a port from the old VBScript library, so it's intended to be as easy to use as possible.
To make sure it works that way, you might want to just be sure that you're CREATING it on the UI thread. If you don't, it might invoke events to a different thread unless you set the SynchronizingObject property to a GUI control. You can also use that same property to invoke the events onto a thread of your choosing.
If you want finer control, you can skip the events entirely, create it on a dedicated background thread, and loop on the WaitForChanged method, which will block until it receives a notification. Most of the time, this is overkill.
There's more detail on each of those properties and methods in the MSDN help.
EDIT: Sorry, missed where you said it was a console application. In that case, you probably want to go with the last method I mentioned, looping on WaitForChanged to do everything synchronously.
modified on Wednesday, March 25, 2009 11:10 AM
|
|
|
|
|
hello.. i have an msaccess database in my c# project given the path as c:\my proj\db.mdb
and in my second project i reffered to the same database and when i change the db.mdb from its original location the visutal studio cant find the db and giving an error.... is if possible to change the path of the database after adding to the project...thanks...
|
|
|
|
|
Thats what app.config is for.
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
thanks... that was xtremly helpful...
|
|
|
|
|
Do I detect a hint of sarcasm here?
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
sorry if u have fealt like that but ur answer solved my problem.. cause i had googled it with long strings but colud not find any relavant answers....
|
|
|
|
|
No offence intended, its just that often if you just give someone a hint they can't be bothered to follow it up, they expect complete code samples. I'm pleased it helped, I generally only give an idea of the answer, as by finding out for yourself you learn. Obviously in your case it applied
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
Hi all!
I have a small project where I need to create a visual family tree editor. Before I start reinventing the wheel, I would like to know if there are any free or open source C# library which lets me do the following:
-add, select and remove elements (simple boxes with title is enough) with mouse and context menu
-connect and disconnect elements with mouse.
If I have this, I 'll be able to do the rest myself (attaching some data structure to the visual tree and storing the tree to a database).
Thanks for any ideas.
|
|
|
|
|
here[^] is one but in C++
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Oh, that is great, if only it was C#. Anyway, thanks, I'll see if I can port it to C#.
|
|
|
|
|
hi
i'm new at c# and i'm using visual studio c# 2008
i have a very large application which needs to take pictures from a webcam to work with them
i found this code (among many other which i haven't been able to get to work) http://www.c-sharpcorner.com/UploadFile/yougerthen/810262008070218AM/8.aspx[^]
notice there, in the extra code the author asks to add for the thing to work, it has already a initializeComponent() since its a form of sorts. BUT notice too that MY application is also a form and pretty much larger, so of course it has its own initializeComponent() with near 150 other componets; the webcam stuff must be in one of the tabs initialized there.
If i let the initializeComponent() be, the compiler says it does not exist in the actual context. i deleted the constructor altogether but then obviously not even the pictureBox appears. but then if i leave the constructor there, but remove the initializeComponent()... what should it had inside instead? the picture box and buttons are already taken care of in the bigger initializeComponent().
so how can i merge this code into mine so i can use the webcam features in there?
any ideas?
|
|
|
|
|
|
Hello,
i would dtetct a zip word on my sting, i have string s = myname.zip and i would return myname, i ty to:
string[] result = s.Split(new Char[] {"zip"},2);
but it does not work, help me, thank you verry mutch.
|
|
|
|
|
abbd wrote: new Char[] {"zip"}
"zip" is a string, not a char.
Secondly use '.'.
hmmm pie
|
|
|
|
|
but if i have for exemple myname_of_25.03.2009.zip, it not work i wold gest all myname_of_25.03.2009, thank you verry mutch
|
|
|
|
|
Then use the Remove function.
Thank you very much.
hmmm pie
|
|
|
|
|
can you give an exemple? thank you
|
|
|
|
|
|
you should not use split method as it causes to create string array object
if your requirement is only to return filname without extension the
use this
return new Path.GetFileNameWithoutExtension(s);
Happy Coding
Deep
|
|
|
|
|
thats the way I like but there is no need for new keyword
PS Good Answer BTW
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
oh thats rights!!!!!!!
thanks for comment........
I guess even no need of the "the" at the end of s econd line
thanks for comment again!!
|
|
|
|