public BrowserHostService(string extensionId) { _pluginSvcLock = new AsyncLock(); _browserRespLock = new AsyncManualResetEvent(false); _extensionId = extensionId; _host = new NativeMessagingHost(); }
private static async Task Main(string[] args) { var host = new NativeMessagingHost(); try { while (true) { var response = await host.Read <Message>(); // Echo response await host.Write(new Message($"You said {response.Value} at {response.DateTime}")); } } catch (EndOfStreamException) { // Disconnected } catch (Exception exception) { await host.Write(new Message($"Error: {exception}")); Console.WriteLine($"Oh 💩: {exception}"); Environment.FailFast("Oh 💩", exception); } }
public OptionsForm(ConfigOpt config) { _host = NativeMessagingHost.GetHost(); _config = config; InitializeComponent(); lblVersion.Text = string.Format("KeePassNatMsg v{0}", AssemblyVersion); }
private async Task StartAsync() { var host = new NativeMessagingHost(); await host.StartListeningAsync(async message => { //string request = JsonConvert.DeserializeObject<Message>(message).Text; Message receivedMessage = JsonConvert.DeserializeObject <Message>(message); Message responseMessage = await ComputeResponseAsync(receivedMessage); return(JsonConvert.SerializeObject(responseMessage)); }, CleanUpAsync); }
static async Task Main(string[] args) { var host = new NativeMessagingHost(); try { await host.Read <dynamic>(); await host.Write(new { hostName = $"{Environment.MachineName}" }); } catch (Exception exception) { await host.Write(new { error = $"{exception}" }); } }
private void OptionsForm_Shown(object sender, EventArgs e) { _host = NativeMessagingHost.GetHost(); CheckNativeMessagingHost(); }
public OptionsForm(ConfigOpt config) { _host = NativeMessagingHost.GetHost(); _config = config; InitializeComponent(); }