public static RemoteStaffSystem GetInstance() { if (instance == null) { instance = new RemoteStaffSystem(); } return(instance); }
public StartWorkWindow() { InitializeComponent(); loggedInStaff = RemoteStaffSystem.GetInstance().LoginModule.LoggedInStaff; this.DataContext = this; StaffName.DataContext = loggedInStaff; clientsBox.DataContext = loggedInStaff; RemoteStaffSystem.GetInstance().UpdateStatus("Not Working"); }
//configs protected override void PullChanged(object sender, ReplicationChangeEventArgs e) { if (!IsProcessing(sender, e)) { //Start Syncing Couchbase Document to Objects Staff staff = RemoteStaffSystem.GetInstance().LoginModule.LoggedInStaff; syncContract(staff); Console.WriteLine("Done Syncing!"); } }
public async Task <bool> StartWork() { var selectedContract = loginModule.LoggedInStaff.SelectedContract; Console.WriteLine(selectedContract); if (selectedContract != null) { string client_name = selectedContract.Client.Name; if (MessageBox.Show("Are you sure you want to start work with " + client_name + "?", "Start Work", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { StartWorkData startWork = new StartWorkData(); startWork.Subcon = selectedContract; Task <bool> task = StartWorkModule.Process(startWork, new CouchbaseLiteSaveWork()); var result = await task; if (result) { RemoteStaffSystem.GetInstance().UpdateStatus("Working"); CurrentWork = StartWorkModule.GetResult(); CurrentWork.TimeBlockLength = TimeBlockLengthInMinute; var manager = new JobManager(); 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); manager.ExecuteAllJobs(); //BaseModule module = ModuleFactory.Get(ModuleFactory.Login); //CouchBaseReplicatorTimeBlock replicatorTimeBlock = new CouchBaseReplicatorTimeBlock(); //replicatorTimeBlock.InitializeReplication((LoginModule)module); } } return(true); } else { MessageBox.Show("Please select a client"); return(false); } }
private async void startWorkButton_Click(object sender, RoutedEventArgs e) { //MessageBox.Show(RemoteStaffSystem.GetInstance().LoginModule.LoggedInStaff.SelectedContract.Display); Task <bool> result = RemoteStaffSystem.GetInstance().StartWork(); var startWork = await result; SubscribeGlobal(); //BaseModule module = ModuleFactory.Get(ModuleFactory.Login); //CouchBaseReplicatorTimeBlock replicatorTimeBlock = new CouchBaseReplicatorTimeBlock(); //replicatorTimeBlock.InitializeReplication((LoginModule)module); }
private void StartWorkForm_KeyPress(object sender, KeyPressEventArgs e) { //Console.WriteLine("KeyPress : " + e.KeyChar); Models.Keyboard keyboard = new Models.Keyboard(); keyboard.ActivityEvent = "KeyPress"; keyboard.DateActivity = new DateTime(); keyboard.Keys = e.KeyChar.ToString(); try { RemoteStaffSystem.GetInstance().CurrentWork.CurrentTimeBlock.Activities.Add(keyboard); RemoteStaffSystem.GetInstance().CurrentWork.CurrentTimeBlock.LastActivityDateTime = DateTime.Today; Console.WriteLine("Activity Count: " + RemoteStaffSystem.GetInstance().CurrentWork.CurrentTimeBlock.Activities.Count); } catch (Exception ex) { Console.WriteLine(ex.Message); } }
private void StartWorkForm_MouseClick(object sender, System.Windows.Forms.MouseEventArgs e) { //Console.WriteLine("MouseClick : " + e.Button); Models.Mouse mouse = new Models.Mouse(); mouse.ActivityEvent = "MouseClick"; mouse.MouseButton = e.Button.ToString(); mouse.DateActivity = new DateTime(); try { RemoteStaffSystem.GetInstance().CurrentWork.CurrentTimeBlock.Activities.Add(mouse); RemoteStaffSystem.GetInstance().CurrentWork.CurrentTimeBlock.LastActivityDateTime = DateTime.Today; Console.WriteLine("Activity Count: " + RemoteStaffSystem.GetInstance().CurrentWork.CurrentTimeBlock.Activities.Count); } catch (Exception ex) { Console.WriteLine(ex.Message); } }
public override void DoJob() { RemoteStaffSystem.GetInstance().CurrentWork.CreateTimeBlock(); TimeBlock previousTimeBlock = RemoteStaffSystem.GetInstance().CurrentWork.PreviousTimeBlock; RemoteStaffSystem.GetInstance().NotWorking = false; RemoteStaffSystem.GetInstance().CurrentWork.ResetScreenShotTimer(); try { Console.WriteLine("Activities vs. Ideal Movement Per Timeblock: " + previousTimeBlock.Activities.Count + " : " + RemoteStaffSystem.GetInstance().GetMovementPerTimeBlock()); if (previousTimeBlock.Activities.Count < RemoteStaffSystem.GetInstance().GetMovementPerTimeBlock()) { Console.WriteLine("The staff logged in is idle!"); RemoteStaffSystem.GetInstance().CurrentWork.PreviousTimeBlock.Status = "idle"; RemoteStaffSystem.GetInstance().UpdateStatus("Idle"); } else { Console.WriteLine("The staff logged in is active!"); RemoteStaffSystem.GetInstance().CurrentWork.PreviousTimeBlock.Status = "active"; RemoteStaffSystem.GetInstance().UpdateStatus("Working"); } //Save to Couchbase if (previousTimeBlock != null) { BaseModule timeBlockModule = ModuleFactory.Get(ModuleFactory.Timeblock); TimeBlockData timeBlockData = new TimeBlockData(); timeBlockData.TimeBlock = previousTimeBlock; timeBlockModule.Process(timeBlockData, new CouchbaseLiteSaveTimeBlocks()); } } catch (Exception ex) { Console.WriteLine(ex.Message); } }