|
This isn't the only thing that needs to be done, though. Yes, you could use a FileSystemWatcher to watch the .config file for changes, but once an AppDomain has been created and the config file read, it won't get read again (it's cached). Instead, you have to have a separate process (or use the same process, which must start your main app in a separate AppDomain ) that watches for changes, notifies your app to quit (or have your main app watch for changes, and the loader restart it when the app exits with a certain exit code). It creates the AppDomain with your custom AppDomainSetup for the AppDomain.SetupInformation , launches your process using AppDomain.ExecuteAssembly , and, thus, respawns your process.
I have covered this in more depth before. Please search the forum comments for keywords like AppDomainSetup for more information.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Is it a bug of a feature that AcceptButton only seems to work with Form.ShowDialog() and not with Form.Show()? That is, when a form is displayed with Show(), the Enter key is ignored, but with ShowDialog(), the Enter key causes the form to be accepted (OK).
Arun
|
|
|
|
|
Hmm... would that be because the modal nature of a dialog box? It seems logical to me that a modal dialog could be dismissed with an accept button, but not necessarily a modeless form.
|
|
|
|
|
I think that it has to do with the ShowDialog [^] form being modal, and that Show [^] is inherited from Control [^], which only makes the Form visible. When it's modal, it's usually a form in which the user has to give some input, and press Enter to accept (or Esc to cancel).
- Daniël Pelsmaeker
There are 10 kinds of people in the world. Those that understand binary and those that do not.
|
|
|
|
|
I have a worker thread that is implementing a TcpListener socket. The Thread is blocking on the AcceptSocket method of TcpListener, which is fine. My problem is closing the blocked thread. I'm using:
Thread.Abort() and Thread.Join() to attemp to stop the thread and wait for it's termination but it apears that the Abort method does not throw the ThreadAbortException that it is supposed to. Any thoughts ?
|
|
|
|
|
Take a look at this.
Basically, all bets are off on aborting threads using certain system resources, like sockets. That's probably why it's not working, but I'm not sure of the best solution for you (would need some more info I think).
I, for one, do not think the problem was that the band was down. I think that the problem may have been that there was a Stonehenge monument on the stage that was in danger of being crushed by a dwarf.
-David St. Hubbins
|
|
|
|
|
Hello all, I am writing a windows service that I plan to run in a machine that has the .net framework but without the .net ide. I am curious as to how i will go about installing the service if i can not access the visual studio .net command prompt? Any help would be appreciated...
Frank
|
|
|
|
|
All tools for installing .NET services are in the .NET Framework. InstallUtil.exe is the one you want. located in:
%WINDIR%\Microsoft.NET\Framework\%version%\InstallUtil.exe
Jonathan 'nonny' Newman
blog.nonny.com [^]
|
|
|
|
|
Besides what Johnny said, you'll also need to implement an Installer class that uses the ServiceInstaller and the ServiceProcessInstaller . If you use the VS.NET designer to create this, they should already be there. Just tweak the properties to get what you want (like a display name and under which credentials to run it). If you didn't use VS.NET to create this (using the Add->Windows Service method), you'll need to create these yourself, but it isn't hard. See the documentation for these two classes for examples.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
I like to serialize user entries to an xml-file. Therefore i ceated a xml-serializable class.
Cause I have to deal with more than one user I have to store different user entries.
Therefore I want to "collect" all user's entries in the same xml-file.
Then that i can navigate through my single xml-file and fetch all informations applying to the current user.
I haven't found an answer yet. Is it possible at all? Or have i to serialize "manually", meaning append nodes and elements by the xml-document-methods to the xml-file?
I hope i could figure out my problem understandingly.
|
|
|
|
|
Serialize to a MemoryStream , then get the child nodes of the document element and append them to the document element of your existing file.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
I've been all over the MSDN library looking for a list of all the available built-in attributes and what thay do. I found a bunch of stuff about what they are and how to make my own but very little about the pre-defined ones.
Anybody know where to look?
Thanks,
Ken Galer
Electrical Engineer
Preferred Utilities Corp.
Danbury, CT 06810
|
|
|
|
|
Look at the documentation for the System.Attribute class. It has a Derived Classes link that gives all the direct derivitives, which you can then recurse into and find their derivitives, and so on.
As far as component development goes, a lot of useful attributes (probably the majority of the attributes you would use when creating a control library) are in the System.ComponentModel namespace.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Found it! Thank you.
In fact, I was there at one time and didn't reconize it.
Ken
Ken Galer
Electrical Engineer
Preferred Utilities Corp.
Danbury, CT 06810
|
|
|
|
|
First of all, hi to everybody, it´s my first post And sorry for my english I am from Spain.
Well I am making a little app that write questions with their answers into an xml file. I am using a treeview to display the data.
The question is the top node, and in it there are subnodes each for an answer.
I know how to see which node was selected with this code:
<br />
if(this.IsNode(tree.GetNodeAt(this.tree.PointToClient(Cursor.Position)))==true)<br />
Where IsNode is:
<br />
private bool IsNode(TreeNode node)<br />
{<br />
try<br />
{<br />
string foo = node.Text;<br />
return true;<br />
}<br />
catch<br />
{<br />
return false;<br />
}<br />
}<br />
My question is:
How can I see if an subnode is selected or an node? I want to show an menu for answers and another for question.
Thanks a lot
|
|
|
|
|
You are doing it the hard way.
There is an easier way to get what you want, by using the TreeView.SelectedNode [^] property. This property returns the currently selected TreeNode , or null if no node is selected.
Now you can test whether the returned TreeNode is a subnode. Remember that a root node doesn't have a Parent node, so we test that:
public bool IsSubnodeSelected()
{
TreeNode selected = MyTreeView.SelectedNode;
if (selected != null)
{
if (selected.Parent != null)
return true;
}
return false;
}
The above method would return true if a subnode is selected, and false when a rootnode or no node is selected.
- Daniël Pelsmaeker
|
|
|
|
|
Thanks a lot, it works but SelectedNode doesn´t work with right click so I use:
<br />
private bool IsSubNode()<br />
{<br />
TreeNode selected =treeview.GetNodeAt(this.treeview.PointToClient(Cursor.Position));<br />
if (selected != null) <br />
{<br />
if (selected.Parent != null)<br />
return true;<br />
}<br />
return false;<br />
}<br />
GetNoteAt with Current Mouse Position works with right click, now subnode works, and I can follow with my little app, thank you
|
|
|
|
|
hi i need any function helping me to create new dial-up connection on pc
|
|
|
|
|
Do you mean a new connection that they can choose from the auto-dial screen, or just a connection to their ISP? For the latter, see the WinINet[^] documentation.
For the former, this really seems to be platform-dependent, i.e. Windows XP works a little differently from Win2K, which works a lot differently from Windows OS's like 98 and ME. If you use the information above, specify functions like InternetAutodial , the user could create their own connection. If you need to create it for them (like some ISP do with their auto-configuration), I think you can do this with .cnf files.
One more way is to use the function InternetDial , which allows you to specify a connection name, flags, and a number to dial. This way, at least, you could get them to dial a particular server. An HWND the parent window (Form.Handle , inherited from Control.Handle ) is required for the prompt dialog. This is supported in all Windows platforms that support .NET.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
hello,
how can I send parameters to a designed page ( smart doc )?
thanx
anat
|
|
|
|
|
Hello,
I want to create an option dialog like Microsoft visual C# .Net option dialog
which consists of a tree in left panel and a by clicking on its node
left panel changes.
Is there any template or sample code that I can use it.
Thanks & Regards
Saeideh
|
|
|
|
|
I would create a form, then put a TreeView on it. Set it's Dock property to Left . Then create multiple Panel objects with different names (or create them in your form code in an array). Then, when a specific TreeNode is selected (check in the Click event), you show a specific Panel, and hide the others. You may want to set the Panel 's Dock property to Full .
- Daniël Pelsmaeker
|
|
|
|
|
You should also try searching CP for option dialogs. There are several examples that work the way you want.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Hi Guys!
we know that there is a way to handle custom exceptions in
asp dot net by specify the error page.
is there any way to do the same in csharp windows form.
i.e custom windows form.
i don't want to write try/catch block in my programm
in all places.i just want to write it once where it can handle all the program exception. is there a way.
Ali Khan
|
|
|
|
|
Legend Never Dies wrote:
is there any way to do the same in csharp windows form.
No. You can't get exceptions without try/catch,I think the best you can do is use try/catch and popup your custom error form in catch part.
Mazy
No sig. available now.
|
|
|
|