Пример #1
0
        private void btn_new_Click(object sender, EventArgs e)
        {
            FrmProfile frmProfile = new FrmProfile();
            Profile    p          = frmProfile.Create();

            if (p != null)
            {
                Program.profiles.Add(p);
                Profile.Save(Program.profiles);
                Program.Update();
                ReloadProfiles();
                list_profiles.SelectedIndex = list_profiles.Items.Count - 1;
            }
        }
Пример #2
0
        private void btn_edit_Click(object sender, EventArgs e)
        {
            int idx = list_profiles.SelectedIndex;

            if (idx != -1)
            {
                FrmProfile frmProfile = new FrmProfile();

                Profile p = frmProfile.Edit(Program.profiles[idx]);

                if (p != null)
                {
                    Program.profiles[idx] = p;
                    Profile.Save(Program.profiles);
                    Program.Update();
                    ReloadProfiles();
                    list_profiles.SelectedIndex = idx;
                }
            }
        }