|
I'm not sure you want to do that!
That is going to be one very busy thread, continually updating the time when it doesn't need to. At the very least you could add a Thread.Sleep(1000) in there to rest the thread for a second between updates, although why you'd do this rather than use a timer escapes me.
Not to mention that you should *never* update the GUI from anything apart from the thread which created it (and in VS2005 it will explicitly block you from doing so). You'd need a call to BeginInvoke to make this solution acceptable.
Regards,
Rob Philpott.
|
|
|
|
|
I developed Multi threaded application ([MTATrhead]). And am using OpenFileDialog, when clicked on My Computer (from left wokspace) it is not showing the Drives available. I found its a bug in COM Interoperability (Pls see link http://discuss.develop.com/archives/wa.exe?A2=ind0509d&L=advanced-dotnet&T=0&F=&S=&P=6681)
Is there any Work Around?
Thanks
Santosh
|
|
|
|
|
Is there any specific reason you specified the [MTAThread] attribute? Multithreaded applications can be STA, unless COM clients are involved. Otherwise, the only option I can think of is launching another thread (STA) and showing the file dialog from that thread.
|
|
|
|
|
Thanks senthil you posting was helpful
|
|
|
|
|
Hi
Guys can any one let me know , how to make the collection classes serializable, thankx in advance.
|
|
|
|
|
Hello
Well, last time I check they already were serializable. The implement the SerializableAttribute , don't they?
Regards
|
|
|
|
|
in an editor some lines are
1 p q r s
2 x y z v
when the user will enter some line(2 a b c d) in between 1 and 2
2 x y z v will appear like 3 x y z v.
it will appear like
1 p q r s
2 a b c d
3 x y z v
give some idea how to do it
|
|
|
|
|
I guess the first step is to think about what it is you want to do, then the next step is to think about the materials you were given in class, and how they point you in the right direction. Then, you should do your own homework. Post here if you get stuck ( i.e. if you have code to post and wonder why it's not exactly working ).
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
hi everyone,
i'm getting this error: "There was an error generating the XML document" when i try to serialize a class. it works for other classes except for classes like these :
public class studentList()
{
public student[] students //has only one member and it is an array of another class
}
i didn't get much info from stackTrace which says:
at System.Xml.Serialization.XmlSerializationWriter.WriteTypedPrimitive(String name, String ns, Object o, Boolean xsiType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriter1.Write3_Object(String n, String ns, Object o, Boolean isNullable, Boolean needType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriter1.Write228_studentRegistration(String n, String ns, studentRegistration o, Boolean isNullable, Boolean needType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriter1.Write5_studentBody(String n, String ns, studentBody o, Boolean isNullable, Boolean needType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriter1.Write1_studentMessage(String n, String ns, studentMessage o, Boolean isNullable, Boolean needType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriter1.Write242_studentMessage(Object o)
my question is, is it the class? this is a project at work. i was given these schema files and just generated classes from those schemas to use for the project. i already did searching online and i found one that it says it is a problem on the class. let me know please. i will really appreciate your reply. thanks
|
|
|
|
|
Did you look at the InnerException property of the exception thrown? Does it give you any useful clues? Typically, this problem comes when one of the member types are not declared [Serializable] .
|
|
|
|
|
i tried to connect to my sql server on my computer using my ip address instead of my server name but i keep on getting an error saying that sql server does not exist or access denied
this is the connection string i used: myConnection = new SqlConnection("Data Source=10.0.0.1,1433;Network Library=DBMSSOCN;Initial Catalog=CallAccounting;User ID=sa;Password=;");
is this correct? or is it because i am not really on a network???
or do i have to configure my sql server differently
kenny
|
|
|
|
|
Since you're trying to connect to the SQL server on your machine, try specifying 127.0.0.1 or "(local)" as the Data Source in your connection string.
|
|
|
|
|
I'm working on a web service which uses public key encryption to transfer files to and from a web server. I've run into an issue that I'm hoping someone can help with. I can download files just fine since I can specify the public key as one of the parameters of the Web method and then decrypt the returned byte array. However I'm not sure how to upload an encrypted file. Since I need the public key of the server to encrypt the file on the client side, I created a web methiod which just returns the server's public key. But when I then encrypt the file on the client side and call another web method to send the byte array, the server's instance of the encryption class has changed and the previously used public key is no longer valid. Any thoughts on a possible solution ?
|
|
|
|
|
Don't change the public key, persist it somewhere. If you want to have temporary key then the only thing I can suggest is to create a temporary lookup table which associates the public key with the primary key. If the file hasn't started to be uploading within say a day then delete the key from the lookup table, any subsequent attempts to use that key should be redirected to receive a new key.
Of course the simplest solution would be to keep use the same public / private key combination for all transfers, as long as you can store it securly on the server.
Just Google it.
Failing that try phoning
|
|
|
|
|
Hello
How did you get Bob in your signature? Also sometimes I see other emoticons on the forums that aren't available on the smiley page of CodeProject like badger or picture of a cup. Where do you find them?
Regards
|
|
|
|
|
Hello everyone!
OK, I want to port this from C++:
while (true)<br />
{<br />
float newTime = (float) SDL_GetTicks();<br />
<br />
float deltaTime = newTime - currentTime;<br />
currentTime = newTime;<br />
<br />
accumulator += deltaTime;<br />
<br />
while (accumulator >= dt)<br />
{<br />
game.Respond();<br />
t += dt;<br />
accumulator -= dt;<br />
}<br />
<br />
game.Render();<br />
<br />
SDL_Delay(10);<br />
}
But there's a little problem... I put all of the event getting in game.Respond. But now in C# they have events, so I can't do that... Help? Thanks!
Windows Calculator told me I will die at 28.
|
|
|
|
|
Hello
You can Use these event handlers to set variable flags -like Left = true, Right = true, etc...- and check them in the Respond() as you did in C++, or a neater way is to devide your Respond() code in the handlers accordingly.
Regards
|
|
|
|
|
That's what I'm doing... I'm setting the keys in the KeyboardDown and unsetting them in KeyboardUp... But this piece of code makes it so that the game will run at the same speed on any computer... And it doesn't work... Any more ideas? Thanks!
Windows Calculator told me I will die at 28.
|
|
|
|
|
Lord Kixdemp wrote: And it doesn't work
I don't understand what exactly that doesn't work? More details would be very helpful.
Regards
|
|
|
|
|
Well... OK, what I posted in the first post was my main game loop... See the second while loop? Well, that's when I'm supposed to get user input through SDL events (non-.NET, just a switch statement)... That's done so that the game runs at the same speed on any computer it runs on (it runs faster at 2.8GHz than at 1.4GHz...). So, now I have the events loop, it's out of my control (SDL.NET), the events only raise when that specific... event happens. So now I want to do the same thing I did in C++ in C#. Thanks!
Windows Calculator told me I will die at 28.
|
|
|
|
|
1- Forgive my ignorance, but what is SDL?
2- Do you have the source code of game.Respond()?
3- SDL.Net is that another language? How does it handle events?
4- The speed control of the game. Did you write its algorithm or is it a 3rd party library?
5- Even in C++ events were simply messages sent to the game. If so then your C++ code should still be able to process these messages or otherwise you simply kick these messages to it manually.
Regards
|
|
|
|
|
|
So I guess that when the user presses a key, there is an SDL event that will be fired? Well, I still don't see aproblem:
1- Make a thread fro the game loop
2- Make flags for each Key to be pressed
3- Raise that flag in the KeyDown, and make it false in KeyUp events -whether windows or SDL events-
4- On each loop render the game accordingly -change the position of the spirit if the key is pressed otherwise stay on course for example-
5- You will still be able to control the speed of excution in the thread by many ways includeing the Thread.Sleep() and specify the interval of sleep based on the speed of excution -you can get the speed of excution by many ways like Timers-.
I hope that was what you were looking for, but somehow i think you already did all this. Where is your problem?
Regards
|
|
|
|
|
|
Why do you make things complicated for yourself. Simply use the KeyUp/KeyDown events to raise flags. Omit the CanRespond flag as it is very error brone. Now only raise flags in the KeyUp/KeyDown event and process them when you can in the loop thread. Of course you put this loop on another thread right? And why is Loop() public? It should be a private method in your form.
Anyway all I'm saying that omit the canResond totally. If the user presses a key while you are rendering it won't really hurt. Process that key when you see fit.
Regards
|
|
|
|