Can Silverlight detect or exchange data between browsers?

The user launches the silverlight application in his browser, navigating to the given URL.

Then the user opens another browser and launches the same silverlight application, navigating to the same URL.

Can a second application instance detect that there is already an instance running on the same computer?

Can it detect itself if both applications work in the same browser instance?

I would expect the answer to be no, but I thought that I would ask him anyway. Otherwise, I believe that I will need to configure the web service and register each instance and send requests to other instances from the same IP address. does that sound reasonable?

+4
source share
3 answers

I think you can search for LocalMessageSender and LocalMessageReceiver . I believe these are new classes in Silverlight 3 that allow two Silverlight applications to run on the same local computer for communication.

Read more: Communication between local Silverlight-based applications (msdn)

+6
source

It will work, I did it myself. This code from the Microsoft website demonstrates how you configured the LocalMessage receiver. If it throws an error, this is because another instance of the Silverlight application is already running.

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'."; } } 
+5
source

I think you're right, you can’t do this cross-application, but you can do it in one browser instance using cookies or Isolated storage .

0
source

Source: https://habr.com/ru/post/1308504/


All Articles