hi, I have 2 forms ParentForm and a child form. In my parent form I have a thread listener which listens to a feed which updates an area of the ParentForm. Now, I have a ChildForm which also needs the data from the listener to be placed on an area of the ChildForm. the thread listener uses delegate to update my ParentForm when it gets...
I'm currently having to integrate a lot of web service calls inside Silverlight that make calls similar to the code below. No user interaction should be possible until the loading of all 3 is complete.
// In my view, having standard delegate methods (non-anonymous) makes the
// code below even messier.
// I've left out the EventArgs t...
I have been trying to figure this out for quite sometime (reading online blogs and articlaes), but so far unsuccessful.
What are delegates? What are Lambda Expressions? Advantages and disadvantages of both? Possible best practice of when to use one or the other?
Thanks in advance.
...
So at work I was using an API that we didn't write, and one of the methods took a delegate. For one reason or another, the idea came to me that I have an extension method that fits that signature, so I was wondering if it would work. I was sure it wouldn't but much to my surprise, it did. Allow me to demonstrate:
Say I have these classe...
I have to call a method whose name is coming from a configuration file. I can achieve this using Reflection.MethodInfo.Invoke() method. But my scenario is all these methods should be of same signature. Can i implement it using Delegates? but how can i add a method name stored in configuration file to a delegate?
...
Hello all,
I am working on a project containing parts of C#, managed C++ as well as unmanaged C++ code. I am working with .NET 3.5.
My programming experience lies more on the unmanaged C++ side an I am not that familiar with the concepts of .NET.
My question is: How can I hide / provide a delegate behind a managed interface class.
Su...
Lets say i have a Poco::Thread:
Thread Parent has an eventhandler method within it.
The parent then spawns two children threads, who are given events that are the parent subscribes the eventhandler to.
So two events both have the same event handler attached.
If Child A triggers their event, and Parent starts to execute it, what would hap...
Hello stack,
there have been quite some posts about this, all trying to serialize a Func delegate.
But could someone think of an alternative, when the use of the delegate is always clear?
We have a generic create command, which takes a delegate as paramater in the constructor. This delegate will create the Item for the create command:...
Hello,
Sorry if this question has all ready been asked, maybe someone can point me in the right direction, I had trouble formatting it.
I have a view controller, when it appears an NSURLConnection loads remote data asynchronously from a server into a table view, similar to how the Mail application loads data. However I also want to be...
Reading this article I found several ways to call a method.
Method to call:
public static void SendData(string value) { }
Calls:
delegate void MyDelegate(string value);
//Slow method - NOT RECOMMENDED IN PRODUCTION!
SendData("Update");
// Fast method - STRONGLY RECOMMENDED FOR PRODUCTION!
MyDelegate d = new MyDelegate(Send...
So I think I have my Views all messed up, and how these work. Actually, I know I do, cause I am getting this: http://www.designmenace.com/downloads/landscapeWhatWhat.png . The iPad is turned landscape and so is the view but it's not rotated properly within the window. But the top bar is rotated properly! And this only happens about 70...
I need a short description of how "delegation" works in programming, preferably in one sentence. Even better to use analogies
...
What methods should be implemented?
I've tried to set the TableDataSource as a delegate to my TableView, but delegate methods wasn't called. After that I tried to set "TableDataSource" as delegate in code, and got this warning:
warning: class 'TableDataSource' does
not implement the 'NSTableViewDelegate' protocol
Delegate metho...
I am having trouble understanding what the rules are for passing delegates in C#3.0. The final .Max() is giving the compile error as shown below, but I can't understand what the significant difference is between that case and any of the others.
int NamedIdentity(int val) { return val; }
Func<int, int> Identity = x => x;
void Main() {
...
Hi,
I have a LAYER class and created a protocol:
@protocol countryControllerDelegate
-(void)didReceiveGamePlayTimeWarning;
@end
And i make use of that delegate in a CocosNode class.
#import "protocolClass.h"
myClass: CocosNode [countryControllerDelegate] {
But there is an error that "cannot find protocol declaration ".
Is ...
Is it possible to add a generic delegate Action to a List collection?
I need some kind of simple messaging system for a Silverlight application.
UPDATE
The following is what i realy "want"
class SomeClass<T>
{
public T Data { get; set; }
// and more ....
}
class App
{
List<Action<SomeClass<T>>> _actions = new List<Action<S...
Hello everybody, I saw similar questions here, but I couldn't find solution to my problem.
I have a simple NSURLConnection in main thread (At least I didn't create any other threads), but my delegate methods aren't get called
[[[NSURLConnection alloc] initWithRequest:request delegate:self] autorelease];
and no methods called, e.g.
- ...
I am really in a fix over understanding the concept of events and delegates.I know that delegates are the objects holding references to methods and can call methods having the same return type and parameters, but then what exactly are events?
If I need to use events for making a simple calculator, then how can I use them so that there a...
I use the following code to request a list of products as per the In-App Purchase Programming Guide. It used to work fine in my iPhone application, however now it crashes every time the product list is requested. The delegate method (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response is ne...
In the Android MapsDemo available in Eclipse for the Google API, they create an inner class SmoothCanvas in MapViewCompassDemo.java. Within this class the re-implement seemingly every method and reroute it to a delegate instance of Canvas.
static final class SmoothCanvas extends Canvas {
Canvas delegate;
private final Paint mSm...