示例#1
0
文件: Gui.cs 项目: southdy/iwe
            public WrapperCreator()
            {
                mDelegate = new HandleDelegate(OnRequest);

                ExportGui_SetCreatorWrapps(mDelegate);

                InitialiseWidgetCreator();
            }
示例#2
0
        private void Btn_Start_Click(object sender, EventArgs e)
        {
            HandleDelegate task1 = GetListBoxItems1;

            task1.BeginInvoke(null, null);
            HandleDelegate task2 = GetListBoxItems2;

            task2.BeginInvoke(null, null);
        }
示例#3
0
 /// <summary>
 /// 注册事件监听
 /// </summary>
 /// <param name="key"></param>
 /// <param name="handle"></param>
 public void AddEventListener(X key, HandleDelegate handle)
 {
     if (HandleDelegateDic.ContainsKey(key))
     {
         HandleDelegateDic[key] += handle;
     }
     else
     {
         HandleDelegateDic.Add(key, handle);
     }
 }
示例#4
0
 /// <summary>
 /// 取消事件监听
 /// </summary>
 /// <param name="key"></param>
 /// <param name="handle"></param>
 public void RemoveEventListener(X key, HandleDelegate handle)
 {
     if (HandleDelegateDic.ContainsKey(key))
     {
         HandleDelegateDic[key] -= handle;
     }
     else
     {
         Debug.Log("事件未注册");
     }
 }
示例#5
0
        public void BindSource(string queueName, Delegate RoutingProcessor)
        {
            _routingProcessor = RoutingProcessor;

            HandleDelegate del = Handle;

            //Set this object up as the listener and start it
            if (SourceBus.MessageConverter == null)
            {
                SourceBus.CreateListener(queueName, queueName, true, del);
            }
        }
示例#6
0
        private void Btn_start_Click(object sender, EventArgs e)
        {
            b2.BackColor = Color.Yellow;


            b5_1.BackColor = Color.Yellow;
            b5_2.BackColor = Color.Yellow;
            b6.BackColor   = Color.Yellow;
            b7.BackColor   = Color.Yellow;
            b8.BackColor   = Color.Yellow;

            //开始自检
            HandleDelegate task = Start_Click;

            task.BeginInvoke(null, Btn_start);

            listBox1.Items.Clear();
        }
示例#7
0
        private void Btn_Start_Click(object sender, EventArgs e)
        {
            //HandleDelegate task = Start_Click;
            //task.BeginInvoke(null, null);

            HandleDelegate task1 = GetListBoxItems1;

            task1.BeginInvoke(null, null);
            HandleDelegate task2 = GetListBoxItems2;

            task2.BeginInvoke(null, null);
            HandleDelegate task3 = GetListBoxItems3;

            task3.BeginInvoke(null, null);
            HandleDelegate task4 = GetListBoxItems4;

            task4.BeginInvoke(null, null);
        }
示例#8
0
        public static bool HandleAction(IntPtr handle, int processId, HandleDelegate handleDelegate,
                                        params object[] args)
        {
            Process currentProcess = Process.GetCurrentProcess();

            bool remote = (processId != currentProcess.Id);

            SafeProcessHandle processHandle = null;

            SafeObjectHandle objectHandle = null;

            try
            {
                if (remote)
                {
                    processHandle = NativeMethods.OpenProcess(ProcessAccessRights.DuplicateHandle, true, processId);

                    if (NativeMethods.DuplicateHandle(processHandle.DangerousGetHandle(), handle, currentProcess.Handle,
                                                      out objectHandle, 0, false,
                                                      DuplicateHandleOptions.SameAccess))
                    {
                        handle = objectHandle.DangerousGetHandle();
                    }
                }
                return(handleDelegate.Invoke(handle, args));
            }

            finally
            {
                if (remote)
                {
                    if (processHandle != null)
                    {
                        processHandle.Close();
                    }

                    if (objectHandle != null)
                    {
                        objectHandle.Close();
                    }
                }
            }
        }
示例#9
0
        public static AppError HandleMessage(string _message)
        {
            Log.LogDebug("JSAPI", "cache a message {0}", _message);
            //messagePool.Enqueue(_message);

            string message = _message;
            // get method
            int pos = message.IndexOf('|');

            if (pos < 0)
            {
                return(new AppError(1, "_message is invaliad"));
            }
            string method = message.Substring(0, pos);

            //get activity
            message = pos < message.Length - 1 ? message.Substring(pos + 1, message.Length - pos - 1) : "";
            pos     = message.IndexOf('|');
            if (pos < 0)
            {
                return(new AppError(1, "_message is invaliad"));
            }

            string activity = message.Substring(0, pos);
            //get param
            string param = pos < message.Length - 1 ? message.Substring(pos + 1, message.Length - pos - 1) : "";

            HandleDelegate handle = findHandle(method);

            if (null == handle)
            {
                return(new AppError(1, "handle is not exists"));
            }

            handle(activity, param);

            Resources.UnloadUnusedAssets();
            System.GC.Collect();
            return(new AppError(0, ""));
        }
示例#10
0
        public override void handlePOSTRequest(HttpProcessor p, StreamReader inputData)
        {
            Config config           = new Config();
            string priterNameConfig = config.ReadString("printer", "print", null);

            if (priterNameConfig == null || priterNameConfig.Length == 0)
            {
                p.writeSuccess("application/json");
                Response res = new Response();
                res.stauts = ResStatusCode.NO_Printer.ToString();
                res.desc   = "请先设置打印面单机器";
                string json = JsonConvert.SerializeObject(res);
                p.outputStream.WriteLine(json);
            }
            else
            {
                HandleDelegate handleDelegate = asynHandle;
                string         data           = inputData.ReadToEnd();
                try
                {
                    Console.WriteLine("======data===========================" + data);
                    JArray       item   = (JArray)JsonConvert.DeserializeObject(data);
                    IAsyncResult result = handleDelegate.BeginInvoke(item, null, null);
                    p.writeSuccess("application/json");
                    Response res = new Response();
                    res.stauts = ResStatusCode.Success.ToString();
                    string json = JsonConvert.SerializeObject(res);
                    p.outputStream.WriteLine(json);
                }
                catch (Newtonsoft.Json.JsonReaderException e)
                {
                    p.writeSuccess("application/json");
                    Response res = new Response();
                    res.stauts = ResStatusCode.Forma_Error.ToString();
                    res.desc   = "数据格式错误";
                    string json = JsonConvert.SerializeObject(res);
                    p.outputStream.WriteLine(json);
                }
            }
        }
示例#11
0
文件: Gui.cs 项目: southdy/iwe
 private static extern void ExportGui_SetGetNativeByWrapper(HandleDelegate _delegate);
示例#12
0
 /// <summary>
 /// 循环播放
 /// </summary>
 private void RunTxtThread()
 {
     MyDelegate = new HandleDelegate(SetControls);
     MyDelegate2 = new HandleDelegate2(SetRichTextBox);
     SizeFDelegate = new GeiSizeF(GetSize);
     XmlDocument xmlDoc = new XmlDocument();
     xmlDoc.Load(Application.StartupPath + "\\tree.xml");
     XmlNode nodePage = xmlDoc.SelectSingleNode("tree/" + ShowPage);
     while (true)
     {
         foreach (XmlNode cruNode in nodePage)
         {
             try
             {
                 if (cruNode.HasChildNodes && cruNode.ChildNodes[0].Name.Contains("表"))
                 {
                     TableHandleDelegate(cruNode);
                 }
                 else if (cruNode.InnerText.Contains("word文档"))
                 {
                     WordHandleDelegate(cruNode);
                 }
                 else if (cruNode.InnerText.Contains(".txt"))
                 {
                     TxtHandleDelegate(cruNode);
                 }
             }
             catch (Exception ee)
             {
                 if (!ee.Message.Contains("正在中止线程"))
                     ew.MonthErrorWriter(ee.Message + "||" + ee.StackTrace.ToString());
             }
         }
     }
 }
 public FTDIBoxRequestHandlerInfo(HandleDelegate handler, FTDIBoxCommandHandlerAttribute info)
 {
     Handler = handler ?? throw new ArgumentNullException(nameof(handler));
     Info    = info ?? throw new ArgumentNullException(nameof(info));
 }
 public DefaultContextEventListener(HandleDelegate aHandler)
 {
     handler = aHandler;
 }
 public DefaultContextEventListener(T callerController, HandleDelegate aHandler) : base(callerController)
 {
     handler = aHandler;
 }
示例#16
0
文件: Gui.cs 项目: southdy/iwe
 public GetNativeByWrapper()
 {
     mDelegate = new HandleDelegate(OnRequest);
     ExportGui_SetGetNativeByWrapper(mDelegate);
 }
示例#17
0
 public static void RegisterHandle(string _method, HandleDelegate _dalegate)
 {
     handles.Add(_method, _dalegate);
 }
示例#18
0
文件: Gui.cs 项目: southdy/iwe
 private static extern void ExportGui_SetCreatorWrapps(HandleDelegate _delegate);
示例#19
0
        private void Start_Click()
        {
            b1_f1.BackColor = Color.Yellow;
            b1_f2.BackColor = Color.Yellow;
            b1_f3.BackColor = Color.Yellow;
            b1_f4.BackColor = Color.Yellow;
            HandleDelegate task1 = Start_FJ1;

            task1.BeginInvoke(null, null);
            HandleDelegate task2 = Start_FJ2;

            task2.BeginInvoke(null, null);
            HandleDelegate task3 = Start_FJ3;

            task3.BeginInvoke(null, null);
            HandleDelegate task4 = Start_FJ4;

            task4.BeginInvoke(null, null);


            b4_1.BackColor = Color.Yellow;
            b4_2.BackColor = Color.Yellow;
            b4_3.BackColor = Color.Yellow;
            b4_4.BackColor = Color.Yellow;
            HandleDelegate task5 = Start_Replenishment1;

            task5.BeginInvoke(null, null);
            HandleDelegate task6 = Start_Replenishment2;

            task6.BeginInvoke(null, null);
            HandleDelegate task7 = Start_Replenishment3;

            task7.BeginInvoke(null, null);
            HandleDelegate task8 = Start_Replenishment4;

            task8.BeginInvoke(null, null);


            b3_1.BackColor = Color.Yellow;
            b3_2.BackColor = Color.Yellow;
            b3_3.BackColor = Color.Yellow;
            b3_4.BackColor = Color.Yellow;
            HandleDelegate task9 = Start_InOut1;

            task9.BeginInvoke(null, null);
            HandleDelegate task10 = Start_InOut2;

            task10.BeginInvoke(null, null);
            HandleDelegate task11 = Start_InOut3;

            task11.BeginInvoke(null, null);
            HandleDelegate task12 = Start_InOut4;

            task12.BeginInvoke(null, null);


            HandleDelegate task13 = Start_HJStorage1;

            task13.BeginInvoke(null, null);
            HandleDelegate task14 = Start_HJStorage2;

            task14.BeginInvoke(null, null);
        }
示例#20
0
 public RequestHandlerInfo(Command address, HandleDelegate handler)
 {
     Address = address;
     Handler = handler ?? throw new ArgumentNullException(nameof(handler));
 }