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 7854983
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T20:14:57+00:00 2026-06-02T20:14:57+00:00

I have a WCF service lib and client[Winform] that connect using netTCPbinding. the client

  • 0

I have a WCF service lib and client[Winform] that connect using netTCPbinding.
the client called a function Search(string txtSearch,string path) and the server should send back the result, but i don’t want the client to wait for results, i need the server to send it back Independently. so whenever the server send back an item, the client should add it to listView1 .

here’s a little code of the client application, So how could i need to access listView1 from Callback class if it’s possible!

public partial class Form1 : Form
{
    FileManagerClient client;
    public Form1()
    {
        InitializeComponent();
        InstanceContext ctx = new InstanceContext(new Callback());
        client = new FileManagerClient(ctx);
    }
}

class Callback : IFileManagerCallback
{
   public void Folder(_Folder folder)
   {
         ListViewItem item = new ListViewItem();
         item.Text = folder.Name;
         item.ToolTipText = folder.Path;
         item.Tag = item.ImageIndex;
         item.Name = item.Text;
         //Add item to listView1
   }

   public void File(_File file)
   {
         ListViewItem item = new ListViewItem();
         item.Text = file.Name;
         item.ToolTipText = file.Path;
         item.Tag = item.ImageIndex;
         item.Name = item.Text;
         //Add item to listView1
   }
}
  • 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-06-02T20:14:57+00:00Added an answer on June 2, 2026 at 8:14 pm

    Implement event

     public partial class Form1 : Form
    {
        FileManagerClient client;
        public Form1()
        {
            InitializeComponent();
            Callback callback = new Callback();
            //Subscribe event for notification
            callback.OnDataReceivedEvent +=new Callback.OnDataReceived(callback_OnDataReceivedEvent);
            InstanceContext ctx = new InstanceContext(callback);
            client = new FileManagerClient(ctx);
        }
    
        private void callback_OnDataReceivedEvent(object sender, ListViewItem item)
        {
            //Add item here
        }
    }
    
    class Callback : IFileManagerCallback
    {
        private delegate void OnDataReceived(object sender, ListViewItem item);
    
        private OnDataReceived _dataReceivedHandler = null;
        public event OnDataReceived OnDataReceivedEvent {
            add { _dataReceivedHandler += value; }
            remove { _dataReceivedHandler -= value; }
        }
    
        public void Folder(_Folder folder)
        {
            ListViewItem item = new ListViewItem();
            item.Text = folder.Name;
            item.ToolTipText = folder.Path;
            item.Tag = item.ImageIndex;
            item.Name = item.Text;
            RaiseEvents(item);
            //Add item to listView1
        }
    
        public void File(_File file)
        {
            ListViewItem item = new ListViewItem();
            item.Text = file.Name;
            item.ToolTipText = file.Path;
            item.Tag = item.ImageIndex;
            item.Name = item.Text;
            RaiseEvents(item);
            //Add item to listView1
        }
    
        private void RaiseEvents(ListViewItem item)
        {
            if (_dataReceivedHandler != null)
            {
                _dataReceivedHandler(this, item);
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a WCF service that needs to hosted using basicHttpBinding using SSL. So
It is possible to have WCF Client that connects persistantly using duplex over net.tcp
I have a WCF service using netMsmqBinding and a client consuming it. I send
I have a WCF service that I am connecting in client application. I am
I have a wcf service which exposes a function that returns a complex type
I have a WCF service that accesses a SQL database to fetch data .
I have a WCF service that I need to call in a ASP.NET web
I have a WCF service that I can debug. I put a breakpoint in
I have a WCF service that can return large amount of data depending on
I have a WCF Service Using MSMQ hosted on IIS. I want to create

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.