public Form_Search(IRapidPassiveEngine rapidPassiveEngine, ChatListSubItem myInfo) { this.myInfo = myInfo; this.rapidPassiveEngine = rapidPassiveEngine; this.ReceiveUserList = new CallbackHandler(diaplayUser);//实例化收到消息时回调方法的委托 InitializeComponent(); }
protected override void Resend(InsightMessage _insightMsg, CallbackHandler _callback) { if (_insightMsg is InsightNetworkMessage netMsg) { NetworkSend(netMsg.connectionId, netMsg, _callback); } else { InternalSend(_insightMsg, _callback); } }
public void QueryLocalClient(string userID, int informationType, byte[] info, CallbackHandler handler, object tag) { if (!this.iuserManager_0.IsUserOnLine(userID)) { throw new Exception(string.Format("Target User {0} is not on current server !", userID)); } IMessageHandler interface2 = this.interface9_0.imethod_4 <BinaryInformationContract>("_0", this.object_0.Request, new BinaryInformationContract(informationType, info), userID); this.class72_0.RegisterCallback(this.object_0.Response, interface2.Header.MessageID, new Delegate0(this.query), new CallbackState <CallbackHandler>(handler, tag)); this.interface40_0.SendMessage(interface2, userID, ActionTypeOnChannelIsBusy.Continue); }
public int CountTestCases(string filter) { CheckLoadWasCalled(); CallbackHandler handler = new CallbackHandler(); // ReSharper disable once ObjectCreationAsStatement new FrameworkController.CountTestsAction(_frameworkController, filter, handler); return(int.Parse(handler.Result)); }
/// <summary> /// Returns information about the tests in an assembly. /// </summary> /// <param name="filter">A filter indicating which tests to include</param> /// <returns>An Xml string representing the tests</returns> public string Explore(string filter) { CheckLoadWasCalled(); CallbackHandler handler = new CallbackHandler(); log.Info("Exploring {0} - see separate log file", Path.GetFileName(_testAssemblyPath)); CreateObject(EXPLORE_ACTION, _frameworkController, filter, handler); return(handler.Result); }
public static void UnityIosImagePickerControllerResultCallback(uint requestId, string payload) { try { CallbackHandler.ScheduleCallback(requestId, payload); } catch (Exception e) { Console.WriteLine("Failed handling of callback for request with Id " + requestId + " :: " + e.Message); } }
public NativeMouse(NativeOSWindow window, Mouse mouse) : base(mouse) { this.window = window; callbackHandler = new CallbackHandler(); nativeMouse = callbackHandler.create(this, window); fireSizeChanged(window.WindowWidth, window.WindowHeight); window.Resized += window_Resized; }
public TelegramService(RootHandler handler, CallbackHandler cbHandler) { _handler = handler; _cbHandler = cbHandler; //init _client = new TelegramBotClient("1679074026:AAHjWMmSNrqdElgxJAHbvAYb69sk7XgQs8Y"); //listeners _client.OnMessage += OnMessageReceived; _client.OnCallbackQuery += OnCallbackReceived; }
public string Explore(string filter) { CheckLoadWasCalled(); CallbackHandler handler = new CallbackHandler(); log.Info("Exploring {0} - see separate log file", Path.GetFileName(_testAssemblyPath)); // ReSharper disable once ObjectCreationAsStatement new FrameworkController.ExploreTestsAction(_frameworkController, filter, handler); return(handler.Result); }
/// <summary> /// Clients library constructor which gets ip adress of arena server and initializes connection with server. /// It registers all events for callbacks from server ( messgaes send by the server to the client ) /// </summary> /// <param name="ip"></param> public ClientsLibrary(string ip) { ipAddress = ip; //_callbackHandler = ClientServiceLocator.Instance.Find<CallbackHandler>(); InitializeServerConnection(); CallbackHandler.RegisterLoginAction((response) => InitialMessageReciveEvent(this, new InitialMessageRecivedArgs(response))); CallbackHandler.RegisterStartGameAction((map, roundNumber, team) => GameStartEvent(this, new GamePlayArgs(map, roundNumber, team, false))); CallbackHandler.RegisterEndGameAction(finalScore => GameEndEvent(this, new GamePlayArgs(new Map(0, 0), finalScore, null, true))); CallbackHandler.RegisterGamePlayAction((map, response) => GamePlayMessageReciveEvent(this, new MessageRecivedArgs(map, response))); CallbackHandler.RegisterBeginRoundAction((roundNumber, possibleMoveList) => RoundStartEvent(this, new GameRoundArgs(roundNumber, possibleMoveList))); CallbackHandler.RegisterEndRoundAction(roundNumber => RoundEndEvent(this, new GameRoundArgs(roundNumber))); }
public static async void CalculateTest() { //BidirectionalCalculatorServiceClient bidirectionalClient = new BidirectionalCalculatorServiceClient(channel); using (var duplexStream = service.Calculate()) { var callbackHandler = new CallbackHandler(duplexStream.ResponseStream); await Task.Delay(3000); await duplexStream.RequestStream.WriteAsync(new BidirectionalCalculatorRequest() { Operation = Operation.Add, N = 2 }); await Task.Delay(3000); await duplexStream.RequestStream.WriteAsync(new BidirectionalCalculatorRequest() { Operation = Operation.Multiply, N = 2 }); await Task.Delay(3000); await duplexStream.RequestStream.WriteAsync(new BidirectionalCalculatorRequest() { Operation = Operation.Subtract, N = 2 }); await Task.Delay(3000); await duplexStream.RequestStream.WriteAsync(new BidirectionalCalculatorRequest() { Operation = Operation.Clear }); await Task.Delay(3000); await duplexStream.RequestStream.WriteAsync(new BidirectionalCalculatorRequest() { Operation = Operation.Add, N = 10 }); await Task.Delay(3000); await duplexStream.RequestStream.CompleteAsync(); await callbackHandler.Task; } }
public void AddCallBackHandler(byte operatorCode, CallbackHandler netWorkBase) { if (_CallBackhandler.ContainsKey(operatorCode)) { throw new Exception("不能使用系統使用的 operatorCode,該 code 為 255"); } if (_CallBackhandler.ContainsKey(operatorCode)) { throw new Exception("以加入過相同的 operatorCode,請確保他們是唯一的"); } _CallBackhandler.Add(operatorCode, netWorkBase); }
public void Callback() { using (SerialPort com1 = new SerialPort(TCSupport.LocalMachineSerialInfo.FirstAvailablePortName)) using (SerialPort com2 = new SerialPort(TCSupport.LocalMachineSerialInfo.SecondAvailablePortName)) { CallbackHandler callbackHandler = new CallbackHandler(); Debug.WriteLine("Verifying BeginWrite with a callback specified"); com1.Handshake = Handshake.RequestToSend; com2.ReadTimeout = 300; com1.Open(); com2.Open(); // RTS allows us to control when driver sends the data but does not // guarantee that data will not be consumed by driver // we can check if data was received on the other side though Action read = () => { com2.BaseStream.Read(new byte[DEFAULT_NUM_BYTES_TO_WRITE], 0, DEFAULT_NUM_BYTES_TO_WRITE); }; IAsyncResult writeAsyncResult = com1.BaseStream.BeginWrite(new byte[DEFAULT_NUM_BYTES_TO_WRITE], 0, DEFAULT_NUM_BYTES_TO_WRITE, callbackHandler.Callback, this); callbackHandler.BeginWriteAysncResult = writeAsyncResult; Assert.Equal(this, writeAsyncResult.AsyncState); Thread.Sleep(100); Assert.Throws <TimeoutException>(read); com2.RtsEnable = true; read(); // callbackHandler.WriteAysncResult guarantees that the callback has been called however it does not gauarentee that // the code calling the callback has finished it's processing IAsyncResult callbackWriteAsyncResult = callbackHandler.WriteAysncResult; // No we have to wait for the callbackHandler to complete int elapsedTime = 0; while (!callbackWriteAsyncResult.IsCompleted && elapsedTime < MAX_WAIT_WRITE_COMPLETE) { Thread.Sleep(10); elapsedTime += 10; } Assert.Equal(this, callbackWriteAsyncResult.AsyncState); Assert.False(callbackWriteAsyncResult.CompletedSynchronously, "Should not have completed sync (cback)"); Assert.True(callbackWriteAsyncResult.IsCompleted, "Should have completed (cback)"); Assert.Equal(this, writeAsyncResult.AsyncState); Assert.False(writeAsyncResult.CompletedSynchronously, "Should not have completed sync (write)"); Assert.True(writeAsyncResult.IsCompleted, "Should have completed (write)"); } }
private void Awake() { if (instance != null) { Debug.LogError("More than one Callback Handler Exists!"); Destroy(gameObject); } else { instance = this; } globalInfo.ClearList(); }
public static void RequestTrackingAuthorizationCallbackHandler(uint requestId, uint rawAuthorizationStatus) { try { CallbackHandler.ScheduleRequestTrackingAuthorizationCallback(requestId, rawAuthorizationStatus); } catch (Exception exception) { Console.WriteLine("Received exception while scheduling a callback for request ID " + requestId); Console.WriteLine("Received authorization status " + rawAuthorizationStatus); Console.WriteLine("Exception: " + exception); } }
public void AcquireAsync(Uri ressource, RessourceHandler <T> handler, CallbackHandler <T> callback, DownloadInfo userArgs) { _info = userArgs; if (!string.IsNullOrEmpty(_info.Url.AbsolutePath)) { DownloadClient <T> webDL = new DownloadClient <T>(); webDL.DownloadAsync(_info, handler, callback); return; } throw new UriFormatException("URL cannot be null or empty"); }
public static void NativeMessageHandlerCallback(uint requestId, string payload) { try { CallbackHandler.ScheduleCallback(requestId, payload); } catch (Exception exception) { Console.WriteLine("Received exception while scheduling a callback for request ID " + requestId); Console.WriteLine("Detailed payload:\n" + payload); Console.WriteLine("Exception: " + exception); } }
private void SendToSpawner(int _connectionId, RequestSpawnStartMsg _message, CallbackHandler _callback = null) { var message = new RequestSpawnStartToSpawnerMsg(_message); if (_connectionId == 0) { server.InternalSend(message, _callback); } else { server.NetworkSend(_connectionId, message, _callback); } }
public void StartScan(ScanType currentScanType, CallbackHandler callback) { this.currentScanType = currentScanType; this.callback = callback; if (!msgfilter) { this.Enabled = false; msgfilter = true; Application.AddMessageFilter(this); } tw.Init(this.Handle); tw.Acquire(); }
protected override async Task ExecuteAsync(CancellationToken stoppingToken) { await CallbackHandler.BeginRunningAsync(_hueService.WatchIncomingAsync, _hueService.HandleEventAsync); //var tasks = Enumerable.Range(1, 3) // .Select(i => handler.RunAsync(() => _hueService.IncomingAsync())) // .ToArray(); //int justInt = tasks.Count(); //return Task.WhenAll(tasks); }
public NativeOSWindow(NativeOSWindow parent, String title, IntVector2 position, IntSize2 size, bool floatOnParent) { this.title = title; IntPtr parentPtr = IntPtr.Zero; if (parent != null) { parentPtr = parent._NativePtr; } nativeWindow = NativeOSWindow_create(parentPtr, title, position.x, position.y, size.Width, size.Height, floatOnParent); callbackHandler = new CallbackHandler(this); }
public void OnImagesReceived(List <Bitmap> bitmaps, ScanType scanType, CallbackHandler callback) { try { if (ImagesReceived != null) { ImagesReceived(this, new ScanEventArgs(bitmaps, scanType, callback)); } } catch (Exception ex) { Tiff.LibTiffHelper.WriteToLog(ex); } }
static void Main(string[] args) { // Setup the client var callbacks = new CallbackHandler(); var endpoint = new EndpointAddress(new Uri("net.tcp://localhost:6789/Service1")); using (var factory = new DuplexChannelFactory <IService1>(callbacks, new NetTcpBinding(SecurityMode.None), endpoint)) { var client = factory.CreateChannel(); client.Process("JOB1"); Console.ReadLine(); factory.Close(); } }
private ResponseTextMessage Build(Update update) { if (UpdateType.Message.CompareTo(update.Type) == 0) { return(CommandHandler.Handle(context, update.Message)); } if (update.Type == UpdateType.CallbackQuery) { return(CallbackHandler.Handle(context, update.CallbackQuery)); } return(null); }
public bool Callback() { SerialPort com1 = new SerialPort(TCSupport.LocalMachineSerialInfo.FirstAvailablePortName); SerialPort com2 = new SerialPort(TCSupport.LocalMachineSerialInfo.SecondAvailablePortName); CallbackHandler callbackHandler = new CallbackHandler(); bool retValue = true; System.IAsyncResult writeAsyncResult; System.IAsyncResult callbackWriteAsyncResult; int elapsedTime; Console.WriteLine("Verifying BeginWrite with a callback specified"); com1.Handshake = Handshake.RequestToSend; com1.Open(); com2.Open(); writeAsyncResult = com1.BaseStream.BeginWrite(new byte[DEFAULT_NUM_BYTES_TO_WRITE], 0, DEFAULT_NUM_BYTES_TO_WRITE, new AsyncCallback(callbackHandler.Callback), null); callbackHandler.BeginWriteAysncResult = writeAsyncResult; retValue &= VerifyAsyncResult(writeAsyncResult, null, false, false, "of IAsyncResult returned from BeginWrite BEFORE Write"); com2.RtsEnable = true; //callbackHandler.WriteAysncResult guarantees that the callback has been called however it does not gauarentee that //the code calling the the callback has finished it's processing callbackWriteAsyncResult = callbackHandler.WriteAysncResult; //No we have to wait for the callbackHandler to complete elapsedTime = 0; while (!callbackWriteAsyncResult.IsCompleted && elapsedTime < MAX_WAIT_WRITE_COMPLETE) { System.Threading.Thread.Sleep(10); elapsedTime += 10; } retValue &= VerifyAsyncResult(callbackWriteAsyncResult, null, false, true, " of IAsyncResult passed into AsyncCallback"); retValue &= VerifyAsyncResult(writeAsyncResult, null, false, true, "of IAsyncResult returned from BeginWrite AFTER Write"); if (!retValue) { Console.WriteLine("Err_017 Verifying BeginWrite with a callback specified FAILED"); } com1.Close(); com2.Close(); return(retValue); }
public virtual void initialize(Subject paramSubject, CallbackHandler paramCallbackHandler, System.Collections.IDictionary paramMap1, System.Collections.IDictionary paramMap2) { try { base.initialize(paramSubject, paramCallbackHandler, paramMap1, paramMap2); } catch (Exception exception) { Console.WriteLine(exception.ToString()); Console.Write(exception.StackTrace); } this.dsJndiName = (string)paramMap2["dsJndiName"]; if (string.ReferenceEquals(this.dsJndiName, null)) { this.dsJndiName = "java:/DefaultDS"; } object @object = paramMap2["principalsQuery"]; if (@object != null) { this.principalsQuery = @object.ToString(); } @object = paramMap2["rolesQuery"]; if (@object != null) { this.rolesQuery = @object.ToString(); } @object = paramMap2["suspendResume"]; if (@object != null) { this.suspendResume = Convert.ToBoolean(@object.ToString()); } if (this.log.TraceEnabled) { this.log.trace("DatabaseServerLoginModule, dsJndiName=" + this.dsJndiName); this.log.trace("principalsQuery=" + this.principalsQuery); this.log.trace("rolesQuery=" + this.rolesQuery); this.log.trace("suspendResume=" + this.suspendResume); } try { initLdapConfig(); } catch (Exception exception) { Console.WriteLine(exception.ToString()); Console.Write(exception.StackTrace); } }
public Root(String pluginFileName, String configFileName, String logFileName) { ogreRoot = Root_Create(pluginFileName, configFileName, logFileName); ogreLog = new OgreLogConnection(); ogreLog.subscribe(); callbackHandler = new CallbackHandler(this); ArchiveManager_addArchiveFactory(embeddedResources.NativeFactory); ArchiveManager_addArchiveFactory(engineArchives.NativeFactory); ArchiveManager_addArchiveFactory(memoryArchives.NativeFactory); ArchiveManager_addArchiveFactory(embeddedScalableResources.NativeFactory); ArchiveManager_addArchiveFactory(scalableEngineArchives.NativeFactory); instance = this; }
private void Send(InsightMessageBase _message, CallbackHandler _callback = null) { if (client) { client.NetworkSend(_message, _callback); return; } if (server) { server.InternalSend(_message, _callback); return; } Debug.LogError("[ProcessSpawner] - Not initialized"); }
public CallbackService(string baseAddress, CallbackHandler callbackHandler, int pingIntervalInSecs, Action onConnectionClosed) { this.baseAddress = baseAddress; this.callbackHandler = callbackHandler; this.pingIntervalInSecs = pingIntervalInSecs; this.onConnectionClosed = onConnectionClosed; contentUpdateMessageParts = new List <ContentUpdateRequestFromMQ>(); changeHighlightMessageParts = new List <ChangeHighlightRequestFromMQ>(); previewPartIdUpdateMessageParts = new List <PreviewPartIdUpdateRequestFromMQ>(); var config = getWebApiConfiguration(); serviceHost = new HttpSelfHostServer(config); }
public unsafe BulletScene(BulletSceneDefinition definition, UpdateTimer timer) { callbackHandler = new CallbackHandler(); bulletScene = callbackHandler.create(this, definition); this.timer = timer; this.name = definition.Name; timer.addBackgroundUpdateListener("Rendering", this); factory = new BulletFactory(this); debugDraw = new BulletDebugDraw(); performanceName = String.Format("BulletScene {0} Background", name); Active = true; InternalTimestep = definition.InternalTimestep; SolverIterations = definition.SolverIterations; AutoSynchronizeAfterUpdate = true; }
/// <summary> /// Loads the tests in an assembly. /// </summary> /// <returns>An Xml string representing the loaded test</returns> public string Load(string testAssemblyPath, IDictionary<string, object> settings) { Guard.ArgumentValid(File.Exists(testAssemblyPath), "testAssemblyPath", "Framework driver constructor called with a file name that doesn't exist."); var idPrefix = string.IsNullOrEmpty(ID) ? "" : ID + "-"; _testAssemblyPath = testAssemblyPath; _frameworkController = CreateObject(CONTROLLER_TYPE, testAssemblyPath, idPrefix, (System.Collections.IDictionary)settings); CallbackHandler handler = new CallbackHandler(); log.Info("Loading {0} - see separate log file", Path.GetFileName(_testAssemblyPath)); CreateObject(LOAD_ACTION, _frameworkController, handler); return handler.Result; }
public TextFileTranslateParams(string txtPath, bool useHeaders, bool useQuotes, string extension, string dateFormat, string fieldDelim, int fieldWidth, NumberFormatInfo nfi, ColumnInfoList ciList, string culture, CallbackHandler cbh, string dummyTime) { TxtPath = txtPath; UseHeaders = useHeaders; UseQuotes = useQuotes; Extension = extension; DateFormat = dateFormat; FieldDelim = fieldDelim; FieldWidth = fieldWidth; DummyTime = dummyTime; NFI = nfi; ColInfoList = ciList; this.cbh = cbh; }
/// <summary> /// Loads the tests in an assembly. /// </summary> /// <returns>An Xml string representing the loaded test</returns> public string Load(string testAssemblyPath, IDictionary<string, object> settings) { Guard.ArgumentValid(File.Exists(testAssemblyPath), "testAssemblyPath", "Framework driver constructor called with a file name that doesn't exist."); var idPrefix = string.IsNullOrEmpty(ID) ? "" : ID + "-"; _testAssemblyPath = testAssemblyPath; try { _frameworkController = CreateObject(CONTROLLER_TYPE, testAssemblyPath, idPrefix, (System.Collections.IDictionary)settings); } catch (SerializationException ex) { throw new NUnitEngineException("The NUnit 3.0 driver does not support the portable version of NUnit. Use a platform specific runner.", ex); } CallbackHandler handler = new CallbackHandler(); log.Info("Loading {0} - see separate log file", Path.GetFileName(_testAssemblyPath)); CreateObject(LOAD_ACTION, _frameworkController, handler); return handler.Result; }
public GeneralErrorEventArgs(Exception currentEx, CallbackHandler callbackM = null) { CurrentException = currentEx; CallbackMethod = callbackM; }
public ForaDeLinhaEventArgs(Exception currentEx, CallbackHandler callbackM = null) : base(currentEx, callbackM) { }
public void InitMain(IRapidPassiveEngine rapidPassiveEngine) { //显示托盘 tray.Visible = true; //传入通信引擎 this.rapidPassiveEngine = rapidPassiveEngine; //吸附窗口边缘 hide hide1 = new hide(this, timer_Adsorption); //获取个人信息 if (this.myInfo == null) { this.myInfo = new ChatListSubItemExtend(); } this.myInfo.ID = Convert.ToUInt32(rapidPassiveEngine.CurrentUserID); //窗口显示用户ID this.ReceiveMyInfo = new CallbackHandler(diaplayUser);//实例化收到消息时回调方法的委托 this.rapidPassiveEngine.CustomizeOutter.Query(null, Constant.MSG_QUERYUSER, System.Text.Encoding.UTF8.GetBytes(myInfo.ID.ToString()), ReceiveMyInfo, new Object()); //载入好友列表 displayFriend(); //预订接收到广播消息的处理事件 this.rapidPassiveEngine.GroupOutter.BroadcastReceived += new CbGeneric<string, string, int, byte[]>(GroupOutter_BroadcastReceived); //预订断线处理事件 this.rapidPassiveEngine.ConnectionInterrupted += new CbGeneric(rapidPassiveEngine_ConnectionInterrupted); //好友下线处理事件 this.rapidPassiveEngine.FriendsOutter.FriendOffline += new CbGeneric<string>(FriendOffline); //好友上线处理事件 this.rapidPassiveEngine.FriendsOutter.FriendConnected += new CbGeneric<string>(FriendConnected); }
public SemPapelEventArgs(Exception currentEx, CallbackHandler callbackM = null) : base(currentEx, callbackM) { }
public int CountTestCases(string filter) { CheckLoadWasCalled(); CallbackHandler handler = new CallbackHandler(); CreateObject(COUNT_ACTION, _frameworkController, filter, handler); return int.Parse(handler.Result); }
/// <summary> /// Returns information about the tests in an assembly. /// </summary> /// <param name="filter">A filter indicating which tests to include</param> /// <returns>An Xml string representing the tests</returns> public string Explore(string filter) { CheckLoadWasCalled(); CallbackHandler handler = new CallbackHandler(); log.Info("Exploring {0} - see separate log file", Path.GetFileName(_testAssemblyPath)); CreateObject(EXPLORE_ACTION, _frameworkController, filter, handler); return handler.Result; }
/// <summary> /// Captura os erros ocorridos e toma as ações necessárias /// </summary> /// <param name="ex">Erro ocorrido</param> protected void TrapError(Exception ex, CallbackHandler callback = null) { #region fim de papel if (ex.Message.Equals("fim de papel", StringComparison.InvariantCultureIgnoreCase)) { if (OnErrorFimPapel != null) { OnErrorFimPapel(this, new SemPapelEventArgs(ex, callback)); return; } } #endregion #region não está em linha if (ex.Message.EndsWith("não está em linha", StringComparison.InvariantCultureIgnoreCase) || ex.Message.EndsWith("não está respondendo", StringComparison.InvariantCultureIgnoreCase) || ex.Message.Contains("não responde")) { if (OnNaoEstaEmLinha != null) { OnNaoEstaEmLinha(this, new ForaDeLinhaEventArgs(ex, callback)); return; } else throw new ECFNaoIniciado(ex.Message); } #endregion if (OnErroGeral != null) OnErroGeral(this, new GeneralErrorEventArgs(ex, callback)); else throw ex; }