예제 #1
0
        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()));
        }
예제 #2
0
        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);
                }
            });
        }
예제 #3
0
        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 => { });
        }