Search Results

Search found 2 results on 1 pages for 'pfaz'.

Page 1/1 | 1 

  • WPF Dragging a window to the desktop

    - by pfaz
    I've seen some nice Adobe AIR demos where a component of the application is dragged outside of the application and dropped onto the desktop and then continues to run in a new window. This seems to be facilitated by the NativeDragManager class. Is there anything similar in WPF? How would you go about implementing this sort of functionality in WPF to allow a user control to be dragged to the desktop and then continue to run in a new window? This is great for multi-monitor scenarios and exactly what msft have added to vs2010. Regards pfaz

    Read the article

  • EventAggregator, is it thread-safe?

    - by pfaz
    Is this thread-safe? The EventAggregator in Prism is a very simple class with only one method. I was surprised when I noticed that there was no lock around the null check and creation of a new type to add to the private _events collection. If two threads called GetEvent simultaneously for the same type (before it exists in _events) it looks like this would result in two entries in the collection. /// <summary> /// Gets the single instance of the event managed by this EventAggregator. Multiple calls to this method with the same <typeparamref name="TEventType"/> returns the same event instance. /// </summary> /// <typeparam name="TEventType">The type of event to get. This must inherit from <see cref="EventBase"/>.</typeparam> /// <returns>A singleton instance of an event object of type <typeparamref name="TEventType"/>.</returns> public TEventType GetEvent<TEventType>() where TEventType : EventBase { TEventType eventInstance = _events.FirstOrDefault(evt => evt.GetType() == typeof(TEventType)) as TEventType; if (eventInstance == null) { eventInstance = Activator.CreateInstance<TEventType>(); _events.Add(eventInstance); } return eventInstance; }

    Read the article

1