Ejemplo n.º 1
0
        private void buttonEdit_Click(object sender, EventArgs e)
        {
            if (dataGridViewValues.SelectedRows.Count <= 0)
            {
                return;
            }
            int currentProfile = dataGridViewValues.SelectedRows[0].Index;
            var editor         = new ProfileEditor {
                Profile = Profiles.List[currentProfile]
            };

            if (editor.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            Profile profile = editor.Profile;

            if (profile == null)
            {
                return;
            }

            Profiles.List[currentProfile]    = profile;
            profilesBindingSource.DataSource = Profiles.List;
            profilesBindingSource.ResetBindings(false);
        }
Ejemplo n.º 2
0
        // todo: clean this up, change how it's done
        public void AddProfile(Profile profile)
        {
            var editor = new ProfileEditor {Profile = profile};
            if (editor.ShowDialog() != DialogResult.OK) return;
            Profile editorProfile = editor.Profile;
            if (editorProfile == null) return;

            Profiles.List.Add(editorProfile);
            profilesBindingSource.DataSource = Profiles.List;
            profilesBindingSource.ResetBindings(false);
        }
Ejemplo n.º 3
0
        private void buttonEditProfile_Click(object sender, EventArgs e)
        {
            var editor = new ProfileEditor {
                Profile = (Profile)comboBoxProfiles.SelectedItem
            };

            if (editor.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            Profiles.List[comboBoxProfiles.SelectedIndex] = editor.Profile;

            profilesSource.DataSource = Profiles.List;
            profilesSource.ResetBindings(false);
            labelProfileInformation.Text = ((Profile)comboBoxProfiles.SelectedItem).ProfileInformation();
        }
Ejemplo n.º 4
0
        private void buttonNew_Click(object sender, EventArgs e)
        {
            var editor = new ProfileEditor();

            if (editor.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            Profile profile = editor.Profile;

            if (profile == null)
            {
                return;
            }
            Profiles.List.Add(profile);
            profilesBindingSource.DataSource = Profiles.List;
            profilesBindingSource.ResetBindings(false);
        }
Ejemplo n.º 5
0
        // todo: clean this up, change how it's done
        public void AddProfile(Profile profile)
        {
            var editor = new ProfileEditor {
                Profile = profile
            };

            if (editor.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            Profile editorProfile = editor.Profile;

            if (editorProfile == null)
            {
                return;
            }

            Profiles.List.Add(editorProfile);
            profilesBindingSource.DataSource = Profiles.List;
            profilesBindingSource.ResetBindings(false);
        }
Ejemplo n.º 6
0
        private void buttonEditProfile_Click(object sender, EventArgs e)
        {
            var editor = new ProfileEditor {Profile = (Profile) comboBoxProfiles.SelectedItem};
            if (editor.ShowDialog() != DialogResult.OK) return;
            Profiles.List[comboBoxProfiles.SelectedIndex] = editor.Profile;

            profilesSource.DataSource = Profiles.List;
            profilesSource.ResetBindings(false);
            labelProfileInformation.Text = ((Profile) comboBoxProfiles.SelectedItem).ProfileInformation();
        }
Ejemplo n.º 7
0
        private void buttonEdit_Click(object sender, EventArgs e)
        {
            if (dataGridViewValues.SelectedRows.Count <= 0) return;
            int currentProfile = dataGridViewValues.SelectedRows[0].Index;
            var editor = new ProfileEditor {Profile = Profiles.List[currentProfile]};
            if (editor.ShowDialog() != DialogResult.OK) return;

            Profile profile = editor.Profile;
            if (profile == null) return;

            Profiles.List[currentProfile] = profile;
            profilesBindingSource.DataSource = Profiles.List;
            profilesBindingSource.ResetBindings(false);
        }
Ejemplo n.º 8
0
 private void buttonNew_Click(object sender, EventArgs e)
 {
     var editor = new ProfileEditor();
     if (editor.ShowDialog() != DialogResult.OK) return;
     Profile profile = editor.Profile;
     if (profile == null) return;
     Profiles.List.Add(profile);
     profilesBindingSource.DataSource = Profiles.List;
     profilesBindingSource.ResetBindings(false);
 }