當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。