|
Thank you for all of your replies.
But could you give me a full example simply show me that how to use "Mutex". Is it the traditional way to do?
Thank you
|
|
|
|
|
Kentamanos already did above. You acquire a Mutex with the first instance and the second instance (or more) can't acquire it so you exit the application:
string mutexName = "some unique string";
bool acquired;
new Mutex(true, mutexName, out acquired);
if (acquired)
{
Application.Run(new MainForm());
}
else
{
Application.Exit();
} Optionally, if you don't acquire the Mutex , you can grab the command line parameters (like a filename) and force the existing process to open a new document (or set focus to the existing document). There are plenty of examples of this here on CodeProject and on the 'net.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
What do you mean?
Kentamanos has posted it.
Thank You
Bo Hunter
|
|
|
|
|
i am a beginner really and i thaught i had the right program and i want to know if the c# builder tool was free and if it it is free if some1 could email it to me
|
|
|
|
|
Go here. This is the free .NET Framework SDK, which includes a command line C# compiler. Take a look at the C# samples.
A good place to start with C# is the Quick Start Tutorials.
If you want a free C# IDE (Integrated Development Environment), I've heard good things about Sharp Develop.
You should definitely read a lot of stuff on MSDN.
You should probably pick up a book on C#. If you're new to programming, learn to walk before you run. I'd start with "console applications", and not worry about form based applications or Web applications yet. Don't expect to write a "killer app" from the starting blocks. Start simple...
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
|
|
|
|
|
|
Thanks.
Mazy
No sig. available now.
|
|
|
|
|
i cannot get OpenPGP can because it is a missing file some1 email it 2 me
|
|
|
|
|
...and this has to do with C# because?
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
|
|
|
|
|
|
OpenPGP is NOT a C# program! It's a C/C++ program. Understand the difference. If you're having problems with OpenPGP, then see http://www.openpgp.org[^]! This is NOT a C# question and does not belong here. Try the C/C++ forum but search the product web site first that I gave you - finding answers to product-specific questions should obviously lead you to the product's web site.
-----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'm trying to develop an XML Webservice for work that uses SOAP. It's very easy to get something going quickly, but It's a bit tougher to get it exactly like you want .
My current concern is the WSDL that's automatically generated with the "?WSDL" query string is very unstrict (can't blame it, it's not psychic). For instance, every parameter to a method that can be null ends up having its "minOccurs" set to 0. I'd also really like to be able to use some regular expression restrictions for certain types. I'm a big believer in schema validation (which I realize I have to do by hand regardless of what the WSDL says), and I'd like the WSDL to be more strict.
I've searched for quite a while, and I'm not having much luck finding anything. There seems to be a lot of attributes I can use to control the XML serialization of classes, but I haven't seen anything yet that lets me do something like "represent this class with this XmlSchema instance", which might be how I would get my service to create a "good" schema (guessing here).
Should I just give up on making the automatically generated WSDL look good and just write my own WSDL file by hand (and point clients there). It seems like that route would be more of a pain in the butt to maintain, but if that's the only way to make me happy I might go that route. Is there any way I can turn off the automatic WSDL generation (?WSDL querystring on the .asmx) if I go that route?
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
|
|
|
|
|
Hmmm...looks like I might be able to implement IXmlSerializable and have it return the exact schema. I'm going to check that out...
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
|
|
|
|
|
Well just in case someone's following my rambling...
I hate when I figure something out minutes after I posted .
I spent the most of the day going down the wrong path with all the attributes available for classes that control how XML serialization works. It would appear that at the end of the day, you're better off just going ahead and implementing IXmlSerializable yourself and saving yourself a lot of headaches.
I now need to make sure the proxy generators handle this type of WSDL properly (I doubt classes will enforce restrictions, but at least I'm putting it out there as a "contract" for clients). If the proxy generators (one in IDE and WSDL.exe if nothing else) handle this properly, then I should be set.
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
|
|
|
|
|
There's a ton of attributes you can use to control a lot of this, although I'm not sure about the regex, and don't remember ever seeing anything like this - but you shouldn't rely stricly on WSDL schema validation since some clients may not do that. Always check params going into your code, so you ultimately control what goes in and out of your methods!
First, there's the attributes in the System.Xml.Serialization namespace, like the XmlRootAttribute and XmlElementAttribute that have an IsNullable property you can set to false . There's also many advanced usage attributes in System.Web.Services.Protocols that let you control the input and output of SOAP and help in the documentation generation for the WSDL, such as using different readers and writers for the generation using the HttpMethodAttribute .
You should use these when you can because it ultimately gives you more control over SOAP and WSDL, and IXmlSerialization is not supposed to be used from your code which means it could change at any time without notice (but I must confess I've used it a few times here and there! ).
-----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 know that the web services don't do any sort of validation, and that I'll have to create a handler to do the validation in any event. I just want WSDL that makes sense and is tight as possible, but I'm starting to think that getting it as tight as I would like will be impossible (I'm a big fan of very explicit "contracts").
Implementing IXmlSerializable made the proxy generator (IDE and WSDL.exe) fail to generate anything for data types I tried to define myself. That means we'd have to give them assemblies for those classes or they'd have to write their own class. So I think going the attributes route is definitely the way to go again, and I'll just have to not expect too much from the WSDL . I actually didn't even notice the IXmlSerializable interface was not supposed to be used. I saw the suggestion in a post (and if I remember correctly it was from a MS VIP or a MS employee). You're right though, it shouldn't really be used.
I missed that IsNullable property. A co-worker claims to have used that and still gets a "minOccurs=0", but I'll check that out in any case.
Thanks for the help!
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
|
|
|
|
|
I've spent a week on making COM+ ManagementTool displaying COM+ Catalog Infomation using COMAdminCatalogCollection. Most of infomation I'd like to
find was in COMAdminCatalogCollection.
But I couldn't find a way of retrieving imfomation of state of Object activated. I'd like to know how many Object is Activated as if I see the COM+ Management Tool provided in Windows 2003.
Please,Help me.
Any idea will be helpful.
kim
|
|
|
|
|
This is not a C# question. Please ask in the C/C++ or COM/ATL forums.
-----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-----
|
|
|
|
|
Currently I'm using C# language to do this work.
Is it not related to C# Question?
|
|
|
|
|
Technically not, if you're using an interop assembly to get information for the catalog. You might be using the C# language, but the question has more to do with the COM+ classes and class interfaces. If you were using a class in the .NET base class library, this would be a different matter. Since you're not, you'll find it beneficial to NOT mention which language you're using (with your problem, it's not important) and mention that you're trying to get the status for COM+ objects in the catalog. This would most likely be answered in the COM forum.
No offense is meant, just that this really isn't the right forum for a COM+-related issue.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thank you for helping me.
I just wanted to know which forum is right for my question.
Once again....Thank you.
|
|
|
|
|
Hi All,
How do u assign a xml Schema that you created to a datatable in a dataset?
thanks,
JJ
|
|
|
|
|
So what I need is in code form, I have created an an Xml Scheme file and I want to assign it to a dataset that I create in code but don't know the right way to assign one to the other?
Thanks,
JJ
|
|
|
|
|
I'm guessing your problem is very similar to the one I was asking about above that's regarding the automatic WSDL generation for an XML web service.
In your particular case, I think you should look at creating a class derived from your base class (DataTable or maybe one for the entire DataSet?) and then implement IXmlSerializable. One of the method allows you to return an XmlSchema, which you can read from a file (or from an assembly using reflection, which is what I normally do).
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
|
|
|
|
|
Ah alittle bit more simpler in my case. Basically I created the XML Scheme in the Schema designer then I assigned the Schema to the dataset.
DataSet ds = new DataSet();
ds.ReadXMLScheme("xsdfile.xsd");
Then I create a datarow from dataset and Add record to dataset.
Works very nicely !
JJ
|
|
|
|