private void OnExit(object sender, EventArgs ev) { try { Globals.log.Debug("Start OnExit()"); RabbitMQWrapper.BlnThreadAborted = true; Globals.blnExitByUser = true; ComputerInfo.SubmitComputerLog(ComputerInfo.SubmitComputerLogMode.Logoff); ComputerInfo.ThreadMainExit(); threadComputerInfo.Abort(); UserActivityThread.blnThreadAborted = true; threadUserActivity.Abort(); if (Globals.EnabledCaptureSceen) { //~ Auto exit() //No CaptureScreen.blnThreadAborted = true; Globals.log.Debug("Try Exit capture screen"); //CaptureScreenThread.Exit(); } formDummy.Close(); Globals.log.Debug("Finish OnExit()"); Application.Exit(); } catch (Exception e) { Globals.log.Error(e.ToString()); } }
public AmivoiceWatcher() { try { #if DEBUG Console.WriteLine("Mode=Debug"); //DebugHelper(); #endif Globals.CreateAllDirectoryAndFiles(); Configuration_SetFile(); InitializeGUI(); //~ Start thread ComputerInfo.SubmitComputerLog(ComputerInfo.SubmitComputerLogMode.Startup); //~ Start UserActivityThread threadUserActivity = new Thread(new ThreadStart(UserActivityThread.ThreadMain)); threadUserActivity.Start(); threadComputerInfo = new Thread(new ThreadStart(ComputerInfo.ThreadMain)); threadComputerInfo.Start(); threadRabbitMQ = new Thread(new ThreadStart(RabbitMQWrapper.ThreadMain)); threadRabbitMQ.Start(); #if DEBUG Globals.Notifications.PopupWelcomeMessage(); #endif //DONT DELETE //StartCaptureScreenRecord(); } catch (Exception e) { Globals.log.Error(e.ToString()); } }
public void SendComputerLog_logoff() { myState = State.sending_logoff; try { Globals.log.Debug("Try to submitting computer info(logoff) "); browser.LoadingStateChanged += BrowserLoadingStateChanged; //var url = @"http://192.168.1.88:3002/webapi/update_computer_log"; var url = Configuration.configuration["update_computer.url"]; var postData = ComputerInfo.GetComputerInfoJsonString(ComputerInfo.SubmitComputerLogMode.Logoff); //browser.Load("dummy:"); while (myState < State.loading_reloadPage_finish) { Thread.Sleep(1000); } while (browser.IsLoading) { Thread.Sleep(1000); } var script = String.Format("sendPostRequest('{0}','{1}')", url, postData); browser.EvaluateScriptAsync(script).ContinueWith(x => { if (x.IsFaulted) { Globals.log.Warn(String.Format("Unable to submit computer info to url" + url)); } else { var response = x.Result; if (response.Success && response.Result != null) { var html = response.Result.ToString(); Globals.log.Debug("FormCefsharpDummy: run script return = " + html); if (html == "") { Globals.log.Warn(String.Format("Unable to submit computer info to url" + url)); } else { Globals.log.Debug("FormCefsharpDummy: run script return = " + html); Globals.log.Debug("Success to submitting LOGOFF computer info "); } } else { Globals.log.Warn(String.Format("Unable to submit computer info to url" + url)); } } myState = State.ready_to_exit; }); } catch (Exception e) { Globals.log.Debug("Cant submit computer info(logoff)"); Globals.log.Error(e.ToString()); } //myState = State.idle; }
public void SendComputerLog_startup() { if (myState == State.sending_startup) { return; } myState = State.sending_startup; try { while (Configuration.myState != Configuration.State.completed) { Thread.Sleep(500); } Globals.log.Debug("FormCefsharpDummy: Try to submitting computer info (startup)"); browser.LoadingStateChanged += BrowserLoadingStateChanged; //var url = @"http://192.168.1.88:3002/webapi/update_computer_log"; var url = Configuration.configuration["update_computer.url"]; var postData = ComputerInfo.GetComputerInfoJsonString(ComputerInfo.SubmitComputerLogMode.Startup); //browser.Load("dummy:"); //while (!isFinishLoadDefault) //{ // Thread.Sleep(1000); //} while (browser.IsLoading) { Thread.Sleep(1000); } var script = String.Format("sendPostRequest('{0}','{1}')", url, postData); Globals.log.Debug("FormCefsharpDummy: runing script:> " + script); browser.EvaluateScriptAsync(script).ContinueWith(x => { var isOk = false; if (x.IsFaulted) { Globals.log.Debug("FormCefsharpDummy: run script results x.IsFaulted "); } else { var response = x.Result; if (response.Success && response.Result != null) { var html = response.Result.ToString(); Globals.log.Debug("FormCefsharpDummy: run script return = " + html); if (html == "") { //Globals.log.Warn(String.Format("FormCefsharpDummy: Unable to submit computer info to url" + url)); } else { Globals.log.Debug("FormCefsharpDummy: run script return = " + html); isOk = true; } } else { } } if (isOk) { Globals.log.Debug("FormCefsharpDummy: Success to submitting computer info "); } else { Globals.log.Warn(String.Format("FormCefsharpDummy: Unable to submit computer info to url" + url)); } myState = State.registering_rabbitMq; RegisterRabbitMq(); }); } catch (Exception e) { Globals.log.Error(e.ToString()); } //myState = State.idle; }