Inheritance: Queue.UI.WinForms.DependencyForm
示例#1
0
        private void addUserButton_Click(object sender, EventArgs e)
        {
            DataGridViewRow row = null;

            if (usersTabs.SelectedTab.Equals(operatorsTabPage))
            {
                using (var f = new EditOperatorForm())
                {
                    f.Saved += (s, eventArgs) =>
                    {
                        if (row == null)
                        {
                            row = usersGridView.Rows[usersGridView.Rows.Add()];
                        }
                        RenderUsersGridRow(row, f.Operator);
                        f.Close();
                    };

                    f.ShowDialog();
                }
            }
            else if (usersTabs.SelectedTab.Equals(administratorsTabPage))
            {
                using (var f = new EditAdministratorForm())
                {
                    f.Saved += (s, eventArgs) =>
                    {
                        if (row == null)
                        {
                            row = usersGridView.Rows[usersGridView.Rows.Add()];
                            row.Selected = true;
                        }
                        RenderUsersGridRow(row, f.Administrator);
                        f.Close();
                    };

                    f.ShowDialog();
                }
            }
        }
示例#2
0
        private void usersGridView_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            int rowIndex = e.RowIndex,
                columnIndex = e.ColumnIndex;

            if (rowIndex >= 0 && columnIndex >= 0)
            {
                var row = usersGridView.Rows[rowIndex];
                User user = row.Tag as User;

                if (user is QueueOperator)
                {
                    using (var f = new EditOperatorForm(user.Id))
                    {
                        f.Saved += (s, eventArgs) =>
                        {
                            RenderUsersGridRow(row, f.Operator);
                            f.Close();
                        };

                        f.ShowDialog();
                    }
                }
                else if (user is QueueAdministrator)
                {
                    using (var f = new EditAdministratorForm(user.Id))
                    {
                        f.Saved += (s, eventArgs) =>
                        {
                            RenderUsersGridRow(row, f.Administrator);
                            f.Close();
                        };

                        f.ShowDialog();
                    }
                }
            }
        }