private void DisplayError() { LoginFormErrorPanel.Visible = true; LoginFormErrorPanel.BringToFront(); LoginFormErrorPanel.Top = 500; ErrorTimer.Start(); }
private string PrepareDataAndPostSession(string sessionId, bool appendData, ref NameValueCollection postParams) { //CacheProcessor.CreateDecryptedImages(sessionId); //List<string> decryptedImagePaths = new List<string>(CacheProcessor.GetDecryptedImagePaths(sessionId)); //if (decryptedImagePaths == null || decryptedImagePaths.Count <= 0) // return string.Empty; CacheProcessor.DecryptData(sessionId); List <string> loadedData = CacheProcessor.LoadData(sessionId); if ((loadedData == null || loadedData.Count <= 0) && !appendData) { CacheProcessor.DeleteSessionFolder(sessionId); return("EMPTY_FOLDER"); } CacheProcessor.CreateDecryptedImages(sessionId); List <string> decryptedImagePaths = new List <string>(CacheProcessor.GetDecryptedImagePaths(sessionId)); if (appendData) { postParams = _ServerApiProvider.AppendPostSessionParams(loadedData, CurrentContext.GetInstance().Session, CurrentContext.GetInstance().LoginData); } else { postParams = _ServerApiProvider.CreatePostSessionParams(loadedData); } string postUrl = _ServerApiProvider.CreatePostSessionUrl(); if (!WebProcessor.CheckInternetConnection()) { ErrorTimer.GetInstance().StartTimer(); return("CONNECTION_FAIL"); } return(WebProcessor.UploadFileWithParams(postUrl, _ServerApiProvider.PrepareFilesData(decryptedImagePaths, "screenshot_files[]", "image/jpeg"), postParams)); /* MOCK */ /*FAKE++; * * if (FAKE == 0) * return WebProcessor.UploadFileWithParams(postUrl, * _ServerApiProvider.PrepareFilesData(decryptedImagePaths), postParams); * else if (FAKE > 0 && FAKE < 3) * return "FAIL"; * else * return WebProcessor.UploadFileWithParams(postUrl, * _ServerApiProvider.PrepareFilesData(decryptedImagePaths), postParams);*/ /* MOCK */ }
public frmQuestion4() { InitializeComponent(); // Tell the system that this form has been used Globalvariables.CompletedQuestionsI[3] = true; Globalvariables.form += 1; // start timer UserTimer.Start(); ErrorTimer.Start(); lblTime.Text = "Timer : " + Convert.ToString(Globalvariables.timer); // This will make a smoother transition between forms. // This will check to see which character image the user has selected, and then display it within this form. switch (Globalvariables.Character) { case 1: { pictureCharacter.Image = Properties.Resources.CharacterPlaceholder; // Displays 1st image pictureCharacter.SizeMode = PictureBoxSizeMode.Zoom; } break; case 2: { pictureCharacter.Image = Properties.Resources.CharacterPlaceholder2; // 2nd image pictureCharacter.SizeMode = PictureBoxSizeMode.Zoom; } break; case 3: { pictureCharacter.Image = Properties.Resources.NeilArmstrong; // 3rd image pictureCharacter.SizeMode = PictureBoxSizeMode.Zoom; } break; case 4: { pictureCharacter.Image = Properties.Resources.Predator2; // 4th image pictureCharacter.SizeMode = PictureBoxSizeMode.Zoom; } break; } // Display player name lblPlayerName.Text = Globalvariables.username; // Display player score lblScore.Text = Convert.ToString(Globalvariables.points); }
private void ErrorTimer_Tick(object sender, EventArgs e) { if (SignUpErrorPanel.Bottom > 500) { SignUpErrorPanel.Top -= 7; } else if (SignUpErrorPanel.Bottom <= 500) { ErrorTimer.Stop(); System.Threading.Thread.Sleep(1000); ErrorTimer2.Start(); } }
public void StopSession(bool unsubscribe) { Context.Timer.Timer.GetInstance().StopTimer(); ErrorTimer.GetInstance().StopTimer(); if (unsubscribe) { ActivityProcessor.GetInstance().UnsubscribeFromMouseKeyEvents(); } int delta = TimingHelper.CalcTimestampDelta(CurrentContext .GetInstance().Session.StartTimestamp, TimingHelper.GetCurrentTimestamp()); //if (delta < CommonConst.DELAY) // return; CurrentContext.GetInstance().Session.PostTime = delta; CurrentContext.GetInstance().Session.StopTime = delta; ThreadPool.QueueUserWorkItem(new WaitCallback((s) => { /*LogController.GetInstance().LogData(LogController. * GetInstance().LogFormat.GetSessionLine("StopSession() -- mode 1: IsSessionDataLocked: " + * CurrentContext.GetInstance().IsSessionDataLocked.ToString()));*/ //while (CurrentContext.GetInstance().IsSessionDataLocked) // Thread.Sleep(1000); /*LogController.GetInstance().LogData(LogController. * GetInstance().LogFormat.GetSessionLine("StopSession() -- mode 2: IsSessionDataLocked: " + * CurrentContext.GetInstance().IsSessionDataLocked.ToString()));*/ //CurrentContext.GetInstance().IsSessionDataLocked = true; CacheStrategyExecutor.GetInstance().CacheStrategy.PostCurrentSession(CurrentContext .GetInstance().Session.StartTimestamp.ToString()); CacheStrategyExecutor.GetInstance().CacheStrategy.PostOldSessions(CurrentContext .GetInstance().Session.StartTimestamp.ToString()); // CurrentContext.GetInstance().IsSessionDataLocked = false; /*LogController.GetInstance().LogData(LogController. * GetInstance().LogFormat.GetSessionLine("StopSession() -- mode 3: IsSessionDataLocked: " + * CurrentContext.GetInstance().IsSessionDataLocked.ToString()));*/ _NotificationHandler.SessionStopped(); })); }
private SessionController() { _ServerApiProvider = ServerApiFactory.CreateServerApiProvider(); ErrorTimer.GetInstance().InitTimer(this); }
public string GetErrorTimerInterval() { return(ErrorTimer.GetInstance().GetCurrentInterval().ToString()); }
private void DisplayError() { SignUpErrorPanel.Visible = true; SignUpErrorPanel.Top = 500; ErrorTimer.Start(); }