events

How to represent an event based architecture in a static UML model?

I have a fairly basic C# event based system but I'm not sure how I model it in UML. I obviosuly want to show the event publisher, subscriber, handlers and EventArgs classes .. I think you use 'signals' but I can't find any examples. Can anyone point me to an example or shed any light? Thanks Edit: I am creating a static model, I don't ...

What would I lose by abandoning the standard EventHandler pattern in .NET?

There's a standard pattern for events in .NET - they use a delegate type that takes a plain object called sender and then the actual "payload" in a second parameter, which should be derived from EventArgs. The rationale for the second parameter being derived from EventArgs seems pretty clear (see the .NET Framework Standard Library Anno...

Event and delegate contravariance in .NET 4.0 and C# 4.0

While investigating this question I got curious about how the new covariance/contravariance features in C# 4.0 will affect it. In Beta 1, C# seems to disagree with the CLR. Back in C# 3.0, if you had: public event EventHandler<ClickEventArgs> Click; ... and then elsewhere you had: button.Click += new EventHandler<EventArgs>(button_C...

In what way do you use delegates and/or events other than for the UI?

I am curious as to how other developers use delegates and/or events other than for responding to UI events? I, personally, don't use them for anything other than responding to UI events but I have a strong feeling that I am missing out on the power of delegates and events. So I pose this question to the SO community so that I may get s...

C# AddEventHandler using Reflection

I have this piece of code that not work public CartaoCidadao() { InitializeComponent(); object o = WebDAV.Classes.SCWatcher.LoadAssembly(); MethodInfo method = this.GetType().GetMethod("Inserted", BindingFlags.NonPublic | BindingFlags.Instance); EventInfo eventInfo = o.GetType().GetEvent("CardInserte...

Custom attached events in WPF

I might be getting the terminology wrong here, but I think I'm trying to create an attached event. In the Surface SDK, you can do things like: <Grid Background="{StaticResource WindowBackground}" x:Name="Foo" s:SurfaceFrameworkElement.ContactChanged="Foo_ContactChanged"/> I want to create a custom event for which a handler can be add...

Intercepting/Hijacking iPhone Touch Events for MKMapView

Is there a bug in the 3.0 SDK that disables real-time zooming and intercepting the zoom-in gesture for the MKMapView? I have some real simple code so I can detect tap events, but there are two problems: zoom-in gesture is always interpreted as a zoom-out none of the zoom gestures update the Map's view in realtime. In hitTest, if I r...

jquery Event.stopPropagation() seems not to work

Am I totally missing what this is supposed to do? I expect that if I call stopPropagation() on an event, handlers for that event won't get triggered on ancestor elements, but the example below isn't working that way (in FireFox 3 at least).. <script type="text/javascript"> $("input").live("click", function(event){ console.log("...

"select" on multiple Python multiprocessing Queues?

What's the best way to wait (without spinning) until something is available in either one of two (multiprocessing) Queues, where both reside on the same system? ...

Why .NET remoting events from server cannot reach clients on different computers

In my case, the server will notify the client to fetch his data when the data is ready. This notification is implemented via an event which the client has to subscribe. When tested in the same computer, the client get notified without any problems. However, when client is moved to the other computer, it cannot get the notifications any...

Use right-click with Windows Forms Button

I am writing an app where the user should be able to alter the action of a button. The user should right-click a button, and choose an option from a pop-up context menu. Once the choice has been made the button will perform a different action when the user uses a normal click. I've already gotten the "Click" event working for a normal...

C#: What are virtual events and how can they be used?

How does a virtual event work? How would you override it? How would that work? And in what cases would you do that? Would it for example be an ok replacement for protected OnEvent methods? So that inheriting classes could just override the event and raise it directly? Or would that be wrong or just not work? The MSDN says this about it...

wxPython, how do I fire events?

Hi, I am making my own button class, subclass of a panel where I draw with a DC, and I need to fire wx.EVT_BUTTON when my custom button is pressed. How do I do it? ...

Handling events fired by Property of ActiveX Control in HTML/Javascript

The following HTML object represents an ActiveX control that has a property named SubSystemA: <object id="MainObject" CLASSID="CLSID:2C327457-D12F-4FC4-BFC2-D7C029003D07" width="0px" height="0px" > <embed name="MainObject"></embed> </object> SubSystemA is a COM object implementing some interface with methods, propertie...

Interesting event "Dispose" behaviour

Hi all, I have noticed interesting behaviour in our .NET WinForms app. We have an mdi form that has many mdi children added. These child forms listen to a "broadcast" event which is in essence a call to refresh itsself. The event is declared in a base class and the listening events added in the child forms. I've noticed that even when ...

Overload the += event operator

Is there a way to overload the event += and -= operators in C#? What I want to do is take an event listener and register it to different events. So something like this: SomeEvent += new Event(EventMethod); Then instead of attaching to SomeEvent, it actually attaches to different events: DifferentEvent += (the listener above); Anot...

Composite WPF EventAggregator subscriptions being lost

In my Composite WPF application I have an event that is published when the user double-clicks on a control. Modules subscribe to the event and perform an action when necessary. This event seems to stop working at random. Sometimes when I run the application I can trigger the event with no problems, other times I can only trigger it a fe...

Handle Events in wxWidgets

I'm creating a game engine using wxWidgets and OpenGL. I'm trying to set up a timer so the game can be updated regularly. I don't want to use wxTimer, because it's probably not accurate enough for what I need. I'm using a while (true) and a wxStopWatch: while (true) { stopWatch.Start(); <handle events> // I need a function for this g...

Emulate a file upload click in jQuery

I have an <img ... /> tag that I have bound a click event to in jQuery. When it is clicked I'd like to have it emulate the click of a button on the file upload to open the file system browse pop-up. I've tried these things within the click function and had no success: ... $(".hiddenUploadBtn").click(); ... ... $(".hiddenUploadBtn").sel...

WatiN Button click Http 500 Internal Server Error

Has anyone ever encountered a HTTP 500 internal server error when clicking a button with WatiN? I have tried Click(); ClickNoWait(); FireEvent("blah"); and all of them bring me to a 500 error page. If you click the button normally with a mouse it works as intended. I have seen WatiN work randomly for this button and I think it might b...