delegates

Button Delegate not being called.

I have a page with a form in a user control. When the button is clicked the validation methods are called correctly client side and server side, but the delegate method is not processed. ASPX Page <%@ Control Language="C#" AutoEventWireup="false"... ... <asp:Button runat="server" ID="btnSubmit" /> ... Codebehind protected override ...

What is the name for this usage of delegate in C#?

This is a terminology question. In C#, I can do this: delegate Stream StreamOpenerDelegate(String name); void WorkMethod(StreamOpenerDelegate d) { // ... } void Exec1() { WorkMethod((x) => { return File.OpenRead(x); }); } void Exec2() { StreamOpenerDelegate opener = (x) => { ...

What is the VB equivalent of this C# syntax, dealing with delegates?

Is it possible to translate the following C# code into VB.NET, using VB 9.0? delegate Stream StreamOpenerDelegate(String name); void Exec1() { WorkMethod( x => File.OpenRead(x)); } void Exec2() { StreamOpenerDelegate opener = x => return File.OpenRead(x) ; WorkMethod(opener); } Can I do something like this?: Private Del...

How to get a copy of the image from UIImagePicker

Hi, I've got a very simple app where the user selects a UIImageView and presses a button to take a photo with the camera. The image is then returned and displayed in the UIImageView. However, since the UIImageViews are sharing the same delegate, when there's already an image in one of the UIImageViews, and I go to take a photo to be pl...

Objective C/Cocoa delegate question

I have read and understand the answer given in this question: http://stackoverflow.com/questions/626898/how-do-i-create-delegates-in-objective-c However, I wish to set a delegate to my main application window and was wondering where in my application I can do that - in my AppDelegate class, or somewhere else? ...

How do you connect the "delegate" outlet of a UITextView to a class that implements UITextViewDelegate protocol?

How do you connect the "delegate" outlet of a UITextView to a class that implements UITextViewDelegate protocol? I can't seem to find an example in the docs The weird thing is the UITextView's "delegate" outlet has that drag 'n drop interface thingy, like you can wire it up to another widget but of course, I don't want to wire it up to...

What is Delegate and Delegate Methods

Guys anyone please let me know difference between Delegate & Delegate Methods and its differences and its usages ??? ...

Generic method with Action<T> parameter

So, I'm sure this has been answered somewhere out there before, but I couldn't find it anywhere. Hoping some generics guru can help. public interface IAnimal{} public class Orangutan:IAnimal{} public void ValidateUsing<T>(Action<T> action) where T : IAnimal { Orangutan orangutan = new Orangutan(); action...

Delegates, can't get my head around them

Hey, I'm looking for useful resources about Delegates. I understand that the delegate sits in the background and receives messages when certain things happen - e.g. a table cell is selected, or data from a connection over the web is retrieved. What I'd like to know in particular is how to use delegates with multiple objects. As far as ...

combining flipsideview and navigationview

when i am trying to combine flipsideview and navigation view i am getting following error "request for member 'delegate' is something not in a structure or union" on the line controller.delegate = self; ...

Custom delegate : How to call back from modalViewController tapping on done ?

Hi all , I want to use custom delegate in my search tab. I have never used my own custom delegate in any application ( this is the just second one ). The scenario is as below : In the search utility ,If I am pressing select category , a modal view controller will be presented in that I am passing a category controller as a parameter...

C# 3.0 - Application of Monitor -Suggestions

In order to understand the Monitor I have implemented the following code.But I am not sure whether the code is Thread Safe. namespace MonitorExample { public delegate void WaterLevelInformer(object sender,WaterLevelArgs e); class WaterLevelListener { //listener will print information // when WaterTank is rea...

Objective-C/Cocoa threads and messaging conundrum

Hello, I have a problem that has been plaguing me for awhile now, I have come up with a solution which I will detail below, and although it seems to be working well I'm not super enthusiastic about it from a design point of view and I'm curious if anyone would have any recommendations about a better way to do this. Basically, I have a s...

Memory Leak on BeginInvoke

1) I heard that when we won't call EndInvoke() it may lead to memory leak? can you demonstrate it how could this lead to memory leak? 2) When i suppose to call EndInvoke() shall i use the code like following ? namespace BlockMechanism { public delegate int MyDelegate(List<int> someInts); class MainClass { static v...

Array of function pointers in C#

Hello There is a set of methods like: Foo(int, float, params objects[]) Goo(int, params objects[]) Too() each taking different number of & type of parameters (so are return values). I read an integer (an index) from a database. The integer corresponds to one of the above mehtod (1 for Foo, 2 for Goo and 3 for Too). How do I st...

C# Func delegate

I am adding range of integers (101,105) using Func<> delegate.I suppose to get 101,102,..105 as output while executing the following.But I am getting 204,204,..... What went wrong? class MainClass { static List<Func<int>> somevalues = new List<Func<int>>(); static void Main() { foreach (int r in E...

When is it better practice to explicitly use the delegate keyword instead of a lambda?

Is there any best practice with respect to coding style with respect to explicit use of the delegate keyword instead of using a lambda? e.g. new Thread(() => { // work item 1 // work item 2 }).Start(); new Thread(delegate() { // work item 1 // work item 2 }).Start(); I think the lambda looks better. If the lambda is better style...

C# Case insensitive comparision

How to implement case insensitive comparison? List<Person> persons = new List<Person>(); persons.Add(new Person("P005", "Janson")); persons.Add(new Person("P002", "Arnold")); persons.Add(new Person("P007", "Kazhal")); persons.Sort((p1, p2) => p1.Name.CompareTo(p2.Name)); ...

How to implement automatic properties in VS 2005 for a delegate callback

I'm attempting to get the TwainDotNet solution I found here (http://stackoverflow.com/questions/476084/c-twain-interaction) to compile, and I'm at my wits end. This solution was obviously developed in VS 2008, and I'm working in 2005 (no choice at the moment). I've spent probably WAY to much time getting this all to compile in 2005, an...

Making a cross-thread call to a ListView

Hi, I have a thread running in the background that periodically tries to update a ListView component, but every time it attempts to I get a "Cross-thread operation not valid: Control 'dlList' accessed from a thread other than the thread it was created on." error. I have used a delegate to try and solve this but it isn't fixing the probl...