private void Form1_Load(object sender, EventArgs e) { bool bLog = true; // initiates debugging ExtOutputLogging(bLog); if (bLog) { ExtSetLogPath("C:\\test\\txlog.txt"); } // callback function callbackDelegateInstance = new callbackDelegate(CallbackHandler); // sets a value indicating whether to catch calls on the wrong thread // that access a control's Handle property when an application is being debugged. Button.CheckForIllegalCrossThreadCalls = false; // starts a worker thread that handles card and reader polling, passing in callback if (ExtStartPolling(callbackDelegateInstance)) { btnStrtPllng.Enabled = false; btnNdPllng.Enabled = true; } }
static void Cmd_CommandCompletion(callbackDelegate callback) { foreach (cmd_function_t cmd in cmd_functions) { if (cmd != null) { callback(cmd.name); } } }
public MouseDll(callbackDelegate cbDeleg, string debugConfigFilename) { // open the mouse API string errorMsg = open_api(cbDeleg, debugConfigFilename); if (errorMsg != null) { throw new Exception(errorMsg); } mIsLoaded = true; reloadConfig(); }
public void sendTropyDisplay(int index, callbackDelegate callback) { try { tropy_data_struct loadData = tropy_List [index]; Debug.Log(tropy_List[index].TropySpriteName); if (loadData.Completed) { callback(loadData.TropyIndex, loadData.TropySpriteName); } } catch (ArgumentNullException ane) { Debug.Log(ane.StackTrace); } }
public void sendTropyCommand(string command, int amount, callbackDelegate callback) { try { tropy_data_struct loadData = tropy_List [getListIndex(command, amount)]; loadData.SendProgress(amount); if (loadData.Completed) { callback(loadData.TropyIndex, loadData.TropySpriteName); } if (tropy_List[16].Completed && tropy_List[19].Completed && tropy_List[25].Completed && tropy_List[31].Completed) { callback(tropy_List[38].TropyIndex, tropy_List[38].TropySpriteName); } tropy_List[getListIndex(command, amount)] = loadData; } catch (Exception exc) { #if EditorDebug Debug.Log(exc.StackTrace); Debug.Log(exc.Message); #endif } }
private static extern string open_api( callbackDelegate deleg, [MarshalAs(UnmanagedType.LPWStr)] string pDebugConfigFilename );
/// <summary> /// add a subscriber for events of type T. /// </summary> public void AddSubscriber <T>(callbackDelegate <T> handler) where T : AbstractEvent { getSubscribers <T>().Add(handler); }
private static extern bool ExtStartPolling(callbackDelegate managedCallbackHandler);
/// <summary> /// 异步请求 /// </summary> /// <param name="url"></param> /// <param name="method"></param> /// <returns></returns> public static async Task <string> SendAsync(string url, string method = "GET", IDictionary <string, string> parameters = null, callbackDelegate testDelegate = null) { string responseText = ""; await Task.Run(() => { responseText = Send(url, method, parameters); testDelegate?.Invoke(responseText); }); return(responseText); }
private void callback(NumVariator.result result) { //wird auf dem anderen thread aufgerufen. damit winforms sachen geändert werden können muss das anscheinend über invoke gehen callbackDelegate callbackD = new callbackDelegate(callback_invoke); this.Invoke(callbackD, result); }