示例#1
0
        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;
            }
        }
示例#2
0
 static void Cmd_CommandCompletion(callbackDelegate callback)
 {
     foreach (cmd_function_t cmd in cmd_functions)
     {
         if (cmd != null)
         {
             callback(cmd.name);
         }
     }
 }
示例#3
0
        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();
        }
示例#4
0
 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);
     }
 }
示例#5
0
    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
        }
    }
示例#6
0
 private static extern string open_api(
     callbackDelegate deleg,
     [MarshalAs(UnmanagedType.LPWStr)] string pDebugConfigFilename
     );
示例#7
0
 /// <summary>
 /// add a subscriber for events of type T.
 /// </summary>
 public void AddSubscriber <T>(callbackDelegate <T> handler) where T : AbstractEvent
 {
     getSubscribers <T>().Add(handler);
 }
示例#8
0
 private static extern bool ExtStartPolling(callbackDelegate managedCallbackHandler);
示例#9
0
        /// <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);
        }
示例#10
0
 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);
 }