Ejemplo n.º 1
0
        private void profileGrid_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 0 || e.ColumnIndex == 1)
            {
                var currentProfiles = _profileManager.Fetch();

                var sqlProfile = currentProfiles.SqlProfiles[e.RowIndex];

                //Edit
                if (e.ColumnIndex == 0)
                {
                    ConnectionCreateProfile profileWindow = new ConnectionCreateProfile(_profileManager);

                    profileWindow.SetProfile(sqlProfile);

                    profileWindow.ShowDialog();

                    RefreshList();
                }

                //Delete
                if (e.ColumnIndex == 1)
                {
                    if (MessageBox.Show($"Are you sure you wish to remove the profile '{sqlProfile.Name}'?", "Confirm",
                                        MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                    {
                        currentProfiles.SqlProfiles.Remove(sqlProfile);

                        _profileManager.Update(currentProfiles);

                        RefreshList();
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private void addProfileButton_Click(object sender, EventArgs e)
        {
            var profile = new ConnectionCreateProfile(_profileManager);

            profile.ShowDialog();

            RefreshList();
        }