private bool PredicateFunc(IUserItem userItem) { if (this.Type != null && this.Type.IsAssignableFrom(userItem.GetType()) == false) { return(false); } if (this.HasParent == true && userItem.Parent == null) { return(false); } if (this.HasChilds == true && userItem.Childs.Any() == false) { return(false); } if (this.IsLeaf == true && userItem.Childs.Any() == true) { return(false); } if (this.TargetToMove != null && CanMove(this.TargetToMove, userItem.Path) == false) { return(false); } if (this.ExcludedItems != null && this.ExcludedItems.Contains(userItem) == true) { return(false); } if (this.Predicate != null && this.Predicate(userItem) == false) { return(false); } return(true); }
protected override void OnHide() { base.OnHide(); RegisterGlobalUIEvent(false); m_currUserItem = null; DataManager.Manager <RideManager>().ValueUpdateEvent -= OnUpdateList; }
public UserState(IUserItem userItem) : this(userItem.UserId) { balance = decimal.Parse(userItem.Balance, System.Globalization.CultureInfo.InvariantCulture); LastChange = userItem.LastChange; currentState = (GameStatus)userItem.CurrentState; }
protected override void OnShow(object data) { base.OnShow(data); m_uWillUseItemNum = 0; DataManager.Manager <RideManager>().ValueUpdateEvent += OnUpdateList; RegisterGlobalUIEvent(true); if (data is UseItemParam) { m_UseItemParam = (UseItemParam)data; switch (m_UseItemParam.type) { case UseItemEnum.None: break; case UseItemEnum.RideExp: m_currUserItem = new RideExpUse(); break; case UseItemEnum.RideFeed: m_currUserItem = new RideFeedUse(); break; case UseItemEnum.MuhonExp: m_currUserItem = new MuhonExpUse(); break; case UseItemEnum.PetLife: InitPetData(UseItemEnum.PetLife); break; case UseItemEnum.PetExp: InitPetData(UseItemEnum.PetExp); break; case UseItemEnum.RideTalent: RideTalentUserItem item = new RideTalentUserItem(); item.CurTalent = (RideManager.RideTalentEnum)m_UseItemParam.customParam; m_currUserItem = item; break; default: break; } InitUI(); if (m_UIGridCreatorBase != null) { m_UIGridCreatorBase.CreateGrids(m_lstUseItemData.Count); } } }
public static void ClassInit(TestContext context) { app = new CremaBootstrapper(); app.Initialize(context, nameof(IUserItem_DispatcherTest)); cremaHost = app.GetService(typeof(ICremaHost)) as ICremaHost; cremaHost.Dispatcher.Invoke(() => { authentication = cremaHost.Start(); userContext = cremaHost.GetService(typeof(IUserContext)) as IUserContext; }); userItem = userContext.Dispatcher.Invoke(() => userContext.Random()); }
public static UserEntity CreateEntity(IUserItem src) { return(new UserEntity { PartitionKey = GetPartitionKey(src.UserId), RowKey = "User", UserId = src.UserId, Balance = src.Balance, CurrentState = src.CurrentState, LastChange = src.LastChange }); }
private void InsertUserBatchAsync() { IUserItem[] userBuffer; lock (this) { userBuffer = new IUserItem[_userCache.Count]; _userCache.CopyTo(userBuffer); _userCache.Clear(); } Thread t = new Thread(new ParameterizedThreadStart(InsertUserBatchTSig)); t.Start(userBuffer); }
private static bool CanMove(IUserItem userItem, string parentPath) { if (userItem.Parent == null) { return(false); } if (userItem.Parent.Path == parentPath) { return(false); } if (NameValidator.VerifyCategoryPath(parentPath) == false) { return(false); } return(parentPath.StartsWith(userItem.Path) == false); }
void IUserServiceCallback.OnUserItemsCreated(SignatureDate signatureDate, string[] itemPaths, UserInfo?[] args) { this.InvokeAsync(() => { var authentication = this.Authenticate(signatureDate); var userItems = new IUserItem[itemPaths.Length]; var categories = new List <UserCategory>(itemPaths.Length); var users = new List <User>(itemPaths.Length); for (var i = 0; i < itemPaths.Length; i++) { var itemPath = itemPaths[i]; if (NameValidator.VerifyCategoryPath(itemPath) == true) { var categoryName = new CategoryName(itemPath); var category = this.Categories.Prepare(itemPath); categories.Add(category); userItems[i] = category; } else { var userInfo = (UserInfo)args[i]; var user = this.Users.BaseAddNew(userInfo.ID, userInfo.CategoryPath); user.Initialize(userInfo, BanInfo.Empty); users.Add(user); userItems[i] = user; } } if (categories.Any() == true) { this.Categories.InvokeCategoriesCreatedEvent(authentication, categories.ToArray()); } if (users.Any() == true) { this.Users.InvokeUsersCreatedEvent(authentication, users.ToArray()); } }, nameof(IUserServiceCallback.OnUserItemsCreated)); }
public void Get_User_Id_Storage_InMemory_Tests_Method() { InMemoryStorage inMemoryStorage = new InMemoryStorage(); Guid guid = Guid.NewGuid(); DateTimeOffset date = DateTimeOffset.Now; DomainUserItem user = new DomainUserItem() { ChatId = 12345678, DateOfRegistration = date, FirstName = "Null", Id = guid, Message = "Null", Status = StatusEnum.Null }; inMemoryStorage.AddUser(user); Assert.AreEqual(inMemoryStorage.Count, 1); IUserItem userItem = inMemoryStorage.GetUser(guid); Assert.AreEqual(inMemoryStorage.Count, 1); Assert.AreEqual(userItem, user); }
public Task SaveUserState(IUserItem userState) { if (userState == null) { return(Task.FromResult(0)); } var existingUser = _userCache.Where(u => u.UserId == userState.UserId).FirstOrDefault(); if (existingUser != null) { _userCache.Remove(existingUser); } _userCache.Add(userState); if (_userCache.Count > _maxBuffer) { InsertUserBatchAsync(); } return(Task.FromResult(0)); }
public Task SaveUserState(IUserItem userState) { throw new NotImplementedException(); }
private static bool DefaultPredicate(IUserItem _) => true;
public BLUserItem(IUserItem UserItemobj) { this.UserItemobj = UserItemobj; }