Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6716487
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:44:22+00:00 2026-05-26T08:44:22+00:00

Just… doing some practices. Structure: A Client WPF App and a Server WPF App,

  • 0

Just… doing some practices.

Structure:

A Client WPF App and a Server WPF App, both of them Self Host a WCF service.

Client WPF contains a View, which contains the ListBox

What I want to do:

  1. Server WPF will create channels to the Client’s WCF and constantly Send Message.

  2. Client’s WCF will receive the message and boardcast to any classes that subscribe it. (Or maybe I will say the classes that observe it).

  3. In this case, the Client’s View should receive message and put into the listbox.

Problems:

So the problem is how do I let the View observe the WCF? Or get notify by the WCF?

The Client’s WCF is created by using ServiceHost myHost = new ServiceHost(typeof(MyClient));

How can I let the WCF have reference to my Client’s View and do the notification?

Throught:

  1. Somehow hardcoding the Client’s WCF to have the View reference internally (this…doesn’t make sense)

  2. Observer Pattern? Make a static Subject class tht’s implement Client’s WCF Interface.
    In the Client’s will routers all the methods calls to Subject class. The View will also implement Client’s WCF Interface and attaches to Subject class. Finally Subject class will routers calls to all the Views….

Something like this:

public class ClientServiceObserver : IClient
{
    static List<IClient> _observers = new List<IClient>();

    public static void Attach(IClient client)
    {
        _observers.Add(client);
    }

    public static void Detach(IClient client)
    {
        _observers.Remove(client);
    }

    public void SendCallbackMessage(string message)
    {
        foreach (IClient client in _observers)
        {
            client.SendCallbackMessage(message);
        }
    }
}

3.Everything similar to option 2, but instead of router all calls everywhere, might as well let WCF just notify Subject class there is update, then View will just get notify and create channel to Server to get it own data…..

All above options doens’t really sounds good… and option 2 I don’t even know if that’s Observer Patterns anymore….

I wonder what will be the best practice to do it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T08:44:23+00:00Added an answer on May 26, 2026 at 8:44 am

    Please look EventAggregator pattern to achieve what you are trying. EvenAggregator implementation are available in

    1. MVVM Light
    2. Microsoft PRISM
    3. Caliburn.Micro

    See example for using EventAggregator here

    You do not need to use the complete framework mentioned here, you can pull out the EventAggregator class and use it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just getting started with Lucene.Net. I indexed 100,000 rows using standard analyzer, ran some
Just curious. Does anyone have experience with both. My gut feeling is that QT
Just opening a WPF solution (not a winforms or any other solution) will cause
Just doing a little introduction to JavaScript. I'm used to more than often testing
just stuck with strange thing. I have the following code: -(void)ImageDownloadCompleat { [self performSelectorOnMainThread:@selector(updateImageButton:)
Just as an example, let’s take a method for getting the App Support directory.
Just what the title says, I need to change the password for an existing
Just looking for the first step basic solution here that keeps the honest people
just a quick question: I am a CS undergrad and have only had experience
Just bought a 2.4GHz Intel Core 2 Duo iMac with 2GB of memory and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.