|
When you have a List of WorkItems, you have to call the Deserialize (which inturn calls the ReadXML) multiple times to load the complete list. You will have to iterate thru the XML Reader (thru the list of WorkItem elements serialized into a single XML file) and call the Deserialize for each WorkItem element, and add the retrived WorkItem to a list. With this logic you can finally populate the List of WorkItems loaded back from XML, into which you have previously serialized the list of WorkItems.
You can try this -
TextReader reader = new StringReader(xmlData);
System.Xml.XmlReader xmlReader = System.Xml.XmlReader.Create( reader );
List<WorkItem> workItemList = new List<WorkItem>( );
try
{
xmlReader.ReadStartElement( );
while ( ( xmlReader.MoveToContent( ) == XmlNodeType.Element && xmlReader.LocalName == typeof( WorkItem ).Name ) )
{
workItemList.Add( ( WorkItem )new XmlSerializer( typeof( WorkItem ) ).Deserialize( xmlReader ) );
xmlReader.Read( );
}
}
catch (Exception ex)
{
}
finally
{
xmlReader.Close();
Reader.Close();
Reader.Dispose();
}
|
|
|
|
|
I have created an C# application to compile C# and VB code. Now I want to extend it to Visual J# as well. Is there any specific class for that(as there are CSharpCodeProvider and VBCodeProvider for C# and VB)??
Also, can I post the code for review??
modified on Tuesday, February 26, 2008 7:21 AM
|
|
|
|
|
And how is the VJSharpCodeProvider not working for you?
|
|
|
|
|
i_want_to_learn_c# wrote: Also, can I post the code for review??
No. We dont get paid to do that.
|
|
|
|
|
Hello guys...
I am facing the following problem when i debug my application but it builds successfully.
this is the error message with header ....loaderlock detected..
VoiceChat\bin\Debug\Microsoft.DirectX.DirectSound.dll' is attempting managed execution inside OS Loader lock. Do not attempt to run managed code inside a DllMain or image initialization function since doing so can cause the application to hang.
please let me know if someone know how to solve it...
modified on Tuesday, February 26, 2008 8:33 AM
|
|
|
|
|
Are you using this in a Web application?
|
|
|
|
|
I have developed a windows service that takes the screenshot and saves in server machine with start-up type Automatic, which is required.When the machine of client is restarted, it shows win32 exception of sqlmngr.exe and service cant be started.Is there any way to remove this exception.
Note that start-up type Automatic is required.
Thanx in advance.
|
|
|
|
|
1. Is there a stack trace?
2. Is your service doing anything with SQL Server?
3. Have you enabled the Allow service to interact with Desktop option?
4. Have you (after the service dies) tried starting it manually to see what happens?
Cheers,
Vikram.
"real dictators don't loose[sic] elections." - Diego Moita.
|
|
|
|
|
Actually every screenshots taken is stored in server part and since there are more than one client it definitely uses SQL server.And,Allow service to interact with desktop is already enabled.Everything works fine,but after restarting the computer it shows the exception but if done manually it works fine saving screenshots in server machine.So how to avoid this exception?
Thank you.
|
|
|
|
|
Sounds like you have a dependency issue. Your service is dependent on Sql Server having started so you need to add a dependency to it to do this.
|
|
|
|
|
Sorry but adding dependency to the service also doesnot work out.It shows same exception of sqlmngr.exe.Help please.
|
|
|
|
|
Hi, I am facing an issue in serialization. I have a class that implement ISerializable interface. Actually I want to make my object to travel on the network. If I don’t implemetn the ISerializable interfce and use the following code I can get the same functionality.
public static Object GetSerializedObject (Object pObject)
{
try
{
BinaryFormatter objBinaryFormatter = new BinaryFormatter();
MemoryStream objMemoryStream = new MemoryStream();
objBinaryFormatter = new BinaryFormatter();
objBinaryFormatter.Serialize(objMemoryStream, pObject);
objMemoryStream.Position = 0;
Object objReturnedObject = (object)objBinaryFormatter.Deserialize(objMemoryStream);
objMemoryStream.Flush();
objMemoryStream.Close();
objBinaryFormatter = null;
return objReturnedObject;
}
catch (Exception objException)
{
throw;
}
}
Please guide me which is the best practice that I should follow. Is there any difference in the approches. There is no constrant to serialize some attribute of the class, the whole object should be serialized.
Regards,
modified on Tuesday, February 26, 2008 8:11 AM
|
|
|
|
|
You don't need to implement the ISerializable interface. Just decorate your class with the [Serializable] attribute and you are fine.
|
|
|
|
|
can anyone tell me how to write an image inside a cell as a comment in Excel using C#
-----Have A Nice Day-----
|
|
|
|
|
Hi everyone,
I have an application which is going to work on the parameters that is passed from another application.
1. The first application is an add-in and the second one is a windows application.
2. The first application is a windows application ans second is a web application. In the web I am using Form authentication.
I want to pass the user who have logged-in in the first application and other details to the second application by clicking a button.
Can any one tell me how to perform the above.
Thanks a lot in advance.
Best Regards,
M. J. Jaya Chitra
|
|
|
|
|
Hi,
Have a look at the Process class and its Start() method.
Specifying a file acts just like double clicking the file in Windows Explorer.
For more control, use the StartInfo property.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
I am using C#, OpenGL and want to draw the Text on screen ... I went to OpenGL site and see the GLFont and other methods. Problem I face in these are:
They give Code in C++ that uses pointers and references that are not supported in C# and it call them as unmanaged code, i write unsafe modifier in front of it but other problem arises. So, these codes are not helpful unless they are in C# language.
if anyone know the method how to draw text in openGL or how to use C++ code in C# language then tell me .... I will be very pleased for your help ....
|
|
|
|
|
Hey,
be careful not to mix up things here.
First, OpenGL is a native C Library, so 'talking to' OpenGL, at some point, requires you to communicate with it - good news is, you don't have to that yourself (but you can if you want to).
Check out the following libraries which may help:
o Tao Framework[^]
o EaseWrapperSDK[^]
NOTE: Tao is for C#, EaseWrapper is for C++. If you haven't worked with managed C++ / Interop, look at Tao first. Tao has more to offer than just wrapping OpenGL, by the way (also wraps SDL, OpenAL, etc.)
Second comes text rendering. There are a number of ways to it:
o Manually. This involves a texture which contains letters and numbers. Then, you render little rectangles with orthographic projection on the screen. For a GUI, you want to do this after the scene is rendered. This is not as hard as it may sound.
o Using a library such as glFont. As far as I know, glFont is a program or a library. Its not an OpenGL-Command. However, I don't know any C# gl font-render libraries, so again you might have to mess with a managed C++ wrapper.
o Using a high-level library such as CeGUI which has a lot more to offer than text rendering. It is included in the EaseWrapperSDK, but it's also C++.
There might be a GUI library in Tao, I'm not sure.
I suggest you go for Tao and have a look at thoseNeHe Lessons[^] which concern font rendering. He presents a number of options. NeHe's tutorials are available as C#, but you will have to (in other words, you should) convert them to Tao if you use it.
Hope that helps,
Chris
"Obstacles are those frightening things you see when you take your Eyes off your aim"
- Henry Ford
Articles
Blog
|
|
|
|
|
Thanks 4 the Reply ... NeHe Lessons's Link was not Opened in my browser i think link is broken ....
I want to ask one more thing that i am using this code ... where height is the Font height and startPoint_x and startPoint_y is the point where text is to be display
CsGL.OpenGL.GDITextureFont myGDITextureFont;
Font newFont;
newFont = new System.Drawing.Font("Microsoft Sans Serif", (float)height);
myGDITextureFont = new GDITextureFont(newFont, 'a', 'z');
GL.glTranslatef((float)startPoint_x, (float)startPoint_y, 0);
myGDITextureFont.DrawString(text);
and in this way text displayed but when i click on it it turns into solid bar .... Can you tell me, What is the problem with this code ....
|
|
|
|
|
Hi,
the link to NeHe works out for me. If it doesn't work, you might want to google it or visit gamedev.net, which links to NeHe.
As for the code you supplied, I don't see any trouble.
However, the problem might be caused by your update/resize methods. The question is: Under which circumstances do you redraw the screen? You have to do that whenever Windows tells you to do so, because it might have invalidated the screen. This can happen when resizing, minimizing, when another application draws in front of yours or even if a different control receives focus. The latter happens upon click, so make sure you redraw the scene for the events named above.
Chris
"Obstacles are those frightening things you see when you take your Eyes off your aim"
- Henry Ford
Articles
Blog
|
|
|
|
|
I have been looking at the NeHe lesson and they seem to be in C++, sorry if im being blind.
Also what is the best way to rotate text, i.e. having it writing at the angle or vertical.
Thanks
|
|
|
|
|
hi to all!
I m using raw socket class to capture network packets,It parse packet headers of TCP/IP and UDP/IP .I want to determine the packet size .
Is there any method to calculate or get packet size and also tell me how i can calulate the network traffic. if there is any soruce code link availble then send me . thanks
|
|
|
|
|
Hey guys,
I'm developing a jukebox kind of app with video support. Currently I support up to three 'rooms' which can play audio individually. The audio is handled by DirectX (9c) and then ported to sound device which handles the rest for you. Now in order to support multiple 'rooms' I need to insert more sound devices in the machine.
I want to use only one 5.1 sound device, and send the audio of multiple rooms, to different output ports on the sound device. Can anyone give me a hint?
Eduard
|
|
|
|
|
I want to execute multiple command on MS DOS using C SHARP is it possible ?
|
|
|
|
|
See here[^]
Courtesy of Google.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|