public Receiver() { InitializeComponent(); LocalMessageReceiver messageReceiver = new LocalMessageReceiver("receiver", ReceiverNameScope.Global, LocalMessageReceiver.AnyDomain); messageReceiver.MessageReceived += messageReceiver_MessageReceived; try { messageReceiver.Listen(); } catch (ListenFailedException) { output.Text = "Cannot receive messages." + Environment.NewLine + "There is already a receiver with the name 'receiver'."; } }
private void Page_Loaded(object sender, RoutedEventArgs e) { receiver.MessageReceived += receiver_MessageReceived; receiver.Listen(); }