public void DoJob() { Process[] processes = Process.GetProcesses(); //Console.WriteLine("Capture Activity Apps"); foreach (Process process in processes) { //Console.WriteLine(process.ToString()); RemoteStaffSystem.GetInstance().CurrentWork.CurrentTimeBlock.Processes.Add(process.ToString()); } }
private async void loginButton_Click(object sender, RoutedEventArgs e) { LoginData loginData = new LoginData(); loginData.EmailAddress = Email.Text; loginData.Password = UserPassword.Password; loginButton.IsEnabled = false; loginButton.Content = "signing in..."; BaseModule module = ModuleFactory.Get(ModuleFactory.Login); var result = await module.Process(loginData); if (result) { CouchBaseReplicatorStaff replicatorStaff = new CouchBaseReplicatorStaff(); replicatorStaff.InitializeReplication((LoginModule)module); RemoteStaffSystem.GetInstance().LoginModule = (LoginModule)module; RemoteStaffSystem.GetInstance().ShowStartWork(); Staff staff = RemoteStaffSystem.GetInstance().LoginModule.LoggedInStaff; replicatorStaff.syncContract(staff); CouchBaseReplicatorWork replicatorWork = new CouchBaseReplicatorWork(); replicatorWork.InitializeReplication((LoginModule)module); CouchBaseReplicatorTimeBlock replicatorTimeBlock = new CouchBaseReplicatorTimeBlock(); replicatorTimeBlock.InitializeReplication((LoginModule)module); this.Close(); } else { dynamic processResult = module.GetResult(); MessageBox.Show(processResult["msg"], "Error!"); loginButton.IsEnabled = true; loginButton.Content = "Login"; } }
public override void DoJob() { try { if (RemoteStaffSystem.GetInstance().CurrentWork.IsReadyForCapturingScreenShot()) { //ScreenshotCapture captureModule = new ScreenshotCapture(); //Image img = captureModule.CaptureScreen(); //MemoryStream screenShot = new MemoryStream(); //img.Save(screenShot, ImageFormat.Jpeg); //screenShot.Position = 0; Bitmap imageScrena = Screna.ScreenShot.Capture(true, true); MemoryStream screenShot = new MemoryStream(); imageScrena.Save(screenShot, ImageFormat.Jpeg); BitmapImage image; using (Stream stream = screenShot) { image = new BitmapImage(); stream.Position = 0; image.BeginInit(); image.CacheOption = BitmapCacheOption.OnLoad; image.StreamSource = stream; image.EndInit(); image.Freeze(); } RemoteStaffSystem.GetInstance().UpdateImage(image); //RemoteStaffSystem.GetInstance().StartWorkForm.updateNotification(); imageScrena = Screna.ScreenShot.Capture(true, true); screenShot = new MemoryStream(); imageScrena.Save(screenShot, ImageFormat.Jpeg); RemoteStaffSystem.GetInstance().CurrentWork.SetScreenShot(screenShot); RemoteStaffSystem.GetInstance().CurrentWork.IncrementScreenShotTimer(); //Console.WriteLine("Capturing ScreenShot"); CaptureActiveAppsJob activeAppsJob = new CaptureActiveAppsJob(); Thread thread = null; try { thread = new Thread(new ThreadStart(activeAppsJob.DoJob)); // start thread executing the job thread.Start(); } catch (Exception ex) { Console.WriteLine(ex.Message); } } else { RemoteStaffSystem.GetInstance().CurrentWork.IncrementScreenShotTimer(); //Console.WriteLine("Not ready for capturing screen shot"); } } catch (Exception ex) { Console.WriteLine(ex.Message); } }