Beispiel #1
0
        protected void addAction <C>(WhiskeyAction action) where C : ToolStripItem
        {
            Actions.Add(action);
            C btn = action.generateControl <C>();

            ToolStrip.Items.Add(btn);
        }
Beispiel #2
0
        /// <summary>
        /// Run an action
        /// </summary>
        /// <param name="action"></param>
        public void run(WhiskeyAction action, Object src)
        {
            if (action == null)
            {
                throw new ArgumentNullException("Action");
            }
            // actions.Enqueue(action);
            //TODO: put the action on a thread system (so that only one runs at a time)
            action.Progress = 0;
            ActionChanged(this, new ActionChangedEventArgs(action));

            ActionChangedEventHandler actionHand = new ActionChangedEventHandler((s, a) =>
            {
                ActionChanged(this, a);
            });

            action.Changed += actionHand;

            Thread actionThread = new Thread(() =>
            {
                action.Effect(src);

                action.Changed -= actionHand;

                action.Progress = 1;
                ActionChanged(this, new ActionChangedEventArgs(action));
                ActionChanged(this, new ActionChangedEventArgs(null));
            });

            actionThread.Name = "ACTION: " + action.Name;
            actionThread.SetApartmentState(ApartmentState.STA);
            actionThread.Start();
        }
Beispiel #3
0
        protected void addAction(WhiskeyAction action)
        {
            Actions.Add(action);
            ToolStripButton btn = action.generateControl <ToolStripButton>();

            ToolStrip.Items.Add(btn);
        }
Beispiel #4
0
        private void initControls()
        {
            WhiskeyPropertyListGrid.PropertyList = Descriptor.getPropertySet();

            remPropertyActions = new List <WhiskeyAction>();

            WhiskeyPropertyListGrid.PropertyAdapter.PropertyValueChanged += updateFile;
            WhiskeyPropertyListGrid.PropertyGrid.PropertyValueChanged    += updateFile;


            addPropertyAction = new AddPropertyAction(Descriptor, WhiskeyPropertyListGrid);
            ToolStripItems.Add(addPropertyAction.generateControl <ToolStripButton>());


            dropDownBtn = new ToolStripDropDownButton("Remove", Assets.AssetManager.ICON_MINUS);


            //updateItems();

            // dropDownBtn.DropDownItems.Add(removeBox);
            dropDownBtn.DropDownDirection = ToolStripDropDownDirection.BelowRight;
            dropDownBtn.DropDown.AutoSize = false;
            dropDownBtn.DropDown.Width    = 200;

            dropDownOpeningHandler = new EventHandler(onDropDownOpening);
            propRemovedHandler     = new PropertyRemovedEventHandler(onPropRemoved);


            dropDownBtn.DropDownOpening += dropDownOpeningHandler;
            // Descriptor.PropertyRemoved += propRemovedHandler;
            //removeBox.Alignment = ToolStripItemAlignment.Right;
            //removeBox.ImageIndex = 1;
            //removeBox.DropDownStyle = ComboBoxStyle.DropDownList;
            ToolStripItems.Add(dropDownBtn);

            editScriptsAction = new AddRemoveTypeScriptsAction(Descriptor, this);
            ToolStripItems.Add(editScriptsAction.generateControl());
        }
Beispiel #5
0
 public ActionChangedEventArgs(WhiskeyAction action)
 {
     Action = action;
 }