private void StartThread() { if (_comThread != null) StopThread(); _comThread = new LoopThread(MainLoop); }
public LottieView(bool fullFps) { _limitFps = !fullFps; _thread = fullFps ? LoopThread.Chats : LoopThreadPool.Stickers.Get(); _threadUI = fullFps ? LoopThread.Chats : LoopThread.Stickers; DefaultStyleKey = typeof(LottieView); }
static public Operation DoFuncOnThread <R>(LoopThread loopThrad, Func <R> func, VFunc1 <R> callback = null, bool callbackOnMainThread = true, long delay = 0) { Invocation <R, Null, Null> inv = new Invocation <R, Null, Null> (func, 0, null, true); Invocation <Null, R, Null> cbInv = callback == null ? null : new Invocation <Null, R, Null> (callback, 1); Operation operation = new Operation(inv, ApplicationEX.GetCurrnSystemMillisecond() + delay, cbInv, callbackOnMainThread); loopThrad.addExecution(operation); return(operation); }
private void StopThread() { if (_comThread == null) return; _comThread.Dispose(); _comThread = null; }
static public Operation DoFuncOnThread <R, Arg1, Arg2>(LoopThread loopThrad, Func2 <R, Arg1, Arg2> func, Arg1 arg1, Arg2 arg2, VFunc1 <R> callback = null, bool callbackOnMainThread = true, long delay = 0) { object[] args = { arg1, arg2 }; Invocation <R, Arg1, Arg2> inv = new Invocation <R, Arg1, Arg2> (func, 2, args, true); Invocation <Null, R, Null> cbInv = callback == null ? null : new Invocation <Null, R, Null> (callback, 1); Operation operation = new Operation(inv, ApplicationEX.GetCurrnSystemMillisecond() + delay, cbInv, callbackOnMainThread); loopThrad.addExecution(operation); return(operation); }
static public Operation DoVoidFuncOnThread <Arg>(LoopThread loopThrad, VFunc1 <Arg> func, Arg arg, VFunc callback = null, bool callbackOnMainThread = true, long delay = 0) { object[] args = { arg }; Invocation <Null, Arg, Null> inv = new Invocation <Null, Arg, Null> (func, 1, args); Invocation <Null, Null, Null> cbInv = callback == null ? null : new Invocation <Null, Null, Null> (callback); Operation operation = new Operation(inv, ApplicationEX.GetCurrnSystemMillisecond() + delay, cbInv, callbackOnMainThread); loopThrad.addExecution(operation); return(operation); }
//移除線程 public static void RemoveLoop(LoopThread loop) { CurrentLoops.Remove(loop); }
//增加線程 public static void AddLoop(string[] code) { LoopThread loop = new LoopThread(code); CurrentLoops.Add(loop); }