private static async Task FindReferencesInServiceProcessAsync( SymbolAndProjectId symbolAndProjectId, Solution solution, IStreamingFindReferencesProgress progress, IImmutableSet<Document> documents, CancellationToken cancellationToken) { var client = await solution.Workspace.GetRemoteHostClientAsync(cancellationToken).ConfigureAwait(false); if (client == null) { await FindReferencesInCurrentProcessAsync( symbolAndProjectId, solution, progress, documents, cancellationToken).ConfigureAwait(false); return; } // Create a callback that we can pass to the server process to hear about the // results as it finds them. When we hear about results we'll forward them to // the 'progress' parameter which will then upate the UI. var serverCallback = new ServerCallback(solution, progress, cancellationToken); using (var session = await client.CreateCodeAnalysisServiceSessionAsync( solution, serverCallback, cancellationToken).ConfigureAwait(false)) { await session.InvokeAsync( nameof(IRemoteSymbolFinder.FindReferencesAsync), SerializableSymbolAndProjectId.Dehydrate(symbolAndProjectId), documents?.Select(SerializableDocumentId.Dehydrate).ToArray()).ConfigureAwait(false); } }
public ServerCall(ServiceName service, ServiceOperation operation, IDictionary jsonData, ServerCallback callback) { m_service = service.Value; m_operation = operation.Value; m_jsonData = jsonData; m_callback = callback; //string jsonData2 = JsonMapper.ToJson(m_jsonData); //Console.WriteLine("\n ServerCall::ServerCall -- json data -- " + jsonData2); }
/// <summary> /// Shuts down the communications layer. /// Make sure to only call this from the main thread! /// </summary> public void ShutDown() { lock (m_serviceCallsWaiting) { m_serviceCallsWaiting.Clear(); } // force a log out ServerCallback callback = BrainCloudClient.CreateServerCallback(null, null, null); ServerCall sc = new ServerCall(ServiceName.PlayerState, ServiceOperation.Logout, null, callback); AddToQueue(sc); m_activeRequest = null; // calling update will try to send the logout Update(); // and then dump the comms layer ResetCommunication(); }
public static void Init() { _serializer = new _Serializer(); _serverCallback = new ServerCallback(); _serverManager = ServerManager.Instance; _messageManager = new MessageManager(); _globalEvent = new GlobalEvent(); _globalEvent.Init(); _viewLib = _serverManager._viewLib; _uiManager = _serverManager._uiManager; _loginService = new LoginService(); _sceneManager = new SceneManager(); _sceneService = new SceneService(); _loginManager = new LoginManager(); _gameManager = GameManager._instance; _gameReference = _gameManager._gameReference; _blockGenerator = new BlockGenerator(); _gameData = new GameData(); _randomUtil = new RandomUtil(); _excelUtil = new ExcelUtil(); }
public static void TestJson() { string result = "{success:false, boxCode:'',message: '找不到包裹'}\r\n"; string result2 = "{success:true,message=''}\r\n"; string result3 = "{success:true,boxCode:'6',message:''\r\n"; string result4 = "{success:true,boxCode:'4',message:''\r\n"; ServerCallback sc = new ServerCallback(); StringReader sr = new StringReader(result2); JsonSerializer serializer = new JsonSerializer(); try { sc = (ServerCallback)serializer.Deserialize(new JsonTextReader(sr), typeof(ServerCallback)); } catch (Exception e) { CLog4net.LogError(e.ToString()); //throw (e); sc = null; } }
/// <summary> /// 从服务器获取快递柜序号 /// </summary> /// <returns></returns> public string GetCabinetCode() { if (this.about.CabinetCode == "") { try { ServerCallback dic = this.service.CabinetConfig(this.about); if (!dic.Success) { return(""); } this.about.CabinetCode = Convert.ToString(dic.CabinetCode); } catch (Exception e) { CLog4net.LogError(e); return(""); } } return(this.about.CabinetCode); }
private void Init(ServerCallback serverCallback) { if (!this.IsHandleCreated) { this.CreateHandle(); } ID = Guid.NewGuid(); SetDefaultStyle(); Processor = new PiSboProcessor2(serverCallback); Processor.PiEngine.TabCode = Code; Processor.SboEngine.TabCode = Code; cboIBetDomain.DataSource = DataContainer.PiServers; cboSboDomain.DataSource = DataContainer.SboServers; dgvLeaguesSetting.DataSource = DataContainer.LeaguesSettings; cboMarket.SelectedIndex = 0; cboCompareValue.SelectedIndex = 0; cboMinOddDef.SelectedIndex = 1; BindConvertStakeInfo(); lblSboStatus.TextChanged += OnStatusTextChanged; lblIbetStatus.TextChanged += OnStatusTextChanged; //Processor.PiEngine.OnLogOffEvent += OnLogOffEvent; Processor.SboEngine.OnLogOffEvent += OnLogOffEvent; Processor.OnProcessStateChange += ProcessorOnOnProcessStateChange; Processor.OnPingEvent += ProcessorOnOnPingEvent; webSboStatement.DocumentCompleted += OnSboStatementDocumentCompleted; timerCheck = new System.Timers.Timer(60000 * 2); timerCheck.Elapsed += CheckInfoStatus; }
private bool PGTakeback() { //快递单号存入数据库(要不要进行检查?) string TrackingNum = this.textPGCode.Text.Trim(); if (TrackingNum.Equals("")) { frmMain.ShowSystemPromptMessage("快递单号不能为空"); CLog4net.LogInfo("快递单号不能为空"); return(false); } else { //与服务器握手检测当前连接状态 ServerCallback3 serviceShakeHand = frmMain.serverService.ServiceShakeHand(frmMain.about, null); if (serviceShakeHand.Success == false) { frmMain.ShowSystemPromptMessage("网络或者服务器连接失败,请稍后再试"); frmMain.voiceService.BroadcastOnce("网络或者服务器连接失败,请稍后再试"); CLog4net.LogInfo("网络或者服务器连接异常"); return(false); } ServerCallback sc = frmMain.serverService.CourierTackBack(TrackingNum, courier, frmMain.about); if (sc.Success) { //拍照 bool issuccess = frmMain.cameraService.TakePicture(); CLog4net.LogInfo("拍照是否成功:" + issuccess.ToString()); int boxcode = -1; try { boxcode = Convert.ToInt32(sc.BoxCode); } catch (Exception err) { CLog4net.LogError("输入快递单号后的事件" + sc.BoxCode + err); } this.box = frmMain.boxsManager.Find(boxcode); if (box.Open()) { frmMain.packageManager.TakePackage(boxcode, 1); frmMain.boxsManager.ClearBox(boxcode); } else { frmMain.voiceService.BroadcastOnce("开柜失败"); frmMain.ShowSystemPromptMessage("如果储物柜无法打开,请联系管理员"); CLog4net.LogInfo("如果储物柜无法打开,请联系管理员"); return(false); } //int sn = Convert.ToInt32(TrackingNum); //查找到包裹 Package p = frmMain.packageManager.FindPackageBySN(TrackingNum); if (p == null) { CLog4net.LogInfo("没有这个包裹,请联系管理员:" + TrackingNum); } else { if (p.Place.Code != box.Code) { CLog4net.LogError("单号" + TrackingNum + ",服务器与客户端查询箱子不一致,服务器boxcode:" + sc.BoxCode + " 客户端boxcode:" + p.Place.Code + " 快递号:" + p.SN); } } //跳转下一页 return(true); } else { if (sc.Message == null) { frmMain.voiceService.BroadcastOnce("网络或者服务器连接失败,请稍后再试"); frmMain.ShowSystemPromptMessage("网络或者服务器连接失败,请稍后再试"); CLog4net.LogInfo("服务器连接异常"); } else { if (sc.Message != "") { frmMain.voiceService.BroadcastOnce(sc.Message); frmMain.ShowSystemPromptMessage(sc.Message); CLog4net.LogInfo(sc.Message); } else { frmMain.voiceService.BroadcastOnce("未找到此包裹,请联系管理员"); frmMain.ShowSystemPromptMessage("没有这个包裹,请联系管理员"); CLog4net.LogInfo("没有这个包裹,请联系管理员"); } } return(false); } } }
public void StartGeofenceMonitoring(String geofenceName, GeoPoint geoPoint, AsyncCallback <object> responder) { ICallback bCallback = new ServerCallback(geoPoint); StartGeofenceMonitoring(bCallback, geofenceName, responder); }
private bool PasswordVerify() { //验证密码 string password = this.textBoxPassword.Text.Trim(); //校验不能为空 if (password.Equals("")) { frmMain.ShowSystemPromptMessage("密码不能为空"); } else { ServerCallback3 serviceShakeHand = frmMain.serverService.ServiceShakeHand(frmMain.about, null); if (serviceShakeHand.Success == false) { frmMain.ShowSystemPromptMessage("网络或者服务器连接失败,请稍后再试"); frmMain.voiceService.BroadcastOnce("网络或者服务器连接失败,请稍后再试"); CLog4net.LogInfo("网络或者服务器连接异常"); } ServerCallback callback = frmMain.serverService.RceiverLogin(password, frmMain.about); if (callback.Success) { bool issuccess = frmMain.cameraService.TakePicture(); CLog4net.LogInfo("拍照是否成功:" + issuccess.ToString()); int tempcode = 0; try { tempcode = Convert.ToInt32(callback.BoxCode); } catch (Exception err) { CLog4net.LogError("inputPwdPanel1_confirmEvent callback.BoxCode" + callback.BoxCode + " " + err); } //开箱 this.box = frmMain.boxsManager.Find(tempcode); if (box.Open()) { frmMain.boxsManager.ClearBox(tempcode); CLog4net.LogInfo("取件成功"); Package package = frmMain.packageManager.TakePackage(callback); if (package != null) { //拍照 if (package.Place.Code != box.Code) { CLog4net.LogError("服务器与客户端查询箱子不一致,服务器boxcode:" + callback.BoxCode + " 客户端boxcode:" + package.Place.Code + " 快递号:" + package.SN); } } else { CLog4net.LogInfo("服务器与客户端查询箱子不一致:" + callback.BoxCode); } return(true); } else { frmMain.voiceService.BroadcastOnce("开柜失败"); frmMain.ShowSystemPromptMessage("如果储物柜无法打开,请联系管理员"); CLog4net.LogInfo("如果储物柜无法打开,请联系管理员:" + tempcode); } } else { if (callback.Message == null) { frmMain.ShowSystemPromptMessage("网络或者服务器连接失败,请稍后再试"); frmMain.voiceService.BroadcastOnce("网络或者服务器连接失败,请稍后再试"); CLog4net.LogInfo("网络或者服务器连接异常"); } else { if (callback.Message != "") { frmMain.ShowSystemPromptMessage(callback.Message); frmMain.voiceService.BroadcastOnce(callback.Message); CLog4net.LogInfo(callback.Message); } else { frmMain.ShowSystemPromptMessage("取件密码错误"); frmMain.voiceService.BroadcastOnce("密码错误"); CLog4net.LogInfo("取件密码错误"); } } } } return(false); }
public ServerCall(ServiceName service, ServiceOperation operation, IDictionary jsonData, ServerCallback callback) { m_service = service.Value; m_operation = operation.Value; m_jsonData = jsonData; m_callback = callback; }
public static Ice.DispatchStatus userStateChanged___(ServerCallback obj__, IceInternal.Incoming inS__, Ice.Current current__) { checkMode__(Ice.OperationMode.Idempotent, current__.mode); IceInternal.BasicStream is__ = inS__.istr(); is__.startReadEncaps(); Murmur.User state; state = null; if(state == null) { state = new Murmur.User(); } state.read__(is__); is__.endReadEncaps(); obj__.userStateChanged(state, current__); return Ice.DispatchStatus.DispatchOK; }
public ServerCall(ServiceName service, ServiceOperation operation, IDictionary jsonData, ServerCallback callback) { m_service = service.Value; m_operation = operation.Value; m_jsonData = jsonData; m_callback = callback; //string jsonData2 = JsonMapper.ToJson(m_jsonData); //Console.WriteLine("\n ServerCall::ServerCall -- json data -- " + jsonData2); }
public void Serve(ServerCallback callback) { this.Listener.Start(); Log("Listening at " + this.ServingURL); HttpListenerContext context; HttpListenerRequest request; HttpListenerResponse response; byte[] buffer; while (this.Listener.IsListening) { try { context = this.Listener.GetContext(); request = context.Request; response = context.Response; Response userRes; try { userRes = callback(new Request(request)); } catch (Exception e) { Error(e.ToString(), 500); userRes = new Response(body: File.ReadAllText("Vitesse/defaultError.html"), status: 500, contentType: "text/html"); } userRes.Headers.Add("Content-Type", userRes.ContentType); response.ContentType = userRes.ContentType; response.StatusCode = userRes.StatusCode; response.ContentEncoding = userRes.ContentEncoding; response.Headers = userRes.Headers; if (userRes.Redirect != null) { Log("Redirecting to " + userRes.Redirect, userRes.StatusCode); response.Redirect(userRes.Redirect); response.OutputStream.Close(); } else { buffer = userRes.ContentEncoding.GetBytes(userRes.Body); response.ContentLength64 = buffer.Length; response.OutputStream.Write(buffer, 0, buffer.Length); response.OutputStream.Close(); } } catch (Exception e) { Error(e.ToString()); this.Listener.Stop(); } } }
//输入快递单号后的事件 private void returnScanTN1_ReturnScanTNEvent(object sender, EventArgs e) { //快递单号存入数据库(要不要进行检查?) TrackingNum = returnScanTN1.getTrackingNum().Trim(); if (TrackingNum.Equals("")) { returnScanTN1.errorMessage("快递单号不能为空"); CLog4net.LogInfo("快递单号不能为空"); } else { ServerCallback sc = serverService.CourierTackBack(TrackingNum, tempCourier, about); if (sc.Success) { //拍照 bool issuccess = cameraService.TakePicture(); CLog4net.LogInfo("拍照是否成功:" + issuccess.ToString()); int boxcode = -1; try { boxcode = Convert.ToInt32(sc.BoxCode); } catch (Exception err) { CLog4net.LogError("输入快递单号后的事件" + sc.BoxCode + err); } Box box = boxsManager.Find(boxcode); if (box.Open()) { packageManager.TakePackage(boxcode, 1); courierNum = box.CoordinateInfo.X.ToString() + box.CoordinateInfo.Y.ToString(); boxsManager.ClearBox(boxcode); } else { voiceService.BroadcastOnce("开柜失败"); returnSuccess1.errorMessage("如果储物柜无法打开,请联系管理员"); CLog4net.LogInfo("如果储物柜无法打开,请联系管理员"); } //int sn = Convert.ToInt32(TrackingNum); //查找到包裹 Package p = packageManager.FindPackageBySN(TrackingNum); if (p == null) { CLog4net.LogInfo("没有这个包裹,请联系管理员:" + TrackingNum); } else { if (p.Place.Code != box.Code) { CLog4net.LogError("单号" + TrackingNum + ",服务器与客户端查询箱子不一致,服务器boxcode:" + sc.BoxCode + " 客户端boxcode:" + p.Place.Code + " 快递号:" + p.SN); } } //跳转下一页 NavReturnSuccessState(courierNum); } else { if (sc.Message == null) { voiceService.BroadcastOnce("网络或者服务器连接失败"); returnScanTN1.errorMessage("网络或者服务器连接失败"); CLog4net.LogInfo("服务器连接异常"); } else { if (sc.Message != "") { voiceService.BroadcastOnce(sc.Message); returnScanTN1.errorMessage(sc.Message); CLog4net.LogInfo(sc.Message); } else { voiceService.BroadcastOnce("未找到此包裹,请联系管理员"); returnScanTN1.errorMessage("没有这个包裹,请联系管理员"); CLog4net.LogInfo("没有这个包裹,请联系管理员"); } } } } }
//输入员工密码后的事件 private void returnIDPwd1_getBackPwdEvent(object sender, EventArgs e) { //获取密码进行匹配 try { CourierPwd = returnIDPwd1.getCourierPwd().Trim(); //是否为空 if (CourierPwd.Equals("")) { returnIDPwd1.errorMessage("密码不能为空"); } else { courier = new Courier(CourierID, CourierPwd); ServerCallback sc = serverService.CourierLogin(courier, about); if (sc.Success) { courier.CompanyName = sc.CompanyName; tempCourier = courier; //跳转下一页 NavReturnScanTNState(); } else { string errorMessage = ""; if (sc.Message == null) { voiceService.BroadcastOnce("网络或者服务器连接失败"); returnICID1.errorMessage("网络或者服务器连接失败"); errorMessage = "网络或者服务器连接失败"; CLog4net.LogInfo("网络或服务器连接异常"); } else { if (sc.Message != "") { voiceService.BroadcastOnce(sc.Message); returnIDPwd1.errorMessage(sc.Message); errorMessage = sc.Message; CLog4net.LogInfo(sc.Message); } else { voiceService.BroadcastOnce("用户名或密码错误"); returnICID1.errorMessage("用户名或密码错误,请重新输入"); errorMessage = "用户名或密码错误,请重新输入"; CLog4net.LogInfo("用户名或密码错误"); } } //快递员取回,返回输入用户名 NavReturnICIDState(false, errorMessage); } } } catch (Exception ex) { voiceService.BroadcastOnce("网络连接异常,请稍后再试或联系管理员,谢谢!"); returnIDPwd1.errorMessage("网络异常"); CLog4net.LogError(ex.ToString()); //回到输入用户名阶段 NavReturnICIDState(false, "网络异常"); } }
//点击再次确认收件人手机号的事件实现 private void confirmConsigneeTel1_confirmEvent(object sender, EventArgs e) { //两次输入要匹配 if (ConsigneeTel.Equals(confirmConsigneeTel1.getTel().Trim())) { CLog4net.LogInfo("再次输入手机号确认成功"); //两次手机号相同 //拍照 bool issuccess = cameraService.TakePicture(); CLog4net.LogInfo("拍照是否成功:" + issuccess.ToString()); //创建包裹 Package p = packageManager.CreatePackage(CourierID, courier.CompanyName, TrackingNum, ConsigneeTel, this.tempChooseBox); ServerCallback serverConnect = serverService.PackageCreate(p, about); if (serverConnect.Success) { boxsManager.UserBox(this.tempChooseBox.Code); //x,y为智能柜坐标 courierNum = p.Place.CoordinateInfo.X.ToString() + p.Place.CoordinateInfo.Y.ToString(); //跳转下一页 NavSavePackageSuccessState(ConsigneeTel, TrackingNum, courierNum); packageManager.CreatePackageSuccess(p); CLog4net.LogInfo("创建包裹成功"); } else { /** * 包裹发送到服务器失败,该次操作不成功 * */ this.NavScanTrackingNumState(false); if (serverConnect.Message != null && serverConnect.Message != "") { voiceService.BroadcastOnce(serverConnect.Message); savePackageSuccess1.errorMessage(serverConnect.Message); scanTrackingNum1.errorMessage(serverConnect.Message); CLog4net.LogInfo(serverConnect.Message); } else { voiceService.BroadcastOnce("网络或者服务器连接失败,请重试"); savePackageSuccess1.errorMessage("网络或者服务器连接失败"); scanTrackingNum1.errorMessage("网络或者服务器连接失败"); CLog4net.LogInfo("包裹发送到服务器失败"); } } } else { //不同显示错误信息 voiceService.BroadcastOnce("两次输入的手机号不同,请重新输入"); confirmConsigneeTel1.errorMessage("两次输入的手机号不同,请重新输入"); CLog4net.LogInfo("两次输入的手机号不同"); //返回输入手机号 NavInputConsigneeTelState(false, "两次输入的手机号不同,请重新输入"); } }
//快递员寄件输入员工密码后的事件实现 private void inputCourierPwd1_confirmCpEvent(object sender, EventArgs e) { //获取密码进行匹配 try { CourierPwd = inputCourierPwd1.getCourierPwd().Trim(); //不能为空 if (CourierPwd.Equals("")) { inputCourierPwd1.errorMessage("密码不能为空"); } else { courier = new Courier(CourierID, CourierPwd); ServerCallback sc = serverService.CourierLogin(courier, about); if (sc.Success)//new Courier(CourierID, CourierPwd).IsRegister()) { courier.CompanyName = sc.CompanyName; //跳转下一页 this.NavChooseBoxState(); //log4net记录用户名和公司名 } else { string errorMessage = ""; if (sc.Message == null) { voiceService.BroadcastOnce("网络或者服务器连接失败"); inputCourierPwd1.errorMessage("网络或者服务器连接失败"); errorMessage = "网络或者服务器连接失败"; CLog4net.LogInfo("服务器连接异常"); } else { if (sc.Message != "") { voiceService.BroadcastOnce(sc.Message); inputCourierPwd1.errorMessage(sc.Message); errorMessage = sc.Message; CLog4net.LogInfo(sc.Message); } else { voiceService.BroadcastOnce("用户名或密码错误,请重新输入"); inputCourierPwd1.errorMessage("用户名或密码错误"); errorMessage = "用户名或密码错误"; CLog4net.LogInfo("用户名或密码错误"); } } //快递员寄件返回输入用户名阶段 NavInputCourierIDState(false, errorMessage); } } } catch (Exception ex) { //回到输入用户名阶段 inputCourierPwd1.errorMessage("密码格式错误"); CLog4net.LogError(ex.ToString()); } }
//取件时点击确定后的事件实现 private void inputPwdPanel1_confirmEvent(object sender, EventArgs e) { //验证密码 string password = inputPwdPanel1.getPwd().Trim(); //校验不能为空 if (password.Equals("")) { inputPwdPanel1.errorMessage("密码不能为空"); } else { ServerCallback callback = serverService.RceiverLogin(password, this.about); if (callback.Success) { bool issuccess = cameraService.TakePicture(); CLog4net.LogInfo("拍照是否成功:" + issuccess.ToString()); int tempcode = 0; try { tempcode = Convert.ToInt32(callback.BoxCode); } catch (Exception err) { CLog4net.LogError("inputPwdPanel1_confirmEvent callback.BoxCode" + callback.BoxCode + " " + err); } //开箱 Box box = boxsManager.Find(tempcode); if (box.Open()) { boxsManager.ClearBox(tempcode); //柜子地址 courierNum = box.CoordinateInfo.X.ToString() + box.CoordinateInfo.Y.ToString(); //跳转下一页 NavGetPackageSuccessState(); //设置信息 getPackageSuccess1.setInfo(courierNum); string s = String.Format("取件成功,您的包裹在{0}号箱,请关闭柜门,谢谢", courierNum); voiceService.BroadcastOnce(s); CLog4net.LogInfo("取件成功"); Package package = packageManager.TakePackage(callback); if (package != null) { //拍照 tempPackage = package; if (package.Place.Code != box.Code) { CLog4net.LogError("服务器与客户端查询箱子不一致,服务器boxcode:" + callback.BoxCode + " 客户端boxcode:" + package.Place.Code + " 快递号:" + package.SN); } } else { CLog4net.LogInfo("服务器与客户端查询箱子不一致:" + callback.BoxCode); } } else { voiceService.BroadcastOnce("开柜失败"); returnSuccess1.errorMessage("如果储物柜无法打开,请联系管理员"); CLog4net.LogInfo("如果储物柜无法打开,请联系管理员:" + tempcode); } } else { if (callback.Message == null) { inputPwdPanel1.errorMessage("网络或者服务器连接失败"); voiceService.BroadcastOnce("网络或者服务器连接失败"); CLog4net.LogInfo("网络或者服务器连接异常"); } else { if (callback.Message != "") { inputPwdPanel1.errorMessage(callback.Message); voiceService.BroadcastOnce(callback.Message); CLog4net.LogInfo(callback.Message); } else { inputPwdPanel1.errorMessage("取件密码错误"); voiceService.BroadcastOnce("密码错误"); CLog4net.LogInfo("取件密码错误"); } } } } }