delegates

Test if property throws exception with nunit

Hi, it seems there are no delegates to properties. Is there a convenient way to do the following? Assert.Throws<InvalidOperationException>( delegate { // Current is a property as we all know nullNodeList.GetEnumerator().Current; }); ...

Question's about delegate an UIScrollview.

Hello, i've got still problems with delegating something like a UIScrollView. For example, i've got 2 Scrollviews (Scrollview1 and Scrollview2)and i want to use the method - (void)scrollViewDidScroll:(UIScrollView *)scrollView1 To interact to both Scrollviews like: if (scrollView1 == scrollView2) { NSLog(@"similar");} First,...

C# - Is it possible to get the owner type of a method from an Action?

I have a class that implements an Interface with some methods. I also have method with an Action parameter where I pass the Interface method. Is it possible to get the type of the owner that has the method? EDIT This is the wrapper: private void Wrapper (params Action[] actions) { var action = actions.FirstOrDefault(); var type...

Handling DependencyProperty changes in the ViewModel of a UserControl.

Hi. Im currently trying to get my first WPF Usercontrol to work. It consists of some UI elements and a ViewModel, holding the data and doing the work. It has a List of items as input, and another List of items as output. I need a certain task in my ViewModel to be done, when the list bound to the input changes. But i can't find a way to ...

Having an IAsyncResult fire a "completed" event

I'm using Remoting to perform some IPC communication, and have the following question: When I invoke delegates to gather data server-side, it is possible to have an event fired on the client when an IAsyncResult is gathered? The following code is in VC++, but .net code is .net code. GetFileTextDelegate ^svd = gcnew GetFileTextDelega...

App delegate and View Controller in iOS4

With multi-tasking in iOS4, the home button puts the app into background and when it comes back into foreground I want the View Controller to 'refresh' (and hence viewWillAppear to be called). I put this in the app delegate thought this should work but nothing happens - (void)applicationDidFinishLaunching:(UIApplication *)application {...

Core Animation delegate not called

I must be doing something wrong obviously. My delegate doesn't get called when I set the frame of a view. Frame version NOT working -(void)someMethod { CAAnimation *anim = [CABasicAnimation animation]; [anim setDelegate:self]; [[currentViewController view] setAnimations:[NSDictionary dictionaryWithObject:anim forKey:@"frame...

iPhone SDK: Passing NSMutable Array to controller not working

Hi there! I have an NSMutableArray countHistory defined and am trying to pass it to the next view controller: Updated Code: NSLog(@"Debug One"); HistoryTableViewController *controller; NSLog(@"Debug Two"); controller = [[HistoryTableViewController alloc] initWithNibName:@"HistoryTableViewController" bundle:nil]; NSLog(@"Debug Three");...

Reload Data On View Controller Dismiss

I have a table view, which populates data from the web. To add information to this list I have a configuration screen presented modally. When data is added successfully the configuration screen is dismissed, I would like the data in the table view to automatically reload from the web to reflect the newly added data. What is the best w...

applicationDidFinishLauching never invoked, WillFinishLauching does

I have a Cocoa application which works fine except it will not invoke applicationDidFinishLauching on my app delegate. applicationWillFinishLauching does work though. In IB I have set the delegate from "Application" (and also File's owner) to my "XXX App Delegate" object. All other application specific methods are called correctly weird...

Dose method -application:didFinishLaunchingWithOptions: run in ios 2.0?

Dose method -application:didFinishLaunchingWithOptions: run in ios 2.0? -application:didFinishLaunchingWithOptions: is a delegate method in ios3.0 and later, Will it be wrong in ios 2.0? ...

How do you examine the arguments passed to a delegate?

I'm trying to make a class to handle invoking methods on a remote server using my own means. To make it easier on the client caller, I'm writing a generic class that accepts an interface so that the compiler will know the number of arguments and the return type of the method. public class Service<TInterface> { public TResult Invoke<...

How to pass NSManagedObjectContext back up to root view in UINavigationController?

I may just be passing data between views completely wrong here, so I am open to completely changing how I pass my data back and forth. My app delegate creates the NSManagedObjectContext and passes that to my main menu using a UINavigationController which makes it the root view: MainMenuViewController *mainMenuViewController = [[MainMen...

Why delegates generated dynamically from expressions are slower than hard-coded lambdas ?

I would have expected delegates generated from expression trees to achieve roughly the same performance as hard-coded, static, equivalent anonymous methods. However, it seems that dynamically generated delegates are noticeably slower... Here's a simple test program to illustrate the case. It just accesses 3 properties of an object 10000...

use of Delegate in iphone sdk

Can somebody explain me how exactly does the delegate work in iphone sdk.....??? A simple example how to use the delegate and what are the advantages of using delegate. ...

How to manipulate at runtime the invocation list of a Delegate?

Hi Guys, I want to know how do I go about removing individual delegates from the invocation list of the parent delegate. <DelegateName>.RemoveAll(); Now I can just remove all and that will work just to get the idea in motion and see if works which it should but then any delegates removed will need adding again at RunTime!!! so: ... ...

.net Remoting: Detect if a server isn't running

I'm working on an app that uses .net remoting for IPC. When my client app starts up, it uses the following code to connect to the server: chnl = gcnew HttpChannel(); ChannelServices::RegisterChannel(chnl, false); IPCObjectInstance = (BaseRemoteObject)Activator.GetObject( typeof(BaseRemoteObject), "http://localhost...

Query on Delegates

Hi, I came across a code which was using BeginInvoke to update label text in a certain way, which I found strange and I can't understand why would somebody do that. If I want to use threading to allow good user experience, I would create a thread and update the labels in the new thread using Thread.Start nethod. Why would I use the b...

ASyncCallback\BeginInvoke for Remoting, debbuging peculiararity

I'm currently using BeginInvoke(with ASyncCallback) to handle my Client\Server communications with remoting. Here is my current setup: ... //Main Remoter.StationDelegate svd = new Remoter.StationDelegate(IPCObjectInstance, &Remoter.GetStationInformation); AsyncCallback callback = new AsyncCallback(this, &CentralControlClient.Sta...

How to evaluate methods of another class in current context?

I have 2 classes whose object should act as "partners". The first one is my Thing class, whose instances should act as Tree::TreeNodes of the gem RubyTree. Basically, this delegation can be implemented using Forwardable: class Thing < NoClassInheritancePlease extend Forwardable def initialize(title = "node") @node = Tree::Tree...