public void CalculateInitialValue(IPosition position, eAction action, int quantity, string ticker, double initPrice, double initCommission, double bid, double ask) { // Depending upon whether the action was a buy or sell("BOT" // or "SLD") calculate the average bought cost, the total bought // cost, the average price and the cost basis. // Finally, calculate the net total with and without commission. switch (action) { case eAction.BOT: position.Buys = quantity; position.AvgBot = initPrice; position.TotalBot = position.AvgBot * position.Buys; position.AvgBot = (initPrice * quantity + initCommission) / quantity; position.CostBasis = quantity * position.AvgBot; break; case eAction.SLD: position.Sells = quantity; position.AvgSld = initPrice; position.TotalSld = position.AvgSld * position.Sells; position.AvgSld = (initPrice * quantity - initCommission) / quantity; position.CostBasis = quantity * position.AvgSld; break; default: throw new ArgumentOutOfRangeException(nameof(action), action, null); } position.TotalCommission += initCommission; position.Net = position.Buys - position.Sells; position.NetTotal = position.TotalBot - position.TotalSld; position.NetTotalInclCommission = position.NetTotal - position.TotalCommission; }
public bool IsAllow(eAction action, eFea Fea) { if (Account == null) { return(false); } var m = MyRole(); if (m == eRole.SuperAdmin || m == eRole.Admin) { return(true); } switch (action) { case eAction.Delete: return(ListPermission.Any(q => q.F_DELETE == true && q.FeaId.Trim().ToUpper() == Fea.ToString())); case eAction.Add: return(ListPermission.Any(q => q.F_ADD == true && q.FeaId.Trim().ToUpper() == Fea.ToString())); case eAction.Edit: return(ListPermission.Any(q => q.F_EDIT == true && q.FeaId.Trim().ToUpper() == Fea.ToString())); case eAction.Search: return(ListPermission.Any(q => q.F_SEARCH == true && q.FeaId.Trim().ToUpper() == Fea.ToString())); default: return(false); } }
/// <summary> /// Buffers the windows input. /// </summary> private void CaptureWindowInputs() { if (Input.GetMouseButtonDown(0)) { Debug.Log("input: GetMouseButtonDown"); lastAction = eAction.PRESS; } else if (Input.GetMouseButtonUp(0)) { Debug.Log("input: GetMouseButtonUp"); // release position doesn't match the initial touch position // need to use some slack releaseCount++; lastTouchUp = Input.mousePosition; Vector3 vDistance = lastTouchUp - lastTouchDown; float fTouchDistance = Mathf.Abs(vDistance.magnitude); if (fTouchDistance > tapDistance) { // pack swipe data // position x,y; normalized distance z lastSwipe.x = vDistance.x; lastSwipe.y = vDistance.y; lastSwipe.z = fTouchDistance / 0.1f; if (lastSwipe.z > 1.0f) { lastSwipe.z = 1.0f; } lastAction = eAction.SWIPE; } else { lastTouchPos = camera.GetComponent <Camera>().ScreenToViewportPoint(lastTouchUp); lastAction = eAction.RELEASE; } // reset touch down lastTouchDown = touchOutofBound; } // left button + directional keys if (Input.GetMouseButton(0)) { Debug.Log("input: GetMouseButton"); if (lastTouchDown == touchOutofBound) { lastTouchDown = Input.mousePosition; } float inputX = Input.GetAxis("Mouse X"); float inputY = Input.GetAxis("Mouse Y"); Vector2 CameraSwipe = new Vector2(inputX, inputY); CameraSwipe *= Time.deltaTime * -50; } // scroll wheel //float fZoom = Input.GetAxis("Mouse ScrollWheel"); }
public override ViewRequest Run(ViewResult viewResult) { if (viewResult.Values.Count() == 0) { return(new ViewRequest <ManagerMainView>()); } if (viewResult.ViewStatus != eViewStatus.Ok) { return(new ViewRequest <AskToExitView>()); } eAction choose = Enum.Parse <eAction>(viewResult.Values["Choose"]); switch (choose) { case eAction.Exit: return(new ViewRequest <ExitView>()); case eAction.ChangeUser: return(new ViewRequest <LoginView>()); default: return(new ViewRequest <UserMainView>()); } }
public void PlayRound() { Console.WriteLine("\n\n"); eAction action = (eAction)Utils.GetConsoleMenu("Enter Action: ", Enum.GetNames(typeof(eAction))); //Console.Clear(); switch (action) { case eAction.Display: foreach (var c in Characters) { c.Display(); } break; case eAction.Attack: Attack(); break; case eAction.Flee: Flee(); break; case eAction.Heal: Heal(); break; case eAction.Exit: Quit = true; break; default: break; } }
void SetAction(eAction action) { _action = action; switch (action) { case eAction.None: _objResult.gameObject.SetActive(false); _btnCollect.enabled = false; break; case eAction.Ready: _objResult.gameObject.SetActive(false); break; case eAction.Play: _btnExit.gameObject.SetActive(false); _anim.SetInteger("event", 1); break; case eAction.Stop: _anim.SetInteger("event", 2); _objResult.gameObject.SetActive(true); break; case eAction.Result: _btnCollect.enabled = true; break; } }
private void MoveActions() { eAction oldAction = NextActions[3]; NextActions.RemoveAt(0); int rndVal = Random.Range(0, 100); if (rndVal < 2) { NextActions.Add((eAction)8); } //if (rndVal < 10) //NextActions.Add((eAction)1); else { eAction newAction; do { newAction = (eAction)Random.Range(1, 7); } while (oldAction == newAction); NextActions.Add(newAction); } }
public void PlayRound(Move i_MoveToApply) { if (isMoveValid(i_MoveToApply)) { const bool v_OnlyCaptureMoves = true; eAction lastAction = applyMove(i_MoveToApply); r_CurrentlyLegalMoves.Clear(); m_LastMovingPiece.AddLegalMovesToList(r_CurrentlyLegalMoves, m_CheckersBoard, v_OnlyCaptureMoves); if (lastAction == eAction.Capture && r_CurrentlyLegalMoves.Any()) { // the player keeping the turn, but we update that it will not be the first move, as in series of capture moves m_FirstMoveThisTurn = false; } else { // turn goes to the next player m_CurrPlayerTurn = enemyPlayer(m_CurrPlayerTurn); m_FirstMoveThisTurn = true; if (!m_CurrPlayerTurn.Human) { makeMachineMove(); } } if (gameOver()) { handleGameOver(); } } else { OnInvalidMoveGiven(new EventArgs()); // show prompt dialog "Move is not Valid" } }
protected void Page_Load(object sender, EventArgs e) { user = new eUser("TestArea"); //user.URL = "Login.aspx";//用户未登录跳转登录地址,默认为Login.aspx action = new eAction(); action.Actioning += action_Actioning; action.Listen(); }
public void Clear() { action = eAction.None; crtl = null; mainctrl = null; parent = null; hotspot = null; }
public CFAuditEntry(eAction action, string actor, DateTime timestamp, List <CFAuditChangeLog> changes) { Data = new XElement("entry"); Action = action; Actor = actor; Timestamp = timestamp; AppendLog(changes); }
public static bool isHeld(eAction pAction) { if (Action.ContainsKey(pAction)) { return(newKeyState.IsKeyDown(Action[pAction]) && oldKeyState.IsKeyDown(Action[pAction])); } return(false); }
public Wizard(int id, string type, Vector2 position, Vector2 velocity, bool canShootSnaffle) : base(id, type, position, velocity) { CanShootSnaffle = canShootSnaffle; HasGrabbedSnaffle = false; Action = eAction.None; NearestSnaffles = null; TargetSnaffle = null; }
protected void Page_Load(object sender, EventArgs e) { user = null;// new eUser(); //user.Check(); Action = new eAction(); Action.Actioning += new eActionHandler(Action_Actioning); Action.Listen(); }
private static void ProcessEvent(eAction action, DelegateThread dt, ThreadContext tc) { if (dt != null) { lock (m_oLocker) { switch (action) { case eAction.Started: ExcpHelper.ThrowIf(m_diIdToContext.ContainsKey(tc.ManagedThreadId), "Thread is running already {0}", tc); ExcpHelper.ThrowIf(m_diNameToContext.ContainsKey(tc.ThreadName), "Thread is running already {0}", tc); m_diIdToContext.Add(tc.ManagedThreadId, tc); m_diNameToContext.Add(tc.ThreadName, tc); Debug.Assert(m_diIdToContext.Count == m_diNameToContext.Count); break; case eAction.Completed: ExcpHelper.ThrowIf(!m_diIdToContext.ContainsKey(tc.ManagedThreadId), "Thread is not running {0}", tc); ExcpHelper.ThrowIf(!m_diNameToContext.ContainsKey(tc.ThreadName), "Thread is not running {0}", tc); m_diIdToContext.Remove(tc.ManagedThreadId); m_diNameToContext.Remove(tc.ThreadName); Debug.Assert(m_diIdToContext.Count == m_diNameToContext.Count); break; case eAction.Error: Debug.Assert(m_diIdToContext.Count == m_diNameToContext.Count); break; default: Debug.Assert(false); break; } try { if (dt != null) { dt(tc); } } catch (Exception excp) { m_logger.Error(ExcpHelper.FormatException(excp, "ProcessEvent {0} ERROR for {1}:\r\n{2}\r\n{3}", action, tc, excp.Message, excp.StackTrace), excp); } } } }
protected void Page_Load(object sender, EventArgs e) { user = new eUser("Manage"); edt = new eForm("ProductConfigs", user); edt.AddControl(eFormControlGroup); Action = new eAction(); Action.Actioning += new eActionHandler(Action_Actioning); Action.Listen(); }
protected void Page_Load(object sender, EventArgs e) { user = new eUser("Manage"); user.Check(); Action = new eAction(); edt = new eForm("a_eke_sysModels", user); //edt.AutoRedirect = false; edt.AddControl(f1); //名称 f2.Field = "Code"; edt.AddControl(f2); //编码 edt.AddControl(f3); //简介 edt.AddControl(f4); //文件 edt.AddControl(f5); //自动 edt.AddControl(f6); //类名 f7.Field = "ParentID"; f7.FieldType = "uniqueidentifier"; edt.AddControl(f7); //上级 edt.AddControl(f8); //关系 edt.AddControl(f9); //类型 if (Action.Value == "del") { string id = eParameters.QueryString("id"); eOleDB.Execute("delete from a_eke_sysModels where ModelID='" + id + "'"); eOleDB.Execute("delete from a_eke_sysModelItems where ModelID='" + id + "'"); eOleDB.Execute("delete from a_eke_sysModelConditions where ModelID='" + id + "'"); eOleDB.Execute("delete from a_eke_sysModelConditionItems where ModelID='" + id + "'"); eOleDB.Execute("delete from a_eke_sysConditions where ModelID='" + id + "'"); eOleDB.Execute("delete from a_eke_sysPowers where ModelID='" + id + "'"); eOleDB.Execute("delete from a_eke_sysActions where ModelID='" + id + "'"); eOleDB.Execute("delete from a_eke_sysModelTabs where ModelID='" + id + "'"); eOleDB.Execute("delete from a_eke_sysModelPanels where ModelID='" + id + "'"); eOleDB.Execute("delete from a_eke_sysUserCustoms where ModelID='" + id + "'"); eOleDB.Execute("delete from a_eke_sysUserColumns where ModelID='" + id + "'"); eOleDB.Execute("delete from a_eke_sysCheckUps where ModelID='" + id + "'"); if (Request.ServerVariables["HTTP_REFERER"] == null) { Response.Redirect("ClearModel.aspx", true); } else { Response.Redirect(Request.ServerVariables["HTTP_REFERER"].ToString(), true); } Response.End(); //Response.Redirect(Request.UrlReferrer.PathAndQuery, true); } edt.onChange += new eFormTableEventHandler(edt_onChange); edt.Handle(); Action.Actioning += new eActionHandler(Action_Actioning); Action.Listen(); }
protected void Page_Load(object sender, EventArgs e) { user = new eUser(UserArea); user.Check(); model = new eModel(ModelID, user); Action = new eAction(); Action.Actioning += new eActionHandler(Action_Actioning); Action.Listen(); }
public void Update(Vector2 position, Vector2 velocity, bool canShootSnaffle) { base.Update(position, velocity); CanShootSnaffle = canShootSnaffle; HasGrabbedSnaffle = false; grabbedSnaffle = null; Action = eAction.None; NearestSnaffles = null; TargetSnaffle = null; }
protected void Page_Load(object sender, EventArgs e) { allids = getParentIDS(pid); user = new eUser("System"); model = new eModel(ModelID, user); Action = new eAction(user); Action.Actioning += new eActionHandler(Action_Actioning); Action.Listen(); }
void FixedUpdate() { switch (_action) { case eAction.Play: ReceiveResult(_reqInfo.data.wheelIndex); _action = eAction.None; break; } }
public async Task <string> Action(eAction action, eInfoAction infoAction) { string result = await Request.Do(action, infoAction, ReturnStatus); if (result.IsNotNull()) { result = String.Format("<SolusVM.Net>{0}</SolusVM.Net>", result); } return(result); }
public void CopyFrom(AnimatorKeyInfo o) { animAction = o.animAction; fadeTime = o.fadeTime; targetState = o.targetState; animParam = o.animParam; paramName = o.paramName; vBool = o.vBool; vFloat = o.vFloat; vInt = o.vInt; }
public void Add(Client client, eAction action, eResourceType?resourceType = null, int?resourceId = null) { // temporary comment to avoid bug where Dequeue lock (SyncObj) { this.Enqueue(new ClientAction() { Client = client, Action = action, ResourceType = resourceType, ResourceId = resourceId, Time = DateTime.Now }); } }
/// <summary> /// Resets the input. /// </summary> private void ResetInput() { // reset buffered action lastAction = eAction.NONE; fingerCount = 0; pressCount = 0; releaseCount = 0; currentTouch = new Touch(); lastTap = new Touch(); cameraSwipe = Vector2.zero; }
void CallBack(eAction action, object obj1, object obj2, object obj3) { Debug.Print(action.ToString() + "===>" + obj1.ToString()); switch (action) { case eAction.Message: string Message = obj1 as string; if (Message != null) { if (lastMessage != Message) sbiMessage.Content = Message + Environment.NewLine + sbiMessage.Content; lastMessage = Message; } break; case eAction.Error: if (obj1 is string) { MessageBox.Show((string)obj1, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } break; case eAction.State: string state = obj1 as string; if (state != null) { if (lastState != state) sbiState.Content = state + Environment.NewLine + sbiState.Content; lastState = state; } break; case eAction.Notification: break; case eAction.RestError: if (obj1 is System.Net.HttpStatusCode) { System.Net.HttpStatusCode StatusCode = (System.Net.HttpStatusCode)obj1; if (StatusCode == System.Net.HttpStatusCode.Forbidden) MessageBox.Show("Invalid Credentials", "Forbidden", MessageBoxButton.OK, MessageBoxImage.Error); else MessageBox.Show("Error:" + (string)obj2, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } break; case eAction.WebSocketError: break; case eAction.CacheError: break; default: break; } }
protected void Page_Load(object sender, EventArgs e) { user = new eUser("Manage"); Action = new eAction(); eform = new eForm("a_eke_sysModels", user); allids = getParentIDS(id); //eBase.Writeln(allids); LitMenus.Text = getTree(""); Action = new eAction(user); Action.Actioning += new eActionHandler(Action_Actioning); Action.Listen(); }
public static void Trail(string MainID, eAction action, string RecordID) { string controller = HttpContext.Current.Request.RequestContext.RouteData.Values["controller"].ToString(); ApplicationDbContext db = new ApplicationDbContext(); AuditTrail audit = new AuditTrail(); audit.Action = action; audit.MainID = MainID; audit.RecordID = RecordID; audit.TDate = DateTime.Now; audit.UserID = HttpContext.Current.User.Identity.Name; audit.Module = controller; db.AuditTrails.Add(audit); db.SaveChanges(); }
public void GetCopyMoveValues(ref float X, ref float Y, ref int count, ref eAction act) { if (tabControl1.SelectedTab == tabPage1) { act = eAction.copy; count = _count; } else if (tabControl1.SelectedTab == tabPage2) { act = eAction.move; count = 1; } X = _X; Y = _Y; }
void FixedUpdate() { if (receive) { receive = false; SetAction(eAction.Ready); } switch (_action) { case eAction.Play: ReceiveResult(_reqInfoArray[_SpinCount - 1].wheelIndex); _action = eAction.None; break; } }
public bool SetAction(eAction eNewAction) { if (this._eAction != eNewAction) { if (this._eAction != eAction.None && eNewAction != eAction.None) { Game.Process.SetByte(this._iEntity + (ulong)Game.Resolver["ActorSingle"]["Action"].Value, (byte)0); this._eActionPending = eNewAction; this._iActionPending = Game.Time() + 500U; return(true); } Game.Process.SetByte(this._iEntity + (ulong)Game.Resolver["ActorSingle"]["Action"].Value, (byte)eNewAction); this._eAction = eNewAction; } return(true); }
void RecordAction( eAction action ) { //Debug.Log( "RecordAction = " + action); actionHistory[playerTime] = action; }
void TakeAction( int x, int y, eAction action ) { if (map[x,y].type != eCellType.player) Debug.DebugBreak(); map[x,y].playerTime++; // Increment player time before they move so it gets copied into new cell switch (action) { case eAction.north: Move( x, y, x, y-1 ); break; case eAction.south: Move( x, y, x, y+1 ); break; case eAction.east: Move( x, y, x+1, y ); break; case eAction.west: Move( x, y, x-1, y ); break; case eAction.timejump: DoTimeJump( x, y ); break; } }
public HistoryItem(DateTime date, string source, string dest, eAction action) : this(source, dest, action) { Date = date; }
public HistoryItem(string source, string dest, eAction action) : this() { Source = source; Dest = dest; Action = action; }
/// <summary> /// Build an output file using the specified input file taking the action /// required to replace the specified line, or insert the text before the /// specified line. /// </summary> /// <param name="inputFilespec">The file we are reading from.</param> /// <param name="outputFilespec">The file we are modifying.</param> /// <param name="lineNumber">Line from the input file that we want to modify</param> /// <param name="newLineText">Text to replace or insert.</param> /// <param name="action">Currently only supports replace OR insert.</param> /// <param name="errorCode">Error to throw if it fails.</param> /// <returns>True if the action was performed on the file.</returns> public bool ModifyFile(string inputFilespec, string outputFilespec, int lineNumber, string newLineText, eAction action, ErrorCodes errorCode) { bool rval = false; if ((action != eAction.insert) && (action != eAction.replace)) return rval; if ((inputFilespec.Length <= 0) || (lineNumber < 0)) return rval; try { Generic.DeleteFile(outputFilespec); } catch { string emsg = "Error while deleting file: " + outputFilespec; LogFile.AddErrorLine(emsg); throw new LDExceptions(ErrorCodes.FileWrite, emsg); } LogFile.AddVerboseLine("StreamReader on <" + inputFilespec + ">"); StreamReader inputStream = new StreamReader(inputFilespec, System.Text.Encoding.Default, true); // Check for Unicode BOM chars. int chT = inputStream.Peek(); // force autodetection of encoding. StreamWriter outputStream = null; try { outputStream = new StreamWriter(outputFilespec, false, inputStream.CurrentEncoding); } catch { throw new LDExceptions(errorCode); } string newLine; int lineCount = 0; while (inputStream.Peek() >= 0) { lineCount++; newLine = inputStream.ReadLine(); if (lineCount == lineNumber) // at the line in question { if (action == eAction.replace && newLineText.Length > 0) outputStream.WriteLine(newLineText); // write out the new line rval = true; if (action == eAction.insert) // if eAction.insert { outputStream.WriteLine(newLineText); // write out the new line outputStream.WriteLine(newLine); // write out the line just read } } else outputStream.WriteLine(newLine); // write out the line just read } inputStream.Close(); outputStream.Close(); return rval; }
public void callback(eAction action, object obj1 = null, object obj2 = null, object obj3 = null) { if (callbackFn == null) throw new NullReferenceException(); callbackFn(action, obj1, obj2, obj3); }
private void btn_EditStockTakeItems_Click(object sender, EventArgs e) { this.Close(); DialogResult = DialogResult.OK; eaction = eAction.do_EditStockTakeItems; }