Beispiel #1
0
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            Program.args = new ArgumentMap();
            Program.args.Init(args);

            try
            {
                Application.Run(new Form1());
            }
            catch (Exception ex)
            {
                int count = int.Parse(Program.args.GetOption("-r", "0"));
                if (count < 3)
                {
                    Notificator.HangoutsChat chat = new Notificator.HangoutsChat(GetConfigValue("WebhookUrl"));
                    MessageBuilder           mb   = new MessageBuilder(0, ex.ToString());
                    chat.Send(mb.GetMessage(MessageBuilder.ReportLevel.APPLICATION_ERROR));
                    System.Threading.Thread.Sleep(3000);
                    Restart(++count);
                }
                else
                {
                    Notificator.HangoutsChat chat = new Notificator.HangoutsChat(GetConfigValue("WebhookUrl"));
                    MessageBuilder           mb   = new MessageBuilder(0, ex.ToString());
                    chat.Send(mb.GetMessage(MessageBuilder.ReportLevel.APPLICATION_RESTARTING_MISSED));
                }
            }
        }
Beispiel #2
0
        public RpaChecker(Form1 form1, string logFileDir, string logFileName, string webhookUrl, bool normalReport, bool errorReport, int logUpdateInterval)
        {
            this.form1             = form1;
            this.logFileDir        = logFileDir;
            this.logFileName       = logFileName;
            this.webhookUrl        = webhookUrl;
            this.normalReport      = normalReport;
            this.errorReport       = errorReport;
            this.logUpdateInterval = logUpdateInterval;

            chat = new Notificator.HangoutsChat(webhookUrl);
        }
Beispiel #3
0
 private void Form1_Load(object sender, EventArgs e)
 {
     this.ActiveControl = this.buttonRun;
     if (Program.args.HasSwitch("-a") || Program.args.HasSwitch("--autostart"))
     {
         if (!isRunning)
         {
             this.buttonRun.PerformClick();
         }
     }
     if (Program.args.HasSwitch("-r") || Program.args.HasSwitch("--restarted"))
     {
         Notificator.HangoutsChat chat = new Notificator.HangoutsChat(this.textBoxWebhook.Text);
         MessageBuilder           mb   = new MessageBuilder();
         chat.Send(mb.GetMessage(MessageBuilder.ReportLevel.APPLICATION_RESTARTED));
     }
 }