Ejemplo n.º 1
0
        /// <summary>
        /// Shows CreateGroupForm for editing chosen group (only if user is administartor of the group)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void EditGroupClick(object sender, DataGridViewCellEventArgs e)
        {
            var senderGrid = (DataGridView)sender;
            if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0)
            {
                GroupsViewModel group = groupsBindingSource[e.RowIndex] as GroupsViewModel;
                if (group.owner_id != Globals.CurrentUser.id)
                {
                    MessageBox.Show("Error: You are not the admin of this group!","Not enough priviliges",MessageBoxButtons.OK);
                    return;
                }

                var createForm = new CreateGroupForm(group, true);
                createForm.ShowDialog();
                UpdateGridView();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Shows CreateGroupForm to create new group.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void NewGroupClick(object sender, EventArgs e)
        {
            var createForm = new CreateGroupForm(new GroupsViewModel(), false);
            createForm.ShowDialog();

            UpdateGridView();
        }