/// <summary> /// called by the FwLink, which may be running in another application. /// </summary> /// <param name="link"></param> public void Request(FwLink link) { if (OnLinkRequest != null) { //trigger the event on anyone who has subscribed to it OnLinkRequest(link); } }
public void Go(string url) { try { FwLink.Activate(url); } catch (Exception error) { Console.WriteLine(error.Message); Console.WriteLine("Press Enter"); Console.ReadLine(); } }
/// <summary> /// Attempts to find an application which matches the link, and passes the link to that application. /// Does not attempt to launch new applications. /// </summary> /// <param name="link"></param> /// <returns>true if it successfully linked to a running application</returns> public static bool AttemptLink(FwLink link) { try { FwBroker broker = FwBroker.GetBroker(); int port = broker.GetRunningApplicationPort(link.ApplicationName); //note that this will not fail, even if no one is listening on that channel FwLinkListener listener = (FwLinkListener)Activator.GetObject(typeof(FwLinkListener), GetPortPath(port, link.ApplicationName)); //but this will fail if we did not really connect to a listener listener.Request(link); return(true); } catch (Exception error) { } return(false); }
/// <summary> /// called by the FwLink, which may be running in another application. /// </summary> /// <param name="link"></param> public void Request(FwLink link) { if (OnLinkRequest != null ) { //trigger the event on anyone who has subscribed to it OnLinkRequest(link); } }
/// <summary> /// Attempts to find an application which matches the link, and passes the link to that application. /// Does not attempt to launch new applications. /// </summary> /// <param name="link"></param> /// <returns>true if it successfully linked to a running application</returns> public static bool AttemptLink(FwLink link) { try { FwBroker broker = FwBroker.GetBroker(); int port =broker.GetRunningApplicationPort(link.ApplicationName); //note that this will not fail, even if no one is listening on that channel FwLinkListener listener = (FwLinkListener)Activator.GetObject(typeof(FwLinkListener), GetPortPath(port, link.ApplicationName)); //but this will fail if we did not really connect to a listener listener.Request(link); return true; } catch(Exception error) { } return false; }