From 59e4b137c572653f8b9c9a839f9f3c36c46a9927 Mon Sep 17 00:00:00 2001 From: Leonardo Domingues Date: Fri, 3 Dec 2021 18:14:18 -0300 Subject: [PATCH] Dialog Methods --- api/wingui/cli.go | 68 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/api/wingui/cli.go b/api/wingui/cli.go index 1ea6a73..57f01b7 100644 --- a/api/wingui/cli.go +++ b/api/wingui/cli.go @@ -2,6 +2,7 @@ package wingui import ( "fmt" + "time" "go.digitalcircle.com.br/open/replaycli-go/api" ) @@ -97,6 +98,11 @@ func (c *Cli) MouseClickAt(x, y int) error { return err } +func (c *Cli) MouseDrag(x, y int, btn string) error { + err := c.HttpCli().JsonGet(fmt.Sprintf("/ipc/wingui/mouse/drag?x=%d&y=%d&btn=%s", x, y, btn), nil) + return err +} + /***************** KB Functions *****************/ func (c *Cli) KBTap(t string) (map[string]interface{}, error) { @@ -432,6 +438,68 @@ func (c *Cli) ScreenDsExtend(fmt string) error { return err } +/***************** Dialog Functions *****************/ + +func (c *Cli) DialogColor(t, d string) (ret map[string]int, err error) { + err = c.HttpCli().JsonGet(fmt.Sprintf("/ipc/wingui/dialog/color?t=%s&d=%s", t, d), &ret) + return ret, err +} + +func (c *Cli) DialogDate(t, m, d, f string) (ret time.Time, err error) { + err = c.HttpCli().JsonGet(fmt.Sprintf("/ipc/wingui/dialog/date?t=%s&m=%s&d=%s&f=%s", t, m, d, f), &ret) + return ret, err +} + +func (c *Cli) DialogEntry(t, m, d string) (ret string, err error) { + err = c.HttpCli().JsonGet(fmt.Sprintf("/ipc/wingui/dialog/entry?t=%s&m=%s&d=%s", t, m, d), &ret) + return ret, err +} + +func (c *Cli) DialogError(t, m string) error { + err := c.HttpCli().JsonGet(fmt.Sprintf("/ipc/wingui/dialog/error?t=%s&m=%s", t, m), nil) + return err +} + +func (c *Cli) DialogFile(t, f, d string) (ret string, err error) { + err = c.HttpCli().JsonGet(fmt.Sprintf("/ipc/wingui/dialog/file?t=%s&f=%s&d=%s", t, f, d), &ret) + return ret, err +} + +func (c *Cli) DialogFileMulti(t, f string) (ret []string, err error) { + err = c.HttpCli().JsonGet(fmt.Sprintf("/ipc/wingui/dialog/filemulti?t=%s&f=%s", t, f), &ret) + return ret, err +} + +func (c *Cli) DialogInfo(t, m string) error { + err := c.HttpCli().JsonGet(fmt.Sprintf("/ipc/wingui/dialog/info?t=%s&m=%s", t, m), nil) + return err +} + +func (c *Cli) DialogList(t, m, f string) (ret string, err error) { + err = c.HttpCli().JsonGet(fmt.Sprintf("/ipc/wingui/dialog/list?t=%s&m=%s&f=%s", t, m, f), &ret) + return ret, err +} + +func (c *Cli) DialogListMulti(t, m, f string) (ret []string, err error) { + err = c.HttpCli().JsonGet(fmt.Sprintf("/ipc/wingui/dialog/listmulti?t=%s&m=%s&f=%s", t, m, f), &ret) + return ret, err +} + +func (c *Cli) DialogPassword(t, m string) (ret string, err error) { + err = c.HttpCli().JsonGet(fmt.Sprintf("/ipc/wingui/dialog/password?t=%s&m=%s", t, m), &ret) + return ret, err +} + +func (c *Cli) DialogQuestion(t, m string) (ret bool, err error) { + err = c.HttpCli().JsonGet(fmt.Sprintf("/ipc/wingui/dialog/question?t=%s&m=%s", t, m), &ret) + return ret, err +} + +func (c *Cli) DialogWarn(t, m string) error { + err := c.HttpCli().JsonGet(fmt.Sprintf("/ipc/wingui/dialog/warn?t=%s&m=%s", t, m), nil) + return err +} + func NewCli() *Cli { ret := &Cli{ApiCli: api.NewApiCli()} return ret