예제 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            this.usuario   = usuarioInput.Text;
            this.password  = passwordInput.Text;

            if (this.usuario.Length > 0 && this.password.Length > 0)
            {
                //TODO validate account with API
                RESTClient httpClient = new RESTClient("http://localhost:8080/tareas", httpVerb.GET);
                // -----
                string response = string.Empty;

                response = httpClient.makeRequest();
                Console.WriteLine(response);
                if (httpClient.errorRequest)
                {
                    Form errorResponseForm = new FormErrorResponse();
                    errorResponseForm.Show();
                }
                else
                {
                    this.Hide();
                    var tasksForm = new FormBuscadorTareas();
                    tasksForm.Closed += (s, args) => this.Close();
                    tasksForm.Show();
                }
            }
            else
            {
                Form errorInput = new FormErrorInputLogin();
                errorInput.Show();
            }
        }
예제 #2
0
        public FormBuscadorTareas()
        {
            InitializeComponent();
            Cursor.Current = Cursors.WaitCursor;
            RESTClient httpClient = new RESTClient("http://localhost:8080/tareas", httpVerb.GET);
            string     response   = httpClient.makeRequest();

            if (httpClient.errorRequest)
            {
                new FormErrorResponse().Show();
            }
            else
            {
                Cursor.Current = Cursors.Default;
                tareas         = JsonConvert.DeserializeObject <List <Tarea> >(response);

                tableTarea.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
                tableTarea.DataSource          = tareas;
            }
        }
예제 #3
0
        private void searchTareas()
        {
            Cursor.Current = Cursors.WaitCursor;
            RESTClient httpClient = new RESTClient("http://localhost:8080/tareas", httpVerb.GET);
            string     response   = httpClient.makeRequest();

            if (httpClient.errorRequest)
            {
                new FormErrorResponse(httpClient.errorMessage).Show();
            }
            else
            {
                Cursor.Current = Cursors.Default;
                tareas         = JsonConvert.DeserializeObject <List <Tarea> >(response);

                tableTarea.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
                tableTarea.DataSource          = tareas;
                searchText.Text  = "";
                priorityBox.Text = "Prioridad";
            }
        }
예제 #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            this.usuario   = userInput.Text;
            this.password  = passwordInput.Text;

            if (this.usuario.Length > 0 && this.password.Length > 0)
            {
                RESTClient httpClient = new RESTClient("http://localhost:8080/signup", httpVerb.POST);

                string response = string.Empty;

                string body = "{\"username\":\"" + usuario + "\"," +
                              "\"password\":\"" + password + "\"}";

                response = httpClient.makeBodyRequest(body);
                Console.WriteLine(response);
                if (httpClient.errorRequest)
                {
                    Form errorResponseForm = new FormErrorResponse(response);
                    errorResponseForm.Show();
                }
                else
                {
                    this.Hide();
                    Usuario user      = JsonConvert.DeserializeObject <Usuario>(response);
                    var     tasksForm = new FormBuscadorTareas(user);
                    tasksForm.Closed += (s, args) => this.Close();
                    tasksForm.Show();
                }
            }
            else
            {
                Form errorInput = new FormErrorInput();
                errorInput.Show();
            }
        }