本文整理汇总了C#中System.Action类的典型用法代码示例。如果您正苦于以下问题:C# System.Action类的具体用法?C# System.Action怎么用?C# System.Action使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
System.Action类属于命名空间,在下文中一共展示了System.Action类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Load
public bool Load(LoaderRequest request, System.Action<LoaderResponse> callback = null, object extraData = null)
{
if (request == null || string.IsNullOrEmpty(request.url))
{
return false;
}
else
{
LoaderResponse response = null;
if (cacheMap.TryGetValue(request.url, out response))
{
Debug.Log("CacheLoader complete:" + request.url);
if (callback != null)
{
response.extraData = extraData;
callback(response);
}
return true;
}
else
{
if (loader.Load(request, LoaderCallback, extraData))
{
this.callback = callback;
return true;
}
else
{
return false;
}
}
}
}
示例2: AddHandler
public void AddHandler(System.Action<ObservableTargetData> handler)
{
if (handler == null) return;
if (_callback == null) this.RegisterTargetTriggerEventHandler();
_callback += handler;
}
示例3: OnClose
public override void OnClose()
{
this.m_Object = (object) null;
this.m_AcceptedCallback = (System.Action<object>) null;
this.m_IsInitialized = false;
EditorApplication.RequestRepaintAllViews();
}
示例4: RemoveHandler
public void RemoveHandler(System.Action<ObservableTargetData> handler)
{
if (handler == null) return;
_callback -= handler;
if (_callback == null) this.UnregisterTargetTriggerEventHandler();
}
示例5: TestDoActionExceedThreadPool
public void TestDoActionExceedThreadPool()
{
long[] data = new long[] { 1, 3 };
System.Action<long[]> act = new System.Action<long[]>((args) =>
{
for (int i = 0; i < data.Length; i++)
{
data[i] = 1;
}
Thread.Sleep(500);
});
long[] data2 = new long[] { 1, 3 };
System.Action<long[]> act2 = new System.Action<long[]>((args) =>
{
for (int i = 0; i < data2.Length; i++)
{
data2[i] = 2;
}
Thread.Sleep(500);
});
ThreadPoolUtil.Instance.DoAction<long>(act, data);
ThreadPoolUtil.Instance.DoAction<long>(act2, data2);
ThreadPoolUtil.Instance.WaitAll();
Assert.Equal(string.Join(",", data), "1,1");
Assert.Equal(string.Join(",", data2), "2,2");
}
示例6: TimedTick
/// Repeatable perform an action each frame for x amount of seconds until a condition is met.
/// Takes the action to perform, the condition for completion and the maximum amount of time each frame
/// to spend performing the action
public TimedTick( System.Action action, System.Func<bool> stopCondition, float time = .1f )
{
start_ = Time.realtimeSinceStartup;
action_ = action;
stopCondition_ = stopCondition;
maxTime_ = time;
}
示例7: Init
public void Init(FlexibleMenuModifyItemUI.MenuType menuType, object obj, System.Action<object> acceptedCallback)
{
this.m_MenuType = menuType;
this.m_Object = obj;
this.m_AcceptedCallback = acceptedCallback;
this.m_IsInitialized = true;
}
示例8: Show
public void Show(bool instantTransition, Action onComplete)
{
elements.enabled = true;
Transition (transitionIn, instantTransition, onComplete);
OnShow ();
}
示例9: OnPointerClick
public void OnPointerClick(PointerEventData eventData)
{
if (EmptyClickAction != null)
{
EmptyClickAction();
EmptyClickAction = null;
}
}
示例10: HostWindow
public HostWindow(Window window, IStatusBar statusBar = null, System.Action<CloseResult> onClosed = null)
{
_statusBar = statusBar;
_window = window;
_onClosed = onClosed;
if (_statusBar == null)
_statusBar = window as IStatusBar;
}
示例11: Initialize
public void Initialize(RenderTexture texture, System.Action callback) {
this.targetTexture = texture;
this.callback = callback;
this.StartCoroutine(this.Render());
}
示例12: SetThread
public void SetThread(Fresvii.AppSteroid.Models.Thread thread, bool isApp, System.Action<Fresvii.AppSteroid.Models.Thread> OnClickCell)
{
this.OnClickCell = OnClickCell;
this.isApp = isApp;
UpdateThread(thread);
}
示例13: ProgressDialog
public ProgressDialog(Window parent, string title, string message, System.Action<ProgressDialog> action)
{
InitializeComponent();
this.Owner = parent;
this.Title = title;
messageLabel.Text = message;
m_action = action;
}
示例14: Init
public void Init(List<ExposablePopupMenu.ItemData> items, float itemSpacing, float minWidthOfPopup, ExposablePopupMenu.PopupButtonData popupButtonData, System.Action<ExposablePopupMenu.ItemData> selectionChangedCallback)
{
this.m_Items = items;
this.m_ItemSpacing = itemSpacing;
this.m_PopupButtonData = popupButtonData;
this.m_SelectionChangedCallback = selectionChangedCallback;
this.m_MinWidthOfPopup = minWidthOfPopup;
this.CalcWidths();
}
示例15: LoadingScreen
public LoadingScreen(Action loadMethod,
Data.UI.Interfaces.IGameScreen next)
: base(true,false)
{
multiThreaded = false;
fadeBlack = false;
_loadMethod = loadMethod;
nextScreen = next;
}