public LineItem(DrawingVisual vis, LineStatus stat, LineAction act, LineLength sid, Brush brh, Point start, Point end) { _visual = vis; Status = stat; LineAction = act; LineSide = sid; brush = brh; _start = start; _end = end; }
private static async void Entry(LineAction _, GotoAction @goto) { await _(); Console.WriteLine("Hello"); await _(); Console.Write("Keep going? "); await _(); string line = Console.ReadLine(); await _(); if (line == "y") { await _(); await @goto(19); await _(); } await _(); Console.WriteLine("Finished!"); }
public void SetLineControl() { if (m_ControllingLine != null && m_ControllingLine != this) { //选中新线,旧的需要等候0.1s才能吸附上而且m_control被新线设置后无法吸附,所以这里需要主动调用下 m_ControllingLine.m_line.AdsorbentLeap();; m_ControllingLine.StopShowSelectInfo(); } m_ControllingLine = this; }
// Use this for initialization void Start() { if (m_ctrlNode == null) { m_ctrlNode = GetComponent <ELineCtrlNode>(); } if (m_LineAction == null) { m_LineAction = GetComponent <LineAction>(); } }
private static async void Entry(LineAction _, GotoAction @goto) { await _(); Console.WriteLine("Hello"); await _(); Console.Write("Keep going? "); await _(); string line = Console.ReadLine(); await _(); if (line == "y") { await _(); await @goto(19); await _(); } await _(); Console.WriteLine("Finished!"); }
/// <summary> /// Method which takes IEnumerable with the data and calls the assigned line action on every line of the data. /// The data needs to fit inside the line action. /// This method is meant to be used when mining from command line /// </summary> /// <param name="data">Enumerable with the data lines</param> /// <param name="lineAction">Action which will be executed on each line</param> protected void UpdateDatabase <T>(IEnumerable <T> data, LineAction <T> lineAction) { // Writeout the delegate name System.Console.WriteLine(lineAction.GetMethodInfo().Name); bool successfull = false; do { var numberOfTries = 1; try { //Execute query -- retrieve collection only once System.Console.WriteLine("Querying Endpoind"); var listData = data.ToList(); System.Console.WriteLine("Updating database"); using (var db = new BookRecommenderContext()) { //Create new console progress counter using (var counter = new Counter(listData.Count)) { // Insert all books in database foreach (var line in listData) { lineAction(line, db); counter.Update(); } } System.Console.WriteLine("Saving database"); db.SaveChanges(); successfull = true; } } catch (Exception ex) { // If something went wrong, wait 10 sec and then try again numberOfTries++; System.Console.WriteLine(ex.ToString()); System.Console.WriteLine("Try again, attempt number " + numberOfTries); } // If something went wrong, wait 10 sec and then try again if (!successfull) { System.Threading.Tasks.Task.Delay(10000).Wait(); } } while (!successfull); }
/// <summary> /// 直线命令 /// </summary> public LineAction LineAction(Color?penColor = null, int lineWidth = 1, Color?fill = null, dynamic Element = null) { if (penColor == null) { penColor = Colors.Black; } var a = new LineAction(); a.Geometry.Element = Element; a.Geometry.PenColor = penColor.Value; if (fill != null) { a.Geometry.FillColor = fill.Value; } a.Geometry.LineWidth = lineWidth; DrawingControl.SetAction(a); LastAction = a; return(a); }
public LineValues(string line) { TimeStamp = DateTime.ParseExact(line.Substring(1, 16), "yyyy-MM-dd HH':'mm", CultureInfo.InvariantCulture); var action = line.Substring(19).Split(new Char[] { '#', ' ' }, StringSplitOptions.RemoveEmptyEntries); if (action[0] == "Guard") { ID = Convert.ToInt32(action[1]); Action = LineAction.BeginShift; } else if (action[0] == "falls") { Action = LineAction.FallsAsleep; } else if (action[0] == "wakes") { Action = LineAction.WakesUp; } }
/// <summary> /// Method which takes IEnumerable with the data and calls the assigned line action on every line of the data. /// The data needs to fit inside the line action. /// This method is meant to be used when mining from web interface /// </summary> /// <param name="data">Enumerable with the data lines</param> /// <param name="lineAction">Action which will be executed on each line</param> /// <param name="miningState">Mining state of the operation from the MiningProxySingleton used to monitor the data mining</param> protected void UpdateDatabase <T>(IEnumerable <T> data, LineAction <T> lineAction, MiningState miningState) { // fall back for deprecated commandline mining if (miningState == null) { UpdateDatabase <T>(data, lineAction); return; } try { // set the mining state miningState.CurrentState = MiningStateType.RunningQueryingEndpoint; var listData = data.ToList(); miningState.CurrentState = MiningStateType.Running; var currentPosition = 0; using (var db = new BookRecommenderContext()) { // proccess each line using the line action and log changes to the mining state foreach (var line in listData) { lineAction(line, db); currentPosition++; miningState.Message = String.Format("{0}/{1}", currentPosition, listData.Count); } miningState.CurrentState = MiningStateType.RunningSavingToDatabase; db.SaveChanges(); miningState.CurrentState = MiningStateType.Completed; miningState.Message = DateTime.Now.ToString(); } } catch (Exception ex) { // If something went wrong, wait 10 sec and then try again miningState.CurrentState = MiningStateType.Error; miningState.Message = ex.Message; } }
public void OnPointerClick(PointerEventData eventData) { if (eventData.button == PointerEventData.InputButton.Right) { return; } NDlabObject obj = GetComponent <NDlabObject>(); if (obj != null) { if (obj is EleLine) { LineAction action = obj.gameObject.GetComponent <LineAction>(); if (action) { action.SetControling(); } } if (eventData.clickCount == 2)//show the Menu UI { if (obj != null && obj.PlayerState == false) { ClickMenuWnd wnd = WndManager.GetWnd <ClickMenuWnd>(); if (wnd != null) { wnd.SetCurCircuitObject(obj as NDCircuitObject); wnd.BtnDel.transform.position = new Vector3(eventData.position.x, eventData.position.y, 0); } } } else if (eventData.clickCount == 1 && eventData.dragging == false && eventData.delta.x < 0.1f && eventData.delta.y < 0.1f) { LabEnv.AddHighlightLabObj(obj, ControlButtonDown); } } }
private static bool IsContinueAction(LineAction action) { return(action == LineAction.None); }
/// <summary> /// 设定当前动作 /// </summary> /// <param name="a"></param> private void SetAction(LineAction a) { tip = new SublineTip(DrawingControl, textTip); tip.Attention(a); }