本文整理汇总了C#中CallbackDelegate类的典型用法代码示例。如果您正苦于以下问题:C# CallbackDelegate类的具体用法?C# CallbackDelegate怎么用?C# CallbackDelegate使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CallbackDelegate类属于命名空间,在下文中一共展示了CallbackDelegate类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DRMCreateClientSession
internal static int DRMCreateClientSession(
CallbackDelegate pfnCallback,
uint uCallbackVersion,
string GroupIDProviderType,
string GroupID,
out SafeRightsManagementSessionHandle phSession)
{
SecurityHelper.DemandRightsManagementPermission();
int res = UnsafeNativeMethods.DRMCreateClientSession(
pfnCallback,
uCallbackVersion,
GroupIDProviderType,
GroupID,
out phSession);
// on some platforms in the failure cases the out parameter is being created with the value 0
// in order to simplify error handling and Disposing of those handles we will just close them as
// soon as we detect such case
if ((phSession != null) && phSession.IsInvalid)
{
phSession.Dispose();
phSession = null;
}
return res;
}
示例2: CamApproach
public void CamApproach(CallbackDelegate callback=null)
{
moving=true;
mStartFrom=transform.localPosition;
mMoveTo=mClosePosition;
mCallback=callback;
}
示例3: CamGetBack
public void CamGetBack(CallbackDelegate callback=null)
{
moving=true;
mStartFrom=transform.localPosition;
mMoveTo=mNormalPosition;
mCallback=callback;
}
示例4: setCallback
public ChatCommand setCallback(string function)
{
callback = new CallbackDelegate((cmd, player) => {
plugin.Invoke(function, new[] { (object)cmd, player });
});
return this;
}
示例5: WatchFolder
public bool WatchFolder(string folder, CallbackDelegate callbackOnChanged)
{
_callbackOnChanged = callbackOnChanged;
// Create a new FileSystemWatcher and set its properties.
FileSystemWatcher watcher = new FileSystemWatcher();
// Watch the folder
try
{
watcher.Path = folder;
/* Watch for changes in LastAccess and LastWrite times, and
the renaming of files or directories. */
watcher.NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite
| NotifyFilters.FileName | NotifyFilters.DirectoryName;
// Only watch pdf files.
watcher.Filter = "*.pdf";
// Add event handlers.
watcher.Changed += new FileSystemEventHandler(OnChanged);
watcher.Created += new FileSystemEventHandler(OnCreated);
watcher.Renamed += new RenamedEventHandler(OnRenamed);
// Begin watching.
watcher.EnableRaisingEvents = true;
}
catch (Exception excp)
{
logger.Error("Failed to watch {0}, excp {1}", folder, excp.Message);
return false;
}
return true;
}
示例6: LerpInfo
public LerpInfo(LerpDelegate lerpF,
float min, float max, float time, CallbackDelegate cb=null)
{
this.lerpF=lerpF;
this.lerpMin=min;
this.lerpMax=max;
this.lerpTime=time;
this.lerp=0f;
this.lerpCB=cb;
}
示例7: setCallback
public ConsoleCommand setCallback(string function)
{
callback = new CallbackDelegate(cmd => {
try {
plugin.Invoke(function, (object)cmd);
} catch (Exception ex) {
Logger.Log("there");
Logger.Log(ex.ToString());
}
});
return this;
}
示例8: KeyboardHook
//Start hook
public KeyboardHook(bool Global)
{
this.Global = Global;
TheHookCB = new CallbackDelegate(KeybHookProc);
if (Global)
{
HookID = SetWindowsHookEx(HookType.WH_KEYBOARD_LL, TheHookCB,
0, //0 for local hook. eller hwnd til user32 for global
0); //0 for global hook. eller thread for hooken
}
else
{
HookID = SetWindowsHookEx(HookType.WH_KEYBOARD, TheHookCB,
0, //0 for local hook. or hwnd to user32 for global
GetCurrentThreadId()); //0 for global hook. or thread for the hook
}
}
示例9: StartAPI
public static extern void StartAPI(CallbackDelegate notifyInfo, CallbackDelegateTick notifyTick, CallbackDelegate notifyLog);
示例10: SetCallback
internal void SetCallback(CallbackDelegate callback)
{
_callback=callback;
}
示例11: ConsoleFunction
public ConsoleFunction(string menu_entry_text, CallbackDelegate callback_delegate)
{
_menu_text = menu_entry_text;
callback = callback_delegate;
}
示例12: AddCallback
/// <summary>
/// Adds a callback function on the client (pre-postback, so beware) and then sets a server-side delegate
/// </summary>
/// <param name="key">A friendly key to internally associate with the callback (does not get passed to client)</param>
/// <param name="callbackDelegate">The delegate method to call when this callback gets fired</param>
/// <returns>The name of a generated client-side function that can be called from JavaScript with args and context parameters</returns>
public string AddCallback(string key, CallbackDelegate callbackDelegate)
{
if (CallbackFunctions.ContainsKey(key))
{
if (callbackDelegate != null && !CallbackDelegates[key].Contains(callbackDelegate))
CallbackDelegates[key].Add(callbackDelegate);
return CallbackFunctions[key];
}
string str = this.Page.ClientScript.GetCallbackEventReference(
this,
"args",
this.ClientID + "_Callback", //"IAjax.DisplayResult",
"context",
"ReportGrid_Error", //"IAjax.DisplayError",
false);
StringBuilder builder2 = new StringBuilder();
// Generate a function name for this guy
int index = CallbackDelegates.Count + 1;
string funcName = "_fn" + index.ToString() + this.ClientID;
builder2.Append("window." + funcName + " = function(args,context){" +
(string.IsNullOrEmpty(ClientShowBusyDuringCallback) ? string.Empty : ((UseClientIDPrefix ? (this.ClientID + "_") : string.Empty) + ClientShowBusyDuringCallback + "(true);")) +
"args='fn=_fn" + index.ToString() +
"&' + (args == null ? '' : args);" + str + ";}\n");
JS.RegisterJSBlock(this, builder2.ToString(), this.ClientID + "_JS" + index.ToString());
CallbackDelegates.Add(
key,
callbackDelegate == null ? new List<CallbackDelegate>() : new List<CallbackDelegate>(new CallbackDelegate[] { callbackDelegate }));
CallbackFunctions.Add(key, funcName);
CallbackIndexes.Add("_fn" + index.ToString(), key);
return funcName;
}
示例13: RequestReportAsync
/// <summary>
/// Creates an asynchronous request for a report from Google Analytics with the given dimensions and metrics.
/// </summary>
/// <param name="account">The <see cref="AnalyticsAccountInfo"/> to get the reports for.</param>
/// <param name="dimensions">A list of <see cref="Dimension"/> for the report.</param>
/// <param name="metrics">A list of <see cref="Metric"/> for the report.</param>
/// <param name="from">The start <see cref="DateTime"/> of the report data.</param>
/// <param name="to">The end <see cref="DateTime"/> of the report data.</param>
/// <param name="callback">The <see cref="CallbackDelegate{T}"/> to invoke when the data has been received.</param>
public void RequestReportAsync(AnalyticsAccountInfo account, IEnumerable<Dimension> dimensions, IEnumerable<Metric> metrics, DateTime from, DateTime to, CallbackDelegate<IEnumerable<GenericEntry>> callback)
{
if (callback != null)
{
ThreadPool.QueueUserWorkItem(o =>
{
IEnumerable<GenericEntry> result = RequestReport(
account,
dimensions,
metrics,
from,
to);
callback(result);
});
}
}
示例14: GetAccountsAsync
/// <summary>
/// Gets an <see cref="IEnumerable{T}"/> with all the <see cref="AnalyticsAccountInfo"/> available to the user.
/// </summary>
/// <param name="callback">The <see cref="CallbackDelegate{T}"/> to invoke when the accounts have been received.</param>
public void GetAccountsAsync(CallbackDelegate<IEnumerable<AnalyticsAccountInfo>> callback)
{
if (callback != null)
{
ThreadPool.QueueUserWorkItem(
o =>
{
IEnumerable<AnalyticsAccountInfo> result = GetAccounts();
callback(result);
});
}
}
示例15: Update
private void Update()
{
if(moving) {
mMovingTime+=Time.deltaTime;
float ratio=Mathf.Clamp(mMovingTime/approachTime, 0f, 1f);
Vector3 point=Vector3.Lerp(mStartFrom, mMoveTo, ratio);
point.y+=Mathf.Sin(ratio*Mathf.PI*yBias);
transform.localPosition=point;
if(mMovingTime>=approachTime) {
if(null!=mCallback) {
mCallback();
mCallback=null;
}
moving=false;
mMovingTime=0f;
approachTime=normalApproachTime;
}
}
}