private void ProfileChangedEvent(object sender, EventArgs e) { var currentCell = ProgramGrid.CurrentCellAddress; var comboBox = sender as DataGridViewComboBoxEditingControl; ProgramManager.entries.programs[currentCell.Y].profile = comboBox.EditingControlFormattedValue.ToString(); ProgramManager.entries.programs[currentCell.Y].ApplyConfig(); ProgramManager.SaveEntries(); }
private void RemoveButton_Click(object sender, EventArgs e) { if (ProgramGrid.SelectedRows.Count > 0) { var entry = ProgramManager.entries.programs[ProgramGrid.CurrentCell.RowIndex]; entry.RemoveConfig(); ProgramManager.entries.programs.Remove(entry); ProgramManager.SaveEntries(); UpdateEntryList(); } }
private void AddButton_Click(object sender, EventArgs e) { if (ProfileManager.profiles.Count == 0) { MessageBox.Show("No profiles have been created. Please create a new profile.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } var result = openProgramDialog.ShowDialog(); if (result == DialogResult.OK) { if (ProgramManager.entries.programs.Any(x => x.path == openProgramDialog.FileName)) { MessageBox.Show("This program has already been added to the list.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } var newEntry = new ProgramManager.ProgramEntry() { icon = null, path = openProgramDialog.FileName, profile = ProfileManager.profiles.First().Key, XIVersion = "Finding..." }; string fileName = openProgramDialog.FileName; int entryIndex = ProgramManager.entries.programs.Count; ProgramManager.entries.programs.Add(newEntry); UpdateEntryList(); Task <Tuple <int, string> > getVersionTask = new Task <Tuple <int, string> >(() => { return(GetXInputVersion(fileName, entryIndex)); }); getVersionTask.Start(); getVersionTask.ContinueWith(task => { ProgramManager.entries.programs[task.Result.Item1].XIVersion = task.Result.Item2; ProgramManager.entries.programs[task.Result.Item1].ApplyConfig(); ProgramManager.SaveEntries(); UpdateEntryList(); }); } }