Exemple #1
0
        public FormMain()
        {
            InitializeComponent();

            TGram.Initialize();

            detector.OnChangeDetected += OnChangeDetected;
            //detector.Start();
        }
Exemple #2
0
        private async void Button1_Click(object sender, EventArgs e)
        {
            label1.ForeColor = Color.Black;
            label1.Text      = "starting in 10s";

            await Task.Delay(10000);

            label1.Text = "monitoring...";

            detector.Start();
            var text = string.Format("[{0} {1}]: started monitoring.", DateTime.Now.ToShortDateString(), DateTime.Now.ToLongTimeString());

            TGram.SendMessage(text);
        }
Exemple #3
0
        public void OnChangeDetected()
        {
            string notification = string.Format("[{0} {1}]: change detected.", DateTime.Now.ToShortDateString(), DateTime.Now.ToLongTimeString());

            Console.WriteLine(notification + " Sending Telegram Notification");

            label1.Invoke(new Action(() =>
            {
                label1.Text      = notification;
                label1.ForeColor = Color.Red;
            }));

            TGram.SendMessage(notification);

            detector.Stop();
        }