示例#1
0
        private void buttonDeleteUser_Click(object sender, EventArgs e)
        {
            //if selected
            string captionE = "Delete user";
            string messageE = "Are you sure you want to delet this user?";

            if (MessageBox.Show(messageE, captionE, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                LatchSDK.LatchResponse unpair = null;
                User user_selected            = null;

                Form wait = new LockifiApp.Forms.Wait();
                wait.Show();

                foreach (User user in parent.users)
                {
                    if (dataGridViewUsers.CurrentRow.Cells[1].Value.ToString() == user.name)
                    {
                        user_selected = user;
                        break;
                    }
                }

                try
                {
                    unpair = parent.latch.Unpair(user_selected.accountId);
                }
                catch
                {
                    wait.Close();
                    string       message = "You do not have internet connection";
                    string       caption = "Problem with internet connection";
                    DialogResult result  = MessageBox.Show(message, caption, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                if (unpair.Error != null && unpair.Error.Message != "")
                {
                    wait.Close();
                    string       message = unpair.Error.Message;
                    string       caption = "Latch connection: " + unpair.Error.Code;
                    DialogResult result  = MessageBox.Show(message, caption, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    wait.Close();
                    parent.users.Remove(user_selected);
                    Fill_dataGridViewUsers();
                    //save xml
                    parent.toXML();
                }
            }
        }
示例#2
0
        private void buttonDeleteUser_Click(object sender, EventArgs e)
        {
            string captionE = "Delete user";
            string messageE = "Are you sure you want to delet this user ?";

            if (MessageBox.Show(messageE, captionE, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                LatchSDK.LatchResponse unpair = null;

                Form wait = new Forms.Wait();
                wait.Show();

                try
                {
                    unpair = grandparent.latch.Unpair(current_user.accountId);
                }
                catch
                {
                    wait.Close();
                    string       message = "You do not have internet connection";
                    string       caption = "Problem with internet connection";
                    DialogResult result  = MessageBox.Show(message, caption, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                if (unpair.Error != null && unpair.Error.Message != "")
                {
                    wait.Close();
                    string       message = unpair.Error.Message;
                    string       caption = "Latch connection: " + unpair.Error.Code;
                    DialogResult result  = MessageBox.Show(message, caption, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    grandparent.users.Remove(current_user);
                    wait.Close();
                    this.Close();
                }
            }
        }
示例#3
0
        private void buttonDeleteUser_Click(object sender, EventArgs e)
        {
            string captionE = "Delete user";
            string messageE = "Are you sure you want to delet this user ?";

            if (MessageBox.Show(messageE, captionE, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                LatchSDK.LatchResponse unpair = null;

                Form wait = new Forms.Wait();
                wait.Show();

                try
                {
                    unpair = grandparent.latch.Unpair(current_user.accountId);
                }
                catch
                {
                    wait.Close();
                    string message = "You do not have internet connection";
                    string caption = "Problem with internet connection";
                    DialogResult result = MessageBox.Show(message, caption, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                if (unpair.Error != null && unpair.Error.Message != "")
                {
                    wait.Close();
                    string message = unpair.Error.Message;
                    string caption = "Latch connection: " + unpair.Error.Code;
                    DialogResult result = MessageBox.Show(message, caption, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    grandparent.users.Remove(current_user);
                    wait.Close();
                    this.Close();
                }
            }
        }
示例#4
0
        private void buttonDeleteUser_Click(object sender, EventArgs e)
        {
            //if selected
            string captionE = "Delete user";
            string messageE = "Are you sure you want to delet this user?";

            if (MessageBox.Show(messageE, captionE,MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                LatchSDK.LatchResponse unpair = null;
                User user_selected = null;

                Form wait = new LockifiApp.Forms.Wait();
                wait.Show();

                foreach (User user in parent.users)
                {
                    if (dataGridViewUsers.CurrentRow.Cells[1].Value.ToString() == user.name)
                    {
                        user_selected = user;
                        break;
                    }
                }

                 try
                {
                        unpair = parent.latch.Unpair(user_selected.accountId);
                }
                catch
                {
                    wait.Close();
                    string message = "You do not have internet connection";
                    string caption = "Problem with internet connection";
                    DialogResult result = MessageBox.Show(message, caption, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                if (unpair.Error != null && unpair.Error.Message != "")
                {
                    wait.Close();
                    string message = unpair.Error.Message;
                    string caption = "Latch connection: " + unpair.Error.Code;
                    DialogResult result = MessageBox.Show(message, caption, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    wait.Close();
                    parent.users.Remove(user_selected);
                    Fill_dataGridViewUsers();
                    //save xml
                    parent.toXML();

                }
            }
        }