/// <summary>
        /// Deletes selected flags.
        /// </summary>
        public static void DeleteSelectedFlag()
        {
            if (View.SelectedFlags.Count > 0)
            {
                foreach (ListViewItem item in View.SelectedFlags)
                {
                    string filename = (string)item.Tag;
                    try
                    {
                        if (File.Exists(filename))
                        {
                            // Esteregg #1
                            if (AskUser(Path.GetFileNameWithoutExtension(filename)) ||
                                (Path.GetFileName(filename).Equals(FLAG_FILENAME, StringComparison.CurrentCultureIgnoreCase) && AskUser2()))
                            {
                                return;
                            }

                            // delete file (try twice sometimes the file is still in use).
                            bool firstTry = true;
                            bool failed   = false;
                            while (firstTry)
                            {
                                try
                                {
                                    File.Delete(filename);
                                    Messenger.AddInfo(string.Format(Messages.MSG_FLAG_0_DELETED, filename));
                                    firstTry = false;
                                }
                                catch (Exception ex)
                                {
                                    if (!firstTry)
                                    {
                                        Messenger.AddError(string.Format(Messages.MSG_ERROR_DELETE_FLAG_0_FAILED, filename), ex);
                                        failed = true;
                                    }
                                    else
                                    {
                                        Thread.Sleep(300);
                                    }

                                    firstTry = false;
                                }
                            }

                            if (failed)
                            {
                                continue;
                            }

                            // remove pic from ListView
                            var pair2Del = new KeyValuePair <string, ListViewItem>(string.Empty, null);
                            foreach (KeyValuePair <string, ListViewItem> pair in flags)
                            {
                                if (((string)pair.Value.Tag) == filename)
                                {
                                    pair2Del = pair;

                                    // will be removed with next refresh.
                                    ////ilFlags.Images.RemoveAt(pair.Value.ImageIndex);
                                    break;
                                }
                            }

                            if (pair2Del.Value != null)
                            {
                                flags.Remove(pair2Del);
                            }

                            // remove from mod selection
                            ModSelectionController.RefreshCheckedStateOfNodeByDestination(filename);
                        }
                    }
                    catch (Exception ex)
                    {
                        Messenger.AddError(string.Format(Messages.MSG_ERROR_DELETE_FLAG_0_FAILED, filename), ex);
                    }
                }

                View.FillListView(flags);
            }
        }