/// <summary> /// Shows the Finsemble Linker Window /// </summary> /// <param name="left">Left of Linker Window relative to the current window (default 0)</param> /// <param name="top">Top of Linker Window relative to the current window (default 30)</param> public void ShowLinkerWindow(double left = 0, double top = 30) { var channelsToSend = new JArray { }; if (channels != null) { foreach (var item in channels) { var channelinfo = allChannels.Where(jt => jt["name"].ToString() == item.ToString())?.First(); if (channelinfo != null) { channelsToSend.Add(channelinfo); } } } JObject data = new JObject { ["channels"] = channelsToSend, ["windowIdentifier"] = windowClient.windowIdentifier }; routerClient.Query("Finsemble.LinkerWindow.SetActiveChannels", data, new JObject { }, delegate(object sender, FinsembleEventArgs e) { Application.Current.Dispatcher.Invoke((Action) delegate //main thread { var wi = new JObject { ["componentType"] = "linkerWindow" }; var parameters = new JObject { ["position"] = "relative", ["left"] = left, ["top"] = top, ["spawnIfNotFound"] = false }; launcherClient.ShowWindow(wi, parameters, (EventHandler <FinsembleEventArgs>) delegate(object s2, FinsembleEventArgs e2) { }); }); }); }
private void RPC(string endpoint, List <JToken> args, EventHandler <FinsembleEventArgs> cb) { switch (endpoint) { case "RouterClient.transmit": RouterClient.Transmit((string)args[0], args[1]); break; case "RouterClient.addListener": RouterClient.AddListener((string)args[0], cb); break; case "RouterClient.removeListener": RouterClient.RemoveListener((string)args[0], cb); break; case "RouterClient.publish": RouterClient.Publish((string)args[0], args[1]); break; case "RouterClient.subscribe": RouterClient.Subscribe((string)args[0], cb); break; case "RouterClient.unsubscribe": RouterClient.Unsubscribe((string)args[0], cb); break; case "RouterClient.query": RouterClient.Query((string)args[0], args[1], args[2] as JObject, cb); break; case "LinkerClient.publish": LinkerClient.Publish(args[0] as JObject); break; case "LinkerClient.subscribe": LinkerClient.Subscribe((string)args[0], cb); break; case "LauncherClient.spawn": LauncherClient.Spawn((string)args[0], args[1] as JObject, cb); break; case "LauncherClient.showWindow": LauncherClient.ShowWindow(args[0] as JObject, args[1] as JObject, cb); break; case "ConfigClient.getValue": ConfigClient.GetValue(args[0] as JObject, cb); break; case "AuthenticationClient.publishAuthorization": authenticationClient.PublishAuthorization <JObject>((string)args[0], args[1] as JObject); break; case "AuthenticationClient.getCurrentCredentials": authenticationClient.GetCurrentCredentials <JObject>((s, a) => { cb(this, new FinsembleEventArgs(null, a)); }); break; case "Logger.error": JToken[] argsArray = args.ToArray(); logger.Error(argsArray); break; case "Logger.warn": logger.Warn(args.ToArray()); break; case "Logger.log": logger.Log(args.ToArray()); break; case "Logger.info": logger.Info(args.ToArray()); break; case "Logger.debug": logger.Debug(args.ToArray()); break; case "Logger.verbose": logger.Verbose(args.ToArray()); break; default: throw new Exception("This API does not exist or is not yet supported"); } }