private void Removetimer_Tick(object sender, EventArgs e) { if (taskremovesectors.Status == TaskStatus.RanToCompletion) { removetimer.Stop(); taskremovesectors.Dispose(); info.EnableClose = true; info.AddText(("Finished, Please close the window." + Environment.NewLine + "If you already have the 3dmap open, changes will not be reflected in that map until the next start of EDD" + Environment.NewLine).T(EDTx.UserControlSettings_GalFini)); } }
private void buttonExtEDSMConfigureArea_Click(object sender, EventArgs e) { GalaxySectorSelect gss = new GalaxySectorSelect(); if (!gss.Init(EDDConfig.Instance.EDSMGridIDs)) { ExtendedControls.MessageBoxTheme.Show(this, "Warning".T(EDTx.Warning), "No map downloaded - please wait for it to download".T(EDTx.UserControlSettings_NoMap)); } else if (gss.ShowDialog() == DialogResult.OK) { EDDConfig.Instance.EDSMGridIDs = gss.Selection; if (gss.Action == GalaxySectorSelect.ActionToDo.Add) { discoveryform.ForceEDSMEDDBFullRefresh(); } else if (gss.Action == GalaxySectorSelect.ActionToDo.Remove) { System.Diagnostics.Debug.WriteLine("Remove "); info = new ExtendedControls.InfoForm(); info.Info("Remove Sectors".T(EDTx.UserControlSettings_RemoveSectors), EDDiscovery.Properties.Resources.edlogo_3mo_icon, string.Format(("Removing {0} Sector(s)." + Environment.NewLine + Environment.NewLine + "This will take a while (up to 30 mins dep on drive type and amount of sectors)." + Environment.NewLine + "You may continue to use EDD while this operation takes place" + Environment.NewLine + "but it may be slow to respond. Do not close down EDD until this window says" + Environment.NewLine + "the process has finished" + Environment.NewLine + Environment.NewLine).T(EDTx.UserControlSettings_GalRemove), gss.Removed.Count)); info.EnableClose = false; info.Show(discoveryform); taskremovesectors = Task.Factory.StartNew(() => RemoveSectors(gss.AllRemoveSectors, (s) => discoveryform.Invoke(new Action(() => { info.AddText(s); })))); removetimer = new Timer() { Interval = 200 }; removetimer.Tick += Removetimer_Tick; removetimer.Start(); } } }