Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > Avalon

EventPublication and EventSubscription not working.

Closed Thread
 
Thread Tools Display Modes
Old 08-15-2007   #1 (permalink)
Richard Lewis Haggard
Guest


 

EventPublication and EventSubscription not working.

I'm having trouble getting EventPublication and EventSubscription to work.
Things compile but the event goes nowhere.

Here's the essentials of the sample application which is simply sending a
string to be passed to the Debug.WriteLine function. I've typed this in from
memory so there could be a typo or two in there but the basic logic should
be correct.

The original program was created using the new project -> WPF window
application wizard.

using System.Diagnostics;
using Microsoft.Practices.CompositUI.EventBroker;
using Microsoft.Practices.CompositUI.Utility;
namespace LoggingExperiment
{
public class Logger
{
[EventSubscription( "TopicTrace", ThreadOption.Publisher )]
public void DoTrace( object sender, DataEventArgs<string> e)
{
Debug.WriteLine( e.Data );
}
}
}

using System;
using Microsoft.Practices.EnterpriseLibrary.Logging;
using Microsoft.Practices.CompositeUI.EventBroker;
using Microsoft.Practices.CompositeUI.Utility;

namespace LoggingExperiemnt
{
public partial class Window1 : System.Windows.Window
{
[EventPublication("TopicTrace", PublicationScope.Global)]
public event EventHandler<DataEventArgs<string>> DoTrace;

public WIndow1()
{
CallTrace(this, "Calling InitializeComponent");
InitializeComponent();
}

public void CallTrace( object sender, string msg )
{
if (DoTrace != null)
{
DoTrace( sender, new DataEventArgs<string>( msg ) );
}
}
}

The code compiles and runs but DoTrace is always null, indicating that the
system never decided that it was necessary to establish the
publish/subscriber relationship. What am I missing?
--
Richard Lewis Haggard
General: www.Haggard-And-Associates.com
Please come visit here for a couple thousand good giggles!:
www.haggard-and-associates.com/Humor/humor.htm


Closed Thread

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
MS Intellipoint stopped working but ctrl panel says working proper Susan C. Vista hardware & devices 0 06-11-2008 06:32 AM
Re: Vista Internet not working, Ping by DNS is working Mark Ellis Vista networking & sharing 0 03-03-2008 05:28 PM
Re: Right click stops working/New tabs stop working/Menu bar disappear Robert Aldwinckle Vista performance & maintenance 9 11-20-2007 03:03 PM
Creative Audigy 2 drivers working on Vista Working SlickWilly Vista hardware & devices 3 06-25-2006 07:49 PM
Smart modem not working - anyone got it working? Arran Vista hardware & devices 0 06-14-2006 05:55 AM








Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50