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


C# CallbackDelegate类代码示例

本文整理汇总了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; 
        }
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:25,代码来源:InternalSafeNativeMethods.cs

示例2: CamApproach

 public void CamApproach(CallbackDelegate callback=null)
 {
     moving=true;
     mStartFrom=transform.localPosition;
     mMoveTo=mClosePosition;
     mCallback=callback;
 }
开发者ID:rustypoet,项目名称:React,代码行数:7,代码来源:CameraMove.cs

示例3: CamGetBack

 public void CamGetBack(CallbackDelegate callback=null)
 {
     moving=true;
     mStartFrom=transform.localPosition;
     mMoveTo=mNormalPosition;
     mCallback=callback;
 }
开发者ID:rustypoet,项目名称:React,代码行数:7,代码来源:CameraMove.cs

示例4: setCallback

 public ChatCommand setCallback(string function)
 {
     callback = new CallbackDelegate((cmd, player) => {
         plugin.Invoke(function, new[] { (object)cmd, player });
     });
     return this;
 }
开发者ID:Viproz,项目名称:Pluton,代码行数:7,代码来源:ChatCommands.cs

示例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;
        }
开发者ID:robdobsn,项目名称:ScanMonitor,代码行数:34,代码来源:ScanFolderWatcher.cs

示例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;
    }
开发者ID:rustypoet,项目名称:React,代码行数:10,代码来源:Lerper.cs

示例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;
 }
开发者ID:Notulp,项目名称:Pluton,代码行数:12,代码来源:ConsoleCommands.cs

示例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
     }
 }
开发者ID:Hornwall,项目名称:corsair-num-lock-status,代码行数:18,代码来源:KeyboardHook.cs

示例9: StartAPI

 public static extern void StartAPI(CallbackDelegate notifyInfo, CallbackDelegateTick notifyTick, CallbackDelegate notifyLog);
开发者ID:ngthanhducit,项目名称:TradingServer1502,代码行数:1,代码来源:Market.Property.cs

示例10: SetCallback

 internal void SetCallback(CallbackDelegate callback)
 {
     _callback=callback;
 }
开发者ID:thunder176,项目名称:HeuristicLab,代码行数:4,代码来源:ExcelRichText.cs

示例11: ConsoleFunction

 public ConsoleFunction(string menu_entry_text, CallbackDelegate callback_delegate)
 {
     _menu_text = menu_entry_text;
     callback = callback_delegate;
 }
开发者ID:ams-tech,项目名称:SpreadsheetsOnline,代码行数:5,代码来源:ConsoleFunction.cs

示例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;
    }
开发者ID:jaytem,项目名称:minGit,代码行数:41,代码来源:ReportGrid.ascx.cs

示例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);
                                      	});
     }
 }
开发者ID:AnonymousRetard,项目名称:n2cms,代码行数:25,代码来源:ReportRequestor.cs

示例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);
                 });
     }
 }
开发者ID:AnonymousRetard,项目名称:n2cms,代码行数:16,代码来源:ReportRequestor.cs

示例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;
            }
        }
    }
开发者ID:rustypoet,项目名称:React,代码行数:20,代码来源:CameraMove.cs


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