Example #1
0
        private ProfileForm(ProfilesFile profiles, bool copy = false)
        {
            Profiles = profiles;

            InitializeComponent();

            if (!copy && CurrentProfile.IsDefault)
            {
                Label_NoEdit.Visible        = true;
                ComboBox_Type.Enabled       = false;
                TextBox_ProfileName.Enabled = false;
                ComboBox_Version.Enabled    = false;
            }

            ComboBox_Type.DataSource    = ProfileType.ToArray();
            ComboBox_Type.SelectedIndex = ProfileType.GetIndex(CurrentProfile.ProfileType);

            if (copy)
            {
                TextBox_ProfileName.Text = $"Copy of {CurrentProfile.Name}";
            }
            else
            {
                TextBox_ProfileName.Text = CurrentProfile.Name;
                OldProfile = CurrentProfile;
            }
            ComboBox_Version.SelectedIndex = ComboBox_Version.Items.IndexOf(CurrentProfile.Version.ToString());
            TextBox_LaunchArgs.Text        = CurrentProfile.LaunchArgs;

            ComboBox_GameMode.Items.AddRange(CurrentProfile.Folder.GameModeFolder.GetGameModes().Select(gm => gm.ModificationInfo.Name).ToArray());


            var chk = new DataGridViewCheckBoxColumn {
                Name = "Enabled"
            };

            DataGridView_Modifications.Columns.Add(chk);
            DataGridView_Modifications.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.ColumnHeader;

            var list = new BindingList <ModificationInfoTable>(new List <ModificationInfoTable>());

            DataGridView_Modifications.DataSource = list;
        }