public async void InitMemoryPictures(List <MemoryPictureItem> items) { _memoryPictureItems = items; CurrentStateTextBlock.Text = "开始记忆"; CurrentStateDetailTextBlock.Text = "依次点击图片,记忆此图片位置及点击的顺序"; foreach (var memoryPictureItem in items) { memoryPictureItem.IsPictureEnabled = false; memoryPictureItem.IsPictureVisibile = true; } var memoryPictureListControl = new MemoryPictureListControl(new TrainingStageSetting() { ClickMaxLimit = 3, TrainingStage = TrainingStage.Learning }, new UserTestRecordInfo()); memoryPictureListControl.MemoryPictureItems = items; memoryPictureListControl.PictureMemorized += MemoryPictureList_OnPictureMemorized; MemoryPictureListContentControl.Content = memoryPictureListControl; await Task.Delay(TimeSpan.FromSeconds(2)); foreach (var memoryPictureItem in items) { memoryPictureItem.IsPictureEnabled = true; memoryPictureItem.IsPictureVisibile = false; } }
private void StartLocationMemoryTesting() { var memoryPictureItems = _memoryPictureItems.ToList(); //打乱随机排序 var pictureItems = memoryPictureItems.RandomSort(); //保持一个图片原位置 var memorizedPictureList = GetLastThreeMemorizedPictures(); var random = new Random(); var randomIndex = random.Next(memorizedPictureList.Count); var memoryPictureItem = memorizedPictureList[randomIndex].PictureItem; pictureItems.Remove(memoryPictureItem); pictureItems.Insert(memorizedPictureList[randomIndex].Location, memoryPictureItem); //设置初始状态 pictureItems.ForEach(i => i.IsPictureCovered = true); //初始化图片 //var visibileRandomIndex = random.Next(memorizedPictureList.Count); var visibileRandomPictureItem = memorizedPictureList[0].PictureItem; visibileRandomPictureItem.IsPictureVisibile = true; //添加控件内容 var memoryPictureListControl = new MemoryPictureListControl(new TrainingStageSetting() { ClickMaxLimit = 3, TrainingStage = TrainingStage.LocationTesting }, _currentTestRecordInfo); memoryPictureListControl.MemoryPictureItems = pictureItems; memoryPictureListControl.PictureLocationComfirmed += MemoryPictureList_OnPictureLocationComfirmed; MemoryPictureListContentControl.Content = memoryPictureListControl; }
private async Task StartLearning(bool isFirstLearning = false) { CurrentStateTextBlock.Text = isFirstLearning ? "开始记忆" : "继续记忆"; CurrentStateDetailTextBlock.Text = "依次点击图片,记忆此图片位置及点击的顺序"; var clickMaxLimit = GetClickMaxLimit(); _currentTestRecordInfo = GetTestInfoByClickCount(clickMaxLimit); ResetMemoryPictureListStatus(); var memoryPictureItems = _memoryPictureItems.ToList(); if (isFirstLearning) { //首次显示所有图片 foreach (var memoryPictureItem in memoryPictureItems) { memoryPictureItem.IsPictureEnabled = false; memoryPictureItem.IsPictureVisibile = true; } } var memoryPictureListControl = new MemoryPictureListControl(new TrainingStageSetting() { ClickMaxLimit = clickMaxLimit, TrainingStage = TrainingStage.Learning }, _currentTestRecordInfo); memoryPictureListControl.MemoryPictureItems = memoryPictureItems; memoryPictureListControl.PictureMemorized += MemoryPictureList_OnPictureMemorized; MemoryPictureListContentControl.Content = memoryPictureListControl; //首次显示所有图片后,恢复隐藏 if (isFirstLearning) { await Task.Delay(TimeSpan.FromSeconds(2)); foreach (var memoryPictureItem in memoryPictureItems) { memoryPictureItem.IsPictureEnabled = true; memoryPictureItem.IsPictureVisibile = false; } } }
private void StartSequentialMemoryTest() { var memoryPictureItems = _memoryPictureItems.ToList(); //打乱随机排序 var pictureItems = memoryPictureItems.RandomSort(); //初始化图片 foreach (var memoryPictureItem in pictureItems) { memoryPictureItem.IsPictureVisibile = true; } var memoryPictureListControl = new MemoryPictureListControl(new TrainingStageSetting() { ClickMaxLimit = 3, TrainingStage = TrainingStage.SequentialTesting }, new UserTestRecordInfo()); memoryPictureListControl.MemoryPictureItems = pictureItems; memoryPictureListControl.SequentialSelected += MemoryPictureList_OnSequentialSelected; MemoryPictureListContentControl.Content = memoryPictureListControl; }