internal static void Open(string hostAddress) { _launcherDeamon = new LauncherDeamon(); var binding = new NetNamedPipeBinding(NetNamedPipeSecurityMode.None); _launcherDeamon.AddServiceEndpoint(typeof(IHost), binding, hostAddress); _launcherDeamon.Open(); }
/// <summary> /// Starts the host deamon. /// </summary> /// <param name="launcherId">The launcher identifier.</param> /// <returns>ServiceHost.</returns> public void StartHostDeamon(string launcherId) { try { LauncherId = launcherId; Logger.Info("Starting Host Deamon [{0}]...", LauncherId); LauncherDeamon.OnRegisterApplet += (s, e1) => { Logger.Info("Applet [{0}-{1}] requesting registration...", e1.AppletName, e1.Id); if (RunningApps.ContainsKey(e1.AppletName)) { return; } RunningApps.Add(e1.AppletName, e1.Id); Logger.Info("Applet [{0}-{1}] registered!", e1.AppletName, e1.Id); }; LauncherDeamon.OnUnregisterApplet += (s, e1) => { Logger.Info("Applet [{0}-{1}] requesting removal...", e1.AppletName, e1.Id); RunningApps.Remove(e1.AppletName); Logger.Info("Applet [{0}-{1}] removed!", e1.AppletName, e1.Id); }; LauncherDeamon.OnAppletLoaded += (s, e1) => Messenger.Default.Send(new AppletMvvmMessage { Id = e1.Id, AppletName = e1.AppletName, Action = AppletActionEnum.Loaded }); LauncherDeamon.Open(LauncherAddress); Logger.Info("Host Deamon [{0}] is listening!", launcherId); } catch (Exception exception) { Logger.Error(exception.GetCombinedMessages); } }