|
Frankly speaking I use my own implementation of Parallel to preserve .Net 2.0 compatibility but it works as you said, too. I will check if it works and post soon.
Greetings - Gajatko
Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.
|
|
|
|
|
BackgroundWorker+Parallel.For combination doesn't work.
progress.Value = e.ProgressPercentage; throws an exception (Cross-thread operation not valid: Control 'progress' blah blah blah)
and
progress.Invoke(new Action(delegate {
progress.Value = e.ProgressPercentage;
})); hangs the program. Any ideas? I though that this situation is so common that there is at least one satisfactory solution for it...
Greetings - Gajatko
Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.
|
|
|
|
|
Why is it hanging?
Take a look at what the threads are doing.
Why is the main thread blocked? What is it waiting for? Maybe you have a dead lock? (progress.Invoke waits for the main thread to finish any active event handlers, maybe the main thread is somehow still waiting for your calculation?)
|
|
|
|
|
Hello,
this is my code to retrieve the DeviceId of a windows mobile 5.0
[DllImport("coredll.dll")]
private static extern int GetDeviceUniqueID([In, Out] byte[] appdata, int cbApplictionData,
int dwDeviceIDVersion,
[In, Out] byte[] deviceIDOuput, ref uint pcbDeviceIDOutput);
private static string s_UniqueDeviceID;
public static string GetUniqueDeviceID()
{
if (string.IsNullOrEmpty(s_UniqueDeviceID))
{
// define AppString
string AppString = "MyAppString";
// get the byte array for the string
byte[] AppData = Encoding.ASCII.GetBytes(AppString);
// some parameters for the native call
int appDataSize = AppData.Length;
uint SizeOut = 20;
// our out parameter
byte[] DeviceOutput = new byte[20];
// Call the native GetDeviceUniqueID method from coredll.dll
GetDeviceUniqueID(AppData, appDataSize, 1, DeviceOutput, ref SizeOut);
// check that we got something
if (SizeOut > 0)
{
// build text from received bytes
StringBuilder resultText = new StringBuilder();
for (int i = 0; i < DeviceOutput.Length; i++)
{
resultText.Append(string.Format("{0:x2}", DeviceOutput));
}
// set up result
s_UniqueDeviceID = resultText.ToString();
}
}
return s_UniqueDeviceID;
}
}
The GetDeviceUniqueId() raise an error of type Cannot find an entry point .
Do someone can help me.
Best regards
dghdfghdfghdfghdgh
|
|
|
|
|
Wow!!! you get the most absurd question of the day award...
First, you didnt even have time to write your subject/question in detail.
Second, instead you posted your code completely (without explanataion) to make us guess.
Third, this is not Mobile Dev Forum...better look in Mobile Development[^]
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
It's a pinvoke question on C#. Not really offtopic.
|
|
|
|
|
Obviously GetDeviceUniqueID does not exist in coredll.dll. If you wrote coredll.dll yourself, did you export the function correctly?
|
|
|
|
|
Thats what I figured, but if you go down to pinvoke.net thats where it is. So somethings wrong.
My current favourite word is: Nipple!
-SK Genius
Game Programming articles start - here[ ^]-
|
|
|
|
|
Try this method instead:
private byte[] GetDeviceID(string AppString)
{
byte[] AppData = Encoding.Unicode.GetBytes(AppString);
int appDataSize = AppData.Length;
byte[] DeviceOutput = new byte[20];
uint SizeOut = 20;
GetDeviceUniqueID(AppData, appDataSize, 1, DeviceOutput, out SizeOut);
return DeviceOutput;
}
byte[] id = GetDeviceId("myAppName");
|
|
|
|
|
Oh - you should also declare the function like this:
[DllImport("coredll.dll")]
private extern static int GetDeviceUniqueID([In, Out] byte[] appdata,
int cbApplictionData,
int dwDeviceIDVersion,
[In, Out] byte[] deviceIDOuput,
out uint pcbDeviceIDOutput);
|
|
|
|
|
Hi. I've got a windows service that uses classes defined in it. Only thing is the dev environment does not pic the classes up. They are there but I get the following.
Error The type or namespace name 'clsUploadToMoss' could not be found (are you missing a using directive or an assembly reference?)
Can someone tell me why this is happening?
Stephen Lintott Bsc IT (RAU)
|
|
|
|
|
As the compiler error indicates, are you missing a using; directive or an assembly reference?
/ravi
|
|
|
|
|
Thats what I don't get. The Classes are in the same namespace(project) as where I'm calling them from. Is there a setting I am missing or something like that?
Stephen Lintott Bsc IT (RAU)
|
|
|
|
|
This might be a dumb question, but did you perhaps forget to add the source files to the project?
/ravi
|
|
|
|
|
No they are there.
Stephen Lintott Bsc IT (RAU)
|
|
|
|
|
If you want, send me a .zip of your project if you'd like me to figure out what's going on.
/ravi
|
|
|
|
|
When you use a web service, you don't have access to any of the classes defined in the web service.
You only have data container classes that resembles the objects that the web service methods uses. Those "ghost" classes are created in the code that is generated to interface with the web service.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Guffa wrote: Those "ghost" classes
Or more commonly known as "proxy" classes
|
|
|
|
|
So I can't use the classes???
Stephen Lintott Bsc IT (RAU)
|
|
|
|
|
Not unless they are exposed via the web service, but those arent the real classes either. Maybe you should look at Remoting if you want to use those classes over the 'wire'.
|
|
|
|
|
He said "windows" service, not "web" service.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
John Simmons / outlaw programmer wrote: He said "windows" service, not "web" service.
So he did.
Sorry, I read it as "web service", and the problem seemed to fit a web service also...
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Make sure the classes are "public". When you add a new class, it's not automatically public.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
make sure that the class constructor's access modifier is public.
or make sure one other thing that the classes namespace matches with the service namespace
|
|
|
|
|
check your 'clsUploadToMoss' class visibility(internal, public or private), and where you call your class
dhaim
programming is a hobby that make some money as side effect
|
|
|
|