示例#1
0
        private void DeleteConfiguration(ConfigureDataListItem configListItem)
        {
            if (Messages.ShowQuestion("Are you sure you want to delete this configuration?", "Hold On", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.No)
            {
                return;
            }

            ConfigurationBase configuration = ConfigurationsManager.GetConfiguration(configListItem.ConfigName);

            bool isDeleted = ConfigurationBase.Delete(configuration, out Exception ex);

            if (isDeleted)
            {
                containerFlowPanel.Controls.Remove(configListItem);
                ConfigurationsManager.RemoveConfiguration(configListItem, configuration);

                if (Configurations.Count == 0)
                {
                    if (!containerFlowPanel.Controls.Contains(emptyListLabel))
                    {
                        containerFlowPanel.Controls.Add(emptyListLabel);
                    }

                    emptyListLabel.Visible = true;
                }
            }
            else
            {
                Messages.DeleteDirectoryException(ex);
            }
        }