private void timer1_Tick(object sender, EventArgs e)
        {
            ToolExecutionManager.CheckStatus((status) =>
            {
                switch (status.CheckStatusCode)
                {
                case CheckStatusCode.AllFinished:
                    if (AutoCloseWhenFinished)
                    {
                        Close();
                    }
                    break;

                case CheckStatusCode.Started:
                    new ToolNotificationForm(status.CurrentToolResult.ToolParameters, 5).Show();
                    AutoCloseWhenFinished = true;
                    break;

                case CheckStatusCode.Error:
                    var ex = (Exception)status.CurrentToolResult.Exception;
                    MessageBox.Show(ex.Message);
                    break;
                }
            });
        }
        static void Main(string[] parameters)
        {
            var config = Config.Instance;

            if (parameters.Contains("-r"))
            {
                config.LastChoiceValid = DateTime.Now.AddMinutes(-1);
                config.Save();
                return;
            }

            bool toolExecuted = false;

            if (DateTime.Now < config.LastChoiceValid)
            {
                config.LastChoiceValid = DateTime.Now.AddMinutes(config.LastChoiceDuration);
                config.Save();

                var ti = config.LastChoiceToolIndex;
                var tp = config.ToolParameters[ti];

                toolExecuted = true;
                ToolExecutionManager.ExecuteTool(tp, parameters);
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new AppForm(!toolExecuted));
        }
Exemplo n.º 3
0
        private void Execute(ToolParameters tp)
        {
            if (chRememberChoice.Checked)
            {
                var config = Config.Instance;
                config.LastChoiceToolIndex = lvTools.SelectedIndices[0];
                config.LastChoiceDuration  = 100;
                config.LastChoiceValid     = DateTime.Now.AddMinutes(config.LastChoiceDuration);
                config.Save();
            }

            ToolExecutionManager.ExecuteTool(tp, _parameters);

            Close();
        }