private void btEnter_Click(object sender, RoutedEventArgs e) { LoginRequest acesso = new LoginRequest(); acesso.login = txtLogin.Text; acesso.password = txtPassword.Text; object result = WebJson.JsonCommand("http://" + txtIP.Text + "/login.fcgi", acesso, typeof(LoginResult)); if (result is LoginResult) { LoginResult dados = (LoginResult)result; if (dados.session != null) { tInfo.Text = "Sessão: " + dados.session; } else { tInfo.Text = "Erro no Login: "******"Erro Desconhecido: " + result; } else { tInfo.Text = ""; } }
private void btRele_Click(object sender, RoutedEventArgs e) { if (WebJson.lr == null) { tInfo.Text = "Efetue login primeiro"; } else { ActionsRequest ar = new ActionsRequest(); ar.actions = new ActionItem[] { new ActionItem() { action = "door", parameters = "door=1" } }; WebJson.JsonCommand("http://192.168.0.200/execute_actions.fcgi?session=" + WebJson.lr.session, ar, null); } }