コード例 #1
0
        public ViewMetadata GetView(string viewId, UserActionType userAction)
        {
            IList <ViewMetadata> views = _serviceContext.ViewMetadata.ToList();
            ViewMetadata         matchedView;

            if (!string.IsNullOrEmpty(viewId))
            {
                matchedView = views.FirstOrDefault(v => v.Name.ToLower().Equals(viewId.ToLower()));
                if (matchedView == null)
                {
                    matchedView = views[0];
                }
            }
            else
            {
                matchedView = views[0];
            }

            switch (userAction)
            {
            case UserActionType.NavigateNext:
                for (int i = 0; i < views.Count(); i++)
                {
                    if (views[i].Name == viewId)
                    {
                        if (i + 1 < views.Count())
                        {
                            return(views[i + 1]);
                        }
                        else
                        {
                            return(views[0]);
                        }
                    }
                }

                break;

            case UserActionType.NavigatePrevious:

                for (int i = 0; i < views.Count(); i++)
                {
                    if (views[i].Name == viewId)
                    {
                        if (i - 1 >= 0)
                        {
                            return(views[i - 1]);
                        }
                        else
                        {
                            return(views[views.Count() - 1]);
                        }
                    }
                }

                break;
            }

            return(matchedView);
        }
コード例 #2
0
        public async Task <IActionResult> DeleteActivityByName(DeleteActivitiesByNameInputModel model)
        {
            if (this.ModelState.IsValid)
            {
                string activityText = model.ActivityName;
                string activityName = string.Join(string.Empty, activityText.Split(" "));

                UserActionType actionValue = (UserActionType)Enum.Parse(typeof(UserActionType), activityName);
                bool           isRemoved   = await this.dbUsageService.RemoveActivitiesByName(actionValue);

                if (isRemoved)
                {
                    this.TempData["Success"] = string.Format(SuccessMessages.SuccessfullyRemoveActionByName, activityText);
                }
                else
                {
                    this.TempData["Error"] = string.Format(ErrorMessages.NoActionsByGivenName, activityText);
                }
            }
            else
            {
                this.TempData["Error"] = ErrorMessages.InvalidInputModel;
                return(this.RedirectToAction("DeleteUsersActivities", "DbUsage", model));
            }

            return(this.RedirectToAction("DeleteUsersActivities", "DbUsage"));
        }
コード例 #3
0
        public async Task CreateAsync(UserAccount user, string description, UserActionType actionType, string data)
        {
            var now = DateTime.UtcNow;
            var nextActionNumber = 1;

            await foreach (var currentAction in _context.UserActions.Where(a => a.UserAccount == user && a.DeletedDateTime == null && a.IsCurrent).OrderBy(a => a.ActionNumber).AsAsyncEnumerable())
            {
                currentAction.IsCurrent          = false;
                currentAction.LastUpdateDateTime = now;
                nextActionNumber = currentAction.ActionNumber + 1;
            }

            await foreach (var redoAction in _context.UserActions.Where(a => a.UserAccount == user && a.DeletedDateTime == null && a.ActionNumber >= nextActionNumber).AsAsyncEnumerable())
            {
                redoAction.DeletedDateTime    = now;
                redoAction.LastUpdateDateTime = now;
            }

            await _context.UserActions.AddAsync(new UserAction
            {
                UserAccount     = user,
                Description     = description,
                ActionType      = actionType,
                UserActionData  = data,
                IsCurrent       = true,
                ActionNumber    = nextActionNumber,
                CreatedDateTime = now
            });

            await _context.SaveChangesAsync();
        }
コード例 #4
0
 public UserAction(UserAction userAction)
 {
     UserId       = userAction.UserId;
     ActionType   = userAction.ActionType;
     Room         = userAction.Room;
     TimeStamp    = userAction.TimeStamp;
     TargetUserId = userAction.TargetUserId;
 }
コード例 #5
0
ファイル: UserAction.cs プロジェクト: johnmensen/TradeSharp
 public UserAction(UserAction userAction)
 {
     UserId = userAction.UserId;
     ActionType = userAction.ActionType;
     Room = userAction.Room;
     TimeStamp = userAction.TimeStamp;
     TargetUserId = userAction.TargetUserId;
 }
コード例 #6
0
        public static int DisplayMenu(Menu menu, bool isBackButton = false)
        {
            int cursorPosition = 0;

            if (isBackButton)
            {
                menu.Options.Add("<---Назад---");
            }
            while (true)
            {
                Console.WriteLine(menu.Text);
                Console.WriteLine("");
                for (int i = 0; i < menu.Options.Count; i++)
                {
                    if (i == cursorPosition)
                    {
                        Console.BackgroundColor = ConsoleColor.Green;
                        Console.ForegroundColor = ConsoleColor.Black;
                        Console.WriteLine(menu.Options[i]);
                        Console.ResetColor();
                    }
                    else
                    {
                        Console.WriteLine(menu.Options[i]);
                    }
                }

                UserActionType action = UserAction();
                if (action == UserActionType.Up)
                {
                    if (cursorPosition == 0)
                    {
                        cursorPosition = menu.Options.Count - 1;
                    }
                    else
                    {
                        cursorPosition--;
                    }
                }
                else if (action == UserActionType.Down)
                {
                    if (cursorPosition == menu.Options.Count - 1)
                    {
                        cursorPosition = 0;
                    }
                    else
                    {
                        cursorPosition++;
                    }
                }
                else if (action == UserActionType.Select)
                {
                    Console.Clear();
                    return(cursorPosition);
                }
                Console.Clear();
            }
        }
コード例 #7
0
        public async Task LogUserActionToDatabaseAsync(ApplicationUser user, UserActionType actionType, string description = null)
        {
            using (var unitOfWork = _serviceProvider.GetService <IUnitOfWork>())
            {
                await unitOfWork.AccountHistoryRepository.LogUserActionToDatabaseAsync(user?.Id, actionType, description);

                await unitOfWork.CompleteAsync();
            }
        }
コード例 #8
0
        public void AcceptDismissAlert(UserActionType acceptance)
        {
            switch (acceptance)
            {
            case UserActionType.ACCEPT:
                AlertBoxUtils.AlertBoxHandler(_driver, true);
                break;

            case UserActionType.DISMISS:
                AlertBoxUtils.AlertBoxHandler(_driver, false);
                break;
            }
        }
コード例 #9
0
        public void WhenIDeleteTheSelectedItemsAndAcceptToConfirm(UserActionType userAction)
        {
            _genericEntityPage.BulkDeleteButton.Click();
            switch (userAction)
            {
            case UserActionType.ACCEPT:
                _modalOnPage.ConfirmDeleteButton.Click();
                break;

            default:
                throw new Exception("Unable to determine required action on Alert box");
            }
        }
コード例 #10
0
 public HudPrompt(UserActionType userAction, string description)
 {
     Description     = description;
     UserAxis        = ActionSetting.InputAxis.None;
     InterfaceAxis   = ActionSetting.InputAxis.None;
     InterfaceAction = InterfaceActionType.NoAction;
     UserAction      = userAction;
     Control         = InputControlType.None;
     Key             = KeyCode.None;
     Mouse           = ActionSetting.MouseAction.None;
     Alpha           = 0f;
     IsEmpty         = false;
 }
コード例 #11
0
        public async Task LogUserActionToDatabaseAsync(string userId, UserActionType actionType, string description)
        {
            userId.ThrowExceptionIfNullOrWhiteSpace(nameof(userId));

            var action = new AccountHistory
            {
                UserId      = userId,
                DateTime    = DateTime.Now,
                ActionType  = actionType.ToString(),
                Description = description
            };

            await AddAsync(action);
        }
コード例 #12
0
        public void TypeAcceptDismissAlert(string text, UserActionType acceptance)
        {
            AlertBoxUtils.WriteToAlertBox(_driver, text);
            switch (acceptance)
            {
            case UserActionType.ACCEPT:
                AlertBoxUtils.AlertBoxHandler(_driver, true);
                break;

            case UserActionType.DISMISS:
                AlertBoxUtils.AlertBoxHandler(_driver, false);
                break;
            }
        }
コード例 #13
0
        public async Task <bool> RemoveActivitiesByName(UserActionType actionValue)
        {
            var allActions = this.db.UserActions.Where(x => x.BaseUserAction.ActionType == actionValue).ToList();

            if (allActions.Count() == 0)
            {
                return(false);
            }

            this.db.UserActions.RemoveRange(allActions);
            await this.db.SaveChangesAsync();

            return(true);
        }
コード例 #14
0
 public void ShowAction(IItemOfInterest ioi, UserActionType action, string description, Transform hudTarget, Camera followCamera)
 {
     SetTargets(ioi, hudTarget, followCamera);
     if (!Prompt1.Visible || Prompt1.UserAction == action)
     {
         Prompt1 = GetBindings(new HudPrompt(action, description));
     }
     else if (!Prompt2.Visible || Prompt2.UserAction == action)
     {
         Prompt2 = GetBindings(new HudPrompt(action, description));
     }
     else
     {
         //Debug.Log("Couldn't add prompt, both prompt already visible");
     }
 }
コード例 #15
0
        public void IPerformActionOnConfirmationBox(UserActionType userAction)
        {
            switch (userAction)
            {
            case UserActionType.ACCEPT:
                AlertBoxUtils.AlertBoxHandler(_driver, true);
                break;

            case UserActionType.DISMISS:
            case UserActionType.CLOSE:
                AlertBoxUtils.AlertBoxHandler(_driver, false);
                break;

            default:
                throw new Exception("Unable to determine required action on Alert box");
            }
        }
コード例 #16
0
        void logAction(FrameworkElement cmdItem, object content, UserActionType actionType)
        {
            var dataContext = getDataContext(cmdItem);

            if (dataContext == null)
            {
                return;
            }
            var actionData = new UserActionData()
            {
                UserName   = UserManager.Instance.CurrentUser.UserName,
                Time       = DateTime.Now,
                ActionType = actionType,
                Name       = getData(content, i => i.ToString()),
                Content    = getData(dataContext, i => i.GetType().FullName),
                ToolTip    = getData(cmdItem.ToolTip, i => i.ToString()),
            };

            _subject.OnNext(actionData);
        }
コード例 #17
0
        /// <summary>
        /// Records a user action and returns record Id. Returns 0 when email is invalid.
        /// </summary>
        /// <param name="email"></param>
        /// <param name="type"></param>
        /// <returns>Id of new record or 0</returns>
        public int RecordAction(string email, UserActionType type)
        {
            var userId = db.Users.FirstOrDefault(x => x.Email == email)?.Id;

            if (String.IsNullOrWhiteSpace(userId))
            {
                return(0);
            }

            var newUserAction = new UserAction
            {
                ApplicationUserId = userId,
                Date = DateTime.Now,
                Type = type
            };

            db.UserActions.Add(newUserAction);

            db.SaveChanges();

            return(newUserAction.Id);
        }
コード例 #18
0
 public static extern void myo_notify_user_action(IntPtr myo, UserActionType type, IntPtr error);
コード例 #19
0
 public void ShowActions(InterfaceActionType action1, UserActionType action2, string description1, string description2, Transform hudTarget, Camera followCamera)
 {
     ShowActions(null, action1, action2, description1, description2, hudTarget, followCamera);
 }
コード例 #20
0
ファイル: UserAction.cs プロジェクト: szecsenyiferenc/poker
 public UserAction(PokerUser pokerUser, UserActionType userActionType)
 {
     PokerUser      = pokerUser;
     UserActionType = userActionType;
 }
コード例 #21
0
 public async Task LogVideoAction(int?userId, long videoId, UserActionType actionType)
 {
     await ExecuteActionAsync($"insert into user_actions(tenant_id,video_id,user_id,action_type_id) values({GET_TENANT_QUERY},{videoId},{userId},{(int) actionType})");
 }
コード例 #22
0
 public void ShowActions(IItemOfInterest ioi, InterfaceActionType action1, UserActionType action2, string description1, string description2, Transform hudTarget, Camera followCamera)
 {
     SetTargets(ioi, hudTarget, followCamera);
     Prompt1 = GetBindings(new HudPrompt(action1, description1));
     Prompt2 = GetBindings(new HudPrompt(action2, description2));
 }
コード例 #23
0
ファイル: UserAction.cs プロジェクト: ALFAcaRUS/Asteroids
 public UserAction(UserActionType action, int count)
 {
     ActionType = action;
     Count      = count;
 }
コード例 #24
0
ファイル: UserAction.cs プロジェクト: erisonliang/Blaze
 public bool IsType(UserActionType type)
 {
     return((_type & type) == type);
 }
コード例 #25
0
ファイル: UserAction.cs プロジェクト: szecsenyiferenc/poker
 public UserAction(PokerUser pokerUser, UserActionType userActionType, int value) : this(pokerUser, userActionType)
 {
     Value = value;
 }
コード例 #26
0
ファイル: Dto.cs プロジェクト: MaratBR/HCI_ASPNET_YodaIM
 public static UserActionDto CreateUserAction(int userId, Guid roomId, UserActionType type) => new UserActionDto
 {
     ActionType = type,
     UserId     = userId,
     RoomId     = roomId
 };
コード例 #27
0
 public async Task LogUserActionToDatabaseAsync(ApplicationUser user, UserActionType actionType, string description = null)
 {
     await _accountManager.LogUserActionToDatabaseAsync(user, actionType, description);
 }
コード例 #28
0
 public void ShowAction(UserActionType action, string description, Transform hudTarget, Camera followCamera)
 {
     ShowAction(null, action, description, hudTarget, followCamera);
 }
コード例 #29
0
 public UserGuideActionArgs(UserActionType action)
 {
     this.UserAction = action;
 }
コード例 #30
0
ファイル: libmyo.cs プロジェクト: Vuwij/Keyboard
		public static extern void myo_notify_user_action(IntPtr myo, UserActionType type, IntPtr error);
コード例 #31
0
 public UserActionCreateDTO(int userID, UserActionType type)
 {
     FK_UserID = userID;
     Type      = type;
     Date      = DateTime.Now;
 }