delegates

Calling a method on a child form from the parent form

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...

Is there a useful design pattern for chained asynchronous/event calls?

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...

Understanding Lambda expressions and delegates

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. ...

Passing an extension method to a method expecting a delegate. How does this work?

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...

how to add a method name from Config file to a delegate?

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? ...

How can I provide a delegate in a managed interface class

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...

How are the Poco C++ events handled?

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...

Create an alternative to serializable anonymous delegates

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:...

Loading and Deleting Remote Data From The Same View Controller

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...

The fastest way to call a method

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...

iPad, UIViews, and View Controllers? Something isn't working...

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...

Need concise definition of "delegate"

I need a short description of how "delegation" works in programming, preferably in one sentence. Even better to use analogies ...

Class 'TableDataSource' does not implement the 'NSTableViewDelegate' protocol

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...

Why is this named function not allowed to be passed as a Func<> argument in C#?

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() { ...

Cannot find protocol declaration in CocosNode

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 ...

add generic Action<T> delegates to a list

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...

NSURLConnection doesn't call delegate methods

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. - ...

events and delegates dilemma

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...

StoreKit SKProductsRequest Crash

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...

Why does the Android maps compass demo use a delegate for the SmoothCanvas class?

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...