Esempio n. 1
0
        //NOTE: running the macro while SW closing causes the issue when SW process hangs and not released
        //suppressing this functionality until resolved
        //private int OnSwAppClose()
        //{
        //    InvokeTrigger(Triggers_e.ApplicationClose);
        //    return 0;
        //}

        private void InvokeTrigger(Triggers_e trigger)
        {
            CommandMacroInfo[] cmds;

            if (m_Triggers.TryGetValue(trigger, out cmds))
            {
                cmds = cmds.Where(c => c.Scope.IsInScope(m_App)).ToArray();

                if (cmds != null && cmds.Any())
                {
                    m_Logger.Log($"Invoking {cmds.Length} command(s) for the trigger {trigger}");

                    foreach (var cmd in cmds)
                    {
                        try
                        {
                            m_MacroRunner.RunMacro(cmd.MacroPath, cmd.EntryPoint, false);
                        }
                        catch (Exception ex)
                        {
                            m_Logger.Log(ex);
                            m_Msg.ShowError(ex, $"Failed to run a macro on trigger: {trigger}");
                        }
                    }
                }
            }
        }
Esempio n. 2
0
 public void RunMacroCommand(CommandMacroInfo cmd)
 {
     try
     {
         m_MacroRunner.RunMacro(cmd.MacroPath, cmd.EntryPoint, cmd.UnloadAfterRun);
     }
     catch (Exception ex)
     {
         m_Logger.Log(ex);
         m_Msg.ShowError(ex, $"Failed to run macro: '{cmd.Title}'");
     }
 }
Esempio n. 3
0
 public void RunMacroCommand(CommandMacroInfo cmd)
 {
     try
     {
         m_MacroRunner.RunMacro(cmd.MacroPath, cmd.EntryPoint, false);
     }
     catch (Exception ex)
     {
         m_Logger.Log(ex);
         m_Msg.ShowError(ex, "Failed to run macro");
     }
 }
Esempio n. 4
0
 public bool RunMacroCommand(CommandMacroInfo cmd, out Exception err)
 {
     try
     {
         m_MacroRunner.RunMacro(cmd.MacroPath, cmd.EntryPoint, cmd.UnloadAfterRun);
         err = null;
         return(true);
     }
     catch (Exception ex)
     {
         m_Logger.Log(ex);
         err = ex;
         return(false);
     }
 }