예제 #1
0
        private void buttonExtSet_Click(object sender, EventArgs e)
        {
            List <int> currentsel = imageViewer.Selection;

            System.Diagnostics.Debug.WriteLine("Initial Sectors " + string.Join(",", initiallist));
            System.Diagnostics.Debug.WriteLine("Cur Sectors " + string.Join(",", currentsel));
            bool added = currentsel.Except(initiallist).Any(); // if initial list does not include a current sel

            if (added)                                         // we added some..
            {
                if (ExtendedControls.MessageBoxTheme.Show(this,
                                                          ("You have added new sectors!" + Environment.NewLine + "This will require a complete re-download of the EDSM data" + Environment.NewLine + "Confirm you wish to do this?").T(EDTx.GalaxySectorSelect_RD),
                                                          "Warning".T(EDTx.Warning), MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK)
                {
                    if (!EDDConfig.Instance.EDSMEDDBDownload)
                    {
                        ExtendedControls.MessageBoxTheme.Show(this, ("Synchronisation to star data disabled in settings." + Environment.NewLine + "Reenable to allow star data to be updated").T(EDTx.GalaxySectorSelect_NoSync), "Warning".T(EDTx.Warning), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }

                    Action = ActionToDo.Add;
                }
                else
                {
                    return;
                }
            }
            else
            {
                Removed = initiallist.Except(currentsel).ToList();  // if initial list does not include a current sel

                if (Removed.Any())
                {
                    AllRemoveSectors = (from int i in GridId.AllId() where !currentsel.Contains(i) select i).ToList();

                    if (ExtendedControls.MessageBoxTheme.Show(this,
                                                              ("You have removed sectors!" + Environment.NewLine + "This will require the DB to be cleaned of entries, which will take time" + Environment.NewLine + "Confirm you wish to do this?").T(EDTx.GalaxySectorSelect_RS),
                                                              "Warning".T(EDTx.Warning), MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK)
                    {
                        Action = ActionToDo.Remove;
                    }
                    else
                    {
                        return;
                    }

                    Action = ActionToDo.Remove;
                }
            }

            DialogResult = DialogResult.OK;
            Close();
        }