private void deleteModButton_Click(object sender, EventArgs e) { SortedDictionary <int, Mod> mods = Profiles.currentProfile.mods; DataGridViewRow row = modsListDataGridView.SelectedRows[0]; mods.Remove(Convert.ToInt32(row.Cells[0].Value)); mods = Mods.SortKeys(mods); Profiles.currentProfile.mods = mods; ConfigUI.LoadProfileMods(Profiles.currentProfile.mods); }
public static async Task MoveModUpDown(bool up) { int upDown = up ? 0 : -2; MainForm MainForm_Control = Application.OpenForms.OfType <MainForm>().First(); DataGridView modsListDataGridView = (DataGridView)MainForm_Control.Controls.Find("modsListDataGridView", true).First(); SortedDictionary <int, Mod> mods = Profiles.currentProfile.mods; int pos = Convert.ToInt32(modsListDataGridView.SelectedRows[0].Cells[0].Value); mods = Mods.MoveMod(mods, pos, up); Profiles.currentProfile.mods = mods; ConfigUI.LoadProfileMods(Profiles.currentProfile.mods); modsListDataGridView.ClearSelection(); modsListDataGridView.Rows[pos + upDown].Selected = true; }
private void commitAddModButton_Click(object sender, EventArgs e) { List <string> temp = new List <string>(); temp.Add(modSearchTermTextBox.Text); PublishedFileDetailsResponse wsFile = SteamWorkshop.GetSteamModDetails(temp); if (wsFile.publishedfiledetails == null) { MessageBox.Show("Mod was not found. Please try again."); return; } PublishedFileDetail wsDetail = wsFile.publishedfiledetails[0]; Mod newMod = new Mod() { Name = wsDetail.title, Id = Convert.ToUInt32(modSearchTermTextBox.Text), LastUpdate = SteamWorkshop.FromUnixTime(wsDetail.time_updated) }; Profiles.currentProfile.mods[Profiles.currentProfile.mods.Count + 1] = newMod; Profiles.currentProfile.save(); ConfigUI.LoadProfileMods(Profiles.currentProfile.mods); Close(); }