コード例 #1
0
ファイル: ActionDAL.cs プロジェクト: aNd1coder/Wojoz
        /// <summary>
        /// 更新数据
        /// </summary>
        /// <param name="mod">ActionInfo</param>
        /// <returns>受影响行数</returns>
        public int Update(ActionInfo mod)
        {
           using (DbConnection conn = db.CreateConnection())
			{
				conn.Open();
				using (DbTransaction tran = conn.BeginTransaction())
				{ 
					try
					{ 
						using (DbCommand cmd = db.GetStoredProcCommand("SP_Action_Update"))
						{
							db.AddInParameter(cmd, "@ActionID", DbType.Int32, mod.ActionID); 
							db.AddInParameter(cmd, "@ActionName", DbType.String, mod.ActionName); 
							db.AddInParameter(cmd, "@State", DbType.Int32, mod.State); 
							db.AddInParameter(cmd, "@IsDeleted", DbType.Int32, mod.IsDeleted); 
							db.AddInParameter(cmd, "@Sort", DbType.Int32, mod.Sort); 
							tran.Commit();
							return db.ExecuteNonQuery(cmd);
						} 
					}
					catch (Exception e)
					{
						tran.Rollback();
						throw e;
					}
					finally
					{
						conn.Close();
					}
				}
			}
        }  
コード例 #2
0
ファイル: GM_Writer.cs プロジェクト: WarlockD/GMdsam
 void WriteAction(int @event, int subEvent, ActionInfo action)
 {
     string eventName = Constants.MakePrittyEventName(@event, subEvent);
     output.WriteLine("Event: {0}", action.Name);
     output.Write(action.Method); // auto ident
     output.WriteLine();
 }
コード例 #3
0
 public DeltaCallsMetric(ActionInfo info)
     : base(info)
 {
     String categoryName = this.actionInfo.ControllerName;
     String instanceName = this.actionInfo.ActionName;
     string counterName = string.Format("{0} {1} {2}", categoryName, instanceName, COUNTER_NAME);
     this.deltaCallsCounter = Metric.Context(this.actionInfo.ActionType).Counter(counterName, Unit.Requests);
 }
コード例 #4
0
 public ActiveRequestsMetric(ActionInfo info)
     : base(info)
 {
     String categoryName = this.actionInfo.ControllerName;
     String instanceName = this.actionInfo.ActionName;
     string counterName = string.Format("{0} {1} {2}", categoryName, instanceName, COUNTER_NAME);
     this.callsInProgressCounter = Metric.Context(this.actionInfo.ActionType).Counter(counterName, Unit.Custom(COUNTER_NAME));
 }
コード例 #5
0
ファイル: RunSpecCommand.cs プロジェクト: heartysoft/dokimi
 public RunSpecCommand(string assemblyPath, string formattersPath, IEnumerable<FormatterInfo> formatters, PrintInfo printInfo, ActionInfo action)
 {
     AssemblyPath = assemblyPath;
     FormattersPath = formattersPath;
     PrintInfo = printInfo;
     Action = action;
     Formatters = formatters.ToArray();
 }
コード例 #6
0
 private void SerializeInternal(ActionInfo model, IDictionary<string, object> result)
 { 
     result.Add("actionid", model.ActionID);
     result.Add("actionname", model.ActionName);
     result.Add("state", model.State);
     result.Add("isdeleted", model.IsDeleted);
     result.Add("sort", model.Sort);
 }
コード例 #7
0
        public void ActionInfoPropertiesNotNullTest()
        {
            var actionInfo = new ActionInfo();

            Assert.IsNotNull(actionInfo.Name);
            Assert.IsNotNull(actionInfo.Id);
            Assert.IsNotNull(actionInfo.InputProperties);
            Assert.IsNotNull(actionInfo.OutputProperties);
        }
        public TimerForEachRequestMetric(ActionInfo info)
            : base(info)
        {
            String controllerName = this.actionInfo.ControllerName;
            String actionName = this.actionInfo.ActionName;
            string counterName = string.Format("{0} {1}", controllerName, actionName);

            this.averageTimeCounter = Metric.Context(this.actionInfo.ActionType).Timer(counterName, Unit.Requests, SamplingType.FavourRecent,
                TimeUnit.Seconds, TimeUnit.Milliseconds);
        }
コード例 #9
0
        public void Action(Card dealer_upcard, CardSet[] player_hands, int active_hand_index, List<ActionEv> actions)
        {
            ActionInfo info = new ActionInfo() {
                hand_index = active_hand_index,
                player_cards = player_hands[active_hand_index],
                action_evs = actions.ToArray()
            };

            action_history.Add(info);
        }
コード例 #10
0
        public static bool CheckAccess(List<RoleDefinition> roleDefinitions, List<RoleAssignment> roleAssigments, string user, string resource, string action)
        {
            List<Claim> claims = new List<Claim>(1);
            claims.Add(new Claim("oid", user));
            ClaimsPrincipal claimsPrincipal = new ClaimsPrincipal(new ClaimsIdentity(claims));

            ResourceInfo resourceInfo = new ResourceInfo("/" + resource);
            ActionInfo actionInfo = new ActionInfo("/"+ resource + "/" + action);            
            
            DefaultPolicyProvider policyProvider = new DefaultPolicyProvider(roleDefinitions, roleAssigments);

            AadAuthorizationEngine engine = new AadAuthorizationEngine(policyProvider);

            return engine.CheckAccess(claimsPrincipal, resourceInfo, actionInfo);
        }
コード例 #11
0
ファイル: Mediator.cs プロジェクト: ArturR89/WPFApplication
        public void Register(object obj, IMessage message, Action handler, object context = null)
        {
            var actionInfo = new ActionInfo
            {
                Listner = obj,
                Handler = handler,
                Context = context
            };

            if (_dictionary.ContainsKey(message.GetType()))
            {
                _dictionary[message.GetType()].Add(actionInfo);
            }
            else
            {
                _dictionary.Add(message.GetType(), new List<ActionInfo>{actionInfo});
            }
        }
コード例 #12
0
ファイル: ActionService.cs プロジェクト: known/Known
 public ValidateResult SaveAs(string menu, ActionInfo action)
 {
     var command = DbHelper.Default.CreateCommand();
     command.Text = "select count(*) from T_Actions where Menu=?Menu and Code=?Code";
     command.Parameters.Add("Menu", menu);
     command.Parameters.Add("Code", action.Code);
     if (command.ToScalar<int>() > 0)
         command.Text = "update T_Actions set Name=?Name,Position=?Position,Description=?Description,Sequence=?Sequence where Menu=?Menu and Code=?Code";
     else
         command.Text = "insert into T_Actions values(?Menu,?Code,?Name,?Position,?Description,?Sequence,1)";
     command.Parameters.Add("Menu", menu);
     command.Parameters.Add("Code", action.Code);
     command.Parameters.Add("Name", action.Name);
     command.Parameters.Add("Position", action.Position);
     command.Parameters.Add("Description", action.Description);
     command.Parameters.Add("Sequence", action.Sequence);
     var message = command.Execute();
     return new ValidateResult(message);
 }
コード例 #13
0
ファイル: ActionInfo.cs プロジェクト: gahadzikwa/GAPP
        public static List<SequenceInfo> GetActionSequences()
        {
            List<SequenceInfo> result = new List<SequenceInfo>();
            try
            {
                string xml = PluginSettings.Instance.ActionSequences;
                if (!string.IsNullOrEmpty(xml))
                {
                    XmlDocument doc = new XmlDocument();
                    doc.LoadXml(xml);
                    XmlElement root = doc.DocumentElement;

                    XmlNodeList bmNodes = root.SelectNodes("sequence");
                    if (bmNodes != null)
                    {
                        foreach (XmlNode n in bmNodes)
                        {
                            SequenceInfo bm = new SequenceInfo();
                            bm.Name = n.SelectSingleNode("Name").InnerText;

                            XmlNodeList anl = n.SelectSingleNode("actions").SelectNodes("action");
                            if (anl != null)
                            {
                                foreach (XmlNode an in anl)
                                {
                                    ActionInfo ai = new ActionInfo();
                                    ai.Plugin = an.SelectSingleNode("Plugin").InnerText;
                                    ai.Action = an.SelectSingleNode("Action").InnerText;
                                    ai.SubAction = an.SelectSingleNode("SubAction").InnerText;
                                    bm.Actions.Add(ai);
                                }
                            }
                            result.Add(bm);
                        }
                    }
                }
            }
            catch
            {
            }
            return result;
        }
コード例 #14
0
ファイル: ActionInfo.cs プロジェクト: RH-Code/GAPP
        public static List<SequenceInfo> GetActionSequences(string filename)
        {
            List<SequenceInfo> result = new List<SequenceInfo>();
            try
            {
                if (System.IO.File.Exists(filename))
                {
                    XmlDocument doc = new XmlDocument();
                    doc.Load(filename);
                    XmlElement root = doc.DocumentElement;

                    XmlNodeList bmNodes = root.SelectNodes("sequence");
                    if (bmNodes != null)
                    {
                        foreach (XmlNode n in bmNodes)
                        {
                            SequenceInfo bm = new SequenceInfo();
                            bm.Name = n.SelectSingleNode("Name").InnerText;

                            XmlNodeList anl = n.SelectSingleNode("actions").SelectNodes("action");
                            if (anl != null)
                            {
                                foreach (XmlNode an in anl)
                                {
                                    ActionInfo ai = new ActionInfo();
                                    ai.Plugin = an.SelectSingleNode("Plugin").InnerText;
                                    ai.Action = an.SelectSingleNode("Action").InnerText;
                                    ai.SubAction = an.SelectSingleNode("SubAction").InnerText;
                                    bm.Actions.Add(ai);
                                }
                            }
                            result.Add(bm);
                        }
                    }
                }
            }
            catch
            {
            }
            return result;
        }
コード例 #15
0
    private void PreviewHandler(CharacterConfigInfo characterConfigInfo, ActionInfo actionInfo)
    {
        Debug.LogError("start preview");
        Alert.Show("预览准备中,请稍等......");
        currentCharacterConfigInfo = characterConfigInfo;
        currentActionInfo          = actionInfo;
        if (currentCharacterConfigInfo != null && currentActionInfo != null && tCreature != null)
        {
            bool isCorrect = CheckActionInfo(currentActionInfo);
            if (!isCorrect)
            {
                return;
            }

            if (currentActionInfo.ActionName != AnimationType.Idle)
            {
                tTimerInfo = TimerManager.AddDelayHandler(OnDelHandler, 2f, 1);
                tCreature.PlayAnimation(AnimationType.Idle, true);
            }
        }
    }
コード例 #16
0
        private void OnTimer_UpdateInstantActions(object sender, ElapsedEventArgs e)
        {
            if (_disposed || !_running)
            {
                return;
            }

            Instance._timerInstant.Stop();

            if (Instance._instantActions.Count > 0)
            {
                ActionInfo action = null;
                Instance._instantActions.TryDequeue(out action);
                if (action != null)
                {
                    action.Action?.Invoke();
                    action.Callback?.Invoke();
                }
                Instance._timerInstant.Start();
            }
        }
コード例 #17
0
ファイル: AvailableActions.cs プロジェクト: Sin96/GestureSign
        private void cmdDeleteAction_Click(object sender, RoutedEventArgs e)
        {
            // Verify that we have an item selected
            if (lstAvailableActions.SelectedItems.Count == 0)
            {
                return;
            }

            // Confirm user really wants to delete selected items
            if (UIHelper.GetParentWindow(this)
                .ShowModalMessageExternal(LocalizationProvider.Instance.GetTextValue("Action.Messages.DeleteConfirmTitle"),
                                          LocalizationProvider.Instance.GetTextValue("Action.Messages.DeleteActionConfirm"),
                                          MessageDialogStyle.AffirmativeAndNegative, new MetroDialogSettings()
            {
                AffirmativeButtonText = LocalizationProvider.Instance.GetTextValue("Common.OK"),
                NegativeButtonText = LocalizationProvider.Instance.GetTextValue("Common.Cancel"),
                ColorScheme = MetroDialogColorScheme.Accented,
            }) != MessageDialogResult.Affirmative)
            {
                return;
            }


            // Loop through selected actions
            for (int i = lstAvailableActions.SelectedItems.Count - 1; i >= 0; i--)
            {
                // Grab selected item
                ActionInfo selectedAction = lstAvailableActions.SelectedItems[i] as ActionInfo;

                // Get the name of the action
                string strActionName = selectedAction.ActionName;

                IApplication selectedApp = lstAvailableApplication.SelectedItem as IApplication;

                selectedApp.RemoveAction(selectedApp.Actions.FirstOrDefault(a => a.Name.Equals(strActionName, StringComparison.Ordinal)));
            }
            RefreshActions(false);
            // Save entire list of applications
            ApplicationManager.Instance.SaveApplications();
        }
コード例 #18
0
        public static IFindUser CreateStrategy(ActionInfo action)
        {
            IFindUser strategy;

            switch (action.AllocationType)
            {
            case ActionInfo.AllocationEnum.角色:
                strategy = new FindByRole();
                break;

            case ActionInfo.AllocationEnum.指定:
                strategy = new FindUserBySpecify();
                break;

            case ActionInfo.AllocationEnum.记录:
                strategy = new FindUserByLog();
                break;

            case ActionInfo.AllocationEnum.指定:
                strategy = new NoAllocation();
                break;

            case ActionInfo.AllocationEnum.道经理:
                strategy = new FIndPartner();
                break;

            case ActionInfo.AllocationEnum.发起者:
                strategy = new FindStarter();
                break;

            case ActionInfo.AllocationEnum.自己:
                strategy = new FindSelf();
                break;

            default:
                throw new ApplicationException("创建寻找用户策略失败!");
            }

            return(strategy);
        }
コード例 #19
0
ファイル: RoomMgr.cs プロジェクト: isoundy000/shmj3d
    public ActionInfo doChi(JsonObject data)
    {
        ActionInfo _info = JsonUtility.FromJson <ActionInfo>(data.ToString());

        int        pai   = _info.pai;
        SeatInfo   seat  = seats[_info.seatindex];
        List <int> holds = seat.holds;
        List <int> chis  = seat.chis;

        if (holds.Count > 0)
        {
            List <int> mjs = getChiArr(pai, true);
            for (int i = 0; i < 2; i++)
            {
                removeFromList(holds, mjs[i]);
            }
        }

        chis.Add(pai);

        return(_info);
    }
コード例 #20
0
    //处理技能信息的编辑
    public void HandleEditActionInfo(ActionInfo actionInfo)
    {
        //每一行技能脚本的开始
        EditorGUILayout.BeginVertical();

        EditorGUILayout.BeginHorizontal();

        //GUILayout.Button(actionInfo.ActionNameEnum.ToString());

        //if (GUILayout.Button("X"))
        //{
        //    scriptAction.ActionInfoList.RemoveAt(i);
        //    return;
        //}
        actionInfo.ActionNameEnum = (ActionNameEnum)EditorGUILayout.EnumPopup("ActionNameEnum", actionInfo.ActionNameEnum,
                                                                              GUILayout.Width(100), GUILayout.Height(20),
                                                                              GUILayout.MaxWidth(200), GUILayout.MaxHeight(80), GUILayout.ExpandHeight(true), GUILayout.ExpandWidth(true));
        EditorGUILayout.EndHorizontal();

        //每一行技能脚本的结束
        EditorGUILayout.EndVertical();
    }
コード例 #21
0
        protected Task ExecuteCommand(ActionInfo action, DotvvmRequestContext context, IEnumerable <ActionFilterAttribute> methodFilters)
        {
            // run OnCommandExecuting on action filters
            foreach (var filter in methodFilters)
            {
                filter.OnCommandExecuting(context, action);
            }
            object result = null;

            try
            {
                result = action.Action();
            }
            catch (Exception ex)
            {
                if (ex is TargetInvocationException)
                {
                    ex = ex.InnerException;
                }
                if (ex is DotvvmInterruptRequestExecutionException)
                {
                    throw new DotvvmInterruptRequestExecutionException("The request execution was interrupted in the command!", ex);
                }
                context.CommandException = ex;
            }

            // run OnCommandExecuted on action filters
            foreach (var filter in methodFilters.Reverse())
            {
                filter.OnCommandExecuted(context, action, context.CommandException);
            }

            if (context.CommandException != null && !context.IsCommandExceptionHandled)
            {
                throw new Exception("Unhandled exception occured in the command!", context.CommandException);
            }

            return(result as Task ?? (result == null ? TaskUtils.GetCompletedTask() : Task.FromResult(result)));
        }
コード例 #22
0
ファイル: Player.cs プロジェクト: PyotrRomanov/LD41
    private void TargetPhase(MetaAction metaAction, KeyCode keyPressed)
    {
        ActionInfo actionInfo = new ActionInfo();

        if (metaAction is TargetedMetaAction)
        {
            TargetedMetaAction targetAction = metaAction as TargetedMetaAction;
            GameObject         cursor       = Instantiate((GameObject)Resources.Load(Player.cursorPf));
            actionInfo.originId  = this.id;
            actionInfo.originPos = this.position;
            cursor.GetComponent <TargetCursor>().Setup(this, targetAction.PotentialTargets(board, actionInfo), targetAction, actionInfo, keyPressed);
            selectActionPhase = false;
        }
        else
        {
            actionInfo.originId  = this.id;
            actionInfo.originPos = this.position;
            actionInfo.targetId  = World.InvalidId;
            actionInfo.targetPos = Board.InvalidPos;
            EndTargetPhase(metaAction, actionInfo);
        }
    }
コード例 #23
0
        private void TryPublishEvents(EventStream eventStream, ActionInfo successActionInfo)
        {
            Func <EventStream, bool> tryPublishEventsAction = (stream) => {
                try {
                    _eventPublisher.Publish(stream);
                    return(true);
                }
                catch (Exception ex) {
                    _logger.Error(string.Format("Exception raised when publishing events:{0}", stream.GetStreamInformation()), ex);
                    return(false);
                }
            };

            if (_retryService.TryAction("TryPublishEvents", () => tryPublishEventsAction(eventStream), 3))
            {
                successActionInfo.Action(successActionInfo.Data);
            }
            else
            {
                _retryService.RetryInQueue(new ActionInfo("TryPublishEvents", (obj) => tryPublishEventsAction(obj as EventStream), eventStream, successActionInfo));
            }
        }
コード例 #24
0
 public ActionResult AddActionInfo(ActionInfo actionInfo)
 {
     if (!string.IsNullOrEmpty(actionInfo.ActionName) && !string.IsNullOrEmpty(actionInfo.Url) && !string.IsNullOrEmpty(Request["Sort"]))
     {
         int sort = 0;
         int.TryParse(Request["Sort"], out sort);
         short normal = (short)DelFlagEnum.Normal;
         actionInfo.Url       = Request["Url"].ToLower();
         actionInfo.Sort      = sort;
         actionInfo.SubTime   = DateTime.Now;
         actionInfo.ModfiedOn = DateTime.Now;
         actionInfo.DelFlag   = normal;
         actionInfo.IsMenu    = Request["isOrNo"] == "true" ? true : false;
         actionInfo.MenuIcon  = Request["ImgSrc"];
         ActionInfo action = ActionInfoService.Add(actionInfo);
         if (action != null)
         {
             return(Content("ok"));
         }
     }
     return(Content("no"));
 }
コード例 #25
0
        public List <ActionInfo> read()
        {
            /// 该方法的代码由插件自动生成,请勿修改。
            string            sql = @"SELECT * FROM ACTION_INFO";
            DataTable         dt  = Helper.Query(sql);
            List <ActionInfo> rst = new List <ActionInfo>();

            foreach (DataRow row in dt.Rows)
            {
                ActionInfo t = new ActionInfo();
                t.NUM             = row[nameof(ActionInfo.NUM)].TryToInt();
                t.ACTION_CODE     = row[nameof(ActionInfo.ACTION_CODE)].TryToString();
                t.CREATE_TIME     = row[nameof(ActionInfo.CREATE_TIME)].TryToDateTime();
                t.DEST_DEVICE     = row[nameof(ActionInfo.DEST_DEVICE)].TryToString();
                t.SOURCE_DEVICE   = row[nameof(ActionInfo.SOURCE_DEVICE)].TryToString();
                t.ACTION_REQUEST  = row[nameof(ActionInfo.ACTION_REQUEST)].TryToString();
                t.ACTION_RESPONSE = row[nameof(ActionInfo.ACTION_RESPONSE)].TryToString();
                t.FLAG            = row[nameof(ActionInfo.FLAG)].TryToInt();
                rst.Add(t);
            }
            return(rst);
        }
コード例 #26
0
        public virtual void Send(TMessage message, object context = null)
        {
            try
            {
                object cntxt = context;
                if (cntxt == null)
                {
                    cntxt = _defaultMessenger;
                }

                IDictionary <WeakReference, ActionInfo> actions = FindActions(cntxt);
                if (actions != null)
                {
                    foreach (var item in actions)
                    {
                        object recipient = item.Key.Target;
                        if (recipient != null)  // Otherwise the recipient has died and been garbage collected
                        {
                            ActionInfo actionInfo = item.Value;
                            if (actionInfo.InvokeOnUiThread)
                            {
                                Device.BeginInvokeOnMainThread(() => {
                                    actionInfo.Action(message);
                                });
                            }
                            else
                            {
                                actionInfo.Action(message);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Logging.LogException(ex);
                throw;
            }
        }
コード例 #27
0
        public ActionResult ShowEditInfo()
        {
            int id = int.Parse(Request["id"]);

            var roleInfo = ActionInfoService.LoadEntities(r => r.ID == id).FirstOrDefault();

            ActionInfo ai = new ActionInfo();

            ai.ActionInfoName = roleInfo.ActionInfoName;
            ai.Url            = roleInfo.Url;
            ai.ID             = roleInfo.ID;
            ai.HttpMethod     = roleInfo.HttpMethod;

            if (ai != null)
            {
                return(Content(Common.SerializerHelper.SerializeToString(new { serverData = ai, msg = "ok" })));
            }
            else
            {
                return(Content(Common.SerializerHelper.SerializeToString(new { msg = "no" })));
            }
        }
コード例 #28
0
        public void Can_Add_ActionInfo()
        {
            ActionInfo model = new ActionInfo
            {
                ID         = TableIDCodingRule.newID("actioninfo", ""),
                ActionName = "学生信息管理",
                HttpMethd  = "Get",
                IsMenu     = true,
                DelFlag    = (short)DelFlagEnum.Normal,
                ModfiedOn  = DateTime.Now,
                SubTime    = DateTime.Now,
                Sort       = 1,
                Url        = "ActionInfo/Index"
            };
            //IActionInfoService target = new ActionInfoService();
            //target.Add(model);
            Mock <IActionInfoService> mock = new Mock <IActionInfoService>();

            //ActionInfoController target = new ActionInfoController(mock.Object);
            //target.Edit(model);
            mock.Verify(u => u.Add(model), Times.Once);
        }
コード例 #29
0
        public override void ShootDashSkillServer(byte actionToken, bool IsBasicAttack, Vector3 targetPos, Vector3 dir)
        {
            if (StateServerSide != ActorState.Idle)
            {
                Log.Information($"ShootDashSkillServer wrong state {StateServerSide}, networkID{GetNetworkId()}");
                return;
            }

            // 패킷을 송신한 유저를 제외하고 리스트 구성
            var player_list = World.Instance(WorldId).playerList.Keys.Where(x => x != mActorController.ControllPlayerId).ToList();


            // 검증을 위해 ActionToken을 등록해둔다.
            ActionTokens[actionToken] = new ActionInfo()
            {
                SkillId = GetSkillId(IsBasicAttack), hitIndex = new HashSet <byte>()
            };

            JSkillData data = ACDC.SkillData[ActionTokens[actionToken].SkillId];

            float duration = 0f;

            if (data != null)
            {
                duration = data.durationTime;
            }

            //Log.Information($"ShootDashSkillServer player ({string.Join(",", player_list)}), {targetPos}, {dir} duration {duration}");

            mActorStateMachine.ChangeState(this, mActorStateMachine.UpdateDash, ActorState.Dash, duration);
            TargetPos = targetPos;

            Vector2 direction = new Vector2(targetPos.x - GetLocation().x, targetPos.z - GetLocation().z);

            degree       = direction.Angle();
            lastVelocity = new Vector3(direction.x, 0, direction.y) * 0.1f;

            InvokeClientRpc(ShootDashRamClient, player_list, actionToken, IsBasicAttack, targetPos, dir);
        }
コード例 #30
0
 public ActionInfo GetActionInfo(Vector2Int position)
 {
     if ((possibleActions & ActionType.Walk) == ActionType.Walk)
     {
         LinkedList <AStarPathNode> path = AStarManager.GetInstance().Search(GridTransform.Position, position);
         if (path == null || path.Count <= 1)
         {
             Debug.LogWarning("Couldn't find path to " + position.ToString());
             return(null);
         }
         if (path.Count - 1 > Stat.MovePoints.Value)
         {
             Debug.LogWarning("Not enough move points");
             return(null);
         }
         ActionInfo actionInfo = new ActionInfo();
         actionInfo.ActionList.Add(new MovingAction(path.Count - 1, path));
         return(actionInfo);
     }
     Debug.LogWarning("Can't walk");
     return(null);
 }
コード例 #31
0
        private static PageHateoasResponse ProcessPagingValidationException(PagingValidationException pagingValidationException, ExceptionContext context, PagingStringResources pageStringResources, IUrlHelper urlHelper)
        {
            const int DefaultPageNumber = 1;
            const int DefaultPageSize   = 25;

            var errorResponse = new PageHateoasResponse
            {
                Errors     = pagingValidationException.ValidationMessages,
                PageNumber = DefaultPageNumber,
                PageSize   = DefaultPageSize
            };

            var actionInfo = new ActionInfo
            {
                UrlHelper  = urlHelper,
                RouteName  = context.ActionDescriptor.AttributeRouteInfo.Name,
                HttpMethod = context.HttpContext.Request.Method
            };

            errorResponse.GenerateLinks(pageStringResources, actionInfo);
            return(errorResponse);
        }
コード例 #32
0
        public void Spell(string spellName)
        {
            Action action = new Action();

            Logging.Logger.AddInfo(this.npc.character.name + " kouzli " + spellName);
            this.spells.TryGetValue(spellName, out action);

            if (action.name != null)
            {
                this.npc.SetCoolDown(action.time);
                this.npc.Heal(action.hpGot);
                this.npc.DrainMana(action.manaDrain);

                ActionInfo info = new ActionInfo();
                info.action         = action;
                info.npcName        = this.npc.character.name;
                info.startPosition  = this.npc.GetPosition3D();
                info.targetName     = this.npc.GetTargetedEnemy().GetCharacter().name;
                info.targetPosition = this.npc.GetTargetedEnemy().GetPosition3D();
                this.npc.GetEntity().Spell(info);
            }
        }
コード例 #33
0
        private void RemoveActions()
        {
            if (AddAction != null)
            {
                ActionInfo addedAction = HostShip.ShipInfo.ActionIcons.Actions.First(a =>
                                                                                     a.ActionType == AddAction.ActionType &&
                                                                                     a.Color == AddAction.Color &&
                                                                                     a.Source == HostUpgrade
                                                                                     );
                HostShip.ShipInfo.ActionIcons.Actions.Remove(addedAction);

                if (HostShip.State != null)
                {
                    HostUpgrade.HostShip.ActionBar.RemoveGrantedAction(AddAction.ActionType, HostUpgrade);
                }
            }

            if (AddActionLink != null)
            {
                HostUpgrade.HostShip.ActionBar.RemoveActionLink(AddActionLink.ActionType, AddActionLink.ActionLinkedType);
            }
        }
コード例 #34
0
ファイル: MessagePipeline.cs プロジェクト: S031/MetaStack
        private async Task <ActionInfo> BuildContext(DataPackage message)
        {
            var    config       = _services.GetRequiredService <IConfiguration>();
            string actionID     = (string)message.Headers["ActionID"];
            string userName     = (string)message.Headers["UserName"];
            string sessionID    = (string)message.Headers["SessionID"];
            string encryptedKey = (string)message.Headers["EncryptedKey"];

            if (!message.Headers.TryGetValue("ConnectionName", out object connectionName))
            {
                connectionName = config["appSettings:defaultConnection"];
            }
            ;

            ActionInfo ai = await _actionManager.GetActionInfoAsync(actionID);

            ActionContext ctx = new ActionContext(_services)
            {
                CancellationToken = _token,
                UserName          = userName,
                SessionID         = sessionID,
                ConnectionName    = (string)connectionName
            };

            if (ai.AuthenticationRequired)
            {
                var ui = await _loginProvider.LogonAsync(userName, sessionID, encryptedKey);

                ctx.Principal = ui;
            }
            else
            {
                ctx.Principal = _guest;
            }

            ai.SetContext(ctx);
            return(ai);
        }
コード例 #35
0
        public static void Dispatch(Action action, bool waitUntilCompleted = false)
        {
            if (!m_mainThreadId.HasValue)
            {
                throw new InvalidOperationException("Dispatcher is not initialized.");
            }
            ActionInfo actionInfo;

            if (m_mainThreadId.Value == Environment.CurrentManagedThreadId)
            {
                action();
            }
            else if (waitUntilCompleted)
            {
                actionInfo        = default(ActionInfo);
                actionInfo.Action = action;
                actionInfo.Event  = new ManualResetEventSlim(initialState: false);
                ActionInfo item = actionInfo;
                lock (m_actionInfos)
                {
                    m_actionInfos.Add(item);
                }
                item.Event.Wait();
                item.Event.Dispose();
            }
            else
            {
                lock (m_actionInfos)
                {
                    List <ActionInfo> actionInfos = m_actionInfos;
                    actionInfo = new ActionInfo
                    {
                        Action = action
                    };
                    actionInfos.Add(actionInfo);
                }
            }
        }
コード例 #36
0
ファイル: Dispatcher.cs プロジェクト: knocte/Sfx.Mvc
		HttpResponse Invoke(ActionInfo action, MvcContext context)
		{
			// Ejecuta las validaciones de seguridad, HttpPost, etc...
			var response = ExecuteFilters(action, context);
			if(response != null)
			{
				return response;
			}

			var method = action.MethodInfo;
			if(method.IsStatic)
			{
				var parameters = new object[] { context };
				return method.Invoke(null, parameters) as HttpResponse;
			}
			else
			{
				var controller = Activator.CreateInstance(action.ControllerType) as Controller;
				if(controller == null)
				{
					return null;
				}

				controller.Context = context;

				try
				{
					response = method.Invoke(controller, null) as HttpResponse;
				}
				catch(TargetInvocationException ex)
				{
					// interesa únicamente el origen de la excepción
					throw ex.InnerException;
				}

				return response;
			}
		}
コード例 #37
0
        private void OnTimer_UpdateConsecutiveActions(object sender, ElapsedEventArgs e)
        {
            if (_disposed || !_running)
            {
                return;
            }

            Instance._updatingConsecutiveActions = true;
            Instance._timerConsecutive.Stop();
            ActionInfo actionInfo = null;

            Instance._consecutiveActions.TryDequeue(out actionInfo);
            if (Instance._consecutiveActions.Count > 0 && actionInfo == null)
            {
                Instance._timerConsecutive.Start();
                return;
            }

            actionInfo.Callback?.Invoke();

            if (Instance._consecutiveActions.Count > 0)
            {
                actionInfo = null;
                Instance._consecutiveActions.TryPeek(out actionInfo);
                if (actionInfo != null)
                {
                    Instance._currentAction = actionInfo;
                    Instance._currentAction.Action?.Invoke();
                    Instance._timerConsecutive.Interval = Math.Max(_currentAction.Duration * 1000, 1);
                }
                Instance._timerConsecutive.Start();
            }
            else
            {
                Instance._currentAction = null;
            }
            Instance._updatingConsecutiveActions = false;
        }
コード例 #38
0
ファイル: DotvvmPresenter.cs プロジェクト: vstribrny/dotvvm
        public async Task ProcessStaticCommandRequest(IDotvvmRequestContext context)
        {
            try
            {
                JObject postData;
                using (var jsonReader = new JsonTextReader(new StreamReader(context.HttpContext.Request.Body)))
                {
                    postData = JObject.Load(jsonReader);
                }

                // validate csrf token
                context.CsrfToken = postData["$csrfToken"].Value <string>();
                CsrfProtector.VerifyToken(context, context.CsrfToken);

                var command       = postData["command"].Value <string>();
                var arguments     = postData["args"] as JArray;
                var executionPlan =
                    StaticCommandBindingCompiler.DecryptJson(Convert.FromBase64String(command), context.Services.GetService <IViewModelProtector>())
                    .Apply(StaticCommandBindingCompiler.DeserializePlan);

                var actionInfo = new ActionInfo {
                    IsControlCommand = false,
                    Action           = () => { return(ExecuteStaticCommandPlan(executionPlan, new Queue <JToken>(arguments), context)); }
                };
                var filters = context.Configuration.Runtime.GlobalFilters.OfType <ICommandActionFilter>()
                              .Concat(executionPlan.GetAllMethods().SelectMany(m => ActionFilterHelper.GetActionFilters <ICommandActionFilter>(m)))
                              .ToArray();

                var result = await ExecuteCommand(actionInfo, context, filters);

                await OutputRenderer.WriteStaticCommandResponse(context,
                                                                ViewModelSerializer.BuildStaticCommandResponse(context, result));
            }
            finally
            {
                StaticCommandServiceLoader.DisposeStaticCommandServices(context);
            }
        }
コード例 #39
0
        /// <summary>
        /// Retrieve ViewModels from a layout action.
        /// </summary>
        /// <param name="action">An ActionInfo object.</param>
        /// <param name="apis">An ApiList object.</param>
        /// <returns>A list of ViewModels id.</returns>
        public static List <string> GetActionViewModelsId(
            this ActionInfo action,
            ApiList apis)
        {
            var viewModels = new List <string>();

            if (!action.IsValid() ||
                !apis.IsValid())
            {
                return(viewModels);
            }

            var apiAction = action.GetAction();

            if (apiAction.IsValid())
            {
                viewModels = viewModels
                             .Union(apis.GetApiListViewModelsId(apiAction))
                             .ToList();
            }

            return(viewModels);
        }
コード例 #40
0
        public bool EditRoleAction(int rid, int aid, bool isPass)
        {
            RoleInfo roleInfo = CurrentDal.LoadEntites(r => r.ID == rid).FirstOrDefault();

            if (roleInfo == null)
            {
                return(false);
            }


            ActionInfo dbActionInfo = CurrentDBSession.ActionInfoDal.LoadEntites(a => a.ID == aid).FirstOrDefault();

            if (isPass)
            {
                roleInfo.ActionInfo.Add(dbActionInfo);
            }
            else
            {
                roleInfo.ActionInfo.Remove(dbActionInfo);
            }

            return(CurrentDBSession.SaveChanges());
        }
コード例 #41
0
ファイル: ActionInfoController.cs プロジェクト: kiddVS/OA
        public ActionResult AddActionInfo()
        {
            ActionInfo action = new ActionInfo();

            action.ActionInfoName = Request["ActionInfoName"];
            action.ActionTypeEnum = short.Parse(Request["ActionTypeEnum"]);
            action.Remark         = Request["Remark"];
            action.Sort           = Request["Sort"];
            action.MenuIcon       = Request["MenuIcon"];
            action.Url            = Request["Url"];
            action.HttpMethod     = Request["HttpMethod"];
            action.DelFlag        = 0;
            action.SubTime        = DateTime.Now;
            action.ModifiedOn     = DateTime.Now.ToString();
            if (ActionInfoService.AddEntity(action) != null)
            {
                return(Content("Y"));
            }
            else
            {
                return(Content("N"));
            }
        }
コード例 #42
0
        /// <summary>
        /// 对用户权限信息进行修改
        /// </summary>
        /// <param name="actionInfo"></param>
        /// <returns></returns>
        public ActionResult UpdateActionInfo(ActionInfo actionInfo)
        {
            //首先查询出所有的用户权限信息
            ActionInfo editActionInfo = _actioninfoService.Get(c => c.ID == actionInfo.ID).FirstOrDefault();

            if (editActionInfo == null)
            {
                return(Content("修改错误,请您检查"));
            }
            //给要修改的实体对象赋值
            editActionInfo.ActionName      = actionInfo.ActionName;
            editActionInfo.RequestHttpType = actionInfo.RequestHttpType;
            editActionInfo.RequestUrl      = actionInfo.RequestUrl;
            editActionInfo.ActionType      = actionInfo.ActionType;
            //进行修改信息
            var result = _actioninfoService.Update(editActionInfo);

            if (result.Code == ResultEnum.Success && result.Data > 0)
            {
                return(Content("OK"));
            }
            return(Content(result.Msg));
        }
コード例 #43
0
    private bool canActionWithAliveRegion(ActionInfo action)
    {
        EnemyRegionWork[] works = enemy.regionWorks;
        int num = action.useAliveRegionIDs.Find((int id) => id < works.Length && (int)works[id].hp <= 0);

        if (num > 0)
        {
            return(false);
        }
        int num2 = action.useDeadRegionIDs.Find((int id) => (id < works.Length && (int)works[id].hp > 0) || enemy.IsEnableReviveRegion(id));

        if (num2 > 0)
        {
            return(false);
        }
        int num3 = action.useReviveRegionIDs.Find((int id) => !enemy.IsEnableReviveRegion(id));

        if (num3 > 0)
        {
            return(false);
        }
        return(true);
    }
コード例 #44
0
        bool log(IAction action, bool completed, bool reversed, Exception ex)
        {
            var info = new ActionInfo
            {
                ID          = ID,
                BID         = BID,
                Order       = action.Order,
                Data        = action.GetData().Serialize(),
                Result      = action.GetResult().Serialize(),
                Action      = action.GetType().Name,
                Exception   = ex.Serialize(),
                Completed   = (ex == null) && completed,
                Reversed    = (ex == null) && reversed,
                VersionTime = DateTime.Now,
                IsLast      = true
            };

            lock (lockObj)
            {
                actionStore[ID].Actions.Add(info);
            }
            return(true);
        }
コード例 #45
0
    public ActionInfo GetActionInfo(Actor selectedActor)
    {
        if (selectedActor == null)
        {
            Debug.LogError("Invalid param");
            return(null);
        }
        LinkedList <AStarPathNode> path = AStarManager.GetInstance().SearchClosest(GridTransform.Position, selectedActor.GridTransform.Position);

        if (path == null || path.Count <= 0)
        {
            Debug.LogWarning("Couldn't find path to " + selectedActor.GridTransform.Position.ToString());
            return(null);
        }
        if (path.Count - 1 + 2 > Stat.MovePoints.Value)
        {
            Debug.LogWarning("Not enough move points");
            return(null);
        }
        ActionInfo actionInfo = new ActionInfo();

        if (path.Count >= 2)
        {
            if ((possibleActions & ActionType.Walk) == ActionType.Walk)
            {
                actionInfo.ActionList.Add(new MovingAction(path.Count - 1, path));
                actionInfo.ActionList.Add(new AttackAction(2, ActionType.Melee, selectedActor));
                return(actionInfo);
            }
        }
        else
        {
            actionInfo.ActionList.Add(new AttackAction(2, ActionType.Melee, selectedActor));
            return(actionInfo);
        }
        return(null);
    }
コード例 #46
0
        /// <summary>
        /// ��ʾ�˵��д���
        /// </summary>
        /// <param name="menuInfo"></param>
        private Form ExecuteAction(ActionInfo info, bool addToMdiForm = false)
        {
            if (!Authority.IsDeveloper() && !Authority.AuthorizeByRule(info.Access))
            {
                MessageForm.ShowError("��û��ִ�д˶�����Ȩ�ޣ�");
                return null;
            }

            Form form = null;
            switch (info.ActionType)
            {
                case ActionType.Window:
                    WindowInfo windowInfo = ADInfoBll.Instance.GetWindowInfo(info.Window.Name);
                    if (windowInfo == null)
                    {
                        throw new ArgumentException(string.Format("Invalid WindowId of {0} in menuInfo", info.Window.Name));
                    }
                    if (!Authority.IsDeveloper() && !Authority.AuthorizeByRule(windowInfo.Access))
                    {
                        MessageForm.ShowError("��û�д򿪴˴����Ȩ�ޣ�");
                        return null;
                    }

                    //bool opened = OpenOnce(windowInfo.Name);
                    if (m_forms.ContainsKey(windowInfo.Name))
                    {
                        m_forms[windowInfo.Name].Activate();
                        return m_forms[windowInfo.Name];
                    }
                    try
                    {
                        form = ServiceProvider.GetService<IWindowFactory>().CreateWindow(windowInfo) as Form;
                        if (form == null)
                        {
                            return null;
                        }
                        form.Text = windowInfo.Text;
                        if (!string.IsNullOrEmpty(windowInfo.ImageName))
                        {
                            form.Icon = PdnResources.GetIconFromImage(Feng.Windows.ImageResource.Get("Icons." + windowInfo.ImageName + ".png").Reference);
                        }
                    }
                    catch (Exception ex)
                    {
                        ExceptionProcess.ProcessWithNotify(ex);
                    }
                    break;
                case ActionType.Form:
                    FormInfo formInfo = null;
                    if (info.Form != null)
                    {
                        formInfo = ADInfoBll.Instance.GetFormInfo(info.Form.Name);
                    }

                    if (formInfo == null)
                    {
                        throw new ArgumentException("Invalid FormInfo in menuInfo");
                    }
                    if (!Authority.IsDeveloper() && !Authority.AuthorizeByRule(formInfo.Access))
                    {
                        MessageForm.ShowError("��û�д򿪴˴����Ȩ�ޣ�");
                        return null;
                    }

                    //bool opened = OpenOnce(formInfo.Name);
                    if (m_forms.ContainsKey(formInfo.Name))
                    {
                        m_forms[formInfo.Name].Activate();
                        return m_forms[formInfo.Name];
                    }
                    try
                    {
                        form = ArchiveFormFactory.CreateForm(formInfo);
                        if (!string.IsNullOrEmpty(formInfo.Text))
                        {
                            form.Text = formInfo.Text;
                        }
                        if (!string.IsNullOrEmpty(formInfo.ImageName))
                        {
                            form.Icon = PdnResources.GetIconFromImage(Feng.Windows.ImageResource.Get("Icons." + formInfo.ImageName + ".png").Reference);
                        }
                    }
                    catch (Exception ex)
                    {
                        ExceptionProcess.ProcessWithNotify(ex);
                    }

                    break;
                case ActionType.Process:
                    ProcessInfo processInfo = ADInfoBll.Instance.GetProcessInfo(info.Process.Name);
                    ProcessInfoHelper.ExecuteProcess(processInfo);
                    break;
                case ActionType.Url:
                    ProcessHelper.OpenUrl(info.WebAddress);
                    break;
                default:
                    throw new ArgumentException("menuInfo's MenuAction is Invalid");
            }

            if (form != null)
            {
                m_actionInfos[form.Name] = info;

                if (addToMdiForm)
                {
                    ShowChildForm(form as MyChildForm);
                }
            }

            return form;
        }
コード例 #47
0
ファイル: Dispatcher.cs プロジェクト: knocte/Sfx.Mvc
		void InitializeActions()
		{			
			const BindingFlags flags = BindingFlags.IgnoreCase | 
										BindingFlags.Static | 
										BindingFlags.Instance | 
										BindingFlags.Public | 
										BindingFlags.FlattenHierarchy;

			lock(syncLock)
			{
				actions = new Map<ActionInfo>();

				foreach(var assembly in LoadAssemblies())
				{
					foreach(var type in assembly.GetTypes())
					{
						if(IsController(type))
						{
							foreach(var method in type.GetMethods(flags))
							{
								if(IsAction(method))
								{
									var path = GetPath(type, method);
									var action = new ActionInfo();
									action.ControllerType = type;
									action.MethodInfo = method;
									actions.Add(path, action);
								}
							}
						}
					}
				}
			}
		}
コード例 #48
0
ファイル: BattleSystem.cs プロジェクト: ofx360/rpg-project
    void DebugDamageValues(ActionInfo aInfo)
    {
		if(aInfo.isDefending)
		{
			Debug.Log(aInfo.receiver.name + " is Defending");
		}
		if(aInfo.isUsingItem)
		{
			Debug.Log(string.Format("{0} was used on {1}", aInfo.item.name, aInfo.receiver.name)); 
		}
        else if(aInfo.elmtHit)
		{
            Debug.Log(string.Format("<color=Red><b>(Element) {0} got hit for {1} ({2}) by {3}</b></color>", 
                aInfo.receiver.name, aInfo.finalVal, aInfo.receiver.GetStat("HP").baseValue, aInfo.sender.name));
		}
        else if(aInfo.critHit)
		{
            Debug.Log(string.Format("<color=Purple><b>(Crit) {0} got hit for {1} ({2}) by {3}</b></color>", 
                aInfo.receiver.name, aInfo.finalVal, aInfo.receiver.GetStat("HP").baseValue, aInfo.sender.name));
		}
        else           
		{
            Debug.Log(string.Format("{0} got hit for {1} ({2}) by {3}", 
                    aInfo.receiver.name, aInfo.finalVal, aInfo.receiver.GetStat("HP").baseValue, aInfo.sender.name));
		}
    }
コード例 #49
0
ファイル: Dispatcher.cs プロジェクト: knocte/Sfx.Mvc
		static HttpResponse ExecuteFilters(ActionInfo action, MvcContext context)
		{
			// Execute controller filters
			foreach(FilterAttribute filter in action.ControllerType.GetCustomAttributes(typeof(FilterAttribute), true))
			{
				var response = filter.Execute(context);
				if(response != null)
				{
					return response;
				}
			}
			// Execute action filters
			foreach(FilterAttribute filter in action.MethodInfo.GetCustomAttributes(typeof(FilterAttribute), true))
			{
				var response = filter.Execute(context);
				if(response != null)
				{
					return response;
				}
			}
			return null;
		}
コード例 #50
0
        private void AddActionLifeItem(ActionInfo actionLifeItem)
        {
            var sameItems = _actionInfos.Where(x => x.ActionType == actionLifeItem.ActionType);
            if (sameItems != null && sameItems.Count() > 0)
                return;

            _actionInfos.Enqueue(actionLifeItem);
        }
コード例 #51
0
ファイル: ActionDAL.cs プロジェクト: aNd1coder/Wojoz
        /// <summary>
        /// 根据分页获得数据列表
        /// </summary>
        /// <param name="TbFields">返回字段</param>
        /// <param name="strWhere">查询条件</param>
        /// <param name="OrderField">排序字段</param>
        /// <param name="PageIndex">页码</param>
        /// <param name="PageSize">页尺寸</param> 
        /// <param name="TotalCount">返回总记录数</param>
        /// <returns>IList<ActionInfo></returns>
        public IList<ActionInfo> Find(string tbFields, string strWhere, string orderField, int pageIndex, int pageSize, out int totalCount)
        {
			IList<ActionInfo> list = new List<ActionInfo>();
			using (DbCommand cmd = db.GetStoredProcCommand("SP_SqlPagenation"))
			{
				db.AddInParameter(cmd, "@TbName", DbType.String, "Action");
				db.AddInParameter(cmd, "@TbFields", DbType.String, tbFields);
				db.AddInParameter(cmd, "@StrWhere", DbType.String, strWhere);
				db.AddInParameter(cmd, "@OrderField", DbType.String, orderField);
				db.AddInParameter(cmd, "@PageIndex", DbType.Int32, pageIndex);
				db.AddInParameter(cmd, "@PageSize", DbType.Int32, pageSize);
				db.AddOutParameter(cmd, "@Total", DbType.Int32, int.MaxValue);
				using (DataTable dt = db.ExecuteDataSet(cmd).Tables[0])
				{
					if (dt.Rows.Count > 0)
					{
						foreach (DataRow dr in dt.Rows)
						{
							ActionInfo model = new ActionInfo();
							model.LoadFromDataRow(dr);
							list.Add(model);
						}
					}
				}

				totalCount = (int)db.GetParameterValue(cmd, "@Total");
				return list;
			}
		} 
コード例 #52
0
ファイル: ActionDAL.cs プロジェクト: aNd1coder/Wojoz
        /// <summary>
        /// 获得实体
        /// </summary>
        /// <param name="keyValue">编号</param>
        /// <returns>ActionInfo</returns>
        public ActionInfo Get(int keyValue)
        {
            ActionInfo model = null;
			using (DbCommand cmd = db.GetStoredProcCommand("SP_GetRecord"))
			{
				db.AddInParameter(cmd, "@TableName", DbType.String, "Action");
				db.AddInParameter(cmd, "@KeyName", DbType.String, "ActionID");
				db.AddInParameter(cmd, "@KeyValue", DbType.Int32, keyValue);
				using (DataTable dt = db.ExecuteDataSet(cmd).Tables[0])
				{
					if (dt.Rows.Count > 0)
					{
						model = new ActionInfo();
						model.LoadFromDataRow(dt.Rows[0]);
					}
				}
				return model;
			}
        } 
コード例 #53
0
 /// <summary>
 /// Gets actions of the box module.
 /// </summary>
 /// <param name="localePrefs">The localization preferences.</param>
 /// <returns>
 /// Array of <see cref="T:Ferda.Modules.ActionInfo"/>.
 /// </returns>
 public ActionInfo[] GetActions(string[] localePrefs)
 {
     List<ActionInfo> result = new List<ActionInfo>();
     Boxes.Serializer.Localization.IHelper boxLocalization = getLocalization(localePrefs);
     foreach (Boxes.Serializer.Configuration.Action action in this.box.Actions.Values)
     {
         ActionInfo resultItem = new ActionInfo(
             action.Name,
             boxLocalization.Actions[action.Name].Label,
             boxLocalization.Actions[action.Name].Hint,
             BoxInfoHelper.TryGetBinaryFile(ConfigFilesDirectoryPath, action.IconPath, false),
             this.GetActionInfoNeededConnectedSockets(action.Name)
             );
         result.Add(resultItem);
     }
     return result.ToArray();
 }
コード例 #54
0
        private void PersistEvents(EventProcessingContext context, ActionInfo successCallback)
        {
            var persistEvents = new Func<bool>(() =>
            {
                try
                {
                    context.AppendResult = _eventStore.Append(_eventStreamConvertService.ConvertTo(context.EventStream));
                    return true;
                }
                catch (Exception ex)
                {
                    if (ex is ConcurrentException || ex is DuplicateAggregateException)
                    {
                        context.Exception = ex as ENodeException;
                        return true;
                    }
                    _logger.Error(string.Format("{0} raised when persisting events:{1}", ex.GetType().Name, context.EventStream), ex);
                    return false;
                }
            });

            _actionExecutionService.TryAction("PersistEvents", persistEvents, 3, successCallback);
        }
コード例 #55
0
 /// <summary>
 /// Creates a new PerformanceMetricBase object that will update data for the
 /// action described by the given ActionInfo object
 /// </summary>
 /// <param name="info">An ActionInfo object that contains data about the action 
 /// that was called</param>
 public PerformanceMetricBase(ActionInfo info)
 {
     this.actionInfo = info;
 }
コード例 #56
0
 void SelectAction(ActionInfo actionInfo)
 {
     lstAvailableActions.SelectedItem = actionInfo;
     lstAvailableActions.UpdateLayout();
     lstAvailableActions.ScrollIntoView(actionInfo);
     EnableRelevantButtons();
 }
コード例 #57
0
ファイル: Store.cs プロジェクト: BikS2013/bUtility
 bool log(IAction action, bool completed, bool reversed, Exception ex)
 {
     var info = new ActionInfo
     {
         ID = ID,
         BID = BID,
         Order = action.Order,
         Data = action.GetData().Serialize(),
         Result = action.GetResult().Serialize(),
         Action = action.GetType().Name,
         Exception = ex.Serialize(),
         Completed = (ex== null) && completed,
         Reversed = (ex == null) && reversed,
         VersionTime = DateTime.Now,
         IsLast = true
     };
     lock (lockObj)
     {
         actionStore[ID].Actions.Add(info);
     }
     return true;
 }
コード例 #58
0
        private static void TestAction(ActionInfo actionInfo)
        {
            switch (actionInfo.ActionType)
            {
                case ActionType.Window:
                    {
                        WindowInfo windowInfo = ADInfoBll.Instance.GetWindowInfo(actionInfo.Window.Name);
                        if (windowInfo == null)
                        {
                            throw new ArgumentException("Invalid WindowID in menuInfo");
                        }
                        MyChildForm form = null;
                        try
                        {
                            form = ServiceProvider.GetService<IWindowFactory>().CreateWindow(windowInfo) as MyChildForm;
                            form.WindowState = FormWindowState.Maximized;
                            var mdiForm = ServiceProvider.GetService<IApplication>() as TabbedMdiForm;
                            //form.Show();
                            mdiForm.ShowChildForm(form);
                            TestWindow(form);
                        }
                        catch (Exception ex)
                        {
                            ExceptionProcess.ProcessWithNotify(ex);
                        }
                        finally
                        {
                            if (form != null)
                            {
                                form.Close();
                            }
                        }
                    }
                    break;
                case ActionType.Form:
                    {
                        FormInfo formInfo = null;
                        if (actionInfo.Form != null)
                        {
                            formInfo = ADInfoBll.Instance.GetFormInfo(actionInfo.Form.Name);
                        }

                        if (formInfo == null)
                        {
                            throw new ArgumentException("Invalid FormInfo in menuInfo");
                        }
                        Form form = null;
                        try
                        {
                            form = ArchiveFormFactory.CreateForm(formInfo);
                            form.WindowState = FormWindowState.Maximized;
                            var mdiForm = ServiceProvider.GetService<IApplication>() as TabbedMdiForm;
                            //form.Show();
                            if (form is MyChildForm)
                            {
                                mdiForm.ShowChildForm(form as MyChildForm);
                            }
                            else
                            {
                                form.Show();
                            }
                            TestForm(form);
                        }
                        catch (Exception ex)
                        {
                            ExceptionProcess.ProcessWithNotify(ex);
                        }
                        finally
                        {
                            if (form != null)
                            {
                                form.Close();
                            }
                        }
                    }
                    break;
                case ActionType.Process:
                    break;
                case ActionType.Url:
                    break;
                default:
                    throw new ArgumentException("menuInfo's MenuAction is Invalid");
            }
        }
 public PostAndPutRequestSizeMetric(ActionInfo info)
     : base(info)
 {
     this.histogram = Metric.Context(this.actionInfo.ActionType).Histogram(COUNTER_NAME, Unit.Bytes, SamplingType.FavourRecent);
 }
コード例 #60
0
 public int addEvent( Action act, ActionInfo info )
 {
     actions[ counter ] = act;
     infos[ counter ] = info;
     return counter++;
 }