Exemplo n.º 1
0
        private void HyperLinkGetQRCode_Click(object sender, RoutedEventArgs e)
        {
            this.m_LocalSettings.Password = this.PasswordBoxPassword.Password;
            JObject   apiRequest  = APIRequestHelper.GetQRCodeMessage(this.m_LocalSettings.UserName, this.m_LocalSettings.Password);
            APIResult apiResponse = APIRequestHelper.SubmitAPIRequestMessage(apiRequest);

            bool isAuthenticated = Convert.ToBoolean(apiResponse.JSONResult["result"]["isAuthenticated"].ToString());

            if (isAuthenticated == true)
            {
                string base64String = apiResponse.JSONResult["result"]["qrCodeImage"].ToString().Replace("data:image/png;base64,", string.Empty);
                this.m_LocalSettings.QRCodeImage = base64String;
                this.m_LocalSettings.Serialize();

                this.LoadQRCodeImage(base64String);
            }
            else
            {
                MessageBox.Show("We were unable to find a match for that Username and Password combination.");
            }
        }