|
I am currently using FileSystemWatcher to monitor one directory for new files.
Can i use it to monitor two directories?
How would that be coded? Because when an event occurs(like a new file), the Event handler is the same. Would i have to create another event handler that does the same thing?
|
|
|
|
|
You can have two FileSystemWatchers and one event associated with both of them
|
|
|
|
|
So i take it that Windows will handle event syncronization. Cause if a new file gets dropped in both directories at the same time, would one event handler still be able to handle?
|
|
|
|
|
It would.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi All,
I have to syncronise the system Date through c# code.
The scenerio is like whenever User sign In, I have to check the current system date,and compare with the date i have written in Registery, so that he can not use the appication beyond the trial period date.
The Problem is that the User can Manipulate his system date and can sign in n number of times.
If anyone have the code then Please help me out in my problem.
Thanx
Sandeep
|
|
|
|
|
Sychronize the system date/time with what?
|
|
|
|
|
In addition to the constraint you've applied, add another flag in the registry, which tells you if the product has expired or not. Initially, it should be false, but after the first time the user has used the product for more than X days, make it false. After this, even if the user manipulates the system time, the second condition will fail.
Possibly better way to do it:
I While installing, set lastUsedDate to the current date and usedDaysCount to 0 in the registry.
II Every subsequent execution
1. Compare current date with lastUsed date in registry.
2. If they are different
lastUsedDate = current date;
usedDaysCount++;
3. If usedDaysCount > 10
Display nag screen and exit
Else
Get on with the program.
Cheers,
Vıkram.
Déjà moo - The feeling that you've seen this bull before.
Join the CP group at NationStates. Password: byalmightybob
|
|
|
|
|
Is there a way to tell if an object, like a button, has been moved into a container like a group box or a panel. (this is the running app, not in the IDE)
The method of moving would be using the MouseMove event with the button object and I was looking to see if there was an easier way than to use the x,y of the object to see if something was in the container after dragging it.
"Details details. Things to do Things to get done. Don't bother me with details just tell me when they're done." James Price
|
|
|
|
|
Have you looked at the Parent property of the control? That should give you the container of the control.
|
|
|
|
|
When I look at the .Parent of the current moving control, it is still showing my form as the parent.
I am not implicitly setting a new parent but I would not be able to do that because i wouldnt know what to set it to and run into the same issue.
"Details details. Things to do Things to get done. Don't bother me with details just tell me when they're done." James Price
|
|
|
|
|
You set Parent by adding the control to the Controls collection of the parent. Parent will tell you if your control belongs to a different control's Controls collection.
|
|
|
|
|
But I would still have to know what the control was under neath the control I am dragging. I cannot use whats under my mouse because that would be what i was dragging.
Unless I am just missing the point you are making.
"Details details. Things to do Things to get done. Don't bother me with details just tell me when they're done." James Price
|
|
|
|
|
Of course. So, you are drawing on a surface (which requires a control), and you know what that surface is. If you detect/manage events applied to *that* surface, you are trapping the relevant events. So you have to build your class from Control, or one of its derivatives.
|
|
|
|
|
ahh, i see what you are saying.
Thanks, I will give that a try.
"Details details. Things to do Things to get done. Don't bother me with details just tell me when they're done." James Price
|
|
|
|
|
|
I have been looking for a portal framework in C#... It looks like the Rainbow portal has not been updated in quite a while. (Dotnetnuke looks good, but is vb.net)Is anybody aware of another alternative? It does not have to be an open source, but must have source code available.
Thanks for your help
|
|
|
|
|
|
I have a form where there is a button and i want to launch an another form by the help of that button which is done but when second form opens it doesnt close the first one as i did many tries.
Following is my code snippet
private void LoadGameButton_Click(object sender, EventArgs e)<br />
{<br />
TicTacToe tic=new TicTacToe();<br />
tic.Show();<br />
log = new Login();<br />
log.Close();
<br />
}
Please help
|
|
|
|
|
Hello,
shah123 wrote: log = new Login();
log.Close(); // or i tried hide and different ways here but still login form appear
this creates a new instance of o Form and closes it directly after creaton.
Just add:
this.Hide();
All the best,
Martin
|
|
|
|
|
Thanks a million. It worked.
|
|
|
|
|
You are wellcome!
I'm glad I could help!
|
|
|
|
|
hi the program i am using for remoting has an configuration file which stores the port number and etc..
RemotingConfiguration.Configure(Application.StartupPath + "\\Client.exe.config",false);
the above is the where the program initialized the remoting with the configuration file..
however i am now trying to change the ip of the server
does anyone know how to set the ip portion of the server programically in the client while the other configuration is set in the configuration file?
thx
|
|
|
|
|
Something like this
ChannelServices.RegisterChannel(new TcpClientChannel(), false);<br />
Activator.GetObject(typeof(NetTime.NetTime), "tcp://localhost:8086/Time") as NetTime.NetTime;<br />
led mike
|
|
|
|
|
Hi All,
In my 3 tier application, I have a business object called a "machine", which has various simple properties such as Name and Asset Number. It also has properties consisting of other objects such as List<meters>MeterReadings and Model ModelInfo
In order to construct the "machine" object, my BLL dials into the DAL (and thence the Database), which then returns a Machine. Subsequently, the BLL dials back into the DAL to fetch the list of Meters and then adds these to the Machine's MeterReadings property, and then the BLL dials into the DAL once more to fetch a Model object and applies this to the Machine's ModelInfo property.
In effect, what I have here is the "parent" Machine object being constructed in the DAL, whilst the BLL then manages the addition of the "child" objects.
I'm not 100%, but I think I'm going about this the wrong way, as it seems quite messy - and I can certainly see that a more complicated object (with more sub objects-as-properties) could become quite unwieldy and difficult to debug.
Could anyone recommend a better method of acheiving this? For example, would it be better to make each Business Object (in my case the parent "Machine") responsble for all of its sub-objects?
Cheers,
Martin.
|
|
|
|
|
It is difficult to convey how, over the years, you easily perceive the structure your application requires. But it's all by rules/observations. Strive to conceive of the structure you need to build by perceiving where the best place is for each thing it needs to do. In effect, objects or classes design themselves if you let the job dictate the object.
In the end, there is no such thing as a "bad" class, simply because the class involves many objects or properties. Neither is there a real metric you should follow -- how big should a class be, or what are too many instance methods or members for instance? The size of the best defined objects is predicated by doing the job the best way it can be done. A lot of your work then is refining classes. You see that you will benefit if you split your large object up into smaller objects; or you see that you accomplish an important goal better by incorporating a further method. Always however, the job dictates class design. Concentrate on doing the job(s) the best they can be done, and you will build the best classes.
|
|
|
|