예제 #1
0
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex >= this.persons.Length) return;

                Person person = this.persons[e.RowIndex];

                if (person == null) return;

                var person_view = new PersonView(serverClient, person);
                person_view.Visible = true;
        }
예제 #2
0
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 0)
            {
                if (e.RowIndex >= persons.Count) return;

                Person person =
                    persons.FirstOrDefault(p => p.Nif == (int) dataGridView1.Rows[e.RowIndex].Cells[0].Value);

                if (person == null) return;

                var person_view = new PersonView(serverClient, person);

                try
                {
                    /*
                    serverClient.GetRegistsAsync(person.Id).ContinueWith((r) =>
                    {
                        person_view.SetRegists(r.Result);
                    });
                    */
                    serverClient.GetBiometricTypeAsync(person.Nif, "face").
                        ContinueWith(b => { person_view.SetImage(b.Result); });
                    person_view.Visible = true;
                    Closing += (o, args) => person_view.Close();
                }
                catch (Exception exception)
                {
                    if (person_view != null || !person_view.IsDisposed)
                    {
                        person_view.Close();
                    }

                    var info = new InfoForm();
                    info.Add(exception.Message);
                    info.ShowDialog(this);
                    info.Dispose();
                }
            }
        }