Exemplo n.º 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);
            }
        }
Exemplo n.º 2
0
        private void MoveConfiguration(ConfigureDataListItem configListItem, bool isUp)
        {
            ConfigurationBase config = ConfigurationsManager.GetConfiguration(configListItem.ConfigName);
            int curIndex             = containerFlowPanel.Controls.IndexOf(configListItem);
            int moveIndex            = 0;

            if (isUp)
            {
                moveIndex = curIndex == 0? 0 : curIndex - 1;
            }
            else
            {
                moveIndex = curIndex == Configurations.Count - 1? curIndex : curIndex + 1;
            }
            containerFlowPanel.Controls.SetChildIndex(configListItem, moveIndex);
            Configurations.RemoveAt(curIndex);
            Configurations.Insert(moveIndex, config);
            config.ProcessingIndex = moveIndex;
            Configurations[curIndex].ProcessingIndex = curIndex;
        }
Exemplo n.º 3
0
        private void OnConfigControlButtonPressed(object sender, ControlButton controlButton)
        {
            ConfigureDataListItem configListItem = (ConfigureDataListItem)sender;

            switch (controlButton)
            {
            case ControlButton.Delete:
                DeleteConfiguration(configListItem);
                break;

            case ControlButton.MoveUp:
                MoveConfiguration(configListItem, true);
                break;

            case ControlButton.MoveDown:
                MoveConfiguration(configListItem, false);
                break;

            case ControlButton.Configure:
                ConfigurationBase configuration = ConfigurationsManager.GetConfiguration(configListItem.ConfigName);
                ConfigureConfiguration(configuration);
                break;
            }
        }