private void When(Action when) { using (_mocks.Playback()) { when.Invoke(); } }
public void PostJSON( string inURL, JsonObject inJSON, Action< string, JsonObject > inCallback ) { var headers = new Dictionary< string, string >(); headers[ "Content-Type" ] = "application/json"; var jsonString = SimpleJson.SimpleJson.SerializeObject( inJSON ); Post( inURL, System.Text.Encoding.UTF8.GetBytes( jsonString ), headers, ( string inError, WWW inWWW ) => { if( inCallback != null ) { JsonObject obj = null; if ( string.IsNullOrEmpty( inError ) && ! string.IsNullOrEmpty( inWWW.text ) ) { Debug.Log("Response: " + inWWW.text ); object parsedObj = null; if ( SimpleJson.SimpleJson.TryDeserializeObject( inWWW.text, out parsedObj ) ) { obj = ( JsonObject ) parsedObj; } } inCallback( inError, obj ); } } ); }
public void RemoveVoxelAnimation(bool hasPreviousBlock, Voxel voxel, Action finishCallback) { if (_animDic.ContainsKey(voxel.Pos)) { AnimTuple anim = _animDic[voxel.Pos]; anim.Trans.GetComponent<MeshRenderer>().material.color = voxel.Color; anim.Trans.GetComponent<DummyBehavior>().StopAllCoroutines(); anim.Cor = anim.Trans.GetComponent<DummyBehavior>().StartCoroutine(RemoveVoxelAnimationCor(voxel.Pos, anim.Trans, () => { finishCallback(); })); } else { if (hasPreviousBlock) { AnimTuple anim = new AnimTuple(); _animDic[voxel.Pos] = anim; anim.Trans = CreateAnimTransform(voxel); anim.Trans.localScale = Vector3.one; anim.Cor = anim.Trans.GetComponent<DummyBehavior>().StartCoroutine(RemoveVoxelAnimationCor(voxel.Pos, anim.Trans, () => { finishCallback(); })); } } }
public bool PosTest1() { bool retVal = true; TestLibrary.TestFramework.BeginScenario("PosTest1: The generic type is int"); try { int[] iArray = { 1, 9, 3, 6, -1, 8, 7, 1, 2, 4 }; List<int> listObject = new List<int>(iArray); MyClass myClass = new MyClass(); Action<int> action = new Action<int>(myClass.sumcalc); listObject.ForEach(action); if (myClass.sum != 40) { TestLibrary.TestFramework.LogError("001", "The result is not the value as expected,sum is: " + myClass.sum); retVal = false; } } catch (Exception e) { TestLibrary.TestFramework.LogError("002", "Unexpected exception: " + e); retVal = false; } return retVal; }
string RepositoryScope(ExecuteCore executeCore = null, Action<EmptyRepositoryFixture, VersionVariables> fixtureAction = null) { // Make sure GitVersion doesn't trigger build server mode when we are running the tests Environment.SetEnvironmentVariable("APPVEYOR", null); var infoBuilder = new StringBuilder(); Action<string> infoLogger = s => { infoBuilder.AppendLine(s); }; executeCore = executeCore ?? new ExecuteCore(fileSystem); Logger.SetLoggers(infoLogger, s => { }, s => { }); using (var fixture = new EmptyRepositoryFixture(new Config())) { fixture.Repository.MakeACommit(); var vv = executeCore.ExecuteGitVersion(null, null, null, null, false, fixture.RepositoryPath, null); vv.AssemblySemVer.ShouldBe("0.1.0.0"); vv.FileName.ShouldNotBeNullOrEmpty(); if (fixtureAction != null) { fixtureAction(fixture, vv); } } return infoBuilder.ToString(); }
public static void GetEmail(GameObject sender, Action<bool, string> callback) { if (sender != null) { //sender.renderer.enabled = false; } Facebook.instance.graphRequest("/me?fields=email", (e, o) => { if (e == null) { Dictionary<string, object> dic = (Dictionary<string, object>)o; string email = (string)dic["email"]; if (callback != null) { callback(true, email); } } else { if (callback != null) { callback(false, ""); } } //sender.renderer.enabled = true; }); }
public void OnActionExecuted(HttpContext httpContext, Action baseAction) { DetermineRequestType(HttpContext.Current.Request); switch (_requestType) { case CrossOriginRequestType.Cors: // If the Origin header is in the request, then process this as a CORS request // Let the default filter process the request baseAction(); // Add response headers for the CORS request var response = httpContext.Response; // Allow all origins response.AppendHeader(AccessControlAllowOriginHeader, _origin); response.AppendHeader(AccessControlAllowCredentials, "true"); break; default: baseAction(); break; } }
public void OnCompleted (Action continuation) { if (continuation == null) throw new ArgumentNullException ("continuation"); TaskAwaiter.HandleOnCompleted (task, continuation, continueOnSourceContext); }
public void OnCompleted (Action continuation) { if (continuation == null) throw new ArgumentNullException ("continuation"); HandleOnCompleted (task, continuation, true); }
void OnGUI() { if (Pause.IsPaused) { if (_action == Action.None) { if (ResumeButton()) { _selection = Action.Resume; Pause.Resume(); _action = Action.None; } else if (ExitButton()) { selectSound.Play(); _action = Action.Exit; _selection = Action.Exit; } } else { if (_action == Action.Resume) { ResumeButton(); } else if (_action == Action.Exit) { ExitButton(); } } } }
public static void AddAction(string actionName, float delayMs) { if (ActionDelayList.Any(a => a.Name == actionName)) return; // Id is in list already var nAction = new Action {Name = actionName, Delay = delayMs}; ActionDelayList.Add(nAction); }
public Action punish(Action action) { switch (pissOffLevel) { case 0: return action; case 1: return LevelOneAction(action); case 2: return LevelTwoAction(action); case 3: return LevelThreeAction(action); case 4: return LevelFourAction(action); case 5: return LevelFiveAction(action); case 6: return LevelSixAction(action); case 7: return LevelSevenAction(action); case 8: return LevelEightAction(action); case 9: return LevelNineAction(action); case 10: return LevelTenAction(action); } return action; }
public static void Create (Action done) { const string section = "PTestPlaytomic.PlayerLevels.Create"; Debug.Log(section); var level = new PlayerLevel { name = "create level" + rnd, playername = "ben" + rnd, playerid = "0", data = "this is the level data", fields = new Dictionary<string,object> { {"rnd", rnd} } }; Playtomic.PlayerLevels.Save (level, (l, r) => { l = l ?? new PlayerLevel (); AssertTrue (section + "#1", "Request succeeded", r.success); AssertEquals (section + "#1", "No errorcode", r.errorcode, 0); AssertTrue (section + "#1", "Returned level is not null", l.Keys.Count > 0); AssertTrue (section + "#1", "Returned level has levelid", l.ContainsKey ("levelid")); AssertEquals (section + "#1", "Level names match", level.name, l.name); Playtomic.PlayerLevels.Save (level, (l2, r2) => { AssertTrue (section + "#2", "Request succeeded", r2.success); AssertEquals (section + "#2", "Duplicate level errorcode", r2.errorcode, 405); done (); }); }); }
public Animation(Action action, int row, int frames) { Action = action; Row = row; Frames = frames; FrameLength = 150; }
/** * Constructs a node with the specified state, parent, action, and path * cost. * * @param state * the state in the state space to which the node corresponds. * @param parent * the node in the search tree that generated the node. * @param action * the action that was applied to the parent to generate the * node. * @param pathCost * full pathCost from the root node to here, typically * the root's path costs plus the step costs for executing * the the specified action. */ public Node(System.Object state, Node parent, Action action, double stepCost) : this(state) { this.parent = parent; this.action = action; this.pathCost = parent.pathCost + stepCost; }
public void OnEntityAct(Action act) { switch(act) { case Action.start: break; case Action.idle: //revived! if(prevAction == Entity.Action.die) { Invulnerable(hurtInvulDelay); mController.enabled = true; } planetAttach.ResetMotion(); break; case Action.hurt: _SetActionDisablePlayer(); Invulnerable(hurtInvulDelay); break; case Action.die: _SetActionDisablePlayer(); break; case Action.victory: _SetActionDisablePlayer(); break; } }
//------------------------------------------------------------------------- public override void createAssetLoad(string asset_path, string asset_name, AsyncAssetLoadGroup async_assetloadgroup, Action<UnityEngine.Object> loaded_action) { AssetPath = asset_path; RequestLoadAssetInfo request_loadassetinfo = new RequestLoadAssetInfo(); request_loadassetinfo.AssetName = asset_name; request_loadassetinfo.LoadedAction = loaded_action; List<RequestLoadAssetInfo> list_requestloadasssetinfo = null; MapRequestLoadAssetInfo.TryGetValue(async_assetloadgroup, out list_requestloadasssetinfo); if (list_requestloadasssetinfo == null) { list_requestloadasssetinfo = new List<RequestLoadAssetInfo>(); } list_requestloadasssetinfo.Add(request_loadassetinfo); MapRequestLoadAssetInfo[async_assetloadgroup] = list_requestloadasssetinfo; if (mAssetBundleCreateRequest == null) { mAssetBundleCreateRequest = AssetBundle.LoadFromFileAsync(asset_path); } }
private TeredoHelper(Action<object> callback, object state) { this.callback = callback; this.state = state; this.onStabilizedDelegate = new StableUnicastIpAddressTableDelegate(OnStabilized); this.runCallbackCalled = false; }
public static void ShowAlertBox(string message, string title, Action onFinished = null) { var alertPanel = GameObject.Find("Canvas").transform.Find("AlertBox"); if (alertPanel == null) { alertPanel = (Instantiate(Resources.Load("AlertBox")) as GameObject).transform; alertPanel.gameObject.name = "AlertBox"; alertPanel.SetParent(GameObject.Find("Canvas").transform); alertPanel.localPosition = new Vector3(-6f, -6f, 0f); } alertPanel.Find("title").GetComponent<Text>().text = title; alertPanel.Find("message").GetComponent<Text>().text = message; alertPanel.gameObject.SetActive(true); if (onFinished != null) { var button = alertPanel.Find("alertBtn").GetComponent<Button>(); UnityAction onclick = null; onclick = () => { onFinished(); alertPanel.gameObject.SetActive(false); button.onClick.RemoveListener(onclick); }; button.onClick.RemoveAllListeners(); button.onClick.AddListener(onclick); } }
public PathRequest(Vector3 _start, Vector3 _end, Action<Vector3[], bool> _callback, GameObject unitGObj) { pathStart = _start; pathEnd = _end; callback = _callback; unitGObjRequesting = unitGObj; }
public void FadeInBlack(Action callback) { if (_fading) return; StartCoroutine(FadeInAsync(callback)); }
public SCAnimationInfo(Action callback, float time) { mCallback = callback; mTime = time; mStatus = Status.NOT_STARTED; }
private void animateToColor(Color color, float waitDuration, Action completion) { LeanTween. color(gameObject, color, duration). setEase(LeanTweenType.easeInOutQuad). setOnComplete(completion).setDelay(waitDuration); }
public override IEnumerator ChooseAction(Action Finish) { System.Random r = new System.Random(); GameObject player = GameObject.FindWithTag("Player"); singleAttackTarget = player.transform.parent.gameObject.GetComponent<Battler>(); List<statusEffect> playerStatusEffects = singleAttackTarget.battleState.statusEffects; if (playerStatusEffects.Exists(se => se.name == "Shapeshifter Toxin")) { DoAction = DoubleAttack; } else { int n = r.Next(3); if (n == 2) //33% of time { DoAction = Toxin; } else //66% of time { DoAction = BasicAttack; } } Finish(); yield break; }
protected Actor(DrawTag drawTag, string name) : base(drawTag, name) { nextAction = null; canOpenDoors = false; energy = 0; }
private static void ProcessAction(Action action) { var target = GetInstance(action.Type); var targetMethod = target.GetType().GetMethod(action.Method); targetMethod.Invoke(target, action.Params); }
public void StartCountdown(int hours, int minutes, int seconds, Action callback) { countFrom = new TimeSpan(hours, minutes, seconds); stopWatch = new Stopwatch(); cb = callback; stopWatch.Start(); }
private void SlowDown(BindingList<DebugLine> bindedList, Action<BindingList<DebugLine>> action) { var uiSynchronyzer = new UISynchronyzer<IList<IEvent<ListChangedEventArgs>>>(); Observable.FromEvent<ListChangedEventArgs>(bindedList, "ListChanged").BufferWithTime(TimeSpan.FromSeconds(1)). Subscribe(uiSynchronyzer); uiSynchronyzer.Subscribe(ev => action(bindedList)); }
public bool PosTest2() { bool retVal = true; TestLibrary.TestFramework.BeginScenario("PosTest2: The generic type is type of string"); try { string[] strArray = { "Hello", "wor", "l", "d" }; List<string> listObject = new List<string>(strArray); MyClass myClass = new MyClass(); Action<string> action = new Action<string>(myClass.joinstr); listObject.ForEach(action); if (myClass.result != "Helloworld") { TestLibrary.TestFramework.LogError("003", "The result is not the value as expected,sum is: " + myClass.sum); retVal = false; } } catch (Exception e) { TestLibrary.TestFramework.LogError("004", "Unexpected exception: " + e); retVal = false; } return retVal; }
public virtual void Draw(Action<Graphics> drawAction) { if (!IsDisposed && this.offGr != null) { drawAction(this.offGr); } }
/// <summary> /// Database query wrapper for select statement /// </summary> /// <param name="code">Code block to run</param> /// <param name="query">Query string</param> /// <param name="values">Key value pairs</param> public static SelectQuery SelectQuery(String query, Action <MySqlDataReader> code) { DBManager.Instance().IsConnect(); return(new SelectQuery(query, code)); }
public static extern void ArPresto_checkApkAvailability( Action <ArAvailability, IntPtr> onResult, IntPtr context);
public Reading(string name, start callback, Action <string, string> timeOver) { timer = new Timer(name); del = callback; this.timeOver = timeOver; }
public static void OnAll<T1, T2, T3, T4>(this IEnumerable<T1> e, Action<T1, T2, T3, T4> f, T2 arg1, T3 arg2, T4 arg3) { foreach (T1 t in e) f(t, arg1, arg2, arg3); }
public static void OnAll<T1, T2>(this IEnumerable<T1> e, Action<T1, T2> f, T2 arg1) { foreach (T1 t in e) f(t, arg1); }
/// <summary> /// Performs <paramref name="f"/> on all <typeparamref name="T"/> intances in <paramref name="e"/>. /// </summary> /// <typeparam name="T">The type of members in <see cref="e"/>.</typeparam> /// <param name="e">The <see cref="IEnumerable{T}"/> which needs to have <paramref name="f"/> carried out on /// its entries.</param> /// <param name="f">A method with no return value that accepts values of <typeparamref name="T"/>.</param> public static void OnAll<T>(this IEnumerable<T> e, Action<T> f) { foreach (T t in e) f(t); }
public void FindPath(PathRequest request, Action <PathResult> callback) { Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); Vector3[] waypoints = new Vector3[0]; bool pathSuccess = false; CNode startNode = grid.GetNodeFromWorldPoint(request.pathStart); CNode endNode = grid.GetNodeFromWorldPoint(request.pathEnd); if (startNode.walkable && endNode.walkable) { CHeap <CNode> openSet = new CHeap <CNode>(grid.MaxSize); HashSet <CNode> closedSet = new HashSet <CNode>(); openSet.Add(startNode); while (openSet.Count > 0) { CNode currentNode = openSet.RemoveFirst(); closedSet.Add(currentNode); if (currentNode == endNode) { stopwatch.Stop(); print("Path found: " + stopwatch.ElapsedMilliseconds + " ms"); pathSuccess = true; break; } foreach (CNode neighbour in grid.GetNeighbours(currentNode)) { if (!neighbour.walkable || closedSet.Contains(neighbour)) { continue; } int newMovementCostToNeighbour = currentNode.gCost + GetDistance(currentNode, neighbour) + neighbour.movementPenalty; if (newMovementCostToNeighbour < neighbour.gCost || !openSet.Contains(neighbour)) { neighbour.gCost = newMovementCostToNeighbour; neighbour.hCost = GetDistance(neighbour, endNode); neighbour.parent = currentNode; if (!openSet.Contains(neighbour)) { openSet.Add(neighbour); } else { openSet.UpdateItem(neighbour); } } } } } if (pathSuccess) { waypoints = RetracePath(startNode, endNode); pathSuccess = waypoints.Length > 0; } callback(new PathResult(waypoints, pathSuccess, request.callback)); }
public MultiThreadDispatcher(Action<T> process, int waitLength, int maxThreads) { mProcess = process; mWaitLength = waitLength; mMaxThreads = maxThreads; }
public virtual bool Write(ReaderWriterLock instance, int millisecondsTimeout, Func <bool> read, Action write) { instance.AcquireReaderLock(millisecondsTimeout); try { if (read()) { return(true); } else { LockCookie cookie = instance.UpgradeToWriterLock(millisecondsTimeout); try { if (read()) { return(true); } else { write(); } } finally { instance.DowngradeFromWriterLock(ref cookie); } } } finally { instance.ReleaseReaderLock(); } return(false); }
// TODO: add comments (ez) // <! this is a comment !> /// <summary> /// </summary> private static Node FromCGML_0_4_0(string str) { if (string.IsNullOrEmpty(str)) { return(null); } Node root = null; ReadElement elementType = ReadElement.None; bool reading = false; ReadScope scope = ReadScope.Default; Node thisNode = null; StringBuilder element = new StringBuilder(); char lastChar = (char)0; Func <string> commitElement = new Func <string>(() => { string s = element.ToString(); element.Clear(); return(s); }); Action commitNodeKey = new Action(() => { Node newNode = new Node(commitElement()); if (root == null) { root = newNode; } else { thisNode.Push(newNode); } thisNode = newNode; }); Action commitAttributeKey = new Action(() => { thisNode.Attributes.Set(new Attribute(commitElement())); elementType = ReadElement.None; }); Action commitValue = new Action(() => { switch (scope) { case ReadScope.Node: { thisNode.Value = commitElement(); break; } case ReadScope.Attribute: { thisNode.Attributes[thisNode.Attributes.Count - 1].Value = commitElement(); break; } } elementType = ReadElement.None; }); for (int i = 0; i < str.Length; i++) { if (i < str.Length) { char c = str[i]; char nextChar = i < str.Length - 1 ? str[i + 1] : (char)0; if (reading) { switch (c) { case CGML.STRING_BEGIN_END: { if (lastChar == '\\') { break; } commitValue(); reading = false; break; } default: { element.Append(c); break; } } } else { switch (c) { // Ignore newlines case '\n': break; // Ignore carriage return case '\r': break; // Ignore tabs case '\t': break; case CGML.NODE_BEGIN: { scope = ReadScope.Node; elementType = ReadElement.Key; break; } case CGML.NODE_END: { scope = ReadScope.Default; elementType = ReadElement.None; break; } case CGML.STRING_BEGIN_END: { elementType = ReadElement.Value; reading = true; break; } case CGML.EQUAL_OPERATOR: { if (elementType == ReadElement.Key && scope == ReadScope.Attribute) { commitAttributeKey(); break; } break; } case ' ': { scope = ReadScope.Attribute; elementType = ReadElement.Key; break; } case CGML.NODE_ENDMARK: { thisNode = thisNode.Parent; break; } default: { if (elementType != ReadElement.None) { element.Append(c); } break; } } } if (scope == ReadScope.Node && elementType == ReadElement.Key) { if (nextChar == CGML.NODE_END || nextChar == CGML.EQUAL_OPERATOR || nextChar == ' ') { commitNodeKey(); } } lastChar = c; } } return(root); }
/// <summary> /// Executes the razor page. /// </summary> /// <param name="webPage">The web page.</param> /// <param name="setParameters">Delegate to set the parameters.</param> /// <param name="resultType">The type of the result.</param> /// <param name="functionContextContainer">The function context container</param> /// <returns></returns> public static object ExecuteRazorPage( WebPageBase webPage, Action<WebPageBase> setParameters, Type resultType, FunctionContextContainer functionContextContainer) { HttpContext currentContext = HttpContext.Current; var startPage = StartPage.GetStartPage(webPage, "_PageStart", new[] { "cshtml" }); // IEnumerable<PageExecutionListener> pageExecutionListeners; HttpContextBase httpContext; if (currentContext == null) { httpContext = new NoHttpRazorContext(); // pageExecutionListeners = new PageExecutionListener[0]; } else { httpContext = new HttpContextWrapper(currentContext); // pageExecutionListeners = httpContext.PageInstrumentation.ExecutionListeners; } var pageContext = new WebPageContext(httpContext, webPage, startPage); if (functionContextContainer != null) { pageContext.PageData.Add(PageContext_FunctionContextContainer, functionContextContainer); } if (setParameters != null) { setParameters(webPage); } var sb = new StringBuilder(); using (var writer = new StringWriter(sb)) { //// PageExecutionContext enables "Browser Link" support //var pageExecutionContext = new PageExecutionContext //{ // TextWriter = writer, // VirtualPath = PathUtil.Resolve(webPage.VirtualPath), // StartPosition = 0, // IsLiteral = true //}; //pageExecutionListeners.ForEach(l => l.BeginContext(pageExecutionContext)); webPage.ExecutePageHierarchy(pageContext, writer); //pageExecutionListeners.ForEach(l => l.EndContext(pageExecutionContext)); } string output = sb.ToString(); if (resultType == typeof(XhtmlDocument)) { if (string.IsNullOrWhiteSpace(output)) return new XhtmlDocument(); try { return XhtmlDocument.ParseXhtmlFragment(output); } catch (XmlException ex) { string[] codeLines = output.Split(new [] { Environment.NewLine, "\n" }, StringSplitOptions.None); XhtmlErrorFormatter.EmbedSourceCodeInformation(ex, codeLines, ex.LineNumber); throw; } } return ValueTypeConverter.Convert(output, resultType); }
public SingleThreadDispatcher(Action<T> process) { Process = process; mQueue = new System.Collections.Concurrent.ConcurrentQueue<T>(); }
public static IApplicationBuilder UseVirtualFolders(this IApplicationBuilder appBuilder, Action<VirtualFolderOptions> configureVirtualFolders) { if (configureVirtualFolders != null) { var virtualFolderOptions = appBuilder.ApplicationServices.GetRequiredService<IOptions<VirtualFolderOptions>>().Value; configureVirtualFolders(virtualFolderOptions); var rewriteOptions = new RewriteOptions().Add(new VirtualFoldersUrlRewriteRule(virtualFolderOptions)); appBuilder.UseRewriter(rewriteOptions); } return appBuilder; }
public virtual bool Write(ReaderWriterLock instance, Func <bool> read, Action write) { return(Write(instance, -1, read, write)); }
public static void DrawProperty(SerializedProperty property, string content, Action setter, params GUILayoutOption[] options) { DrawProperty(property, new GUIContent(content), setter, options); }
protected void Register <T>(Action <T> when) { _handlers.Add(typeof(T), e => when((T)e)); }
/// <summary> /// Adds a HashiCorp Vault configuration source to <paramref name="builder" />. /// </summary> /// <param name="builder">The <see cref="IConfigurationBuilder" /> to add to.</param> /// <param name="configureSource">Configures the source.</param> /// <returns>The <see cref="IConfigurationBuilder" />.</returns> internal static IConfigurationBuilder AddVault(this IConfigurationBuilder builder, Action<VaultConfigurationSource> configureSource) { return builder.Add(configureSource); }
protected override async ETTask Run(Session session, DBQueryBatchRequest request, DBQueryBatchResponse response, Action reply) { try { DBCacheComponent dbCacheComponent = Game.Scene.GetComponent <DBCacheComponent>(); List <ComponentWithId> components = await dbCacheComponent.GetBatch(request.CollectionName, request.IdList); response.Components = components; if (request.NeedCache) { foreach (ComponentWithId component in components) { dbCacheComponent.AddToCache(component, request.CollectionName); } } reply(); await ETTask.CompletedTask; } catch (Exception e) { ReplyError(response, e, reply); } }
/// <summary> [0, times) </summary> public static void Loop(this int times, Action<int> action, Predicate<int> condition = null) => (0, times - 1).Loop(action, condition);
public static void DrawProperty(SerializedProperty property, Action setter, params GUILayoutOption[] options) { DrawProperty(property, (GUIContent)null, setter, options); }
public static void ForEach<T>(this T[] array, Action<T, int> action) => array.Length.Loop(i => action(array[i], i));
public static void ForEach<T>(this T[] array, Action<T> action) => Array.ForEach(array, action);
public MentionAdapterViewHolder(View itemView, Action<MentionAdapterClickEventArgs> clickListener,Action<MentionAdapterClickEventArgs> longClickListener) : base(itemView) { try { MainView = itemView; Image = MainView.FindViewById<ImageView>(Resource.Id.card_pro_pic); Name = MainView.FindViewById<TextView>(Resource.Id.card_name); About = MainView.FindViewById<TextView>(Resource.Id.card_dist); CheckBox = MainView.FindViewById<CheckBox>(Resource.Id.cont); //Event itemView.Click += (sender, e) => clickListener(new MentionAdapterClickEventArgs { View = itemView, Position = AdapterPosition }); itemView.LongClick += (sender, e) => longClickListener(new MentionAdapterClickEventArgs { View = itemView, Position = AdapterPosition }); } catch (Exception e) { Console.WriteLine(e); } }
public static void Loop(this int times, Action action, Predicate<int> condition = null) => times.Loop(_ => action(), condition);
public static async Task BatchQuery(int batchSize, QueryFilter filter, Action<IEnumerable<Crawler>> batchProcessor, Database database = null) { await BatchQuery(batchSize, (c) => filter, batchProcessor, database); }
public void InvokeNonBlocking <T>(T interaction, Action <T> callback) where T : IInteraction { throw new NotImplementedException(); }
void IFubuRazorView.NoLayout() { _renderAction = RenderNoLayout; }
public static async Task BatchQuery(int batchSize, WhereDelegate<CrawlerColumns> where, Action<IEnumerable<Crawler>> batchProcessor, Database database = null) { await Task.Run(async ()=> { CrawlerColumns columns = new CrawlerColumns(); var orderBy = Bam.Net.Data.Order.By<CrawlerColumns>(c => c.KeyColumn, Bam.Net.Data.SortOrder.Ascending); var results = Top(batchSize, where, orderBy, database); while(results.Count > 0) { await Task.Run(()=> { batchProcessor(results); }); long topId = results.Select(d => d.Property<long>(columns.KeyColumn.ToString())).ToArray().Largest(); results = Top(batchSize, (CrawlerColumns)where(columns) && columns.KeyColumn > topId, orderBy, database); } }); }
void IFubuRazorView.UseLayout(IFubuRazorView layout) { LayoutView = layout; _renderAction = RenderWithLayout; _result = () => layout.Result.ToString(); }
public void SetActionFunc(Action<int> act) { this.action = act; }