当前位置: 首页>>代码示例>>C#>>正文


C# EventHandler.BeginInvoke方法代码示例

本文整理汇总了C#中EventHandler.BeginInvoke方法的典型用法代码示例。如果您正苦于以下问题:C# EventHandler.BeginInvoke方法的具体用法?C# EventHandler.BeginInvoke怎么用?C# EventHandler.BeginInvoke使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EventHandler的用法示例。


在下文中一共展示了EventHandler.BeginInvoke方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PosTest1

    public bool PosTest1()
    {
        bool retVal = true;

        String temp = TestLibrary.Generator.GetString(-55, false, 1, 255);

        TestLibrary.TestFramework.BeginScenario("PosTest1:invoke the method BeginInvoke with all arguments null");
        try
        {
            HelperEvent helperEvent = new HelperEvent();

            EventHandler<HelperArgs> eventHandler = new EventHandler<HelperArgs>(setMessage);

            IAsyncResult iAR = eventHandler.BeginInvoke(helperEvent, new HelperArgs(temp), null, null);

            TestLibrary.TestFramework.LogError("001", "Expected NotSupportedException exception");
            retVal = false;
        }
        catch (NotSupportedException)
        {
            // expected
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("002", "Unexpected exception:" + e);
            retVal = false;
        }
        return retVal;
    }
开发者ID:l1183479157,项目名称:coreclr,代码行数:29,代码来源:eventhandlerbegininvoke.cs

示例2: OnConnectionStatusChangedInternal

        // we need this method instead of directly call OnConnectionStatusChanged
        // because of deadlock which can happen if we initiate the call ( pressing Call button).
        void OnConnectionStatusChangedInternal(object sender, ConnectionEventArgs e) {
            EventHandler<ConnectionEventArgs> d = new EventHandler<ConnectionEventArgs>(OnConnectionStatusChanged);
            if (e.Connection.Status == ConnectionStatus.Connected) {
                _currentIncommingConnection = e.Connection;
                if (!string.IsNullOrEmpty(_answerSoundFileName)) {
                    ThreadPool.QueueUserWorkItem(SendFile, e.Connection);
                }
            } else {
                _currentIncommingConnection = null;
            }
            d.BeginInvoke(sender, e, null, null);

        }
开发者ID:modulexcite,项目名称:capi.net,代码行数:15,代码来源:MainForm.cs

示例3: btnOk_Click

 private void btnOk_Click(object sender, EventArgs e)
 {
     picSpinner.Show();
     btnOk.Enabled = false;
     EventHandler action = new EventHandler(StartCSVImport);
     action.BeginInvoke((bool)((string)cmbPlaylist.SelectedItem != "-"), null, null, null);
 }
开发者ID:jordymeow,项目名称:rincevent,代码行数:7,代码来源:FrmCsv.cs

示例4: BeginStart

        /// <summary>
        /// Start wiping asynchronously
        /// </summary>
        /// <param name="callback">The method to be called when the operation has been completed.</param>
        /// <param name="state">The state object.</param>
        public bool BeginStart(AsyncCallback callback, object state)
        {
            Debug.AssertNotNull(callback, "Callback method not defined");

            if(items == null || items.Count == 0) {
                return false;
            }

            // run the task on the ThreadPool
            EventHandler e = new EventHandler(StartAsync);
            endStartCalled = false;
            e.BeginInvoke(null, null, callback, startEvent);
            return true;
        }
开发者ID:gratianlup,项目名称:SecureDelete,代码行数:19,代码来源:WipeSession.cs

示例5: InvokeNewLineEvent

        /// <summary> Helper function to Invoke or directly call event. </summary>
        /// <param name="newLineHandler"> The event handler. </param>
        /// <param name="newLineArgs"></param>
        private void InvokeNewLineEvent(EventHandler<CommandEventArgs> newLineHandler, CommandEventArgs newLineArgs)
        {
            if (newLineHandler == null || (ControlToInvokeOn != null && ControlToInvokeOn.IsDisposed)) return;

            if (ControlToInvokeOn != null )
            {
                //Asynchronously call on UI thread
                try { ControlToInvokeOn.BeginInvoke((MethodInvoker)(() => newLineHandler(this, newLineArgs))); } catch { }
            }
            else
            {
                //Directly call
                try { newLineHandler.BeginInvoke(this, newLineArgs, null, null); } catch { }
            }
        }
开发者ID:phatchman,项目名称:ScumMeter,代码行数:18,代码来源:CmdMessenger.cs

示例6: User_CommandPcs

        protected override string User_CommandPcs(string cmd)
        {
            cmd = cmd.ToUpper();

            string returnValue = "+1";

            float value = base.CommandSetAnaylzer(cmd);

            ScanModel scanModel = new ScanModel();

            if (cmd.Contains("CENT"))
            {

            }
            else if (cmd.Contains("SPAN"))
            {

            }
            else if (cmd.Contains("BWID"))
            {

            }
            else if (cmd.Contains("RES"))
            {

            }
            else if (cmd.Contains("VID"))
            {

            }
            else if (cmd.Contains("STAT"))
            {

            }
            else if (cmd.Contains("STOP"))
            {

            }
            else if (cmd.Contains("CALC:X"))
            {

            }
            else if (cmd.Contains("CALC:Y?"))
            {
                EventHandler eh = new EventHandler(delegate {
                    base.ClsSRE();

                    //Operation

                    base.SetSRE();
                });

                eh.BeginInvoke(null,null,null,null);

                returnValue = (-178.5).ToString();
            }

            Console.WriteLine(value.ToString());

            return returnValue;
            //return base.User_CommandPcs(cmd);
        }
开发者ID:wimimiw,项目名称:WPALayoutDemo,代码行数:62,代码来源:ScpiCommand.cs

示例7: StartAsync

 public void StartAsync()
 {
     EventHandler e = new EventHandler(StartImpl);
     e.BeginInvoke(null, null, null, null);
 }
开发者ID:gratianlup,项目名称:SecureDelete,代码行数:5,代码来源:ActionExecuter.cs

示例8: OnConditionsMetAsync

 /// <summary>
 /// Calls OnConditionsMet on its own thread, which then raises the ConditionsMet event for each of the delegates wired up.
 /// </summary>
 protected virtual void OnConditionsMetAsync(object sender, ConditionsMetEventArgs e)
 {
     if (ConditionsMet != null)
     {
         EventHandler<ConditionsMetEventArgs> workerDelegate = new EventHandler<ConditionsMetEventArgs>(this.OnConditionsMet);
         workerDelegate.BeginInvoke(sender, e,
             new AsyncCallback(asyncResult => ((EventHandler<ConditionsMetEventArgs>)asyncResult.AsyncState).EndInvoke(asyncResult)),
             workerDelegate);
     }
 }
开发者ID:pettijohn,项目名称:TaskSchedulerEngine,代码行数:13,代码来源:ScheduleDefinition.cs


注:本文中的EventHandler.BeginInvoke方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。