|
|
How do i make to "snap" togheter 2 dialog boxes from same process. like in WinAMP
|
|
|
|
|
By working out when they are close, and moving them so they are right on top of each other. Then, when they are 'snapped', when one is moved, you move the other one in unison. There's a moved event you can use for this.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
I'm adding some code to a project that requires the use of the app.config file. However I don't have access to this file. Can anyone think of a good way to start the application and have it "generate" an app.config file, or just ignore the file?
I'm trying to use Enterprise Library Caching without app.config, or perhaps add the config section to the app.config file.
Any ideas? Solutions?
Thanks,
Jason
|
|
|
|
|
What do you mean 'requires the use' and 'don't have access' ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
So we have an application which has an app.config file. However the code I'm working on is a secondary agent that runs within that application with the app.config file. I would like to run the Enterprise Library Caching without having to modify this app.config file.
Does that make any more sense?
Is there a way to use the EntLib.Caching without the use of the app.config. Or perhaps is there a way in code to handle the calls to the app.config file?
|
|
|
|
|
You can add it to the solution. Right click -> Add Item -> Application configuration file.
Insert funny quote here.
|
|
|
|
|
I'm not sure if that's what he means. As usual, they ask and then don't answer when you try to help.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Give me a break. I was away from my computer for a while.
|
|
|
|
|
Sorry, but it's just not uncommon for people to ask and then never reply when people answer by asking for more detail.
I still don't get what the conflict is - does John's answer help ? You can read the app.config as a normal XML file and parse it if you want to.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Thanks, though that isn't what I'm needing. I've replied with a bit more info.
|
|
|
|
|
If you just want to read the file, that's possible because after all, it's just an xml file. You can actually force your program to read a different app.config file but once you do, it's a fairly convoluted coding process to un-do that. I think I have some code for you to use as an example, but it may be at home.
"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
|
|
|
|
|
All right, that sounds quite weird, but that's the way it works:
foreach(something in somethingelse)
{
add_a_job_to_the_threadpool(delegate { myFunction(something.Key, something.Value); } );
}
Right, so what obviously happens here is that ALL calls to myFunction() receive the same parameters since something is passed as reference. How do I get this done as values or at least as references to the value, not to the iterator. I already tried to use a struct (which would pass by value) but the something is actually a dictionary<string,> and even wrapping them in a struct doesnt change much.
There must be a better way then copying them before passing to the delegate.
Anyone?
|
|
|
|
|
I thought you'd need to create new string variables from the Key and Value, and then pass those.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
That's what I would like to avoid. Especially since the class parameter is quite expensive by means of processor resources.
|
|
|
|
|
Yeah, I can understand that, but I suspect that the combination of how anonymous methods are scoped, and the nature of the string class, will make it unavoidable. I do think the anonymous method scoping is part of the issue, have you tried using a non anonymous method ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Actually no, didn't try that yet (more because of the custom threadpool class I am using), but to fence the problem in its worth a try. Thanks for the idea.
|
|
|
|
|
np - I hope it helps.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Andreas Saurwein Franci Gonçalves wrote: How do I get this done
That depends, there are several options. The two most obvious choices are 1) Hire a software developer that know and understands how to do multi-threaded software development 2) Learn the subject of multi-threaded software development (NOTE: this is a fairly large and somewhat complex subject ), then using the new knowledge, develop the solution yourself.
led mike
|
|
|
|
|
Thanks a lot for this quite useless answer. After 25 years developing software, about half of that threaded server applications in C++, I do have a slight idea of accomplishing this task, but I do not have sufficient knowledge of C# yet to do it.
So if you can not contribute anything useful to the forum, don't contribute at all.
|
|
|
|
|
Andreas Saurwein Franci Gonçalves wrote: So if you can not contribute anything useful to the forum, don't contribute at all.
Some people find my charming sarcasm useful. You can't please all the people all the time. So I will contribute what and when I want and not check in with your opinion. Thanks for the suggestion though. Have a nice day.
led mike
|
|
|
|
|
Andreas Saurwein Franci Gonçalves wrote: After 25 years developing software, about half of that threaded server applications in C++, I do have a slight idea of accomplishing this task, but I do not have sufficient knowledge of C# yet to do it.
Whatever. I am closing in on 20 years, with a big segment in the middle doing multi-threaded C++ server development. Someone with that background should not be struggling with such a basic issue just because the language/platform has changed.
led mike
|
|
|
|
|
Well, so as you are obviously an expert, you most surely can give an simple example in a few lines of code how to circumvent the situation. (And even if you are not an C# expert it should not be hard to answer just because its not your language of experience).
|
|
|
|
|
Andreas Saurwein Franci Gonçalves wrote: how to circumvent the situation.
Possibly, if you had described the situation accurately. As it is I can't make any sense of what you posted.
foreach(something in somethingelse) that loop is bogus, foreach(type instance <span style="color: Blue;">in</span> collection) , as is your definition of something versus how you claim to use it.
Andreas Saurwein Franci Gonçalves wrote: the something is actually a dictionary<string,><string,>
If something is a Dictionary<string, whatever> then there is no something.Key nor something.Value
add_a_job_to_the_threadpool(delegate { myFunction(something.Key, something.Value); } ); I have no idea what your requirements are nor what the existing code structure is since you obviously did not post it. Makes it rather difficult to offer any lines of code that could be helpful.
Since you appear to be struggling with how to pass the state information to each thread context. Making the following major assumptions I would say:
foreach(string skey in somethingDictionary.Keys)
add( delegate{ myFunction( skey, somethingDictionary); } ); myFunction can then obtain it's state information, or whatever it is, from the dictionary using the key
led mike
|
|
|
|
|
Thanks for confirming that you have not the slightest idea about threading and C#. You might also wish to lookup the Dictionary enumerator again on MSDN.
|
|
|
|