private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            bool?nullable = new UserEditDialog().ShowDialog();
            bool flag     = true;

            if ((nullable.GetValueOrDefault() == flag ? (nullable.HasValue ? 1 : 0) : 0) == 0)
            {
                return;
            }
            this.RefreshData();
        }
        private void editAccountButton_Click(object sender, EventArgs e)
        {
            if (accountView.SelectedItems.Count > 0)
            {
                string selectedAccountUsername =
                    accountView.SelectedItems[0].Text;
                UserEditDialog editUserDialog = new UserEditDialog(
                    settings.GetUser(selectedAccountUsername));

                if (editUserDialog.ShowDialog() == DialogResult.OK)
                {
                    unsavedChanges = true;
                    RefreshAccountView();
                }
            }
        }
        private void btnEdit_Click(object sender, RoutedEventArgs e)
        {
            Button         btn  = sender as Button;
            UsersEntity    user = btn.Tag as UsersEntity;
            UserEditDialog view = new UserEditDialog();

            view.Model = JSONHelper.Deserialize <UsersEntity>(JSONHelper.Serialize(user));
            bool?nullable = view.ShowDialog();
            bool flag     = true;

            if ((nullable.GetValueOrDefault() == flag ? (nullable.HasValue ? 1 : 0) : 0) == 0)
            {
                return;
            }
            RefreshData();
        }
        private void addAccountButton_Click(object sender, EventArgs e)
        {
            UserEditDialog newUserDialog = new UserEditDialog();

            if (newUserDialog.ShowDialog() == DialogResult.OK)
            {
                if (settings.ContainsAccount(newUserDialog.Account.Username))
                {
                    MessageBox.Show("The specified username is already " +
                                    "taken by another account and can't be added.",
                                    "Invalid username", MessageBoxButtons.OK,
                                    MessageBoxIcon.Warning);
                }
                else
                {
                    settings.AddUser(newUserDialog.Account);
                    unsavedChanges = true;
                    RefreshAccountView();
                }
            }
        }