本文整理汇总了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));
}
}
示例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
}
示例3: FadeOut
//淡出
public void FadeOut(float _fadeOutTime, CallBack _fun = null)
{
if (!isFading)
{
StartCoroutine(FadeAction(false,_fadeOutTime, _fun));
}
}
示例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());
});
}
示例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));
}
}
示例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");
}
}
示例7: registerCallBack
public void registerCallBack(CallBack callbackToRegister)
{
if(!m_Listeners.Contains(callbackToRegister))
{
m_Listeners.Add(callbackToRegister);
}
}
示例8: addEventListner
public void addEventListner(string eventType,CallBack function)
{
if(_listenList==null){
_listenList = new List<EventListenTerm>();
}
_listenList.Add(new EventListenTerm(eventType,function));
}
示例9: removeCallBack
public void removeCallBack(CallBack callbackToRemove)
{
if (m_Listeners.Contains(callbackToRemove))
{
m_Listeners.Remove(callbackToRemove);
}
}
示例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);
}
示例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
}
}
示例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);
}
}
示例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();
}
示例14: onShowDCN
public void onShowDCN(string mess, CallBack clickOK) {
DoOnMainThread.ExecuteOnMainThread.Enqueue(() => {
this.lb_mess.text = mess;
btnOK.gameObject.SetActive(true);
onClickOK = clickOK;
onShow();
});
}
示例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);
}