private void CheckNativeMessagingHost() { var t = new Task <bool>(() => _host.GetBrowserStatuses().Any(bs => bs.Value == BrowserStatus.Installed)); var t2 = t.ContinueWith((ti) => { if (ti.IsCompleted && !ti.Result) { var nmiInstall = MessageBox.Show(this, $"The native messaging host was not detected. It must be installed for KeePassNatMsg to work. Do you want to install it now?", "Native Messaging Host Not Detected", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (nmiInstall == DialogResult.Yes) { var bsf = new BrowserSelectForm(_host); if (bsf.ShowDialog(this) == DialogResult.OK) { _host.Install(bsf.SelectedBrowsers); _host.UpdateProxy(); MessageBox.Show(this, "The native messaging host installed completed successfully.", "Install Complete", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } GetNativeMessagingStatus(); }); lblProxyVersion.Text = "Loading Native Messaging Status..."; t.Start(); }
private void CheckNativeMessagingHost() { var t = new Task <bool>(() => _host.GetBrowserStatuses().Any(bs => bs.Value == BrowserStatus.Installed)); var t2 = t.ContinueWith((ti) => { if (ti.IsCompleted && !ti.Result) { Invoke(new Action(() => PromptInstall())); } GetNativeMessagingStatus(); }); SetProxyVersionText("Loading Native Messaging Status..."); t.Start(); }