Exemplo n.º 1
0
        private void btnModify_Click(object sender, EventArgs e)
        {
            if (lstActionDefinitions.SelectedIndices.Count <= 0)
            {
                return;
            }

            _actionDefinitionForm = new ActionDefinitionForm(
                lstActionDefinitions.SelectedItems[0].Tag as ActionDefinition,
                ActionDefinitionValidator
                );

            _actionDefinitionForm.OnSave += actionDefinition =>
            {
                var index = _settings.ActionDefinitions.FindIndex(
                    i => i.Id == actionDefinition.Id
                    );

                if (index > -1)
                {
                    _settings.ActionDefinitions[index] = actionDefinition;
                }

                PrepareListOfActions();

                OnSettingsUpdated(_settings);
            };

            Hide();
            _actionDefinitionForm.ShowDialog();
            Show();
        }
Exemplo n.º 2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            _actionDefinitionForm = new ActionDefinitionForm(new ActionDefinition(), ActionDefinitionValidator);

            _actionDefinitionForm.OnSave += actionDefinition =>
            {
                _settings.ActionDefinitions.Add(actionDefinition);
                PrepareListOfActions();

                OnSettingsUpdated(_settings);
            };

            Hide();
            _actionDefinitionForm.ShowDialog();
            Show();
        }