本文整理汇总了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);
}
}
示例2: FireChanged
private void FireChanged(EventHandler eventHandler)
{
eventHandler?.Invoke(this, EventArgs.Empty);
}
示例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);
}
示例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);
}
}
示例5: TriggerToEventHelper
protected virtual void TriggerToEventHelper(EndpointEvent _endPointEvent,
EventHandler<EndpointEvent> _eventHandler)
{
_eventHandler?.Invoke(this, _endPointEvent);
}
示例6: RaiseTileDataChanged
protected void RaiseTileDataChanged(EventHandler<TileChangedEventArgs> handler, TileChangedEventArgs args)
{
handler?.Invoke(this, args);
}
示例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);
}
示例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);
}
}