Ejemplo n.º 1
0
        /// <summary>
        /// Handles Duplicate Action
        /// </summary>
        /// <param name="sender">The Sender</param>
        /// <param name="args">The Event Arguments</param>
        private void HandleDuplicateAction(object sender, Controls.ActionEditorControlEventArgs args)
        {
            try
            {
                var sendingControl = sender as Control;
                var existingAction = args.Action;
                var newAction      = new Model.Macro.Action();

                newAction.ActionType  = existingAction.ActionType;
                newAction.ActionDelay = existingAction.ActionDelay;

                newAction.ScreenResolution.X = existingAction.ScreenResolution.X;
                newAction.ScreenResolution.Y = existingAction.ScreenResolution.Y;

                newAction.ScreenPosition.X = existingAction.ScreenPosition.X;
                newAction.ScreenPosition.Y = existingAction.ScreenPosition.Y;

                SourceMacro.Assembly.Add(newAction);
                AddMacroActonEditorControl(newAction);
            }
            catch (Exception caught)
            {
                logger.Error("Unexpected Error Handling Duplicate Action", caught);
                throw;
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Handles Remove Action
 /// </summary>
 /// <param name="sender">The Sender</param>
 /// <param name="args">The Event Arguments</param>
 private void HandleRemoveAction(object sender, Controls.ActionEditorControlEventArgs args)
 {
     try
     {
         var sendingControl = sender as Control;
         SourceMacro.Assembly.Remove(args.Action);
         MacroActionsFlowPanel.Controls.Remove(sendingControl);
         sendingControl.Dispose();
     }
     catch (Exception caught)
     {
         logger.Error("Unexpected Error Handling Remove Action", caught);
         throw;
     }
 }