public void DoAction(string name, ActionArgs arg) { if (this.actions.ContainsKey(name)) { this.actions[name].Do(arg); } }
/// <summary> /// Returns a list of actions (alerts) that have been generated for your account. /// </summary> /// <param name="args"></param> /// <returns></returns> public Task<GetActionListResponse> GetActionsList(ActionArgs args = null) { var queryString = args != null ? args.ToQueryString() : string.Empty; var apiMethod = "actions" + queryString; return Client.GetAsync<GetActionListResponse>(apiMethod); }
public override void Do(ActionArgs args) { Drawable drawable = this.Entity.GetComponent("Drawable") as Drawable; if (drawable != null) { drawable.CurrentFrame = ((SingleIntArgs)args).Amount; drawable.SourceRect = new Rectangle(drawable.CurrentFrame * drawable.FrameWidth, 0, drawable.FrameWidth, drawable.FrameHeight); } }
/// <summary> /// Disable current MembershipUser /// </summary> /// <param name="args">Action arguments</param> public void Execute(ActionArgs args) { MembershipUser user = Membership.GetUser(); if (user != null) { user.IsApproved = false; Membership.UpdateUser(user); } }
public override void Do(ActionArgs args) { if (this.Entity != null && args != null && args is ChangeInputSequenceArgs) { InputSequence sequence = this.Entity.GetComponent("InputSequence") as InputSequence; if (sequence != null) { sequence.Sequence = ((ChangeInputSequenceArgs)args).NewSequence; } } }
public override void Do(ActionArgs args) { if (this.Entity != null && args != null && args is ChangeCurrentSmoothingArgs) { PreviousPosition position = this.Entity.GetComponent("PreviousPosition") as PreviousPosition; if (position != null) { position.currentSmoothing = ((ChangeCurrentSmoothingArgs)args).Delta; } } }
public override void Do(ActionArgs args) { Hitpoints hitpoints = this.Entity.GetComponent("Hitpoints") as Hitpoints; if (hitpoints != null) { hitpoints.HP -= ((SingleIntArgs)args).Amount; if (hitpoints.HP <= 0) { this.Entity.IsAlive = false; } } }
public override void Do(ActionArgs args) { if (this.Entity != null && args != null && args is ChangePositionArgs) { PreviousPosition position = this.Entity.GetComponent("PreviousPosition") as PreviousPosition; if (position != null) { Vector2 newPosition = ((ChangePositionArgs)args).Delta; position.Vector2Pos = newPosition; } } }
public override void Do(ActionArgs args) { if (AIName != null && AIName != "" && AIName != "none") { this.Entity.DoAction(AIName, args); } else { // move at mob specific speed Mobile mobile = this.Entity.GetComponent("Mobile") as Mobile; mobile.Position += mobile.Velocity; } }
public override void Do(ActionArgs args) { if (this.Entity != null && args != null && args is DropLootArgs) { LootTable lootTable = (LootTable)this.Entity.GetComponent("LootTable"); Dictionary<Vector2, List<Entity>> floor = ((DropLootArgs)args).floorItems; // get items from lootTable and place them into floor List<Entity> loot = LootManager.getLootDrop(((Experience)this.Entity.GetComponent("Experience")).Current_Level, lootTable.Affinity); Position pos = (Position)this.Entity.GetComponent("Position"); LootManager.addLootToFloor(floor,loot,new Vector2(pos.X, pos.Y)); } }
/// <summary> /// Execute action /// </summary> /// <param name="args">Arguments</param> public void Execute(ActionArgs args) { if (args == null) { return; } IntrusionException intrusionException = args.FaultException as IntrusionException; if (intrusionException != null) { Esapi.Logger.Fatal(LogEventTypes.SECURITY, intrusionException.LogMessage); } }
public override void Do(ActionArgs args) { if (this.Entity != null && args != null && args is ChangePositionArgs) { Position position = this.Entity.GetComponent("Position") as Position; if (position != null) { Vector2 delta = ((ChangePositionArgs)args).Delta; position.X += (int)delta.X; position.Y += (int)delta.Y; } } }
public override void Do(ActionArgs args) { if (this.Entity != null && args != null && args is GainExperienceArgs) { Experience exp = this.Entity.GetComponent("Experience") as Experience; if (exp != null) { exp.Current_EXP += ((GainExperienceArgs)args).Amount; exp.Current_LevelEXP += ((GainExperienceArgs)args).Amount; if (exp.Current_EXP >= Meta.ExpLevel[exp.Current_Level]) this.Entity.DoAction("LevelUp"); } } }
protected virtual int ExecuteAction(VSM.Data.Objects.M_KioskOwner_Config theM_KioskOwner_Config, VSM.Data.Objects.M_KioskOwner_Config original_M_KioskOwner_Config, string lastCommandName, string commandName, string dataView) { ActionArgs args = new ActionArgs(); args.Controller = "M_KioskOwner_Config"; args.View = dataView; args.Values = CreateFieldValues(theM_KioskOwner_Config, original_M_KioskOwner_Config); args.LastCommandName = lastCommandName; args.CommandName = commandName; ActionResult result = ControllerFactory.CreateDataController().Execute("M_KioskOwner_Config", dataView, args); result.RaiseExceptionIfErrors(); result.AssignTo(theM_KioskOwner_Config); return(result.RowsAffected); }
/// <summary> /// Block current request /// </summary> /// <param name="args"></param> /// <remarks>Will end the current request</remarks> public void Execute(ActionArgs args) { HttpResponse response = (HttpContext.Current != null ? HttpContext.Current.Response : null); if (null == response) { throw new InvalidOperationException(); } response.ClearHeaders(); response.ClearContent(); response.StatusCode = _statusCode; response.End(); }
//请求MES正常上料 public Result CommAgvCallEvent(ActionArgs actionArgs) { RChargingState chargingState = new RChargingState() { LINE = Constant.OrderLine, IS_READ = 0, DISPATCH_STATE = 0, FLAG = 1, NO_FROM = "1" }; actionArgs.RedisClientRemote.LPush("LD:A00:MDCI:CHARGING_STATE:Q", chargingState); Logger.Device.Info("invoke CommAgvCallEvent 请求正常上料成功"); return(Result.Success()); }
protected virtual int ExecuteAction(XIOT.Data.Objects.CB_DataElement theCB_DataElement, XIOT.Data.Objects.CB_DataElement original_CB_DataElement, string lastCommandName, string commandName, string dataView) { ActionArgs args = new ActionArgs(); args.Controller = "CB_DataElement"; args.View = dataView; args.Values = CreateFieldValues(theCB_DataElement, original_CB_DataElement); args.LastCommandName = lastCommandName; args.CommandName = commandName; ActionResult result = ControllerFactory.CreateDataController().Execute("CB_DataElement", dataView, args); result.RaiseExceptionIfErrors(); result.AssignTo(theCB_DataElement); return(result.RowsAffected); }
protected virtual int ExecuteAction(MyCompany.Data.Objects.ForcastManual theForcastManual, MyCompany.Data.Objects.ForcastManual original_ForcastManual, string lastCommandName, string commandName, string dataView) { ActionArgs args = new ActionArgs(); args.Controller = "ForcastManual"; args.View = dataView; args.Values = CreateFieldValues(theForcastManual, original_ForcastManual); args.LastCommandName = lastCommandName; args.CommandName = commandName; ActionResult result = ControllerFactory.CreateDataController().Execute("ForcastManual", dataView, args); result.RaiseExceptionIfErrors(); result.AssignTo(theForcastManual); return(result.RowsAffected); }
public static bool IsActionOrFunc(object target) { if (target == null) { return(false); } var tType = target as Type ?? target.GetType(); if (tType.IsGenericType) { tType = tType.GetGenericTypeDefinition(); } return(FuncArgs.ContainsKey(tType) || ActionArgs.ContainsKey(tType)); }
/// <summary> /// Block current request /// </summary> /// <param name="args"></param> /// <remarks>Will end the current request</remarks> public void Execute(ActionArgs args) { HttpResponse response = (HttpContext.Current != null ? HttpContext.Current.Response : null); if (null == response) { throw new InvalidOperationException(); } response.ClearHeaders(); response.ClearContent(); response.StatusCode = this._statusCode; response.End(); }
public override void Do(ActionArgs args) { if (this.Entity != null && args != null && args is TakeDamageArgs) { Hitpoints hitpoints = this.Entity.GetComponent("Hitpoints") as Hitpoints; if (hitpoints != null) { hitpoints.Current_HP -= ((TakeDamageArgs)args).Damage; if (hitpoints.Current_HP <= 0) { hitpoints.Alive = false; } } } }
protected virtual int ExecuteAction(VSM.Data.Objects.Base_Customer_Authentication theBase_Customer_Authentication, VSM.Data.Objects.Base_Customer_Authentication original_Base_Customer_Authentication, string lastCommandName, string commandName, string dataView) { ActionArgs args = new ActionArgs(); args.Controller = "Base_Customer_Authentication"; args.View = dataView; args.Values = CreateFieldValues(theBase_Customer_Authentication, original_Base_Customer_Authentication); args.LastCommandName = lastCommandName; args.CommandName = commandName; ActionResult result = ControllerFactory.CreateDataController().Execute("Base_Customer_Authentication", dataView, args); result.RaiseExceptionIfErrors(); result.AssignTo(theBase_Customer_Authentication); return(result.RowsAffected); }
protected virtual int ExecuteAction(VSM.Data.Objects.T_Contents_KioskGroup theT_Contents_KioskGroup, VSM.Data.Objects.T_Contents_KioskGroup original_T_Contents_KioskGroup, string lastCommandName, string commandName, string dataView) { ActionArgs args = new ActionArgs(); args.Controller = "T_Contents_KioskGroup"; args.View = dataView; args.Values = CreateFieldValues(theT_Contents_KioskGroup, original_T_Contents_KioskGroup); args.LastCommandName = lastCommandName; args.CommandName = commandName; ActionResult result = ControllerFactory.CreateDataController().Execute("T_Contents_KioskGroup", dataView, args); result.RaiseExceptionIfErrors(); result.AssignTo(theT_Contents_KioskGroup); return(result.RowsAffected); }
protected virtual int ExecuteAction(MyCompany.Data.Objects.MaterialNumberImportLog theMaterialNumberImportLog, MyCompany.Data.Objects.MaterialNumberImportLog original_MaterialNumberImportLog, string lastCommandName, string commandName, string dataView) { ActionArgs args = new ActionArgs(); args.Controller = "MaterialNumberImportLog"; args.View = dataView; args.Values = CreateFieldValues(theMaterialNumberImportLog, original_MaterialNumberImportLog); args.LastCommandName = lastCommandName; args.CommandName = commandName; ActionResult result = ControllerFactory.CreateDataController().Execute("MaterialNumberImportLog", dataView, args); result.RaiseExceptionIfErrors(); result.AssignTo(theMaterialNumberImportLog); return(result.RowsAffected); }
//给MES添加空箱下料请求 3 public Result PLC03NgNullAgvCallEvent(ActionArgs actionArgs) { RChargingState chargingState = new RChargingState() { LINE = Constant.OrderLine, IS_READ = 0, DISPATCH_STATE = 1, FLAG = 1, NO_FROM = "3" }; actionArgs.RedisClientRemote.LPush("LD:A00:MDCI:CHARGING_STATE:Q", chargingState); Logger.Device.Info($" invoke PLC03NgNullAgvCallEvent 给MES添加空箱下料请求成功"); return(Result.Success()); }
//读取NgNum来判断是否需要NG空箱呼叫 public Result PLC03NgNumReadEvent(ActionArgs actionArgs) { //查找当前工作流引擎 var eng = ModBusDataFactory.workFlowEngines.FirstOrDefault(x => x.ModuleName == "WFE"); int NgNum = (int)actionArgs.StepResult.Data; if (NgNum >= Constant.Package) { //触发设置空箱任务呼叫信号 FlowBlock block = eng?._workFlow.Blocks.FirstOrDefault(v => v.Name == "PLC03Setp3NgNullAgvCallB"); eng?.EnqueueBlock(block); } Logger.Device.Info($" invoke PLC03WorkbinInEvent 料箱转移到3号位成功"); return(Result.Success()); }
protected virtual int ExecuteAction(VSM.Data.Objects.VW_RPT_Kiosk_Usage theVW_RPT_Kiosk_Usage, VSM.Data.Objects.VW_RPT_Kiosk_Usage original_VW_RPT_Kiosk_Usage, string lastCommandName, string commandName, string dataView) { ActionArgs args = new ActionArgs(); args.Controller = "VW_RPT_Kiosk_Usage"; args.View = dataView; args.Values = CreateFieldValues(theVW_RPT_Kiosk_Usage, original_VW_RPT_Kiosk_Usage); args.LastCommandName = lastCommandName; args.CommandName = commandName; ActionResult result = ControllerFactory.CreateDataController().Execute("VW_RPT_Kiosk_Usage", dataView, args); result.RaiseExceptionIfErrors(); result.AssignTo(theVW_RPT_Kiosk_Usage); return(result.RowsAffected); }
protected virtual int ExecuteAction(MyCompany.Models.AATOrderImport theAATOrderImport, MyCompany.Models.AATOrderImport original_AATOrderImport, string lastCommandName, string commandName, string dataView) { ActionArgs args = new ActionArgs(); args.Controller = "AATOrderImport"; args.View = dataView; args.Values = CreateFieldValues(theAATOrderImport, original_AATOrderImport); args.LastCommandName = lastCommandName; args.CommandName = commandName; ActionResult result = ControllerFactory.CreateDataController().Execute("AATOrderImport", dataView, args); result.RaiseExceptionIfErrors(); result.AssignTo(theAATOrderImport); return(result.RowsAffected); }
protected override void BeforeSqlAction(ActionArgs args, ActionResult result) { if (args.CommandName == "Insert" && args["Number"].Value == null) { String Enq_no = null; String type_prefix = null; using (SqlText findPrice = new SqlText( "select dbo.GenerateNewEnquiryNumber(@ID) as enq_no")) { findPrice.AddParameter("@ID", args["TypeID"].Value); Enq_no = Convert.ToString(findPrice.ExecuteScalar()); } args["Number"].NewValue = Enq_no; args["Number"].Modified = true; // args["CreatedByUserID"].NewValue = WindowsIdentity.GetCurrent().Name; // args["CreatedByUserID"].Modified = true; } // if (args["CreatedByUsername"].Value == null) if (args.CommandName == "Insert" && args["CreatedByUsername"].Value == null) { MembershipUser User = Membership.GetUser(); args["CreatedByUsername"].NewValue = User.UserName; args["CreatedByUsername"].Modified = true; // args["CreatedByUserID"].NewValue = WindowsIdentity.GetCurrent().Name; // args["CreatedByUserID"].Modified = true; } /* * if (args.CommandName == "Update" && args["ChangedByUsername"].Value == null) * * { * MembershipUser User = Membership.GetUser(); * args["ChangedByUsername"].NewValue = User.UserName; * args["ChangedByUsername"].Modified = true; * * // args["CreatedByUserID"].NewValue = WindowsIdentity.GetCurrent().Name; * // args["CreatedByUserID"].Modified = true; * * } */ }
public override void Do(ActionArgs args) { // Do Jumping Mobile mobile = this.Entity.GetComponent("Mobile") as Mobile; ElapsedTime += ((SingleIntArgs)args).Amount; // if not forcing down nor jumping, lets jump if (!Jump && !Down && ElapsedTime >= (1 * 1000)) { Jump = true; mobile.Velocity = new Vector2(mobile.Velocity.X, GameUtil.JumpPower); this.Entity.DoAction("ChangeFrameOfAnimation", new SingleIntArgs(1)); } // we're still going up! if (Jump && !Down) { // hit max height? if (mobile.Position.Y <= GameUtil.playerY - GameUtil.maxJumpHeight) { Down = true; mobile.Velocity += new Vector2(0, GameUtil.JumpFriction); } } // we need to stop falling when we hit ground. if (Down) { if (mobile.Velocity.Y < GameUtil.FallPower) { mobile.Velocity += new Vector2(0, GameUtil.JumpFriction); } if (mobile.Position.Y >= GameUtil.playerY) { Vector2 standPosition = mobile.Position; standPosition.Y = GameUtil.groundY - mobile.SpriteHeight; mobile.Position = standPosition; mobile.Velocity = new Vector2(mobile.Velocity.X, 0); Down = false; Jump = false; ElapsedTime = 0; this.Entity.DoAction("ChangeFrameOfAnimation", new SingleIntArgs(0)); } } mobile.Position += mobile.Velocity; }
//换箱请求下料 public Result PLC01AgvChangeEvent(ActionArgs actionArgs) { //换箱请求下料 RChargingState chargingState = new RChargingState() { LINE = Constant.OrderLine, IS_READ = 0, DISPATCH_STATE = 1, FLAG = 1, NO_FROM = "1" }; actionArgs.RedisClientRemote.Set("LD:A00:MDCI:CHARGING_STATE:Q", chargingState); Logger.Device.Info($" invoke PLC01AgvChangeEvent 换箱请求下料"); return(Result.Success()); }
//记录AGV到达1号位信号 public Result AgvArriviedEvent(ActionArgs actionArgs) { var eng = ModBusDataFactory.workFlowEngines.FirstOrDefault(x => x.ModuleName == "WFE"); FlowBlock block = eng?._workFlow.Blocks.FirstOrDefault(v => v.Name == "PLC01UpdateInfoB"); //模拟3个料箱信息写入RFID byte[] bts = InitRfidStationInfos(actionArgs); if (block == null) { return(Result.Fail()); } block.Steps[0].Value = Encoding.Unicode.GetString(bts); eng.EnqueueBlock(block); Logger.Device.Info($" invoke AgvArriviedEvent 记录AGV到达1号位信号"); return(Result.Success()); }
public override void Do(ActionArgs e) { Begin(e); if (precheckToDo(e)) { var arg = e as ActionLoadImageArgs; WebClient client = new WebClient(); client.OpenReadCompleted += client_OpenReadCompleted; _waiting.Add(client, arg); client.OpenReadAsync(arg.ImageUri); } else { Cancel(e); } }
static void HandleFinishedTask(object sender, ActionArgs e) { Tasks tasks = new Tasks(); tasks.Load(); Task task = tasks.CurrentTask(); tasks.SetCurrentTaskFinished(); Notification notify = new Notification(); notify.Summary = "Task Finished"; notify.Body = task.Summary; notify.Urgency = Urgency.Critical; notify.Show(); SuggestTask(); }
public void VerifyBuyXPayYActionCampaign() { // The BuyXPayYAction uses IOrderTotalCalculator.CalculateOrderRowTotal which is a bad method as it has // no access to the OrderCarrier, and therefor doesn't know which currency is being used. var order = new OrderCarrier { CurrencyID = currencySystemId, OrderRows = new List <OrderRowCarrier> { new OrderRowCarrier { Quantity = 3, TotalPrice = 5.01m, TotalVATAmount = 0.96m, UnitListPrice = 1.67226891m, VATPercentage = 0.1900m } } }; var filteredOrderRow = new FilteredOrderRow(); filteredOrderRow.SetInternalProperty(r => r.OrderRowCarrier, order.OrderRows.First()); var args = new ActionArgs(); args.SetInternalProperty(r => r.OrderCarrier, order); args.SetInternalProperty(r => r.FilteredOrderRows, new List <FilteredOrderRow> { filteredOrderRow }); var campaignData = new BuyXPayYAction.Data { BuyQuantity = 3, PayQuantity = 2 }; var sut = new CampaignAction(campaignData); sut.PublicProcess(args); CalculateOrder(order); Assert.Equal(1.67m, order.TotalDiscount); Assert.Equal(1.99m, order.TotalDiscountWithVAT); }
public void HandleInput(string input) { input = input.Trim(); if (status != InterpreterState.Standard) { Initialize(input); return; } input = input.ToLower(); string[] inputArgs = input.Split(' '); string command = inputArgs[0].ToLower(); string commandargs = input.Substring(command.Length).Trim();; if (inputArgs.Length >= 1) { ActionArgs a = null; string arg = input.Remove(0, command.Length); try { ActionBuilder builder = Player.GetAction(command); if (builder != null) { a = builder.TranslateArgs(Player, input); } if (builder != null && a != null) { CharacterAction act = builder.BuildAction(a); if (act != null) { if (act is TargetedAction && ((TargetedAction)act).Target == null) { Player.NotifyPlayer("Targeted actions must have a valid target"); return; } Player.Room.AddActionToQueue(builder.BuildAction(a)); } } }catch (ArgumentException ex) { Player.NotifyPlayer(ex.Message); } } if (Commands.ContainsKey(command)) { Commands[command](commandargs); } }
public override bool precheckToDo(ActionArgs e) { ActionFacebookGetAvatarArgs arg = e as ActionFacebookGetAvatarArgs; if (arg != null) { if (arg.IsGuest) { return(arg.FacebookId > 0); } else { return(FacebookClient.Instance.IsUserLogedin()); } } return(false); }
public override void Do(ActionArgs args) { if (this.Entity != null && args != null && args is MoveTowardsPlayerArgs) { Position position = this.Entity.GetComponent("Position") as Position; MoveTowardsPlayerArgs arguments = args as MoveTowardsPlayerArgs; if (position != null) { Vector2 next = getNextPointToPlayer(position, arguments); if (next != Vector2.Zero && !arguments.manager.isMobAliveAtPos(next)) { this.Entity.DoAction("ChangeAbsPosition", new ChangePositionArgs(next)); } } } }
public override void Do(ActionArgs e) { Begin(e); if (precheckToDo(e)) { try { ActionFacebookGetAvatarArgs arg = e as ActionFacebookGetAvatarArgs; loadAvatar(arg); } catch (Exception ex) { Cancel(e); } } else { Cancel(e); } }
void support_global_act_OnDone(object sender, ActionArgs e) { ActionSupportAccountAskArgs arg = e as ActionSupportAccountAskArgs; ServerStream sv = _stream_wating[(Actions.Action)sender]; _stream_wating.Remove((Actions.Action)sender); int buff_len = 2 + 2 * arg.AccountId.Length; StreamBuffer buff = new StreamBuffer(buff_len); buff.writeSStr(arg.AccountId); sv.ResponseData = buff.Data; sv.ErrorCode = 0; sv.Status = (int)ServerStreamStatus.STREAM_STATUS_RESPONSED; }
// protected override void ExecuteAction(ActionArgs args, ActionResult result) { // Added for project page oes not go well with page name if (args.CommandName == "Custom" && args.CommandArgument == "SetProjectStatusClosed") { using (SqlText updatePrice = new SqlText( "update [Projects] set StatusID=@StatusID where ID=@ID")) { updatePrice.AddParameter("@StatusID", 2); updatePrice.AddParameter("@ID", args["ID"].Value); updatePrice.ExecuteNonQuery(); } result.ClientScript = "this.set_lastCommandName(null);" + "this.goToView('grid1');"; Result.ShowAlert("Project Closed."); } }
public override void Cancel(ActionArgs e) { ActionFacebookLoginArgs arg = e as ActionFacebookLoginArgs; if (arg != null) { try { arg.Result = null; } catch (Exception ex) { //throw ex; } } else { Exception ex = new Exception("Facebook login dialog error"); //throw ex; } base.Cancel(e); }
public override void Do(ActionArgs e) { Begin(e); if (precheckToDo(e)) { try { getMe(e as ActionFacebookGetInfomationArgs); } catch (Exception ex) { throw ex; } } else { Cancel(e); } }
/// <summary> /// DeclineNotificationHandler /// Handles notifications /// </summary> private void DeclineNotificationHandler(object o, ActionArgs args) { lock (notifyLock) { Logger.Debug("The notification declined"); Notification notification = (Notification)o; if (currentNotification != null) { NotificationData data = pendingData[currentPeerID]; if (data.Conversation != null) { CleanUpConversation(data.Conversation, true); } currentNotification = null; currentPeerID = 0; } } }
public static async Task <int> WhenCommentInPost(ActionArgs args) { FacebookClient fb = new FacebookClient(args.Token_facebook); FacebookClient fb2 = new FacebookClient(args.Token_facebook); JavaScriptSerializer jss = new JavaScriptSerializer(); fb2.GetCompleted += (o, e) => { dynamic result = (IDictionary <string, object>)e.GetResultData(); if (e.Error == null) { int nb = 1; string res = jss.Serialize(result); if (((JsonArray)result["data"]).Count() > 0) { Debug.WriteLine("nb = " + nb); Debug.WriteLine("json : " + res); args.TheReaction(o, args); } } }; fb.GetCompleted += (o, e) => { dynamic result = (IDictionary <string, object>)e.GetResultData(); if (e.Error == null) { Debug.WriteLine("result = "); args.Arg1 = " OKkkk " + result["data"][0]["message"]; string post_id = result["data"][0]["id"]; fb2.GetTaskAsync(post_id + "/comments"); } }; await Task.Delay(200); await fb.GetTaskAsync("me/feed"); return(0); }
public static async Task <int> WaitForNothing(ActionArgs args) { FacebookClient fb = new FacebookClient(args.Token_facebook); fb.GetCompleted += (o, e) => { dynamic result = e.GetResultData(); if (e.Error == null) { args.Arg1 = result.message; args.TheReaction(o, args); } }; await Task.Delay(200); await fb.GetTaskAsync("me/feed"); return(0); }
public override void Do(ActionArgs e) { if (precheckToDo(e)) { Begin(e); ActionSupportAccountAskArgs arg = e as ActionSupportAccountAskArgs; Deployment.Current.Dispatcher.BeginInvoke(() => { SupportAccountAskDialog dialog = new SupportAccountAskDialog(); dialog.OnComplete += dialog_OnComplete; arg.ParentLayout.Children.Add(dialog.Dialog); _waiting.Add(dialog, arg); dialog.show(); }); } else { Cancel(e); } }
public override void Do(ActionArgs args) { if (this.Entity != null && args != null && args is ChangeDirectionOfAnimationArgs) { Animation animation = this.Entity.GetComponent("Animation") as Animation; if (animation != null) { string direction = ((ChangeDirectionOfAnimationArgs)args).Direction; if (direction == "left") { animation.Effects = SpriteEffects.FlipHorizontally; } else if (direction == "right") { animation.Effects = SpriteEffects.None; } } } }
public override void Do(ActionArgs args) { if (this.Entity != null && args != null && (args is EquipWeaponArgs || args is EquipArmorArgs)) { bool isWeapon = false; if (args is EquipWeaponArgs) { weaponArgs = args as EquipWeaponArgs; isWeapon = true; } else if (args is EquipArmorArgs) armorArgs = args as EquipArmorArgs; Equipment equipment = this.Entity.GetComponent("Equipment") as Equipment; if (isWeapon) { switch (weaponArgs.Slot) { case (int)Slots.MainHand: equipment.MainHand = weaponArgs.Equipable; break; default: break; } } else { switch (armorArgs.Slot) { case (int)Slots.Chest: equipment.Chest = armorArgs.Equipable; break; default: break; } } } }
public override void Do(ActionArgs args) { if (this.Entity != null && args != null && args is MoveArgs) { Movement movement = this.Entity.GetComponent("Movement") as Movement; movement.PreviousPosition = movement.CurrentPosition; movement.CurrentSmoothing = 0; switch (((MoveArgs)args).MovingDirection) { case MoveArgs.Direction.Up: movement.CurrentPosition += new Vector2(0, -movement.Velocity); break; case MoveArgs.Direction.Down: movement.CurrentPosition += new Vector2(0, movement.Velocity); break; case MoveArgs.Direction.Left: movement.CurrentPosition += new Vector2(-movement.Velocity, 0); break; case MoveArgs.Direction.Right: movement.CurrentPosition += new Vector2(movement.Velocity, 0); break; } } }
public override void Do(ActionArgs args) { Drawable drawable = this.Entity.GetComponent("Drawable") as Drawable; if (drawable != null) { drawable.ElapsedTimeCounter += ((AnimationTimeArgs)args).Delta; if (drawable.ElapsedTimeCounter > GameUtil.playerAnimationLength) { if (drawable.Looping) { drawable.CurrentFrame++; // if we have 2 frames, they count as 0 and 1. 2 is out of bounds. if (drawable.CurrentFrame == drawable.FrameCount) { drawable.CurrentFrame = 0; } } else { // make sure we haven't hit the end of drawable if (drawable.CurrentFrame + 1 != drawable.FrameCount) { drawable.CurrentFrame++; } } drawable.SourceRect = new Rectangle(drawable.CurrentFrame * drawable.FrameWidth, 0, drawable.FrameWidth, drawable.FrameHeight); drawable.ElapsedTimeCounter = 0; } } }
/// <summary> /// Logout user using FormsAuthentication /// </summary> /// <param name="args"></param> public void Execute(ActionArgs args) { FormsAuthentication.SignOut(); }
protected virtual int ExecuteAction(MyCompany.Data.Objects.Prefix thePrefix, MyCompany.Data.Objects.Prefix original_Prefix, string lastCommandName, string commandName, string dataView) { ActionArgs args = new ActionArgs(); args.Controller = "Prefix"; args.View = dataView; args.Values = CreateFieldValues(thePrefix, original_Prefix); args.LastCommandName = lastCommandName; args.CommandName = commandName; ActionResult result = ControllerFactory.CreateDataController().Execute("Prefix", dataView, args); result.RaiseExceptionIfErrors(); result.AssignTo(thePrefix); return result.RowsAffected; }
void IPlugIn.ProcessArguments(ActionArgs args, ActionResult result, ViewPage page) { if (_annotations.Count == 0) return; string p = AnnotationPlugIn.GenerateDataRecordPath(args.Controller, page, args.Values, 0); if (!(Directory.Exists(p))) Directory.CreateDirectory(p); foreach (FieldValue v in _annotations) { Match m = Regex.Match(v.Name, "^_Annotation_(Note)(New|\\w+)$"); if (m.Success) { if (m.Groups[1].Value == "Note") { string fileName = m.Groups[2].Value; if (fileName == "New") { fileName = DateTime.Now.ToString("u"); fileName = Regex.Replace(fileName, "[\\W]", String.Empty); } fileName = Path.Combine(p, (fileName + ".xml")); if (!(String.IsNullOrEmpty(Convert.ToString(v.NewValue)))) { XmlWriterSettings settings = new XmlWriterSettings(); settings.CloseOutput = true; XmlWriter writer = XmlWriter.Create(new FileStream(fileName, FileMode.Create), settings); try { writer.WriteStartElement("note"); writer.WriteAttributeString("timestamp", DateTime.Now.ToString("o")); writer.WriteAttributeString("username", HttpContext.Current.User.Identity.Name); writer.WriteAttributeString("email", AnnotationPlugIn.UserEmail); writer.WriteString(Convert.ToString(v.NewValue)); writer.WriteEndElement(); } finally { writer.Close(); } } else { File.Delete(fileName); if (Directory.GetFiles(p).Length == 0) Directory.Delete(p); } } } } }
void IPlugIn.PreProcessArguments(ActionArgs args, ActionResult result, ViewPage page) { _annotations = new List<FieldValue>(); if (args.Values != null) foreach (FieldValue v in args.Values) if (v.Name.StartsWith("_Annotation_") && v.Modified) { _annotations.Add(v); v.Modified = false; } }
protected virtual string GenerateOutputFileName(ActionArgs args, string outputFileName) { args.CommandArgument = args.CommandName; args.CommandName = "FileName"; List<FieldValue> values = new List<FieldValue>(); values.Add(new FieldValue("FileName", outputFileName)); args.Values = values.ToArray(); ActionResult result = ControllerFactory.CreateDataController().Execute(args.Controller, args.View, args); foreach (FieldValue v in result.Values) if (v.Name == "FileName") { outputFileName = Convert.ToString(v.Value); break; } return outputFileName; }
public virtual void Do(ActionArgs args) { }
protected virtual int ExecuteAction(MyCompany.Data.Objects.MoneyReceiptsGeneral theMoneyReceiptsGeneral, MyCompany.Data.Objects.MoneyReceiptsGeneral original_MoneyReceiptsGeneral, string lastCommandName, string commandName, string dataView) { ActionArgs args = new ActionArgs(); args.Controller = "MoneyReceiptsGeneral"; args.View = dataView; args.Values = CreateFieldValues(theMoneyReceiptsGeneral, original_MoneyReceiptsGeneral); args.LastCommandName = lastCommandName; args.CommandName = commandName; ActionResult result = ControllerFactory.CreateDataController().Execute("MoneyReceiptsGeneral", dataView, args); result.RaiseExceptionIfErrors(); result.AssignTo(theMoneyReceiptsGeneral); return result.RowsAffected; }
private void OnSafeInvoke(object sender, ActionArgs e) { // DispatcherPriority set to lower than both databinding and rendering to give them priority over data processing Dispatcher.BeginInvoke(e.Action, DispatcherPriority.Background, null); }
protected virtual int ExecuteAction(MyCompany.Data.Objects.AccTrnDetailForChequeVoid theAccTrnDetailForChequeVoid, MyCompany.Data.Objects.AccTrnDetailForChequeVoid original_AccTrnDetailForChequeVoid, string lastCommandName, string commandName, string dataView) { ActionArgs args = new ActionArgs(); args.Controller = "AccTrnDetailForChequeVoid"; args.View = dataView; args.Values = CreateFieldValues(theAccTrnDetailForChequeVoid, original_AccTrnDetailForChequeVoid); args.LastCommandName = lastCommandName; args.CommandName = commandName; ActionResult result = ControllerFactory.CreateDataController().Execute("AccTrnDetailForChequeVoid", dataView, args); result.RaiseExceptionIfErrors(); result.AssignTo(theAccTrnDetailForChequeVoid); return result.RowsAffected; }