private async void LoadToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (ModListView.Items.Count != 0)
            {
                DialogResult overwrite = MessageBox.Show("The mod list is not empty, are you sure you want to overwrite the current list?", "Confirm Overwrite", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
                if (overwrite == DialogResult.No)
                {
                    return;
                }
            }

            try {
                if (LoadModListDialog.ShowDialog() == DialogResult.OK)
                {
                    ToggleLoadingLabel(true);
                    ModListView.BeginUpdate();
                    ModListView.Items.Clear();

                    ModListView.Sorting = SortOrder.None;

                    await Task.Run(() => LoadModList(LoadModListDialog.FileName));

                    if (KeepSortedCheckBox.Checked)
                    {
                        ModListView.Sorting = SortOrder.Ascending;
                        ModListView.Sort();
                    }

                    ModListView.EndUpdate();
                    ToggleLoadingLabel(false);
                }
            } catch (Exception ex) {
                MessageBox.Show($"There was an error loading the mod list.\r\n\r\nType: {ex.GetType().Name}\r\n\r\n{ex.Message}", "Error Loading Mod List", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #2
0
        private async void LoadLocalButton_Click(object sender, EventArgs e)
        {
            if (ModListView.Items.Count != 0)
            {
                DialogResult overwrite = MessageBox.Show("The download list is not empty, are you sure you want to overwrite the current list?", "Confirm Overwrite", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
                if (overwrite == DialogResult.No)
                {
                    return;
                }
            }

            try {
                if (LoadModListDialog.ShowDialog() == DialogResult.OK)
                {
                    ToggleLoadingLabel(true);
                    ModListView.BeginUpdate();
                    ModListView.Items.Clear();

                    await Task.Run(() => LoadModList(LoadModListDialog.FileName));

                    ModListView.EndUpdate();
                    ToggleLoadingLabel(false);

                    if (ReleaseTypeComboBox.SelectedItem != null)
                    {
                        if (ModListView.Items.Count != 0)
                        {
                            UpdateButton.Enabled = true;
                        }
                        else
                        {
                            UpdateButton.Enabled = false;
                        }
                    }
                    if (GameVersionsComboBox.SelectedItem != null)
                    {
                        if (ModListView.Items.Count != 0)
                        {
                            UpdateButton.Enabled = true;
                        }
                        else
                        {
                            UpdateButton.Enabled = false;
                        }
                    }
                }
            } catch (Exception ex) {
                MessageBox.Show($"There was an error loading the mod list.\r\n\r\nType: {ex.GetType().Name}\r\n\r\n{ex.Message}", "Error Loading Mod List", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }