IEnumerator CallWrapper() { yield return(null); IEnumerator e = coroutine; while (running) { if (paused) { yield return(null); } else { if (e != null && e.MoveNext()) { yield return(e.Current); } else { running = false; } } } FinishedHandler handler = Finished; if (handler != null) { handler(stopped); } }
// Constructor. public Timer(float seconds, FinishedHandler finishedCallback = null, bool running = true, bool loop = true) { this.secondsTarget = seconds; this.finishedCallback = finishedCallback; this.running = running; this.loop = loop; }
public Task( IEnumerator c, FinishedHandler handler, bool autoStart = true) : this(c, autoStart) { Finished += handler; }
private void _taskStateFinished(bool manual) { FinishedHandler handler = _finished; if (handler != null) { handler(manual); } }
void TaskFinished(bool manual) { FinishedHandler handler = Finished; if (handler != null) { handler(manual); } }
public bool AddFinishedListener(FinishedHandler handler) { if (this.m_finishedListeners.Contains(handler)) { return false; } this.m_finishedListeners.Add(handler); return true; }
private void InitControls() { txtMsg.Text = string.Empty; progressBar1.Visible = false; _progressHandler = new ProgressHandler(DoProgress); _writeLogHandler = new WriteLogHandler(DoLog); _finishedHandler = new FinishedHandler(Finished); FormClosing += new FormClosingEventHandler(frmActionExecutor_FormClosing); }
public void TimerFinished(bool manual) { FinishedHandler handler = Finished; if (handler != null) { handler(manual); } }
public BinaryExecuter(string binaryPath, string args, string transactionId, string invocationId, FinishedHandler finishedHandler) { _binaryPath = binaryPath; _workingDirectory = Path.GetDirectoryName(_binaryPath); _args = args; _transactionid = transactionId; _invocationId = invocationId; _finishedHandler = finishedHandler; }
void TaskFinished(bool manual, string name) { FinishedHandler handler = Finished; if (handler != null) { handler(manual, name); } }
private void TaskFinished(bool manual) { FinishedHandler finished = this.Finished; if (finished != null) { finished(manual); } }
/// <summary> /// 结束 /// </summary> public void finishExec() { // 目标协程执行结束 FinishedHandler handler = EventFinished; if (handler != null) { handler(_bStoped, this); } }
void TaskFinished(bool manual) { FinishedHandler handler = Finished; if (handler != null) { handler(manual); } EventDelegate.Execute(onFinish); }
void TaskFinished(bool manual) { FinishedHandler handler = Finished; if (handler != null) { handler(manual); } if (flushAtFinish) { Flush(); } }
// Constructor. public Timer(float seconds, FinishedHandler FinishedCallback = null, bool loop = true, bool clearOnRun = false, StartedHandler StartedCallback = null, StoppedHandler StoppedCallback = null, TickedHandler TickedCallback = null) { this.secondsTarget = seconds; this.Finished = FinishedCallback; this.loop = loop; this.clearOnRun = clearOnRun; this.Started = StartedCallback; this.Stopped = StoppedCallback; this.Ticked = TickedCallback; runner = new Runner(OnStarted, OnStopped); }
/// <summary> /// Erzeugt eine neue Datenkanalinstanz. /// </summary> /// <param name="socket">Der zugehörige Datenkanal.</param> /// <param name="onFinished">Methode, die nach dem Schliessen des Datenkanals aufgerufen werden soll.</param> public DataChannel(Socket socket, FinishedHandler onFinished) { // Remember m_OnFinished = onFinished; // Attach to socket m_Socket = socket; // Use asynchronous m_Socket.Blocking = false; // Report FTPMain.Log("DataChannel created"); }
public void UpdateTime(float time) { time = ignoreTimeScale ? time - currentTime : time; if (running) { if (paused) { return; } switch (timeUnit) { case TimeUnit.FrameRate: currentTime += 1; break; case TimeUnit.Second: currentTime += time; break; case TimeUnit.CentiSecond: currentTime += time * 100; break; case TimeUnit.MilliSecond: currentTime += time * 1000; break; } if (currentTime >= attackTime) { if (HasRepeat) { ResetState(); } else { Stop(); } FinishedHandler handle = Finished; if (handle != null) { handle(stopped); } } } }
// Constructor. public Timer(float seconds, FinishedHandler FinishedCallback = null, bool loop = true, bool clearOnRun = false, StartedHandler StartedCallback = null, StoppedHandler StoppedCallback = null, TickedHandler TickedCallback = null) { if (seconds <= 0.0f) { Debug.LogError("Prevented instantiation of a timer that loops every " + seconds + " seconds. Make sure timers run for longer than 0 seconds. " + "The timer has been set to loop every second to prevent an infinite loop."); seconds = 1.0f; } this.secondsTarget = seconds; this.Finished = FinishedCallback; this.loop = loop; this.clearOnRun = clearOnRun; this.Started = StartedCallback; this.Stopped = StoppedCallback; this.Ticked = TickedCallback; runner = new Runner(OnStarted, OnStopped); }
/// <summary> /// 每个资源加载完成回调函数 /// </summary> private void CallbackOneLoadFinished(bool manual) { m_CurFreeCoroutineNum++; m_completeIndex++; FinishedHandler handler = OneFinished; if (handler != null) { handler(manual); } if (isDone()) { CallbackListLoadFinished(manual); } else { LoadNext(); } }
private IEnumerator CallWrapper() { //Debug.Log("CallWrapper"); yield return(null); UnityEngine.Profiling.Profiler.BeginSample("CallWrapper 1: " + _coroutine.ToString()); IEnumerator e = _coroutine; UnityEngine.Profiling.Profiler.EndSample(); while (running) { if (paused) { yield return(null); } else { UnityEngine.Profiling.Profiler.BeginSample("CallWrapper 2: " + e); bool flag = e.MoveNext(); UnityEngine.Profiling.Profiler.EndSample(); if (e != null && flag) { yield return(e.Current); } else { running = false; } } } UnityEngine.Profiling.Profiler.BeginSample("CallWrapper 3: " + e.ToString()); FinishedHandler handler = Finished; if (handler != null) { handler(stopped); } UnityEngine.Profiling.Profiler.EndSample(); }
public TaskRunner(IEnumerator c, FinishedHandler handler, bool autoStart = true) : this(c, autoStart) { TaskFinishedHandler += handler; }
/// <summary> /// Start sending <paramref name="recordedActions"/> to the <see cref="window"/> and invoke <paramref name="finishedCallback"/> when done. /// </summary> public static void StartPlayback(EditorWindow window, IList <UserAction> recordedActions, FinishedHandler finishedCallback) { foreach (EditorWindowTestPlayer testPlayer in Resources.FindObjectsOfTypeAll <EditorWindowTestPlayer>()) { testPlayer.Close(); } IsPlaying = true; EditorWindowTestPlayer player = CreateInstance <EditorWindowTestPlayer>(); player.ShowUtility(); player.Finished += finishedCallback; player.window = window; foreach (UserAction action in recordedActions) { TestableEditorElements.StartPlayback(action.PrepickedSelections); player.window.SendEvent(action.Event); player.SendEvent(EditorGUIUtility.CommandEvent("Wait")); } player.SendEvent(EditorGUIUtility.CommandEvent("Finished")); }
static void Main(string[] args) { var player = new MoviePlayer(); player.CurrentMovie = "Star Wars"; //player.Finished += DisplayFinishedMessage; //player.Finished += ( // (name) => // { // int a = 3; // a += 1; // Console.WriteLine($"finished movie {name}."); // } //); FinishedHandler handler = ((name) => Console.WriteLine($"finished movie {name}.")); player.Finished += handler; player.Finished += (name) => Console.WriteLine("second handler too!"); player.Finished -= handler; // handler would no longer be called player.Finished += handler; player.PlayMovie(); // ////////////////////// LAMBDA EXPRESSIONS WITH LINQ var movieNames = new List <string>() { "Star Wars", "Toy Story", "Jurassic Park", "The Godfather", "The Avengers", "Cinderella" }; //int maxLength = 0; //for (int i = 0; i < movieNames.Count; i++) //{ // if (movieNames[i].Length > maxLength) // { // } //} movieNames.Max(movieName => movieName.Length); // returns 13 // first movie name that starts with a T movieNames.First(x => x[0] == 'T'); // LINQ Language-Integrated Query Language // works on any IEnumerable<> or IQueryable<> var y = movieNames.Select(x => x[1]).ToList(); // get the second character of each movie name }
// Change the timer's finished callback function. public void SubscribeToFinished(FinishedHandler Callback) { Finished = Callback; }
void Finished(bool manual) { FinishedHandler handler = TaskFinishedHandler; handler?.Invoke(manual); }
/// <summary> /// Erzeugt eine neue Client Verbindung. /// </summary> /// <param name="socket">Netzwerkverbindung zum Client.</param> /// <param name="file">Die Datei, die diesem Client zugeordnet ist.</param> /// <param name="onFinished">Methode zum Rückrufe nach Beenden der Verbindung.</param> public FTPClient(Socket socket, FileInfo file, FinishedHandler onFinished) { // Remember m_OnFinished = onFinished; m_Socket = socket; m_File = file; // Asnychronous m_Socket.Blocking = false; // Start reply Send(220, "FTP Wrap"); // Register m_Processors["ABOR"] = ProcessABOR; m_Processors["RETR"] = ProcessRETR; m_Processors["LIST"] = ProcessLIST; m_Processors["PASV"] = ProcessPASV; m_Processors["TYPE"] = ProcessTYPE; m_Processors["QUIT"] = ProcessQUIT; m_Processors["USER"] = ProcessUSER; m_Processors["PASS"] = ProcessPASS; m_Processors["SYST"] = ProcessSYST; m_Processors["CWD"] = ProcessCWD; }