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


C# EventHandler.?.Invoke方法代码示例

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


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

示例1: CheckRaiseEventOnUIThread

 public async static void CheckRaiseEventOnUIThread(object sender, EventHandler eventHandler, bool raiseEventsOnUIThread)
 {
     if (!raiseEventsOnUIThread)
     {
         eventHandler?.Invoke(sender, EventArgs.Empty);
     }
     else
     {
         var dispatcher = CoreApplication.MainView?.CoreWindow?.Dispatcher;
         if (dispatcher != null)
             await dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => eventHandler?.Invoke(sender, EventArgs.Empty));
         else
             eventHandler?.Invoke(sender, EventArgs.Empty);
     }
 }
开发者ID:shaoyiwork,项目名称:IoTHelpers,代码行数:15,代码来源:RaiseEventHelper.cs

示例2: FireChanged

 private void FireChanged(EventHandler eventHandler)
 {
     eventHandler?.Invoke(this, EventArgs.Empty);
 }
开发者ID:MvvmCross,项目名称:MvvmCross,代码行数:4,代码来源:MvxAutoCompleteTextView.cs

示例3: Get_Name

        /// <summary>
        /// Asks the user to provide an name and then
        /// executes a specified event
        /// </summary>
        /// <param name="fireEvent">Event to call after input</param>
        private void Get_Name(EventHandler<EventArgs> fireEvent)
        {
            Console.Write("Name: ");
            var input = Console.ReadLine();

            if (input == "") return;

            StoreName = input;
            fireEvent?.Invoke(this,EventArgs.Empty);
        }
开发者ID:looterwar,项目名称:RepositoryResearch,代码行数:15,代码来源:StoreMenuView.cs

示例4: Get_ID

        /// <summary>
        /// Asks the user to provide an ID and then
        /// executes a specified event
        /// </summary>
        /// <param name="fireEvent">Event to call after input</param>
        private void Get_ID(EventHandler<EventArgs> fireEvent)
        {
            Console.Write("ID: ");
            var input = Console.ReadLine();
            int result;

            if (int.TryParse(input, out result))
            {
                Id = result;
                fireEvent?.Invoke(this, EventArgs.Empty);
            }
        }
开发者ID:looterwar,项目名称:RepositoryResearch,代码行数:17,代码来源:StoreMenuView.cs

示例5: TriggerToEventHelper

 protected virtual void TriggerToEventHelper(EndpointEvent _endPointEvent,
     EventHandler<EndpointEvent> _eventHandler)
 {
     _eventHandler?.Invoke(this, _endPointEvent);
 }
开发者ID:Zyruis11,项目名称:netSharp,代码行数:5,代码来源:BaseEndpoint.cs

示例6: RaiseTileDataChanged

 protected void RaiseTileDataChanged(EventHandler<TileChangedEventArgs> handler, TileChangedEventArgs args)
 {
     handler?.Invoke(this, args);
 }
开发者ID:TeravoxelTwoPhotonTomography,项目名称:acq-dashboard,代码行数:4,代码来源:AcquisitionComponent.cs

示例7: Get_Price

        /// <summary>
        /// Asks the user to provide an price and then
        /// executes a specified event
        /// </summary>
        /// <param name="fireEvent">Event to call after input</param>
        private void Get_Price(EventHandler<EventArgs> fireEvent)
        {
            Console.Write("Price: ");
            var input = Console.ReadLine();
            float result;

            if (!float.TryParse(input, out result))
            {
                Console.WriteLine("\nInvalid price input must be a float (Example: 1 or 1.0)...\n\nSkipping field..");
                Price = null;
            }
            else
            {
                Price = result;
            }

            fireEvent?.Invoke(this, EventArgs.Empty);
        }
开发者ID:looterwar,项目名称:RepositoryResearch,代码行数:23,代码来源:ProductMenuView.cs

示例8: Get_Timestamp

        /// <summary>
        /// Asks the user to provide an timestamp and then
        /// executes a specified event
        /// </summary>
        /// <param name="fireEvent">Event to call after input</param>
        private void Get_Timestamp(EventHandler<EventArgs> fireEvent)
        {
            Console.Write("Update timestamp? [yes or no]:");
            var input = Console.ReadLine();

            if (input != null && input.ToLower().Trim().Equals("yes"))
            {
                Timestamp = DateFormatter.GetDateWithoutMilliseconds(DateTime.Now);
                fireEvent?.Invoke(this, EventArgs.Empty);
            }
        }
开发者ID:looterwar,项目名称:RepositoryResearch,代码行数:16,代码来源:SaleMenuView.cs


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