private static MobileConnector CreateConnector() { var winHeader = TitleGetter.GetActiveWindowTitle(); if (winHeader.EndsWith("Google Chrome") && ChromeQrDisplayer.ChromeConnection != null) { return(new MobileConnector(ChromeQrDisplayer.ChromeConnection)); } return(new MobileConnector(new QrDisplayerWindow())); }
private static void _passLoad_KeyPressed(object sender, KeyPressedEventArgs e) { var winHeader = TitleGetter.GetActiveWindowTitle(); CreateConnector().ShowQrForAJsonResult <MessageWithPassword>("PULL", new Task <string>(() => JsonConvert.SerializeObject( new MessageWithResourceid(winHeader)))).ContinueWith(result => { if (result.Exception == null && result.Result != null) { SendKeys.SendWait(result.Result.password); } }); }
private static void _passCreate_KeyPressed(object sender, KeyPressedEventArgs e) { var winHeader = TitleGetter.GetActiveWindowTitle(); var passAskerTask = new Task <string>(() => { var passAsker = new PasswordGetterForm(winHeader); var res = passAsker.ShowDialog(); if (res != DialogResult.OK) { return(null); } return(JsonConvert.SerializeObject( new MessageWithPassword(winHeader, passAsker.PasswordResult))); }); CreateConnector().ShowQrForAJsonResult <MessageStatus>("STORE", passAskerTask).ContinueWith(result => { }); }