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


C# CallBack类代码示例

本文整理汇总了C#中CallBack的典型用法代码示例。如果您正苦于以下问题:C# CallBack类的具体用法?C# CallBack怎么用?C# CallBack使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CallBack类属于命名空间,在下文中一共展示了CallBack类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FadeIn

 //淡入
 public void FadeIn(float _fadeInTime, CallBack _fun = null)
 {
     if (!isFading)
     {
         StartCoroutine(FadeAction(true,_fadeInTime, _fun));
     }
 }
开发者ID:GaoKaiHaHa,项目名称:MyUnityFrameWork,代码行数:8,代码来源:CameraFade.cs

示例2: Main

        public static void Main()
        {
            CallBack callback = new CallBack(TimeNow);
            Timer time = new Timer(callback.Invoke, null, 0, 1000);

            Console.Read(); //press enter to exit
        }
开发者ID:Bvaptsarov,项目名称:Homework,代码行数:7,代码来源:TimerCallBack.cs

示例3: FadeOut

 //淡出
 public void FadeOut(float _fadeOutTime, CallBack _fun = null)
 {
     if (!isFading)
     {
         StartCoroutine(FadeAction(false,_fadeOutTime, _fun));
     }
 }
开发者ID:GaoKaiHaHa,项目名称:MyUnityFrameWork,代码行数:8,代码来源:CameraFade.cs

示例4: AddVkFriend

        public void AddVkFriend(string uid, CallBack onSuccess, CallBack onError)
        {
            if (!this.connected)
            {
                return;
            }

            var url = "https://api.vk.com/method/friends.add";
            var sendData = new Dictionary<string, string>
                               {
                                   { "access_token", this.access_token },
                                   { "uid", uid }
                               };
            this.GetQuery(
                url,
                sendData,
                res =>
                    {
                        var decodedResponse = Newtonsoft.Json.Linq.JObject.Parse(res.ToString());
                        var answer = decodedResponse["response"];
                        if (answer == null)
                        {
                            onError(new object());
                            return;
                        }

                        onSuccess(answer.ToString());
                    },
                res =>
                    {
                        onError(new object());
                    });
        }
开发者ID:appgranula,项目名称:vk_metro,代码行数:33,代码来源:VK_API.cs

示例5: FadeInToOut

 //从淡入到淡出
 public void FadeInToOut(float _fadeInTime, float afterInDelayTime, float _fadeOutTime, CallBack afterFadeInCallback=null, CallBack afterFadeOutCallback = null)
 {
     if (!isFading)
     {
         StartCoroutine(FadeInToOutAction(_fadeInTime, afterInDelayTime, _fadeOutTime, afterFadeInCallback, afterFadeOutCallback));
     }
 }
开发者ID:GaoKaiHaHa,项目名称:MyUnityFrameWork,代码行数:8,代码来源:CameraFade.cs

示例6: Handle

        public void Handle(List<UPnPArg> args, CallBack cb, XMLWriterPi writer)
        {
            Console.WriteLine("Browse Was called (BrowseStrat)");
            List<UPnPArg> retArgs = new List<UPnPArg>();

            string containerId = GetContainerID(args);

            if (containerId == "BadArgs")
            {
                cb(retArgs, containerId);
            }
            else
            {
                List<ITrack> containingList = _dbLookup.Browse(containerId);
                int NumberReturned = containingList.Count;

                string retVal = writer.ConvertITrackToXML(containingList);

                retArgs.Add(new UPnPArg("Result", retVal));
                retArgs.Add(new UPnPArg("NumberReturned", NumberReturned.ToString()));
                retArgs.Add(new UPnPArg("TotalMatches", NumberReturned.ToString()));

                cb(retArgs, "Browse");
            }
        }
开发者ID:GufCab,项目名称:Semester-Projekt---Pi-Program,代码行数:25,代码来源:DBHandle.cs

示例7: registerCallBack

 public void registerCallBack(CallBack callbackToRegister)
 {
     if(!m_Listeners.Contains(callbackToRegister))
     {
         m_Listeners.Add(callbackToRegister);
     }
 }
开发者ID:ZaikMD,项目名称:ImagineNation,代码行数:7,代码来源:AnimationCallBackManager.cs

示例8: addEventListner

 public void addEventListner(string eventType,CallBack function)
 {
     if(_listenList==null){
         _listenList		= new List<EventListenTerm>();
     }
     _listenList.Add(new EventListenTerm(eventType,function));
 }
开发者ID:hxflyer,项目名称:NanoGUI,代码行数:7,代码来源:EventDispatcher.cs

示例9: removeCallBack

 public void removeCallBack(CallBack callbackToRemove)
 {
     if (m_Listeners.Contains(callbackToRemove))
     {
         m_Listeners.Remove(callbackToRemove);
     }
 }
开发者ID:ZaikMD,项目名称:ImagineNation,代码行数:7,代码来源:AnimationCallBackManager.cs

示例10: string_callback

 public void string_callback(CallBack cb, [StringValue][WideChar(false)] string mesg) {
     if(cb == null) {
         Console.WriteLine("Received a nil callback.");
         return;
     }              
     cb.call_back(mesg);
 }
开发者ID:JnS-Software-LLC,项目名称:iiop-net,代码行数:7,代码来源:TestService.cs

示例11: LongForLoop

 //passing the delegate as a parameter
 // declaring the delegate
 public void LongForLoop(CallBack obj)
 {
     for (int i = 0; i < 10000; i++)
     {
         obj(i); //invokeing the delegate
     }
 }
开发者ID:higharc91,项目名称:LambdaAndDelegateExamples,代码行数:9,代码来源:DelegatesBetweenParties.cs

示例12: Request

    public static void Request(MethodType method, string uri, string body, CallBack<string> callBack)
    {
        try
        {
            Init("8aa5b8b5-f769-11e3-954e-06a6fa0000b9", "6ef2e5c0-3ef1-11e4-ae91-06a6fa0000b9");

            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(APIEndpoint + uri);

            request.Method = method.ToString();
            request.ContentType = "applications/json";

            if (PlayerPrefs.HasKey("access_token"))
            request.Headers["Authorization"] = "Bearer " + PlayerPrefs.GetString("access_token");

            if(request.Method == "POST" || request.Method == "PUT")
            {
                StreamWriter writer = new StreamWriter(request.GetRequestStream());
                writer.Write(body);
                writer.Close();
            }

            HttpWebResponse response = (HttpWebResponse)request.GetResponse();
            Stream dataStream = response.GetResponseStream();
            StreamReader reader = new StreamReader(dataStream);

            string responseFromServer = reader.ReadToEnd();

            callBack(responseFromServer);
        }
        catch(Exception e)
        {
            Debug.Log(e.Message);
        }
    }
开发者ID:ylyking,项目名称:AssetBundleCreator-1,代码行数:34,代码来源:BaasIOBinding.cs

示例13: FadeAction

    IEnumerator FadeAction(bool isFadeIn,float tempFadeTime,  CallBack _fun)
    {
        tempColor = GUI.color;
        GUI.depth = 100;
        fadeTime = tempFadeTime;

        if (isFadeIn) alpha = 0;
        else alpha = 1;

        if (crossfadeTexture == null)
        {
            crossfadeTexture = new Texture2D(1, 1, TextureFormat.RGB24, false);
            crossfadeTexture.SetPixel(0, 0, Color.black);
            crossfadeTexture.Apply();
        }

        isFading = true;
        float tempTime = fadeTime + Time.unscaledTime; ;

        while (true)
        {
                if (!isFadeIn)
                {
                    alpha = (tempTime - Time.unscaledTime) / fadeTime;

                    if (alpha < 0.05f)
                    {
                        alpha = 0;
                        break;
                    }
                }
                else
                {
                    alpha = Mathf.Clamp(1 - ((tempTime - Time.unscaledTime) / fadeTime), 0f, 1f);

                    if (alpha >= 0.98f)
                    {
                        alpha = 1;
                        break;
                    }
                }
            yield return new WaitForEndOfFrame();
        }
        yield return new WaitForEndOfFrame();
        isFading = false;
        Debug.Log("Camera fade alpha: " + alpha);
        try
        {
            if (_fun != null)
            {
                _fun();
            }
        }
        catch (Exception e)
        {
            Debug.LogError("Camera Fade Call back Exception :" + e);
        }
          //  yield return new WaitForEndOfFrame();
    }
开发者ID:GaoKaiHaHa,项目名称:MyUnityFrameWork,代码行数:59,代码来源:CameraFade.cs

示例14: onShowDCN

 public void onShowDCN(string mess, CallBack clickOK) {
     DoOnMainThread.ExecuteOnMainThread.Enqueue(() => {
         this.lb_mess.text = mess;
         btnOK.gameObject.SetActive(true);
         onClickOK = clickOK;
         onShow();
     });
 }
开发者ID:sonxoans2,项目名称:CoThu,代码行数:8,代码来源:PanelThongBao.cs

示例15: Main

        public static void Main(string[] args)
        {
            // Create an instance of the delegate
            CallBack myCallBack = new CallBack(Program.Report);

            // Call the function
            EnumWindows(myCallBack, 0);
        }
开发者ID:oblivious,项目名称:Oblivious,代码行数:8,代码来源:Program.cs


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