public override void ServerCallBack(Dictionary <byte, object> server_packet) { string code = server_packet[0].ToString(); string response = server_packet[1].ToString(); switch (code) { case "Get": if (GetActions.Count > 0) { Action <string> callback = GetActions.Dequeue(); callback(response); } break; case "Set": if (SetActions.Count > 0) { Action <string> callback = SetActions.Dequeue(); callback(response); } break; default: Debug.Log("AccountCallBackHandler.ServerCallBack code u=is wrong."); break; } }
public void Set(string key, string value, Action <string> callback) { int totalLength = key.Length + value.Length; if (totalLength > HttpMaxLangth) { throw new Exception("key + value 長度不能超過 2000. 現在的長度是 : " + totalLength); } gameService.Deliver(OperatorCode, new Dictionary <byte, object>() { { 0, "Set" }, { 1, key }, { 2, value } }); SetActions.Enqueue(callback); }
//******INNER_METHODS***************************************************************************************************************************************** public GACShip_Agent_LandingPage GACShipLoginToApplication() { GACShip_Agent_LoginPage loginPage = new GACShip_Agent_LoginPage(); Excel excel = new Excel(@"C:\Users\edqu01\Documents\GAC Automation\GACShip Agent Automation - August-31\ConsoleApp1\TestData\GACShipTestData.xlsx", "LogIn"); PropertyCollection.ChildTest = PropertyCollection.ExtentTest.CreateNode(GetActions.GetMyMethodName()); //Checks first if element is present then type in the Username if (InitialAssertion.ifElementIsPresentandVisible(loginPage.Username) == true) { SetActions.FillInTextField((excel.ReadDatabyColumnName("GACShip", "UserName")), loginPage.Username); SeleniumReporting.ElementPresentVerification(true, "UserName Text Field"); SeleniumReporting.WriteMessageOnTheReport("Username was typed in the text field."); } else { SeleniumReporting.ElementPresentVerification(false, "UserName Text Field"); } //Checks first if element is present then type in the Password if (InitialAssertion.ifElementIsPresentandVisible(loginPage.Password) == true) { SetActions.FillInTextField((excel.ReadDatabyColumnName("GACShip", "Password")), loginPage.Password); SeleniumReporting.ElementPresentVerification(true, "PassWord Text Field"); SeleniumReporting.WriteMessageOnTheReport("Password was typed in the text field."); } else { SeleniumReporting.ElementPresentVerification(false, "PassWord Text Field"); } SetActions.ClickButton(loginPage.LogInButton, "LogIn"); excel.Close(); GACShip_Agent_LandingPage landingPage = new GACShip_Agent_LandingPage(); InitialAssertion.WaitForElementLoad(By.XPath(LandingPageHeader), 30); return(new GACShip_Agent_LandingPage()); //************************************************************************************************************************************************************************ }