static void Main(string[] args) { IntegralInput input = new IntegralInput { A = 0, B = 5, N = 100 }; CallBackHandler handler = new CallBackHandler(); InstanceContext instanceContext = new InstanceContext(handler); ServiceIntegralClient serviceIntegralClient = new ServiceIntegralClient(instanceContext); IntegralOutput output = serviceIntegralClient.IntegralSeqTrapeze(input); Console.WriteLine($"Sequential trapeze: {output.result}"); output = serviceIntegralClient.IntegralParTrapeze(input); Console.WriteLine($"Parallel trapeze: {output.result}"); output = serviceIntegralClient.IntegralSeqRectangleMedium(input); Console.WriteLine($"Sequential rectangle medium: {output.result}"); output = serviceIntegralClient.IntegralParRectangleMedium(input); Console.WriteLine($"Parallel rectangle medium: {output.result}"); output = serviceIntegralClient.IntegralSeqSimpson(input); Console.WriteLine($"Sequential simpson medium: {output.result}"); output = serviceIntegralClient.IntegralParSimpson(input); Console.WriteLine($"Parallel simpson medium: {output.result}"); Console.WriteLine("End of program!"); Console.ReadKey(); }
private void registerSabreMarkup(string commands) { try { int ret = 0; string markupProperties = string.Format(defaultMarkupProperties, commands); ret = CallBackHandler.registerSabreMarkup_stdcall(cbMarkup, ref markupProperties); if (ret.Equals(3001)) { IsRegmarkup = true; } else if (ret.Equals(3003)) { IsRegmarkup = true; } else { //lblStatusRegister.Text = "Error al registrar markup"; } } catch (Exception) { //lblStatusRegister.Text = "Error al registrar markup\nDescripción\n" + ex.ToString(); } }
private void unRegisterSabreMarkup() { try { int ret = 0; ret = CallBackHandler.unRegisterSabreMarkup(); if (ret.Equals(3011)) { IsRegmarkup = false; } else if (ret.Equals(3013)) { //lblStatusRegister.Text = "Markup no registrado"; } else { //lblStatusRegister.Text = "Error al registrar markup"; } } catch (Exception) { //lblStatusRegister.Text = "Error al registrar markup\nDescripción\n" + ex.ToString(); } }
/// <summary> /// Получение данных из Excel файла /// </summary> /// <param name="fileName">имя файла</param> /// <param name="resultListener">Функция обратного вызова</param> public void GetData(string fileName, CallBackHandler resultListener) { this.resultListener = resultListener; classThread = new Thread(new ParameterizedThreadStart(_getData)); classThread.Start(fileName); }
private void checkStateChange() { int currentState = API_ERROR; int count; int output; #if (POLLING) { currentState = getApiStateFromEvents(); if (previousState == API_SUSPENDED && currentState == API_READY) { currentState = API_RESUME; printAPIState(currentState); previousState = API_READY; return; } } #else { currentState = getApiStateFromEventsWithResume(); } #endif if ((currentState != API_ERROR) && (currentState != previousState)) { switch (currentState) { case API_READY: #region Connected if (IsConnected) { client_Connect(); if (Listenercount > 0) { for (count = 1; count <= Listenercount; count++) { output = CallBackHandler.beginSabreTrafficListener_stdcall(Convert.ToInt32(MESSAGE_TYPE), cb); } } } else { client_Connect(); begin_SabreTrafficListener(); LoadCommandsRestricted(); CheckConnection(); } break; #endregion case API_UNAVAILABLE: IsSigned = false; IsConnected = false; CloseObjects(); break; } previousState = currentState; } }
public void Parse(List <List <object> > data, CallBackHandler resultListener) { this.resultListener = resultListener; classThread = new Thread(new ParameterizedThreadStart(_Parse)); classThread.Start(data); }
/// <summary> /// 添加回调函数 /// </summary> /// <param name="callBack"></param> public void addCallBackHandler(CallBackHandler callBack) { if (this.callBackList == null) { this.callBackList = new List <CallBackHandler>(); } this.callBackList.Add(callBack); }
public void Dispose() { classThread.Abort(); classThread = null; resultListener = null; GC.GetTotalMemory(true); }
/// <summary> /// 在主執行續執行的處理。收到封包時觸發 /// </summary> /// <param name="eventData"></param> protected override void OnEvent(IPacket eventData) { CallBackHandler networkBase = null; if (_CallBackhandler.TryGetValue(eventData.OperationCode, out networkBase)) { networkBase.ServerCallBack(eventData.Parameters); } }
/// <summary> /// Initilize /// </summary> public static void Initilize() { AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); convertHandler = new ConvertPerfDataNameHandler(ConvertPerfDataName); handler = new CallBackHandler(PerfDataCallBack); Log4WWrapper.Initialize(string.Empty); Log4WWrapper.RegisterPerfDataNameCallback(convertHandler); Log4WWrapper.RegisterCallback(handler); }
public CommandsAPI() { try { cbCustom = new CallBackHandler.MySabreCallback(CustomDelegate); long output = CallBackHandler.beginSabreTrafficListener_stdcall(Convert.ToInt32(MESSAGE_TYPE), cbCustom); } catch (Exception EX) { } }
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); }
[Route(@"api/message/update")] // webhook uri part public async Task <OkResult> Update([FromBody] Update update) { var commands = Bot.Commands; var client = await Bot.Get(); Telegram.Bot.Types.Message message; int index; long chatId; switch (update.Type) { case UpdateType.Message: message = update.Message; chatId = message.Chat.Id; var messageId = message.MessageId; index = checkUser(chatId); if (message.Text[0] == '/') { Bot.users[index].status = Status.Usual; } if (Bot.users[index].status == Status.Usual) { foreach (var command in commands) { if (command.Contains(message.Text)) { await command.Execute(message, client); break; } } } else { await anotherStatus(message, index, client); } break; case UpdateType.CallbackQuery: chatId = update.CallbackQuery.Message.Chat.Id; index = checkUser(chatId); await CallBackHandler.callbackHandler(update.CallbackQuery, client, Bot.users, index); break; } return(Ok()); }
private void begin_SabreTrafficListener() { try { long output = CallBackHandler.beginSabreTrafficListener_stdcall(Convert.ToInt32(MESSAGE_TYPE), cb); if (output.Equals(0)) { //Listenercount += 1; } } catch { } }
public void ShowPass(string pass, CallBackHandler<string> handler) { if (_Pass != null && _Pass.Visible) { return; } _Pass = new Pass(); _Pass.CallBack = handler; _Pass.Location = new Point(Location.X + (Width - _Pass.Width) / 2, Location.Y + (Height - _Pass.Height) / 2); _Pass.Show(_ASec, pass); }
public void Dispose() { long output = CallBackHandler.endSabreTrafficListener_stdcall(cbCustom); }
private void end_SabreTrafficListener() { long output = CallBackHandler.endSabreTrafficListener_stdcall(cb); }
public void ShowSave(string file, CallBackHandler<string> handler) { if (_Save == null) { _Save = new Save(); } _Save.CallBack = handler; _Save.Show(_ASec, file); }
/// <summary> /// 加入自定義的回傳處理者 /// </summary> /// <param name="operatorCode">每個處理者的唯一編號,對應到 Server 的傳出編號</param> /// <param name="base"></param> public void AddCallBackHandler(byte operatorCode, CallBackHandler @base) { @base.AddService(gameService); gameService.AddCallBackHandler(operatorCode, @base); }
public static extern IntPtr SetWindowsHookEx(int idHook, CallBackHandler lpfn, IntPtr hMod, uint dwThreadId);
public void ShowOpen(string file, CallBackHandler<string> handler) { if (_Open == null) { _Open = new Open(); } _Open.CallBack = handler; _Open.Show(_ASec, file); }
public void ShowText(string data, CallBackHandler<string> handler) { if (_Text != null && _Text.Visible) { return; } _Text = new Text(); _Text.CallBack = handler; _Text.Location = new Point(Location.X + (Width - _Text.Width) / 2, Location.Y + (Height - _Text.Height) / 2); _Text.Show(_ASec, data); }
/// <summary> /// 加入自定義的回傳處理者 /// </summary> /// <param name="base"></param> public void AddCallBackHandler(byte operatorCode, CallBackHandler @base) { mConnect?.AddCallBackHandler(operatorCode, @base); }
public ConnectThread(CallBackHandler CallBak) { isClosed = false; isGetNews = false; OnCallBack += CallBak; }