コード例 #1
0
        public bool Add(ActionStoreItem item)
        {
            if(Contains(item.Name) == true) {
                return false;
            }

            _items.Add(item);
            return true;
        }
コード例 #2
0
        private void SaveTemplate()
        {
            TemplateName form = new TemplateName();
            form.Text = "Save Action Template";

            if(form.ShowDialog() == DialogResult.OK) {
                ActionStoreItem item = new ActionStoreItem();
                item.Name = form.Name.Text;

                // save the actions
                if(ActionList.SelectedItems.Count > 0) {
                    foreach(ListViewItem lvi in ActionList.SelectedItems) {
                        item.Actions.Add((IAction)lvi.Tag);
                    }
                }
                else {
                    // save all
                    foreach(ListViewItem lvi in ActionList.Items) {
                        item.Actions.Add((IAction)lvi.Tag);
                    }
                }

                _options.ActionStore.Add(item);
                SDOptionsFile.TrySaveOptions(_options);
                LoadTemplates();
            }
        }