Exemplo n.º 1
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            _ticks++;
            this.Text = _ticks.ToString();
            if (_ticks == 6)
            {
                CheckProcess cp = new CheckProcess();
                if (!cp.isRunning("chrome"))
                {
                    /*
                     * save last time
                     * get history
                     *
                     */

                    List <HistoryItem> history = ch.GetHistory(StaticValues.prn);
                    if (history.Count > 0)
                    {
                        HttpResponseMessage msg = PostData.SendToServer(history, "history");
                        Console.WriteLine("Status Code " + msg.StatusCode);
                        ch.SaveLastTime();

                        //CaptureScreen cs = new CaptureScreen();
                        //cs.Screenshot();
                        //string response = PostData.SendFileToServer(StaticValues.image);
                        //DateTime dt = DateTime.Now;
                        //Console.WriteLine("Response " + response);
                    }
                }
                this.Text = "Done";
                _ticks    = 0;
            }
        }
Exemplo n.º 2
0
        public Welcome()
        {
            InitializeComponent();
            CheckProcess process = new CheckProcess();

            //if(process.isRunning("chrome"))
            //{
            //    Process [] pr = Process.GetProcessesByName("chrome");
            //    foreach (Process p in pr)
            //        p.Kill();
            //}
again:
            try
            {
                if (new CheckProcess().isRunning("chrome"))
                {
                    MessageBox.Show("Please relaunch your chrome...");
                    goto again;
                }
                ch = new ChromeHistory(StaticValues.prn);
                //CheckProcess cp = new CheckProcess();
                //if(!cp.isRunning("chrome"))
                ch.SaveLastTime();
                timer1.Start();
                timer2.Start();

                this.WindowState = FormWindowState.Minimized;
            }catch (Exception ex)
            {
                MessageBox.Show("Please relaunch your chrome");
                goto again;
            }
        }